/* Tokens de lib/theme.dart. Todo el chrome es neutro; el color lo ponen los
   tipos, la escala de amenaza de los KOs y un único acento lima. */
:root {
  --bg: #0a0c11;
  --surface: #12151c;
  --surface-high: #1a1e27;
  --surface-higher: #242935;
  --border: #222733;
  --border-strong: #333a4a;
  --text: #eef1f6;
  --text-muted: #a7afbc;
  --text-faint: #8b94a3;
  --accent: #d4f84a;
  --on-accent: #0a0c11;
  --rival: #7aa7ff;
  --good: #3ddc97;
  --warn: #ffb547;
  --bad: #ff5c6c;
  --danger: #ff8a5b;
  --caution: #e8d26a;

  --r-tag: 6px;
  --r-small: 10px;
  --r-control: 14px;
  --r-card: 20px;
  --r-sheet: 28px;

  --display: 'Space Grotesk', system-ui, sans-serif;
  --body: 'Inter', system-ui, sans-serif;

  --gutter: 16px;
  --bar-h: 60px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  color-scheme: dark;
}

@font-face {
  font-family: 'Inter';
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/Inter-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/Inter-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/Inter-700.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-weight: 800;
  font-display: swap;
  src: url('/fonts/Inter-800.woff2') format('woff2');
}
@font-face {
  font-family: 'Space Grotesk';
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/SpaceGrotesk-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Space Grotesk';
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/SpaceGrotesk-700.woff2') format('woff2');
}

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

html {
  background: var(--bg);
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--bar-h) + 16px);
  -webkit-text-size-adjust: 100%;
  scrollbar-color: var(--border-strong) var(--bg);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.5 var(--body);
  font-feature-settings: 'cv11', 'ss01';
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: rgba(212, 248, 74, 0.33);
  color: var(--text);
}

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

h1,
h2,
p,
dl,
dd,
ol,
ul {
  margin: 0;
}

h1,
h2 {
  font-family: var(--display);
  font-weight: 700;
  text-wrap: balance;
}

a {
  color: inherit;
}

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

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.nowrap {
  white-space: nowrap;
}

.skip {
  position: absolute;
  left: 16px;
  top: -80px;
  z-index: 20;
  padding: 10px 14px;
  border-radius: var(--r-small);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  text-decoration: none;
}
.skip:focus {
  top: 10px;
}

.icon {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Botones: mismo lenguaje que los de la app (alto 46, radio 14). */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: var(--r-control);
  font: 700 15px/1 var(--body);
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color 160ms var(--ease-out),
    border-color 160ms var(--ease-out),
    transform 160ms var(--ease-out);
}
.btn:active {
  transform: scale(0.98);
}
.btn-accent {
  background: var(--accent);
  color: var(--on-accent);
}
.btn-accent:hover {
  background: #e0ff6e;
}
.btn-ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text);
  font-weight: 600;
}
.btn-ghost:hover {
  background: var(--surface-high);
}
.btn-big {
  min-height: 56px;
  padding: 0 28px;
  font-size: 17px;
  box-shadow: 0 10px 24px -12px rgba(0, 0, 0, 0.9);
}
.btn-small {
  min-height: 36px;
  padding: 0 12px;
  font-size: 13px;
}

.link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.link:hover {
  text-decoration-thickness: 2px;
}

/* Barra fija: marca, reloj del turno y descarga. */
.bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 16px;
  height: var(--bar-h);
  padding: 0 var(--gutter);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  font: 700 17px/1 var(--display);
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}
.mark {
  width: 28px;
  height: 28px;
  flex: none;
}

.turn {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  max-width: 420px;
  margin: 0 auto;
}
.turn-label {
  font: 700 11px/1 var(--body);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  white-space: nowrap;
  transition: color 200ms var(--ease-out);
}
.turn-track {
  position: relative;
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-higher);
  overflow: hidden;
}
.turn-fill {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--accent);
  transform-origin: left center;
  transform: scaleX(var(--left, 1));
}
.turn-clock {
  min-width: 3.2em;
  text-align: right;
  font: 700 15px/1 var(--display);
  font-variant-numeric: tabular-nums;
}
.turn.done .turn-label {
  color: var(--accent);
}

