@charset "UTF-8";

/* ==========================================================================
   TakhtNardRank — design system
   A walnut board, cream inlay and a single brass accent. Surfaces are flat,
   separated by hairlines and one real shadow level; the wood texture does the
   decorative work so nothing else has to.
   ========================================================================== */

/* ------------------------------------------------------------------ fonts */
@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-400.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-500.woff2') format('woff2');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-700.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-900.woff2') format('woff2');
  font-weight: 900;
  font-display: swap;
}

/* ------------------------------------------------------------------ tokens */
:root {
  --ink-900: #150e08;
  --ink-800: #1e1610;
  --ink-700: #2a1e15;
  --ink-600: #3a2a1d;

  --wood-700: #4a3020;
  --wood-600: #6b4326;
  --wood-500: #855633;

  --cream-050: #fdfaf4;
  --cream-100: #f6efe3;
  --cream-200: #ece0cb;
  --cream-300: #ddcdb0;

  --sand-400: #b9a37f;
  --sand-500: #8d7a5e;

  --brass-300: #e6c477;
  --brass-400: #d1a63f;
  --brass-500: #a8802f;

  --win-500: #2f6b4f;
  --win-100: #e2efe7;
  --loss-500: #a3402f;
  --loss-100: #f7e4df;

  --text-strong: #211710;
  --text: #3d3025;
  --text-muted: #6f5f4d;
  --text-invert: #f7f1e6;
  --text-invert-muted: #bda98c;

  --line: #e0d4bd;
  --line-strong: #cdbb9c;
  --line-dark: rgba(230, 196, 119, 0.18);

  --surface: #fffdf8;
  --surface-alt: #f7f1e4;
  --surface-dark: var(--ink-800);

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;

  --shadow: 0 1px 2px rgba(33, 23, 16, 0.05), 0 8px 24px -12px rgba(33, 23, 16, 0.22);
  --shadow-lift: 0 2px 4px rgba(33, 23, 16, 0.07), 0 20px 44px -20px rgba(33, 23, 16, 0.35);

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4.5rem;

  --container: 1180px;
  --header-h: 68px;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

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

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

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

/* Any component that sets `display` would otherwise beat the [hidden]
   attribute, so make hiding win outright. */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: 'Vazirmatn', 'Segoe UI', Tahoma, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.85;
  color: var(--text);
  background: var(--cream-100);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  margin: 0 0 var(--space-3);
  color: var(--text-strong);
  line-height: 1.35;
  font-weight: 900;
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(1.9rem, 1.2rem + 2.6vw, 3.1rem); }
h2 { font-size: clamp(1.5rem, 1.1rem + 1.5vw, 2.15rem); }
h3 { font-size: clamp(1.15rem, 1rem + 0.6vw, 1.4rem); }

p { margin: 0 0 var(--space-4); }

a {
  color: var(--wood-600);
  text-decoration: none;
  transition: color 0.18s var(--ease);
}
a:hover { color: var(--brass-500); }

img { max-width: 100%; height: auto; display: block; }

ul, ol { padding-inline-start: 1.4rem; margin: 0 0 var(--space-4); }
li { margin-bottom: var(--space-2); }

hr { border: 0; border-top: 1px solid var(--line); margin: var(--space-6) 0; }

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

.skip-link {
  position: absolute;
  inset-inline-start: 1rem;
  top: -100px;
  z-index: 999;
  background: var(--ink-900);
  color: var(--text-invert);
  padding: 0.7rem 1.2rem;
  border-radius: var(--radius-sm);
  transition: top 0.2s var(--ease);
}
.skip-link:focus { top: 1rem; color: var(--text-invert); }

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

/* --------------------------------------------------------------- utilities */
.container {
  width: min(100% - 2rem, var(--container));
  margin-inline: auto;
}

.section { padding-block: var(--space-8); }
.section--tight { padding-block: var(--space-7); }

.section-head { margin-bottom: var(--space-6); max-width: 60ch; }
.section-head p { color: var(--text-muted); margin-bottom: 0; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--brass-500);
  margin-bottom: var(--space-3);
}
.eyebrow::before {
  content: '';
  width: 24px;
  height: 2px;
  background: var(--brass-400);
  border-radius: 2px;
}

.num { font-variant-numeric: tabular-nums; }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }

