/* ============================================================
   Runekin · Stylesheet
   Direção: Arqueologia Arcana × Colecionável Neo-Noir × Wood-Type
   ------------------------------------------------------------
   - Sem cores saturadas espalhadas. Dourado é a única "voz" cromática.
   - Surfaces de pedra escura com bordas finas. Sem sombras suculentas.
   - Tipografia: Underdog (display/wordmark/headlines, wood-type
     vintage poster) + Hanken Grotesk (corpo limpo).
     Underdog tem 1 weight só — hierarquia se faz por tamanho e cor.
   - Atmosfera: grão de papel, vinheta, glow central muito sutil.
   - Magenta sobrevive APENAS como "ignição ritual" (CTA principal).
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Underdog&family=Hanken+Grotesk:wght@400;500;600;700&display=swap');

:root {
  /* ====== PALETTE ARCANA ====== */
  /* Tumba */
  --bg:           #0a0612;   /* midnight, quase preto, levemente violeta */
  --bg-deep:      #050309;
  --stone:        #14101f;   /* surface 1 */
  --stone-up:     #1c1828;   /* surface 2 (hover/raise) */
  --line:         #2a2436;
  --line-strong:  #3a3148;
  --line-gold:    rgba(232, 184, 100, 0.22);
  --line-gold-on: rgba(232, 184, 100, 0.6);

  /* Tinta (texto) */
  --ink:          #efe6d4;   /* off-white com warmth — pergaminho claro */
  --ink-2:        #c8bdab;   /* corpo */
  --dim:          #8a8298;   /* secundário */
  --faint:        #5a5468;   /* tertiary, separators */

  /* Rune-light (a única voz cromática real) */
  --gold:         #e8b864;   /* base */
  --gold-soft:    #cfa050;   /* sombra */
  --gold-glow:    #ffd88a;   /* highlight */
  --gold-deep:    #7d5a1f;   /* outline escura */
  --gold-ember:   #b8782a;
  --gold-wash:    rgba(232, 184, 100, 0.06); /* fundo levíssimo */

  /* Acentos rituais — uso muito restrito */
  --ember:        #c14a39;   /* vermelho seco, alarme/ressonância falha */
  --magenta:      #d54972;   /* só CTA principal — "ignição ritual" */
  --magenta-deep: #8e2c4d;
  --jade:         #6aa687;   /* sucesso discreto */
  --violet:       #6f5aa3;   /* moments frios */

  /* Tipografia
     Display: Underdog (single weight, wood-type / vintage poster).
              Hierarquia se faz por tamanho e cor, não peso.
     Body:    Hanken Grotesk (limpa, contraste clássico com wood-type). */
  --display:      'Underdog', 'Georgia', serif;
  --body:         'Hanken Grotesk', system-ui, sans-serif;

  /* Layout */
  --r-sm: 6px;
  --r:    12px;
  --r-lg: 18px;

  color-scheme: dark;
}

/* ============ RESET ============ */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--ink-2);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.6;
  font-weight: 400;
  background: var(--bg);
  overflow-x: hidden;
  /* Underdog tem só weight 400 — impede o browser de fingir bold/italic */
  font-synthesis: none;
}

/* ============ ATMOSFERA ============
   Grão de papel + vinheta + glow dourado central muito sutil.
   Tudo posicionado fixo, atrás de tudo. */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(900px 600px at 50% 28%, rgba(232,184,100,0.05), transparent 65%),
    radial-gradient(1200px 700px at 80% 110%, rgba(111,90,163,0.08), transparent 60%),
    var(--bg);
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    /* grão sutil */
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' seed='3'/><feColorMatrix values='0 0 0 0 0.5  0 0 0 0 0.4  0 0 0 0 0.2  0 0 0 0.18 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/></svg>"),
    /* vinheta */
    radial-gradient(130% 100% at 50% 40%, transparent 55%, rgba(5,3,9,0.85) 100%);
  background-size: 160px 160px, auto;
  opacity: 0.55;
  mix-blend-mode: multiply;
}
/* O .starfield existia no HTML — mantenho como container vazio, sem brilho neon */
.starfield { position: fixed; inset: 0; z-index: -1; pointer-events: none; display: none; }

