/* Version: cr1.2.0 */
:root {
    --font-sans: 'Noto Sans KR', 'Noto Sans JP', 'Noto Sans SC', 'Noto Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "PingFang SC", "Hiragino Sans", "Meiryo", "Microsoft YaHei", Arial, sans-serif;
    --font-serif: 'Noto Serif KR', 'Noto Serif JP', 'Noto Serif SC', 'Noto Serif', 'Songti SC', 'Yu Mincho', 'Batang', Georgia, serif;
    --bg-color: #000000;
    --card-bg: rgba(255, 255, 255, 0.05);
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --accent-gold: #d4af37;
    --flower-glow: 0 0 15px rgba(255, 255, 255, 0.6);
    --modal-bg: #1e1e1e;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    display: flex;
    justify-content: center;
    min-height: 100vh;
}

button, input, select, textarea {
    font-family: inherit;
}

/* iOS Input Zoom Fix */
@media screen and (-webkit-min-device-pixel-ratio:0) {

    select,
    textarea,
    input {
        font-size: 16px !important;
    }
}

.site-logo {
    display: block;
    margin: 0 auto 10px;
    max-height: 50px;
    /* Adjust based on logo design */
    width: auto;
    object-fit: contain;
}

.app-container {
    width: 100%;
    max-width: 480px;
    /* Mobile-first approach restricted width for clearer layout on desktop */
    background-color: #000000;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    padding: 0.5rem 0.6rem;
    margin: 0 auto;
    /* Centering */
}

/* PC Responsive */
@media (min-width: 1025px) {
    .app-container {
        max-width: 1200px;
        /* Expand on PC */
    }
}

/* Header */
header {
    text-align: center;
    margin-bottom: 0px;
    border-bottom: none;
    padding-bottom: 0px;
    padding-top: calc(env(safe-area-inset-top, 0px) + 48px) !important;
}

.top-bar {
    position: fixed !important;
    top: 0 !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: 100% !important;
    max-width: 480px !important;
    height: calc(env(safe-area-inset-top, 0px) + 48px) !important;
    z-index: 10050 !important;
    background: #000000 !important;
    box-sizing: border-box !important;
    padding: calc(env(safe-area-inset-top, 0px) + 6px) 8px 6px 8px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 5px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

@media (min-width: 1025px) {
    .top-bar {
        max-width: 1200px !important;
    }
}

.sub-title {
    color: var(--accent-gold);
    font-size: 0.8rem;
    letter-spacing: 1px;
    margin-bottom: 0.2rem;
}

.deceased-name {
    font-size: 1.35rem;
    font-weight: 600;
    margin-bottom: 0.15rem;
}

.dates {
    color: var(--text-secondary);
    font-size: 0.78rem;
}

/* Memorial Altar (Unified Grid) */
.memorial-altar {
    display: grid;
    /* Use var(--grid-cols) set by JS, default to 14 */
    /* minmax(34px, 1fr): Ensures columns don't get too small on mobile, forcing scroll */
    grid-template-columns: repeat(var(--grid-cols, 14), minmax(28px, 1fr));
    gap: 0;
    margin-bottom: 0.8rem;
    background: #111;
    border: 1px solid #333;
    padding: 0;
    /* Remove container padding for complete edge-to-edge look */
    position: relative;
    max-width: 100%;

    /* Horizontal Scroll for Mobile */
    overflow-x: auto;
    overflow-y: hidden;
    /* Lock vertical */
    scrollbar-width: thin;
    /* Firefox */
    scrollbar-color: var(--accent-gold) #1a1a1a;

    /* Smooth Touch Scroll */
    -webkit-overflow-scrolling: touch;
}

/* Custom Scrollbar for Webkit */
.memorial-altar::-webkit-scrollbar {
    height: 6px;
}

.memorial-altar::-webkit-scrollbar-track {
    background: #1a1a1a;
}

.memorial-altar::-webkit-scrollbar-thumb {
    background-color: var(--accent-gold);
    border-radius: 3px;
}

/* Portrait Placement */
.portrait-container {
    /* Grid positions are now set via Inline Styles in JS */
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    position: relative;
    /* Added for absolute positioning of incense */
}

/* Incense Burner Styles */
.incense-container {
    position: relative;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
}

.incense-bowl {
    width: 40px;
    height: 25px;
    background: radial-gradient(circle at 30% 30%, #daa520, #8b4500);
    border-radius: 0 0 20px 20px;
    box-shadow: inset 0 -2px 5px rgba(0, 0, 0, 0.5), 0 5px 10px rgba(0, 0, 0, 0.6);
    border-top: 3px solid #ffd700;
    position: relative;
}

/* Incense Legs (Tripod style) */
.incense-leg {
    position: absolute;
    width: 8px;
    height: 12px;
    background: #8b4500;
    bottom: -8px;
    border-radius: 0 0 5px 5px;
}

.leg-left {
    left: 5px;
    transform: rotate(10deg);
}

.leg-right {
    right: 5px;
    transform: rotate(-10deg);
}

.leg-back {
    left: 50%;
    transform: translateX(-50%) scale(0.8);
    bottom: -6px;
    z-index: -1;
    opacity: 0.8;
}

.incense-bowl::after {
    /* Incense stick */
    content: '';
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 3px;
    height: 15px;
    background: #5d4037;
}

/* Smoke Styles */
.smoke-plume {
    position: absolute;
    bottom: 35px;
    left: 50%;
    width: 80px;
    /* Wider plume */
    height: 400px;
    /* Even taller to definitely go over */
    transform: translateX(-50%);
    pointer-events: none;
    overflow: visible;
    display: flex;
    justify-content: center;
}

.smoke {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    /* Whiter and more opaque start */
    background: radial-gradient(circle, rgba(255, 255, 255, 0.9) 0%, rgba(240, 240, 240, 0.2) 80%);
    filter: blur(6px);
    /* Slightly less blur for definition */
    opacity: 0;
    animation: rise-wavy 6s infinite ease-out;
}

/* 3 Distinct Strands */
.smoke:nth-child(1) {
    animation-delay: 0s;
    width: 20px;
    height: 35px;
    animation-duration: 5.5s;
    --sway-dir: 1;
}

.smoke:nth-child(2) {
    animation-delay: 2.0s;
    width: 30px;
    height: 55px;
    animation-duration: 6.5s;
    --sway-dir: -1;
}

.smoke:nth-child(3) {
    animation-delay: 4.0s;
    width: 25px;
    height: 45px;
    animation-duration: 7s;
    --sway-dir: 0.5;
}

@keyframes rise-wavy {
    0% {
        transform: translateX(-50%) translateY(0) scale(0.5);
        opacity: 0;
    }

    10% {
        opacity: 0.6;
        /* More visible at start */
    }

    40% {
        transform: translateX(calc(-50% + 25px * var(--sway-dir))) translateY(-150px) scale(2);
        opacity: 0.7;
        /* Peak opacity higher */
    }

    70% {
        transform: translateX(calc(-50% - 25px * var(--sway-dir))) translateY(-280px) scale(3);
        opacity: 0.4;
        /* Fade slower */
    }

    100% {
        transform: translateX(calc(-50% + 15px * var(--sway-dir))) translateY(-400px) scale(5);
        opacity: 0;
    }
}




.frame {
    position: relative;
    width: 100%;
    height: 100%;
    background: linear-gradient(145deg, #2a2a2a, #111);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
    border-radius: 2px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    border: 3px solid var(--accent-gold);
    /* Gold Border */
}

.portrait {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: sepia(30%) contrast(1.1);
    cursor: pointer;
    transition: filter 0.3s;
}

.portrait.hidden {
    display: none;
}

.portrait:hover {
    filter: sepia(0%) contrast(1.0) brightness(1.1);
}

/* Compact Flowers */
.flower-item {
    width: 100%;
    height: 100%;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0.3;
    filter: grayscale(90%);
    padding: 0;
    /* REMOVED PADDING: Flowers will touch */
    /* Inner padding so flowers don't touch edges physically but boxes do */
    box-sizing: border-box;
    aspect-ratio: 1;
    /* Force Square */
    overflow: hidden;
    /* Clip the Scaled Image so it stays inside box */
    /* Optional: hairline border to visually separate if needed, but user asked for "no gap" */
    /* border: 0.5px solid rgba(255,255,255,0.05); */
}

.flower-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* OR cover if we want them to fill the box completely rectangle */
    /* object-fit: cover; Might cut off petals. Contain is safer for icon. */
    transform: scale(1.0);
    /* Zoom in on the flower */
    /* Slight scale up to overlap edges if image has whitespace */
}

.flower-item.purchased {
    opacity: 1;
    filter: grayscale(0%);
    /* transform: scale(1.35);  REMOVED to prevent double-scaling (img is already scaled) */
    transform: scale(1.0);
    /* Reset to 1.0 just to be safe, or remove entirely if trusted */
    /* No scale up to prevent overlap z-fighting */
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.45));
    z-index: 1;
    /* Bring purchased to front slightly */
}

.flower-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    z-index: 2;
}

/* Donation Section */
.donation-section {
    margin-bottom: 1.2rem;
    text-align: center;
}

/* Guestbook Section */
.guestbook-section {
    margin-bottom: 1.4rem;
    position: relative;
}

.guestbook-section h2 {
    font-size: 1.05rem;
    margin-top: 0;
    margin-bottom: 0.6rem;
    color: var(--accent-gold);
    font-weight: 600;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

.guestbook-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 1rem;
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.14);
    padding: 1rem;
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.guestbook-form input,
.guestbook-form textarea {
    width: 100%;
    padding: 11px 13px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #fff;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.92rem;
    box-sizing: border-box;
    transition: all 0.2s ease;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.guestbook-form input:focus,
.guestbook-form textarea:focus {
    background: rgba(0, 0, 0, 0.6);
    border-color: var(--accent-gold);
    outline: none;
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.3);
}

.guestbook-form textarea::placeholder,
.guestbook-form input::placeholder {
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.88rem;
}

.user-id-display {
    color: var(--accent-gold);
    font-size: 0.9rem;
    margin-bottom: 5px;
    font-weight: 600;
}

.guestbook-form textarea {
    resize: vertical;
    min-height: 72px;
}

.submit-btn {
    align-self: flex-end;
    background: linear-gradient(135deg, #d4af37 0%, #aa8010 100%);
    color: #111;
    border: none;
    padding: 9px 24px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.92rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
    transition: all 0.2s ease;
}

.submit-btn:hover {
    filter: brightness(1.15);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(212, 175, 55, 0.45);
}

.message-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 320px;
    overflow-y: auto;
    padding-right: 4px;
}

.message-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 14px 16px;
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-left: 3px solid var(--accent-gold);
    border-radius: 4px 12px 12px 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.msg-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.msg-body {
    font-size: 0.95rem;
    color: var(--text-primary);
}

.bank-info-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    margin-top: 1rem;
}

.bank-name {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.account-number {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0.5rem 0 1rem;
    letter-spacing: 1px;
}

.copy-btn {
    background: transparent;
    border: 1px solid var(--accent-gold);
    color: var(--accent-gold);
    padding: 8px 20px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
}

.copy-btn:hover {
    background: var(--accent-gold);
    color: #000;
}

.toast {
    visibility: hidden;
    min-width: 200px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 4px;
    padding: 10px;
    position: fixed;
    z-index: 100;
    left: 50%;
    bottom: 30px;
    transform: translateX(-50%);
    font-size: 0.9rem;
}

.toast.show {
    visibility: visible;
    animation: fadein 0.5s, fadeout 0.5s 2.5s;
}

@keyframes fadein {
    from {
        bottom: 0;
        opacity: 0;
    }

    to {
        bottom: 30px;
        opacity: 1;
    }
}

@keyframes fadeout {
    from {
        bottom: 30px;
        opacity: 1;
    }

    to {
        bottom: 0;
        opacity: 0;
    }
}

/* Memory Wall */
.memory-wall {
    margin-bottom: 3rem;
}

.upload-controls {
    text-align: center;
    margin-bottom: 1rem;
    display: flex;
    justify-content: center;
    gap: 10px;
}

.name-input {
    padding: 10px;
    border-radius: 4px;
    border: 1px solid #444;
    background: #222;
    color: #fff;
    width: 120px;
}

.upload-btn {
    display: inline-block;
    background: #333;
    color: #fff;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s;
    border: 1px solid #444;
}

.upload-btn:hover {
    background: #444;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
}

.gallery-item {
    aspect-ratio: 1;
    background: #222;
    overflow: hidden;
    border-radius: 4px;
    position: relative;
    /* For referencing absolute caption */
}

.gallery-item img,
.gallery-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 0.8rem;
    padding: 5px;
    text-align: center;
    backdrop-filter: blur(2px);
}