.btn-bar {
  min-height: 40px;
  padding: 0 14px;
  font-size: 14px;
}
.btn-bar .icon {
  width: 18px;
  height: 18px;
}

/* Página */
.layout {
  display: grid;
  gap: 44px;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 20px var(--gutter) 96px;
}

.intro h1 {
  font-size: clamp(27px, 4.2vw + 11px, 54px);
  line-height: 1.04;
  letter-spacing: -0.035em;
  max-width: 22ch;
}
.lead {
  margin-top: 12px;
  max-width: 46ch;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-muted);
}

.get-touch {
  margin-top: 28px;
}
.get-touch .btn-big {
  width: 100%;
  max-width: 380px;
}
/* Segunda vía: la app web (PWA) en /app/. */
.web-inline {
  display: none;
  margin-top: 16px;
  font-size: 15px;
  color: var(--text-muted);
}
.btn-web {
  width: 100%;
  max-width: 380px;
  margin-top: 16px;
}
.meta {
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

.get-qr {
  display: flex;
  gap: 20px;
  align-items: center;
  margin-top: 32px;
  padding: 20px;
  max-width: 460px;
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  background: var(--surface);
}
.qr {
  flex: none;
  width: 148px;
  height: 148px;
  padding: 16px;
  border-radius: var(--r-control);
  background: var(--accent);
}
.qr svg {
  display: block;
  width: 100%;
  height: 100%;
}
.qr-text {
  display: grid;
  gap: 6px;
  font-size: 14px;
  color: var(--text-muted);
}
.qr-title {
  font: 700 18px/1.2 var(--display);
  color: var(--text);
}
.qr-text .link {
  justify-self: start;
  margin-top: 4px;
}

.turn-flow {
  display: grid;
  gap: 72px;
  min-width: 0;
}

.q h2,
.more h2,
.get h2 {
  font-size: clamp(36px, 5vw + 14px, 64px);
  line-height: 1;
  letter-spacing: -0.04em;
}
.q-sub {
  margin-top: 14px;
  max-width: 54ch;
  color: var(--text-muted);
}

/* Calc */
.calc {
  margin-top: 28px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  background: var(--surface);
}
.calc.swap > * {
  animation: swap-in 420ms var(--ease-out) both;
}
.calc.swap > :nth-child(2) {
  animation-delay: 50ms;
}
.calc.swap > :nth-child(3) {
  animation-delay: 90ms;
}
@keyframes swap-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}
.calc.swap .roll {
  animation: roll-in 520ms var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 18ms + 80ms);
}
@keyframes roll-in {
  from {
    transform: scaleY(0);
  }
}