/* ============ SHELL ============ */
.app {
  position: relative;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.screen { display: none; padding: 20px 22px 60px; animation: screenIn 0.6s cubic-bezier(.2,.7,.2,1) both; }
.screen.is-active { display: block; }
@keyframes screenIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ============ APPBAR (telas internas) ============ */
.appbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 14px;
  padding: 18px 22px;
  background: linear-gradient(180deg, var(--bg) 60%, rgba(10,6,18,0.6) 100%);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.appbar-back {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border: 1px solid var(--line-strong); background: var(--stone);
  border-radius: 50%;
  color: var(--ink); font-size: 20px; line-height: 1; cursor: pointer;
  transition: border-color .2s, color .2s, background .2s;
}
.appbar-back:hover { border-color: var(--line-gold-on); color: var(--gold); }
.appbar-back:active { background: var(--stone-up); }
.appbar-title {
  font-family: var(--display); font-weight: 600;
  font-size: 24px; letter-spacing: -.2px; color: var(--ink);
  flex: 1;
}
.appbar-extra { margin-left: auto; }

/* ============ HUD DA HOME ============ */
.screen.home { display: none; }
.screen.home.is-active { display: flex; flex-direction: column; min-height: calc(100dvh - env(safe-area-inset-top)); padding-top: calc(env(safe-area-inset-top) + 18px); }
.home-hud {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 4px 2px;
}
.iconbtn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border: 1px solid var(--line); background: var(--stone);
  border-radius: 50%;
  color: var(--dim); cursor: pointer;
  transition: border-color .2s, color .2s;
}
.iconbtn:hover { border-color: var(--line-gold-on); color: var(--gold); }
.iconbtn svg { width: 16px; height: 16px; }

/* Chip Câmara */
.camchip {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 5px 14px 5px 8px;
  background: transparent; border: 1px solid var(--line-gold);
  border-radius: 99px; color: var(--ink); cursor: pointer;
  font: inherit;
  transition: border-color .2s, background .2s;
}
.camchip:hover { border-color: var(--line-gold-on); background: var(--gold-wash); }
.camdot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--gold); box-shadow: 0 0 8px var(--gold-glow);
  flex: 0 0 8px;
}
.camtxt { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.1; }
.camtxt small { font: 9px var(--body); letter-spacing: 2.5px; color: var(--dim); text-transform: uppercase; }
.camtxt b { font: 500 13px var(--body); color: var(--ink); }

/* Contador 0/151 */
.dexpill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px;
  background: transparent; border: 1px solid var(--line);
  border-radius: 99px;
}
.dexpill b { font: 500 14px var(--body); color: var(--ink); }
.dexpill span { font: 11px var(--body); color: var(--dim); letter-spacing: .3px; }
.dexpill svg { width: 12px; height: 12px; color: var(--gold-soft); margin-left: 4px; }

/* ============ HERO RUNEKIN (vitrine de colecionável) ============
   Sai o "anel girante SaaS-y". Entra um wordmark dominante em
   Underdog, dentro de uma moldura tipo placa de letreiro vintage,
   com 7 marcas coloridas pequenas em cima — assinatura das 7 peças. */
.hero {
  position: relative;
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
  margin: 56px auto 36px;
  padding: 36px 24px 32px;
  width: 100%;
  max-width: 460px;
}

/* "Rune-light" — glow dourado etéreo no centro */
.hero-glow {
  position: absolute; left: 50%; top: 50%;
  width: 480px; height: 320px;
  transform: translate(-50%, -50%);
  background:
    radial-gradient(closest-side, rgba(232,184,100,0.18) 0%, rgba(232,184,100,0.05) 45%, transparent 75%);
  filter: blur(2px);
  animation: runeLight 7s ease-in-out infinite;
  z-index: 0; pointer-events: none;
}
@keyframes runeLight {
  0%, 100% { opacity: .7; }
  50%      { opacity: 1; }
}

/* Moldura sutil — só os 4 cantinhos (estilo letreiro/scanner) */
.hero-frame {
  position: absolute; inset: 0;
  z-index: 0; pointer-events: none;
}
.hero-frame .fr {
  position: absolute; width: 18px; height: 18px;
  border: 1px solid var(--line-gold-on);
}
.hero-frame .tl { top: 0; left: 0; border-right: 0; border-bottom: 0; }
.hero-frame .tr { top: 0; right: 0; border-left: 0; border-bottom: 0; }
.hero-frame .bl { bottom: 0; left: 0; border-right: 0; border-top: 0; }
.hero-frame .br { bottom: 0; right: 0; border-left: 0; border-top: 0; }