/* ----------------------------------------------------------------- buttons */
.btn {
  --btn-bg: var(--wood-600);
  --btn-fg: var(--cream-050);
  --btn-border: var(--wood-600);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 48px;
  padding: 0.7rem 1.6rem;
  border: 1px solid var(--btn-border);
  border-radius: var(--radius-sm);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s var(--ease), background-color 0.18s var(--ease), border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
  text-align: center;
}
.btn:hover { color: var(--btn-fg); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); }
.btn[disabled],
.btn[aria-disabled='true'] { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

.btn--primary {
  --btn-bg: var(--brass-400);
  --btn-fg: #2b1f0b;
  --btn-border: var(--brass-500);
}
.btn--primary:hover { --btn-bg: var(--brass-300); }

.btn--ghost {
  --btn-bg: transparent;
  --btn-fg: var(--text-strong);
  --btn-border: var(--line-strong);
}
.btn--ghost:hover { --btn-bg: var(--surface-alt); }

.btn--onDark {
  --btn-bg: transparent;
  --btn-fg: var(--cream-100);
  --btn-border: rgba(246, 239, 227, 0.35);
}
.btn--onDark:hover { --btn-bg: rgba(246, 239, 227, 0.1); }

.btn--danger {
  --btn-bg: transparent;
  --btn-fg: var(--loss-500);
  --btn-border: rgba(163, 64, 47, 0.4);
}
.btn--danger:hover { --btn-bg: var(--loss-100); }

.btn--block { width: 100%; }
.btn--lg { min-height: 56px; font-size: 1.05rem; padding-inline: 2rem; }
.btn--sm { min-height: 38px; padding: 0.3rem 0.9rem; font-size: 0.86rem; }

/* ------------------------------------------------------------------ header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(21, 14, 8, 0.96);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--line-dark);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  min-height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--cream-100);
  font-weight: 900;
  font-size: 1.08rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand:hover { color: var(--brass-300); }
.brand img { width: 32px; height: 32px; border-radius: 8px; }
.brand span small {
  display: block;
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: var(--sand-500);
  line-height: 1;
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  margin-inline-start: auto;
}
.nav a {
  color: var(--cream-200);
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.94rem;
  font-weight: 500;
  white-space: nowrap;
}
.nav a:hover { background: rgba(246, 239, 227, 0.08); color: var(--cream-050); }
.nav a[aria-current='page'] { color: var(--brass-300); }

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-user {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--line-dark);
  border-radius: 999px;
  color: var(--cream-100);
  font-size: 0.86rem;
}
.header-user strong { font-weight: 700; }
.header-user .rank-chip {
  color: var(--brass-300);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.nav-toggle {
  display: none;
  width: 44px; height: 44px;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--line-dark);
  border-radius: var(--radius-sm);
  color: var(--cream-100);
  cursor: pointer;
  margin-inline-start: auto;
}
.nav-toggle svg { width: 22px; height: 22px; }

@media (max-width: 940px) {
  .nav-toggle { display: inline-flex; }
  .nav,
  .header-actions {
    display: none;
    width: 100%;
  }
  .site-header__inner { flex-wrap: wrap; padding-block: 0.6rem; }
  .site-header.is-open .nav,
  .site-header.is-open .header-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.15rem;
    padding-bottom: 0.6rem;
    margin-inline-start: 0;
  }
  .site-header.is-open .nav a { padding: 0.75rem 0.9rem; }
  .site-header.is-open .header-actions { gap: 0.5rem; padding-top: 0.5rem; border-top: 1px solid var(--line-dark); }
  .site-header.is-open .header-user { justify-content: center; }
}

/* -------------------------------------------------------------------- hero */
.hero {
  position: relative;
  background: var(--ink-900);
  color: var(--text-invert);
  overflow: hidden;
  isolation: isolate;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url('../img/wood-texture.webp');
  background-size: 420px;
  opacity: 0.14;
  z-index: -2;
}
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 90% at 78% 12%, rgba(209, 166, 63, 0.18), transparent 62%);
  z-index: -1;
}

.hero__inner {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: var(--space-7);
  align-items: center;
  padding-block: clamp(2.5rem, 1rem + 6vw, 5rem);
}

.hero h1 { color: var(--cream-050); margin-bottom: var(--space-4); }
.hero__lead {
  font-size: clamp(1rem, 0.95rem + 0.35vw, 1.16rem);
  color: var(--text-invert-muted);
  max-width: 46ch;
  margin-bottom: var(--space-5);
}

.hero__cta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--line-dark);
}
.hero__meta div strong {
  display: block;
  font-size: 1.35rem;
  font-weight: 900;
  color: var(--cream-050);
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}
.hero__meta div span { font-size: 0.85rem; color: var(--text-invert-muted); }