.calc-matchup {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: start;
  gap: 12px;
}
.side {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.side-def {
  justify-items: end;
  text-align: right;
}
.side-def .pills {
  justify-content: flex-end;
}
.side-name {
  font: 700 16px/1.15 var(--display);
  letter-spacing: -0.01em;
}
.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.pill {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: var(--r-tag);
  background: var(--c);
  color: var(--ink);
  font: 800 11px/1 var(--body);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* El movimiento viaja del atacante al defensor por la línea de su tipo. */
.move {
  display: grid;
  gap: 2px;
  max-width: 120px;
  padding-bottom: 10px;
  text-align: center;
  background: linear-gradient(var(--c), var(--c)) center bottom / 100% 2px no-repeat;
}
.move-name {
  font: 700 14px/1.2 var(--body);
  color: color-mix(in srgb, var(--c) 45%, var(--text));
}
.move-meta {
  font-size: 12px;
  color: var(--text-faint);
}

.calc-result {
  display: grid;
  gap: 8px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.pct {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  font: 700 clamp(40px, 7vw + 10px, 60px)/1 var(--display);
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.pct .dash {
  margin: 0 0.06em;
  color: var(--text-faint);
}
.pct .unit {
  margin-left: 0.04em;
  font-size: 0.6em;
  color: var(--text-muted);
}
.ko {
  justify-self: start;
  padding: 5px 10px;
  border-radius: var(--r-small);
  background: color-mix(in srgb, var(--tone) 14%, transparent);
  color: var(--tone);
  font: 800 15px/1.2 var(--body);
  font-variant-numeric: tabular-nums;
}
.ko-rolls {
  font-weight: 600;
}
.dmg {
  font-size: 14px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.tone-bad {
  --tone: var(--bad);
}
.tone-danger {
  --tone: var(--danger);
}
.tone-warn {
  --tone: var(--warn);
}
.tone-caution {
  --tone: var(--caution);
}
.tone-muted {
  --tone: var(--text-muted);
}

/* Los 16 rolls contra la línea de PS. */
.rolls {
  position: relative;
  display: grid;
  grid-template-columns: repeat(16, 1fr);
  align-items: end;
  gap: 3px;
  height: 104px;
  margin-top: 22px;
  padding-top: 20px;
}
.roll {
  height: calc(var(--h) * 100%);
  border-radius: 4px 4px 1px 1px;
  background: var(--surface-higher);
  transform-origin: bottom;
}
.roll.hit {
  background: var(--tone, var(--danger));
}
.hp-line {
  position: absolute;
  left: -4px;
  right: -4px;
  bottom: calc(var(--hp) * (100% - 20px));
  border-top: 2px dashed var(--text-muted);
  pointer-events: none;
}
.hp-line span {
  position: absolute;
  left: 4px;
  bottom: 4px;
  padding: 1px 6px;
  border-radius: var(--r-tag);
  background: var(--surface);
  font: 700 12px/1.4 var(--body);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.factors {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 18px;
  padding: 0;
  list-style: none;
}
.factor {
  padding: 4px 9px;
  border-radius: var(--r-small);
  background: var(--surface-high);
  font: 600 12px/1.3 var(--body);
  color: var(--text-muted);
}
.factor.tone-up {
  color: var(--good);
}
.factor.tone-down {
  color: var(--bad);
}

.summary {
  margin-top: 16px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-faint);
  overflow-wrap: anywhere;
}
.calc-count {
  margin-top: 14px;
  font: 700 11px/1 var(--body);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.btn-next {
  margin-top: 14px;
}

/* Duelo de Speed */
.duel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-areas:
    'a b'
    'field field';
  gap: 12px;
  margin-top: 28px;
}
.duel-side {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  background: var(--surface);
  transition: border-color 200ms var(--ease-out);
}
.side-a {
  grid-area: a;
  --side: var(--accent);
}
.side-b {
  grid-area: b;
  --side: var(--rival);
}
.duel-side.first {
  border-color: color-mix(in srgb, var(--side) 55%, var(--border));
}
.field-label {
  font: 700 11px/1 var(--body);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--side);
}
.select {
  width: 100%;
  min-height: 48px;
  padding: 0 36px 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-control);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a7afbc' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E")
      right 10px center / 18px no-repeat,
    var(--surface-high);
  font-weight: 600;
  font-size: 15px;
  text-overflow: ellipsis;
  appearance: none;
  cursor: pointer;
}
.select:hover {
  border-color: var(--border-strong);
}
.duel-speed {
  font: 700 clamp(44px, 6vw + 16px, 72px)/1 var(--display);
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  transition: color 200ms var(--ease-out);
}
.duel-side.first .duel-speed {
  color: var(--side);
}
.duel-set {
  font-size: 13px;
  line-height: 1.35;
  color: var(--text-faint);
}
.duel-bar {
  display: block;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-higher);
  overflow: hidden;
}
.duel-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--text-faint);
  transform-origin: left center;
  transform: scaleX(var(--w, 0));
  transition:
    transform 420ms var(--ease-out),
    background-color 200ms var(--ease-out);
}
.duel-side.first .duel-bar span {
  background: var(--side);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: transparent;
  font: 600 13px/1 var(--body);
  cursor: pointer;
  transition:
    background-color 160ms var(--ease-out),
    border-color 160ms var(--ease-out),
    color 160ms var(--ease-out);
}
.chip:hover:not(:disabled) {
  background: var(--surface-high);
}
.chip[aria-pressed='true'] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.chip:disabled {
  cursor: default;
  opacity: 0.5;
}

.duel-field {
  grid-area: field;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 16px;
  padding: 14px 16px;
  border-radius: var(--r-card);
  background: var(--surface-high);
}
.duel-verdict {
  flex: 1 1 200px;
  font: 700 18px/1.25 var(--display);
  letter-spacing: -0.01em;
}