/* 7 marcas coloridas — as 7 runas/peças do jogo */
.hero-runes {
  position: relative; z-index: 1;
  display: flex; gap: 14px; justify-content: center;
  margin-bottom: 26px;
}
.hero-runes i {
  width: 7px; height: 7px;
  background: var(--c);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--c);
  opacity: .55;
  transition: transform .8s ease;
}
.hero:hover .hero-runes i { opacity: .85; }

/* ====== WORDMARK RUNEKIN — agora protagonista ====== */
.brand-runekin {
  position: relative; z-index: 1;
  margin: 0;
  font-family: var(--display);
  font-size: 80px; line-height: .95; letter-spacing: -.5px;
  color: var(--ink);
  text-shadow: 0 2px 0 #00000088;
}
.brand-runekin .accent {
  color: var(--gold);
  text-shadow: 0 2px 0 #00000088, 0 0 20px rgba(232,184,100,0.4);
}
.brand-runekin .mark {
  display: inline-block; width: 5px; height: 5px;
  border-radius: 50%; background: var(--gold);
  vertical-align: 0.5em;
  margin: 0 0.04em;
  box-shadow: 0 0 12px var(--gold-glow);
}

.tagline {
  position: relative; z-index: 1;
  margin: 22px 0 0;
  font: 500 10.5px var(--body);
  letter-spacing: 6px; text-transform: uppercase;
  color: var(--gold-soft);
}
.tagline::before, .tagline::after {
  content: ""; display: inline-block;
  width: 22px; height: 1px;
  background: var(--gold-deep);
  vertical-align: middle;
  margin: 0 14px 3px;
  opacity: .7;
}

/* Elementos legados do HTML — escondidos */
.hero-burst, .hero-tokens, .hero-beast, .hero-sigil, .logo { display: none !important; }

/* ============ BOTÃO PRINCIPAL DA HOME (ESCANEAR) ============ */
/* Linha separadora antes do CTA */
.home-prog {
  margin: 36px 0 22px;
  height: 1px; padding: 0;
  background: linear-gradient(90deg, transparent, var(--line-gold), transparent);
  border: 0; overflow: visible;
}
.home-prog .bar { display: none; }

.play {
  display: flex; align-items: center; gap: 16px;
  width: 100%; padding: 20px 22px;
  background: linear-gradient(180deg, var(--stone-up), var(--stone));
  border: 1px solid var(--line-gold-on);
  border-radius: var(--r);
  color: var(--ink); cursor: pointer;
  text-align: left;
  position: relative; overflow: hidden;
  transition: border-color .25s, transform .15s, box-shadow .25s;
}
.play::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(140% 100% at -10% 50%, rgba(213,73,114,0.18), transparent 50%);
  pointer-events: none;
}
.play:hover { border-color: var(--gold); box-shadow: 0 0 24px -8px var(--gold), inset 0 0 0 1px var(--gold-wash); }
.play:active { transform: translateY(1px); }
.play .play-ico {
  flex: 0 0 44px; width: 44px; height: 44px;
  display: grid; place-items: center;
  border: 1px solid var(--line-gold);
  border-radius: 10px;
  background: var(--bg-deep);
  color: var(--gold);
}
.play .play-ico svg { width: 18px; height: 18px; }
.play .pt { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.play .pt b {
  font-family: var(--display); font-weight: 600;
  font-size: 24px; letter-spacing: -.3px;
  color: var(--ink);
}
.play .pt small { font: 12px var(--body); color: var(--dim); letter-spacing: .2px; }
.play .pgo { color: var(--gold-soft); font: 400 28px var(--display); }

/* ============ TILES SECUNDÁRIOS ============ */
.tiles {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 10px; margin-top: 12px;
}
.tile {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 18px 8px;
  background: var(--stone);
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--dim); cursor: pointer;
  transition: border-color .2s, color .2s, background .2s;
}
.tile:hover { border-color: var(--line-gold-on); color: var(--gold); background: var(--stone-up); }
.tile .ti {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  color: inherit;
}
.tile .ti svg { width: 22px; height: 22px; stroke-width: 1.4; }
.tile span {
  font-family: var(--display); font-weight: 500;
  font-size: 15px; color: var(--ink);
}

