/**
 * @module style.css
 * @description UI Architecture contendo Z-Stacking reverso, HUD de Game Engine e Book UI.
 * High-Key Edition (Branco e Rosa Pastel) + TV Media Controls.
 */

:root {
    --couro-dark: #2c1a11;
    --texto-claro: #f5f5f7;
    --texto-escuro: #2c2c2c;
    --anim-curve: cubic-bezier(0.23, 1, 0.32, 1);
    --borda-ouro: #c5a059;
    --pagina-stack: #fffaf0;
    --overlay-alpha: rgba(0, 0, 0, 0.2);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

*:focus,
*:focus-visible {
    outline: none;
}

::selection {
    background: transparent;
    color: inherit;
}

::-moz-selection {
    background: transparent;
    color: inherit;
}

body, html {
    width: 100vw; height: 100vh; color: var(--texto-claro); font-family: 'Lora', serif;
    overflow: hidden; -webkit-font-smoothing: antialiased; background:
    radial-gradient(circle at 20% 15%, rgba(255, 199, 132, 0.12), transparent 28%),
    radial-gradient(circle at 82% 18%, rgba(122, 168, 255, 0.14), transparent 32%),
    linear-gradient(180deg, #151922 0%, #090b11 100%);
    user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none;
    cursor: grab; 
}
body:active { cursor: grabbing; }
body::before,
body::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
}
body::before {
    z-index: 2;
    background:
    radial-gradient(circle at center, transparent 42%, rgba(4, 6, 10, 0.52) 100%),
    linear-gradient(180deg, rgba(255, 214, 164, 0.08), transparent 24%, transparent 72%, rgba(8, 12, 20, 0.28));
}
body::after {
    z-index: 1;
    opacity: 0.16;
    background-image:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
    background-size: 3px 3px, 3px 3px;
    mix-blend-mode: soft-light;
}

/* ==========================================================================
   WEBGL CONTEXT
   ========================================================================== */
#webgl-canvas { position: fixed; inset: 0; z-index: 0; outline: none; filter: saturate(1.08) contrast(1.04); }

#world-interaction-layer {
    position: fixed;
    inset: 0;
    z-index: 50000;
    pointer-events: none;
}

.floating-action-btn {
    position: fixed;
    left: 0;
    top: 0;
    transform: translate3d(calc(var(--tx, -500px) - 50%), calc(var(--ty, -500px) - 50%), 0);
    will-change: transform, opacity;
    min-width: 118px;
    padding: 9px 14px;
    border: 1px solid rgba(255, 244, 231, 0.24);
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(44, 28, 21, 0.68), rgba(94, 67, 53, 0.58));
    color: rgba(255, 243, 234, 0.88);
    font-family: 'Lora', serif;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    box-shadow: 0 10px 22px rgba(22, 10, 6, 0.16);
    backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.floating-action-btn.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.floating-action-btn:hover {
    background: linear-gradient(135deg, rgba(74, 48, 38, 0.82), rgba(121, 88, 71, 0.72));
    border-color: rgba(255, 244, 231, 0.42);
    /* Retiramos transform na transição, então o hover fará um pequeno pulo direto para -2px. Excelente performance. */
    transform: translate3d(calc(var(--tx, -500px) - 50%), calc(var(--ty, -500px) - 50% - 2px), 0);
}

#gift-surprise-overlay {
    position: fixed;
    inset: 0;
    z-index: 50020;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.35s ease;
}

#gift-surprise-overlay.active {
    opacity: 1;
}

.gift-flower-bloom {
    position: absolute;
    left: 50%;
    top: 44%;
    transform: translate(-50%, -50%) scale(0.35);
    font-size: clamp(3.4rem, 6vw, 5.6rem);
    filter: drop-shadow(0 16px 24px rgba(91, 24, 46, 0.3));
    opacity: 0;
}

#gift-surprise-overlay.active .gift-flower-bloom {
    animation: giftBloom 1.4s ease forwards;
}