.hero__board {
  position: relative;
  filter: drop-shadow(0 28px 44px rgba(0, 0, 0, 0.55));
}
.hero__board img { border-radius: 6px; }

.prize-banner {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  flex-wrap: wrap;
  padding: 0.85rem 1.2rem;
  margin-bottom: var(--space-5);
  border: 1px solid rgba(209, 166, 63, 0.4);
  border-inline-start-width: 4px;
  border-radius: var(--radius-sm);
  background: rgba(209, 166, 63, 0.08);
}
.prize-banner b {
  font-size: clamp(1.35rem, 1rem + 1.6vw, 2rem);
  font-weight: 900;
  color: var(--brass-300);
  font-variant-numeric: tabular-nums;
}
.prize-banner span { color: var(--text-invert-muted); font-size: 0.92rem; }

@media (max-width: 900px) {
  .hero__inner { grid-template-columns: 1fr; gap: var(--space-5); }
  .hero__board { order: -1; max-width: 460px; margin-inline: auto; }
}

/* -------------------------------------------------------------- countdown */
.countdown {
  display: flex;
  gap: 0.5rem;
  margin-bottom: var(--space-5);
}
.countdown__unit {
  min-width: 62px;
  padding: 0.5rem 0.4rem;
  text-align: center;
  border: 1px solid var(--line-dark);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.22);
}
.countdown__unit b {
  display: block;
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--cream-050);
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}
.countdown__unit span { font-size: 0.7rem; color: var(--text-invert-muted); }
.countdown--light .countdown__unit { background: var(--surface); border-color: var(--line); }
.countdown--light .countdown__unit b { color: var(--text-strong); }
.countdown--light .countdown__unit span { color: var(--text-muted); }

/* ------------------------------------------------------------------ cards */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-5);
  box-shadow: var(--shadow);
}
.card--flat { box-shadow: none; }
.card h3 { margin-bottom: var(--space-2); }

.grid { display: grid; gap: var(--space-4); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

/* ------------------------------------------------------------------ prizes */
.prizes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
  align-items: end;
}
.prize {
  position: relative;
  padding: var(--space-5) var(--space-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-align: center;
  box-shadow: var(--shadow);
}
.prize__rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px; height: 46px;
  margin-bottom: var(--space-3);
  border-radius: 50%;
  font-weight: 900;
  font-size: 1.15rem;
  color: var(--ink-900);
  background: var(--cream-200);
  border: 2px solid var(--line-strong);
  font-variant-numeric: tabular-nums;
}
.prize__amount {
  display: block;
  font-size: clamp(1.2rem, 0.9rem + 1vw, 1.6rem);
  font-weight: 900;
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
}
.prize__label { font-size: 0.9rem; color: var(--text-muted); }