/* Live Stream */
.live-stream-section {
    margin-bottom: 3rem;
    text-align: center;
}

.video-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    margin-top: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid #333;
}

.video-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
    /* Hidden until active */
}

.video-container video.active {
    display: block;
}

.video-placeholder {
    color: #888;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.connect-btn {
    background: rgba(255, 255, 255, 0.08);
    color: #888;
    border: 1px solid #444;
    padding: 10px 25px;
    border-radius: 30px;
    font-size: 1rem;
    cursor: pointer;
    font-weight: 600;
    box-shadow: none;
    transition: background 0.2s;
}

.connect-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #aaa;
}

.secondary-btn {
    background: transparent;
    border: 1px solid #666;
    color: #ccc;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    margin-top: 10px;
}

.secondary-btn:hover {
    border-color: #fff;
    color: #fff;
}

.camera-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 150px;
    overflow-y: auto;
    width: 250px;
}

.cam-btn {
    background: #333;
    border: 1px solid #444;
    color: #fff;
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cam-btn:hover {
    background: #444;
}

.small-text {
    font-size: 0.85rem;
    color: #aaa;
    margin-bottom: 10px;
}

.live-indicator {
    position: absolute;
    top: 15px;
    left: 15px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.live-indicator.hidden {
    display: none;
}

.red-dot {
    width: 8px;
    height: 8px;
    background-color: #f44336;
    border-radius: 50%;
    display: inline-block;
    animation: blink 1.5s infinite;
}

@keyframes blink {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }

    100% {
        opacity: 1;
    }
}

/* Header Edit */
.header-content {
    position: relative;
    display: inline-block;
}

.edit-info-btn {
    background: transparent;
    border: 1px solid #444;
    color: #666;
    font-size: 0.72rem;
    padding: 3px 8px;
    border-radius: 12px;
    cursor: pointer;
    margin-top: 4px;
    transition: all 0.2s;
}

.edit-info-btn:hover {
    border-color: var(--accent-gold);
    color: var(--accent-gold);
}

/* Modal Inputs */
.input-group {
    text-align: left;
    margin-bottom: 15px;
}

.input-group label {
    display: block;
    color: #aaa;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.input-group input {
    width: 100%;
    padding: 10px;
    background: #222;
    border: 1px solid #444;
    color: #fff;
    border-radius: 4px;
}

/* Login Overlay */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;

    /* Reveal animation */
    transition: opacity 0.8s ease, visibility 0.8s;
    opacity: 1;
    visibility: visible;
}

.login-overlay.fade-out {
    opacity: 0;
    visibility: hidden;
}

.login-card {
    background: #000000;
    padding: 2.5rem;
    border-radius: 12px;
    text-align: center;
    border: 1px solid #333;
    box-shadow: 0 0 30px rgba(212, 175, 55, 0.1);
    max-width: 90%;
    width: 350px;
}

.login-card h2 {
    color: var(--accent-gold);
    margin-bottom: 0.5rem;
    border: none;
    font-size: 1.5rem;
}

.login-card p {
    color: #888;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.login-input-group input {
    width: 100%;
    padding: 12px;
    margin-bottom: 10px;
    background: #000000;
    border: 1px solid #444;
    color: #fff;
    border-radius: 6px;
    font-size: 1rem;
}

.login-btn {
    width: 100%;
    padding: 12px;
    background: var(--accent-gold);
    color: #000;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    margin-top: 10px;
    transition: background 0.3s;
}

.login-btn:hover {
    background: #c5a028;
}

/* Social Login */
.social-login {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.social-btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.2s;
}

.social-btn:hover {
    filter: brightness(0.9);
}

.social-btn.kakao {
    background: #FEE500;
    color: #000;
}

.social-btn.naver {
    background: #03C75A;
    color: #fff;
}

.social-btn.google {
    background: #fff;
    color: #444;
    border: 1px solid #ddd;
}

/* Divider */
.divider {
    position: relative;
    margin: 20px 0;
    text-align: center;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 1px;
    background: #333;
    z-index: 0;
}

.divider span {
    position: relative;
    background: #000000;
    padding: 0 10px;
    color: #666;
    font-size: 0.8rem;
    z-index: 1;
}

/* Footer */
footer {
    text-align: center;
    color: #555;
    font-size: 0.7rem;
    margin-top: auto;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--modal-bg);
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    max-width: 90%;
    width: 320px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-height: 90vh;
    overflow-y: auto;
}

.flower-preview img {
    width: 120px;
    /* Increased from 80px */
    margin: 1.5rem 0;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.btn-cancel,
.btn-confirm {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
}

.btn-cancel {
    background: transparent;
    color: #aaa;
}

.btn-confirm {
    background: var(--accent-gold);
    color: #000;
    font-weight: 600;
}

.hidden {
    display: none !important;
}

/* ==========================================
   9. Theme Selector & Active Theme Styles
   ========================================== */
.theme-selection-section {
    margin-bottom: 1.5rem;
    background: var(--card-bg);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.theme-title {
    font-size: 0.95rem;
    color: var(--accent-gold);
    margin-bottom: 12px;
    text-align: center;
    letter-spacing: 1px;
    font-weight: 600;
}

.theme-selector {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 5px 0 10px 0;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-gold) #1a1a1a;
}

.theme-selector::-webkit-scrollbar {
    height: 4px;
}

.theme-selector::-webkit-scrollbar-track {
    background: #111;
}

.theme-selector::-webkit-scrollbar-thumb {
    background: var(--accent-gold);
    border-radius: 2px;
}

.theme-option {
    flex: 0 0 80px;
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid transparent;
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
}

.theme-option:hover {
    background: rgba(255, 255, 255, 0.08);
}

.theme-option.active {
    border-color: var(--accent-gold);
    background: rgba(212, 175, 55, 0.1);
}

.theme-preview-box,
.theme-preview-img {
    width: 60px;
    height: 45px;
    border-radius: 4px;
    object-fit: cover;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #222;
    border: 1px solid #444;
}

.theme-preview-box.default-preview {
    font-size: 1.5rem;
    background: #111;
}

.theme-name {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    text-align: center;
}

.theme-option.active .theme-name {
    color: #fff;
    font-weight: 600;
}

/* Theme Altar Overrides */
.memorial-altar.theme-active {
    display: block !important;
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    padding: 0;
    min-height: auto !important;
    max-height: none !important;
}

.altar-theme-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 5;
    pointer-events: none;
}

.memorial-altar.theme-active .portrait-container {
    position: absolute !important;
    top: 41%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24.5%;
    height: 35.5%;
    grid-column: auto !important;
    grid-row: auto !important;
    display: block;
    z-index: 2; /* Render behind the background template's frame overlay */
}

.memorial-altar.theme-active .portrait-container.placeholder-active {
    z-index: 8 !important; /* Higher than theme overlay (z-index 5) so placeholder text is always visible */
}

.memorial-altar.theme-active .frame {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    border-radius: 0;
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.memorial-altar.theme-active .portrait {
    filter: none !important;
    object-fit: cover;
    width: 100%;
    height: 100%;
    transform-origin: center center;
    position: absolute;
    top: 0;
    left: 0;
}

.portrait-click-trigger {
    position: absolute !important;
    top: 41%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24.5%;
    height: 35.5%;
    z-index: 10;
    cursor: pointer;
    background: rgba(255, 255, 255, 0);
}

/* Upload Placeholder inside Altar Frame */
.upload-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--accent-gold);
    pointer-events: auto;
    z-index: 8;
    text-align: center;
    background: rgba(0, 0, 0, 0.65);
    border: 1px dashed var(--accent-gold);
    box-sizing: border-box;
    width: 94%;
    height: 94%;
    padding: 4px;
    border-radius: 4px;
}

.upload-placeholder .upload-text {
    font-size: 0.52rem;
    font-weight: bold;
    color: var(--accent-gold);
    white-space: normal;
    word-break: keep-all;
    line-height: 1.25;
    display: block;
    max-width: 100%;
}

.phone-device-wrapper .upload-placeholder .upload-text {
    font-size: 0.52rem !important;
}

@media (max-width: 800px) {
    .upload-placeholder .upload-text {
        font-size: 0.52rem;
    }
}

@media (max-width: 480px) {
    .upload-placeholder .upload-text {
        font-size: 0.52rem;
    }
}

@media (max-width: 360px) {
    .upload-placeholder .upload-text {
        font-size: 0.46rem;
    }
}

.upload-placeholder.hidden {
    display: none !important;
}

.upload-icon {
    font-size: 1.5rem;
    margin-bottom: 4px;
}

/* Photo Control Box Overlay & Bounding Border */
.photo-control-box {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    transform: none !important;
    z-index: 12;
    border: 1.5px dashed var(--accent-gold);
    box-sizing: border-box;
    pointer-events: none; /* Let pan events pass to trigger overlay */
    transition: opacity 0.3s ease;
    opacity: 1;
}

.photo-control-box.hidden {
    display: none !important;
}

/* Corner Resize Handles */
.resize-handle {
    position: absolute;
    width: 14px;
    height: 14px;
    background-color: #fff;
    border: 2px solid var(--accent-gold);
    border-radius: 50%;
    pointer-events: auto; /* Active cursor for resize drag */
    z-index: 15;
}

.resize-handle.top-left {
    top: -7px;
    left: -7px;
    cursor: nwse-resize;
}

.resize-handle.top-right {
    top: -7px;
    right: -7px;
    cursor: nesw-resize;
}

.resize-handle.bottom-left {
    bottom: -7px;
    left: -7px;
    cursor: nesw-resize;
}

.resize-handle.bottom-right {
    bottom: -7px;
    right: -7px;
    cursor: nwse-resize;
}

.photo-control-box.fade-out-outline {
    opacity: 0 !important;
    pointer-events: none !important;
}

.photo-control-box.fade-out-outline .resize-handle {
    pointer-events: none !important;
}

/* Fullscreen Virtual Space Overlays */
.virtual-overlay {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 48px) !important;
    left: 0;
    width: 100vw;
    height: calc(100vh - env(safe-area-inset-top, 0px) - 48px) !important;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    z-index: 1000 !important;
    display: flex;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
    padding: 20px !important;
}

.virtual-overlay.hidden {
    display: none !important;
}

.virtual-card {
    background: linear-gradient(135deg, #1e1e1e 0%, #121212 100%);
    border: 1px solid var(--accent-gold);
    border-radius: 12px;
    width: 90%;
    max-width: 950px;
    height: 85vh;
    display: flex;
    flex-direction: column;
    padding: 25px;
    box-sizing: border-box;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    overflow: hidden;
}

.virtual-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(218, 165, 32, 0.2);
    padding-bottom: 15px;
    margin-bottom: 15px;
}

.virtual-header h2 {
    color: var(--accent-gold);
    font-size: 1.5rem;
    margin: 0;
    border: none;
    padding: 0;
}

.close-overlay-btn {
    background: transparent;
    border: 1px solid var(--accent-gold);
    color: var(--accent-gold);
    padding: 5px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s ease;
}

.close-overlay-btn:hover {
    background: var(--accent-gold);
    color: #000;
}

.close-overlay-image-btn {
    background: none !important;
    border: none !important;
    padding: 0 !important;
    cursor: pointer !important;
    width: 28px !important;
    height: 28px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: transform 0.2s ease !important;
    box-shadow: none !important;
}