/* ============ TELA DO SCANNER ============ */
#screen-scanner { display: none; padding: 0 22px 60px; }
#screen-scanner.is-active { display: flex; flex-direction: column; }

.scan-stage {
  position: relative; width: min(94vw, 460px);
  aspect-ratio: 1;
  margin: 10px auto 0;
}
#scanCanvas {
  display: block; width: 100%; height: 100%;
  background: var(--bg-deep);
  border: 1px solid var(--line);
  border-radius: var(--r);
}

/* Mira fixa (cantos dourados) */
.scan-frame {
  position: absolute; left: 13%; top: 13%; width: 74%; height: 74%;
  z-index: 2; pointer-events: none;
  border-radius: 8px;
  box-shadow: inset 0 0 60px rgba(0,0,0,0.4);
  transition: box-shadow .2s;
}
.scan-frame .cnr {
  position: absolute; width: 26px; height: 26px;
  border: 2px solid var(--gold);
  filter: drop-shadow(0 0 6px rgba(232,184,100,0.4));
  transition: border-color .2s;
}
.scan-frame .tl { left: -2px; top: -2px; border-right: 0; border-bottom: 0; border-top-left-radius: 8px; }
.scan-frame .tr { right: -2px; top: -2px; border-left: 0; border-bottom: 0; border-top-right-radius: 8px; }
.scan-frame .bl { left: -2px; bottom: -2px; border-right: 0; border-top: 0; border-bottom-left-radius: 8px; }
.scan-frame .br { right: -2px; bottom: -2px; border-left: 0; border-top: 0; border-bottom-right-radius: 8px; }
.scan-frame.ok .cnr { border-color: var(--jade); filter: drop-shadow(0 0 8px var(--jade)); }
.scan-frame.ok { box-shadow: inset 0 0 60px rgba(0,0,0,0.4), 0 0 40px -8px var(--jade); }

/* Live status (toast pequeno em cima da mira) */
.scan-live {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  z-index: 4;
  background: rgba(10,6,18,0.85); border: 1px solid var(--line-gold);
  border-radius: 99px;
  padding: 6px 16px;
  font: 500 11px var(--body); color: var(--ink-2);
  letter-spacing: .3px;
  backdrop-filter: blur(8px);
  white-space: nowrap;
  max-width: 92%;
}
.scan-live b { color: var(--gold); font-weight: 600; }

/* Fallback de câmera negada */
.scan-error {
  position: absolute; inset: 0; z-index: 6;
  display: flex; flex-direction: column; gap: 18px;
  align-items: center; justify-content: center;
  background: rgba(10,6,18,0.92);
  backdrop-filter: blur(4px);
  padding: 32px; text-align: center;
  border-radius: var(--r);
}
.scan-error p {
  margin: 0;
  font: 400 15px/1.5 var(--body); color: var(--ink-2);
  max-width: 280px;
}

/* Hint embaixo da stage */
.hint {
  text-align: center;
  font: 400 13px/1.5 var(--body); color: var(--dim);
  margin: 18px auto 0;
  max-width: 420px;
  letter-spacing: .2px;
}
.hint b { color: var(--ink); font-weight: 500; }

/* Botão Capturar — herda visual do .play */
.btn.capture {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  width: min(94vw, 460px); margin: 18px auto 0;
  padding: 18px 24px;
  background: linear-gradient(180deg, var(--stone-up), var(--stone));
  border: 1px solid var(--line-gold-on);
  border-radius: var(--r);
  color: var(--ink); cursor: pointer;
  font-family: var(--display); font-weight: 600;
  font-size: 19px; letter-spacing: -.2px;
  transition: border-color .2s, box-shadow .25s, transform .15s;
  position: relative; overflow: hidden;
}
.btn.capture::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(120% 80% at 50% 100%, rgba(232,184,100,0.15), transparent 60%);
  pointer-events: none;
}
.btn.capture:hover { border-color: var(--gold); box-shadow: 0 0 28px -8px var(--gold); }
.btn.capture:active { transform: translateY(1px); }
.btn.capture svg { width: 20px; height: 20px; color: var(--gold); }