.prize--first {
  padding-block: var(--space-6);
  border-color: var(--brass-400);
  box-shadow: var(--shadow-lift);
}
.prize--first .prize__rank { background: var(--brass-300); border-color: var(--brass-500); }
.prize--first .prize__amount { color: var(--brass-500); }
.prize--second .prize__rank { background: #e3e0d8; border-color: #c2bcae; }
.prize--third .prize__rank { background: #e5cdb4; border-color: #c69f78; }

@media (max-width: 760px) {
  .prizes { grid-template-columns: 1fr; }
  .prize--first { order: -1; }
}

/* ------------------------------------------------------------------ steps */
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: var(--space-4);
  counter-reset: step;
}
.step {
  position: relative;
  padding: var(--space-5) var(--space-4) var(--space-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.step::before {
  counter-increment: step;
  content: counter(step, persian);
  position: absolute;
  top: -16px;
  inset-inline-start: var(--space-4);
  width: 34px; height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ink-800);
  color: var(--brass-300);
  font-weight: 900;
  font-size: 0.95rem;
}
.step h3 { font-size: 1.05rem; margin-bottom: var(--space-1); }
.step p { margin: 0; font-size: 0.92rem; color: var(--text-muted); }

/* ------------------------------------------------------------ leaderboard */
.board-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table.board {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}
table.board th,
table.board td {
  padding: 0.85rem 1rem;
  text-align: start;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
table.board thead th {
  background: var(--surface-alt);
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.01em;
  border-bottom: 1px solid var(--line-strong);
  position: sticky;
  top: 0;
  z-index: 1;
}
table.board tbody tr:last-child td { border-bottom: 0; }
table.board tbody tr:hover { background: var(--surface-alt); }
table.board td.player { font-weight: 700; color: var(--text-strong); white-space: normal; }
table.board td.score { font-weight: 900; color: var(--text-strong); }

.rank-badge {
  display: inline-grid;
  place-items: center;
  min-width: 34px; height: 34px;
  padding-inline: 0.4rem;
  border-radius: 10px;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  font-weight: 900;
  font-size: 0.92rem;
  color: var(--text-strong);
}
tr.rank-1 .rank-badge { background: var(--brass-300); border-color: var(--brass-500); }
tr.rank-2 .rank-badge { background: #e6e3db; border-color: #c2bcae; }
tr.rank-3 .rank-badge { background: #e9d3bb; border-color: #c69f78; }
tr.is-me { background: rgba(209, 166, 63, 0.12) !important; }
tr.is-me td:first-child { box-shadow: inset 3px 0 0 var(--brass-400); }

.board-empty {
  padding: var(--space-7) var(--space-5);
  text-align: center;
  color: var(--text-muted);
}
.board-empty strong { display: block; color: var(--text-strong); font-size: 1.1rem; margin-bottom: var(--space-2); }

.board-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4);
  border-bottom: 1px solid var(--line);
  background: var(--surface-alt);
}
.board-toolbar form { display: flex; gap: 0.5rem; }

.live-dot {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.84rem;
  color: var(--text-muted);
}
.live-dot::before {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--win-500);
  animation: pulse 2.4s var(--ease) infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* podium */
.podium {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
  align-items: end;
  margin-bottom: var(--space-5);
}
.podium__item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-4) var(--space-3);
  text-align: center;
  box-shadow: var(--shadow);
}
.podium__item[data-place='1'] { padding-block: var(--space-6); border-color: var(--brass-400); }
.podium__place {
  display: inline-grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--cream-200);
  font-weight: 900;
  margin-bottom: var(--space-2);
}
.podium__item[data-place='1'] .podium__place { background: var(--brass-300); }
.podium__item[data-place='2'] .podium__place { background: #e6e3db; }
.podium__item[data-place='3'] .podium__place { background: #e9d3bb; }
.podium__name { font-weight: 700; color: var(--text-strong); word-break: break-word; }
.podium__score { font-size: 1.25rem; font-weight: 900; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.podium__meta { font-size: 0.8rem; color: var(--text-muted); }

@media (max-width: 620px) {
  .podium { grid-template-columns: 1fr; }
  .podium__item[data-place='1'] { order: -1; }
}

/* sticky personal rank */
.my-rank {
  position: sticky;
  bottom: 0;
  z-index: 30;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4);
  margin-top: var(--space-4);
  padding: var(--space-4);
  background: var(--ink-800);
  color: var(--text-invert);
  border: 1px solid var(--line-dark);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
}
.my-rank strong { color: var(--brass-300); font-variant-numeric: tabular-nums; }
.my-rank .my-rank__label { font-size: 0.85rem; color: var(--text-invert-muted); display: block; }
.my-rank > div { min-width: 90px; }
.my-rank .btn { margin-inline-start: auto; }

/* ------------------------------------------------------------- fair play */
.fairplay {
  background: var(--ink-800);
  color: var(--text-invert);
  position: relative;
  overflow: hidden;
}
.fairplay::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url('../img/wood-dark.webp');
  background-size: 380px;
  opacity: 0.12;
}
.fairplay .container { position: relative; }
.fairplay h2 { color: var(--cream-050); }
.fairplay__lead { color: var(--text-invert-muted); max-width: 62ch; }
.fair-list { list-style: none; padding: 0; display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.fair-list li {
  position: relative;
  padding: var(--space-4);
  padding-inline-start: 3rem;
  background: rgba(255, 253, 248, 0.05);
  border: 1px solid var(--line-dark);
  border-radius: var(--radius-sm);
  color: var(--cream-200);
  font-size: 0.94rem;
  margin: 0;
}
.fair-list li::before {
  content: '✓';
  position: absolute;
  inset-inline-start: var(--space-4);
  top: var(--space-4);
  width: 22px; height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--brass-400);
  color: var(--ink-900);
  font-size: 0.8rem;
  font-weight: 900;
  line-height: 1;
}

/* --------------------------------------------------------------------- faq */
.faq details {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-3);
  overflow: hidden;
}
.faq summary {
  padding: var(--space-4);
  font-weight: 700;
  color: var(--text-strong);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: '+';
  font-size: 1.4rem;
  font-weight: 400;
  color: var(--brass-500);
  transition: transform 0.2s var(--ease);
}
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details > div { padding: 0 var(--space-4) var(--space-4); color: var(--text-muted); }