.close-overlay-image-btn:hover {
    transform: scale(1.1) !important;
    background: none !important;
}

.virtual-desc {
    color: #ccc;
    font-size: 0.9rem;
    margin-bottom: 20px;
    line-height: 1.4;
}

/* 🌳 자연장 (Natural Burial) Styles */
.burial-container {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    border: 1px solid #333;
    background: #111;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.burial-landscape {
    position: relative;
    width: 100%;
    max-width: 600px;
    aspect-ratio: 1 / 1;
    background-image: url('natural_burial_bg.png');
    background-size: cover;
    background-position: center top;
    border: 2px solid var(--accent-gold);
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0,0,0,0.6);
    overflow: hidden;
}

.grave-plot {
    position: absolute;
    width: 90px;
    height: 90px;
    transform: translate(-50%, -50%);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    transition: all 0.3s ease;
    box-sizing: border-box;
    z-index: 10;
}

.grave-plot,
.grave-plot * {
    pointer-events: auto !important;
    cursor: pointer !important;
}

.grave-plot:hover {
    transform: translate(-50%, -50%) scale(1.08);
}

.grave-plot.owned {
    background: transparent;
    border: none;
    border-radius: 0;
}

.grave-plot.owned .grave-icon {
    font-size: 1.3rem;
}

.grave-plot .grave-icon {
    font-size: 1.1rem;
}

.grave-plot .grave-name {
    font-size: 0.62rem;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 1px 2px #000;
    margin-top: 1px;
    max-width: 48px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.grave-plot .grave-deco-indicators {
    display: flex;
    gap: 2px;

    font-size: 0.65rem;
    margin-top: 1px;
}

/* 🏛️ 봉안당 (Columbarium) Styles */
.columbarium-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    background: #000000 !important;
    overflow: hidden;
    padding: 0;
}

.room-3d-viewport {
    perspective: 1200px;
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    user-select: none;
}

.room-3d {
    width: 420px;
    height: 420px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.19, 1, 0.22, 1);
    transform: translateZ(-300px);
    cursor: grab;
}

.room-3d:active {
    cursor: grabbing;
}

.room-wall {
    position: absolute;
    width: 420px;
    height: 420px;
    background: transparent !important;
    border: none !important;
    box-sizing: border-box;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 12px;
    padding: 15px;
    backface-visibility: visible;
    box-shadow: none !important;
}

/* 4 Walls Configuration */
.wall-front  { transform: rotateY(0deg) translateZ(210px); }
.wall-right  { transform: rotateY(90deg) translateZ(210px); }
.wall-back   { transform: rotateY(180deg) translateZ(210px); }
.wall-left   { transform: rotateY(-90deg) translateZ(210px); }

/* 3D Niche Styles */
.niche-cell {
    aspect-ratio: 1;
    background: transparent !important;
    border: none !important;
    border-radius: 2px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    padding: 6px;
    box-sizing: border-box;
    transition: all 0.3s ease;
    box-shadow: none !important;
}



.niche-cell:hover {
    border-color: var(--accent-gold);
    box-shadow: inset 0 6px 12px rgba(0,0,0,0.85), 0 0 15px rgba(212,175,55,0.4);
}

.niche-cell-portrait {
    width: 26px;
    height: 35px;
    border: 1px solid #8d6e63;
    border-radius: 1px;
    background: #000;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}

.niche-cell-portrait img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.niche-cell:hover {
    border-color: var(--accent-gold);
    box-shadow: 0 0 8px rgba(218,165,32,0.6);
    transform: scale(1.05);
    z-index: 20;
}

.niche-cell.owned {
    border-color: var(--accent-gold);
    background: linear-gradient(145deg, #1f1f1f, #070707);
}

.niche-glass {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255,255,255,0.08) 0%, rgba(255,255,255,0.01) 60%, rgba(0,0,0,0.3) 100%);
    border-radius: 2px;
    pointer-events: none;
    border: 0.5px solid rgba(255,255,255,0.03);
}

.niche-urn {
    font-size: 1.8rem;
    filter: drop-shadow(0 2px 3px rgba(0,0,0,0.5));
    transition: transform 0.3s ease;
}

.niche-label {
    font-size: 0.7rem;
    color: #eee;
    background: rgba(0,0,0,0.7);
    padding: 1px 4px;
    border-radius: 2px;
    margin-top: 3px;
    border: 0.5px solid rgba(218,165,32,0.3);
    max-width: 90%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.niche-lights {
    display: flex;
    gap: 3px;
    margin-top: 2px;
    font-size: 0.7rem;
}

/* Navigation Arrows for Room Rotation */
.nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid var(--accent-gold);
    color: var(--accent-gold);
    font-size: 1.5rem;
    padding: 15px 10px;
    cursor: pointer;
    z-index: 50;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.nav-arrow:hover {
    background: var(--accent-gold);
    color: #000;
}

.left-arrow { left: 20px; }
.right-arrow { right: 20px; }

/* 🛒 Funeral Shop Styles */
.shop-products-grid {
    flex: 1;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    padding: 10px;
}

.shop-item-card {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 20px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: all 0.3s ease;
}

.shop-item-card:hover {
    border-color: var(--accent-gold);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.shop-item-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--accent-gold);
    color: #000;
    font-size: 0.75rem;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 4px;
}

.shop-item-icon {
    font-size: 3rem;
    margin-bottom: 12px;
    text-align: center;
}

.shop-item-card h3 {
    margin: 0 0 8px 0;
    font-size: 1.1rem;
    color: #fff;
}

.shop-item-desc {
    font-size: 0.85rem;
    color: #999;
    line-height: 1.4;
    flex: 1;
    margin: 0 0 15px 0;
}

.shop-item-price {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--accent-gold);
    margin-bottom: 12px;
}

.buy-item-btn {
    background: transparent;
    border: 1.5px solid var(--accent-gold);
    color: var(--accent-gold);
    padding: 8px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s ease;
    width: 100%;
}

.buy-item-btn:hover {
    background: var(--accent-gold);
    color: #000;
}

/* Sub Modals */
.sub-modal {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 48px) !important;
    left: 0;
    width: 100vw !important;
    height: calc(100vh - env(safe-area-inset-top, 0px) - 48px) !important;
    background: #000000 !important;
    z-index: 1005 !important;
    display: flex;
    justify-content: center;
    align-items: flex-start !important;
    padding: 15px 0px !important;
    box-sizing: border-box;
    overflow-y: auto !important;
}

.sub-modal.hidden {
    display: none !important;
}

.sub-modal-content {
    background: #1c1c1c;
    border: 1px solid var(--accent-gold);
    border-radius: 8px;
    width: 90%;
    max-width: 400px;
    padding: 20px;
    box-sizing: border-box;
    box-shadow: 0 5px 20px rgba(0,0,0,0.5);
}

.sub-modal-content h3 {
    color: var(--accent-gold);
    margin: 0 0 15px 0;
    font-size: 1.2rem;
}

.decoration-selector {
    margin-top: 15px;
}

.decoration-selector label {
    display: block;
    color: #aaa;
    font-size: 0.85rem;
    margin-bottom: 8px;
}

.deco-options {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.deco-opt-btn {
    background: #2a2a2a;
    border: 1px solid #444;
    color: #ccc;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.deco-opt-btn:hover {
    border-color: var(--accent-gold);
    color: var(--accent-gold);
}

.deco-opt-btn.active {
    background: var(--accent-gold);
    color: #000;
    border-color: var(--accent-gold);
}

/* 🏛️ Columbarium Entrance Facade & Transition Styling */
.columbarium-entrance {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.entrance-bg-zoom {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transition: transform 1.5s ease-in-out;
}

.entrance-bg-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 46.1% center !important;
    opacity: 0.75;
}

.entrance-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(0,0,0,0.2) 20%, rgba(0,0,0,0.7) 100%);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
    z-index: 5;
}

.entrance-title {
    color: var(--accent-gold);
    font-size: 1.3rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
    font-family: var(--font-serif);
    margin-top: 10px;
}

/* Door opening zoom animation */
.columbarium-entrance.open .entrance-bg-zoom {
    transform: scale(2.2);
    transform-origin: center center;
}

.columbarium-entrance.open .entrance-overlay {
    opacity: 0;
    transition: opacity 1.2s ease-out;
    pointer-events: none;
}

.enter-room-btn {
    background: linear-gradient(135deg, var(--accent-gold) 0%, #9a7a2a 100%);
    color: #000;
    border: none;
    border-radius: 4px;
    padding: 10px 24px;
    font-size: 0.95rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(218,165,32,0.3);
    transition: all 0.3s ease;
    margin-bottom: 10px;
    font-family: var(--font-serif);
    z-index: 10;
}

.enter-room-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(218,165,32,0.5);
}

