:root {
  --ink: #fff4dc; --ink-dim: #e6d6b8; --plum: #1d1428; --plum-2: #2b1d3a; --panel: rgba(29, 20, 40, .78);
  --gold: #e8c26a; --gold-2: #f7dc92; --gold-deep: #b98a2e; --teal: #5fd0bd; --coral: #ff7a6b; --violet: #b58cff;
  --serif: Georgia, 'Iowan Old Style', 'Palatino Linotype', 'Book Antiqua', 'Times New Roman', serif;
  --sans: 'Trebuchet MS', 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--plum); color: var(--ink); font-family: var(--sans); overflow: hidden; overscroll-behavior: none; touch-action: none; -webkit-user-select: none; user-select: none; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--gold-2); outline-offset: 2px; }
#scene { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; outline: none; }

/* ---------- carregamento */
.loading { position: fixed; inset: 0; display: grid; place-content: center; gap: 10px; text-align: center; background: radial-gradient(circle at 50% 40%, #3b2650, #140d1c 70%); z-index: 50; transition: opacity .6s; }
.loading.done { opacity: 0; pointer-events: none; }
.loading h1 { font-family: var(--serif); font-size: clamp(30px, 6vw, 54px); margin: 0; color: var(--gold-2); letter-spacing: .5px; }
.loading .bar { width: min(320px, 70vw); height: 8px; border-radius: 99px; background: rgba(255,255,255,.12); overflow: hidden; margin: 8px auto; }
.loading .bar div { height: 100%; width: 0; background: linear-gradient(90deg, var(--gold-deep), var(--gold-2)); transition: width .2s; }
.eyebrow { text-transform: uppercase; letter-spacing: 2.5px; font-size: 11px; color: var(--gold); margin: 0; font-weight: 700; }

/* ---------- HUD */
.hud { position: fixed; left: 0; right: 0; top: 0; padding: calc(12px + var(--safe-t)) 14px 0; display: flex; align-items: flex-start; gap: 10px; pointer-events: none; z-index: 10; }
.panel { background: var(--panel); border: 2px solid rgba(232, 194, 106, .75); border-radius: 12px; box-shadow: 0 6px 18px rgba(0,0,0,.35), inset 0 0 0 1px rgba(0,0,0,.4); backdrop-filter: blur(4px); }
.height-panel { padding: 6px 14px 8px; min-width: 128px; }
.height { font-family: var(--serif); font-size: 34px; line-height: 1; font-weight: 700; color: var(--ink); text-shadow: 0 2px 0 #000; }
.height small { font-size: 16px; margin-left: 3px; color: var(--gold-2); }
.chapter { font-size: 11px; letter-spacing: 1.6px; text-transform: uppercase; color: var(--gold); font-weight: 700; margin-top: 2px; }
.best-mini { font-size: 11px; color: var(--ink-dim); margin-top: 2px; }
.challenge { padding: 7px 12px 9px; max-width: 250px; display: grid; gap: 1px; font-size: 12px; }
.challenge-label { font-size: 9.5px; letter-spacing: 1.6px; text-transform: uppercase; color: var(--teal); font-weight: 700; }
.challenge strong { font-family: var(--serif); font-size: 15px; }
.challenge span#challenge-detail { color: var(--ink-dim); }
.challenge.done { border-color: var(--teal); }
.challenge.done .challenge-label::after { content: ' · selo conquistado ✓'; }
.challenge.failed { opacity: .55; }
.challenge.failed .challenge-label::after { content: ' · tente de novo'; color: var(--coral); }
.progress { height: 5px; background: rgba(255,255,255,.14); border-radius: 9px; overflow: hidden; margin-top: 5px; }
.progress div { height: 100%; width: 0; background: linear-gradient(90deg, var(--teal), #b8fff0); transition: width .25s; }
.hud-right { margin-left: auto; display: flex; gap: 8px; align-items: center; pointer-events: auto; }
.pages { display: flex; align-items: center; gap: 6px; padding: 5px 12px 5px 8px; font-family: var(--serif); font-size: 22px; font-weight: 700; }
.pages img { width: 24px; height: 30px; object-fit: contain; filter: drop-shadow(0 0 6px rgba(255,200,90,.8)); }
.pages.pulse { animation: pulse .45s ease-out; }
@keyframes pulse { 40% { transform: scale(1.18); border-color: var(--gold-2); } }
.round { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--gold); background: var(--panel); font-size: 18px; display: grid; place-items: center; box-shadow: 0 4px 12px rgba(0,0,0,.35); }
.round:hover { background: var(--plum-2); }
.round.off { opacity: .6; text-decoration: line-through; }

/* ---------- faixa de capítulo e avisos */
.banner { position: fixed; left: 50%; top: 24%; transform: translate(-50%, -10px); text-align: center; pointer-events: none; opacity: 0; transition: opacity .5s, transform .5s; z-index: 9; display: grid; gap: 4px; width: min(90vw, 560px); }
.banner.show { opacity: 1; transform: translate(-50%, 0); }
.banner.small { top: calc(96px + var(--safe-t)); gap: 0; }
.banner.small strong { font-size: 30px; }
.banner.small span { font-size: 14px; }
@media (max-width: 640px) { .banner.small { top: calc(150px + var(--safe-t)); } }
.banner small { color: var(--gold); letter-spacing: 3px; text-transform: uppercase; font-weight: 700; font-size: 12px; text-shadow: 0 2px 6px #000; }
.banner strong { font-family: var(--serif); font-size: clamp(30px, 6vw, 52px); color: var(--ink); text-shadow: 0 3px 0 rgba(0,0,0,.6), 0 0 24px rgba(0,0,0,.6); line-height: 1.05; }
.banner span { color: var(--ink-dim); font-style: italic; font-family: var(--serif); font-size: 17px; text-shadow: 0 2px 6px #000; }
.toast { position: fixed; left: 50%; bottom: calc(118px + var(--safe-b)); transform: translate(-50%, 20px); background: var(--panel); border: 2px solid var(--gold); border-radius: 999px; padding: 9px 18px; font-size: 14px; opacity: 0; transition: opacity .3s, transform .3s; z-index: 12; max-width: min(92vw, 520px); text-align: center; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.fly-page { position: fixed; width: 26px; height: 34px; z-index: 11; pointer-events: none; transition: transform .6s cubic-bezier(.5,-0.2,.7,1), opacity .6s; filter: drop-shadow(0 0 8px rgba(255,200,90,.9)); }

/* ---------- toque */
.touch { position: fixed; left: 0; right: 0; bottom: calc(14px + var(--safe-b)); display: flex; justify-content: space-between; padding: 0 14px; pointer-events: none; z-index: 10; }
.touch button { pointer-events: auto; width: 84px; height: 84px; border-radius: 22px; border: 2px solid rgba(232,194,106,.6); background: rgba(29,20,40,.45); font-size: 30px; color: var(--ink); backdrop-filter: blur(3px); touch-action: none; }
.touch button.held { background: rgba(232,194,106,.35); transform: scale(.96); }

/* ---------- sobreposições */
.overlay { position: fixed; inset: 0; display: grid; place-items: center; z-index: 20; padding: 18px; background: radial-gradient(ellipse at 50% 55%, rgba(20,12,30,.05), rgba(15,9,24,.55) 75%); }
.overlay[hidden] { display: none; }
@media (min-width: 900px) { .overlay[data-state=menu] { justify-items: start; padding-left: max(5vw, 24px); } }
.card { width: min(94vw, 460px); background: linear-gradient(180deg, rgba(43,29,58,.92), rgba(24,16,34,.94)); border: 2px solid var(--gold); border-radius: 18px; padding: 22px 22px 18px; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.55), inset 0 0 0 1px rgba(0,0,0,.5); display: grid; gap: 10px; }
.title-block { display: grid; gap: 2px; }
.title-block h1 { font-family: var(--serif); font-size: clamp(34px, 8vw, 50px); margin: 0; line-height: 1; color: var(--gold-2); text-shadow: 0 3px 0 #2a1733; }
.title-block .byline { font-family: var(--serif); font-style: italic; color: var(--ink-dim); font-size: 17px; }
.portrait { width: 116px; height: 116px; image-rendering: pixelated; margin: -6px auto -4px; filter: drop-shadow(0 6px 10px rgba(0,0,0,.5)); }
.lead { margin: 0; color: var(--ink-dim); font-size: 15px; line-height: 1.45; }
.stats { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--ink-dim); }
.stats b { color: var(--ink); font-family: var(--serif); font-size: 16px; }
.btn { border: 0; border-radius: 12px; padding: 13px 18px; font-weight: 700; font-size: 16px; letter-spacing: .3px; }
.btn.primary { background: linear-gradient(180deg, var(--gold-2), var(--gold) 55%, var(--gold-deep)); color: #2b1a10; box-shadow: 0 0 0 3px rgba(255,236,170,.35), 0 6px 0 #6b4a16, 0 10px 20px rgba(0,0,0,.4); font-size: 19px; }
.btn.primary:active { transform: translateY(3px); box-shadow: 0 0 0 3px rgba(255,236,170,.35), 0 3px 0 #6b4a16; }
.btn.secondary { background: rgba(255,244,220,.1); border: 2px solid rgba(232,194,106,.6); }
.btn.ghost { background: none; border: 2px solid transparent; color: var(--ink-dim); text-decoration: underline; text-underline-offset: 3px; padding: 8px; font-weight: 600; font-size: 14px; }
.row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.row .btn { flex: 1 1 0; min-width: 120px; }
.keys { font-size: 12.5px; color: var(--ink-dim); display: flex; gap: 6px; justify-content: center; align-items: center; flex-wrap: wrap; }
kbd { display: inline-block; border: 1px solid rgba(255,244,220,.5); border-bottom-width: 3px; border-radius: 6px; padding: 1px 7px; font-size: 12px; font-family: var(--sans); background: rgba(255,255,255,.06); }
.result-height { font-family: var(--serif); font-size: 64px; line-height: 1; font-weight: 700; }
.result-height small { font-size: 22px; color: var(--gold-2); }
.ribbon { justify-self: center; background: var(--coral); color: #fff; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; font-size: 12px; padding: 5px 14px; border-radius: 4px; box-shadow: 0 3px 0 #9b3a33; }
.ribbon.gold { background: var(--gold); color: #3a2410; box-shadow: 0 3px 0 var(--gold-deep); }
.stamp { display: inline-flex; gap: 8px; align-items: center; justify-content: center; padding: 8px 12px; border: 2px dashed var(--teal); border-radius: 12px; color: #c9fff4; font-size: 14px; }
.stamp.miss { border-color: rgba(255,255,255,.25); color: var(--ink-dim); }
.route { font-size: 12px; color: var(--ink-dim); letter-spacing: .5px; }

/* ---------- diálogo */
dialog { width: min(96vw, 860px); max-height: min(92vh, 900px); border: 2px solid var(--gold); border-radius: 18px; padding: 0; background: linear-gradient(180deg, #2b1d3a, #1a1224); color: var(--ink); box-shadow: 0 30px 80px rgba(0,0,0,.6); overflow: hidden; }
dialog::backdrop { background: rgba(10, 6, 16, .6); backdrop-filter: blur(2px); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px 20px; border-bottom: 1px solid rgba(232,194,106,.3); }
.modal-header h2 { margin: 0; font-family: var(--serif); font-size: 24px; color: var(--gold-2); }
.modal-body { padding: 16px 20px 22px; overflow: auto; max-height: calc(min(92vh, 900px) - 70px); -webkit-user-select: text; user-select: text; touch-action: pan-y; }
.modal-lead { margin: 0 0 14px; color: var(--ink-dim); line-height: 1.5; }
.album-head { display: grid; grid-template-columns: 120px 1fr; gap: 16px; align-items: center; margin-bottom: 14px; }
.album-cover { position: relative; width: 120px; aspect-ratio: 600/796; border-radius: 6px; overflow: hidden; box-shadow: 0 8px 18px rgba(0,0,0,.5); }
.album-cover img { width: 100%; height: 100%; object-fit: cover; }
.album-cover span { position: absolute; left: 27%; right: 27%; top: 19.5%; height: 14%; display: grid; place-items: center; font-family: var(--serif); color: #4a2a55; font-size: 8.5px; line-height: 1.05; text-align: center; font-weight: 700; }
@media (max-width: 640px) { .album-cover span { font-size: 6.5px; } }
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.story-card { background: rgba(255,244,220,.06); border: 2px solid rgba(232,194,106,.45); border-radius: 12px; padding: 8px; text-align: left; display: grid; gap: 4px; }
.story-card img { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 8px; }
.story-card h3 { margin: 2px 0 0; font-family: var(--serif); font-size: 16px; }
.story-card p { margin: 0; font-size: 12.5px; color: var(--ink-dim); }
.story-card.locked img { filter: grayscale(1) brightness(.35) blur(3px); }
.story-card.locked { border-style: dashed; opacity: .85; }
.story-detail { display: grid; grid-template-columns: minmax(0, 300px) 1fr; gap: 18px; align-items: start; }
.story-detail img { width: 100%; border-radius: 12px; border: 2px solid var(--gold); }
.story-detail h3 { font-family: var(--serif); font-size: 28px; margin: 4px 0; }
.story-detail h4 { margin: 0 0 10px; color: var(--gold); font-weight: 600; }
.story-detail p { line-height: 1.6; font-size: 16px; }
.fiction { font-size: 12px; color: var(--ink-dim); font-style: italic; margin-top: 14px; }
.looks-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.look-card { border: 2px solid rgba(232,194,106,.45); border-radius: 14px; padding: 10px; text-align: center; background: rgba(255,244,220,.05); display: grid; gap: 6px; }
.look-card img { width: 100%; max-width: 150px; margin: 0 auto; image-rendering: pixelated; aspect-ratio: 192/160; }
.look-card.selected { border-color: var(--teal); box-shadow: 0 0 0 2px rgba(95,208,189,.35); }
.look-card.locked img { filter: brightness(0) opacity(.45); }
.look-card h3 { margin: 0; font-family: var(--serif); }
.look-card p { margin: 0; font-size: 12.5px; color: var(--ink-dim); }
.help-list { padding-left: 18px; line-height: 1.55; margin: 0 0 14px; }
.legend { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin: 8px 0 16px; }
.legend div { display: flex; gap: 10px; align-items: center; background: rgba(255,244,220,.05); border-radius: 10px; padding: 8px; font-size: 13px; }
.legend img { width: 64px; height: 44px; object-fit: contain; }
.goal-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.goal-item { border: 1px solid rgba(232,194,106,.35); border-radius: 10px; padding: 8px 10px; font-size: 13px; display: grid; gap: 2px; }
.goal-item span { color: var(--ink-dim); }
.goal-item.done { border-color: var(--teal); background: rgba(95,208,189,.1); }
.settings-row { display: flex; align-items: center; gap: 12px; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,.08); flex-wrap: wrap; }
.settings-row input[type=range] { flex: 1; min-width: 140px; accent-color: var(--gold); }
.seg { display: inline-flex; border: 2px solid rgba(232,194,106,.6); border-radius: 10px; overflow: hidden; }
.seg button { background: none; border: 0; padding: 7px 12px; font-size: 13px; }
.seg button[aria-pressed=true] { background: var(--gold); color: #2b1a10; font-weight: 700; }
.credits p { line-height: 1.55; color: var(--ink-dim); }
.credits strong { color: var(--ink); }
.noscript { position: fixed; inset: 0; display: grid; place-items: center; }

@media (max-width: 640px) {
  .hud { padding: calc(8px + var(--safe-t)) 8px 0; gap: 6px; flex-wrap: wrap; }
  .height-panel { min-width: 104px; padding: 5px 10px 6px; }
  .height { font-size: 28px; }
  .challenge { order: 3; max-width: none; flex: 1 1 100%; padding: 5px 10px 7px; grid-template-columns: auto 1fr; column-gap: 8px; font-size: 11px; }
  .challenge strong { font-size: 13px; }
  .challenge .challenge-label { grid-column: 1 / -1; }
  .challenge .progress { grid-column: 1 / -1; margin-top: 3px; }
  .round { width: 40px; height: 40px; }
  .pages { font-size: 19px; padding: 4px 10px 4px 6px; }
  .touch button { width: 76px; height: 76px; }
  .card { padding: 18px 16px 14px; gap: 8px; }
  .story-detail { grid-template-columns: 1fr; }
  .album-head { grid-template-columns: 90px 1fr; }
  .album-cover { width: 90px; }
  .result-height { font-size: 52px; }
  .banner { top: 30%; }
}
@media (prefers-reduced-motion: reduce) { .banner, .toast, .fly-page { transition: none; } }

/* ---------- guia "Como jogar" (kit da coleção, 2.2.0) com as cores e letras do caderno */
:root {
  --cj-painel: #1a1224; --cj-painel-2: #2b1d3a; --cj-texto: var(--ink); --cj-suave: var(--ink-dim);
  --cj-destaque: var(--gold); --cj-destaque-texto: #2b1a10; --cj-borda: #0f0918; --cj-fonte: var(--sans); --cj-raio: 18px;
}
.cj-fundo { background: rgba(10, 6, 16, .72); }
.cj-topo h2, .cj-titulo-cartao { font-family: var(--serif); }
.cj-topo h2 { color: var(--gold-2); font-size: 1.3rem; }
.cj-titulo-cartao { font-size: 1.25rem; color: var(--gold-2); }
.cj-anfitria { width: 52px; height: 52px; filter: drop-shadow(0 3px 5px rgba(0,0,0,.5)); }
.cj-clipe { border-color: rgba(232,194,106,.6); }
.cj-clipe video { image-rendering: auto; }
.cj-prox { box-shadow: 0 3px 0 var(--gold-deep); }

/* ---------- metas (no álbum desde a 2.2.0) */
.metas-titulo { font-family: var(--serif); margin: 18px 0 8px; }

/* ---------- tutorial jogável (2.2.0): pedido ancorado no alvo */
.tuto { position: fixed; inset: 0; pointer-events: none; z-index: 11; }
.tuto-anel, .tuto-seta, .tuto-balao { position: absolute; left: 0; top: 0; will-change: transform; }
.tuto-anel { border: 4px dashed #ffd35a; border-radius: 50%; box-shadow: 0 0 0 2px #2a1733, inset 0 0 0 2px #2a1733, 0 0 18px rgba(255, 210, 90, .85); animation: tuto-pulso 1.1s ease-in-out infinite alternate; }
.tuto-seta { width: 28px; text-align: center; font-size: 30px; line-height: 1; color: #ffd35a; text-shadow: 0 0 0 #2a1733, 2px 2px 0 #2a1733, -2px 2px 0 #2a1733, 0 -1px 0 #2a1733, 0 0 10px rgba(0, 0, 0, .6); }
.tuto-seta span { display: block; animation: tuto-bob .8s ease-in-out infinite alternate; }
.tuto-balao { width: max-content; max-width: min(340px, calc(100vw - 16px)); background: linear-gradient(180deg, rgba(43, 29, 58, .96), rgba(24, 16, 34, .96)); border: 2px solid var(--gold); border-radius: 14px; padding: 8px 14px 9px; text-align: center; box-shadow: 0 10px 26px rgba(0, 0, 0, .5); }
.tuto-balao { transition: opacity .15s; }
.tuto-balao.atras { opacity: .28; }
.tuto-passo { display: block; font-size: 10.5px; letter-spacing: 1.6px; text-transform: uppercase; font-weight: 700; color: var(--teal); }
.tuto-texto { margin: 3px 0 0; font-size: 16.5px; font-weight: 700; line-height: 1.35; color: var(--ink); }
.tuto-texto kbd { font-size: 13px; padding: 1px 7px; background: var(--gold); color: #2b1a10; border-color: #6b4a16; font-weight: 700; }
.tuto-dica { margin: 3px 0 0; font-size: 13px; line-height: 1.35; color: var(--ink-dim); }
.tuto-dica[hidden] { display: none; }
.tuto-btn { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; border: 2px solid var(--gold); background: rgba(29, 20, 40, .8); font-size: 14px; vertical-align: middle; margin: -4px 1px 0; }
.tuto-pular { position: fixed; left: 50%; bottom: calc(26px + var(--safe-b)); transform: translateX(-50%); z-index: 11; min-height: 44px; padding: 8px 18px; border-radius: 999px; border: 2px solid rgba(232, 194, 106, .6); background: rgba(29, 20, 40, .72); color: var(--ink); font-weight: 700; font-size: 14px; backdrop-filter: blur(3px); }
.tuto-pular:hover { background: var(--plum-2); }
.touch button.tuto-foco { border-color: var(--gold-2); box-shadow: 0 0 0 4px rgba(247, 220, 146, .95), 0 0 22px rgba(247, 220, 146, .75); animation: tuto-brilho 1.1s ease-in-out infinite alternate; }
@keyframes tuto-pulso { from { opacity: 1; } to { opacity: .7; } }
@keyframes tuto-brilho { from { box-shadow: 0 0 0 4px rgba(247, 220, 146, .95), 0 0 22px rgba(247, 220, 146, .75); } to { box-shadow: 0 0 0 7px rgba(247, 220, 146, .55), 0 0 30px rgba(247, 220, 146, .45); } }
@keyframes tuto-bob { from { transform: translateY(-4px); } to { transform: translateY(4px); } }
@media (max-width: 640px) { .tuto-texto { font-size: 15.5px; } .tuto-pular { bottom: calc(30px + var(--safe-b)); } }
@media (prefers-reduced-motion: reduce) { .tuto-anel, .tuto-seta span, .touch button.tuto-foco { animation: none; } }