.gift-flower-message {
    position: absolute;
    left: 50%;
    top: calc(44% + 64px);
    transform: translateX(-50%);
    padding: 10px 18px;
    border-radius: 999px;
    background: rgba(58, 31, 39, 0.54);
    border: 1px solid rgba(255, 232, 225, 0.24);
    color: #fff3ee;
    font-family: 'Playfair Display', serif;
    font-size: 1rem;
    letter-spacing: 0.04em;
    opacity: 0;
    backdrop-filter: blur(8px);
}

#gift-surprise-overlay.active .gift-flower-message {
    animation: giftMessageIn 1.1s ease 0.2s forwards;
}

#gift-petal-rain {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.gift-petal {
    position: absolute;
    top: -10%;
    width: 18px;
    height: 12px;
    border-radius: 70% 30% 70% 30%;
    opacity: 0;
    filter: blur(0.2px);
    animation: petalFall var(--petal-duration, 4.6s) linear forwards;
}

@keyframes giftBloom {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.35) rotate(-12deg); }
    45% { opacity: 1; transform: translate(-50%, -50%) scale(1.12) rotate(4deg); }
    100% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0deg); }
}

@keyframes giftMessageIn {
    0% { opacity: 0; transform: translateX(-50%) translateY(10px); }
    100% { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes petalFall {
    0% { opacity: 0; transform: translate3d(0, 0, 0) rotate(0deg) scale(0.8); }
    12% { opacity: 0.92; }
    100% { opacity: 0; transform: translate3d(var(--petal-drift, 40px), 115vh, 0) rotate(280deg) scale(1.08); }
}

/* ==========================================================================
    TV Media Controls HUD
    ========================================================================== */
#tv-interaction-prompt {
    position: fixed; top: 0; left: 0;
    transform: translate3d(calc(var(--tx, -500px) - 50%), calc(var(--ty, -500px) + 20px), 0);
    display: flex; gap: 15px; z-index: 50000; opacity: 0; pointer-events: none; visibility: hidden;
    transition: opacity 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), visibility 0.3s;
    will-change: transform, opacity;
}
#tv-interaction-prompt.visible {
    opacity: 1; visibility: visible;
    transform: translate3d(calc(var(--tx, -500px) - 50%), var(--ty, -500px), 0);
    pointer-events: auto;
}

.tv-ctrl-btn {
    background: linear-gradient(180deg, rgba(15, 20, 29, 0.9), rgba(8, 10, 16, 0.92)); color: #fff; padding: 12px 25px;
    font-family: 'Lora', serif; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em;
    border-radius: 999px; font-size: 0.75rem; border: 1px solid rgba(255,255,255,0.12);
    cursor: pointer; backdrop-filter: blur(8px); box-shadow: 0 18px 35px rgba(0,0,0,0.22); transition: all 0.2s ease;
}
.tv-ctrl-btn:hover { background: linear-gradient(180deg, rgba(223, 171, 160, 0.95), rgba(173, 118, 97, 0.95)); border-color: rgba(255, 225, 214, 0.9); transform: scale(1.05); }
.tv-ctrl-btn:active { transform: scale(0.95); }

/* ==========================================================================
   VIRTUAL JOYSTICK (Mobile Hardware Polling)
   ========================================================================== */
