/* =========================================================
   MATRIX CONQUEST — estilos
   Conceito: o fundo é um plano sob uma transformação linear viva (fieldBackground.js).
   Layout: hero editorial dividido + bento assimétrico; superfícies em "moldura dupla"
   (núcleo + bandeja feitos com sombras concêntricas). J1 = azul (î), J2 = coral (ĵ).
   Tema escuro único e deliberado.
   ========================================================= */

:root {
  --bg: #07080b;
  --bg-2: #0b0d12;
  --core: rgba(14, 16, 22, 0.86);
  --core-2: rgba(20, 23, 31, 0.92);
  --fg: #eceef3;
  --fg-2: #a7acbb;
  --fg-3: #7a7f90;
  --line: rgba(236, 238, 243, 0.08);
  --line-2: rgba(236, 238, 243, 0.14);
  --line-3: rgba(236, 238, 243, 0.24);
  --tray: rgba(255, 255, 255, 0.025);
  --blue: #6b93ff;
  --blue-soft: rgba(107, 147, 255, 0.14);
  --coral: #ff7d5e;
  --coral-soft: rgba(255, 125, 94, 0.14);
  --gold: #f4c86a;
  --gold-soft: rgba(244, 200, 106, 0.14);
  --good: #5fe3a4;
  --good-soft: rgba(95, 227, 164, 0.11);
  --bad: #ff6b6b;
  --bad-soft: rgba(255, 107, 107, 0.11);
  --warn: #f4c86a;
  --warn-soft: rgba(244, 200, 106, 0.1);
  --flame: #ffa25a;
  --on-accent: #07080b;
  --sea: #0a121c;
  --sea-line: rgba(120, 170, 230, 0.2);
  --sand: #161a23;
  --sand-ink: rgba(236, 238, 243, 0.32);
  --scrim: rgba(3, 4, 6, 0.72);

  --font-display: 'Geist', 'Segoe UI', system-ui, sans-serif;
  --font-serif: 'Instrument Serif', 'Times New Roman', Georgia, serif;
  --font-body: 'Geist', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;

  --step--1: 0.8125rem;
  --step-0: 1rem;
  --step-1: 1.125rem;
  --step-2: 1.375rem;
  --step-3: 1.75rem;
  --step-4: 2.5rem;

  --r-core: 22px;
  --r-sm: 14px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-in: cubic-bezier(0.7, 0, 0.84, 0);
  /* moldura dupla: hairline do núcleo, bandeja de 7px, hairline da bandeja, realce interno */
  --bezel: 0 0 0 1px var(--line), 0 0 0 7px var(--tray), 0 0 0 8px var(--line), inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 30px 60px -30px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 96px;
}

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.55;
  color: var(--fg);
  background: radial-gradient(1200px 800px at 85% -10%, rgba(107, 147, 255, 0.08), transparent 60%),
    radial-gradient(900px 700px at -10% 110%, rgba(255, 125, 94, 0.06), transparent 60%), var(--bg);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* grão de filme: camada fixa, não interativa */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.field {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
}
/* durante as partidas o fundo fica mais discreto, para não disputar atenção com as contas */
body:has(.screen[data-screen='tower'], .screen[data-screen='conquest']) .field {
  opacity: 0.45;
  transition: opacity 1.2s var(--ease-out);
}
.field-caption {
  position: fixed;
  left: 20px;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  z-index: 1;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--fg-3);
  opacity: 0.7;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
  white-space: pre;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 0.5em;
  text-wrap: balance;
}

p {
  margin: 0 0 0.75em;
}

a {
  color: var(--blue);
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
}

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
  border-radius: 8px;
}

[hidden] {
  display: none !important;
}

.icon {
  flex: none;
  stroke-width: 1.6;
}

.with-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 60;
  padding: 10px 16px;
  background: var(--fg);
  color: var(--bg);
  border-radius: 999px;
  font-weight: 600;
}
.skip-link:focus {
  top: calc(12px + env(safe-area-inset-top, 0px));
}

.muted {
  color: var(--fg-3);
}

.center {
  display: flex;
  justify-content: center;
  margin-block: 32px;
}

.eyebrow,
.eyebrow-pill {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.eyebrow-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-self: start;
  align-self: start;
  width: max-content;
  max-width: 100%;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 0 0 1px var(--line-2);
  color: var(--fg-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.eyebrow-pill__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 0 4px rgba(95, 227, 164, 0.15);
  animation: breathe 2.4s var(--ease-out) infinite;
}
@keyframes breathe {
  50% {
    box-shadow: 0 0 0 7px rgba(95, 227, 164, 0);
  }
}

kbd {
  display: inline-grid;
  place-items: center;
  min-width: 1.9em;
  padding: 1px 7px;
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px var(--line-3), inset 0 -2px 0 var(--line-2);
  background: rgba(255, 255, 255, 0.04);
  font-family: var(--font-mono);
  font-size: 0.82em;
  color: var(--fg);
}

.pen--p0 {
  color: var(--blue);
}
.pen--p1 {
  color: var(--coral);
}

/* ---------- Superfícies (moldura dupla) ---------- */
.panel,
.sheet,
.tower,
.stat,
.versus-wrap,
.tutorial__step,
.dialog,
.map-card,
.player-panel,
.feedback {
  position: relative;
  background: var(--core);
  border-radius: var(--r-core);
  box-shadow: var(--bezel);
}
.panel,
.sheet {
  padding: 24px;
}

/* ---------- Estrutura ---------- */
.topbar {
  position: sticky;
  top: calc(12px + env(safe-area-inset-top, 0px));
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: min(1200px, calc(100% - 32px));
  margin: 12px auto 0;
  padding: 6px 6px 6px 16px;
  border-radius: 999px;
  background: rgba(10, 12, 17, 0.62);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  box-shadow: 0 0 0 1px var(--line), inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 20px 40px -20px rgba(0, 0, 0, 0.6);
}
.topbar__brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 4px;
  border: 0;
  background: none;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}
.topbar__brand:disabled {
  cursor: default;
}
.topbar__logo .logo-bracket {
  fill: none;
  stroke: var(--fg);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.topbar__logo .logo-mark {
  fill: var(--gold);
}
.topbar__logo .logo-dot {
  fill: var(--line-3);
}

.screen {
  position: relative;
  z-index: 2;
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 16px 72px;
  outline: none;
}

.footer {
  position: relative;
  z-index: 2;
  padding: 24px 16px calc(40px + env(safe-area-inset-bottom, 0px));
  text-align: center;
  color: var(--fg-3);
  font-size: var(--step--1);
}
.footer strong {
  color: var(--fg-2);
  font-weight: 500;
}

.noscript {
  text-align: center;
  padding: 40px 16px;
}

/* ---------- Entrada (motion.js) ---------- */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  filter: blur(6px);
}
.reveal.is-revealed {
  opacity: 1;
  transform: none;
  filter: none;
  transition:
    opacity 0.9s var(--ease-out) var(--reveal-delay, 0ms),
    transform 0.9s var(--ease-out) var(--reveal-delay, 0ms),
    filter 0.9s var(--ease-out) var(--reveal-delay, 0ms);
}

.split {
  display: inline-block;
}
.split__char {
  display: inline-block;
  animation: char-up 1s var(--ease-out) both;
  animation-delay: calc(var(--ci) * 45ms + 120ms);
}
@keyframes char-up {
  from {
    transform: translateY(0.6em) rotate(6deg);
    opacity: 0;
    filter: blur(8px);
  }
}

