

@layer base {
  button:not(:disabled),
  [role="button"]:not(:disabled) {
    cursor: pointer;
  }
}

.book-shell {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

html, body {
            margin: 0;
            width: 100%;
            height: 100%;
            overflow: hidden;
            background: radial-gradient(circle at center, #240000 0%, #0a0001 50%, #000000 100%);
            font-family: 'Playfair Display', serif;
            touch-action: none;
        }
        
        #vignette {
            position: fixed; top: 0; left: 0; width: 100%; height: 100%;
            background: radial-gradient(circle, transparent 55%, rgba(20, 0, 0, 0.7) 100%);
            pointer-events: none; z-index: 5;
        }

        #noise {
            position: fixed; top: 0; left: 0; width: 100%; height: 100%;
            background: transparent;
            opacity: 0.06; pointer-events: none; z-index: 6;
            filter: contrast(150%);
        }

        #ui {
            position: absolute; bottom: 30px; width: 100%; text-align: center;
            color: #ffdd99; font-size: 12px; pointer-events: none;
            letter-spacing: 3px; text-transform: uppercase;
            text-shadow: 0 0 10px rgba(255, 221, 153, 0.5);
            z-index: 10; opacity: 0.8;
        }

        /* --- STYLE CHO PHẦN CREDIT MỚI --- */
        #credit {
            position: absolute; bottom: 20px; left: 20px;
            color: #d4af37; font-family: 'Playfair Display', serif;
            font-size: 12px; letter-spacing: 2px;
            z-index: 100; opacity: 0.6;
            text-shadow: 0 0 5px rgba(212, 175, 55, 0.5);
            font-style: italic; pointer-events: none;
        }

        #subtitle-container {
            position: absolute; bottom: 80px; width: 100%; 
            display: flex; justify-content: center; pointer-events: none; z-index: 20;
        }
        #subtitle {
            font-family: 'Playfair Display', serif; 
            font-weight: 700; font-style: italic; font-size: 24px; color: #ffdd99; 
            text-shadow: 0 2px 4px rgba(0, 0, 0, 0.9);
            background: rgba(20, 0, 0, 0.8); border: 2px solid #d4af37; border-radius: 0px;
            box-shadow: 0 0 20px rgba(212, 175, 55, 0.3), inset 0 0 20px rgba(0,0,0,0.8);
            padding: 20px 50px; backdrop-filter: blur(5px);
            opacity: 0; transition: opacity 0.5s ease-in-out;
            max-width: 80%; text-align: center; line-height: 1.5;
        }

        #loading-screen {
            position: fixed; top: 0; left: 0; width: 100%; height: 100%;
            background: radial-gradient(circle at center, #240000 0%, #0a0001 50%, #000000 100%);
            color: #d4af37; z-index: 9999;
            display: flex; flex-direction: column; justify-content: center; align-items: center;
            transition: opacity 1s;
        }
        .loader { border: 5px solid #333; border-top: 5px solid #d4af37; border-radius: 50%; width: 50px; height: 50px; animation: spin 1s linear infinite; margin-bottom: 20px; }
        @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

        /* --- MAGIC LOCK STYLES --- */
        #lock-overlay {
            position: fixed; top: 0; left: 0; width: 100%; height: 100%;
            background: rgba(0, 0, 0, 0.85);
            backdrop-filter: blur(10px);
            z-index: 9000;
            display: flex; justify-content: center; align-items: center;
            transition: opacity 2s ease-in-out, visibility 2s;
            pointer-events: auto; /* Cho phép nhận events */
        }

        #lock-canvas {
            position: absolute; top: 0; left: 0; width: 100%; height: 100%;
            cursor: crosshair; /* Thêm cursor để dễ nhìn */
        }

        #final-text {
            position: absolute; top: 50%; left: 50%;
            transform: translate(-50%, -50%);
            font-family: 'Playfair Display', serif;
            font-size: 100px;
            color: #ffd700;
            opacity: 0;
            pointer-events: none;
            text-shadow: 0 0 30px #ffd700, 0 0 60px #ffaa00;
            transition: opacity 1.5s ease-out;
            z-index: 100;
            letter-spacing: 5px;
            white-space: nowrap;
            display: flex;
            align-items: baseline;
            gap: 15px;
            max-width: 90%;
        }

        /* Responsive cho mobile */
        @media (max-width: 768px) {
            #final-text {
                font-size: 60px;
                gap: 10px;
                letter-spacing: 3px;
                max-width: 95%;
            }
        }

        @media (max-width: 480px) {
            #final-text {
                font-size: 40px;
                gap: 8px;
                letter-spacing: 2px;
                max-width: 95%;
            }
        }

        /* Khi chữ quá dài, tự động scale down */
        @media (max-width: 380px) {
            #final-text {
                font-size: 32px;
                gap: 6px;
                letter-spacing: 1px;
            }
        }

        #guide-text {
            position: absolute; top: 15%;
            width: 100%; text-align: center;
            font-family: 'Playfair Display', serif;
            color: #ffdd99; font-size: 14px; letter-spacing: 4px;
            text-transform: uppercase; opacity: 0.6;
            pointer-events: none;
            transition: opacity 0.5s;
            text-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
            animation: pulseGuide 3s infinite ease-in-out;
        }
        @keyframes pulseGuide { 0% { opacity: 0.4; } 50% { opacity: 0.8; } 100% { opacity: 0.4; } }

        #book-guide-text {
            position: absolute; top: 15%;
            width: 100%; text-align: center;
            font-family: 'Playfair Display', serif;
            color: #ffdd99; font-size: 18px; letter-spacing: 4px;
            text-transform: uppercase; opacity: 0;
            pointer-events: none;
            transition: opacity 0.5s;
            text-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
            animation: pulseGuide 3s infinite ease-in-out;
            z-index: 15;
        }