#virtual-joystick {
    position: fixed; bottom: 35px; left: 35px; width: 130px; height: 130px;
    z-index: 50000; touch-action: none; display: none; 
}
#mobile-fullscreen-toggle {
    position: fixed;
    right: 20px;
    bottom: 38px;
    z-index: 1000001;
    display: none;
    min-width: 132px;
    padding: 13px 18px;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(15, 20, 29, 0.9), rgba(8, 10, 16, 0.92));
    color: #fff;
    font-family: 'Lora', serif;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    box-shadow: 0 18px 35px rgba(0,0,0,0.22);
    backdrop-filter: blur(8px);
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease, opacity 0.2s ease;
}
#mobile-fullscreen-toggle:hover { background: linear-gradient(180deg, rgba(223, 171, 160, 0.95), rgba(173, 118, 97, 0.95)); }
#mobile-fullscreen-toggle:active { transform: scale(0.96); }
#mobile-fullscreen-toggle.is-hidden { opacity: 0; pointer-events: none; }
@media (pointer: coarse) {
    #virtual-joystick { display: block; }
    #mobile-fullscreen-toggle { display: block; }
}
.joystick-base {
    position: absolute; inset: 0; background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(223, 171, 160, 0.5); border-radius: 50%;
    display: flex; align-items: center; justify-content: center; backdrop-filter: blur(4px);
    transition: border-color 0.2s ease, background 0.2s ease;
}
.joystick-stick {
    width: 55px; height: 55px; background: rgba(223, 171, 160, 0.8);
    border-radius: 50%; box-shadow: 0 0 15px rgba(223, 171, 160, 0.4);
    position: absolute; transform: translate(0px, 0px); pointer-events: none;
    transition: background 0.2s ease; will-change: transform;
}
.joystick-base.active { border-color: rgba(223, 171, 160, 0.8); background: rgba(255, 255, 255, 0.4); }
.joystick-base.active .joystick-stick { background: rgba(197, 160, 89, 0.9); }

/* ==========================================================================
   GLOBAL ILLUMINATION BLOCKER (Abajur)
   ========================================================================== */
#room-darkness-overlay {
    position: fixed; inset: 0; z-index: 999999;
    background: transparent; /* Remove peso de renderização do CSS (GPU fill-rate) para não travar */
    box-shadow: inset 0 0 200px 100px rgba(0, 0, 0, 0.85); /* Vinheta super leve apenas nas bordas */
    display: flex; align-items: flex-start; justify-content: center;
    transition: opacity 2.5s ease-in-out, background-color 1s ease;
}
#room-darkness-overlay.lit { opacity: 0; pointer-events: none; }