/* ---------- Chips ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 3px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 0 0 1px var(--line-2);
  color: var(--fg-2);
  font-size: var(--step--1);
  font-weight: 500;
  white-space: nowrap;
}
.chip--topic {
  color: var(--fg);
  box-shadow: inset 0 0 0 1px var(--line-3);
}
.chip--final {
  background: var(--gold-soft);
  color: var(--gold);
  box-shadow: inset 0 0 0 1px rgba(244, 200, 106, 0.4);
}
.bars-icon rect.is-on {
  fill: currentColor;
}
.bars-icon rect.is-off {
  fill: var(--line-3);
}

/* ---------- Botões (pílulas com ícone aninhado) ---------- */
.btn {
  --btn-bg: rgba(255, 255, 255, 0.05);
  --btn-fg: var(--fg);
  --btn-ring: var(--line-2);
  --icon-bg: rgba(255, 255, 255, 0.08);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 20px;
  border: 0;
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  box-shadow: inset 0 0 0 1px var(--btn-ring);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--step-0);
  letter-spacing: -0.01em;
  transform: translate(var(--mx, 0), var(--my, 0));
  transition:
    transform 0.5s var(--ease-spring),
    background-color 0.3s var(--ease-out),
    box-shadow 0.3s var(--ease-out),
    opacity 0.3s var(--ease-out);
}
.btn .icon {
  box-sizing: content-box;
  width: 16px;
  height: 16px;
  padding: 7px;
  margin-block: -4px;
  border-radius: 50%;
  background: var(--icon-bg);
  transition: transform 0.5s var(--ease-spring);
}
/* ícone sempre no fim, aninhado num círculo ("botão dentro do botão"); todo .btn tem rótulo de texto */
.btn > .icon {
  order: 2;
  margin-right: -12px;
}
.btn:hover:not(:disabled) .icon {
  transform: translate(2px, -1px) scale(1.06);
}
.btn:hover:not(:disabled) {
  --btn-ring: var(--line-3);
}
.btn:active:not(:disabled) {
  transform: translate(var(--mx, 0), var(--my, 0)) scale(0.97);
}
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.btn--sm {
  min-height: 40px;
  padding: 6px 16px;
  font-size: 0.9rem;
}
.btn--sm .icon {
  padding: 5px;
}
.btn--lg {
  min-height: 54px;
  padding: 10px 26px;
  font-size: var(--step-1);
}
.btn--lg > .icon {
  margin-right: -16px;
}
.btn--primary {
  --btn-bg: var(--fg);
  --btn-fg: var(--bg);
  --btn-ring: transparent;
  --icon-bg: rgba(7, 8, 11, 0.1);
  box-shadow: 0 10px 30px -10px rgba(236, 238, 243, 0.35);
}
.btn--primary:hover:not(:disabled) {
  --btn-bg: #ffffff;
}
.btn--success {
  --btn-bg: var(--good);
  --btn-fg: var(--on-accent);
  --btn-ring: transparent;
  --icon-bg: rgba(7, 8, 11, 0.12);
}
.btn--danger {
  --btn-fg: var(--bad);
  --btn-ring: rgba(255, 107, 107, 0.4);
}
.btn--ghost {
  --btn-bg: rgba(255, 255, 255, 0.04);
}
.btn--p0 {
  --btn-bg: var(--blue);
  --btn-fg: var(--on-accent);
  --btn-ring: transparent;
  --icon-bg: rgba(7, 8, 11, 0.12);
}
.btn--p1 {
  --btn-bg: var(--coral);
  --btn-fg: var(--on-accent);
  --btn-ring: transparent;
  --icon-bg: rgba(7, 8, 11, 0.12);
}
.btn--attack {
  width: 100%;
  min-height: 62px;
  font-size: var(--step-2);
  font-weight: 600;
}
.btn--attack::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: inherit;
  box-shadow: 0 0 0 1px currentColor;
  opacity: 0;
  animation: ring 1.8s var(--ease-out) infinite;
  color: var(--btn-bg);
  pointer-events: none;
}
@keyframes ring {
  0% {
    opacity: 0.6;
    transform: scale(0.96);
  }
  100% {
    opacity: 0;
    transform: scale(1.08);
  }
}

/* ---------- Cabeçalho das telas ---------- */
.screen-header {
  display: flex;
  align-items: flex-start;
  gap: 16px 24px;
  margin-bottom: 40px;
  flex-wrap: wrap;
}
.screen-header__text {
  display: grid;
  gap: 10px;
  min-width: 0;
}
.screen-title {
  font-size: clamp(2.2rem, 6vw, 4rem);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 0.95;
  margin: 0;
  outline: none;
}
.screen-subtitle {
  color: var(--fg-2);
  margin: 0;
  max-width: 58ch;
  font-size: var(--step-1);
}

/* ---------- Menu ---------- */
.menu {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 56px;
}
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.85fr);
  gap: 48px;
  align-items: center;
  padding-block: 24px 8px;
  min-height: min(68vh, 640px);
}
.hero__text {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 26px;
  min-width: 0;
}
.hero__title {
  display: grid;
  margin: 0;
  font-size: clamp(3.4rem, 11vw, 8.4rem);
  font-weight: 500;
  line-height: 0.86;
  letter-spacing: -0.06em;
  outline: none;
}
.hero__serif {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.02em;
  padding-left: 0.18em;
  background: linear-gradient(100deg, var(--blue) 0%, #b9a7ff 45%, var(--coral) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero__serif {
  display: inline-block;
  padding-right: 0.08em;
  animation: char-up 1.2s var(--ease-out) 0.45s both;
}
.hero__lead {
  margin: 0;
  max-width: 46ch;
  color: var(--fg-2);
  font-size: var(--step-1);
  line-height: 1.6;
}
.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.specimen {
  margin: 0;
  justify-self: center;
  width: min(420px, 100%);
  perspective: 900px;
}
.specimen__core {
  display: grid;
  gap: 22px;
  padding: 26px;
  border-radius: 28px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.01) 40%), var(--core);
  box-shadow: var(--bezel);
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transform-style: preserve-3d;
  transition: transform 0.8s var(--ease-spring);
  animation: float 9s var(--ease-out) infinite alternate;
}
@keyframes float {
  from {
    translate: 0 -6px;
  }
  to {
    translate: 0 8px;
  }
}
.specimen__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.specimen__order {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--fg-3);
}
.specimen__body {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.specimen__name {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 2.2rem;
  color: var(--fg-2);
}
.specimen__matrix .matrix__cell {
  font-size: 1.7rem;
}
.specimen__det {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  color: var(--fg-3);
}
.specimen__det strong {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 500;
  letter-spacing: -0.04em;
  color: var(--fg);
}
.specimen__hint {
  margin: -10px 0 0;
  font-size: 0.75rem;
  color: var(--fg-3);
}

.bento-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 22px;
}
.bento {
  grid-column: span 6;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  border-radius: var(--r-core);
}
.bento--tower {
  grid-column: span 7;
}
.bento--conquest {
  grid-column: span 5;
}
.bento__core {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 18px;
  height: 100%;
  min-height: 380px;
  padding: 26px;
  border-radius: var(--r-core);
  background: var(--core);
  box-shadow: var(--bezel);
  overflow: hidden;
  transition:
    transform 0.6s var(--ease-spring),
    box-shadow 0.6s var(--ease-out);
}
.bento__core::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(500px 280px at 80% 0%, var(--glow, var(--blue-soft)), transparent 70%);
  opacity: 0.8;
  transition: opacity 0.6s var(--ease-out);
  pointer-events: none;
}
.bento--conquest .bento__core {
  --glow: var(--coral-soft);
}
.bento:hover .bento__core {
  transform: translateY(-4px);
}
.bento:hover .bento__core::before {
  opacity: 1.4;
}
.bento__head {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.bento__go {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px var(--line-2);
  transition:
    transform 0.6s var(--ease-spring),
    background-color 0.3s var(--ease-out),
    color 0.3s var(--ease-out);
}
.bento:hover .bento__go {
  transform: rotate(-45deg);
  background: var(--fg);
  color: var(--bg);
}
.bento__art {
  position: relative;
  justify-self: center;
  align-self: center;
  width: 100%;
  max-width: 260px;
  height: auto;
  max-height: 200px;
}
.bento__text {
  position: relative;
  display: grid;
  gap: 8px;
}
.bento__title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3.4vw, 2.6rem);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1;
}
.bento__desc {
  color: var(--fg-2);
  max-width: 44ch;
}
.bento__facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.bento__facts span {
  padding: 3px 10px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px var(--line);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--fg-3);
}