/* 🕊️ Premium Tribute Cards & Realistic Vibe Styling */
.tribute-card {
    background: linear-gradient(135deg, #15181b 0%, #0d0f11 100%) !important;
    border: 2px solid var(--accent-gold) !important;
    box-shadow: 0 15px 35px rgba(0,0,0,0.8), 0 0 15px rgba(218,165,32,0.15);
    border-radius: 12px;
    padding: 24px;
    color: #f0f0f0;
    max-width: 420px !important;
    width: 90%;
}

.tribute-header {
    display: none !important;
}

/* Realistic Granite Tombstone */
.tribute-tombstone {
    background: radial-gradient(circle, #3d4247 0%, #202326 100%);
    border: 2px solid #5a626a;
    border-bottom: 8px solid #181a1c;
    border-radius: 6px 6px 0 0;
    padding: 24px 15px;
    text-align: center;
    box-shadow: inset 0 2px 10px rgba(255,255,255,0.1), 0 10px 20px rgba(0,0,0,0.6);
    margin-bottom: 20px;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
}

.tribute-tombstone::after {
    content: '';
    position: absolute;
    bottom: -12px;
    left: -10px;
    right: -10px;
    height: 6px;
    background: #4a5056;
    border: 2px solid #5a626a;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

.tombstone-header {
    font-size: 1.3rem;
    font-weight: 600;
    color: #e5e5e5;
    font-family: var(--font-serif);
    text-shadow: 1px 1px 3px rgba(0,0,0,0.9), -1px -1px 0px rgba(255,255,255,0.05);
    letter-spacing: 2px;
}

.tombstone-inscription {
    font-size: 0.95rem;
    color: #a8b0b8;
    margin-top: 15px;
    font-style: italic;
    font-family: var(--font-serif);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    line-height: 1.4;
    white-space: pre-wrap;
}

.tribute-deco-section {
    background: rgba(0, 0, 0, 0.4);
    border-radius: 6px;
    padding: 12px;
    border: 1px solid rgba(255,255,255,0.05);
}

.tribute-section-label {
    font-size: 0.8rem;
    color: #aaa;
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
}

.tribute-deco-items {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.tribute-deco-chip {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 0.8rem;
    color: #ddd;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Realistic Niche Showcase */
.tribute-niche-showcase {
    width: 240px;
    height: 240px;
    margin: 0 auto;
    background: radial-gradient(circle, #2d2417 0%, #120e09 100%);
    border: 6px solid #4a3b25; /* mahogany wood border */
    box-shadow: inset 0 0 30px rgba(0,0,0,0.9), 0 10px 25px rgba(0,0,0,0.8);
    position: relative;
    border-radius: 6px;
    overflow: hidden;
}

.niche-case-glass {
    position: absolute;
    width: 100%;
    height: 100%;
    padding: 20px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, rgba(255,255,255,0.08) 0%, rgba(255,255,255,0) 50%, rgba(255,255,255,0.03) 100%);
}

.urn-large-display {
    font-size: 4.8rem;
    line-height: 1;
    filter: drop-shadow(0 8px 12px rgba(0,0,0,0.6));
    margin-top: 10px;
    transition: filter 0.3s ease;
}

.nameplate-large-display {
    background: linear-gradient(180deg, #ffd700 0%, #c5a018 100%);
    color: #111;
    border: 1px solid #7a630f;
    border-radius: 2px;
    padding: 3px 15px;
    font-size: 0.85rem;
    font-weight: bold;
    font-family: var(--font-serif);
    box-shadow: 0 2px 5px rgba(0,0,0,0.4);
    letter-spacing: 1px;
}

.lights-large-display {
    position: absolute;
    bottom: 20px;
    width: 100%;
    left: 0;
    display: flex;
    justify-content: space-around;
    padding: 0 40px;
    box-sizing: border-box;
}

.tribute-light-candle {
    font-size: 1.8rem;
    animation: candleFlicker 1.5s infinite alternate;
}

.tribute-light-flower {
    font-size: 1.8rem;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
}

@keyframes candleFlicker {
    0% { transform: scale(1) rotate(-1deg); filter: drop-shadow(0 0 5px rgba(255,165,0,0.6)); }
    100% { transform: scale(1.08) rotate(1deg); filter: drop-shadow(0 0 12px rgba(255,69,0,0.9)); }
}

.btn-edit {
    background: #222;
    border: 1px solid var(--accent-gold);
    color: var(--accent-gold);
    padding: 8px 20px;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-edit:hover {
    background: var(--accent-gold);
    color: #000;
}

/* 🌳 Cyber Natural Burial Redesign Grid and Assembly Styles */
.visual-option-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(95px, 1fr));
    gap: 8px;
    margin-top: 5px;
}

.visual-option-card {
    background: #222;
    border: 2px solid #3c3c3c;
    border-radius: 6px;
    padding: 6px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    box-sizing: border-box;
}

.visual-option-card img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 5px;
    background: #111;
}

.visual-option-card span {
    font-size: 0.7rem;
    color: #bbb;
    font-weight: 500;
}

.visual-option-card:hover {
    border-color: #888;
    background: #2b2b2b;
}

.visual-option-card.active {
    border-color: var(--accent-gold);
    background: rgba(218,165,32,0.12);
}

.visual-option-card.active span {
    color: var(--accent-gold);
    font-weight: bold;
}

/* Assembled Grave Visual Layout */
.assembled-grave-view {
    position: relative;
    width: 100%;
    height: 290px;
    background: #000000 !important;
    border-radius: 8px;
    border: none !important;
    box-sizing: border-box;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 6px !important;
}

.assembled-grave-bg {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.95; /* Bring landscape background to full vivid visibility */
    pointer-events: none;
}

.assembled-grave-base {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 210px;
    height: 210px;
    z-index: 2;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.assembled-grave-base.special-grave-layout {
    width: 100% !important;
    height: 88% !important;
    bottom: 0 !important;
    left: 0 !important;
    transform: none !important;
    z-index: 1 !important;
}
.assembled-grave-base.special-grave-layout img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center 35px !important;
}

/* Position base centered when a vertical tombstone is present on the right */
.assembled-grave-base.has-vertical-tombstone {
    width: 140px;
    height: 140px;
    left: 50%;
    bottom: 25px;
}

/* Flat plaque layout: tilts the base container so the stone slab lies flat in the grass field */
.assembled-grave-base.flat-plaque-layout {
    transform: translateX(-50%) perspective(350px) rotateX(46deg) scaleY(0.8) translateY(35px);
    bottom: -15px;
}

.assembled-grave-base img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0px 5px 8px rgba(0,0,0,0.45)); /* Soft natural shadow on grass */
}

/* Perspective text overlay sitting directly on the flat stone base */
.assembled-base-text-overlay {
    position: absolute;
    top: 18%;
    left: 15%;
    width: 70%;
    height: 64%;
    display: flex;
    flex-direction: row; /* In vertical mode, columns line up horizontally */
    align-items: center;
    justify-content: center;
    color: #fff;
    font-family: var(--font-serif);
    text-shadow: 0px 1px 3px rgba(0,0,0,0.95), 0px 0px 4px rgba(0,0,0,0.7);
    box-sizing: border-box;
    z-index: 10;
    pointer-events: none;
    padding: 6px;
    
    /* Vertical writing mode rules */
    writing-mode: vertical-rl;
    text-orientation: upright;
    letter-spacing: 3px;
}

.assembled-base-inscription {
    color: #f0f0f0;
    line-height: 1.5;
    max-height: 100%;
    max-width: 100%;
    overflow: hidden;
    word-break: keep-all;
    text-align: center;
}

.assembled-tombstone {
    position: absolute;
    bottom: 25px;
    right: 10px;
    width: 60px;
    height: 80px;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: center;
}

.assembled-tombstone img {
    width: 100%;
    height: 100%;
    object-fit: fill;
    filter: drop-shadow(0px 6px 10px rgba(0,0,0,0.5)); /* Soft shadow behind the tombstone */
}

.assembled-tombstone-text-overlay {
    position: absolute;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: #fff;
    font-family: var(--font-serif);
    text-shadow: 0px 1px 3px rgba(0,0,0,0.95), 0px 0px 5px rgba(0,0,0,0.6);
    z-index: 4;
    overflow: hidden;
}

.assembled-tombstone-text-overlay div {
    display: block;
    height: 100%;
    width: 100%;
    white-space: nowrap;
    writing-mode: vertical-rl;
    -webkit-writing-mode: vertical-rl;
    -ms-writing-mode: tb-rl;
    text-orientation: upright;
    -webkit-text-orientation: upright;
}

.assembled-tombstone-inscription {
    color: #f5f5f5;
    line-height: 1.5;
    max-height: 100%;
    max-width: 100%;
    overflow: hidden;
    word-break: keep-all;
    text-align: center;
}

/* Portrait photo frame on the portrait tombstone */
.assembled-tombstone-portrait-frame {
    position: absolute;
    top: 18% !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: 42% !important;
    height: 30% !important;
    border: none;
    background: transparent;
    z-index: 5;
    overflow: hidden;
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
}

.assembled-tombstone-portrait-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Adjust overlay position for Portrait Tombstone */
.assembled-tombstone.has-photo .assembled-tombstone-text-overlay {
    top: 40px;
    bottom: 6px;
    left: 15%;
    right: 15%;
    justify-content: center;
}

/* Decorations positioned left and right of the grave */
.assembled-deco-left, .assembled-deco-right {
    position: absolute;
    bottom: 20px;
    width: 75px;
    height: 90px;
    z-index: 5;
    pointer-events: none;
    transition: all 0.3s ease;
}

.assembled-deco-left {
    left: 25px;
}

.assembled-deco-right {
    right: 25px;
}

/* Balanced position when a vertical tombstone is present on the right */
.assembled-deco-left.has-vertical-tombstone {
    left: 10px;
    width: 60px;
    height: 75px;
}

.assembled-deco-right.has-vertical-tombstone {
    right: 70px;
    bottom: 15px;
    width: 50px;
    height: 60px;
}

.assembled-deco-left img, .assembled-deco-right img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0px 5px 8px rgba(0,0,0,0.45)); /* Realistic shadow for flowers/trees */
}

/* Niche Tribute Candle & Flower bottom shelf layout */
.lights-large-display {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    width: 85%;
    height: 70px;
    margin-top: 15px;
    padding-top: 5px;
    border-top: 1px dashed rgba(255, 255, 255, 0.15);
    box-sizing: border-box;
    position: relative;
}

/* Custom Animated Candle */
.tribute-candle-container {
    position: relative;
    width: 30px;
    height: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    margin-bottom: 2px;
}

.candle-body {
    width: 14px;
    height: 32px;
    background: linear-gradient(to right, #fdfbf7 0%, #eeebe3 40%, #e2dfd5 80%, #d8d4c9 100%);
    border-radius: 2px 2px 0 0;
    box-shadow: inset -1px 0 2px rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.3);
    position: relative;
}

/* Melted wax drip effect */
.candle-body::after {
    content: '';
    position: absolute;
    left: 2px;
    top: 0;
    width: 2px;
    height: 10px;
    background: #fdfbf7;
    border-radius: 0 0 1px 1px;
    box-shadow: 1px 0 1px rgba(0,0,0,0.05);
}

.candle-wick {
    width: 2px;
    height: 6px;
    background: #222;
    position: absolute;
    bottom: 32px;
    z-index: 2;
}