.lamp-switch-wrapper { display: flex; flex-direction: column; align-items: center; cursor: pointer; transform-origin: top center; animation: subtleSwing 4s ease-in-out infinite alternate; padding: 0 40px 40px 40px; }
.pull-cord { width: 2px; height: 180px; background: linear-gradient(to bottom, #dfaba0 0%, #c5a059 100%); box-shadow: 0 0 10px rgba(223, 171, 160, 0.5); transition: height 0.2s ease; }
.pull-ring { width: 24px; height: 24px; border: 3px solid #dfaba0; border-radius: 50%; box-shadow: 0 0 15px rgba(223, 171, 160, 0.6), inset 0 0 5px rgba(223, 171, 160, 0.3); background: transparent; transition: transform 0.2s ease; }
.pull-hint { margin-top: 25px; font-family: 'Lora', serif; font-size: 0.75rem; color: #dfaba0; text-transform: uppercase; letter-spacing: 0.2em; opacity: 0.8; animation: fadeHint 2s infinite alternate; }

.lamp-switch-wrapper:active .pull-cord { height: 200px; }
.lamp-switch-wrapper:active .pull-ring { transform: scale(0.9); }
@keyframes subtleSwing { 0% { transform: rotate(-3deg); } 100% { transform: rotate(3deg); } }

/* ==========================================================================
   MODULE ISOLATION (Book Container)
   ========================================================================== */
.isolated-module { position: fixed; inset: 0; z-index: 99900; background: #000; opacity: 0; pointer-events: none; visibility: hidden; transition: opacity 1.2s ease-in-out, visibility 1.2s; cursor: default; }
.isolated-module.active { opacity: 1; pointer-events: auto; visibility: visible; }
.module-close-btn { position: absolute; top: 30px; left: 30px; z-index: 100000; background: rgba(0,0,0,0.6); border: 1px solid rgba(255,255,255,0.2); color: #fff; padding: 10px 20px; font-family: 'Lora', serif; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em; border-radius: 4px; cursor: pointer; backdrop-filter: blur(5px); transition: background 0.3s ease; }
.module-close-btn:hover { background: rgba(223, 171, 160, 0.4); border-color: #dfaba0; }

#subsystem-letter {
    background:
    radial-gradient(circle at 20% 18%, rgba(255, 231, 207, 0.18), transparent 32%),
    radial-gradient(circle at 78% 16%, rgba(214, 186, 255, 0.12), transparent 30%),
    linear-gradient(180deg, rgba(17, 12, 18, 0.97), rgba(8, 6, 10, 0.98));
}
.letter-shell {
    position: absolute;
    inset: 88px 20px 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}
.letter-card {
    width: min(92vw, 860px);
    max-height: min(78vh, 760px);
    overflow: auto;
    padding: clamp(24px, 3vw, 42px);
    border-radius: 30px;
    background:
    linear-gradient(180deg, rgba(255, 251, 244, 0.98), rgba(243, 230, 214, 0.98)),
    url('https://www.transparenttextures.com/patterns/paper-fibers.png');
    border: 1px solid rgba(119, 79, 54, 0.16);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.65);
    color: #3d2b24;
}
.letter-header {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}
.letter-meta {
    font-family: 'Lora', serif;
    font-size: clamp(0.95rem, 0.9rem + 0.25vw, 1.08rem);
    color: #5a4033;
}
.letter-meta strong {
    font-family: 'Playfair Display', serif;
    font-size: 1.08em;
    margin-right: 6px;
}
.letter-divider {
    height: 1px;
    margin: 12px 0 20px;
    background: linear-gradient(90deg, transparent, rgba(122, 83, 56, 0.42), transparent);
}
.letter-body {
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.letter-body p {
    font-family: 'Lora', serif;
    font-size: clamp(1rem, 0.94rem + 0.28vw, 1.12rem);
    line-height: 1.9;
    color: #352721;
    text-wrap: pretty;
}
.letter-card::-webkit-scrollbar {
    width: 10px;
}
.letter-card::-webkit-scrollbar-thumb {
    background: rgba(117, 80, 60, 0.35);
    border-radius: 999px;
}

#subsystem-paint {
    background:
    radial-gradient(circle at 18% 20%, rgba(255, 215, 180, 0.16), transparent 30%),
    radial-gradient(circle at 85% 22%, rgba(129, 165, 255, 0.14), transparent 28%),
    linear-gradient(180deg, rgba(19, 23, 34, 0.98), rgba(7, 10, 15, 0.98));
}
.paint-studio-shell {
    position: absolute;
    inset: 78px 28px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    justify-content: center;
}
.paint-studio-header {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.paint-studio-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.45rem, 1.15rem + 1vw, 2.1rem);
    color: #f4e3c5;
    font-style: italic;
}
.paint-studio-subtitle {
    font-family: 'Lora', serif;
    font-size: 0.76rem;
    color: rgba(244, 227, 197, 0.82);
    letter-spacing: 0.04em;
}
.paint-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: center;
    padding: 9px 12px;
    border-radius: 18px;
    background: rgba(255, 249, 241, 0.08);
    border: 1px solid rgba(255, 234, 211, 0.14);
    backdrop-filter: blur(8px);
}
.paint-colors {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: center;
    max-width: min(100%, 420px);
}
.paint-color {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    border: 2px solid rgba(255,255,255,0.45);
    background: var(--swatch);
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.paint-color.is-active {
    transform: scale(1.12);
    border-color: #ffe6c7;
    box-shadow: 0 0 0 4px rgba(255, 214, 164, 0.18);
}
.paint-brush-control {
    display: flex;
    gap: 10px;
    align-items: center;
    font-family: 'Lora', serif;
    font-size: 0.82rem;
    color: #f4e3c5;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.paint-brush-control input {
    width: 140px;
}
.paint-action-btn {
    border: 1px solid rgba(255,255,255,0.16);
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(223, 171, 160, 0.96), rgba(173, 118, 97, 0.96));
    color: #fff;
    font-family: 'Lora', serif;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 11px 18px;
    cursor: pointer;
}
.paint-action-btn:hover {
    filter: brightness(1.05);
}
.paint-canvas-frame {
    width: min(86vw, 920px);
    height: min(56vh, 560px);
    background: linear-gradient(135deg, #f6eadc, #e6d7c8);
    padding: 10px;
    border-radius: 24px;
    box-shadow: 0 24px 60px rgba(0,0,0,0.34);
}
#paint-canvas {
    width: 100%;
    height: 100%;
    display: block;
    background: #fffdf8;
    border-radius: 18px;
    cursor: crosshair;
    touch-action: none;
}

/* ==========================================================================
   BOOK UI & TYPOGRAPHY
   ========================================================================== */
#book-container { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 10; }
.van-gogh-background { position: absolute; inset: -5%; z-index: 1; pointer-events: none; }
.van-gogh-image { width: 100%; height: 100%; object-fit: cover; animation: subtlePan 30s ease-in-out infinite alternate; will-change: transform; }
.van-gogh-overlay { position: absolute; inset: 0; background-color: var(--overlay-alpha); z-index: 2; }
.paper-texture { position: absolute; inset: 0; background-image: url('https://www.transparenttextures.com/patterns/paper-fibers.png'); opacity: 0.15; pointer-events: none; z-index: 100; }
#star-particles { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 4; opacity: 0.65; }

.page { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; perspective: 2500px; padding: 20px; z-index: 1; opacity: 0; pointer-events: none; transition: opacity 0.8s ease; }
.page.hero { opacity: 1; z-index: 20; pointer-events: none; }
.page.active { opacity: 1; z-index: 30; pointer-events: none; }

.book-cover-wrapper { width: min(82vw, 370px); height: min(74vh, 530px); position: relative; transform-style: preserve-3d; transition: transform 1.2s var(--anim-curve); box-shadow: 30px 30px 70px rgba(0,0,0,0.65); border-radius: 4px 12px 12px 4px; will-change: transform; cursor: pointer; pointer-events: auto; }
.book-cover-front { position: absolute; inset: 0; background-color: var(--couro-dark); background-image: linear-gradient(to right, rgba(255,255,255,0.08) 0%, rgba(255,255,255,0) 8%), url('./imagens/yasmin1.png'); background-size: cover; background-position: center; border: 3px solid var(--borda-ouro); border-radius: 4px 12px 12px 4px; z-index: 5; transform: translateZ(1px); backface-visibility: hidden; }
.book-cover-inside { position: absolute; inset: -3px; background-color: #3e2723; background-image: url('https://www.transparenttextures.com/patterns/paper-fibers.png'); border: 3px solid var(--borda-ouro); border-radius: 12px 4px 4px 12px; box-shadow: inset -15px 0 30px rgba(0,0,0,0.8); transform: translateZ(-2px) rotateY(180deg); z-index: 4; backface-visibility: hidden; }
.book-spine { position: absolute; left: 0; top: 0; bottom: 0; width: 25px; background: linear-gradient(to right, #1f120b 0%, #2a170f 55%, #4a2d1d 100%); box-shadow: inset -5px 0 15px rgba(0,0,0,0.4); transform: translateX(-20px) rotateY(-95deg); transform-origin: right; border-radius: 4px 0 0 4px; z-index: 3; }
.book-cover-wrapper::after { content: ''; position: absolute; top: 5px; bottom: 5px; right: 5px; width: 100%; background-color: var(--pagina-stack); background-image: repeating-linear-gradient(transparent, transparent 2px, rgba(0,0,0,0.03) 2px, rgba(0,0,0,0.03) 4px); border-right: 4px solid var(--borda-ouro); border-radius: 0 10px 10px 0; transform: translateZ(-5px) translateX(-5px) rotateY(1deg); z-index: 1; }

.content { width: min(82vw, 370px); height: min(74vh, 530px); background-color: var(--pagina-stack); background-image: linear-gradient(90deg, rgba(0,0,0,0.08) 0%, rgba(0,0,0,0.02) 8%, transparent 15%), url('https://www.transparenttextures.com/patterns/paper-fibers.png'); border-radius: 4px 12px 12px 4px; box-shadow: inset 15px 0 20px -10px rgba(0,0,0,0.15), 15px 15px 40px rgba(0,0,0,0.5); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 25px; gap: 15px; overflow: hidden; opacity: 0; transform: rotateY(15deg) translateX(30px); transform-origin: left center; transition: opacity 0.8s ease, transform 0.8s var(--anim-curve); pointer-events: none; cursor: pointer; position: relative; }
.page.active .content { opacity: 1; transform: rotateY(0deg) translateX(0); pointer-events: auto; }

.content.editorial-layout { padding: 45px 30px; justify-content: center; }
.photo-wrapper { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; margin: 0 auto; width: 100%; }
.editorial-layout .photo-frame { width: min(55vw, 190px); aspect-ratio: 4 / 5; max-height: min(35vh, 230px); border: 8px solid #ffffff; border-bottom-width: 25px; box-shadow: 0 6px 15px rgba(0,0,0,0.2); border-radius: 2px; margin: 0 auto; position: relative; overflow: hidden; transition: transform 0.3s ease, box-shadow 0.3s ease; background-size: cover; background-position: center; }
.chapter-eyes-layout {
    justify-content: flex-start;
    padding: 18px 24px 34px;
    gap: 8px;
    overflow: hidden;
}
.chapter-eyes-photo-wrapper {
    gap: 8px;
    max-width: 100%;
    flex-shrink: 0;
}
.chapter-eyes-photo {
    width: min(36vw, 128px);
    aspect-ratio: 3 / 4;
    margin-bottom: 2px;
}
.chapter-eyes-layout .chapter-title {
    width: 92%;
    font-size: 0.68rem;
    letter-spacing: 0.12em;
}
.chapter-eyes-layout .page-ornament { margin: 4px auto 10px auto; }
.chapter-eyes-layout .safe-zone { margin-top: 0; padding: 0 4px; }
.chapter-eyes-layout .magic-text { font-size: clamp(0.84rem, 0.8vw + 0.8rem, 1rem); line-height: 1.5; }
.chapter-eyes-layout .magic-text.verse { margin-bottom: 8px; }
.quiz-layout {
    justify-content: flex-start;
    align-items: stretch;
    padding: 24px 24px 38px;
    gap: 10px;
    overflow: hidden;
}
.quiz-layout .chapter-title {
    width: 100%;
    font-size: 0.8rem;
}
.quiz-block {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.quiz-question {
    font-family: 'Lora', serif;
    font-size: 0.86rem;
    line-height: 1.45;
    color: #4c372d;
    text-align: left;
    font-weight: 700;
}
.quiz-options {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 9px;
    padding: 0;
    margin: 0;
}
.quiz-options li {
    padding-left: 0;
}
.quiz-option {
    width: 100%;
    border: 1px solid rgba(122, 92, 72, 0.18);
    border-radius: 12px;
    background: rgba(255, 252, 246, 0.82);
    color: var(--texto-escuro);
    font-family: 'Lora', serif;
    font-size: 0.8rem;
    line-height: 1.42;
    text-align: left;
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.quiz-option:hover {
    background: rgba(246, 233, 221, 0.96);
    border-color: rgba(122, 92, 72, 0.35);
}
.quiz-option.is-selected {
    transform: translateY(-1px);
}
.quiz-option.is-correct {
    background: rgba(217, 241, 220, 0.95);
    border-color: rgba(76, 136, 88, 0.6);
    color: #21492c;
}
.quiz-option.is-wrong {
    background: rgba(248, 219, 219, 0.95);
    border-color: rgba(165, 72, 72, 0.58);
    color: #6a2020;
}
.quiz-feedback {
    min-height: 24px;
    width: 100%;
    font-family: 'Lora', serif;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-align: left;
    color: #7a5c48;
}
.quiz-feedback.is-correct {
    color: #2f6a3f;
}
.quiz-feedback.is-wrong {
    color: #8a2f2f;
}
.photo-frame.interactive-frame { cursor: pointer; }
.photo-frame.interactive-frame:hover { transform: scale(1.03); box-shadow: 0 10px 25px rgba(0,0,0,0.3); }
.click-hint { position: absolute; bottom: -20px; left: 50%; transform: translateX(-50%); font-family: 'Lora', serif; font-size: 0.6rem; color: #a1a1a1; text-transform: uppercase; letter-spacing: 0.1em; opacity: 0; transition: opacity 0.3s ease; }
.photo-frame.interactive-frame:hover .click-hint { opacity: 1; }
.chapter-title { font-family: 'Lora', serif; font-size: 0.75rem; letter-spacing: 0.15em; text-transform: uppercase; color: #5a4033; text-align: center; width: 80%; margin: 0 auto; }
.page-ornament { width: 50px; height: 1px; background-color: rgba(90, 64, 51, 0.4); margin: 10px auto 20px auto; position: relative; }
.page-ornament::before { content: '✦'; position: absolute; top: -11px; left: 50%; transform: translateX(-50%); font-size: 14px; color: rgba(90, 64, 51, 0.7); background: var(--pagina-stack); padding: 0 6px; }
.page-number { position: absolute; bottom: 20px; font-family: 'Lora', serif; font-size: 0.75rem; color: rgba(90, 64, 51, 0.6); font-style: italic; }
.safe-zone { width: 100%; position: relative; margin-top: 5px; padding: 0 10px; }
.magic-text { font-size: clamp(0.9rem, 1vw + 0.85rem, 1.1rem); line-height: 1.6; color: var(--texto-escuro); font-style: italic; font-family: 'Playfair Display', serif; text-align: center; }
.magic-text.verse { margin-bottom: 15px; }
.editorial-layout .magic-text { font-weight: 400; color: var(--texto-escuro); }
.editorial-layout .magic-text:first-of-type::first-letter { all: unset; }
.photo-frame { width: min(60vw, 220px); aspect-ratio: 3 / 4; max-height: min(38vh, 250px); background-size: cover; background-position: center; border: 8px solid #ffffff; box-shadow: 0 6px 15px rgba(0,0,0,0.2); margin: 0 auto 15px auto; border-radius: 2px; overflow: hidden; }

/* ==========================================================================
   GALAXY MAP ENGINE
   ========================================================================== */
#immersion-layer { position: absolute; inset: 0; z-index: 9999; overflow: hidden; background: radial-gradient(circle at center, #0a0e19 0%, #000000 100%); pointer-events: none; opacity: 0; transition: opacity 1.5s ease; cursor: grab; }
#immersion-layer.active { pointer-events: auto; opacity: 1; }
#galaxy-map { position: absolute; width: 300vw; height: 300vh; top: -100vh; left: -100vw; will-change: transform; }
#galaxy-map:active { cursor: grabbing; }
#static-stars-layer { position: absolute; width: 100%; height: 100%; border-radius: 50%; pointer-events: none; }
.interactive-star { position: absolute; width: 80px; height: 80px; transform: translate(-50%, -50%); display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 20; pointer-events: auto; -webkit-tap-highlight-color: transparent; }
.star-core { width: 6px; height: 6px; background: #fff; border-radius: 50%; animation: pulsarCore 1.5s ease-in-out infinite alternate; }
.star-halo { position: absolute; width: 100%; height: 100%; border-radius: 50%; background: radial-gradient(circle, rgba(197, 160, 89, 0.8) 0%, transparent 60%); animation: pulsarHalo 2s ease-in-out infinite alternate; pointer-events: none; }
@keyframes pulsarCore { 0% { transform: scale(0.6); opacity: 0.3; box-shadow: 0 0 5px 1px rgba(255,255,255,0.5); } 100% { transform: scale(1.6); opacity: 1; box-shadow: 0 0 15px 4px #fff, 0 0 30px 10px var(--borda-ouro); } }
@keyframes pulsarHalo { 0% { transform: scale(0.6); opacity: 0.1; } 100% { transform: scale(1.3); opacity: 0.9; } }
.interactive-star:hover .star-halo { transform: scale(1.5); animation-play-state: paused; opacity: 1; }
#hud-message-overlay { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.85); backdrop-filter: blur(8px); display: flex; flex-direction: column; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity 0.6s ease; z-index: 50; padding: 30px; cursor: default; }
#hud-message-overlay.visible { opacity: 1; pointer-events: auto; }
#hud-text { font-family: 'Playfair Display', serif; font-size: clamp(1.4rem, 2.5vw + 1rem, 2.2rem); color: #f2e3c6; line-height: 1.6; font-style: italic; text-align: center; max-width: 800px; text-shadow: 0 0 20px rgba(242, 227, 198, 0.3); transform: translateY(20px); transition: transform 0.6s ease; }
#hud-message-overlay.visible #hud-text { transform: translateY(0); }
.hud-hint { margin-top: 40px; font-family: 'Lora', serif; font-size: 0.75rem; color: rgba(242, 227, 198, 0.6); text-transform: uppercase; letter-spacing: 0.25em; animation: fadeHint 3s ease-in-out infinite alternate; }
@keyframes fadeHint { 0% { opacity: 0.2; } 100% { opacity: 0.8; } }
#close-immersion { position: absolute; bottom: 5%; left: 50%; transform: translateX(-50%); z-index: 100; background: rgba(10, 14, 25, 0.8); border: 1px solid rgba(242, 227, 198, 0.3); color: #f2e3c6; font-family: 'Lora', serif; text-transform: uppercase; letter-spacing: 0.2em; font-size: 0.7rem; padding: 12px 30px; border-radius: 4px; cursor: pointer; transition: all 0.4s ease; backdrop-filter: blur(4px); }
#close-immersion:hover { background: rgba(242, 227, 198, 0.2); border-color: rgba(242, 227, 198, 0.8); }

/* ==========================================================================
   MEDIA QUERIES (Responsividade)
   ========================================================================== */
@media (max-width: 767px) {
    .book-cover-wrapper, .content { width: min(86vw, 350px); height: min(70vh, 500px); }
    .content.editorial-layout { padding: 26px 20px; gap: 10px; }
    .editorial-layout .photo-frame { width: min(48vw, 168px); max-height: min(28vh, 190px); border-width: 6px; border-bottom-width: 18px; }
    .photo-frame { width: min(52vw, 182px); max-height: min(30vh, 200px); border-width: 6px; }
    .chapter-eyes-photo { width: min(32vw, 112px); max-height: min(24vh, 145px); }
    .letter-shell { inset: 82px 10px 16px; }
    .letter-card { width: 100%; max-height: 82vh; padding: 22px 18px 24px; border-radius: 24px; }
    .letter-body p { line-height: 1.78; }
    #tv-interaction-prompt { flex-direction: column; gap: 10px; bottom: 10%; }
    .floating-action-btn { min-width: 108px; padding: 8px 12px; font-size: 0.66rem; }
    .paint-studio-shell { inset: 74px 10px 12px; gap: 8px; }
    .paint-studio-title { font-size: clamp(1.2rem, 4.4vw, 1.5rem); }
    .paint-studio-subtitle { font-size: 0.7rem; }
    .paint-toolbar { gap: 8px; padding: 8px 10px; }
    .paint-brush-control { width: 100%; justify-content: center; }
    .paint-canvas-frame { width: 100%; height: min(52vh, 420px); padding: 8px; }
}

@media (pointer: coarse), (max-width: 900px) {
    body::before,
    body::after {
        display: none;
    }

    #webgl-canvas {
        filter: none;
    }

    .tv-ctrl-btn,
    .joystick-base,
    #mobile-fullscreen-toggle,
    #room-darkness-overlay,
    .module-close-btn,
    .paint-toolbar,
    #hud-message-overlay,
    #close-immersion {
        backdrop-filter: none;
    }

    .tv-ctrl-btn,
    .book-cover-wrapper,
    .content,
    .editorial-layout .photo-frame,
    .photo-frame,
    .pull-cord,
    .pull-ring,
    #mobile-fullscreen-toggle,
    #hud-text {
        box-shadow: none;
        text-shadow: none;
    }

    .lamp-switch-wrapper,
    .van-gogh-image,
    .interactive-star,
    .star-core,
    .star-halo {
        animation: none;
    }

    #star-particles,
    .paper-texture,
    .interactive-star .star-halo {
        display: none;
    }
}