/* ilustrações dos modos */
.art-floor {
  fill: rgba(255, 255, 255, 0.025);
  stroke: var(--line-3);
  stroke-width: 1;
  transform-box: fill-box;
  transform-origin: center bottom;
  animation: floor-glow 4.8s var(--ease-out) infinite;
  animation-delay: calc(var(--fi) * 0.24s);
}
@keyframes floor-glow {
  0%,
  100% {
    fill: rgba(255, 255, 255, 0.025);
  }
  12% {
    fill: rgba(107, 147, 255, 0.35);
    stroke: var(--blue);
  }
}
.art-flag {
  fill: none;
  stroke: var(--gold);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.art-ground {
  stroke: var(--line-3);
}
.art-contour {
  fill: none;
  stroke: var(--sea-line);
  stroke-dasharray: 3 5;
}
.art-land {
  fill: var(--sand);
  stroke: var(--sand-ink);
  stroke-width: 1.2;
}
.art-land--p0 {
  stroke: var(--blue);
  fill: var(--blue-soft);
}
.art-land--p1 {
  stroke: var(--coral);
  fill: var(--coral-soft);
}
.art-route {
  fill: none;
  stroke: var(--coral);
  stroke-width: 1.6;
  stroke-dasharray: 4 6;
  animation: dash 1.6s linear infinite;
}
@keyframes dash {
  to {
    stroke-dashoffset: -20;
  }
}
.art-shot {
  fill: var(--fg);
  offset-path: path('M52 108 Q130 0 208 92');
  animation: travel 3.2s var(--ease-spring) infinite;
}
@keyframes travel {
  from {
    offset-distance: 0%;
    opacity: 0;
  }
  15% {
    opacity: 1;
  }
  85% {
    opacity: 1;
  }
  to {
    offset-distance: 100%;
    opacity: 0;
  }
}

.quick {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 22px;
}
.quick__item {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 72px;
  padding: 14px 18px;
  border: 0;
  border-radius: 20px;
  background: var(--core);
  box-shadow: var(--bezel);
  text-align: left;
  transition: transform 0.5s var(--ease-spring);
}
.quick__item:hover {
  transform: translateY(-3px);
}
.quick__icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 0 0 1px var(--line);
}
.quick__text {
  display: grid;
  min-width: 0;
  flex: 1;
}
.quick__text strong {
  font-weight: 500;
}
.quick__text small {
  color: var(--fg-3);
  font-size: 0.78rem;
}
.quick__arrow {
  color: var(--fg-3);
  transition: transform 0.5s var(--ease-spring);
}
.quick__item:hover .quick__arrow {
  transform: translateX(4px);
  color: var(--fg);
}

.marquee {
  position: relative;
  overflow: hidden;
  padding-block: 22px;
  border-block: 1px solid var(--line);
  mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}
.marquee__track {
  display: flex;
  width: max-content;
  animation: marquee 38s linear infinite;
}
.marquee:hover .marquee__track {
  animation-play-state: paused;
}
.marquee__list {
  display: flex;
  gap: 48px;
  margin: 0;
  padding: 0 24px;
  list-style: none;
}
.marquee__list li {
  display: inline-flex;
  align-items: center;
  gap: 48px;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  color: var(--fg-2);
  white-space: nowrap;
}
.marquee__dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--gold);
  transform: rotate(45deg);
  order: -1;
}
@keyframes marquee {
  to {
    transform: translateX(-50%);
  }
}

.contents {
  display: grid;
  gap: 14px;
}
.contents__list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px 24px;
  list-style: none;
  padding: 0;
  margin: 0;
}
.contents__list li {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--fg-2);
}
.contents__list .icon {
  color: var(--good);
}

/* ---------- Setup ---------- */
.setup {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}
.setup__main {
  display: grid;
  gap: 26px;
}
.setup__main > .btn {
  justify-self: start;
}
.setup__aside {
  display: grid;
  gap: 16px;
}
.setup__rules {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
  color: var(--fg-2);
}
.setup__rules .icon--heart {
  color: var(--coral);
}
.setup__rules .icon--flame {
  color: var(--flame);
}

.floor-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
}
.floor-list li {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
.floor-list li:last-child {
  border-bottom: 0;
}
.floor-list strong,
.floor-list small {
  display: block;
}
.floor-list strong {
  font-weight: 500;
}
.floor-list small {
  color: var(--fg-3);
}
.floor-list__num {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  box-shadow: inset 0 0 0 1px var(--line-2);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--fg-2);
}

.difficulty {
  border: 0;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.difficulty legend {
  padding: 0;
  margin-bottom: 12px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.difficulty__option {
  position: relative;
  display: grid;
  gap: 6px;
  align-content: start;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.025);
  box-shadow: inset 0 0 0 1px var(--line);
  cursor: pointer;
  transition:
    box-shadow 0.3s var(--ease-out),
    background-color 0.3s var(--ease-out),
    transform 0.5s var(--ease-spring);
}
.difficulty__option:hover {
  box-shadow: inset 0 0 0 1px var(--line-3);
}
.difficulty__option:active {
  transform: scale(0.98);
}
.difficulty__option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.difficulty__title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  font-size: var(--step-1);
}
.difficulty__desc {
  font-size: var(--step--1);
  color: var(--fg-3);
}
.difficulty__option:has(input:checked) {
  background: rgba(107, 147, 255, 0.08);
  box-shadow: inset 0 0 0 1.5px var(--blue);
}
.difficulty__option:has(input:checked) .difficulty__title {
  color: var(--blue);
}
.difficulty__option:has(input:focus-visible) {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
}
.toggle input {
  appearance: none;
  position: relative;
  flex: none;
  width: 44px;
  height: 26px;
  margin: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px var(--line-2);
  cursor: pointer;
  transition: background-color 0.3s var(--ease-out);
}
.toggle input::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--fg-2);
  transition:
    transform 0.5s var(--ease-spring),
    background-color 0.3s var(--ease-out);
}
.toggle input:checked {
  background: var(--good);
}
.toggle input:checked::after {
  transform: translateX(18px);
  background: var(--on-accent);
}
.toggle input:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}
.toggle strong,
.toggle small {
  display: block;
}
.toggle strong {
  font-weight: 500;
}
.toggle small {
  color: var(--fg-3);
}
.toggle--block {
  padding: 20px 22px;
}
.toggle--block .icon {
  color: var(--fg-2);
}