#hearts-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 15;
}

#loading-text {
  font-size: 12px;
  color: #888;
}

#lock-canvas,
canvas {
  touch-action: none;
}



/* LEMY integration keeps the original burgundy/gold book and adds compact, accessible reading controls. */
html,body{height:100%;min-height:100%;overscroll-behavior:none}
*,*::before,*::after{box-sizing:border-box}
button{font:500 14px 'Playfair Display',serif;cursor:pointer;touch-action:manipulation}
[hidden]{display:none!important}
#loading-screen{pointer-events:none}
#guide-text{top:max(90px,13vh);padding:0 22px;letter-spacing:2px;line-height:1.7;font-size:clamp(12px,2.5vw,14px);opacity:.9}
#unlock-book{position:absolute;bottom:max(65px,12vh);left:50%;transform:translateX(-50%);padding:12px 28px;min-height:44px;border:1px solid #d4af3780;border-radius:999px;background:#240a0ae6;color:#ffe8b0;box-shadow:0 0 20px #d4af371a;pointer-events:auto}
#unlock-book:focus-visible,#book-actions button:focus-visible{outline:3px solid #fff0b5;outline-offset:5px}
#final-text{font-size:clamp(20px,6vw,70px);white-space:normal;width:90%;justify-content:center;flex-wrap:wrap;gap:10px;line-height:1.3;overflow-wrap:anywhere;text-align:center}
.lock-initial{font-size:1.75em;font-weight:400;transform:scaleY(1.1);display:inline-block;transform-origin:bottom}
#ui{bottom:max(115px,env(safe-area-inset-bottom));padding:0 50px;font-size:11px;letter-spacing:2px;overflow-wrap:anywhere;line-height:1.5}
#credit{bottom:max(8px,env(safe-area-inset-bottom));left:12px;font-size:10px;letter-spacing:.6px}
#book-guide-text{top:16%;font-size:clamp(12px,2.9vw,18px);letter-spacing:2px;padding:0 26px;line-height:1.6;animation:none}
#book-actions{position:fixed;z-index:40;left:12px;right:12px;bottom:max(24px,env(safe-area-inset-bottom));pointer-events:auto;text-align:center}
#chapter-status{color:#ffe4a7;text-shadow:0 1px 6px #000;font-size:12px;line-height:1.5;margin-bottom:7px;overflow-wrap:anywhere}
.book-buttons{display:flex;justify-content:center;gap:8px}
#book-actions button{border:1px solid #d4af3766;border-radius:999px;min-height:42px;min-width:42px;padding:8px 16px;color:#ffe4a7;background:#240a0ad9;backdrop-filter:blur(8px);box-shadow:0 3px 12px #0004}
#book-actions button:hover{background:#501010}
#book-prev,#book-next{font-family:Arial,sans-serif;font-size:18px}
#subtitle-container{bottom:max(150px,24vh);padding:0 12px}
#subtitle{font-size:clamp(14px,3.8vw,24px);max-width:min(86vw,800px);max-height:27vh;overflow:auto;padding:14px 22px;line-height:1.5;overflow-wrap:anywhere;background:#140000d9;border-width:1px;border-radius:8px}
@media(max-width:600px){#ui{bottom:116px;padding-inline:24px;font-size:10px;letter-spacing:1.2px}#book-guide-text{top:17%}#subtitle-container{bottom:155px}#subtitle{max-width:94vw;max-height:24vh;padding:11px 15px}.book-buttons{gap:6px}#book-actions button{padding:8px 13px;min-height:44px}#chapter-status{font-size:11px}#final-text{gap:8px;letter-spacing:1px}}
@media(max-height:480px){#guide-text{top:64px}#unlock-book{bottom:24px;padding:8px 24px}#book-guide-text{top:65px}#ui{display:none}#book-actions{bottom:10px}#chapter-status{font-size:10px;margin-bottom:3px}#book-actions button{min-height:36px;padding-block:5px}#subtitle-container{bottom:88px}#subtitle{font-size:14px;max-height:25vh;padding:8px 12px}#credit{font-size:9px}}
@media(prefers-reduced-motion:reduce){.loader{animation:none}#guide-text{animation:none}#lock-overlay,#final-text,#subtitle{transition:none}}

#subtitle{pointer-events:auto;touch-action:pan-y}
#loading-screen{transition:opacity .25s ease}
#subtitle:focus-visible{outline:2px solid #ffe8b0;outline-offset:3px}