/* ------------------------------------------------------------------ forms */
.form-page {
  display: grid;
  place-items: center;
  min-height: calc(100vh - var(--header-h) - 300px);
  padding-block: var(--space-7);
}
.form-card {
  width: min(100%, 460px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-lift);
}
.form-card--wide { width: min(100%, 680px); }
.form-card h1 { font-size: 1.6rem; margin-bottom: var(--space-2); }
.form-card__lead { color: var(--text-muted); font-size: 0.94rem; margin-bottom: var(--space-5); }

.field { margin-bottom: var(--space-4); }
.field label {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-strong);
  margin-bottom: var(--space-2);
}
.field .hint { font-size: 0.8rem; color: var(--text-muted); margin-top: var(--space-1); }

input[type='text'],
input[type='email'],
input[type='password'],
input[type='search'],
input[type='number'],
input[type='url'],
input[type='datetime-local'],
input[type='date'],
select,
textarea {
  width: 100%;
  min-height: 48px;
  padding: 0.6rem 0.9rem;
  font: inherit;
  font-size: 1rem;   /* keeps iOS from zooming on focus */
  color: var(--text-strong);
  background: var(--cream-050);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
textarea { min-height: 140px; resize: vertical; line-height: 1.8; }
select { appearance: none; background-image: none; }

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--brass-400);
  box-shadow: 0 0 0 3px rgba(209, 166, 63, 0.22);
}
input[aria-invalid='true'],
textarea[aria-invalid='true'] { border-color: var(--loss-500); }

.field-error {
  display: block;
  margin-top: var(--space-1);
  font-size: 0.82rem;
  color: var(--loss-500);
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 0.9rem;
  color: var(--text);
  cursor: pointer;
}
.check input { width: 20px; height: 20px; min-height: 0; margin-top: 3px; accent-color: var(--wood-600); flex: 0 0 auto; }

.form-foot {
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--line);
  font-size: 0.9rem;
  color: var(--text-muted);
  text-align: center;
}

.code-input {
  letter-spacing: 0.7em;
  text-align: center;
  font-size: 1.6rem !important;
  font-weight: 700;
  padding-inline-start: 0.7em;
}