.players-form {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 14px;
}
.players-form__vs {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.8rem;
  color: var(--fg-3);
  padding-bottom: 6px;
}
.player-field {
  display: grid;
  gap: 8px;
}
.player-field__label {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-weight: 500;
}
.player-field__label small {
  font-family: var(--font-mono);
  color: var(--fg-3);
  font-size: 0.72rem;
}
.pen-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  align-self: center;
}
.player-field--p0 .pen-dot {
  background: var(--blue);
}
.player-field--p1 .pen-dot {
  background: var(--coral);
}
.text-input {
  width: 100%;
  min-height: 52px;
  padding: 12px 18px;
  border: 0;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.035);
  box-shadow: inset 0 0 0 1px var(--line-2);
  font-size: var(--step-1);
  transition:
    box-shadow 0.3s var(--ease-out),
    background-color 0.3s var(--ease-out);
}
.text-input::placeholder {
  color: var(--fg-3);
}
.text-input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 0 1.5px var(--fg-2);
}
.player-field--p0 .text-input:focus {
  box-shadow: inset 0 0 0 1.5px var(--blue);
}
.player-field--p1 .text-input:focus {
  box-shadow: inset 0 0 0 1.5px var(--coral);
}

.rules {
  margin: 0;
  padding-left: 1.5em;
  display: grid;
  gap: 10px;
  color: var(--fg-2);
}
.rules li::marker {
  font-family: var(--font-mono);
  font-size: 0.85em;
  color: var(--fg-3);
}
.rules--keys {
  list-style: none;
  padding-left: 0;
}

/* ---------- Matrizes ---------- */
.matrix {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin: 0;
}
.matrix__label {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.25rem;
  color: var(--fg-2);
}
.matrix__body {
  position: relative;
  padding: 10px 18px;
}
.matrix__body::before,
.matrix__body::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 10px;
  border: 1.5px solid var(--fg-2);
  transform-origin: center;
  animation: bracket-in 0.8s var(--ease-out) both;
}
.matrix__body::before {
  left: 0;
  border-right: 0;
  border-radius: 6px 0 0 6px;
}
.matrix__body::after {
  right: 0;
  border-left: 0;
  border-radius: 0 6px 6px 0;
}
@keyframes bracket-in {
  from {
    transform: scaleY(0.2);
    opacity: 0;
  }
}
.matrix__grid {
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(2.4ch, auto));
  gap: 8px 18px;
  justify-items: center;
  align-items: center;
}
.matrix__cell {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
  min-width: 2.4ch;
  text-align: center;
  padding: 2px 6px;
  border-radius: 8px;
  animation: cell-in 0.7s var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 35ms + 120ms);
}
@keyframes cell-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.9);
    filter: blur(4px);
  }
}
.matrix__cell.is-marked {
  background: var(--gold-soft);
  box-shadow: inset 0 0 0 1px rgba(244, 200, 106, 0.45);
  color: var(--gold);
}
.matrix__cell.is-negative {
  color: #ffc6b8;
}
.matrix__cell.is-marked.is-negative {
  color: var(--gold);
}
.matrix--compact .matrix__cell {
  font-size: 1.02rem;
}
.matrix--compact .matrix__grid {
  gap: 4px 12px;
}
.matrix--compact .matrix__label {
  font-size: 1rem;
}

.expr {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 16px 22px;
}
.expr__op {
  font-family: var(--font-serif);
  font-size: 2rem;
  color: var(--fg-3);
}
.expr__scalar {
  font-family: var(--font-mono);
  font-size: 1.5rem;
}

/* ---------- Entrada de resposta ---------- */
.answer {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
}
.cell-input {
  width: 3.7rem;
  height: 3.2rem;
  padding: 0 4px;
  border: 0;
  border-radius: 14px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 0 0 1px var(--line-2);
  transition:
    box-shadow 0.3s var(--ease-out),
    background-color 0.3s var(--ease-out),
    transform 0.4s var(--ease-spring);
}
.cell-input--wide {
  width: 8rem;
  height: 3.6rem;
  font-size: 1.6rem;
}
.cell-input:focus {
  outline: none;
  background: rgba(107, 147, 255, 0.1);
  box-shadow: inset 0 0 0 1.5px var(--blue), 0 0 0 5px rgba(107, 147, 255, 0.12);
  transform: translateY(-1px);
}
.cell-input:disabled {
  opacity: 1;
  cursor: default;
}
.cell-input.is-invalid {
  background: var(--warn-soft);
  box-shadow: inset 0 0 0 1.5px var(--warn);
}
.cell-input.is-right {
  background: var(--good-soft);
  box-shadow: inset 0 0 0 1.5px var(--good);
  color: var(--good);
  animation: cell-pop 0.5s var(--ease-spring);
}
.cell-input.is-wrong {
  background: var(--bad-soft);
  box-shadow: inset 0 0 0 1.5px var(--bad);
  color: var(--bad);
  text-decoration: line-through;
}
@keyframes cell-pop {
  40% {
    transform: scale(1.08);
  }
}
.matrix--input .matrix__grid {
  gap: 10px;
}
.matrix--input .matrix__body {
  padding: 12px 20px;
}
.answer-pair {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.answer-pair__item {
  display: grid;
  justify-items: center;
  gap: 6px;
  font-size: var(--step--1);
  color: var(--fg-3);
}
.answer-pair__sep {
  font-family: var(--font-serif);
  font-size: 1.8rem;
  color: var(--fg-3);
  line-height: 3.2rem;
}
.sign-btn {
  min-width: 44px;
  padding-inline: 14px;
  font-family: var(--font-mono);
  font-size: 1.15rem;
}
.answer-msg {
  margin: 4px 0 0;
  text-align: center;
  color: var(--warn);
  font-weight: 500;
}
.answer-msg:empty {
  display: none;
}

/* ---------- Questão ---------- */
.question {
  display: grid;
  gap: 18px;
  animation: question-in 0.8s var(--ease-out) both;
}
@keyframes question-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
}
.question__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.question__prompt {
  font-size: clamp(1.4rem, 3.2vw, 2rem);
  font-weight: 500;
  letter-spacing: -0.03em;
  margin: 0;
}
.question__operands {
  padding-block: 12px;
  overflow-x: auto;
}
.question__note {
  text-align: center;
  font-family: var(--font-mono);
  margin: 0;
}
.question__ask {
  display: flex;
  justify-content: center;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.question__ask-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.question__ask-expr {
  font-family: var(--font-mono);
  font-size: var(--step-2);
}

/* ---------- HUD ---------- */
.hud {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px 32px;
  padding: 16px 22px;
}
.hud__item {
  position: relative;
  display: grid;
  gap: 4px;
}
.hud__label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.hud__value {
  font-family: var(--font-display);
  font-size: var(--step-3);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.hud__timer {
  margin-left: auto;
}
.hud__quit {
  flex: none;
}
.combo {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 162, 90, 0.12);
  box-shadow: inset 0 0 0 1px rgba(255, 162, 90, 0.35);
  font-weight: 500;
  color: var(--flame);
}
.combo:empty {
  display: none;
}

.hearts {
  display: inline-flex;
  gap: 4px;
  line-height: 0;
}
.heart {
  display: inline-block;
  color: var(--coral);
  filter: drop-shadow(0 0 8px rgba(255, 125, 94, 0.45));
}
.heart.is-empty {
  color: var(--fg-3);
  filter: none;
}
.heart.is-breaking {
  animation: heart-break 0.48s var(--ease-out);
}
.heart.is-restored {
  animation: pop 0.45s var(--ease-spring);
}
@keyframes heart-break {
  0% {
    transform: scale(1);
  }
  35% {
    transform: scale(1.4) rotate(-12deg);
  }
  100% {
    transform: scale(0.9);
  }
}

.timer {
  display: grid;
  gap: 8px;
  min-width: 136px;
}
.timer__row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--fg-3);
}
.timer__text {
  font-family: var(--font-mono);
  font-size: var(--step-1);
  font-variant-numeric: tabular-nums;
  color: var(--fg);
}
.timer__track {
  height: 3px;
  border-radius: 2px;
  background: var(--line-2);
  overflow: hidden;
}
.timer__bar {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--coral));
  transform-origin: left;
  transition: transform 0.2s linear;
}
.timer.is-warning .timer__text,
.timer.is-warning .timer__row {
  color: var(--bad);
}
.timer.is-warning .timer__bar {
  background: var(--bad);
}
.timer.is-warning .timer__text {
  animation: tick 1s var(--ease-out) infinite;
}
@keyframes tick {
  50% {
    opacity: 0.55;
  }
}

