/* DAMOKU - folha de estilo.
   Fraunces para a marca e os títulos, Inter para tudo o resto. Fundo escuro
   por omissão, com um modo claro para quem resolve à luz do dia. */

:root {
  color-scheme: dark light;
  /* sobreposto por data-theme, ver abaixo */

  --bg: #0e1219;
  --bg-2: #121824;
  --surface: #171e2b;
  --surface-2: #1d2634;
  --ink: #eef2f8;
  --ink-soft: #b9c4d4;
  --muted: #7f8da2;
  --line: rgba(255, 255, 255, .09);
  --line-2: rgba(255, 255, 255, .16);
  --grid: rgba(255, 255, 255, .13);
  --grid-firm: rgba(238, 242, 248, .82);
  --accent: #e8a087;
  --accent-2: #d9765a;
  --accent-wash: rgba(232, 160, 135, .14);
  --entered: #7db6e8;
  --wrong: #f0796b;
  --sel: rgba(125, 182, 232, .26);
  --peer: rgba(255, 255, 255, .045);
  --same: rgba(232, 160, 135, .13);
  --block: #0a0e15;

  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px -14px rgba(0, 0, 0, .8);
  --shadow-lift: 0 2px 6px rgba(0, 0, 0, .45), 0 26px 50px -20px rgba(0, 0, 0, .95);
  --r: 16px;
  --r-sm: 11px;

  --ui: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: Fraunces, "Iowan Old Style", Georgia, serif;
  --jp: "Yu Gothic", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "MS Gothic", sans-serif;

  --ease: cubic-bezier(.22, .8, .3, 1);
}

/* Modo automático: só vale enquanto ela não escolher. Assim que carrega no
   botão, o atributo data-theme aparece e estas regras deixam de aplicar. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg: #f6f3ee;
    --bg-2: #efeae2;
    --surface: #ffffff;
    --surface-2: #f7f4ef;
    --ink: #141c2b;
    --ink-soft: #3d4a60;
    --muted: #6d7a8c;
    --line: rgba(20, 28, 43, .1);
    --line-2: rgba(20, 28, 43, .18);
    --grid: rgba(20, 28, 43, .15);
    --grid-firm: rgba(20, 28, 43, .85);
    --accent: #c25c3c;
    --accent-2: #a94a2c;
    --accent-wash: rgba(194, 92, 60, .12);
    --entered: #2f6fa8;
    --wrong: #c0392b;
    --sel: rgba(47, 111, 168, .2);
    --peer: rgba(20, 28, 43, .04);
    --same: rgba(194, 92, 60, .11);
    --block: #141c2b;
    --shadow: 0 1px 2px rgba(20, 28, 43, .05), 0 10px 30px -16px rgba(20, 28, 43, .3);
    --shadow-lift: 0 2px 6px rgba(20, 28, 43, .07), 0 26px 50px -22px rgba(20, 28, 43, .4);
  }
}

/* Escolha explícita. Mantém estes valores iguais aos de cima. */
:root[data-theme="light"] {
    --bg: #f6f3ee;
    --bg-2: #efeae2;
    --surface: #ffffff;
    --surface-2: #f7f4ef;
    --ink: #141c2b;
    --ink-soft: #3d4a60;
    --muted: #6d7a8c;
    --line: rgba(20, 28, 43, .1);
    --line-2: rgba(20, 28, 43, .18);
    --grid: rgba(20, 28, 43, .15);
    --grid-firm: rgba(20, 28, 43, .85);
    --accent: #c25c3c;
    --accent-2: #a94a2c;
    --accent-wash: rgba(194, 92, 60, .12);
    --entered: #2f6fa8;
    --wrong: #c0392b;
    --sel: rgba(47, 111, 168, .2);
    --peer: rgba(20, 28, 43, .04);
    --block: #141c2b;
    --shadow: 0 1px 2px rgba(20, 28, 43, .05), 0 10px 30px -16px rgba(20, 28, 43, .3);
    --shadow-lift: 0 2px 6px rgba(20, 28, 43, .07), 0 26px 50px -22px rgba(20, 28, 43, .4);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

/* Qualquer regra de display nossa ganha ao display:none que o browser dá ao
   atributo hidden, e o botão de voltar aparecia na lista. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 16px;
  line-height: 1.55;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(3.5rem + env(safe-area-inset-bottom));
  overflow-x: hidden;
}

/* Halo por trás de tudo, para o fundo não ser uma chapa lisa. */
.glow {
  position: fixed;
  inset: -30vh -10vw auto;
  height: 70vh;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(46% 50% at 22% 30%, var(--accent-wash), transparent 70%),
    radial-gradient(40% 46% at 80% 12%, rgba(125, 182, 232, .11), transparent 70%);
  filter: blur(10px);
}

main { max-width: 54rem; margin: 0 auto; padding: 0 1.15rem; position: relative; z-index: 1; }

/* ------------------------------------------------------------------ barra */

.bar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1.15rem;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: saturate(1.7) blur(16px);
  -webkit-backdrop-filter: saturate(1.7) blur(16px);
  border-bottom: 1px solid transparent;
  transition: border-color .25s var(--ease), background .25s var(--ease);
}
.bar.scrolled { border-bottom-color: var(--line); }