/* ============ BOTÕES GENÉRICOS ============ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 18px;
  background: var(--stone);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--ink-2); cursor: pointer;
  font: 500 14px var(--body); letter-spacing: .2px;
  transition: border-color .2s, color .2s, background .2s;
}
.btn:hover { border-color: var(--line-gold-on); color: var(--gold); }
.btn:active { background: var(--stone-up); }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.ghost:hover { border-color: var(--line-gold-on); color: var(--gold); background: var(--gold-wash); }
.btn.primary {
  background: linear-gradient(180deg, var(--magenta), var(--magenta-deep));
  border-color: var(--magenta-deep);
  color: #fff;
  font-weight: 600;
  text-shadow: 0 1px 1px rgba(0,0,0,0.3);
}
.btn.primary:hover { box-shadow: 0 0 24px -8px var(--magenta); border-color: var(--magenta); color: #fff; }
.btn.primary:active { transform: translateY(1px); }
.btn.block { display: flex; justify-content: center; width: 100%; margin-top: 28px; padding: 14px; }
.btn[disabled] { opacity: .35; cursor: not-allowed; }

/* ============ CADERNO DE CAMPO ============ */
#screen-grimorio { padding: 0 22px 60px; }
.grim-head { margin: 14px 0 8px; }
.grim-count {
  margin-bottom: 14px;
  font: 400 13px var(--body); color: var(--dim);
  letter-spacing: .2px;
  display: flex; align-items: baseline; gap: 4px;
}
.grim-count b {
  font-family: var(--display); font-weight: 400;
  font-size: 42px; color: var(--gold);
  margin-right: 10px;
  line-height: 1;
  text-shadow: 0 0 18px rgba(232,184,100,0.3);
}
.dim { color: var(--faint) !important; }

.prog {
  height: 2px; border-radius: 0;
  background: var(--line);
  overflow: hidden;
}
.prog .bar {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold), var(--gold-glow));
  box-shadow: 0 0 8px var(--gold);
  transition: width .6s cubic-bezier(.2,.9,.3,1);
}

.rarity-legend {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 16px;
  font: 11px var(--body); font-weight: 500; letter-spacing: .3px;
}
.rarity-legend .leg {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 99px;
  color: var(--dim);
  background: var(--stone);
}
.rarity-legend .leg b { color: var(--ink); font-weight: 600; }

/* Slots — "specimen cards" */
#dexGrid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-top: 18px;
}
.slot {
  position: relative;
  aspect-ratio: 1;
  background: var(--stone);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  display: grid; place-items: center;
  cursor: default;
  overflow: hidden;
  transition: border-color .2s, transform .15s;
}
.slot .n {
  position: absolute; top: 4px; left: 6px;
  font: 500 9px var(--body); color: var(--faint);
  letter-spacing: .5px;
}
.slot .sil {
  width: 70%; height: 70%;
  display: grid; place-items: center;
  /* "Pokédex unknown": silhueta preta opaca, perde cor mas mantém forma */
  filter: brightness(0) saturate(0) opacity(0.45);
}
.slot .sil svg, .slot svg {
  width: 100%; height: 100%;
}
.slot .sstars {
  position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%);
  font-size: 8px; color: var(--gold-soft); letter-spacing: 1px;
}
.slot .sstars.dim { color: var(--faint) !important; }

.slot.found {
  border-color: var(--line-gold-on);
  background: var(--stone-up);
  cursor: pointer;
}
.slot.found .sil { filter: none; }
.slot.found:hover { border-color: var(--gold); transform: translateY(-1px); box-shadow: 0 6px 14px -6px var(--gold); }

.slot.locked {
  opacity: .42; filter: grayscale(.6);
}
.slot.locked::after {
  content: ''; position: absolute; right: 5px; top: 5px;
  width: 12px; height: 12px;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23e8b864'><path d='M12 1a5 5 0 0 0-5 5v3H6a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-9a2 2 0 0 0-2-2h-1V6a5 5 0 0 0-5-5zm-3 8V6a3 3 0 1 1 6 0v3H9z'/></svg>") center/contain no-repeat;
  opacity: .8;
}
.slot.apex {
  opacity: .5; filter: grayscale(.8);
  background: var(--bg-deep);
}
.slot.apex::before {
  content: '???'; position: absolute; inset: 0;
  display: grid; place-items: center;
  font-family: var(--display); font-weight: 600;
  font-size: 13px; letter-spacing: 3px; color: var(--gold);
}
.slot.apex .sil { display: none; }