/* ---------- Torre ---------- */
.tower-game {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}
.tower-game__side {
  position: sticky;
  top: calc(100px + env(safe-area-inset-top, 0px));
  min-width: 0; /* deixa a faixa de andares rolar em vez de alargar a página */
}
.tower-game__main {
  display: grid;
  gap: 22px;
  min-width: 0;
}
.tower {
  padding: 18px;
}
.tower__top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0 0 12px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
}
.tower__floors {
  position: relative;
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tower__floor {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  transition:
    background-color 0.5s var(--ease-out),
    box-shadow 0.5s var(--ease-out);
}
.tower__num {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  text-align: center;
  color: var(--fg-3);
}
.tower__info {
  display: grid;
  min-width: 0;
}
.tower__name {
  font-weight: 500;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tower__topic {
  font-size: 0.76rem;
  color: var(--fg-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tower__status {
  display: grid;
  place-items: center;
}
.tower__floor.is-locked {
  color: var(--fg-3);
}
.tower__floor.is-locked .tower__status {
  opacity: 0.55;
}
.tower__floor.is-done .tower__num,
.tower__floor.is-done .tower__status {
  color: var(--good);
}
.tower__floor.is-current {
  background: rgba(107, 147, 255, 0.12);
  box-shadow: inset 0 0 0 1px rgba(107, 147, 255, 0.45), 0 0 30px -8px rgba(107, 147, 255, 0.5);
}
.tower__floor.is-current .tower__num {
  color: var(--blue);
}
.tower__marker {
  display: inline-flex;
  color: var(--blue);
}
.progress {
  display: grid;
  gap: 8px;
}
.progress__track {
  height: 3px;
  border-radius: 2px;
  background: var(--line-2);
  overflow: hidden;
}
.progress__bar {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--good), var(--blue));
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 0.9s var(--ease-spring);
}
.progress__text {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--fg-3);
  text-align: center;
}

.answer-area {
  display: grid;
  justify-items: center;
  gap: 18px;
}
.answer-area__title {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-3);
}

/* ---------- Feedback e resolução ---------- */
.feedback {
  display: grid;
  gap: 14px;
  padding: 24px;
  animation: slide-in 0.7s var(--ease-out) both;
}
.feedback p {
  margin: 0;
}
.feedback--correct {
  background: linear-gradient(180deg, var(--good-soft), transparent 60%), var(--core);
}
.feedback--wrong {
  background: linear-gradient(180deg, var(--bad-soft), transparent 60%), var(--core);
}
.feedback__title {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: var(--step-4);
  font-weight: 500;
  letter-spacing: -0.04em;
  margin: 0;
}
.feedback--correct .feedback__title {
  color: var(--good);
}
.feedback--wrong .feedback__title {
  color: var(--bad);
}
.feedback__stamp {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: currentColor;
  animation: stamp 0.6s var(--ease-spring) both;
}
.feedback__stamp .icon {
  color: var(--on-accent);
  stroke-width: 2.4;
}
.feedback__points {
  font-family: var(--font-mono);
  color: var(--good);
}
.feedback__combo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-self: start;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 162, 90, 0.12);
  box-shadow: inset 0 0 0 1px rgba(255, 162, 90, 0.35);
  font-weight: 500;
  color: var(--flame);
}
.feedback__combo--lost {
  color: var(--bad);
  background: var(--bad-soft);
  box-shadow: inset 0 0 0 1px rgba(255, 107, 107, 0.35);
}
.feedback__action {
  justify-self: start;
}

.explain {
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.025);
  box-shadow: inset 0 0 0 1px var(--line);
}
.explain summary {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 8px 18px;
  cursor: pointer;
  font-weight: 500;
  list-style-position: inside;
}
.explain[open] summary {
  border-bottom: 1px solid var(--line);
}
.explain__body {
  display: grid;
  gap: 16px;
  padding: 16px 18px 18px;
  animation: slide-in 0.5s var(--ease-out) both;
}
.explain__step {
  display: grid;
  gap: 10px;
}
.explain__step p {
  margin: 0;
  max-width: 70ch;
  color: var(--fg-2);
}
.explain__calcs {
  list-style: none;
  margin: 0;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.3);
  box-shadow: inset 0 0 0 1px var(--line);
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.9;
  overflow-x: auto;
}
.explain__calcs li {
  white-space: nowrap;
  color: var(--fg-2);
}
.explain__result {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.explain__result strong {
  font-weight: 500;
}
.explain__answer {
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--step-3);
  color: var(--good);
}