.bar-title { flex: 1; display: flex; align-items: baseline; gap: 0.6rem; min-width: 0; }
.bar-mark { font-family: var(--display); font-size: 1.1rem; font-weight: 600; letter-spacing: 0.15em; }
.bar-sub {
  font-family: var(--jp);
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.icon-btn {
  display: grid; place-items: center;
  width: 2.3rem; height: 2.3rem;
  border: 1px solid var(--line-2);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer; padding: 0; flex: none;
  transition: transform .16s var(--ease), background .2s;
}
.icon-btn svg { width: 1.05rem; height: 1.05rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:active { transform: scale(.9); }
.icon-btn.ghost { border-color: transparent; background: none; }

.timer {
  font-variant-numeric: tabular-nums;
  font-size: 0.82rem; font-weight: 500;
  color: var(--ink-soft);
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
}

/* ------------------------------------------------------------------- hero */

.hero { text-align: center; padding: 3.2rem 0 1.6rem; }
.hero-mark {
  font-family: var(--display);
  font-size: clamp(2.9rem, 13vw, 5rem);
  font-weight: 600;
  letter-spacing: 0.1em;
  margin: 0; line-height: .96;
  text-indent: 0.1em;
  background: linear-gradient(180deg, var(--ink), color-mix(in srgb, var(--ink) 62%, var(--accent)));
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  animation: fade-up .7s var(--ease) both;
}
.hero-kana {
  font-family: var(--jp);
  font-size: clamp(.85rem, 3.2vw, 1.05rem);
  letter-spacing: .45em; text-indent: .45em;
  color: var(--accent);
  margin: .85rem 0 0;
  animation: fade-up .7s .06s var(--ease) both;
}

@keyframes fade-up { from { opacity: 0; transform: translateY(14px); } }

/* ---------------------------------------------------------------- filtros */

/* ------------------------------------------------------------------ lista */

@keyframes card-in { from { opacity: 0; transform: translateY(12px) scale(.97); } }

.card > * { position: relative; }

.card-tick {
  position: absolute; top: .6rem; right: .6rem;
  width: 1.25rem; height: 1.25rem; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent); color: var(--bg);
  font-size: .7rem; font-weight: 700;
  z-index: 2;
}

.thumb {
  width: 100%; aspect-ratio: 1;
  border-radius: 9px;
  background: var(--surface-2);
  overflow: hidden;
  transition: opacity .3s;
}
.thumb svg { width: 100%; height: 100%; display: block; }

.chip {
  display: inline-block;
  font-size: .68rem; font-weight: 600; letter-spacing: .01em;
  padding: .16rem .5rem; border-radius: 999px;
  background: var(--surface-2); color: var(--ink-soft);
  white-space: nowrap;
  border: 1px solid var(--line);
}
.chip.b1 { background: rgba(94, 186, 138, .15); color: #6fc79b; border-color: rgba(94, 186, 138, .25); }
.chip.b2 { background: rgba(104, 165, 226, .15); color: #7db6e8; border-color: rgba(104, 165, 226, .25); }
.chip.b3 { background: rgba(224, 179, 84, .15); color: #dcb15f; border-color: rgba(224, 179, 84, .25); }
.chip.b4 { background: rgba(226, 143, 88, .15); color: #e69660; border-color: rgba(226, 143, 88, .25); }
.chip.b5 { background: rgba(232, 106, 92, .16); color: #ef8577; border-color: rgba(232, 106, 92, .28); }
.chip.tag { background: var(--accent-wash); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 26%, transparent); }
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .chip.b1 { color: #3d7a5b; }
  :root:not([data-theme]) .chip.b2 { color: #2f689c; }
  :root:not([data-theme]) .chip.b3 { color: #8e6a10; }
  :root:not([data-theme]) .chip.b4 { color: #a1561c; }
  :root:not([data-theme]) .chip.b5 { color: #ad3a2f; }
}
:root[data-theme="light"] .chip.b1 { color: #3d7a5b; }
:root[data-theme="light"] .chip.b2 { color: #2f689c; }
:root[data-theme="light"] .chip.b3 { color: #8e6a10; }
:root[data-theme="light"] .chip.b4 { color: #a1561c; }
:root[data-theme="light"] .chip.b5 { color: #ad3a2f; }
.chip.mini { background: none; border-color: transparent; color: var(--muted); padding-inline: .15rem; }

/* ------------------------------------------------------------------- jogo */

.playhead { text-align: center; padding: 1.7rem 0 1.2rem; animation: fade-up .45s var(--ease) both; }
.playhead h1 { font-family: var(--display); font-size: 1.85rem; font-weight: 600; margin: 0 0 .55rem; letter-spacing: -.01em; }
.rules { font-size: .86rem; color: var(--muted); margin: .95rem auto 0; max-width: 32rem; }

.board-wrap { display: flex; justify-content: center; animation: fade-up .5s .05s var(--ease) both; }
.board {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: .75rem;
  width: 100%; max-width: 30rem;
  touch-action: manipulation;
}
.board svg { width: 100%; height: auto; display: block; user-select: none; -webkit-user-select: none; }

.cell { cursor: pointer; }
.cell-bg { fill: transparent; transition: fill .12s linear; }
.cell-bg.sel { fill: var(--sel); }
.cell-bg.peer { fill: var(--peer); }
.cell-bg.block { fill: var(--block); }
.grid-line { stroke: var(--grid); stroke-width: .5; }
.grid-strong { stroke: var(--grid-firm); stroke-width: 1.4; }
.cage { stroke: var(--muted); stroke-width: .6; stroke-dasharray: 1.9 1.5; fill: none; }
.given { fill: var(--ink); font-weight: 600; }
.entered { fill: var(--entered); font-weight: 500; }
.entered.bad { fill: var(--wrong); }
.pop { animation: pop .22s var(--ease); transform-origin: center; transform-box: fill-box; }
@keyframes pop { from { transform: scale(.45); opacity: .2; } }
.note { fill: var(--muted); }
.clue { fill: var(--ink-soft); }
.kclue { fill: #cfd8e6; }
.deco { fill: var(--ink); }
.num { fill: var(--muted); }
.wsfound { stroke: var(--accent); stroke-opacity: .3; stroke-linecap: round; fill: none; }
.wsdrag { stroke: var(--entered); stroke-opacity: .3; stroke-linecap: round; fill: none; }
.wsletter { fill: var(--ink-soft); font-family: var(--ui); font-weight: 500; }

/* -------------------------------------------------------------- definição */

.cluebar {
  display: flex; align-items: center; gap: .25rem;
  margin: 0 auto 1rem; max-width: 30rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: .4rem .45rem;
  box-shadow: var(--shadow);
}
.cluebar p { flex: 1; margin: 0; text-align: center; font-size: .9rem; }
.cluebar b { color: var(--accent); font-variant-numeric: tabular-nums; }

.ghost-input { position: fixed; opacity: 0; pointer-events: none; width: 1px; height: 1px; left: -100px; top: 0; border: 0; }

/* ---------------------------------------------------------------- teclado */

.pad { margin: 1.4rem auto 0; max-width: 30rem; }
.keys { display: grid; grid-template-columns: repeat(5, 1fr); gap: .5rem; }
.keys button {
  font: inherit; font-size: 1.3rem; font-weight: 500;
  font-variant-numeric: tabular-nums;
  padding: .78rem 0;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .12s var(--ease), background .15s, border-color .15s;
}
.keys button:hover { background: var(--surface-2); border-color: var(--accent); }
.keys button:active { transform: scale(.93); background: var(--accent-wash); }

.tools { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .7rem; }
.tool {
  flex: 1 1 6rem;
  display: flex; align-items: center; justify-content: center; gap: .35rem;
  font: inherit; font-size: .83rem; font-weight: 500;
  padding: .62rem .4rem;
  background: var(--surface); color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background .18s, color .18s, border-color .18s, transform .12s var(--ease);
}
.tool:active { transform: scale(.96); }
.tool-glyph { font-size: .95rem; line-height: 1; }
.tool.on { background: var(--accent); color: #1a0f0b; border-color: var(--accent); }
.tool.danger { color: var(--accent); }

.status { text-align: center; margin: 1.15rem 0 0; min-height: 1.5em; color: var(--muted); font-size: .89rem; }

/* --------------------------------------------------------------- vitória */

.win {
  position: relative; overflow: hidden;
  margin: 1.5rem auto 0; max-width: 22rem; text-align: center;
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--accent) 32%, var(--line));
  border-radius: var(--r);
  padding: 1.8rem 1.2rem 1.5rem;
  box-shadow: var(--shadow-lift);
  animation: fade-up .45s var(--ease) both;
}
.win-burst {
  position: absolute; inset: -50% -20% auto; height: 130%;
  background: radial-gradient(45% 45% at 50% 22%, var(--accent-wash), transparent 70%);
}
.win > * { position: relative; }
.win-mark {
  width: 2.8rem; height: 2.8rem; margin: 0 auto .8rem;
  display: grid; place-items: center; border-radius: 50%;
  background: var(--accent); color: var(--bg);
  font-size: 1.3rem; font-weight: 700;
  animation: stamp .5s var(--ease) both;
}
@keyframes stamp { from { transform: scale(.3) rotate(-18deg); opacity: 0; } }
.win-title { font-family: var(--display); font-size: 1.45rem; font-weight: 600; margin: 0; }
.win-time { color: var(--muted); font-size: .88rem; margin: .15rem 0 1.2rem; font-variant-numeric: tabular-nums; }

.btn {
  font: inherit; font-size: .88rem; font-weight: 500;
  padding: .62rem 1.4rem; border-radius: 999px;
  border: 1px solid var(--ink); background: var(--ink); color: var(--bg);
  cursor: pointer; transition: transform .14s var(--ease), opacity .2s;
}
.btn:active { transform: scale(.96); }

/* --------------------------------------------------------- sopa de letras */

.wordbank { margin: 1.15rem auto 0; max-width: 30rem; }
.wordbank ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .4rem; justify-content: center; }
.wordbank li {
  font-size: .75rem; font-weight: 500; letter-spacing: .04em;
  padding: .22rem .6rem; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink-soft);
  transition: opacity .25s, color .25s;
}
.wordbank li.found { color: var(--muted); text-decoration: line-through; opacity: .45; }
.secret {
  margin: 1.2rem auto 0; text-align: center;
  font-family: var(--display); font-style: italic; font-size: 1.05rem;
  color: var(--accent); max-width: 26rem; line-height: 1.45;
  animation: fade-up .6s var(--ease) both;
}

/* ------------------------------------------------------------- definições */

.cluelists { margin: 1.5rem auto 0; max-width: 30rem; display: grid; gap: 1.4rem; grid-template-columns: 1fr; }
@media (min-width: 34rem) { .cluelists { grid-template-columns: 1fr 1fr; } }
.cluelists h3 { font-size: .68rem; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); margin: 0 0 .55rem; font-weight: 700; }
.cluelists ol { list-style: none; margin: 0; padding: 0; }
.cluelists li {
  font-size: .84rem; padding: .3rem .45rem; border-radius: 7px;
  cursor: pointer; color: var(--ink-soft);
  transition: background .16s, color .16s, opacity .25s;
}
.cluelists li:hover { background: var(--surface); }
.cluelists li b { color: var(--muted); font-variant-numeric: tabular-nums; margin-right: .35rem; }
.cluelists li.on { background: var(--sel); color: var(--ink); }
.cluelists li.solved { opacity: .4; text-decoration: line-through; }

/* ------------------------------------------------------------- transições */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

::view-transition-old(root) { animation: vt-out .22s var(--ease) both; }
::view-transition-new(root) { animation: vt-in .3s var(--ease) both; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-8px) scale(.99); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(10px) scale(.995); } }

/* =========================================================== v3: escolha */

.lead {
  font-family: var(--display);
  font-size: 1.15rem; font-weight: 600;
  margin: 2.2rem 0 .9rem;
}

/* --- cartões de sequência --- */

.streaks { display: grid; grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr)); gap: .6rem; margin-top: 1.6rem; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: .85rem .9rem;
  box-shadow: var(--shadow);
  animation: fade-up .5s var(--ease) both;
}
.stat-card .v { font-family: var(--display); font-size: 1.7rem; font-weight: 600; line-height: 1.05; }
.stat-card .k { font-size: .74rem; color: var(--muted); letter-spacing: .01em; margin-top: .15rem; }
.stat-card.hot { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.stat-card.hot .v { color: var(--accent); }

/* --- enigma do dia --- */

.daily {
  display: flex; align-items: center; gap: .9rem; width: 100%;
  margin-top: .9rem; padding: .9rem 1rem;
  background: linear-gradient(135deg, var(--accent-wash), transparent 60%), var(--surface);
  border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--line));
  border-radius: var(--r);
  box-shadow: var(--shadow);
  cursor: pointer; color: inherit; font: inherit; text-align: left;
  transition: transform .18s var(--ease), box-shadow .25s;
  animation: fade-up .5s .05s var(--ease) both;
}
.daily:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.daily:active { transform: translateY(0); }
.daily .thumb { width: 3.2rem; height: 3.2rem; flex: none; }
.daily-body { flex: 1; min-width: 0; }
.daily-kicker { font-size: .68rem; letter-spacing: .17em; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.daily-name { font-weight: 600; font-size: .95rem; }
.daily-sub { font-size: .78rem; color: var(--muted); }

/* --- cartões de tipo --- */

.kinds { display: grid; gap: .7rem; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); }

.kind {
  position: relative;
  display: flex; flex-direction: column; gap: .65rem;
  padding: .85rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  cursor: pointer; color: inherit; font: inherit; text-align: left;
  overflow: hidden;
  transition: transform .2s var(--ease), box-shadow .25s var(--ease), border-color .25s;
  animation: card-in .5s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 30ms);
}
.kind::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(70% 60% at 50% 0%, var(--accent-wash), transparent 70%);
  opacity: 0; transition: opacity .3s;
}
.kind:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); border-color: var(--line-2); }
.kind:hover::before { opacity: 1; }
.kind:active { transform: translateY(-1px) scale(.995); }
.kind > * { position: relative; }
.kind .thumb { width: 100%; aspect-ratio: 1; }
.kind-name { font-weight: 600; font-size: .92rem; }
.kind-foot { display: flex; align-items: center; justify-content: space-between; gap: .4rem; font-size: .74rem; color: var(--muted); }
.kind-best { color: var(--accent); font-variant-numeric: tabular-nums; font-weight: 600; }
.kind.empty-pool { opacity: .5; }

/* ------------------------------------------------------------ jogo (v3) */

.playmeta { display: flex; align-items: center; justify-content: center; gap: .4rem; flex-wrap: wrap; }
.chip.best { background: var(--accent-wash); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 30%, transparent); font-variant-numeric: tabular-nums; }

.skiprow { text-align: center; margin-top: 1rem; }
.link {
  font: inherit; font-size: .84rem;
  background: none; border: 0; color: var(--muted);
  cursor: pointer; padding: .4rem .6rem; border-radius: 8px;
  text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-2);
}
.link:hover { color: var(--ink-soft); }
.link.danger { color: var(--accent); }