/* ============ OVERLAYS (modal/reveal/detail) ============ */
.overlay {
  position: fixed; inset: 0; z-index: 200;
  display: none; place-items: center;
  padding: 20px;
  background: radial-gradient(circle at 50% 40%, rgba(28,24,40,0.92), rgba(5,3,9,0.96));
  backdrop-filter: blur(6px);
}
.overlay.show { display: grid; animation: fade .35s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ============ MODAL DE SETUP DA CÂMARA ============ */
.setup-card {
  width: min(94vw, 460px);
  background: var(--stone);
  border: 1px solid var(--line-gold);
  border-radius: var(--r);
  padding: 32px 26px 24px;
  text-align: center;
  box-shadow: 0 30px 80px -20px rgba(0,0,0,0.7), 0 0 60px -20px rgba(232,184,100,0.15);
}
.setup-eyebrow {
  font: 500 10px var(--body);
  letter-spacing: 4px; text-transform: uppercase;
  color: var(--gold-soft);
  margin-bottom: 10px;
}
.setup-title {
  font-family: var(--display); font-weight: 600;
  font-size: 30px; letter-spacing: -.3px;
  color: var(--ink);
  margin: 0 0 14px;
}
.setup-sub {
  font: 400 14px/1.55 var(--body); color: var(--dim);
  margin: 0 0 22px;
}
.setup-sub b { color: var(--ink); font-weight: 500; }
.setup-options { display: flex; flex-direction: column; gap: 8px; margin-bottom: 22px; }
.setup-check {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  background: var(--bg-deep);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink); cursor: pointer; text-align: left;
  transition: border-color .2s, background .2s;
  position: relative;
}
.setup-check:hover { border-color: var(--line-gold-on); }
.setup-check input {
  position: absolute; opacity: 0; pointer-events: none;
}
.setup-check.checked {
  border-color: var(--gold);
  background: var(--stone-up);
  box-shadow: inset 0 0 16px rgba(232,184,100,0.08);
}
.setup-text { flex: 1; }
.setup-text b { font-family: var(--display); font-weight: 600; font-size: 17px; color: var(--ink); display: block; line-height: 1.1; }
.setup-text small { display: block; font: 400 11.5px var(--body); color: var(--dim); margin-top: 3px; letter-spacing: .2px; }
.setup-dot {
  width: 18px; height: 18px; border-radius: 50%; flex: 0 0 18px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.15);
}
.setup-tick {
  width: 18px; height: 18px; border-radius: 4px; flex: 0 0 18px;
  border: 1.5px solid var(--line-strong);
  background: var(--bg-deep);
  position: relative;
  transition: border-color .2s, background .2s;
}
.setup-check.checked .setup-tick { border-color: var(--gold); background: var(--gold); }
.setup-check.checked .setup-tick::after {
  content: ''; position: absolute; left: 5px; top: 1px;
  width: 5px; height: 10px;
  border: solid var(--bg-deep);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.setup-confirm { width: 100%; margin-top: 4px; padding: 14px; justify-content: center; font-size: 15px; }
.setup-close {
  margin-top: 8px;
  background: transparent; border: 0;
  color: var(--faint);
  font: 12px var(--body);
  cursor: pointer;
  padding: 6px; display: block; width: 100%;
}
.setup-close:hover { color: var(--ink-2); }

/* ============ REVEAL / DETAIL ============ */
.reveal-card, .detail-card {
  background: var(--stone);
  border: 1px solid var(--line-gold);
  border-radius: var(--r);
  padding: 28px 24px 24px;
  text-align: center;
  width: min(92vw, 380px);
  box-shadow: 0 30px 80px -20px rgba(0,0,0,0.7);
}
.reveal-stage {
  position: relative;
  width: min(74vw, 260px); height: min(74vw, 260px);
  margin: 12px auto;
  display: grid; place-items: center;
  background: var(--bg-deep);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.reveal-meta {
  font-family: var(--display); font-weight: 600;
  font-size: 24px; color: var(--gold);
  margin: 12px 0 6px;
}
.reveal-stars { color: var(--gold-glow); margin: 4px 0 12px; letter-spacing: 2px; }
.reveal-type {
  font: 11px var(--body); letter-spacing: 3px; text-transform: uppercase;
  color: var(--dim);
}

/* ============ TOAST ============ */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
  background: var(--stone); border: 1px solid var(--line-gold);
  color: var(--ink); padding: 12px 22px; border-radius: 8px;
  font: 13px var(--body); letter-spacing: .2px;
  z-index: 300; opacity: 0;
  transition: opacity .25s, transform .25s;
  box-shadow: 0 16px 40px -10px rgba(0,0,0,0.6);
  pointer-events: none;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============ AR (sobre o scanner) ============ */
.ar-ground {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border-radius: var(--r); pointer-events: none; z-index: 1;
  animation: arGroundIn .55s cubic-bezier(.2,.9,.2,1.05);
}
@keyframes arGroundIn { from { opacity: 0; transform: scale(.55); } to { opacity: 1; transform: none; } }
.ar-monster {
  position: absolute; pointer-events: none; z-index: 3;
  filter: drop-shadow(0 6px 16px rgba(0,0,0,0.7));
  animation: arRise 1s cubic-bezier(.2,1.3,.3,1);
}
.ar-monster svg, .ar-monster canvas { width: 100% !important; height: 100% !important; }
@keyframes arRise {
  0%   { transform: translateY(70px) scale(.2); opacity: 0; filter: blur(10px) brightness(2) drop-shadow(0 0 18px var(--gold)); }
  35%  { opacity: .8; filter: blur(4px) brightness(1.6) drop-shadow(0 0 22px var(--gold)); }
  62%  { transform: translateY(-8px) scale(1.08); opacity: 1; filter: blur(0) brightness(1.25) drop-shadow(0 0 16px var(--gold)); }
  100% { transform: none; filter: drop-shadow(0 6px 16px rgba(0,0,0,0.7)); }
}
.ar-label {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%);
  z-index: 4;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center;
  background: rgba(10,6,18,0.92); border: 1px solid var(--line-gold);
  border-radius: 10px; padding: 10px 16px;
  backdrop-filter: blur(8px);
  max-width: 94%;
  animation: arLabelIn .5s .55s both cubic-bezier(.2,.9,.2,1);
}
@keyframes arLabelIn { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }
.ar-label b {
  font-family: var(--display); font-weight: 600;
  color: var(--gold); font-size: 17px;
}
.ar-label span { font: 11px var(--body); letter-spacing: 2px; text-transform: uppercase; color: var(--dim); }
.ar-label .btn { padding: 6px 12px; font-size: 12px; }

/* ============ REVELAÇÃO (burst no scanner) ============ */
.scan-reveal {
  position: absolute; inset: 0; z-index: 5;
  pointer-events: none; mix-blend-mode: screen;
  animation: revealFade .85s cubic-bezier(.2,.7,.3,1) forwards;
}
.scan-reveal::before, .scan-reveal::after {
  content: ''; position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%); border-radius: 50%;
}
.scan-reveal::before {
  width: 36%; height: 36%;
  background: radial-gradient(circle, #fff 0%, var(--gold) 24%, var(--magenta) 58%, transparent 78%);
  animation: revealCore .85s cubic-bezier(.15,.7,.2,1) forwards;
}
.scan-reveal::after {
  width: 74%; height: 74%;
  border: 2px solid var(--gold);
  box-shadow: 0 0 24px var(--gold);
  animation: revealRing .85s ease-out forwards;
}
@keyframes revealFade { 0% { opacity: 0; } 10% { opacity: 1; } 100% { opacity: 0; } }
@keyframes revealCore {
  0%   { transform: translate(-50%,-50%) scale(.1); opacity: 0; }
  22%  { transform: translate(-50%,-50%) scale(1.4); opacity: 1; }
  100% { transform: translate(-50%,-50%) scale(2.8); opacity: 0; }
}
@keyframes revealRing {
  0%   { transform: translate(-50%,-50%) scale(.4); opacity: 0; border-width: 5px; }
  28%  { opacity: .95; }
  100% { transform: translate(-50%,-50%) scale(1.7); opacity: 0; border-width: 1px; }
}

/* ============ PROSE (Como jogar / Créditos) ============ */
.prose { max-width: 460px; }
.prose .lead {
  /* parágrafo de abertura — Hanken pra fluir bem em texto longo */
  font-family: var(--body); font-weight: 400;
  font-size: 19px; line-height: 1.55; letter-spacing: -.1px;
  color: var(--ink);
  margin: 14px 0 32px;
}
.prose .lead b {
  /* destaque com display font + cor */
  font-family: var(--display); font-weight: 400;
  color: var(--gold);
  font-size: 1.05em;
}
.prose h3 {
  font-family: var(--display); font-weight: 400;
  font-size: 22px; letter-spacing: .3px;
  color: var(--gold);
  margin: 36px 0 12px;
  display: flex; align-items: center; gap: 12px;
}
.prose h3::before {
  content: ""; width: 24px; height: 1px;
  background: var(--gold-deep);
}
.prose p { color: var(--ink-2); margin: 0 0 10px; line-height: 1.65; }
.prose p b { color: var(--ink); font-weight: 600; }

.steps {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 16px;
}
.steps li {
  display: flex; gap: 16px; align-items: flex-start;
  padding: 14px 16px;
  background: var(--stone);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.steps li:hover { border-color: var(--line-gold); }
.step-n {
  flex: none; width: 32px; height: 32px;
  display: grid; place-items: center;
  font-family: var(--display); font-weight: 600; font-size: 18px;
  color: var(--gold);
  background: var(--bg-deep);
  border: 1px solid var(--line-gold);
  border-radius: 50%;
}
.steps li div { padding-top: 4px; color: var(--ink-2); line-height: 1.6; }
.steps li b { color: var(--ink); font-weight: 600; }

/* Créditos */
.cred-mark { display: flex; align-items: center; gap: 14px; margin: 14px 0 22px; }
.brand.sm {
  font-family: var(--display); font-weight: 600;
  font-size: 30px; color: var(--ink);
}
.brand.sm span { color: var(--gold); }
.sigil { position: relative; width: 56px; height: 56px; display: grid; place-items: center; }
.sigil-ring { position: absolute; inset: 0; border-radius: 50%; border: 1px solid var(--line-gold-on); }
.sigil-runes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; width: 28px; }
.sigil-runes i { aspect-ratio: 1; border-radius: 1px; background: var(--c); opacity: .7; }
.sigil-runes i:last-child { grid-column: span 2; }

.cred {
  background: var(--stone);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}
.cred-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; padding: 13px 18px;
  border-bottom: 1px solid var(--line);
}
.cred-row:last-child { border-bottom: 0; }
.cred-row span { color: var(--dim); font-size: 13px; letter-spacing: .2px; }
.cred-row b {
  font-family: var(--display); font-weight: 600;
  color: var(--ink); font-size: 14px; text-align: right;
}
.cred-note { font: 12.5px var(--body); color: var(--faint); margin-top: 18px; line-height: 1.65; }
.cred-foot {
  text-align: center; margin-top: 28px;
  font-family: var(--display);
  font-size: 13px; letter-spacing: 6px; text-transform: uppercase;
  color: var(--faint);
}