/* ---------- Fim de jogo ---------- */
.end-screen {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 18px;
  padding-top: 24px;
}
.end-screen__seal {
  display: grid;
  place-items: center;
  width: 108px;
  height: 108px;
  margin-bottom: 8px;
  border-radius: 50%;
  box-shadow: var(--bezel);
  animation: stamp 0.9s var(--ease-spring) both;
}
.end-screen--win .end-screen__seal {
  background: radial-gradient(circle at 30% 25%, #ffe6a8, var(--gold) 60%, #b98a2e);
  color: var(--on-accent);
}
.end-screen--lose .end-screen__seal {
  background: var(--bad-soft);
  color: var(--bad);
}
.end-screen__title {
  font-size: clamp(3rem, 10vw, 6.5rem);
  font-weight: 500;
  letter-spacing: -0.06em;
  line-height: 0.9;
  margin: 0;
  outline: none;
}
.end-screen--win .end-screen__title {
  background: linear-gradient(100deg, var(--fg), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.end-screen--lose .end-screen__title {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.03em;
  color: var(--fg-2);
}
.end-screen__lead {
  display: grid;
  justify-items: center;
  gap: 6px;
  font-size: var(--step-1);
  max-width: 640px;
  margin: 0;
  color: var(--fg-2);
}
.end-screen__lead small {
  color: var(--fg-3);
  font-size: var(--step-0);
}
.end-screen__floor,
.end-screen__winner {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: var(--step-4);
  line-height: 1.1;
  color: var(--fg);
}
.end-screen__winner.pen--p0 {
  color: var(--blue);
}
.end-screen__winner.pen--p1 {
  color: var(--coral);
}
.end-screen__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 12px;
}

.stats-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 22px;
  margin-bottom: 28px;
}
.stats-grid--5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.stat {
  display: grid;
  gap: 10px;
  padding: 18px 20px;
  text-align: left;
}
.stat__label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--step--1);
  color: var(--fg-3);
}
.stat__value {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.versus-wrap {
  width: 100%;
  max-width: 680px;
  overflow-x: auto;
}
.versus {
  width: 100%;
  border-collapse: collapse;
}
.versus caption {
  padding: 16px 20px 6px;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.versus th,
.versus td {
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  text-align: right;
}
.versus tr:last-child th,
.versus tr:last-child td {
  border-bottom: 0;
}
.versus thead th {
  font-weight: 500;
}
.versus tbody th {
  text-align: left;
  color: var(--fg-2);
  font-weight: 400;
}
.versus td {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.versus td.is-winner {
  color: var(--gold);
}

/* ---------- Conquista ---------- */
.conquest {
  display: grid;
  gap: 24px;
}
.scoreboard {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: stretch;
  gap: 14px;
  padding: 12px;
}
.scoreboard__center {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 10px;
  padding-inline: 10px;
}
.scoreboard__round {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: var(--step-2);
}
.pboard {
  position: relative;
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 14px 18px;
  border-radius: 16px;
  transition: box-shadow 0.4s var(--ease-out);
}
.pboard--p0 {
  background: linear-gradient(120deg, var(--blue-soft), transparent 70%);
  box-shadow: inset 0 0 0 1px rgba(107, 147, 255, 0.25);
}
.pboard--p1 {
  background: linear-gradient(240deg, var(--coral-soft), transparent 70%);
  box-shadow: inset 0 0 0 1px rgba(255, 125, 94, 0.25);
  justify-items: end;
  text-align: right;
}
.pboard__name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--step-1);
  font-weight: 500;
  overflow-wrap: anywhere;
}
.pboard--p1 .pboard__name {
  flex-direction: row-reverse;
}
.pboard__tag {
  display: inline-grid;
  place-items: center;
  flex: none;
  min-width: 30px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--on-accent);
}
.pboard--p0 .pboard__tag,
.player-panel--p0 .pboard__tag {
  background: var(--blue);
}
.pboard--p1 .pboard__tag,
.player-panel--p1 .pboard__tag {
  background: var(--coral);
}
.pboard__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  font-size: 0.92rem;
}
.pboard--p1 .pboard__row {
  justify-content: flex-end;
}
.pboard__stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--fg-2);
}
.pboard__score {
  font-family: var(--font-mono);
  color: var(--fg);
}
.pboard__state {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.pboard.is-vulnerable {
  box-shadow: inset 0 0 0 1px var(--bad), 0 0 26px -10px var(--bad);
}
.pboard.is-vulnerable .pboard__state {
  color: var(--bad);
}
.pboard__combo {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 1.3em;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--flame);
}
.pboard__you {
  padding: 1px 8px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px var(--line-3);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--fg-2);
}

.battlefield {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}
.battlefield__map {
  position: sticky;
  top: calc(100px + env(safe-area-inset-top, 0px));
  display: grid;
  gap: 24px;
  min-width: 0;
}
.battlefield__play {
  display: grid;
  gap: 24px;
  min-width: 0;
}

/* Carta náutica */
.map-card {
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 40%, #0f1b2a, var(--sea) 70%);
}
.map {
  display: block;
  width: 100%;
  height: auto;
}
.map__sea {
  fill: transparent;
}
.map__soundings text {
  font-family: var(--font-mono);
  font-size: 14px;
  fill: var(--sea-line);
}
.map__routes line {
  stroke: var(--fg-3);
  stroke-opacity: 0.4;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 1 10;
}
.map__compass circle {
  fill: none;
  stroke: var(--sea-line);
  stroke-width: 1.2;
}
.map__compass-star {
  fill: none;
  stroke: var(--fg-3);
  stroke-width: 1.2;
}
.map__compass-north {
  fill: var(--fg-3);
}
.map__compass text {
  font-family: var(--font-mono);
  font-size: 15px;
  fill: var(--fg-3);
  text-anchor: middle;
}
.island__contour {
  fill: none;
  stroke: var(--sea-line);
  stroke-width: 1.2;
  stroke-dasharray: 4 6;
}
.island__contour--outer {
  opacity: 0.5;
}
.island__land {
  fill: var(--sand);
  stroke: var(--sand-ink);
  stroke-width: 2;
  transition:
    stroke 0.6s var(--ease-out),
    fill 0.6s var(--ease-out);
}
.island__hatch {
  fill: none;
  pointer-events: none;
}
.island[data-owner='p0'] .island__hatch {
  fill: url(#hatch-p0);
}
.island[data-owner='p1'] .island__hatch {
  fill: url(#hatch-p1);
}
.island[data-owner='p0'] .island__land {
  stroke: var(--blue);
  stroke-width: 3;
  fill: #121a2e;
}
.island[data-owner='p1'] .island__land {
  stroke: var(--coral);
  stroke-width: 3;
  fill: #261714;
}
.hatch-line--p0 {
  stroke: var(--blue);
  stroke-width: 2;
  stroke-opacity: 0.4;
}
.hatch-line--p1 {
  stroke: var(--coral);
  stroke-width: 2;
  stroke-opacity: 0.4;
}
.island__glyph {
  fill: none;
  stroke: var(--fg);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.island__badge {
  font-family: var(--font-mono);
  font-size: 15px;
  letter-spacing: 0.06em;
  fill: var(--fg-3);
  text-anchor: middle;
  dominant-baseline: middle;
}
.island[data-owner='p0'] .island__badge {
  fill: var(--blue);
}
.island[data-owner='p1'] .island__badge {
  fill: var(--coral);
}
.island__name {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 22px;
  letter-spacing: -0.01em;
  fill: var(--fg);
  text-anchor: middle;
  paint-order: stroke;
  stroke: var(--sea);
  stroke-width: 6px;
  stroke-linejoin: round;
}
.island__heart {
  fill: var(--coral);
  stroke: var(--coral);
  stroke-width: 1.5;
}
.island__heart.is-empty {
  fill: var(--sea);
  stroke: var(--fg-3);
  stroke-width: 2;
}
.island__flag line {
  stroke: var(--fg-2);
  stroke-width: 2;
  stroke-linecap: round;
}
.island[data-owner='p0'] .island__flag path {
  fill: var(--blue);
}
.island[data-owner='p1'] .island__flag path {
  fill: var(--coral);
}
.island[data-owner='none'] .island__flag {
  display: none;
}
.island.is-captured {
  animation: capture 1s var(--ease-spring);
  transform-box: fill-box;
  transform-origin: center;
}
@keyframes capture {
  0% {
    transform: scale(1);
  }
  25% {
    transform: scale(1.12);
  }
  100% {
    transform: scale(1);
  }
}
.map__route {
  fill: none;
  stroke: currentColor;
  stroke-width: 4;
  stroke-linecap: round;
  filter: drop-shadow(0 0 8px currentColor);
  transition: opacity 0.6s var(--ease-out);
}
.map__route.is-fading {
  opacity: 0;
}
.map__head {
  fill: currentColor;
  stroke: var(--fg);
  stroke-width: 2;
  filter: drop-shadow(0 0 10px currentColor);
}
.map__impact {
  fill: none;
  stroke: currentColor;
  stroke-width: 4;
  animation: impact 0.8s var(--ease-out) forwards;
  transform-box: fill-box;
  transform-origin: center;
}
@keyframes impact {
  from {
    transform: scale(0.5);
    opacity: 1;
  }
  to {
    transform: scale(5);
    opacity: 0;
  }
}

.battle-status {
  display: grid;
  gap: 12px;
}
.battle-status p {
  margin: 0;
}
.battle-status__event {
  display: grid;
  gap: 4px;
}
.battle-status__title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--step-3);
  font-weight: 500;
  letter-spacing: -0.03em;
  animation: slide-in 0.6s var(--ease-out) both;
}
.battle-status__ok {
  color: var(--good);
}
.battle-status__attack {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.battle-status__wait {
  color: var(--fg-2);
}

.arena {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: stretch;
  gap: 14px;
}
.arena__vs {
  align-self: center;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 2rem;
  color: var(--fg-3);
}
.player-panel {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 14px;
  padding: 18px 14px;
  transition: opacity 0.4s var(--ease-out);
}
.player-panel--p0 {
  background: linear-gradient(180deg, var(--blue-soft), transparent 55%), var(--core);
}
.player-panel--p1 {
  background: linear-gradient(180deg, var(--coral-soft), transparent 55%), var(--core);
}
.player-panel__title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: var(--step-1);
  font-weight: 500;
  overflow-wrap: anywhere;
}
.player-panel__input {
  max-width: 100%;
  overflow-x: auto;
}
.player-panel__verdict {
  margin: 0;
  font-weight: 500;
  text-align: center;
}
.player-panel__verdict:empty {
  display: none;
}
.player-panel.is-correct {
  background: linear-gradient(180deg, var(--good-soft), transparent 70%), var(--core);
}
.player-panel.is-correct .player-panel__verdict {
  color: var(--good);
}
.player-panel.is-wrong .player-panel__verdict {
  color: var(--bad);
}
.player-panel.is-locked:not(.is-correct) {
  opacity: 0.66;
}
.player-panel .cell-input {
  width: 3.1rem;
  height: 2.9rem;
  font-size: 1.1rem;
}
.player-panel .cell-input--wide {
  width: 6.5rem;
}
.player-panel--remote .player-panel__input {
  display: none;
}
.player-panel--remote .answer-msg {
  color: var(--fg-3);
  font-weight: 400;
}

/* ---------- Conteúdo (tutorial, aprender, estatísticas) ---------- */
.tutorial {
  list-style: none;
  padding: 0;
  margin: 0 0 28px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 22px;
}
.tutorial__step {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 22px;
}
.tutorial__step h2 {
  margin: 0;
  font-size: var(--step-2);
  font-weight: 500;
}
.tutorial__step p {
  margin: 0;
  color: var(--fg-2);
}
.tutorial__num {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 3rem;
  line-height: 0.9;
  color: var(--fg-3);
}
.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}
.info-block h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--step-2);
  font-weight: 500;
}
.info-block h2:not(:first-child) {
  margin-top: 24px;
}

