/* ==========================================================================
   Tema: escuro, clima de viagem no tempo. Pensado primeiro para o celular.
   ========================================================================== */
:root {
  --font: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bg: #120d22;
  --bg2: #1b1433;
  --panel: rgba(255, 255, 255, 0.055);
  --panel-solid: #221a3d;
  --line: rgba(255, 255, 255, 0.12);
  --text: #f1edfb;
  --muted: #a99fc6;
  --gold: #f5c451;
  --gold-text: #2b1d00;
  --danger: #e5484d;
  --ok: #3fd18a;
  --ancora: #2f6bff;
  --energia: #d6332f;
  --era: #3fae3a;
  --back: #3a2a5c;
  --back-image: none;
  --radius: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { background: var(--bg); }
/* Nada pode ficar mais largo que a tela: no celular isso desloca tudo que é fixo embaixo */
html, body { max-width: 100%; overflow-x: clip; }
body {
  margin: 0; min-height: 100dvh; font: 16px/1.45 var(--font); color: var(--text);
  background:
    radial-gradient(1px 1px at 20% 30%, rgba(255,255,255,.5) 50%, transparent 51%) 0 0 / 180px 180px,
    radial-gradient(1px 1px at 70% 80%, rgba(255,255,255,.35) 50%, transparent 51%) 0 0 / 240px 240px,
    radial-gradient(ellipse at 50% -10%, #3b2a78 0%, transparent 60%),
    radial-gradient(ellipse at 100% 100%, #2a1240 0%, transparent 55%),
    var(--bg);
  background-attachment: fixed;
}
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.15; }
h1 { font-size: 1.6rem; font-weight: 900; }
h2 { font-size: 1.15rem; font-weight: 800; }
h3 { font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-top: 1rem; }
p { margin: .4rem 0; }
a { color: var(--gold); }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.center { text-align: center; }
.grow { flex: 1; min-width: 0; }
.row-flex, .row { display: flex; gap: 8px; align-items: center; }

button { font: inherit; color: inherit; }
input {
  font: inherit; color: var(--text); width: 100%; min-height: 48px; padding: .6rem .85rem;
  background: rgba(255,255,255,.07); border: 1px solid var(--line); border-radius: 12px; outline: none;
}
input:focus { border-color: var(--gold); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 48px;
  padding: .55rem 1.1rem; border-radius: 14px; border: 1px solid var(--line); background: var(--panel);
  font-weight: 800; cursor: pointer; text-decoration: none; color: var(--text); white-space: nowrap;
  transition: transform .08s, filter .15s, background .15s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: linear-gradient(180deg, #ffd56e, var(--gold)); color: var(--gold-text); border: 0; box-shadow: 0 6px 18px rgba(245,196,81,.25); }
.btn.danger { background: var(--danger); color: #fff; border: 0; }
.btn.ghost { background: transparent; }
.btn.small { min-height: 36px; padding: .3rem .8rem; font-size: .85rem; border-radius: 10px; }
.btn.wide { width: 100%; }
.btn.big { min-height: 56px; font-size: 1.05rem; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel);
  display: grid; place-items: center; cursor: pointer; font-size: 1.15rem; flex: none;
}
.icon-btn.small { width: 34px; height: 34px; font-size: .9rem; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }

/* ==========================================================================
   Início
   ========================================================================== */
.hero { max-width: 420px; margin: 0 auto; padding: 48px 16px calc(32px + var(--safe-b)); text-align: center; }
.logo { font-size: 3.4rem; filter: drop-shadow(0 6px 24px rgba(245,196,81,.45)); }
.hero h1 { font-size: 2rem; background: linear-gradient(180deg, #fff, #f5c451); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tagline { color: var(--muted); margin-bottom: 1.4rem; }
.hero form { text-align: left; display: flex; flex-direction: column; gap: 10px; }
.hero label { font-weight: 800; font-size: .9rem; }
.hero .row input { flex: 1; }
.error { color: #ff8f8f; font-size: .88rem; margin: 0; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .82rem; margin: 6px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.foot { color: var(--muted); font-size: .82rem; margin-top: 1.2rem; }

/* ==========================================================================
   Sala
   ========================================================================== */
body.game { padding-bottom: calc(230px + var(--safe-b)); }
.loading, .center-screen { min-height: 70dvh; display: grid; place-items: center; align-content: center; gap: 10px; text-align: center; padding: 16px; color: var(--muted); }
.center-screen p { max-width: 340px; }
.big-emoji { font-size: 3rem; }

.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
  background: rgba(18, 13, 34, .82); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.top-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.15; }
.top-title strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; gap: 8px; }
.status { font-size: .75rem; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #f59e0b; }
.status.online::before { background: var(--ok); box-shadow: 0 0 0 3px rgba(63,209,138,.2); }

main.lobby, main.choosing { max-width: 520px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.invite { text-align: center; }
.code { font-size: 2.4rem; font-weight: 900; letter-spacing: .2em; margin: 2px 0 12px; color: var(--gold); }
.lobby-list { list-style: none; margin: 0; padding: 0; }
.lobby-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.lobby-list li:last-child { border-bottom: 0; }

.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none;
  font-weight: 900; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.4); border: 2px solid rgba(255,255,255,.25);
}
.avatar.offline { filter: grayscale(.9); opacity: .5; }

/* -- cartas de personagem -------------------------------------------------- */
.choosing h1 { text-align: center; margin-top: 8px; }
.role-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.role-pair.one { grid-template-columns: minmax(0, 260px); justify-content: center; }
.rolecard {
  --role: #888; position: relative; display: flex; flex-direction: column; text-align: center; gap: 4px;
  padding: 10px 10px 14px; border-radius: 18px; cursor: pointer; color: var(--text);
  background: linear-gradient(170deg, color-mix(in srgb, var(--role) 45%, #1b1433), #1b1433 75%);
  border: 2px solid color-mix(in srgb, var(--role) 70%, transparent);
  box-shadow: 0 10px 30px rgba(0,0,0,.4); transition: transform .15s, box-shadow .15s, opacity .15s;
}
.rolecard.selected { transform: translateY(-4px); box-shadow: 0 0 0 3px var(--gold), 0 14px 34px rgba(0,0,0,.5); }
.rolecard:disabled { opacity: .35; cursor: default; filter: grayscale(.6); }
.rolecard.lacaio { --role: #c0392b; }
.rolecard-art {
  width: 100%; aspect-ratio: 3 / 3.2; border-radius: 12px; display: grid; place-items: center; font-size: 3.4rem;
  background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--role) 60%, #fff), var(--role) 55%, color-mix(in srgb, var(--role) 50%, #000));
  background-size: cover; background-position: center; box-shadow: inset 0 0 0 2px rgba(255,255,255,.15);
}
.rolecard-art.has-image { aspect-ratio: 5 / 7; background: #0b0816 center / contain no-repeat; }
.rolecard-name { font-weight: 900; font-size: 1.15rem; margin-top: 4px; }
.rolecard-sub { font-size: .75rem; font-weight: 800; color: var(--gold); text-transform: uppercase; letter-spacing: .04em; }
.rolecard-text { font-size: .82rem; color: #ddd6f3; line-height: 1.3; }
.rolecard-tag { position: absolute; top: 8px; left: 8px; background: var(--gold); color: var(--gold-text); font-size: .7rem; font-weight: 900; border-radius: 8px; padding: 1px 6px; }

.rolechip {
  display: inline-flex; align-items: center; gap: 3px; font-size: .74rem; font-weight: 800; white-space: nowrap;
  padding: 2px 8px; border-radius: 999px; background: rgba(245,196,81,.16); color: var(--gold);
}
.rolechip.lacaio { background: rgba(229,72,77,.18); color: #ff9b9b; }

/* -- placar --------------------------------------------------------------------- */
.scoreboard { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 12px 16px 4px; max-width: 720px; margin: 0 auto; }
.score { min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 8px 10px; }
.score-head { display: flex; justify-content: space-between; gap: 6px; font-size: .74rem; font-weight: 800; color: var(--muted); }
.score-head span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score-head b { color: var(--text); font-size: .95rem; }
.deck-info { grid-column: 1 / -1; font-size: .78rem; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.mini-back { width: 12px; height: 16px; border-radius: 3px; background: var(--back); display: inline-block; box-shadow: inset 0 0 0 1px rgba(255,255,255,.3); }

/* -- faixa de turno ------------------------------------------------------------ */
.banner {
  max-width: 720px; margin: 8px auto 0; padding: 10px 16px; text-align: center; font-weight: 800; color: var(--muted);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px;
}
.banner.mine {
  position: sticky; top: 63px; z-index: 15; margin: 8px 12px 0; border-radius: 14px; color: var(--gold-text);
  background: linear-gradient(180deg, #ffd56e, var(--gold)); box-shadow: 0 8px 22px rgba(0,0,0,.35);
}
@media (min-width: 744px) { .banner.mine { margin: 8px auto 0; } }
.banner.mine .btn { color: var(--gold-text); border-color: rgba(0,0,0,.2); }
.banner-text { flex-basis: 100%; }
.top-cards { display: flex; gap: 8px; justify-content: center; }

/* -- jogadores ------------------------------------------------------------------- */
.others { max-width: 720px; margin: 0 auto; padding: 8px 12px; display: grid; gap: 10px; }
@media (min-width: 744px) { .others { grid-template-columns: 1fr 1fr; } }
.seat {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px;
  transition: border-color .15s, box-shadow .15s;
}
.seat.turn { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold), 0 0 24px rgba(245,196,81,.18); }
.seat.dead { opacity: .45; }
.seat.protected { box-shadow: inset 0 0 0 2px rgba(120,190,255,.5); }
.seat-head {
  display: flex; align-items: center; gap: 8px; width: 100%; background: none; border: 0; padding: 2px;
  text-align: left; border-radius: 12px; cursor: default; min-height: 44px; flex-wrap: wrap;
}
.seat-head:disabled { opacity: 1; }
.seat.pickable .seat-head { cursor: pointer; background: rgba(245,196,81,.14); box-shadow: 0 0 0 2px var(--gold); animation: pulse 1.2s infinite; }
.seat-name { font-weight: 800; flex: 1; min-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hearts { font-size: .85rem; letter-spacing: -1px; white-space: nowrap; }
.hearts.dead { letter-spacing: 0; color: var(--muted); }
.shield { font-size: 1rem; }

.row { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.card-back, .face.mini {
  position: relative; width: 52px; height: 72px; border-radius: 9px; flex: none; padding: 0; cursor: default;
  border: 0; transition: transform .12s, box-shadow .12s, opacity .12s;
}
.card-back {
  background:
    var(--back-image),
    repeating-linear-gradient(45deg, rgba(255,255,255,.07) 0 4px, transparent 4px 9px),
    radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--back) 60%, #fff) 0 14%, transparent 15%),
    linear-gradient(160deg, color-mix(in srgb, var(--back) 80%, #fff), var(--back));
  background-size: cover;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.22), 0 3px 8px rgba(0,0,0,.4);
}
.card-back .pos {
  position: absolute; left: 4px; top: 3px; font-size: .68rem; font-weight: 900; color: rgba(255,255,255,.85);
}
.card-back:disabled { opacity: .35; }
.card-back.selectable, .face.selectable { cursor: pointer; box-shadow: 0 0 0 3px var(--gold), 0 0 16px rgba(245,196,81,.55); animation: pulse 1.2s infinite; }
.card-back.picked, .face.picked { transform: translateY(-6px); box-shadow: 0 0 0 3px #fff, 0 0 20px rgba(255,255,255,.6); animation: none; }
@keyframes pulse { 50% { box-shadow: 0 0 0 3px var(--gold), 0 0 4px rgba(245,196,81,.2); } }

/* -- frentes de carta -------------------------------------------------------------- */
.face {
  --c: #888; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: #fff; text-align: center; background-size: cover; background-position: center;
  background-color: var(--c);
  background-image: linear-gradient(170deg, color-mix(in srgb, var(--c) 60%, #fff), var(--c) 55%, color-mix(in srgb, var(--c) 55%, #000));
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.3), 0 3px 8px rgba(0,0,0,.4);
}
.face.has-image { background-size: cover; background-position: center; background-color: #0b0816; }
.face.ancora { --c: var(--ancora); }
.face.energia { --c: var(--energia); }
.face.era { --c: var(--era); }
.face.mini .face-icon { font-size: 1.5rem; }
.face.big { width: 120px; height: 168px; border-radius: 14px; padding: 10px; }
.face.big .face-icon { font-size: 2.6rem; }
.face-name { font-weight: 900; font-size: .95rem; line-height: 1.1; }
.face-flavor { font-size: .68rem; opacity: .85; line-height: 1.2; }

/* -- meu painel (fixo embaixo) ------------------------------------------------------- */
.me {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 18; padding: 10px 14px calc(12px + var(--safe-b));
  background: rgba(27, 20, 51, .96); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line); border-radius: 22px 22px 0 0; box-shadow: 0 -10px 30px rgba(0,0,0,.45);
}
.me.turn { border-top: 2px solid var(--gold); }
.me > * { max-width: 720px; margin-left: auto; margin-right: auto; }
.me-head { display: flex; align-items: center; gap: 8px; }
.me-role { background: none; border: 0; padding: 0; cursor: pointer; }
.me-role .rolechip { font-size: .85rem; padding: 5px 10px; }
.me .row { justify-content: center; }
.actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.act {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 64px;
  border-radius: 14px; border: 1px solid var(--line); background: rgba(255,255,255,.08); cursor: pointer;
  font-weight: 800; font-size: .82rem; transition: transform .08s;
}
.act .i { font-size: 1.4rem; line-height: 1; }
.act:active { transform: scale(.96); }
.act.tech { background: linear-gradient(180deg, #ffd56e, var(--gold)); color: var(--gold-text); border: 0; }
.act.danger { border-color: rgba(229,72,77,.5); color: #ffb3b3; }

/* -- fim de jogo ------------------------------------------------------------------------ */
.end-overlay { position: fixed; inset: 0; z-index: 30; background: rgba(8, 5, 18, .78); display: grid; place-items: center; padding: 16px; animation: fade .3s; }
.end-card { width: min(100%, 440px); max-height: 92dvh; overflow-y: auto; text-align: center; background: var(--panel-solid); border: 1px solid var(--line); border-radius: 24px; padding: 22px 18px; box-shadow: 0 30px 80px rgba(0,0,0,.6); }
.end-card.guardioes { border-color: var(--ancora); }
.end-card.lacaios { border-color: var(--energia); }
.reveal-list { list-style: none; padding: 0; margin: 14px 0; text-align: left; }
.reveal-list li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
@keyframes fade { from { opacity: 0; } }

/* -- folhas (bottom sheet) ------------------------------------------------------------- */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(5, 3, 12, .6); animation: fade .2s; }
.sheet {
  position: fixed; z-index: 41; left: 0; right: 0; bottom: 0; max-height: 86dvh; overflow-y: auto;
  background: var(--panel-solid); border-radius: 24px 24px 0 0; border-top: 1px solid var(--line);
  padding: 6px 18px calc(18px + var(--safe-b)); box-shadow: 0 -20px 60px rgba(0,0,0,.6);
  animation: sheet-in .22s ease-out;
}
@media (min-width: 640px) {
  .sheet { left: 50%; right: auto; bottom: auto; top: 50%; width: 460px; transform: translate(-50%, -50%); border-radius: 22px; border: 1px solid var(--line); animation: fade .2s; }
  .sheet-grip { display: none; }
}
@keyframes sheet-in { from { transform: translateY(60px); opacity: 0; } }
.sheet-grip { width: 42px; height: 5px; border-radius: 3px; background: var(--line); margin: 6px auto 12px; }
.sheet h2 { margin-top: 6px; }
.sheet-actions { display: flex; gap: 10px; margin-top: 16px; }
.sheet-actions .btn { flex: 1; }
.secret { margin: 8px 0; }
.secret-cards { display: flex; gap: 12px; justify-content: center; }
.secret-card { display: flex; flex-direction: column; align-items: center; gap: 4px; font-weight: 800; }
.secret .face.big { margin: 6px auto; }
.history { list-style: none; padding: 0; margin: 0; }
.history li { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.rules { padding-left: 1.1rem; }
.rules li { margin-bottom: .4rem; }
.tech-list { display: flex; flex-direction: column; gap: 8px; }
.tech-option {
  --role: #888; display: flex; gap: 12px; align-items: center; text-align: left; padding: 10px 12px; border-radius: 14px;
  background: color-mix(in srgb, var(--role) 14%, transparent); border: 1px solid color-mix(in srgb, var(--role) 45%, transparent);
  cursor: pointer; color: var(--text);
}
.tech-option.static { cursor: default; }
.tech-option .muted { font-size: .85rem; }
.tech-icon { font-size: 1.7rem; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: color-mix(in srgb, var(--role) 35%, transparent); flex: none; }

/* -- avisos ------------------------------------------------------------------------- */
#toasts { position: fixed; z-index: 25; bottom: calc(var(--me-h, 0px) + 12px); left: 50%; transform: translateX(-50%); width: min(92vw, 440px); display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.toast { background: rgba(43,34,80,.97); border: 1px solid var(--line); color: var(--text); padding: 9px 14px; border-radius: 14px; font-size: .9rem; box-shadow: 0 8px 24px rgba(0,0,0,.45); animation: sheet-in .2s ease-out; text-align: center; }
.toast.big { font-weight: 800; font-size: 1rem; border-color: var(--gold); }
.toast.error { background: var(--danger); border-color: transparent; }
.toast.out { opacity: 0; transform: translateY(-6px); transition: all .3s; }

/* ==========================================================================
   Modo de teste (/teste/): vários "celulares" lado a lado
   ========================================================================== */
body.test-table { padding: 0; }
.test-head { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); background: rgba(18,13,34,.9); }
.test-head .btn.small { min-height: 32px; padding: .2rem .7rem; }
.phones { display: flex; gap: 16px; padding: 16px; overflow-x: auto; align-items: flex-start; }
.phone { margin: 0; flex: none; }
.phone figcaption { font-weight: 800; margin-bottom: 6px; display: flex; gap: 8px; }
.phone iframe { width: 390px; height: min(800px, calc(100dvh - 120px)); border: 0; border-radius: 28px; box-shadow: 0 0 0 10px #000, 0 20px 50px rgba(0,0,0,.6); background: var(--bg); }

/* -- contas ------------------------------------------------------------------ */
.userbar { display: flex; align-items: center; gap: 8px; padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px; border-bottom: 1px solid var(--line); }
.userbar form { margin: 0; }
.hint { color: var(--muted); font-size: .8rem; margin: -4px 0 0; }
.hero a.btn { text-decoration: none; }
.recent { margin-top: 14px; text-align: left; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.recent h3 { width: 100%; margin: 0 0 4px; }
.messages { list-style: none; padding: 0; }

/* -- linha do tempo em cartas ------------------------------------------------------------ */
.timeline { display: flex; gap: 4px; margin-top: 6px; }
.tl-card {
  flex: 1; max-width: 30px; aspect-ratio: 5 / 7; border-radius: 4px; border: 1.5px dashed rgba(255,255,255,.18);
  display: grid; place-items: center; font-size: .7rem; line-height: 1;
}
.tl-card.on { border: 0; box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.35), 0 0 8px var(--c); background: linear-gradient(170deg, color-mix(in srgb, var(--c) 60%, #fff), var(--c)); }
.tl-card.ancora { --c: var(--ancora); }
.tl-card.energia { --c: var(--energia); }
.tl-card.new { animation: tl-pop .7s cubic-bezier(.2, 1.6, .4, 1) 1.4s both; }
@keyframes tl-pop { from { transform: scale(0) rotate(-20deg); opacity: 0; } }

/* -- palco: cartas grandes que viram ------------------------------------------------------ */
#stage { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 16px; background: rgba(6, 4, 14, .88); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fade .2s; }
.stage-box {
  --w: min(130px, calc((100vw - 48px - (var(--n) - 1) * 10px) / var(--n)));
  width: 100%; max-width: 720px; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center;
  animation: stage-in .25s ease-out;
}
.stage-box.out { opacity: 0; transform: scale(.96); transition: all .2s; }
@keyframes stage-in { from { opacity: 0; transform: translateY(14px) scale(.97); } }
.stage-title { font-weight: 900; font-size: 1.1rem; text-shadow: 0 2px 10px rgba(0,0,0,.6); }
.stage-box.secret .stage-title { color: var(--gold); }
.stage-cards { display: flex; align-items: center; justify-content: center; gap: 10px; perspective: 900px; }
.stage-slot { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.stage-label { font-size: .75rem; font-weight: 800; color: var(--muted); }
.stage-between { font-size: 1.6rem; font-weight: 900; color: var(--gold); }
.stage-caption { color: var(--text); opacity: .9; font-size: .92rem; max-width: 420px; }
.stage-hint { color: var(--muted); font-size: .72rem; }
.stage-btn { min-width: 200px; }

.flip { width: var(--w); aspect-ratio: 5 / 7; transition: transform .9s cubic-bezier(.5, 0, .3, 1); }
.flip-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .52s cubic-bezier(.4, .1, .3, 1.25); }
.flip.up .flip-inner { transform: rotateY(180deg); }
.flip-side { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.flip-side.front { transform: rotateY(180deg); }
.flip-side .card-back, .flip-side .face.big { width: 100%; height: 100%; border-radius: 12px; }
.flip.up .face { box-shadow: inset 0 0 0 2px rgba(255,255,255,.35), 0 0 34px color-mix(in srgb, var(--c) 70%, transparent), 0 10px 30px rgba(0,0,0,.5); }
.stage-box.many .face-flavor { display: none; }
.stage-box.many .face.big { padding: 6px; }
.stage-box.many .face.big .face-icon { font-size: 1.8rem; }
.stage-box.many .face-name { font-size: .7rem; }
/* Embaralhar: as cartas viram, se juntam no meio e se espalham de novo */
.stage-box.shuffling .flip { animation: gather .9s ease-in-out .5s both; }
@keyframes gather {
  45% { transform: translateX(calc((var(--n) - 1) * 0.5 * (var(--w) + 10px) - var(--i) * (var(--w) + 10px))) rotate(calc((var(--i) - 2) * 6deg)); }
  70% { transform: translateX(calc((var(--n) - 1) * 0.5 * (var(--w) + 10px) - var(--i) * (var(--w) + 10px))) translateY(-8px) rotate(calc((2 - var(--i)) * 5deg)); }
}
@media (prefers-reduced-motion: reduce) {
  .flip-inner, .flip { transition: none; }
  .stage-box.shuffling .flip, .tl-card.new { animation: none; }
}

/* -- carta desconhecida e "o que você sabe" ------------------------------------------------- */
.face.unknown {
  --c: #5b5277;
  background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.06) 0 6px, transparent 6px 12px),
    linear-gradient(170deg, #7a7098, #3d3555);
}
.face.unknown .face-icon { font-weight: 900; color: #fff; }
.tl-card.unknown { --c: #8a80a8; font-weight: 900; color: #fff; }
.tl-card.era { --c: var(--era); }
.knowledge {
  display: flex; align-items: center; gap: 8px; margin-top: 8px; padding: 4px 0; width: 100%;
  background: none; border: 0; color: var(--muted); font: inherit; font-size: .74rem; font-weight: 800; cursor: pointer;
}
.knowledge-cards { display: flex; gap: 3px; }
.knowledge-cards .tl-card { width: 20px; flex: none; }
.knowledge-gone { color: var(--gold); font-weight: 700; }
