/* Sinalero — design tokens ------------------------------------------------ */
:root {
  --bg: #f4f1ea;
  --bg-glow: #e7ecff;
  --surface: #fffdf8;
  --surface-2: #f7f4ec;
  --ink: #121720;
  --ink-2: #394253;
  --muted: #6d7686;
  --line: #e3ded1;
  --line-2: #d2cab8;
  --accent: #1b4dff;
  --accent-hover: #0f3ee0;
  --accent-ink: #ffffff;
  --accent-soft: #e7ecff;
  --ok: #0b8f62;
  --ok-soft: #e3f6ee;
  --bad: #c4432b;
  --bad-soft: #fbe9e5;
  --stage: #0b0e14;
  --radius: 20px;
  --shadow: 0 1px 2px rgba(18, 23, 32, 0.04),
    0 14px 36px -14px rgba(18, 23, 32, 0.22);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0f14;
    --bg-glow: #131f45;
    --surface: #131821;
    --surface-2: #171d27;
    --ink: #f2f5f9;
    --ink-2: #c4cbd6;
    --muted: #8f9aac;
    --line: #242b37;
    --line-2: #36404f;
    --accent: #6c8cff;
    --accent-hover: #8aa3ff;
    --accent-ink: #0b0e14;
    --accent-soft: #1a2445;
    --ok: #45d6a0;
    --ok-soft: #0f2b23;
    --bad: #ff7a66;
    --bad-soft: #2c1715;
    --stage: #05070b;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35),
      0 18px 44px -18px rgba(0, 0, 0, 0.75);
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  line-height: 1.5;
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 50% -8%, var(--bg-glow), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img,
video,
svg {
  max-width: 100%;
}

button,
input {
  font: inherit;
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent);
  outline-offset: 2px;
}

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

.skip {
  position: absolute;
  left: -999px;
  top: 0.5rem;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--ink);
  color: var(--bg);
  border-radius: 0.6rem;
  text-decoration: none;
  font-weight: 600;
}

.skip:focus {
  left: 1rem;
}

[hidden] {
  display: none !important;
}

/* Layout ------------------------------------------------------------------ */
.shell {
  flex: 1;
  width: min(100% - 2rem, 680px);
  margin: 0 auto;
  padding: 0.5rem 0 2.5rem;
}

.top {
  width: min(100% - 2rem, 680px);
  margin: 0 auto;
  padding: 1.1rem 0 0.6rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--ink);
  text-decoration: none;
  font-size: 1.22rem;
  font-weight: 780;
  letter-spacing: -0.045em;
}

.brand__mark {
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 0.48rem;
  box-shadow: 0 6px 14px -6px rgba(27, 77, 255, 0.65);
}

.top__nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.86rem;
  color: var(--muted);
}

.top__nav a {
  color: inherit;
  text-decoration: none;
}

.top__nav a:hover {
  color: var(--ink);
}

.streak {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

/* Typography helpers ------------------------------------------------------ */
.eyebrow {
  margin: 0;
  font-size: 0.7rem;
  font-weight: 680;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.daily-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin: 0.6rem 0 1rem;
}

.daily-title {
  margin: 0.18rem 0 0;
  font-size: clamp(1.65rem, 6vw, 2.1rem);
  font-weight: 800;
  letter-spacing: -0.05em;
  line-height: 1.05;
}

.daily-title span {
  color: var(--muted);
  font-weight: 620;
  font-variant-numeric: tabular-nums;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.72rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 0.78rem;
  font-weight: 620;
  white-space: nowrap;
}

.micro {
  margin: 0.85rem 0 0;
  font-size: 0.76rem;
  color: var(--muted);
}

.micro--center {
  text-align: center;
  margin-top: 1rem;
}

.micro a,
.prose a {
  color: var(--accent);
  text-underline-offset: 0.18em;
}

/* Buttons ----------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 3rem;
  padding: 0.7rem 1.1rem;
  border-radius: 0.9rem;
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 0.94rem;
  font-weight: 680;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease,
    transform 0.08s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: translateY(1px);
}

.btn--primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.btn--primary:hover {
  background: var(--accent-hover);
}

.btn--ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-2);
}

.btn--ghost:hover {
  background: var(--surface-2);
}

/* Inside .prose, generic link colors would beat the button color. */
.prose .btn--primary {
  color: var(--accent-ink);
}

.prose .btn--ghost {
  color: var(--ink);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Game -------------------------------------------------------------------- */
.game {
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 6px);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.stage {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: var(--radius);
  background:
    radial-gradient(85% 80% at 50% 32%, #1a2233 0%, #090c12 72%),
    var(--stage);
}

.stage__video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: transparent;
}

.stage__hud {
  position: absolute;
  inset: 0.7rem 0.7rem auto;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  pointer-events: none;
}

.stage__badge {
  padding: 0.27rem 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 999px;
  background: rgba(8, 11, 17, 0.64);
  color: #e9edf7;
  font-size: 0.74rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  backdrop-filter: blur(8px);
}

.stage__play {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 4.5rem;
  height: 4.5rem;
  border: 0;
  border-radius: 50%;
  background: #ffffff;
  color: var(--accent);
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 14px 38px -10px rgba(4, 8, 20, 0.65),
    0 0 0 1px rgba(8, 11, 17, 0.05);
  transition: transform 0.16s ease, opacity 0.18s ease, visibility 0.18s ease;
}

.stage__play svg {
  width: 1.85rem;
  height: 1.85rem;
  margin-left: 0.2rem;
  fill: currentColor;
}

.stage__play .icon-replay {
  display: none;
  margin-left: 0;
}

.stage__play.is-compact {
  inset: auto 0.7rem 0.85rem auto;
  width: 3rem;
  height: 3rem;
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(8, 11, 17, 0.78);
  color: #ffffff;
  box-shadow: 0 8px 22px -8px rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
}

.stage__play.is-compact svg {
  width: 1.3rem;
  height: 1.3rem;
}

.stage__play.is-compact .icon-play {
  display: none;
}

.stage__play.is-compact .icon-replay {
  display: block;
}

.stage__play:hover {
  transform: scale(1.06);
}

.stage__play.is-hidden {
  opacity: 0;
  visibility: hidden;
  transform: scale(0.9);
}

.stage__hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 1.35rem;
  margin: 0;
  color: #dfe6f5;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  text-align: center;
  opacity: 0.78;
  pointer-events: none;
  text-shadow: 0 1px 8px rgba(4, 8, 20, 0.55);
  transition: opacity 0.2s ease;
}

.stage__hint.is-hidden {
  opacity: 0;
}

.stage__progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.18);
}