.candle-flame {
    width: 8px;
    height: 18px;
    background: radial-gradient(ellipse at bottom, #ffffff 0%, #ffeb3b 25%, #ff9800 60%, #f44336 100%);
    border-radius: 50% 50% 20% 20% / 60% 60% 40% 40%;
    position: absolute;
    bottom: 37px;
    animation: candleFlicker 0.1s infinite alternate;
    filter: drop-shadow(0 0 6px rgba(255, 179, 0, 0.9)) drop-shadow(0 0 12px rgba(255, 110, 0, 0.5));
    transform-origin: center bottom;
    z-index: 3;
}

@keyframes candleFlicker {
    0% {
        transform: scale(1) rotate(-1deg);
        opacity: 0.92;
    }
    50% {
        transform: scale(1.04) rotate(0deg);
        opacity: 0.98;
    }
    100% {
        transform: scale(1.08) rotate(1deg);
        opacity: 1;
    }
}

/* Custom Flower Bouquet container */
.tribute-light-flower-container {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    margin-bottom: 2px;
}

.tribute-light-flower-container img {
    height: 100%;
    width: 100%;
    object-fit: contain;
    filter: drop-shadow(0px 3px 5px rgba(0,0,0,0.35));
}

/* Split-Screen Tribute Editor Modal */
.tribute-editor-card {
    background: #000000 !important;
    border: none !important;
    padding: 20px 10px !important;
    border-radius: 0px !important;
    box-shadow: none !important;
}

.tribute-editor-split {
    display: flex;
    gap: 20px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.tribute-preview-side {
    flex: 1;
    min-width: 320px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: transparent;
    padding: 0;
    border-radius: 0;
    border: none;
}

.tribute-form-side {
    flex: 1.2;
    min-width: 320px;
    max-height: 62vh;
    overflow-y: auto;
    padding-right: 8px;
}

.tribute-form-side::-webkit-scrollbar {
    width: 6px;
}
.tribute-form-side::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 3px;
}

.side-title {
    color: var(--accent-gold);
    font-size: 0.95rem;
    font-weight: bold;
    margin-bottom: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 5px;
    width: 100%;
    text-align: left;
}

/* Columbarium Niche Cabinet Showcase New 3D Style */
.niche-case-glass-new {
    width: 320px;
    height: 250px;
    background: radial-gradient(circle at center, #3e2723 0%, #1e1210 100%);
    border: 6px solid #5d4037;
    box-shadow: inset 0 0 40px rgba(0,0,0,0.9), 0 8px 24px rgba(0,0,0,0.7);
    border-radius: 4px;
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 15px 45px 15px;
    box-sizing: border-box;
    overflow: hidden;
}

.niche-left-urn {
    position: absolute;
    left: 15px;
    top: 15px;
    width: 140px;
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.niche-left-urn img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 5px 10px rgba(0,0,0,0.6));
}

.niche-photo-frame-3d {
    position: absolute;
    right: 15px;
    top: 15px;
    width: 90px;
    height: 110px;
    border: 3px solid #8d6e63;
    background: #000;
    box-shadow: inset 1px 1px 3px rgba(0,0,0,0.8), 1px 3px 5px rgba(0,0,0,0.5);
    border-radius: 2px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.niche-photo-frame-3d img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.niche-inscription-frame-3d {
    position: absolute;
    right: 15px;
    bottom: 50px;
    width: 120px;
    height: 75px;
    background: linear-gradient(135deg, #3d221c 0%, #22120f 100%);
    border: 2px solid #5d4037;
    border-radius: 3px;
    box-shadow: inset 0px 1px 2px rgba(255,255,255,0.1), 0 3px 6px rgba(0,0,0,0.6);
    padding: 6px 10px;
    box-sizing: border-box;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    z-index: 2;
}

.niche-name-vertical {
    writing-mode: vertical-rl;
    text-orientation: upright;
    color: #ffd700;
    font-weight: bold;
    font-size: 0.8rem;
    margin-left: 8px;
    letter-spacing: 2px;
    font-family: var(--font-serif);
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
    height: 100%;
    display: flex;
    align-items: center;
}

.niche-inscription-vertical {
    writing-mode: vertical-rl;
    text-orientation: upright;
    color: #eee;
    font-size: 0.68rem;
    line-height: 1.3;
    letter-spacing: 1px;
    font-family: var(--font-serif);
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
    height: 100%;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.niche-bottom-shelf {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 42px;
    background: linear-gradient(to bottom, #1f1210 0%, #0c0706 100%);
    border-top: 3px solid #3e2723;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.5);
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    padding-bottom: 4px;
    box-sizing: border-box;
    z-index: 5;
}

.niche-bottom-shelf .tribute-candle-container {
    width: 24px;
    height: 38px;
}
.niche-bottom-shelf .candle-body {
    width: 10px;
    height: 20px;
}
.niche-bottom-shelf .candle-wick {
    bottom: 20px;
}
.niche-bottom-shelf .candle-flame {
    width: 6px;
    height: 13px;
    bottom: 23px;
}
.niche-bottom-shelf .tribute-light-flower-container {
    width: 42px;
    height: 38px;
}

/* Phone Frame Mockup for Desktop screen sizes */
@media (min-width: 500px) {
    html, body {
        height: 100%;
        margin: 0;
        padding: 0;
        background-color: #0f1c0e; /* Dark green theme background surrounding the phone frame */
        display: flex;
        justify-content: center;
        align-items: center;
        overflow: hidden;
    }

    .phone-device-wrapper {
        position: relative;
        width: 390px;
        height: 844px; /* iPhone 13/14 screen size aspect ratio */
        background: #000;
        border: 12px solid #1c1c1e;
        border-radius: 48px;
        box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.85), 0 0 0 4px #2c2c2e;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        box-sizing: content-box;
        
        /* CSS Trick: Contain position: fixed elements inside the phone wrapper */
        transform: translate(0, 0); 
    }

    /* Simulate dynamic island / notch at the top of the screen */
    .phone-device-wrapper::before {
        content: "";
        position: absolute;
        top: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 140px;
        height: 25px;
        background: #000;
        border-bottom-left-radius: 18px;
        border-bottom-right-radius: 18px;
        z-index: 10000;
        pointer-events: none;
    }

    /* Simulate iOS Home Indicator bar at the bottom */
    .phone-device-wrapper::after {
        content: "";
        position: absolute;
        bottom: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 120px;
        height: 5px;
        background: rgba(255, 255, 255, 0.45);
        border-radius: 2.5px;
        z-index: 10000;
        pointer-events: none;
    }

    .phone-device-body {
        width: 100%;
        height: 100%;
        position: relative;
        overflow-y: auto;
        overflow-x: hidden;
        background: #050a04;
        display: flex;
        flex-direction: column;
        border-radius: 36px;
        
        /* Hide scrollbars inside virtual screen to simulate a phone application */
        -ms-overflow-style: none;  /* IE/Edge */
        scrollbar-width: none;  /* Firefox */
    }
    
    .phone-device-body::-webkit-scrollbar {
        display: none; /* Chrome, Safari, Opera */
    }

    /* Force all viewport-fixed overlays to bind within the phone boundaries */
    .login-overlay {
        position: absolute !important;
        width: 100% !important;
        height: 100% !important;
        top: 0 !important;
        left: 0 !important;
        border-radius: 36px;
    }
    .virtual-overlay, .sub-modal, .pet-modal-overlay {
        position: absolute !important;
        width: 100% !important;
        height: 100% !important;
        top: 0 !important;
        left: 0 !important;
        border-radius: 36px;
        z-index: 20000 !important;
    }
    .virtual-overlay {
        padding: 10px !important;
    }
    .virtual-card {
        height: 90% !important;
        width: 92% !important;
        padding: 15px !important;
    }
}

/* On real mobile viewports, let it occupy full native screen naturally */
@media (max-width: 499px) {
    html, body {
        height: 100%;
        margin: 0;
        padding: 0;
        overflow: auto;
    }

    .phone-device-wrapper {
        width: 100vw;
        height: 100vh;
        border: none;
        box-shadow: none;
        border-radius: 0;
        overflow: visible;
        display: block;
        transform: none;
    }
    
    .phone-device-body {
        width: 100%;
        height: 100%;
        overflow: visible;
        border-radius: 0;
    }

    .sub-modal-content.tribute-editor-card {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        border: none !important;
        border-radius: 0px !important;
        padding: 10px 8px !important;
        background: #000000 !important;
    }

    .assembled-niche-view, .assembled-grave-view {
        height: 230px !important;
    }
    .side-title {
        display: none !important;
    }
    .tribute-editor-split {
        gap: 6px !important;
        margin-top: 5px !important;
    }
    .tribute-form-side {
        max-height: none !important;
        overflow-y: visible !important;
    }
    .input-group {
        margin-top: 6px !important;
    }
    .input-group label {
        margin-bottom: 2px !important;
        font-size: 0.8rem !important;
    }
    textarea#nicheInscription, textarea#graveInscription {
        height: 48px !important;
        padding: 5px !important;
        font-size: 0.8rem !important;
    }
    .visual-option-grid {
        gap: 6px !important;
        margin-top: 4px !important;
    }
    .visual-option-card {
        padding: 4px !important;
    }
    .visual-option-card img {
        height: 35px !important;
    }
    .visual-option-card span {
        font-size: 0.75rem !important;
    }
    .assembled-grave-base {
        bottom: 40px !important;
        width: 140px !important;
        height: 140px !important;
    }
    .assembled-tombstone {
        bottom: 20px !important;
        width: 65px !important;
        height: 105px !important;
        left: calc(50% + 38px) !important;
    }
}

.lang-dropdown-menu button:hover {
    background: #2a2a2a !important;
    color: var(--accent-gold) !important;
}

#graveTributeModal .assembled-tombstone {
    pointer-events: auto !important;
    user-select: none !important;
    -webkit-user-drag: none !important;
}

#graveTributeModal #assembledTombstoneImg {
    pointer-events: none !important;
    user-select: none !important;
    -webkit-user-drag: none !important;
}

#graveTributeModal .assembled-tombstone-text-overlay {
    pointer-events: auto !important;
    cursor: move;
    touch-action: none !important;
    user-select: none !important;
}

.text-box-resize-handle {
    position: absolute !important;
    bottom: -12px !important;
    right: -12px !important;
    width: 24px !important;
    height: 24px !important;
    max-width: 24px !important;
    max-height: 24px !important;
    background: #ffd700 url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><path d="M6,11 L6,6 L11,6 M13,18 L18,18 L18,13 M6,6 L18,18"/></svg>') no-repeat center !important;
    background-size: 14px 14px !important;
    border: 2px solid #000 !important;
    border-radius: 4px !important;
    cursor: se-resize !important;
    z-index: 1000 !important;
    box-sizing: border-box !important;
    touch-action: none !important;
}

/* Expand touch/hit area of the handle to 60px to prevent accidental backplate clicks */
.text-box-resize-handle::after {
    content: '';
    position: absolute;
    top: -18px;
    left: -18px;
    right: -18px;
    bottom: -18px;
    cursor: se-resize;
    z-index: 1001;
    pointer-events: auto !important;
    touch-action: none !important;
}

/* Premium frame/plaque for Columbarium Niche text */
.niche-inscription-frame {
    background: url('niche_frame.png?v=v22') no-repeat center center / 100% 100% !important;
    border: none !important;
    border-radius: 4px !important;
    box-shadow: 0 4px 10px rgba(0,0,0,0.8) !important;
    box-sizing: border-box !important;
}

/* Premium 3D Navigation Capsule Buttons */
.nav-btn-premium {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    height: 36px;
    background: linear-gradient(180deg, rgba(46, 40, 32, 0.96) 0%, rgba(26, 22, 16, 0.98) 50%, rgba(12, 10, 7, 0.98) 100%) !important;
    color: #e5c05d !important;
    border: 1px solid rgba(212, 175, 55, 0.45) !important;
    border-radius: 12px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.70rem !important;
    font-weight: 800 !important;
    padding: 0 4px !important;
    white-space: nowrap;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    box-shadow: 0 4px 10px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.25), inset 0 -1px 0 rgba(0,0,0,0.6) !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-shadow: 0px 1px 2px rgba(0,0,0,0.9);
}

.nav-btn-premium:hover {
    background: linear-gradient(180deg, rgba(68, 56, 40, 0.96) 0%, rgba(38, 30, 20, 0.98) 50%, rgba(18, 14, 8, 0.98) 100%) !important;
    color: #ffffff !important;
    border-color: #ffd700 !important;
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(0,0,0,0.65), 0 0 8px rgba(255,215,0,0.4), inset 0 1px 0 rgba(255,255,255,0.4) !important;
}

.nav-btn-premium.active {
    background: linear-gradient(180deg, #ffd359 0%, #d4af37 40%, #9a7209 100%) !important;
    color: #111111 !important;
    border-color: #ffd700 !important;
    text-shadow: 0 1px 0 rgba(255,255,255,0.4) !important;
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.8), inset 0 -1px 1px rgba(0,0,0,0.4), 0 3px 10px rgba(212,175,55,0.5) !important;
}

/* Single Large Niche Cell */
.niche-cell.large-single-niche {
    grid-column: 1 / span 3;
    grid-row: 1 / span 3;
    width: 100%;
    height: 100%;
}

.large-single-niche .niche-urn {
    font-size: 7.5rem !important;
    opacity: 0.25 !important;
    transition: all 0.3s ease;
}

.large-single-niche .niche-label {
    font-size: 1.15rem !important;
    padding: 8px 18px !important;
    margin-top: 20px !important;
    white-space: nowrap;
}

/* Align login card to top when height is constrained by virtual keyboard */
@media (max-height: 600px) {
    .login-overlay {
        align-items: flex-start !important;
        padding-top: 30px !important;
        padding-bottom: 30px !important;
    }
}

/* Compact theme selector bar layout right under categories */
.theme-selection-section.compact-bar {
    margin: 4px 0 8px 0;
    background: transparent;
    padding: 0 4px;
    border: none;
    border-radius: 0;
}
.theme-selection-section.compact-bar .theme-title {
    display: none !important;
}
.theme-selection-section.compact-bar .theme-selector {
    display: flex;
    justify-content: space-between;
    gap: 4px;
    overflow-x: visible;
    padding: 0;
    margin: 0;
}
.theme-selection-section.compact-bar .theme-option {
    flex: 1;
    max-width: 48px;
    background: rgba(255, 255, 255, 0.03);
    border: 1.5px solid #444;
    border-radius: 6px;
    padding: 4px 2px;
    gap: 2px;
    box-sizing: border-box;
}
.theme-selection-section.compact-bar .theme-option:hover {
    background: rgba(255, 255, 255, 0.08);
}
.theme-selection-section.compact-bar .theme-option.active {
    border-color: var(--accent-gold);
    background: rgba(212, 175, 55, 0.15);
    box-shadow: 0 0 5px rgba(212, 175, 55, 0.4);
}
.theme-selection-section.compact-bar .theme-preview-img {
    width: 36px;
    height: 27px;
    border-radius: 3px;
    border: 1.5px solid #222;
}
.theme-selection-section.compact-bar .theme-name {
    font-size: 0.55rem;
    white-space: nowrap;
    text-align: center;
    color: #bbb;
    margin-top: 1px;
}

/* Theme-specific photo positioning overrides (aligned to background frames) */
/* Theme 1 (le01) */
.memorial-altar.theme-active.theme-le01 .altar-theme-overlay {
    width: 125% !important;
    height: 125% !important;
    left: -12.5% !important;
    top: 0 !important;
    transform: none !important;
}
.memorial-altar.theme-active.theme-le01 .portrait-container,
.memorial-altar.theme-active.theme-le01 .portrait-click-trigger {
    left: 50.21% !important;
    top: 43.39% !important;
    width: 19.69% !important;
    height: 36.95% !important;
}

