body {
        display: flex;
        flex-direction:column;
        justify-content: center;
        align-items: center;
        height: 100vh;
        margin: 0;
        font-family: Arial, sans-serif;
        text-align: center;
        transition: background-color 0.5s ease;    
        }
    
    h1 {
        margin-bottom: 20px;
    }

    .stack {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 28px;
    }

    button {
        padding: 15px 30px;
        font-size: 18px;
        cursor: pointer;
        margin-top: 20px;
    }

    button:disabled {
        background-color: #777;
        color: #eee;
        cursor: not-allowed;
        opacity: 0.9;
    }

    .btn {
        position: fixed;
        cursor: pointer;
        user-select: none;
        z-index: 1200;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        transition: left 0.25s ease, top 0.25s ease;
    }

    .progress {
        position: static;
        width: min(900px, 92vw);
        height: 22px;
        margin-top: 6px;
        background-color: #eee;
        border: 1px solid #aaa;
        border-radius: 10px;
        overflow: hidden;
    }

    .progress-fill {
        height: 100%;
        width: 0%;
        background: linear-gradient(90deg, #4f46e5, #22c55e);
        transition: width 0.4s ease;
    }

    .destruct-box {
        position: fixed;
        right: 16px;
        bottom: 16px;
        padding: 10px 14px;
        background: rgba(0,0,0,0.75);
        color: #fff;
        font-weight: 700;
        border-radius: 10px;
        z-index: 1400;
        backdrop-filter: blur(3px);
    }

    .self-destruct-overlay {
        position: fixed;
        inset: 0;
        background: radial-gradient(rgba(255,0,0,0.15), rgba(0,0,0,0.92));
        color: #fff;
        display: grid;
        place-items: center;
        font-size: clamp(28px, 6vw, 64px);
        font-weight: 900;
        letter-spacing: 1px;
        z-index: 2000;
        animation: boom 1.1s ease both;
    }

    .self-destruct-warning {
        font-size: 10px;
        opacity: 0.9;
        margin-bottom: 4px;
    }

    @keyframes boom {
        0% { opacity: 0; transform: scale(0.98);}
        40% { opacity: 1; transform: scale(1.02);}
        100% { opacity: 1; transform: scale(1);}
    }

    .rarity-wrap {
        position: fixed;
        inset: 0;
        display: grid;
        place-items: center;
        pointer-events: none;
        z-index: 1000;
    }

    .rarity {
        padding: 16px 24px;
        border-radius: 12px;
        background: rgba(0,0,0,0.7);
        backdrop-filter: blur(4px);
        text-align: center;
        transform: translateY(-10px) scale(0.95);
        opacity: 0;
        transition: transform 0.25s ease, opacity 0.25s ease;
    }

    .rarity.show {
        transform: translateY(0) scale(1);
        opacity: 1;
    }

    .rarity_tier { font-size: 20px; font-weight: bold; margin-bottom: 6px; }
    .rarity_name { font-size: 28px; font-weight: bold; }

    .tier-common { color: #9ca3af; }
    .tier-uncommon { color: #22c55e; }
    .tier-rare { color: #60a5fa; }
    .tier-legendary { color: #facc15; }

    .emoji-drop {
        position: fixed;
        top: -80px;
        left: 0;
        width: 40px;
        height: 40px;
        pointer-events: none;
        user-select: none;
        z-index: 900;
        will-change: transform, opacity;
        animation-name: emoji-fall;
        animation-timing-function: linear;
        animation-fill-mode: forwards;
    }
    
    @keyframes emoji-fall {
        0% { transform: translateY(0) rotate(0deg); opacity:1;}
        100% {transform: translateY(110vh) rotate(360deg); opacity: 0.85;}
    }

    @keyframes reenable-flash {
        0% { background-color: #4f46e5; color: #fff; }
        50% { background-color: #22c55e; color: #fff; }
        100% { background-color: #4f46e5; color: #fff; }
    }

    .btn.flash {
        animation: reenable-flash 1s ease;
    }

    .quake-shake {
        animation: quake-shake 0.6s linear infinite;
    }

    @keyframes quake-shake {
        0% { transform: translate(0, 0) rotate(0deg); }
        10% { transform: translate(-4px, -2px) rotate(-0.5deg); }
        20% { transform: translate(3px, 3px) rotate(0.4deg); }
        30% { transform: translate(-2px, 4px) rotate(0.2deg); }
        40% { transform: translate(5px, -3px) rotate(-0.6deg); }
        50% { transform: translate(-3px, 2px) rotate(0.3deg); }
        60% { transform: translate(4px, -4px) rotate(-0.4deg); }
        70% { transform: translate(-5px, 1px) rotate(0.5deg); }
        80% { transform: translate(2px, -3px) rotate(-0.2deg); }
        90% { transform: translate(-1px, 5px) rotate(0.2deg); }
        100% { transform: translate(0, 0) rotate(0deg); }
    }

    .quake-bubble {
        position: fixed;
        left: 0; top: 0;
        padding: 8px 12px;
        background: rgba(0,0,0,0.75);
        color: #fff;
        border-radius: 12px;
        font-weight: 800;
        letter-spacing: 0.5px;
        pointer-events: none;
        z-index: 1500;
        animation: quake-bubble 1.2s ease-out forwards;
        will-change: transform, opacity
    }

    @keyframes quake-bubble {
        0% { transform: translateY(0) scale(0.92); opacity: 0;}
        10% {opacity: 1; }
        100% { transform: translateY(-60px) scale(1.08); opacity: 0; }
    }

    .now-playing-toast {
        position: fixed;
        left: 50%;
        bottom: 72px;
        padding: 10px 14px;
        background: #111;
        color: #fff;
        font-weight: 700;
        border-radius: 10px;
        opacity: 0;
        transform: translateX(-50%) translateY(6px);
        transition: opacity .25s ease, transform .25s ease;
        z-index: 1600;
        pointer-events: none;
    }

    .now-playing-toast.show {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }

    .confetti-piece {
        position: fixed;
        width: 8px;
        height: 14px;
        border-radius: 2px;
        will-change: transform, opacity;
        pointer-events: none;
        z-index: 1400;
        animation: confetti-fly var(--dur, 1200ms) cubic-bezier(.25, .7, .2, 1) forwards;
        transform: translate(0, 0) rotate(0deg);
        opacity: 0.95;
    }

    @keyframes confetti-fly {
        0% { transform: translate(0,0) rotate(0deg); opacity: 1;}
        60% { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); opacity: 1;}
        100% { transform: translate(calc(var(--dx) * 1.15), calc(var(--dy) + 40px)) rotate(calc(var(--rot) * 1.15)); opacity: 0; }
    }

    .floor-confetti {
        position: fixed;
        bottom: 8px;
        width: 8px;
        height: 14px;
        border-radius: 2px;
        transform: rotate(var(--r, 0deg));
        opacity: 0.95;
        pointer-events: none;
        z-index: 800;
        transition: opacity .8s ease; 
    }

    .floor-confetti.fade-out { opacity: 0;}

    .yt-bg {
        position: fixed;
        inset: 0;
        width: 100%;
        height: 100%;
        z-index: -1;
        pointer-events: none;
    }

    .screensaver-overlay {
        position: fixed;
        inset: 0;
        z-index: 1100;
        pointer-events: none;
        mix-blend-mode: var(--ss-blend, multiply);
        opacity: var(--ss-alpha, 0.35);
        transition: opacity .25s ease;
    }

    .typed-msg {
        position: fixed;
        inset: 0;
        display: grid;
        place-items: center;
        padding: 24px;
        pointer-events: none;
        z-index: 1500;
        color: #fff;
        text-align: center;
        line-height: 1.1;
        font-weight: 900;
        text-shadow: 0 2px 8px rgba(0,0,0,0.35), 0 0 2px rgba(0,0,0,0.5);
        opacity: 1;
        transition: opacity 1s ease;
    }

    .typed-msg.fade-out { opacity: 0;}

    .typed-msg-content {
        display: inline-block;
        max-width: 90vw;
        font-weight: 700;
        letter-spacing: 0.5px;
        word-break: break-word;
        text-align: center;

        font-size: calc(100vw / var(--word-count, 10));
    }
    .inverse-cursor {
        position: fixed;
        width: 16px;
        height: 15px;
        border: 2px solid #fff;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.15);
        pointer-events: none;
        z-index: 2001;
        transform: translate(-9999px, -9999px);
        box-shadow: 0 0 6px rgba(0, 0, 0, 0.5);
    }

    .scene-layer {
        position:fixed;
        inset: 0;
        z-index: 1900;
        display: grid;
        place-items: center;
        background: #000;
    }

    body[data-scene="intro"] #stack,
    body[data-scene="outro"] #stack {
        display: none;
    }

    body[data-scene="game"] #stack {
        display: flex;
    }

    .screen {
        position: absolute;
        inset: 0;
        display: grid;
        place-items: center;
    }

    .type-block {
        max-width: 900px;
        padding: 20px;
        color: #fff;
        font-size: 22px;
        line-height: 1.5;
        font-weight: 700;
        letter-spacing: 0.5px;
        text-align: center;
    }

    .press-hint {
        position: absolute;
        bottom: 40px;
        left: 50%;
        transform: translateX(-50%);
        color: #fff;
        font-size: 18px;
        font-weight: 800;
        opacity: 0.85;
    }

    .table-bg {
        position: absolute;
        inset: 0;
        background: #222 url("assets/table_bg.jpg") center / cover no-repeat;
    }
    

    .letter-hotspot {
        position: absolute;
        left: 50%;
        top: 48%;
        width: 300px;
        height: 200px;
        transform: translate(-50%, -50%);
        background: rgba(255, 255, 255, 0.06);
        border: 2px dashed rgba(255, 255, 255, 0.2);
        border-radius: 8px;
        cursor: pointer;
    }

    .letter-modal {
        position: fixed;
        inset: 0;
        display: grid;
        place-items: center;
        background: rgba(0,0,0,0.5);
        z-index: 1950;
    }

    .letter-card {
        width: 640px;
        max-width: 92vw;
        background: #fff;
        color: #111;
        border-radius: 12px;
        padding: 20px;
        box-shadow: 0 12px 60px rgba(0,0,0,0.45);
    }

    .letter-text {
        font-size: 20px;
        line-height: 1.4;
        margin-bottom: 16px;
        font-weight: 800;
        letter-spacing: 0.5px;
        text-align: center;
    }

    .letter-actions {
        display: flex;
        justify-content: center;
    }

    .letter-btn {
        padding: 10px 16px;
        font-size: 16px;
        border-radius: 8px;
        border: none;
        background: #111;
        color: #fff;
        font-weight: 800;
        cursor: pointer;
    }