/* Entre turnos */
.rows {
  margin-top: 28px;
  border-top: 1px solid var(--border);
}
.row {
  display: grid;
  gap: 6px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}
.row dt {
  font: 700 17px/1.25 var(--display);
}
.row dd {
  max-width: 62ch;
  color: var(--text-muted);
}

/* Fin del turno */
.get-cta {
  margin-top: 28px;
}
.get-cta .btn-big {
  width: 100%;
  max-width: 380px;
}
.steps {
  display: grid;
  gap: 14px;
  margin-top: 32px;
  padding: 0;
  list-style: none;
  counter-reset: step;
}
.steps li {
  position: relative;
  padding-left: 44px;
  min-height: 30px;
  max-width: 58ch;
  color: var(--text-muted);
  counter-increment: step;
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -2px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: var(--r-small);
  background: var(--surface-high);
  font: 700 15px/1 var(--display);
  color: var(--accent);
}
.steps strong {
  color: var(--text);
  font-weight: 700;
}
.note {
  margin-top: 16px;
  max-width: 58ch;
  font-size: 14px;
  color: var(--text-faint);
}
.checksum {
  margin-top: 24px;
  max-width: 640px;
  border: 1px solid var(--border);
  border-radius: var(--r-control);
}
.checksum summary {
  min-height: 48px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}
.checksum-body {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px 16px;
}
.checksum code {
  flex: 1;
  min-width: 0;
  font: 500 12.5px/1.5 ui-monospace, 'SFMono-Regular', Menlo, monospace;
  color: var(--text-faint);
  overflow-wrap: anywhere;
}

.foot {
  display: grid;
  gap: 8px;
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px var(--gutter) 40px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-faint);
}
.foot p {
  max-width: 80ch;
}

/* Móvil estrecho: el reloj pierde la etiqueta antes que la marca. */
@media (max-width: 420px) {
  .bar {
    gap: 12px;
  }
  .brand span {
    display: none;
  }
}

@media (max-width: 719px) {
  .get-touch {
    display: none;
  }
  .web-inline {
    display: block;
  }
  .q h2,
  .more h2,
  .get h2 {
    font-size: 36px;
  }
  .q-sub {
    margin-top: 10px;
  }
  .calc,
  .duel {
    margin-top: 20px;
  }
  .rolls {
    margin-top: 16px;
  }
  .duel {
    gap: 8px;
  }
  .duel-side {
    padding: 12px;
  }
  .chips {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .chip {
    padding: 0 6px;
    font-size: 12px;
  }
  .duel-verdict {
    flex-basis: 100%;
    order: -1;
    font-size: 17px;
  }
}

@media (max-width: 359px) {
  .duel {
    grid-template-columns: 1fr;
    grid-template-areas: 'a' 'b' 'field';
  }
}

@media (min-width: 720px) {
  :root {
    --gutter: 32px;
  }
  .layout {
    padding-top: 64px;
  }
  .calc {
    padding: 28px;
  }
  .calc-matchup {
    gap: 20px;
  }
  .side-name {
    font-size: 18px;
  }
  .move {
    max-width: 180px;
    padding-bottom: 14px;
  }
  .move-name {
    font-size: 16px;
  }
  .move-meta {
    font-size: 13px;
  }
  .rolls {
    height: 132px;
    gap: 5px;
  }
  .duel-side {
    padding: 20px;
  }
  .row {
    grid-template-columns: 200px 1fr;
    gap: 24px;
  }
}

/* Escritorio: la presentación y el QR se quedan fijos a la izquierda y el
   turno corre a la derecha. */
@media (min-width: 1080px) {
  .layout {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: 80px;
    align-items: start;
  }
  .intro {
    position: sticky;
    top: calc(var(--bar-h) + 56px);
  }
  .intro h1 {
    font-size: 46px;
    max-width: none;
  }
  .lead {
    font-size: 17px;
  }
  .turn-flow {
    gap: 96px;
    padding-top: 6px;
  }
}

@media (hover: hover) and (pointer: fine) and (min-width: 1080px) {
  .get-touch {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