/* Theme 2 (le02) */
.memorial-altar.theme-active.theme-le02 .altar-theme-overlay {
    width: 100% !important;
    height: 100% !important;
    left: 0 !important;
    top: 0 !important;
    transform: none !important;
}
.memorial-altar.theme-active.theme-le02 .portrait-container,
.memorial-altar.theme-active.theme-le02 .portrait-click-trigger {
    left: 49.76% !important;
    top: 44.58% !important;
    width: 17.68% !important;
    height: 37.61% !important;
}

/* Theme 3 (le03) */
.memorial-altar.theme-active.theme-le03 .altar-theme-overlay {
    width: 130% !important;
    height: 130% !important;
    left: -15% !important;
    top: 0 !important;
    transform: none !important;
}
.memorial-altar.theme-active.theme-le03 .portrait-container,
.memorial-altar.theme-active.theme-le03 .portrait-click-trigger {
    left: 50.09% !important;
    top: 46.80% !important;
    width: 19.66% !important;
    height: 37.23% !important;
}

/* Theme 4 (le04) */
.memorial-altar.theme-active.theme-le04 .altar-theme-overlay {
    width: 140% !important;
    height: 140% !important;
    left: -20% !important;
    top: 0 !important;
    transform: none !important;
}
.memorial-altar.theme-active.theme-le04 .portrait-container,
.memorial-altar.theme-active.theme-le04 .portrait-click-trigger {
    left: 49.96% !important;
    top: 47.96% !important;
    width: 18.14% !important;
    height: 38.26% !important;
}

/* Theme 5 (le05) */
.memorial-altar.theme-active.theme-le05 .altar-theme-overlay {
    width: 115% !important;
    height: 115% !important;
    left: -7.5% !important;
    top: -7.5% !important;
    transform: none !important;
}
.memorial-altar.theme-active.theme-le05 .portrait-container,
.memorial-altar.theme-active.theme-le05 .portrait-click-trigger {
    left: 49.89% !important;
    top: 43.55% !important;
    width: 20.17% !important;
    height: 43.25% !important;
}

/* Theme 6 (le06) */
.memorial-altar.theme-active.theme-le06 .altar-theme-overlay {
    width: 138% !important;
    height: 138% !important;
    left: -19% !important;
    top: -10% !important;
    transform: none !important;
}
.memorial-altar.theme-active.theme-le06 .portrait-container {
    left: 51.05% !important;
    top: 43.94% !important;
    width: 20.50% !important;
    height: 34.57% !important;
    z-index: 6 !important; /* Bring photo on top of opaque overlay slot */
}
.memorial-altar.theme-active.theme-le06 .portrait-click-trigger {
    left: 51.05% !important;
    top: 43.94% !important;
    width: 20.50% !important;
    height: 34.57% !important;
}

/* Foreground flower decorations to overlay the frame over bottom corners */
.foreground-flower-decor {
    position: absolute;
    z-index: 7; /* Draw above the frame (z-index 6) */
    pointer-events: none;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.45));
}

.foreground-flower-decor.left-decor-1 {
    bottom: -14px;
    left: -14px;
    width: 32px;
    height: 32px;
    transform: rotate(-10deg);
}

.foreground-flower-decor.left-decor-2 {
    bottom: -20px;
    left: 4px;
    width: 28px;
    height: 28px;
    transform: rotate(20deg);
}

.foreground-flower-decor.right-decor-1 {
    bottom: -14px;
    right: -14px;
    width: 32px;
    height: 32px;
    transform: rotate(15deg);
}

.foreground-flower-decor.right-decor-2 {
    bottom: -20px;
    right: 4px;
    width: 28px;
    height: 28px;
    transform: rotate(-25deg);
}

/* Adjust incense section location to sit below the altar end */
.incense-section {
    margin-top: 5px !important; /* Slide it down below the bottom row of flowers */
    margin-bottom: 25px !important;
}



/* ========================================================
   🌈 LeLife Pet Living Sanctuary & Mode Switcher Styles
   ======================================================== */

.global-mode-switcher {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 0 4px;
    background: transparent;
    border: none;
    border-radius: 0;
    margin: 2px auto 2px auto;
    max-width: 440px;
    box-shadow: none;
    backdrop-filter: none;
    position: relative;
    z-index: 100;
}

.mode-tab {
    flex: 1;
    max-width: 210px;
    padding: 7px 12px;
    font-size: 0.82rem;
    font-weight: 700;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.08);
    color: #bbb;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.mode-tab:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    transform: translateY(-1px);
}

.mode-tab.active {
    background: linear-gradient(135deg, #d4af37 0%, #aa7c11 100%);
    color: #111;
    border-color: #ffd700;
    box-shadow: 0 2px 10px rgba(212, 175, 55, 0.45);
}

#modePetBtn.mode-tab.active {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    color: #222;
    border-color: #ffb6c1;
    box-shadow: 0 2px 12px rgba(255, 154, 158, 0.55);
}

/* Pet Memorial Header Card */
.pet-memorial-section {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    padding: 2px 10px 8px 10px;
    box-sizing: border-box;
}

.pet-header-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 182, 193, 0.3);
    border-radius: 12px;
    padding: 8px 12px;
    margin-top: 0px;
    margin-bottom: 8px;
    text-align: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.pet-title-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.pet-name-badge {
    font-size: 1.05rem;
    font-weight: 800;
    color: #ffccd5;
    text-shadow: 0 1px 4px rgba(0,0,0,0.6);
}

.pet-dates-badge {
    font-size: 0.78rem;
    color: #bbb;
    background: rgba(0,0,0,0.4);
    padding: 2px 8px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.1);
}

.pet-edit-btn {
    background: linear-gradient(180deg, rgba(255, 215, 0, 0.28) 0%, rgba(184, 134, 11, 0.35) 100%);
    border: 1px solid rgba(255, 215, 0, 0.6);
    color: #ffd700;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.35);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.pet-edit-btn:hover {
    background: linear-gradient(180deg, #ffd700 0%, #b8860b 100%);
    color: #111;
    text-shadow: none;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.pet-select-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(180deg, rgba(255, 229, 127, 0.28) 0%, rgba(198, 143, 8, 0.35) 100%);
    border: 1px solid rgba(255, 215, 0, 0.65);
    color: #ffe57f;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.35);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.pet-select-btn:hover {
    background: linear-gradient(180deg, #ffe57f 0%, #d4af37 100%);
    color: #111;
    text-shadow: none;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.pet-photo-header-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(180deg, rgba(255, 182, 193, 0.3) 0%, rgba(219, 112, 147, 0.35) 100%);
    border: 1px solid rgba(255, 182, 193, 0.65);
    color: #ffccd5;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.35);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.pet-photo-header-btn:hover {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    color: #111;
    text-shadow: none;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 154, 158, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.pet-quote-text {
    font-family: 'Noto Serif KR', 'Noto Serif JP', 'Noto Serif SC', 'Noto Serif', 'Songti SC', 'Yu Mincho', 'Batang', Georgia, serif;
    font-size: 0.8rem;
    color: #eee;
    font-style: italic;
    margin-top: 4px;
    opacity: 0.9;
}

/* Photorealistic 3D Stage */
.pet-stage-container {
    position: relative;
    width: 100%;
    height: 440px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(0,0,0,0.6);
    border: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: #111;
}

.pet-room-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center bottom;
    transition: opacity 0.3s ease, background-image 0.3s ease;
    z-index: 1;
}

/* 🌈 Rainbow Bridge Over Horizon / Window */
.pet-rainbow-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
    overflow: hidden;
}

.pet-rainbow-svg {
    width: 100%;
    height: 100%;
    opacity: 0.88;
    filter: drop-shadow(0 0 16px rgba(255, 255, 255, 0.45)) drop-shadow(0 0 28px rgba(255, 215, 0, 0.35));
    animation: rainbowPulse 5s ease-in-out infinite alternate;
}

@keyframes rainbowPulse {
    0% {
        opacity: 0.80;
        transform: scale(0.995) translateY(0);
        filter: drop-shadow(0 0 14px rgba(255, 255, 255, 0.4)) drop-shadow(0 0 22px rgba(255, 215, 0, 0.3));
    }
    100% {
        opacity: 0.98;
        transform: scale(1.005) translateY(-2px);
        filter: drop-shadow(0 0 24px rgba(255, 255, 255, 0.65)) drop-shadow(0 0 38px rgba(255, 215, 0, 0.5));
    }
}

.pet-rainbow-soft-aura {
    position: absolute;
    top: 36px;
    left: 15%;
    width: 70%;
    height: 160px;
    background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.22) 0%, rgba(255, 220, 180, 0.14) 45%, transparent 75%);
    pointer-events: none;
    mix-blend-mode: screen;
}

.pet-ambient-light {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% 30%, rgba(255,245,230,0.15) 0%, rgba(0,0,0,0.3) 100%);
    pointer-events: none;
    z-index: 2;
}

/* Room Chips Selector - High-End 3D Segmented Capsule Bar with Vertical Grooves */
.pet-room-chips {
    position: relative;
    z-index: 25;
    display: flex;
    justify-content: stretch;
    align-items: stretch;
    width: calc(100% - 16px);
    margin: 6px auto 4px;
    padding: 2px;
    box-sizing: border-box;
    background: linear-gradient(180deg, rgba(46, 46, 54, 0.96) 0%, rgba(22, 22, 26, 0.98) 50%, rgba(10, 10, 14, 0.98) 100%);
    border: 1px solid rgba(255, 255, 255, 0.26);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.75), inset 0 1px 1px rgba(255, 255, 255, 0.35), inset 0 -1px 1px rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
}

.room-chip {
    flex: 1 1 0;
    min-width: 0;
    padding: 6px 1px;
    border: none;
    border-radius: 8px;
    margin: 0;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: -0.4px;
    color: #e0e0e0;
    background: transparent;
    border-right: 1px solid rgba(255, 255, 255, 0.12);
    cursor: pointer;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-sizing: border-box;
}

/* Specific styling for Vietnamese and long labels */
[lang="vi"] .room-chip,
[data-lang="vi"] .room-chip,
body.lang-vi .room-chip {
    font-size: 0.61rem !important;
    letter-spacing: -0.5px !important;
    padding: 6px 0px !important;
}

.room-chip:last-of-type {
    border-right: none;
}

.room-chip:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.12);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.room-chip.active {
    color: #111111;
    background: linear-gradient(180deg, #ffe072 0%, #e5be3a 35%, #b8860b 80%, #8c6302 100%);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
    font-weight: 900;
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.9), inset 0 -1px 2px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(229, 190, 58, 0.5);
    border-radius: 8px;
}

/* Living Avatar Stage Wrapper */
.pet-avatar-wrapper {
    position: relative;
    z-index: 5;
    flex: 1;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 25px;
    cursor: pointer;
    user-select: none;
}

/* Contact Ground Shadow */
.pet-ground-shadow {
    position: absolute;
    bottom: 22px;
    width: 170px;
    height: 36px;
    background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.65) 0%, rgba(0, 0, 0, 0.3) 45%, transparent 75%);
    border-radius: 50%;
    transform: scaleY(0.5);
    pointer-events: none;
    z-index: 4;
}

/* Living Pet Body */
.pet-living-body {
    position: relative;
    width: 220px;
    height: 240px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    transform-origin: bottom center;
    transition: transform 0.25s cubic-bezier(0.25, 1, 0.5, 1), filter 0.2s;
    z-index: 6;
}

.pet-real-photo-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.35));
    pointer-events: none;
    transition: filter 0.2s;
}

/* Living Eye Sparkles & Blinking */
.pet-eye-glint {
    position: absolute;
    width: 6px;
    height: 6px;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 0 6px #fff, 0 0 12px rgba(255,255,255,0.8);
    opacity: 0.85;
    pointer-events: none;
    z-index: 8;
    animation: eyeGlintPulse 2.5s infinite ease-in-out;
}

.pet-eye-glint.left {
    top: 36%;
    left: 44%;
}

.pet-eye-glint.right {
    top: 36%;
    left: 56%;
}

@keyframes eyeGlintPulse {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.4); opacity: 1; }
}