/* ------------------------------------------------------------------ alerts */
.alert {
  display: flex;
  gap: 0.7rem;
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-alt);
  margin-bottom: var(--space-4);
  font-size: 0.93rem;
}
.alert--success { background: var(--win-100); border-color: rgba(47, 107, 79, 0.3); color: #1e4a36; }
.alert--error { background: var(--loss-100); border-color: rgba(163, 64, 47, 0.3); color: #7d2f22; }
.alert--info { background: #eef2f7; border-color: #cdd8e5; color: #34455c; }

/* ------------------------------------------------------------------ badges */
.badge {
  display: inline-block;
  padding: 0.16rem 0.6rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  border: 1px solid var(--line-strong);
  background: var(--surface-alt);
  color: var(--text-muted);
}
.badge--win { background: var(--win-100); border-color: rgba(47, 107, 79, 0.35); color: var(--win-500); }
.badge--loss { background: var(--loss-100); border-color: rgba(163, 64, 47, 0.35); color: var(--loss-500); }
.badge--gold { background: rgba(209, 166, 63, 0.16); border-color: var(--brass-400); color: var(--brass-500); }

/* -------------------------------------------------------------- dashboard */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--space-3); }
.stat {
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.stat b {
  display: block;
  font-size: 1.7rem;
  font-weight: 900;
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
}
.stat span { font-size: 0.85rem; color: var(--text-muted); }
.stat--accent { background: var(--ink-800); border-color: var(--ink-700); }
.stat--accent b { color: var(--brass-300); }
.stat--accent span { color: var(--text-invert-muted); }

.next-target {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px dashed var(--brass-400);
  border-radius: var(--radius);
  background: rgba(209, 166, 63, 0.08);
  color: var(--text-strong);
  font-weight: 700;
}

.history-list { list-style: none; padding: 0; margin: 0; }
.history-list li {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
  margin: 0;
}
.history-list li:last-child { border-bottom: 0; }
.history-list .delta { margin-inline-start: auto; font-weight: 900; font-variant-numeric: tabular-nums; }
.delta--up { color: var(--win-500); }
.delta--down { color: var(--loss-500); }

/* ---------------------------------------------------------------- banners */
.ad-slot { margin-block: var(--space-5); text-align: center; }
.ad-slot a { display: inline-block; max-width: 100%; }
.ad-slot img { border-radius: var(--radius-sm); margin-inline: auto; }
.ad-slot__note {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

.ad-sticky {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 55;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.4rem;
  background: rgba(21, 14, 8, 0.94);
  border-top: 1px solid var(--line-dark);
}
.ad-sticky img { max-height: 60px; width: auto; }
.ad-sticky button {
  background: transparent;
  border: 0;
  color: var(--cream-200);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.2rem 0.5rem;
}

/* ----------------------------------------------------------------- popup */
.popup-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: var(--space-4);
  background: rgba(21, 14, 8, 0.72);
  backdrop-filter: blur(3px);
  animation: fade 0.2s var(--ease);
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.popup {
  position: relative;
  width: min(100%, 460px);
  max-height: 90vh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lift);
  animation: rise 0.26s var(--ease);
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.popup img { border-start-start-radius: var(--radius-lg); border-start-end-radius: var(--radius-lg); }
.popup__body { padding: var(--space-5); }
.popup__body h3 { margin-bottom: var(--space-2); }
.popup__close {
  position: absolute;
  top: 0.6rem;
  inset-inline-end: 0.6rem;
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 0;
  background: rgba(21, 14, 8, 0.6);
  color: #fff;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}
.popup__close:hover { background: rgba(21, 14, 8, 0.85); }

/* ------------------------------------------------------------------ footer */
.site-footer {
  background: var(--ink-900);
  color: var(--text-invert-muted);
  padding-block: var(--space-7) var(--space-5);
  margin-top: var(--space-8);
  border-top: 3px solid var(--brass-500);
}
.site-footer a { color: var(--cream-200); }
.site-footer a:hover { color: var(--brass-300); }
.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--space-5);
  margin-bottom: var(--space-5);
}
.footer-grid h4 { color: var(--cream-100); font-size: 0.95rem; margin-bottom: var(--space-3); }
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li { margin-bottom: var(--space-2); font-size: 0.9rem; }
.footer-brand p { font-size: 0.9rem; max-width: 40ch; }
.footer-bottom {
  padding-top: var(--space-4);
  border-top: 1px solid var(--line-dark);
  font-size: 0.82rem;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  justify-content: space-between;
}

/* ------------------------------------------------------------------- misc */
.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: center;
  padding: var(--space-4);
  list-style: none;
  margin: 0;
}
.pagination li { margin: 0; }
.pagination a,
.pagination span {
  display: grid;
  place-items: center;
  min-width: 40px;
  height: 40px;
  padding-inline: 0.6rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.pagination a:hover { background: var(--surface-alt); }
.pagination .is-current { background: var(--wood-600); border-color: var(--wood-600); color: var(--cream-050); font-weight: 700; }
.pagination .is-disabled { opacity: 0.4; }

.prose { max-width: 74ch; }
.prose h2 { margin-top: var(--space-6); }
.prose h3 { margin-top: var(--space-5); }
.prose ul li::marker { color: var(--brass-500); }

.doc-header {
  background: var(--ink-800);
  color: var(--text-invert);
  padding-block: var(--space-7);
  position: relative;
  overflow: hidden;
}
.doc-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url('../img/wood-dark.webp');
  background-size: 340px;
  opacity: 0.12;
}
.doc-header .container { position: relative; }
.doc-header h1 { color: var(--cream-050); margin-bottom: var(--space-2); }
.doc-header p { color: var(--text-invert-muted); margin: 0; max-width: 62ch; }

.breadcrumb {
  font-size: 0.84rem;
  color: var(--text-invert-muted);
  margin-bottom: var(--space-3);
}
.breadcrumb a { color: var(--cream-200); }
.breadcrumb span { margin-inline: 0.4rem; opacity: 0.5; }

.doc-split {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: var(--space-6);
  align-items: start;
}
@media (max-width: 860px) {
  .doc-split { grid-template-columns: 1fr; }
}

.empty-state {
  text-align: center;
  padding: var(--space-7) var(--space-4);
  color: var(--text-muted);
}
.empty-state strong { display: block; font-size: 1.1rem; color: var(--text-strong); margin-bottom: var(--space-2); }
