/* League platform design system.
   Brand tokens live in :root. They follow score.snookers.pro (navy with a white cue ball) and are mirrored in
   app/services/theme.py (XLSX export) and mobile/src/lib/theme.ts — update all three together. */

:root {
  --brand: #0f3460;
  --brand-dark: #16213e;
  --brand-soft: #e7edf6;
  --brand-deep: #1a1a2e;
  --brand-fg: #ffffff; /* text on a --brand fill (buttons) */
  --gold: #c9a227;
  --gold-soft: #f6edcc;
  --red: #c0392b;
  --red-soft: #fbe9e7;
  --blue: #1f6feb;
  --blue-soft: #e8f0fe;

  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --ink: #141a2b;
  --ink-2: #4a5470;
  --ink-3: #646e8c;
  --line: #e1e6ef;
  --line-strong: #c9d1e0;

  /* text on the navy surfaces (sidebar, header, hero, footer) */
  --on-brand: #d5dcef;
  --on-brand-2: #c9d2ea;
  --on-brand-muted: #8b96b7;
  --on-brand-label: #8a95bb;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 48, .06), 0 4px 16px rgba(16, 24, 48, .05);
  --sidebar: 248px;
  --font: "Heebo", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --brand: #6f93dc;
    --brand-dark: #131f3d;
    --brand-soft: #141f3a;
    --brand-deep: #080b16;
    --brand-fg: #0b1226;
    --gold: #e0bd4f;
    --gold-soft: #2c2610;
    --red: #ef6b5e;
    --red-soft: #2e1714;
    --blue: #6aa3ff;
    --blue-soft: #14213a;
    --bg: #0b0f1c;
    --surface: #121a2c;
    --surface-2: #172036;
    --ink: #e6eaf4;
    --ink-2: #b4bdd4;
    --ink-3: #8b96b7;
    --line: #232d45;
    --line-strong: #313c58;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--ink); background: var(--bg); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.25; font-weight: 700; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .75rem; }
small, .muted { color: var(--ink-3); }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar { background: var(--brand-dark); color: var(--on-brand); padding: 18px 14px; position: sticky; top: 0; height: 100vh;
  overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; color: #fff; font-weight: 700; }
.brand img { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; background: #fff; }
/* the score.snookers.pro mark: a white cue ball with a navy dot */
.ball { position: relative; border-radius: 50%; flex: none; background: radial-gradient(circle at 35% 30%, #fff, #eef1f7 65%, #c3cbdb);
  box-shadow: inset -2px -3px 5px rgba(15,52,96,.25); }
.ball::after { content: ""; position: absolute; width: 27%; height: 27%; left: 21.5%; top: 21.5%; border-radius: 50%; background: #0f3460; }
.brand .ball { width: 34px; height: 34px; }
.brand small { display: block; color: var(--on-brand-muted); font-weight: 400; font-size: .78rem; }
.nav-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--on-brand-label); padding: 14px 10px 4px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--on-brand); }
.nav a:hover { background: rgba(255,255,255,.07); text-decoration: none; }
.nav a.active { background: rgba(255,255,255,.12); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
[dir=rtl] .nav a.active { box-shadow: inset -3px 0 0 var(--gold); }
.nav .count { margin-inline-start: auto; background: var(--gold); color: #1d1600; font-size: .72rem; font-weight: 700;
  border-radius: 999px; padding: 0 7px; }
.sidebar-foot { margin-top: auto; border-top: 1px solid rgba(255,255,255,.1); padding-top: 12px; display: flex; flex-direction: column; gap: 4px; }
.sidebar-foot form { margin: 0; }
.sidebar-foot button { all: unset; cursor: pointer; display: flex; gap: 10px; align-items: center; padding: 8px 10px;
  border-radius: var(--radius-sm); color: var(--on-brand); width: 100%; box-sizing: border-box; }
.sidebar-foot button:hover { background: rgba(255,255,255,.07); }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 14px 28px; background: var(--surface);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; color: var(--ink-3); font-size: .9rem; }
.crumbs a { color: var(--ink-2); }
.crumbs .sep { opacity: .5; }
.topbar .spacer { flex: 1; }
.content { padding: 24px 28px 48px; max-width: 1280px; width: 100%; }
.menu-toggle { display: none; }
.scrim { display: none; }

.banner { background: var(--gold); color: #1d1600; padding: 8px 16px; display: flex; gap: 12px; align-items: center; justify-content: center; font-weight: 600; }
.banner form { margin: 0; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 280px; transform: translateX(-100%); transition: transform .2s; z-index: 30; }
  [dir=rtl] .sidebar { inset: 0 0 0 auto; transform: translateX(100%); }
  #menu:checked ~ .shell .sidebar { transform: none; }
  #menu:checked ~ .shell .scrim { display: block; }
  .scrim { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 20; }
  .menu-toggle { display: inline-flex; cursor: pointer; padding: 6px; border-radius: 8px; }
  .topbar { padding: 12px 16px; }
  .content { padding: 16px 16px 40px; }
}

/* ---------- page header ---------- */
.page-head { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: flex-end; justify-content: space-between; margin-bottom: 20px; }
.page-head p { margin: 4px 0 0; color: var(--ink-2); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- cards & grid ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 18px; }
.card > h2, .card > h3 { display: flex; align-items: center; gap: 8px; }
.card-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.card-head h2, .card-head h3 { margin: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > .card-head { padding: 16px 20px 0; }
.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat b { display: block; font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.stat span { color: var(--ink-3); font-size: .85rem; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 12px; text-align: start; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); font-weight: 600; background: var(--surface-2); }
tbody tr:hover { background: var(--surface-2); }
td.num, th.num { text-align: center; font-variant-numeric: tabular-nums; }
tr.qualify td { background: var(--gold-soft); }
tr.qualify td:first-child { box-shadow: inset 3px 0 0 var(--gold); }
[dir=rtl] tr.qualify td:first-child { box-shadow: inset -3px 0 0 var(--gold); }
tr.cutline td { border-bottom: 2px dashed var(--line-strong); }
.pos { width: 42px; text-align: center; font-weight: 700; color: var(--ink-2); }
.pts { font-weight: 800; }

/* ---------- matches ---------- */
.round-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); margin: 18px 0 8px; font-weight: 700; }
.matches { display: flex; flex-direction: column; gap: 8px; }
.match { display: grid; grid-template-columns: 1fr auto 1fr auto; gap: 12px; align-items: center; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; }
.match .p { display: flex; align-items: center; gap: 8px; min-width: 0; }
.match .p .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.match .p2 { justify-content: flex-end; text-align: end; }
.match .p.win span.name { font-weight: 700; }
.match .meta { display: flex; gap: 8px; align-items: center; color: var(--ink-3); font-size: .82rem; white-space: nowrap; }
.score { display: inline-flex; gap: 6px; align-items: center; font-weight: 800; font-size: 1.05rem; font-variant-numeric: tabular-nums;
  background: var(--brand-soft); color: var(--brand); border-radius: 8px; padding: 3px 12px; }
.score.pending { background: var(--surface-2); color: var(--ink-3); font-weight: 600; font-size: .85rem; }
.score-form { display: inline-flex; gap: 4px; align-items: center; margin: 0; }
.score-form input { width: 44px; text-align: center; padding: 5px 4px; }
/* Match rows adapt to their card's width, not the viewport (half-width cards on the dashboard). */
.matches { container-type: inline-size; }
@container (max-width: 620px) {
  .match { grid-template-columns: 1fr auto 1fr; }
  .match .meta { grid-column: 1 / -1; justify-content: center; }
}
td.who { white-space: nowrap; }

.hs { font-size: .75rem; font-weight: 700; color: var(--brand); background: var(--brand-soft); border-radius: 6px; padding: 1px 6px; white-space: nowrap; }

/* ---------- bracket ---------- */
.bracket { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 22px; overflow-x: auto; padding-bottom: 8px; }
.bracket .col { display: flex; flex-direction: column; justify-content: space-around; gap: 12px; }
.bracket .col h4 { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); margin: 0 0 4px; }
.tie { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.tie a { color: inherit; display: block; }
.tie a:hover { text-decoration: none; background: var(--surface-2); }
.tie .row { display: flex; justify-content: space-between; gap: 8px; padding: 7px 10px; }
.tie .row + .row { border-top: 1px solid var(--line); }
.tie .row.win { font-weight: 700; background: var(--brand-soft); }
.tie .seed { color: var(--ink-3); font-size: .75rem; min-width: 18px; display: inline-block; }
.tie .fs { font-variant-numeric: tabular-nums; font-weight: 700; }
.tie .foot { font-size: .72rem; color: var(--ink-3); padding: 3px 10px; background: var(--surface-2); border-top: 1px solid var(--line); }
.champion { display: flex; align-items: center; gap: 14px; background: linear-gradient(135deg, var(--gold-soft), var(--surface));
  border: 1px solid var(--gold); border-radius: var(--radius); padding: 16px 20px; margin-bottom: 18px; }
.champion b { font-size: 1.3rem; }

/* ---------- forms ---------- */
label { display: block; font-weight: 600; font-size: .85rem; margin-bottom: 4px; color: var(--ink-2); }
input, select, textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); padding: 8px 10px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand) 35%, transparent); border-color: var(--brand); }
input[type=checkbox], input[type=radio] { width: auto; }
textarea { min-height: 80px; }
.field { margin-bottom: 12px; }
.form-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); align-items: end; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0; }
.inline-form input, .inline-form select { width: auto; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.hint { font-size: .8rem; color: var(--ink-3); margin-top: 4px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; margin: 0 0 12px; }
legend { font-weight: 700; padding: 0 6px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 600; cursor: pointer;
  border-radius: var(--radius-sm); border: 1px solid transparent; padding: 8px 14px; background: var(--brand); color: var(--brand-fg); white-space: nowrap; }
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn.ghost { background: transparent; color: var(--ink-2); }
.btn.danger { background: var(--red); }
.btn.gold { background: var(--gold); color: #1d1600; }
.btn.sm { padding: 4px 10px; font-size: .85rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- feedback ---------- */
.flash { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; font-weight: 500; }
.flash.success { background: var(--brand-soft); color: var(--brand); }
.flash.error { background: var(--red-soft); color: var(--red); }
.flash.info { background: var(--blue-soft); color: var(--blue); }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: .74rem; font-weight: 700; border-radius: 999px; padding: 2px 9px;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.badge.green { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.badge.gold { background: var(--gold-soft); color: #7a5d00; border-color: transparent; }
.badge.red { background: var(--red-soft); color: var(--red); border-color: transparent; }
.badge.blue { background: var(--blue-soft); color: var(--blue); border-color: transparent; }
@media (prefers-color-scheme: dark) { .badge.gold { color: var(--gold); } }
.level { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 22px; padding: 0 6px; border-radius: 6px;
  font-size: .75rem; font-weight: 800; background: var(--ink); color: var(--surface); }
.empty { text-align: center; padding: 32px 16px; color: var(--ink-3); }
.empty .icon { width: 34px; height: 34px; margin-bottom: 8px; opacity: .6; }
.copy { display: flex; gap: 8px; }
.copy input { font-family: ui-monospace, monospace; font-size: .85rem; direction: ltr; }
.progress { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--brand); }
.list { list-style: none; padding: 0; margin: 0; }
.list li { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 8px 14px; color: var(--ink-2); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 700; }
.tabs a:hover { text-decoration: none; color: var(--ink); }
details > summary { cursor: pointer; font-weight: 600; color: var(--brand); }
details[open] > summary { margin-bottom: 10px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.photo { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.photo img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: var(--surface-2); }
.photo .cap { padding: 8px 10px; font-size: .85rem; display: flex; justify-content: space-between; gap: 8px; align-items: center; }
pre.json { background: var(--surface-2); border-radius: 6px; padding: 6px 8px; font-size: .75rem; margin: 0; white-space: pre-wrap; max-width: 420px; direction: ltr; }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: linear-gradient(180deg, var(--brand-deep), var(--brand-dark) 55%, #0f3460); }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border-radius: 16px; padding: 28px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.auth-card .brand { color: var(--ink); padding: 0 0 18px; }
.auth-card .brand small { color: var(--ink-3); }
.auth-card .ball { box-shadow: inset -2px -3px 5px rgba(15,52,96,.25), 0 0 0 1px var(--line-strong); }
.auth-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 16px; font-size: .9rem; }
.htmx-request .btn, .btn.htmx-request { opacity: .6; }

/* ---------- site (public homepage) ---------- */
.site { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.site-main { flex: 1; }
.wrap { width: 100%; max-width: 1140px; margin-inline: auto; padding-inline: 20px; }
.site-top { background: var(--brand-dark); color: #fff; position: sticky; top: 0; z-index: 10; border-bottom: 1px solid rgba(255,255,255,.08); }
.site-top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; }
.site-brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; }
.site-brand:hover { text-decoration: none; }
.site-brand small { display: block; color: var(--on-brand-muted); font-weight: 400; font-size: .78rem; }
.site-brand .ball, .site-foot .ball { width: 32px; height: 32px; }
.site-nav { display: flex; align-items: center; gap: 4px; }
.site-nav > a:not(.btn) { display: inline-flex; align-items: center; gap: 6px; color: var(--on-brand); padding: 8px 10px; border-radius: var(--radius-sm); }
.site-nav > a:not(.btn):hover, .site-nav > a.active { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.site-nav .btn { margin-inline-start: 6px; background: #fff; color: #0f3460; }
.btn.lg { padding: 12px 20px; font-size: 1rem; border-radius: 10px; }
.btn.outline { background: transparent; color: inherit; border-color: currentColor; }

.hero { background: linear-gradient(180deg, var(--brand-deep), var(--brand-dark) 55%, #0f3460); color: #fff; padding: 64px 0 72px; }
.hero-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 48px; align-items: center; }
.eyebrow { display: inline-block; font-size: .8rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--gold);
  margin-bottom: 14px; }
.hero h1 { font-size: clamp(2rem, 4.2vw, 3.1rem); line-height: 1.12; font-weight: 800; margin-bottom: 18px; letter-spacing: -.01em; }
.hero .lead { font-size: 1.12rem; color: var(--on-brand-2); max-width: 34em; margin-bottom: 26px; }
.hero .actions { gap: 12px; }
.hero .btn.outline { color: #fff; border-color: rgba(255,255,255,.45); }
.hero .btn.outline:hover { background: rgba(255,255,255,.08); }
.hero-note { margin-top: 18px; color: var(--on-brand-muted); font-size: .92rem; }
.hero-note a { color: #fff; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

.hero-visual { display: flex; flex-direction: column; gap: 14px; }
.mock { background: var(--surface); color: var(--ink); border-radius: 14px; box-shadow: 0 24px 60px rgba(0,0,0,.35); overflow: hidden; }
.mock-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.mock table th { background: var(--surface-2); }
.mock td { padding: 8px 12px; }
.mock tbody tr:hover { background: inherit; }
.mock-match { padding: 12px 16px; margin-inline-start: 36px; }
.mm-row { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 10px; align-items: center; }
.mm-row > span:not(.score) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mm-row > span:last-child { text-align: end; }
.mm-foot { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; font-size: .85rem; }
.mm-foot .badge { margin-inline-start: auto; }
.mm-foot .badge .icon { width: 12px; height: 12px; }

.strip { background: var(--surface); border-bottom: 1px solid var(--line); }
.strip .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 24px; padding-block: 16px; color: var(--ink-2); font-weight: 500; }
.strip span { display: inline-flex; align-items: center; gap: 8px; }
.strip .icon { color: var(--brand); }

.site-section { padding: 72px 0; }
.site-section.alt { background: var(--surface); border-block: 1px solid var(--line); }
.section-head { max-width: 640px; margin-bottom: 36px; }
.section-head h2, .split h2, .cta-band h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); font-weight: 800; letter-spacing: -.01em; }
.section-head p { color: var(--ink-2); font-size: 1.05rem; }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.feature { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.feature > .icon, .role > .icon { width: 40px; height: 40px; padding: 9px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); margin-bottom: 14px; }
.feature p, .role p { color: var(--ink-2); margin: 0; }

.flow { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; counter-reset: none; }
.flow li { position: relative; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.flow li p { color: var(--ink-2); margin: 0; }
.flow-n { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: var(--brand-fg);
  font-weight: 800; margin-bottom: 12px; }
.flow li:not(:last-child)::after { content: ""; position: absolute; top: 38px; inset-inline-end: -14px; width: 10px; height: 10px;
  border-top: 2px solid var(--line-strong); border-inline-end: 2px solid var(--line-strong); transform: rotate(45deg); }
[dir=rtl] .flow li:not(:last-child)::after { transform: rotate(-45deg); }
.more { margin: 22px 0 0; font-weight: 600; }
[dir=rtl] .arrow { display: inline-block; transform: scaleX(-1); }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center; }
.split p { color: var(--ink-2); font-size: 1.05rem; }
.ladder-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 24px; box-shadow: var(--shadow); }
.ladder { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.rung { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 6px; border-radius: 10px; background: var(--surface-2);
  border: 1px solid var(--line); }
.rung .level { min-width: 32px; height: 30px; font-size: .95rem; }
.rung b { font-size: 1.4rem; }
.rung small { font-size: .75rem; }
.ladder-example { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-top: 16px; padding: 12px 14px;
  border-radius: 10px; background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.ladder.inline { max-width: 420px; margin: 0 0 16px; }

.roles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.role { display: flex; flex-direction: column; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; color: inherit; }
.role:hover { text-decoration: none; border-color: var(--brand); }
.role .arrow-link { margin-top: 16px; color: var(--brand); font-weight: 600; }

.cta-band { background: linear-gradient(180deg, var(--brand-dark), #0f3460); color: #fff; padding: 56px 0; }
.cta-band .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 24px; }
.cta-band p { color: var(--on-brand-2); margin: 0; max-width: 36em; }
.cta-band .btn.outline { color: #fff; border-color: rgba(255,255,255,.45); }

.site-foot { background: var(--brand-deep); color: var(--on-brand-muted); padding: 28px 0; font-size: .9rem; }
.site-foot .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.site-foot nav { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.site-foot a { color: var(--on-brand); }
.site-foot .site-brand { color: #fff; }

/* ---------- guides ---------- */
.guides.wrap, .guide-page.wrap { padding-block: 32px 64px; }
.guide-group { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin: 28px 0 12px; }
.guide-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.guide-card { display: flex; gap: 14px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; color: inherit; box-shadow: var(--shadow); }
.guide-card:hover { text-decoration: none; border-color: var(--brand); }
.guide-card b { display: block; margin-bottom: 2px; }
.guide-card small { display: block; color: var(--ink-2); font-size: .9rem; }
.guide-icon { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); }

.guide-page { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 36px; align-items: start; }
.guide-page.single { grid-template-columns: minmax(0, 1fr); justify-items: center; }
.guide-toc { position: sticky; top: 88px; display: flex; flex-direction: column; gap: 4px; font-size: .92rem; }
.main .guide-toc { top: 76px; }
.guide-toc a { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: var(--radius-sm); color: var(--ink-2); }
.guide-toc a:hover { background: var(--surface); text-decoration: none; color: var(--ink); }
.guide-toc a.active { background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.guide-toc .toc-all { font-weight: 600; color: var(--ink); border-bottom: 1px solid var(--line); border-radius: 0; margin-bottom: 6px; padding-bottom: 10px; }
.guide-toc nav { display: flex; flex-direction: column; gap: 2px; }

.prose { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 32px 40px; box-shadow: var(--shadow); max-width: 820px;
  font-size: 1rem; line-height: 1.7; }
.prose > .badge { margin-bottom: 12px; }
.prose h1 { font-size: 2rem; font-weight: 800; }
.prose .lead { font-size: 1.1rem; color: var(--ink-2); padding-bottom: 18px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.prose h2 { font-size: 1.3rem; margin: 32px 0 10px; }
.prose h3 { font-size: 1.05rem; margin: 22px 0 8px; }
.prose ul, .prose ol { padding-inline-start: 1.4em; margin: 0 0 14px; }
.prose li { margin-bottom: 6px; }
.prose li > ul { margin-top: 6px; }
.prose table { margin: 8px 0 18px; border: 1px solid var(--line); border-radius: var(--radius-sm); border-collapse: separate; border-spacing: 0; overflow: hidden; }
.prose tr:last-child td { border-bottom: 0; }
.prose table td { vertical-align: top; }
.prose th { text-transform: none; letter-spacing: 0; font-size: .82rem; }
.prose .level { vertical-align: middle; }
.prose .hs { font-size: .85rem; }
ol.steps { list-style: none; counter-reset: step; padding-inline-start: 0; }
ol.steps > li { counter-increment: step; position: relative; padding-inline-start: 42px; margin-bottom: 12px; }
ol.steps > li::before { content: counter(step); position: absolute; inset-inline-start: 0; top: 1px; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); font-weight: 800; font-size: .85rem; }
.path { display: inline; font-weight: 600; color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px;
  padding: 1px 7px; white-space: normal; }
.callout { border-inline-start: 4px solid var(--blue); background: var(--blue-soft); border-radius: var(--radius-sm); padding: 12px 16px; margin: 14px 0 18px; }
.callout > b:first-child { display: block; margin-bottom: 2px; }
.callout ul { margin: 6px 0 0; }
.callout.tip { border-color: var(--brand); background: var(--brand-soft); }
.callout.warn { border-color: var(--gold); background: var(--gold-soft); }
.formula { display: inline-block; font-weight: 700; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 14px; }
.guide-pager { display: flex; justify-content: space-between; gap: 14px; margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--line); }
.guide-pager a { display: flex; flex-direction: column; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--ink); font-weight: 600; max-width: 48%; }
.guide-pager a:hover { border-color: var(--brand); text-decoration: none; }
.guide-pager small { font-weight: 400; }
.guide-pager .next { margin-inline-start: auto; text-align: end; }

@media (max-width: 960px) {
  .hero-grid, .split { grid-template-columns: 1fr; gap: 36px; }
  .features, .roles, .flow { grid-template-columns: 1fr 1fr; }
  .flow li::after { display: none; }
  .guide-page { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .guide-toc { min-width: 0; }
  .guide-toc { position: static; }
  .guide-toc nav { flex-direction: row; overflow-x: auto; gap: 6px; padding-bottom: 4px; }
  .guide-toc nav a { white-space: nowrap; border: 1px solid var(--line); background: var(--surface); }
}
@media (max-width: 640px) {
  .hide-sm { display: none; }
  .site-brand small { display: none; }
  .hero { padding: 40px 0 48px; }
  .features, .roles, .flow { grid-template-columns: 1fr; }
  .site-section { padding: 48px 0; }
  .mock-match { margin-inline-start: 0; }
  .ladder { gap: 6px; }
  .prose { padding: 22px 18px; border-radius: 12px; }
  .prose h1 { font-size: 1.6rem; }
  .guide-pager { flex-direction: column; }
  .guide-pager a { max-width: none; }
}