/* Natural Eyelid Blinking */
.pet-living-body.blinking .pet-real-photo-img {
    filter: brightness(0.95);
    transform: scaleY(0.97);
}

.pet-living-body.blinking .pet-eye-glint {
    opacity: 0;
    transform: scaleY(0.1);
}

/* Smiling / Petting Reaction */
.pet-living-body.smiling {
    filter: drop-shadow(0 0 18px rgba(255, 215, 0, 0.6)) brightness(1.08);
}

/* Interactive Movable & Resizable Items Layer on 3D Stage (Like Columbarium Niche) */
.pet-interactive-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 15;
}

.pet-interactive-item {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    cursor: move;
    touch-action: none;
    user-select: none;
    border: 1.5px dashed transparent;
    border-radius: 8px;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.pet-interactive-item:hover,
.pet-interactive-item.selected {
    border-color: rgba(255, 215, 0, 0.9) !important;
    background: rgba(255, 215, 0, 0.09);
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.45);
    z-index: 30;
}

.pet-interactive-item .text-box-resize-handle {
    display: none !important;
}

.pet-interactive-item.selected .text-box-resize-handle {
    display: block !important;
}

.pet-interactive-item .pet-item-del-btn {
    display: none;
    position: absolute;
    top: -10px;
    right: -10px;
    width: 22px;
    height: 22px;
    background: #e74c3c;
    color: #fff;
    border: 1.5px solid #fff;
    border-radius: 50%;
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    z-index: 1005;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}

.pet-interactive-item.selected .pet-item-del-btn {
    display: flex;
    align-items: center;
    justify-content: center;
}

.pet-interactive-item .item-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 38px;
    line-height: 1;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.6));
    pointer-events: none;
    user-select: none;
}

.pet-interactive-item img.pet-flower-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.6));
    pointer-events: none;
}

.pet-interactive-item .pet-candle-item {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: clamp(26px, 75%, 76px);
    cursor: pointer;
    position: relative;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.6));
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.pet-interactive-item .pet-candle-item:hover {
    transform: scale(1.1);
}

.pet-interactive-item .pet-candle-item.lit .candle-body {
    filter: drop-shadow(0 0 16px rgba(255, 180, 50, 1));
}

.pet-candle-item .candle-flame {
    position: absolute;
    top: -8px;
    left: 45%;
    width: 8px;
    height: 14px;
    background: radial-gradient(circle, #fff7a0 0%, #ff9900 70%, #ff4400 100%);
    border-radius: 50% 50% 20% 20%;
    opacity: 0;
    box-shadow: 0 0 12px #ff8800;
    transition: opacity 0.3s;
}

.pet-candle-item.lit .candle-flame {
    opacity: 1;
    animation: flameFlicker 0.4s infinite alternate ease-in-out;
}

@keyframes flameFlicker {
    0% { transform: scale(1) translateY(0); filter: brightness(1); }
    100% { transform: scale(1.2) translateY(-1px); filter: brightness(1.3); }
}

.pet-flower-item {
    position: relative;
    cursor: pointer;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.pet-flower-item:hover {
    transform: scale(1.08) translateY(-4px);
}

.pet-flower-img {
    width: 92px;
    height: 92px;
    object-fit: contain;
    filter: drop-shadow(0 8px 16px rgba(0,0,0,0.65)) drop-shadow(0 0 14px rgba(255,215,0,0.35));
    transition: all 0.3s ease;
}

/* Real Photo Upload Floating Badge */
.pet-photo-upload-badge {
    position: absolute;
    top: 55px;
    right: 12px;
    background: rgba(0, 0, 0, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: #fff;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 10px rgba(0,0,0,0.4);
    transition: all 0.2s;
    z-index: 12;
}

.pet-photo-upload-badge:hover {
    background: rgba(255, 182, 193, 0.9);
    color: #111;
    border-color: #fff;
}

/* Touch Guide Hint */
.pet-touch-hint {
    position: relative;
    z-index: 10;
    text-align: center;
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.75);
    padding-bottom: 6px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
    pointer-events: none;
}

/* Floating Heart & Reaction Animation */
.pet-reaction-aura {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9;
}

.floating-heart {
    position: absolute;
    font-size: 2rem;
    animation: floatHeartUp 1.2s forwards cubic-bezier(0.1, 0.8, 0.3, 1);
}

@keyframes floatHeartUp {
    0% { transform: scale(0.5) translateY(0); opacity: 0; }
    30% { opacity: 1; transform: scale(1.3) translateY(-15px); }
    100% { opacity: 0; transform: scale(1.6) translateY(-60px); }
}

/* 3. Simple 4-Button Healing Action Bar (3D Tactile Capsule Cards) */
.pet-healing-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 12px;
    margin-bottom: 16px;
    width: 100%;
    box-sizing: border-box;
}

.healing-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 9px 4px 8px;
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(48, 48, 56, 0.95) 0%, rgba(25, 25, 30, 0.98) 50%, rgba(12, 12, 16, 0.98) 100%);
    border: 1px solid rgba(255, 255, 255, 0.22);
    color: #f0f0f0;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.3), inset 0 -1px 0 rgba(0, 0, 0, 0.7);
    min-width: 0;
    overflow: hidden;
    position: relative;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.healing-btn:hover {
    transform: translateY(-2px);
    background: linear-gradient(180deg, rgba(62, 62, 74, 0.95) 0%, rgba(35, 35, 42, 0.98) 50%, rgba(18, 18, 24, 0.98) 100%);
    color: #ffffff;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.healing-btn:active {
    transform: translateY(1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.8), inset 0 1px 2px rgba(0, 0, 0, 0.6);
}

.healing-btn .btn-icon {
    font-size: 1.35rem;
    margin-bottom: 3px;
    line-height: 1;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.7));
    transition: transform 0.2s ease;
}

.healing-btn:hover .btn-icon {
    transform: scale(1.15);
}

.healing-btn .btn-label {
    font-size: 0.70rem;
    font-weight: 800;
    white-space: nowrap;
    letter-spacing: -0.4px;
    text-overflow: ellipsis;
    overflow: hidden;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
}

