/* ATRAVESSA — neon de túnel. Fundo quase preto puxado pro roxo, traço que brilha,
   cor só onde tem significado (cada peça tem a sua). Tudo respeita a área segura
   (notch / barra). Display: Audiowide (logo, títulos — o zero dela é cortado, então NÚMEROS vão em Chakra Petch); texto: Chakra Petch. */
:root {
  --bg0: #07051A;
  --bg1: #1A0E40;
  --line: rgba(170, 160, 255, 0.28);
  --text: #ECE8FF;
  --muted: #9089C0;
  --cyan: #22F3FF;
  --pink: #FF3FD0;
  --yellow: #FFE14D;
  --lime: #7CFF5B;
  --violet: #9B6BFF;
  --danger: #FF2E4D;
  --radius: 14px;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --font: "Chakra Petch", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Audiowide", "Chakra Petch", system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body { background: radial-gradient(110% 80% at 50% 42%, var(--bg1), var(--bg0)); color: var(--text); font: 16px/1.4 var(--font); user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.hidden { display: none !important; }
button, select { font-family: inherit; }
button:focus-visible, select:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

.boot { position: fixed; inset: 0; display: grid; place-items: center; }
.boot-mark { width: 64px; height: 64px; border: 2px solid var(--cyan); box-shadow: 0 0 18px rgba(34,243,255,0.6), inset 0 0 12px rgba(34,243,255,0.3); animation: bootIn 1.2s ease-in infinite; }
@keyframes bootIn { from { transform: scale(0.3); opacity: 0; } 70% { opacity: 1; } to { transform: scale(1.4); opacity: 0; } }

.screen { position: fixed; inset: 0; padding: calc(16px + var(--sat)) 16px calc(16px + var(--sab)); }

/* ── capa (sem rolagem: espaços acompanham a ALTURA da tela) ───────────────── */
.home { display: flex; flex-direction: column; align-items: center; overflow: hidden; padding-top: calc(10px + var(--sat)); padding-bottom: calc(10px + var(--sab)); }
.home > * { width: 100%; max-width: 420px; }
.home-top { display: flex; justify-content: space-between; align-items: center; }
.lang-pill { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border: 1.5px solid rgba(170,160,255,0.35); border-radius: 999px; background: rgba(14,11,42,0.6); color: var(--text); font-weight: 700; font-size: 15px; cursor: pointer; }
.lang-pill select { appearance: none; -webkit-appearance: none; background: transparent; border: 0; color: inherit; font: inherit; padding: 0; cursor: pointer; outline: none; }
.lang-pill select option { background: #0E0B2A; }
.lang-pill span { font-size: 11px; pointer-events: none; }
.top-link { display: inline-flex; align-items: center; gap: 8px; background: none; border: 0; color: #C9C3F0; font: inherit; font-size: 16px; cursor: pointer; padding: 6px 0; }
.top-link svg { width: 24px; height: 24px; }
.logo { margin: clamp(6px, 1.6dvh, 16px) 0 0; text-align: center; font-family: var(--display); font-weight: 400; letter-spacing: 0.04em;
  font-size: clamp(34px, min(12vw, 7dvh), 58px); line-height: 1; color: #fff; cursor: default;
  text-shadow: 0 0 18px rgba(255,63,208,0.65), 0 0 2px #fff; }
.hero-wrap { flex: 1 1 0; min-height: 0; max-width: none; container-type: size; display: grid; place-items: center; }
.hero { width: min(86cqmin, 330px); height: min(86cqmin, 330px); overflow: visible; }
.hero-tunnel { fill: none; stroke: rgba(107,75,255,0.45); stroke-width: 1.2; }
.hero-wall { transform-origin: 0 0; animation: wallCome 2.4s cubic-bezier(.6,0,.9,.4) infinite; }
.hero-wall .glass { fill: rgba(34,243,255,0.13); stroke: rgba(34,243,255,0.6); stroke-width: 1.5; }
.hero-wall .hole { fill: none; stroke: var(--cyan); stroke-width: 3; filter: drop-shadow(0 0 5px var(--cyan)); }
.hero-piece { transform-origin: 0 0; animation: pieceSpin 2.4s steps(1, end) infinite; }
.hero-piece use { fill: rgba(255,63,208,0.55); stroke: var(--pink); stroke-width: 3; filter: drop-shadow(0 0 8px var(--pink)); }
@keyframes wallCome { 0% { transform: scale(0.12); opacity: 0; } 15% { opacity: 1; } 78% { transform: scale(1); opacity: 1; } 100% { transform: scale(2.2); opacity: 0; } }
@keyframes pieceSpin { 0% { transform: rotate(180deg); } 30% { transform: rotate(270deg); } 62% { transform: rotate(360deg); } 100% { transform: rotate(360deg); } }
.taglines { text-align: center; }
.tagline { margin: 0; font-family: var(--display); font-size: clamp(16px, min(5.4vw, 3dvh), 24px); color: #fff; letter-spacing: 0.02em; }
.subline { margin: 0.6dvh 0 0; font-size: clamp(14px, min(4.2vw, 2.3dvh), 18px); color: #B9A8FF; }
.btn-play { width: 100%; display: flex; align-items: center; justify-content: center; gap: 14px; border: 0; cursor: pointer;
  margin-top: clamp(12px, 2.4dvh, 22px); padding: clamp(10px, 2.1dvh, 18px); border-radius: clamp(16px, 2.6dvh, 22px);
  background: var(--cyan); color: #050416; font-family: var(--display); font-size: clamp(20px, 3.3dvh, 26px); letter-spacing: 0.06em; box-shadow: 0 0 26px rgba(34,243,255,0.55); transition: transform 0.08s; }
.btn-play svg { width: clamp(24px, 4dvh, 34px); height: clamp(24px, 4dvh, 34px); }
.btn-play:active { transform: scale(0.97); }
.stats { display: grid; grid-template-columns: 1fr 1fr; margin-top: clamp(12px, 2dvh, 18px); border: 1.5px solid rgba(170,160,255,0.28); border-radius: 18px; background: rgba(14,11,42,0.5); }
.stats div { text-align: center; padding: clamp(6px, 1.3dvh, 12px) 6px; min-width: 0; }
.stats div + div { border-left: 1.5px solid rgba(170,160,255,0.22); }
.stats small { display: block; font-size: 12px; letter-spacing: 0.14em; color: #9D8CFF; font-weight: 700; }
.stats b { font-weight: 700; font-size: clamp(20px, 3.2dvh, 26px); color: #fff; font-variant-numeric: tabular-nums; }
.a11y-link { margin: clamp(10px, 2dvh, 18px) auto 0; display: inline-flex; align-items: center; justify-content: center; gap: 10px; background: none; border: 0; color: #B9A8FF; font: inherit; font-size: 16px; font-weight: 700; cursor: pointer; }
.a11y-link svg { width: 26px; height: 26px; }
.foot { display: flex; justify-content: center; align-items: center; margin: clamp(4px, 1dvh, 10px) 0 0; flex-wrap: wrap; }
.foot-link { background: none; border: 0; color: #C9C3F0; font: inherit; font-size: 14px; text-decoration: none; cursor: pointer; padding: 6px 12px; white-space: nowrap; }
.foot-link + .foot-link { border-left: 1.5px solid rgba(170,160,255,0.3); }
.foot-link .warn { color: var(--yellow); }

/* ── botões / painéis ──────────────────────────────────────────────────── */
.btn { width: 100%; padding: 14px 16px; border-radius: var(--radius); border: 1.5px solid var(--line); background: rgba(14,11,42,0.7); color: var(--text);
  font-size: 17px; font-weight: 700; letter-spacing: 0.06em; cursor: pointer; transition: transform 0.08s, box-shadow 0.15s; }
.btn:active { transform: scale(0.97); }
.btn-primary { border-color: var(--cyan); color: #fff; font-size: 19px; padding: 17px; text-shadow: 0 0 10px var(--cyan);
  box-shadow: 0 0 18px rgba(34,243,255,0.45), inset 0 0 14px rgba(34,243,255,0.25); }
.btn-gold { border-color: var(--yellow); color: #fff; text-shadow: 0 0 8px rgba(255,225,77,0.8); box-shadow: 0 0 14px rgba(255,225,77,0.35), inset 0 0 10px rgba(255,225,77,0.18); }
.btn-gold small { display: block; font-size: 12px; font-weight: 500; color: var(--muted); text-shadow: none; letter-spacing: 0.04em; }
.home .btn-gold { margin-top: clamp(10px, 1.8dvh, 16px); padding: clamp(8px, 1.4dvh, 14px); font-size: 15px; }
.settings { display: grid; grid-template-columns: 1fr; gap: 8px; }
.toggle { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: var(--radius); border: 1px solid var(--line); background: rgba(14,11,42,0.5); cursor: pointer; font-size: 15px; }
.toggle input { width: 20px; height: 20px; accent-color: var(--violet); margin: 0; flex: none; }
.select-row { justify-content: space-between; }
.select-row select { background: rgba(14,11,42,0.9); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; font: inherit; font-size: 14px; }
.sheet .card { gap: 12px; }
.sheet-note { margin: 0; color: var(--muted); font-size: 13px; text-align: center; }

.overlay { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(7,5,26,0.74); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); z-index: 10; padding: 16px; cursor: default; }
.card { width: min(340px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; border: 1.5px solid var(--line); border-radius: 18px; padding: 22px; display: flex; flex-direction: column; gap: 10px; background: rgba(14,11,42,0.94); box-shadow: 0 0 30px rgba(155,107,255,0.25); }
.card h2 { margin: 0; text-align: center; letter-spacing: 0.1em; font-size: 20px; }
.res-why { margin: 0; text-align: center; color: var(--muted); }
.health p { margin: 0; color: var(--text); font-size: 14px; line-height: 1.45; }
.health b { color: var(--yellow); }
.cont-timer { height: 6px; border-radius: 3px; background: rgba(170,160,255,0.15); overflow: hidden; }
.cont-timer i { display: block; height: 100%; width: 100%; background: var(--lime); box-shadow: 0 0 8px var(--lime); transform-origin: left; }
.break { text-align: center; }
.break-tip { margin: 0; color: var(--text); font-size: 14px; line-height: 1.45; }
.break-note { color: var(--muted); font-size: 11px; }
.break-eye { width: 54px; height: 30px; margin: 0 auto 2px; border: 2px solid var(--cyan); border-radius: 50% / 60%; position: relative; box-shadow: 0 0 12px rgba(34,243,255,0.4); animation: blinkEye 4s ease-in-out infinite; }
.break-eye::after { content: ""; position: absolute; left: 50%; top: 50%; width: 12px; height: 12px; margin: -6px; border-radius: 50%; background: var(--cyan); }
@keyframes blinkEye { 0%, 44%, 52%, 100% { transform: scaleY(1); } 48% { transform: scaleY(0.1); } }

/* resultado */
.res-title { font-family: var(--display); font-weight: 400; color: var(--danger); text-shadow: 0 0 14px rgba(255,46,77,0.7); }
.res-score { text-align: center; }
.res-score b { display: block; font-weight: 700; font-size: 56px; line-height: 1.1; color: #fff; text-shadow: 0 0 18px rgba(155,107,255,0.9); font-variant-numeric: tabular-nums; }
.res-record { color: var(--yellow); letter-spacing: 0.14em; font-weight: 700; text-shadow: 0 0 10px var(--yellow); }
.res-dist { margin: 0; text-align: center; font-size: 14px; color: var(--muted); }
.res-dist.gold { color: var(--yellow); font-weight: 700; text-shadow: 0 0 8px rgba(255,225,77,0.6); }
.res-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 2px 0 6px; }
.res-stats div { border: 1px solid var(--line); border-radius: 10px; padding: 7px 4px; text-align: center; min-width: 0; }
.res-stats b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
.res-stats small { display: block; color: var(--muted); font-size: 10px; letter-spacing: 0.08em; overflow-wrap: anywhere; }

/* ── partida ────────────────────────────────────────────────────────────── */
.game { padding: 0; cursor: pointer; touch-action: none; }
#stage { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hud { position: absolute; top: 0; left: 0; right: 0; padding: calc(10px + var(--sat)) 14px 6px; display: grid; grid-template-columns: 92px 1fr 92px; align-items: center; pointer-events: none; max-width: 560px; margin: 0 auto; }
.hud > * { pointer-events: auto; }
.icon-btn { width: 42px; height: 42px; border-radius: 12px; border: 1.5px solid var(--line); background: rgba(14,11,42,0.6); color: var(--text); font-size: 12px; font-weight: 800; cursor: pointer; }
.hud-mid { text-align: center; pointer-events: none; }
.hud-score { display: block; font-weight: 700; font-size: 36px; line-height: 1.05; color: #fff; text-shadow: 0 0 14px rgba(155,107,255,0.9); font-variant-numeric: tabular-nums; }
.hud-level { font-size: 12px; letter-spacing: 0.22em; color: var(--muted); font-weight: 700; }
.hud-right { display: flex; flex-direction: column; align-items: flex-end; justify-content: flex-start; gap: 4px; height: 50px; pointer-events: none; }
.lives { display: flex; gap: 6px; }
.lives i { width: 18px; height: 20px; display: block; background: var(--cyan); clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); filter: drop-shadow(0 0 4px var(--cyan)); }
.lives i.off { background: rgba(170,160,255,0.22); filter: none; }
.lives.last i:not(.off) { background: var(--danger); filter: drop-shadow(0 0 5px var(--danger)); }
.lives.hurt { animation: hurt 0.4s; }
.lives.heal { animation: bump 0.35s ease-out; }
@keyframes hurt { 25% { transform: translateX(-4px); } 50% { transform: translateX(4px); } 75% { transform: translateX(-2px); } }
.combo { font-weight: 700; font-size: 19px; color: var(--pink); text-shadow: 0 0 10px var(--pink); }
.bump { animation: bump 0.22s ease-out; }
@keyframes bump { 40% { transform: scale(1.18); } }

.meter { position: absolute; left: 50%; bottom: calc(14px + var(--sab)); transform: translateX(-50%); width: min(220px, 60vw); text-align: center; pointer-events: none; }
.meter small { display: block; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; color: rgba(236,232,255,0.72); margin-bottom: 4px; }
.meter-track { height: 6px; border-radius: 3px; background: rgba(236,232,255,0.1); overflow: hidden; }
.meter-track i { display: block; height: 100%; width: 100%; background: var(--yellow); box-shadow: 0 0 8px var(--yellow); transform-origin: left; transform: scaleX(0); transition: transform 0.2s; }
.meter.on small { color: var(--pink); font-weight: 700; }
.meter.on .meter-track i { background: var(--pink); box-shadow: 0 0 12px var(--pink); }

.hint-bubble { position: absolute; left: 16px; right: 16px; bottom: calc(58px + var(--sab)); margin: 0 auto; max-width: 420px; text-align: center; pointer-events: none;
  padding: 9px 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(14,11,42,0.75); color: var(--text); font-size: 14px; font-weight: 700; }

/* 3-2-1 no alto: a peça e o buraco que vem ficam visíveis (QA: o número cobria os dois) */
.countdown { position: absolute; left: 0; right: 0; top: calc(86px + var(--sat)); z-index: 9; display: flex; flex-direction: column; align-items: center; gap: 2px; pointer-events: none; }
.countdown b { font-weight: 700; font-size: 76px; line-height: 1; color: #fff; text-shadow: 0 0 24px rgba(34,243,255,0.9); font-variant-numeric: tabular-nums; }
.countdown small { color: var(--cyan); letter-spacing: 0.2em; font-weight: 700; text-transform: uppercase; }

.toast { position: fixed; left: 50%; bottom: calc(24px + var(--sab)); transform: translateX(-50%); background: rgba(14,11,42,0.95); color: var(--text); padding: 10px 16px; border-radius: 999px; z-index: 70; border: 1px solid var(--line); max-width: calc(100vw - 32px); text-align: center; }
.update-banner { position: fixed; top: 0; left: 0; right: 0; z-index: 60; background: #3B1D8F; color: #fff; text-align: center; padding: calc(10px + var(--sat)) 10px 10px; font-weight: 700; cursor: pointer; }

/* FX (fx.js) */
.confetti-wrap { position: fixed; inset: 0; pointer-events: none; z-index: 80; overflow: hidden; }
.confetti-piece { position: absolute; top: -20px; border-radius: 2px; animation-name: confetti-fall; animation-timing-function: cubic-bezier(.25,.6,.4,1); animation-fill-mode: forwards; }
@keyframes confetti-fall { to { transform: translate(var(--drift), 110vh) rotate(var(--spin)); opacity: 0.9; } }

/* reduzir movimento: corta animações de interface */
.reduced *, .reduced *::before, .reduced *::after { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) { .hero-wall, .hero-piece, .boot-mark { animation: none; } }

/* telas baixas: cartões mais compactos (QA: "Entendi" do aviso de saúde cortado em 320×568) */
@media (max-height: 660px) {
  .card { padding: 16px; gap: 8px; }
  .health p { font-size: 13px; line-height: 1.38; }
  .card .btn { padding: 11px 14px; font-size: 15px; }
  .card .btn-primary { padding: 13px; font-size: 17px; }
}
/* tela estreita: rodapé da capa sem quebrar um link sozinho */
@media (max-width: 350px) { .foot-link { padding: 6px 7px; font-size: 13px; } }
.icon-btn { justify-self: start; }

/* contador "COMBO N ×M" (a partir do ×2) e presente do fim de setor */
.combo { font-size: 13px; white-space: nowrap; letter-spacing: 0.04em; }
.combo[data-tier="5"] { color: #FF8A2A; text-shadow: 0 0 10px #FF8A2A; }
.gift { text-align: center; }
.gift h2 { color: var(--lime); text-shadow: 0 0 12px rgba(124,255,91,0.6); }

/* pontos de avanço (capa): fichas roláveis — INÍCIO + começo de cada zona já alcançada */
.start-row { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin-top: clamp(8px, 1.4dvh, 12px); padding: 2px; -webkit-overflow-scrolling: touch; }
.start-row::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; min-width: 104px; padding: 7px 12px; border-radius: 14px; border: 1.5px solid rgba(170,160,255,0.28); background: rgba(14,11,42,0.5); color: var(--text); font: inherit; cursor: pointer; text-align: center; }
.chip b { display: block; font-size: 13px; letter-spacing: 0.08em; font-weight: 700; }
.chip small { display: block; font-size: 11px; color: var(--muted); white-space: nowrap; }
.chip.on { border-color: var(--cyan); color: #fff; box-shadow: 0 0 12px rgba(34,243,255,0.35), inset 0 0 8px rgba(34,243,255,0.15); }
.chip:active { transform: scale(0.97); }

/* jogada guiada: link discreto acima da dica */
.guide-skip { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(112px + var(--sab)); z-index: 5; background: none; border: 0; color: var(--muted); font: inherit; font-size: 13px; text-decoration: underline; padding: 8px 14px; cursor: pointer; }

/* resultado: ponto de avanço liberado / partida que começou adiantada */
.res-note { margin: 0; text-align: center; font-size: 13px; color: var(--cyan); }