.stage__progress span {
  display: block;
  width: 0;
  height: 100%;
  background: rgba(255, 255, 255, 0.94);
  transition: width 0.1s linear;
}

.meter {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 0.35rem;
  height: 2.15rem;
  margin-top: 0.9rem;
}

.meter__bar {
  width: 13%;
  max-width: 2.6rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  background: var(--surface-2);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.meter__bar--1 { height: 20%; }
.meter__bar--2 { height: 34%; }
.meter__bar--3 { height: 50%; }
.meter__bar--4 { height: 68%; }
.meter__bar--5 { height: 84%; }
.meter__bar--6 { height: 100%; }

.meter__bar.is-on {
  background: var(--accent);
  border-color: var(--accent);
}

.meter__caption {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  margin: 0.5rem 0.1rem 0;
  color: var(--muted);
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
}

.meter__caption b {
  color: var(--ink);
  font-weight: 680;
}

.guess {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.guess__input {
  flex: 1;
  min-width: 0;
  height: 3.2rem;
  padding: 0 1rem;
  border: 1px solid var(--line-2);
  border-radius: 0.9rem;
  background: var(--surface);
  color: var(--ink);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.guess__input::placeholder {
  color: var(--muted);
}

.guess__input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.guess__input.is-shake {
  animation: shake 0.35s ease;
  border-color: var(--bad);
}

.guess__btn {
  height: 3.2rem;
  padding-inline: 1.25rem;
}

@keyframes shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-3px); }
  40%, 60% { transform: translateX(3px); }
}

.error {
  min-height: 1.2rem;
  margin: 0.55rem 0.1rem 0;
  color: var(--bad);
  font-size: 0.84rem;
  font-weight: 560;
}

.guesses {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
}

.guesses:empty {
  display: none;
}

.guesses li {
  padding: 0.3rem 0.62rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 0.81rem;
}

/* Result ------------------------------------------------------------------ */
.result {
  position: relative;
  overflow: hidden;
  padding: 1.15rem;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 6px);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.result::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: var(--ok);
}

.result--loss::before {
  background: var(--bad);
}

.result__intro {
  padding: 0.35rem 0 0.2rem;
  text-align: center;
}

.result__title {
  margin: 0.25rem 0 0.1rem;
  font-size: 1.45rem;
  font-weight: 720;
  letter-spacing: -0.04em;
}

.result__answer {
  margin: 0.15rem 0 0;
  font-size: clamp(1.9rem, 8vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.05em;
  line-height: 1.1;
  color: var(--ink);
}

.result--win .result__answer {
  color: var(--ok);
}

.result__sub {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.89rem;
}

.result__video-wrap {
  margin: 0.95rem 0 0.2rem;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--stage);
}

.result__video {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
}

.panel {
  margin-top: 1rem;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--surface-2);
}

.panel__head {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
  color: var(--muted);
  font-size: 0.77rem;
}