/* ============ ALTAR (rota legada — estilo mínimo só pra não quebrar) ============ */
#screen-altar .board, .board-wrap { display: grid; gap: 4px; }
.cell, .stone { background: var(--stone); border: 1px solid var(--line); border-radius: 4px; }
.cell.filled { background: var(--cc, var(--gold)); }

/* ============ RESPONSIVO (desktop) ============ */
@media (min-width: 720px) {
  .app { max-width: 720px; }
  .prose { max-width: 620px; margin: 0 auto; }
  .scan-stage { width: min(72vw, 560px); }
  .btn.capture { width: min(72vw, 560px); padding: 22px 26px; font-size: 21px; }
  .hero { margin: 64px auto 40px; max-width: 580px; padding: 44px 32px 36px; }
  .brand-runekin { font-size: 108px; letter-spacing: -1px; }
  .tiles { gap: 14px; }
  .tile { padding: 24px 12px; }
  .tile .ti svg { width: 26px; height: 26px; }
  .tile span { font-size: 17px; }
  .grim-count b { font-size: 52px; }
  #dexGrid { grid-template-columns: repeat(8, 1fr); gap: 8px; }
}
@media (min-width: 1100px) {
  .app { max-width: 900px; }
  .prose { max-width: 700px; }
  .scan-stage { width: min(60vw, 620px); }
  .btn.capture { width: min(60vw, 620px); }
  .hero { max-width: 680px; }
  .brand-runekin { font-size: 128px; }
  #dexGrid { grid-template-columns: repeat(10, 1fr); }
}