/* Individual Colored Glow Accents on Hover & Active */
.healing-btn.treat-btn:hover { 
    border-color: #ffd700; 
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.7), 0 0 10px rgba(255, 215, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.healing-btn.treat-btn .btn-label { color: #ffe57f; }

.healing-btn.toy-btn:hover { 
    border-color: #ff7675; 
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.7), 0 0 10px rgba(255, 118, 117, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.healing-btn.toy-btn .btn-label { color: #ffb8b8; }

.healing-btn.flower-btn:hover { 
    border-color: #ff9a9e; 
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.7), 0 0 10px rgba(255, 154, 158, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.healing-btn.flower-btn .btn-label { color: #fecfef; }

.healing-btn.letter-btn:hover { 
    border-color: #74b9ff; 
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.7), 0 0 10px rgba(116, 185, 255, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.healing-btn.letter-btn .btn-label { color: #a0c4ff; }

/* 3D Circular Buttons for Top Bar (Home & Settings) */
.home-btn-3d, .settings-btn-3d {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(180deg, rgba(48, 48, 56, 0.96) 0%, rgba(24, 24, 28, 0.98) 50%, rgba(10, 10, 14, 0.98) 100%);
    border: 1px solid rgba(255, 255, 255, 0.26);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.35), inset 0 -1px 0 rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    padding: 0;
}

.home-btn-3d:hover, .settings-btn-3d:hover {
    transform: translateY(-1px);
    border-color: #ffd700;
    background: linear-gradient(180deg, rgba(65, 65, 78, 0.96) 0%, rgba(35, 35, 42, 0.98) 50%, rgba(15, 15, 20, 0.98) 100%);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.7), 0 0 10px rgba(255, 215, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.home-btn-3d:active, .settings-btn-3d:active {
    transform: translateY(1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.8), inset 0 1px 2px rgba(0, 0, 0, 0.6);
}

/* 4. Pet Modals Styling */
.pet-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20000;
    padding: 16px;
    box-sizing: border-box;
}

.pet-modal-card {
    background: rgba(28, 28, 34, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 182, 193, 0.45);
    border-radius: 20px;
    width: 100%;
    max-width: 420px;
    max-height: 88vh;
    overflow-y: auto;
    padding: 22px 18px 20px 18px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.85), 0 0 24px rgba(255, 182, 193, 0.18);
    text-align: center;
    color: #fff;
    box-sizing: border-box;
    animation: petModalPopIn 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes petModalPopIn {
    from { opacity: 0; transform: scale(0.92) translateY(12px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.pet-modal-card h3 {
    margin: 0 0 6px 0;
    font-size: 1.12rem;
    color: #ffccd5;
    font-weight: 700;
}

.pet-modal-card .modal-sub {
    font-size: 0.8rem;
    color: #ccc;
    margin-bottom: 14px;
    line-height: 1.4;
}

.treat-options-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px 8px;
    margin-bottom: 14px;
    max-height: 310px;
    overflow-y: auto;
    padding: 10px 6px 12px 6px;
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch;
}

.treat-card {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 12px;
    padding: 11px 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    box-sizing: border-box;
}

.treat-card:hover {
    background: rgba(255, 215, 0, 0.2);
    border-color: #ffd700;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.3);
}

.treat-card .t-icon {
    font-size: 1.7rem;
    margin-bottom: 4px;
    line-height: 1;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.treat-card .t-name {
    font-size: 0.68rem;
    font-weight: 600;
    color: #eee;
    word-break: keep-all;
    line-height: 1.2;
}

.modal-flower-thumb {
    width: 54px;
    height: 54px;
    object-fit: contain;
    margin-bottom: 6px;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.5));
}

.pet-letter-textarea {
    width: 100%;
    background: rgba(0,0,0,0.4);
    border: 1px solid #555;
    border-radius: 10px;
    padding: 10px;
    color: #fff;
    font-size: 0.85rem;
    box-sizing: border-box;
    resize: none;
    margin-bottom: 12px;
}

.send-letter-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    color: #111;
    font-weight: 800;
    font-size: 0.9rem;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(255, 154, 158, 0.4);
    transition: all 0.2s;
}

.send-letter-btn:hover {
    filter: brightness(1.08);
    transform: translateY(-2px);
}

.pet-reply-box {
    margin-top: 14px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px dashed #ffd700;
    border-radius: 10px;
    padding: 12px;
    text-align: left;
}

.reply-header {
    font-size: 0.82rem;
    font-weight: 800;
    color: #ffd700;
    margin-bottom: 6px;
}

.reply-content {
    font-size: 0.8rem;
    color: #eee;
    line-height: 1.4;
}

.modal-close-btn {
    margin-top: 12px;
    background: none;
    border: 1px solid #666;
    color: #aaa;
    padding: 6px 18px;
    border-radius: 8px;
    font-size: 0.75rem;
    cursor: pointer;
}

.modal-close-btn:hover {
    color: #fff;
    border-color: #999;
}

.candle-toggle-action-btn {
    background: rgba(255, 180, 50, 0.2);
    border: 1px solid #ffaa00;
    color: #ffcc66;
    padding: 8px 18px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.candle-toggle-action-btn.active {
    background: #ffaa00;
    color: #111;
}

.edit-input-group {
    text-align: left;
    margin-bottom: 12px;
}

.edit-input-group label {
    display: block;
    font-size: 0.75rem;
    color: #aaa;
    margin-bottom: 4px;
}

.edit-input-group input {
    width: 100%;
    background: rgba(0,0,0,0.4);
    border: 1px solid #555;
    border-radius: 8px;
    padding: 8px;
    color: #fff;
    font-size: 0.85rem;
    box-sizing: border-box;
}

.sample-pet-select-btn {
    flex: 1;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid #666;
    color: #fff;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 0.75rem;
    cursor: pointer;
}

.sample-pet-select-btn:hover {
    border-color: #ffb6c1;
    background: rgba(255, 182, 193, 0.2);
}

/* 🐾 Pet Breed & Model Selection Grid & Tabs */
.pet-model-tabs {
    display: flex;
    gap: 8px;
    margin: 10px 0 12px 0;
    background: rgba(0, 0, 0, 0.35);
    padding: 4px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.pet-tab-btn {
    flex: 1;
    padding: 8px 10px;
    background: transparent;
    border: none;
    border-radius: 9px;
    color: #bbb;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.pet-tab-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.pet-tab-btn.active {
    background: linear-gradient(135deg, #ffd700 0%, #ffaa00 100%);
    color: #111;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.35);
}

/* Compact Pet Select Modal to fit entire view on mobile without scrolling */
.pet-modal-card.pet-select-modal-compact {
    padding: 14px 12px 10px 12px !important;
    max-height: 94vh !important;
}

.pet-select-modal-compact .pet-select-modal-title {
    margin: 0 0 2px 0 !important;
    font-size: 0.98rem !important;
}

.pet-select-modal-compact .pet-select-modal-sub {
    font-size: 0.68rem !important;
    margin-bottom: 6px !important;
    line-height: 1.2 !important;
}

.pet-select-modal-compact .pet-model-tabs {
    margin-bottom: 6px !important;
    gap: 6px !important;
}

.pet-select-modal-compact .pet-tab-btn {
    padding: 4px 10px !important;
    font-size: 0.72rem !important;
    border-radius: 8px !important;
}

.pet-select-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
    margin: 4px 0 6px 0;
    max-height: 380px;
    overflow-y: auto;
    padding: 2px;
}

@media (max-width: 480px) {
    .pet-select-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 4px;
        margin: 4px 0 6px 0;
    }
}

.pet-select-card {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 4px 2px 3px 2px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.pet-select-card:hover {
    border-color: #ffd700;
    background: rgba(255, 215, 0, 0.15);
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.35);
}

.pet-select-card.selected {
    border: 2px solid #ffd700 !important;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.3) 0%, rgba(212, 175, 55, 0.4) 100%) !important;
    transform: scale(1.03) !important;
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.7), inset 0 0 8px rgba(255, 255, 255, 0.35) !important;
    position: relative;
}

.pet-select-card.selected::after {
    content: "✓";
    position: absolute;
    top: 2px;
    right: 2px;
    background: #ffd700;
    color: #111;
    font-size: 0.55rem;
    font-weight: 900;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.6);
}

.pet-select-card:active {
    transform: scale(0.97);
}

.pet-select-thumb {
    width: 36px;
    height: 36px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
    margin-bottom: 2px;
    transition: transform 0.2s ease;
}

.pet-select-card:hover .pet-select-thumb,
.pet-select-card.selected .pet-select-thumb {
    transform: scale(1.08);
}

.pet-select-card .p-name {
    font-size: 0.58rem;
    color: #eee;
    font-weight: 600;
    text-align: center;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.pet-select-card.selected .p-name {
    color: #ffffff;
    font-weight: 800;
    text-shadow: 0 1px 3px rgba(0,0,0,0.9);
}

.pet-select-bottom-actions {
    display: flex !important;
    flex-direction: row !important;
    gap: 6px !important;
    margin-top: 6px !important;
    width: 100% !important;
}

.pet-select-bottom-actions .pet-apply-model-btn {
    flex: 1.1 !important;
    padding: 8px 6px !important;
    background: linear-gradient(180deg, #ffd359 0%, #d4af37 40%, #9a7209 100%) !important;
    border: 1px solid #ffd700 !important;
    color: #111111 !important;
    font-size: 0.76rem !important;
    font-weight: 800 !important;
    border-radius: 10px !important;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.45), inset 0 1px 1px rgba(255, 255, 255, 0.8) !important;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.pet-select-bottom-actions .pet-apply-model-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 14px rgba(255, 215, 0, 0.6), inset 0 1px 1px rgba(255, 255, 255, 0.9) !important;
}

.pet-select-bottom-actions .pet-apply-model-btn:active {
    transform: scale(0.98);
}

.pet-select-bottom-actions .pet-direct-upload-btn {
    flex: 0.9 !important;
    padding: 8px 6px !important;
    background: linear-gradient(135deg, rgba(255, 154, 158, 0.3) 0%, rgba(254, 207, 239, 0.3) 100%) !important;
    border: 1px solid #ff9a9e !important;
    color: #ffeef2 !important;
    font-size: 0.74rem !important;
    font-weight: 700 !important;
    border-radius: 10px !important;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 3px 8px rgba(255, 154, 158, 0.25) !important;
    white-space: nowrap !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.pet-select-bottom-actions .pet-direct-upload-btn:hover {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%) !important;
    color: #111 !important;
    transform: translateY(-1px);
    box-shadow: 0 5px 12px rgba(255, 154, 158, 0.5) !important;
}

.pet-select-modal-compact .pet-select-close-btn {
    margin-top: 5px !important;
    padding: 4px 18px !important;
    font-size: 0.70rem !important;
}

/* ==========================================================================
   Pet Memorial BGM Healing Player & Modal Styles
   ========================================================================== */
.pet-bgm-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 14px 0;
    max-height: 240px;
    overflow-y: auto;
    padding-right: 4px;
}

.pet-bgm-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.22s ease;
    text-align: left;
}

.pet-bgm-card:hover {
    background: rgba(255, 215, 0, 0.08);
    border-color: rgba(255, 215, 0, 0.35);
    transform: translateX(3px);
}

.pet-bgm-card.active {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2) 0%, rgba(255, 182, 193, 0.2) 100%);
    border-color: #ffd700;
    box-shadow: 0 4px 14px rgba(255, 215, 0, 0.25);
}

.pet-bgm-card .bgm-icon {
    font-size: 1.4rem;
    flex-shrink: 0;
}

.pet-bgm-card .bgm-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.pet-bgm-card .bgm-title {
    font-size: 0.86rem;
    font-weight: 700;
    color: #fff;
}

.pet-bgm-card.active .bgm-title {
    color: #ffe57f;
}

.pet-bgm-card .bgm-desc {
    font-size: 0.72rem;
    color: #aaa;
    margin-top: 2px;
}

.pet-bgm-card .bgm-status-tag {
    font-size: 0.72rem;
    font-weight: 700;
    color: #ffd700;
    flex-shrink: 0;
}

.pet-bgm-controls {
    display: flex;
    gap: 10px;
    margin: 12px 0 16px;
}

.bgm-ctrl-btn, .bgm-mute-btn {
    flex: 1;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.bgm-ctrl-btn {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.25) 0%, rgba(255, 165, 0, 0.25) 100%);
    border: 1px solid #ffd700;
    color: #ffe57f;
}

.bgm-ctrl-btn:hover {
    background: #ffd700;
    color: #111;
}

.bgm-mute-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #eee;
}

.bgm-mute-btn.muted {
    background: rgba(255, 82, 82, 0.2);
    border-color: #ff5252;
    color: #ff8a80;
}

/* ==========================================================================
   Pet Auto Nu-kki (Cutout) Studio Modal Styles
   ========================================================================== */
.pet-cutout-modal-card {
    max-width: 380px !important;
    width: 92% !important;
}

.cutout-preview-container {
    width: 100%;
    height: 180px;
    border-radius: 14px;
    overflow: hidden;
    margin: 12px 0 10px;
    border: 1px solid rgba(255, 215, 0, 0.3);
    position: relative;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}

.cutout-preview-box {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.checkerboard-bg {
    background-color: #222;
    background-image: linear-gradient(45deg, #333 25%, transparent 25%),
                      linear-gradient(-45deg, #333 25%, transparent 25%),
                      linear-gradient(45deg, transparent 75%, #333 75%),
                      linear-gradient(-45deg, transparent 75%, #333 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
}

.cutout-preview-box img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.6));
    transition: transform 0.18s ease;
}

.room-preview-inner {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center bottom;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.cutout-preview-toggle-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
}

.cutout-tab-btn {
    flex: 1;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: #aaa;
    font-size: 0.74rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cutout-tab-btn.active {
    background: rgba(255, 215, 0, 0.2);
    border-color: #ffd700;
    color: #ffe57f;
}

.cutout-tuning-panel {
    background: rgba(0, 0, 0, 0.25);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cutout-slider-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cutout-slider-row .slider-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.74rem;
    color: #ddd;
    font-weight: 600;
}

.cutout-slider-row .slider-val {
    color: #ffd700;
    font-weight: 700;
}

.cutout-slider-row input[type="range"] {
    width: 100%;
    accent-color: #ffd700;
    cursor: pointer;
}

.cutout-quick-modes {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
    margin-bottom: 12px;
}

.quick-mode-btn {
    padding: 7px 4px;
    background: linear-gradient(180deg, rgba(46, 46, 54, 0.95) 0%, rgba(24, 24, 28, 0.98) 50%, rgba(12, 12, 16, 0.98) 100%);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 10px;
    color: #ccc;
    font-size: 0.68rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    white-space: nowrap;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.25);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.quick-mode-btn:hover {
    background: linear-gradient(180deg, rgba(62, 62, 74, 0.95) 0%, rgba(35, 35, 42, 0.98) 50%, rgba(18, 18, 24, 0.98) 100%);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-1px);
    box-shadow: 0 5px 12px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.quick-mode-btn.active {
    background: linear-gradient(180deg, #ffe072 0%, #e5be3a 40%, #b8860b 100%);
    border-color: #ffd700;
    color: #111;
    font-weight: 800;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.8), 0 2px 8px rgba(229, 190, 58, 0.45);
}

.cutout-apply-btn {
    background: linear-gradient(180deg, #ffd700 0%, #e5a700 50%, #b8860b 100%) !important;
    color: #111 !important;
    font-weight: 800 !important;
    font-size: 0.88rem !important;
    box-shadow: 0 4px 14px rgba(255, 215, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.6) !important;
    border: 1px solid rgba(255, 215, 0, 0.8) !important;
}

.cutout-apply-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(255, 215, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.8) !important;
}

/* ==========================================================================
   Global Mode Enforcement & Login Mode Tabs
   ========================================================================== */
.login-mode-tab-btn {
    flex: 1;
    padding: 12px 8px;
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(46, 46, 54, 0.95) 0%, rgba(24, 24, 28, 0.98) 50%, rgba(10, 10, 14, 0.98) 100%);
    border: 1px solid rgba(255, 255, 255, 0.22);
    color: #ccc;
    font-weight: 800;
    font-size: 0.88rem;
    cursor: pointer;
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
    text-align: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.25), inset 0 -1px 0 rgba(0, 0, 0, 0.7);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.login-mode-tab-btn:hover {
    background: linear-gradient(180deg, rgba(62, 62, 74, 0.95) 0%, rgba(35, 35, 42, 0.98) 50%, rgba(18, 18, 24, 0.98) 100%);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.login-mode-tab-btn.active.family-tab {
    background: linear-gradient(180deg, #ffe072 0%, #d4af37 40%, #9a7209 100%) !important;
    border-color: #ffd700 !important;
    color: #111 !important;
    font-weight: 900 !important;
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.8), inset 0 -1px 1px rgba(0, 0, 0, 0.4), 0 4px 14px rgba(212, 175, 55, 0.55) !important;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4) !important;
}

.login-mode-tab-btn.active.pet-tab {
    background: linear-gradient(180deg, #ffc0c8 0%, #ff9a9e 40%, #db7093 100%) !important;
    border-color: #ff9a9e !important;
    color: #111 !important;
    font-weight: 900 !important;
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.8), inset 0 -1px 1px rgba(0, 0, 0, 0.4), 0 4px 14px rgba(255, 154, 158, 0.55) !important;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4) !important;
}

/* Bulletproof mode-based hiding */
body.mode-pet #themeSelectionSection,
body.mode-pet #memorialAltar,
body.mode-pet .incense-section,
body.mode-pet .donation-section,
body.mode-pet .memory-wall,
body.mode-pet .live-stream-section,
body.mode-pet .header-content,
body.mode-pet .nav-family-group,
body.mode-pet #globalModeSwitcher {
    display: none !important;
}

body.mode-family #petMemorialSection,
body.mode-family .nav-pet-group,
body.mode-family #globalModeSwitcher {
    display: none !important;
}