.panel__head span:first-child {
  color: var(--ink);
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.panel__foot {
  margin: 0.6rem 0 0;
  color: var(--muted);
  font-size: 0.77rem;
}

.panel__foot b {
  color: var(--ink);
}

.bars {
  display: flex;
  flex-direction: column;
  gap: 0.32rem;
}

.bars--large {
  gap: 0.45rem;
  margin: 0.9rem 0;
}

.bars__row {
  display: grid;
  grid-template-columns: 1rem minmax(0, 1fr) 2rem;
  align-items: center;
  gap: 0.55rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.bars__track {
  display: block;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}

.bars__fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  opacity: 0.55;
  transition: width 0.35s ease;
}

.bars__row.is-mine .bars__fill {
  background: var(--ok);
  opacity: 1;
}

.bars__row.is-mine .bars__count {
  color: var(--ink);
  font-weight: 700;
}

.bars__count {
  text-align: right;
}

.result__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 1rem;
}

.result__actions .btn {
  flex: 1 1 10rem;
}

.next-day {
  margin: 1.1rem 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  text-align: center;
}

/* Practice categories ----------------------------------------------------- */
.cats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 0.9rem;
  padding-bottom: 0.35rem;
  scrollbar-width: none;
}

.cats::-webkit-scrollbar {
  display: none;
}

.cat {
  flex: 0 0 auto;
  padding: 0.4rem 0.72rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.79rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.cat:hover {
  color: var(--ink);
}

.cat.is-active {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--bg);
}

/* Prose pages ------------------------------------------------------------- */
.prose {
  max-width: 42rem;
  margin: 0 auto;
  padding-top: 0.6rem;
}

.prose--wide {
  max-width: 46rem;
}

.prose--center {
  text-align: center;
}

.prose h1 {
  margin: 0.2rem 0 0.85rem;
  font-size: clamp(1.7rem, 5vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1.12;
}

.prose h2 {
  margin: 1.9rem 0 0.5rem;
  font-size: 1.14rem;
  font-weight: 720;
  letter-spacing: -0.02em;
}

.prose p,
.prose li,
.prose dd {
  color: var(--ink-2);
}

.lead {
  font-size: 1.04rem;
  color: var(--ink-2);
}

.steps {
  display: grid;
  gap: 0.8rem;
  margin: 1.3rem 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  position: relative;
  padding: 0.95rem 1rem 0.95rem 3.25rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--surface);
}

.steps li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0.9rem;
  top: 0.95rem;
  display: grid;
  place-items: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 0.78rem;
  font-weight: 700;
}

.steps strong {
  display: block;
  margin-bottom: 0.15rem;
  color: var(--ink);
}

.callout {
  margin: 1.25rem 0;
  padding: 1rem 1.1rem;
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  border-radius: 1rem;
  background: var(--accent-soft);
  color: var(--ink-2);
}

.callout strong {
  color: var(--ink);
}

.faq dt {
  margin-top: 1.05rem;
  font-weight: 700;
  color: var(--ink);
}

.faq dd {
  margin: 0.3rem 0 0;
}

.cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.7rem;
}

.link-list {
  padding-left: 1.1rem;
}

.link-list li {
  margin: 0.35rem 0;
}

.stat-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  margin: 1.1rem 0 1.5rem;
}

.stat-card {
  padding: 0.9rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--surface);
  text-align: center;
}

.stat-card__value {
  display: block;
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.stat-card__label {
  font-size: 0.72rem;
  color: var(--muted);
}

.empty {
  color: var(--muted);
}

/* Footer ------------------------------------------------------------------ */
.foot {
  width: min(100% - 2rem, 680px);
  margin: 0 auto;
  padding: 1.2rem 0 2rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.77rem;
}

.foot__links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 0 0 0.55rem;
}

.foot a {
  color: inherit;
}

.foot a:hover {
  color: var(--ink);
}

.foot__note {
  margin: 0;
  line-height: 1.5;
}

/* Toast ------------------------------------------------------------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 1.2rem;
  z-index: 60;
  padding: 0.6rem 1rem;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-size: 0.85rem;
  font-weight: 620;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 0.8rem);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Bar widths — static classes keep the CSP free of inline styles ---------- */
.w-0 { width: 0%; }
.w-5 { width: 5%; }
.w-10 { width: 10%; }
.w-15 { width: 15%; }
.w-20 { width: 20%; }
.w-25 { width: 25%; }
.w-30 { width: 30%; }
.w-35 { width: 35%; }
.w-40 { width: 40%; }
.w-45 { width: 45%; }
.w-50 { width: 50%; }
.w-55 { width: 55%; }
.w-60 { width: 60%; }
.w-65 { width: 65%; }
.w-70 { width: 70%; }
.w-75 { width: 75%; }
.w-80 { width: 80%; }
.w-85 { width: 85%; }
.w-90 { width: 90%; }
.w-95 { width: 95%; }
.w-100 { width: 100%; }

/* Responsive -------------------------------------------------------------- */
@media (max-width: 640px) {
  .cats {
    flex-wrap: nowrap;
    overflow-x: auto;
  }
}

@media (max-width: 430px) {
  .guess {
    flex-direction: column;
  }

  .guess__btn {
    width: 100%;
  }

  .daily-head {
    align-items: flex-start;
  }

  .daily-head .chip {
    margin-top: 0.55rem;
  }

  .meter__caption {
    font-size: 0.71rem;
  }

  .stat-card__value {
    font-size: 1.4rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}