.win-actions { display: flex; flex-direction: column; align-items: center; gap: .5rem; margin-top: 1.2rem; }
.badges { display: flex; flex-wrap: wrap; gap: .35rem; justify-content: center; margin-top: .3rem; }
.badge {
  font-size: .7rem; font-weight: 600;
  padding: .2rem .6rem; border-radius: 999px;
  background: var(--accent-wash); color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  animation: fade-up .4s var(--ease) both;
}
.win.record { border-color: var(--accent); }
.win.record .win-mark { animation: stamp .5s var(--ease) both, glow 1.6s 0.5s ease-in-out infinite; }
@keyframes glow {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-wash); }
  50% { box-shadow: 0 0 0 12px transparent; }
}
.beat { text-decoration: line-through; opacity: .55; }

/* ---------------------------------------------------------------- números */

.stats-table { display: grid; gap: .5rem; margin-top: 1rem; }
.stats-row {
  display: grid; grid-template-columns: 1.6rem 1fr auto auto;
  align-items: center; gap: .7rem;
  padding: .7rem .85rem;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: .87rem;
}
.stats-row .mini-thumb { width: 1.6rem; height: 1.6rem; opacity: .55; }
.stats-row .n { color: var(--muted); font-variant-numeric: tabular-nums; }
.stats-row .t { color: var(--accent); font-variant-numeric: tabular-nums; font-weight: 600; }
.stats-empty { color: var(--muted); text-align: center; padding: 2rem 0; }