.learn-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 32px;
}
.learn-nav__link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 4px 14px 4px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  box-shadow: inset 0 0 0 1px var(--line-2);
  color: var(--fg-2);
  font-size: var(--step--1);
  text-decoration: none;
  transition:
    box-shadow 0.3s var(--ease-out),
    color 0.3s var(--ease-out);
}
.learn-nav__link span {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}
.learn-nav__link:hover {
  color: var(--fg);
  box-shadow: inset 0 0 0 1px var(--line-3);
}
.learn {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 22px;
  margin-bottom: 40px;
}
.learn__topic {
  display: grid;
  gap: 14px;
  align-content: start;
  scroll-margin-top: 100px;
}
.learn__topic h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: var(--step-2);
  font-weight: 500;
  margin: 0;
}
.learn__topic p {
  margin: 0;
  color: var(--fg-2);
}
.learn__num {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.6rem;
  color: var(--fg-3);
}
.learn__example {
  padding: 18px 10px;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.28);
  box-shadow: inset 0 0 0 1px var(--line);
  overflow-x: auto;
}
.learn__note {
  font-family: var(--font-mono);
  font-size: 0.86rem;
}

.bars {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 14px;
}
.bars__item {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 2fr auto;
  gap: 14px;
  align-items: center;
}
.bars__label {
  color: var(--fg-2);
}
.bars__track {
  height: 6px;
  border-radius: 3px;
  background: var(--line-2);
  overflow: hidden;
}
.bars__fill {
  display: block;
  width: var(--pct);
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--blue), var(--good));
  transform-origin: left;
  animation: grow 1.2s var(--ease-out) both;
}
@keyframes grow {
  from {
    transform: scaleX(0);
  }
}
.bars__value {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--fg-3);
  font-variant-numeric: tabular-nums;
}

.settings {
  display: grid;
  gap: 22px;
  max-width: 720px;
}

/* ---------- Diálogo ---------- */
.dialog {
  max-width: min(460px, calc(100vw - 48px));
  border: 0;
  color: var(--fg);
  padding: 28px;
  background: var(--core-2);
}
.dialog[open] {
  animation: dialog-in 0.6s var(--ease-spring) both;
}
@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.96);
  }
}
.dialog::backdrop {
  background: var(--scrim);
  backdrop-filter: blur(8px);
}
.dialog h2 {
  font-size: var(--step-3);
  font-weight: 500;
}
.dialog p {
  color: var(--fg-2);
}
.dialog__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

/* ---------- Modo online e vez no modo local ---------- */
.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  margin: 0;
  padding: 5px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  box-shadow: inset 0 0 0 1px var(--line);
}
.segmented__option {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 999px;
  text-align: center;
  color: var(--fg-3);
  cursor: pointer;
  transition:
    background-color 0.4s var(--ease-spring),
    color 0.3s var(--ease-out);
}
.segmented__option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.segmented__option:has(input:checked) {
  background: var(--fg);
  color: var(--bg);
}
.segmented__option:has(input:focus-visible) {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}
.mode-pane {
  display: grid;
  gap: 22px;
  animation: slide-in 0.6s var(--ease-out) both;
}
.mode-pane > .btn {
  justify-self: start;
}
.online-choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.online-choice {
  display: grid;
  align-content: start;
  gap: 16px;
  padding: 20px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.025);
  box-shadow: inset 0 0 0 1px var(--line);
  min-width: 0;
}
.online-choice h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: var(--step-2);
  font-weight: 500;
}
.online-choice p {
  margin: 0;
}
.online-choice .difficulty {
  grid-template-columns: 1fr;
}
.online-choice > .btn {
  justify-self: start;
}
.text-input--code {
  font-family: var(--font-mono);
  font-size: var(--step-3);
  letter-spacing: 0.32em;
  text-transform: uppercase;
  text-align: center;
}