/* Os filhos do cartão do dia são spans: sem isto ficam todos na mesma linha. */
.daily-kicker, .daily-name, .daily-sub { display: block; }
.daily-kicker { line-height: 1.4; }

/* O color-scheme tem de acompanhar, senão as barras de scroll e os campos
   nativos ficam do tema errado. */
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"]  { color-scheme: dark; }

/* Botão do tema: mostra só o ícone do estado actual. */
.theme-ico { display: none; }
:root:not([data-theme]) .theme-ico.auto,
:root[data-theme="light"] .theme-ico.light,
:root[data-theme="dark"] .theme-ico.dark { display: block; }

/* =============================================================== v7: pausa */

/* O relógio é o botão de pausa: é onde a mão já está e é o que se quer parar. */
.timer {
  display: inline-flex; align-items: center; gap: .4rem;
  font: inherit; font-size: .82rem; font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
  padding: .3rem .7rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: transform .14s var(--ease), border-color .2s, color .2s;
}
.timer:hover { border-color: var(--line-2); }
.timer:active { transform: scale(.95); }
.timer-ico { width: .72rem; height: .72rem; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; }
.timer.paused { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
/* Em pausa o ícone passa a "play", para dizer o que o toque vai fazer. */
.timer.paused .timer-ico { display: none; }
.timer.paused::before {
  content: ""; width: 0; height: 0;
  border-left: .5rem solid currentColor;
  border-top: .32rem solid transparent;
  border-bottom: .32rem solid transparent;
}

.board-stack { position: relative; width: 100%; max-width: 30rem; }
.board-stack .board { max-width: none; }

/* A grelha fica tapada, não desfocada: um desfoque lê-se na mesma se se
   apertar os olhos, e o objectivo da pausa é não continuar a pensar nela. */
.veil {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  z-index: 5;
  animation: veil-in .2s var(--ease) both;
}
@keyframes veil-in { from { opacity: 0; } }
.veil-inner { text-align: center; padding: 1.5rem; }
.veil-ico {
  width: 2rem; height: 2rem; margin-bottom: .7rem;
  fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linecap: round;
}
.veil-title { font-family: var(--display); font-size: 1.4rem; font-weight: 600; margin: 0 0 .3rem; }
.veil-sub { color: var(--muted); font-size: .85rem; margin: 0 0 1.2rem; line-height: 1.5; }

/* Com a grelha tapada, o teclado não deve aceitar nada. */
.pad.frozen { opacity: .35; pointer-events: none; }

/* Mesmo número que a casa escolhida: ajuda a varrer a grelha, não revela nada
   que já não esteja escrito. */
.cell-bg.same { fill: var(--same); }

/* ========================================================= quadro do dia */

.board-panel {
  margin-top: .9rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: .9rem 1rem 1rem;
  box-shadow: var(--shadow);
  animation: fade-up .45s var(--ease) both;
}
.board-panel h3 {
  font-size: .68rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 .7rem; font-weight: 700;
}
.lb-row {
  display: grid; grid-template-columns: 1.4rem 1fr auto;
  align-items: baseline; gap: .6rem;
  padding: .3rem 0; font-size: .9rem;
}
.lb-row + .lb-row { border-top: 1px solid var(--line); }
.lb-pos { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .8rem; }
.lb-row.gold .lb-pos, .lb-row.gold .lb-name { color: var(--accent); font-weight: 600; }
.lb-row.me { background: var(--accent-wash); border-radius: 7px; padding-inline: .4rem; margin-inline: -.4rem; }
.lb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-time { font-variant-numeric: tabular-nums; color: var(--ink-soft); }
.lb-note { color: var(--muted); font-size: .8rem; margin: .7rem 0 0; }

.lb-ask { margin-top: 1rem; text-align: center; }
.lb-ask-title { font-size: .9rem; margin: 0 0 .6rem; }
.lb-ask-row { display: flex; gap: .4rem; justify-content: center; }
.lb-ask input {
  font: inherit; font-size: .9rem;
  padding: .5rem .7rem; min-width: 0; flex: 1 1 8rem; max-width: 11rem;
  border: 1px solid var(--line-2); border-radius: var(--r-sm);
  background: var(--bg); color: var(--ink);
}
.lb-ask input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.lb-ask-note { color: var(--muted); font-size: .75rem; margin: .5rem 0 0; }
.btn.small { padding: .5rem 1rem; font-size: .85rem; border-radius: var(--r-sm); }

/* Contagem para o próximo enigma do dia. */
.daily-right { display: flex; flex-direction: column; align-items: flex-end; gap: .35rem; flex: none; }
.daily-count { font-size: .7rem; color: var(--muted); white-space: nowrap; }
.daily-count b { color: var(--accent); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ============================================================= definições */

.set-block {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 1rem 1.1rem 1.1rem;
  box-shadow: var(--shadow);
  margin-bottom: .8rem;
  animation: fade-up .45s var(--ease) both;
}
.set-block h3 {
  font-size: .68rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 .8rem; font-weight: 700;
}
.set-row { display: flex; gap: .5rem; }
.set-row input {
  font: inherit; font-size: .95rem;
  flex: 1 1 auto; min-width: 0;
  padding: .6rem .8rem;
  border: 1px solid var(--line-2); border-radius: var(--r-sm);
  background: var(--bg); color: var(--ink);
}
.set-row input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.set-note { color: var(--muted); font-size: .8rem; margin: .7rem 0 0; line-height: 1.5; }
.set-ok { color: var(--accent); font-size: .8rem; margin: .5rem 0 0; animation: fade-up .3s var(--ease) both; }

/* Selector de tema em três estados. */
.seg { display: flex; gap: .3rem; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: .25rem; }
.seg button {
  flex: 1; font: inherit; font-size: .82rem; font-weight: 500;
  padding: .45rem .3rem;
  border: 0; border-radius: 999px;
  background: transparent; color: var(--muted);
  cursor: pointer; white-space: nowrap;
  transition: background .18s, color .18s;
}
.seg button:hover { color: var(--ink-soft); }
.seg button.on { background: var(--ink); color: var(--bg); }

/* ============================================================== desafio */

.chip.rival {
  background: rgba(125, 182, 232, .16); color: var(--entered);
  border-color: color-mix(in srgb, var(--entered) 30%, transparent);
  font-variant-numeric: tabular-nums;
}
.btn.ghost-btn {
  background: transparent; color: var(--ink); border-color: var(--line-2);
  display: inline-flex; align-items: center; gap: .45rem;
}
.btn.ghost-btn:hover { border-color: var(--ink); }
.btn-ico { width: .95rem; height: .95rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.rival-line { color: var(--entered); font-size: .88rem; margin: .4rem 0 0; }
.rival-line.beat { color: var(--accent); font-weight: 600; }

/* =================================================== enigmas anteriores */

.pastrow { text-align: center; margin-top: .5rem; }

.past-row {
  display: grid; grid-template-columns: 2.4rem 1fr auto;
  align-items: center; gap: .8rem;
  width: 100%;
  padding: .75rem .9rem;
  margin-bottom: .5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow);
  cursor: pointer; color: inherit; font: inherit; text-align: left;
  transition: transform .16s var(--ease), border-color .2s;
  animation: card-in .4s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 25ms);
}
.past-row:hover { transform: translateY(-2px); border-color: var(--line-2); }
.past-row:active { transform: translateY(0); }
.past-row.today { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.past-thumb { width: 2.4rem; height: 2.4rem; opacity: .75; }
.past-thumb svg { width: 100%; height: 100%; }
.past-when { font-size: .7rem; color: var(--muted); text-transform: capitalize; }
.past-what { font-weight: 600; font-size: .9rem; }
.past-mark { font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.past-mark.done { color: var(--accent); font-weight: 600; }

/* Enigma do dia trancado enquanto não houver nome. */
.daily.locked { opacity: .72; }
.daily.locked .daily-kicker { color: var(--muted); }
.daily-lock { font-size: .95rem; filter: grayscale(1); opacity: .6; }

/* ================================================================ perfil */

.profile-head { display: flex; align-items: center; gap: 1rem; padding: 1.8rem 0 1.4rem; }
.avatar {
  width: 3.6rem; height: 3.6rem; flex: none;
  display: grid; place-items: center;
  font-size: 2rem; line-height: 1;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 50%; box-shadow: var(--shadow);
}
.profile-id { min-width: 0; }
.profile-id h1 { font-family: var(--display); font-size: 1.6rem; font-weight: 600; margin: 0; overflow: hidden; text-overflow: ellipsis; }
.profile-sub { color: var(--muted); font-size: .85rem; margin: .15rem 0 0; }

.set-row select {
  font: inherit; font-size: .95rem;
  flex: 1 1 auto; min-width: 0;
  padding: .6rem .7rem;
  border: 1px solid var(--line-2); border-radius: var(--r-sm);
  background: var(--bg); color: var(--ink);
}

.badge-grid { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); }
.badge-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: .8rem .85rem;
  box-shadow: var(--shadow);
  animation: card-in .45s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 22ms);
}
.badge-card.locked { opacity: .42; }
.badge-card.locked .badge-ico { filter: grayscale(1); }
.badge-ico { font-size: 1.5rem; line-height: 1; }
.badge-name { font-weight: 600; font-size: .84rem; margin-top: .4rem; }
.badge-desc { color: var(--muted); font-size: .72rem; margin-top: .15rem; line-height: 1.4; }
.badge-card.earned { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }

.lb-flag { margin-right: .35rem; }