.lobby {
  max-width: 640px;
  margin-inline: auto;
  padding: 36px 28px;
}
.lobby__status {
  display: grid;
  justify-items: center;
  gap: 16px;
  text-align: center;
}
.lobby__status p {
  margin: 0;
}
.lobby__code {
  display: flex;
  gap: 0.12em;
  font-family: var(--font-mono);
  font-size: clamp(2.8rem, 12vw, 5rem);
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.12em;
  color: var(--fg);
  text-shadow: 0 0 40px rgba(107, 147, 255, 0.5);
}
.lobby__share {
  display: flex;
  gap: 8px;
  width: 100%;
}
.lobby__link {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  font-family: var(--font-mono);
  font-size: var(--step--1);
}
.lobby__meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px 14px;
  color: var(--fg-2);
}
.lobby__guest {
  font-weight: 500;
  color: var(--good);
}
.lobby__wait {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--fg-2);
}
.lobby__error {
  font-weight: 500;
  color: var(--bad);
}
.spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1.5px solid var(--line-2);
  border-top-color: var(--fg);
  animation: spin 0.9s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.net-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--bad-soft);
  box-shadow: inset 0 0 0 1px rgba(255, 107, 107, 0.4);
  font-weight: 500;
  animation: slide-in 0.5s var(--ease-out) both;
}

.btn--buzz {
  width: 100%;
  min-height: 64px;
  font-size: var(--step-1);
}
.btn--buzz kbd {
  background: rgba(7, 8, 11, 0.12);
  box-shadow: inset 0 0 0 1px rgba(7, 8, 11, 0.3);
  color: inherit;
}

/* ---------- Efeitos (só transform/opacity) ---------- */
@keyframes pop {
  0% {
    transform: scale(0.6);
    opacity: 0;
  }
  70% {
    transform: scale(1.06);
    opacity: 1;
  }
  100% {
    transform: scale(1);
  }
}
@keyframes stamp {
  0% {
    transform: scale(0.4) rotate(-20deg);
    opacity: 0;
  }
  100% {
    transform: none;
    opacity: 1;
  }
}
@keyframes slide-in {
  from {
    transform: translateY(14px);
    opacity: 0;
  }
}
@keyframes shake {
  20%,
  80% {
    transform: translateX(3px);
  }
  40% {
    transform: translateX(-7px);
  }
  60% {
    transform: translateX(7px);
  }
}
.fx-shake {
  animation: shake 0.45s var(--ease-out);
}
.fx-pop {
  animation: pop 0.5s var(--ease-spring);
}
.fx-damage {
  animation: damage 0.7s var(--ease-out);
}
@keyframes damage {
  30% {
    box-shadow: inset 0 0 0 1.5px var(--bad), 0 0 40px -6px var(--bad);
  }
}
.fx-climb {
  animation: climb 0.8s var(--ease-spring);
}
@keyframes climb {
  from {
    transform: translateY(18px);
    opacity: 0.3;
  }
}
.fx-hop {
  animation: hop 0.7s var(--ease-spring);
}
@keyframes hop {
  40% {
    transform: translateY(-9px);
  }
}
.fx-float {
  position: absolute;
  left: 50%;
  top: -12px;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  animation: float-up 1.4s var(--ease-out) forwards;
  z-index: 5;
}
.fx-float--good {
  color: var(--good);
  text-shadow: 0 0 18px rgba(95, 227, 164, 0.6);
}
.fx-float--bad {
  color: var(--bad);
}
@keyframes float-up {
  from {
    opacity: 1;
    transform: translate(-50%, 0) scale(0.9);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -48px) scale(1.1);
  }
}
.fx-confetti {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 50;
}

/* Reduzir animações: configuração do jogo ou do sistema */
.reduce-motion *,
.reduce-motion *::before,
.reduce-motion *::after {
  animation: none !important;
  transition: none !important;
}
.reduce-motion .reveal {
  opacity: 1;
  transform: none;
  filter: none;
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

/* ---------- Responsivo ---------- */
@media (max-width: 1080px) {
  .battlefield {
    grid-template-columns: 1fr;
  }
  .battlefield__map {
    position: static;
  }
  .map-card {
    max-width: 760px;
    width: 100%;
    justify-self: center;
  }
  .tutorial {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .stats-grid--5 {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }
  .quick {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: minmax(0, 1fr); /* 1fr puro não encolhe abaixo do conteúdo sem quebra */
    min-height: 0;
  }
  .specimen {
    justify-self: start;
  }
  .bento-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .bento,
  .bento--tower,
  .bento--conquest {
    grid-column: 1 / -1;
  }
  .setup,
  .info-grid {
    grid-template-columns: 1fr;
  }
  .tower-game {
    grid-template-columns: 1fr;
  }
  .tower-game__side {
    position: static;
  }
  /* Torre vira faixa horizontal 1 → 10 */
  .tower {
    padding: 10px 12px;
  }
  .tower__top {
    display: none;
  }
  .tower__floors {
    flex-direction: row-reverse;
    justify-content: flex-end;
    overflow-x: auto;
    margin: 0 0 10px;
    padding: 4px;
    scrollbar-width: thin;
  }
  .tower__floor {
    grid-template-columns: auto;
    justify-items: center;
    flex: none;
    min-width: 46px;
    padding: 6px;
    gap: 2px;
  }
  .tower__info {
    display: none;
  }
  .tower__status {
    min-height: 18px;
  }
}

@media (max-width: 720px) {
  .screen {
    padding: 32px 16px 56px;
  }
  .panel,
  .sheet {
    padding: 18px;
  }
  .menu {
    gap: 40px;
  }
  .bento__core {
    min-height: 0;
  }
  .quick {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  .difficulty {
    grid-template-columns: 1fr;
  }
  .players-form {
    grid-template-columns: 1fr;
  }
  .players-form__vs {
    padding: 0;
    text-align: center;
  }
  .arena {
    grid-template-columns: 1fr;
  }
  .arena__vs {
    justify-self: center;
  }
  .arena--online .player-panel--remote {
    order: 3;
    padding: 12px 14px;
  }
  .arena--online .arena__vs {
    display: none;
  }
  .scoreboard {
    grid-template-columns: 1fr 1fr;
  }
  .scoreboard__center {
    grid-column: 1 / -1;
    grid-row: 1;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    width: 100%;
  }
  .pboard {
    padding: 10px 12px;
  }
  .pboard__name {
    font-size: var(--step-0);
    gap: 6px;
    overflow-wrap: normal;
    word-break: break-word;
  }
  .hud {
    gap: 12px 20px;
  }
  .hud__timer {
    margin-left: 0;
    flex: 1 1 100%;
    order: 10;
  }
  .timer {
    min-width: 0;
  }
  .tutorial {
    grid-template-columns: 1fr;
  }
  .bars__item {
    grid-template-columns: 1fr auto;
  }
  .bars__track {
    grid-column: 1 / -1;
    grid-row: 2;
  }
  .learn {
    grid-template-columns: 1fr;
  }
  .online-choices {
    grid-template-columns: 1fr;
  }
  .matrix__cell {
    font-size: 1.15rem;
  }
  .expr {
    gap: 10px 14px;
  }
  .expr__op {
    font-size: 1.5rem;
  }
  .feedback__title {
    font-size: var(--step-3);
  }
  .feedback__action,
  .setup__main > .btn,
  .online-choice > .btn,
  .mode-pane > .btn {
    justify-self: stretch;
  }
  .end-screen__actions .btn,
  .hero__actions .btn {
    flex: 1 1 100%;
  }
  .field-caption {
    display: none;
  }
}

@media (max-width: 380px) {
  .cell-input,
  .player-panel .cell-input {
    width: 2.9rem;
    height: 2.8rem;
    font-size: 1.05rem;
  }
  .matrix--input .matrix__grid {
    gap: 6px;
  }
}
