/* =========================================================================
   League app (Royal Golf Sim) — shared design system
   Dark, premium, "royal": black clubhouse + white crest + royal gold.
   Page-specific styles live in /css/pages/<page>.css and reuse these tokens.
   ========================================================================= */

/* Display face: Oswald (SIL Open Font License, /fonts/OFL.txt), self-hosted so
   every phone and PC gets the same condensed "royal" headings. Latin subset,
   variable weight 400–700 — so display weights top out at 700. */
@font-face {
  font-family: "Oswald";
  src: url("/fonts/oswald-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  /* surfaces */
  --bg: #08090b;
  --bg-elev: #0e1014;
  --surface: #13161b;
  --surface-2: #191d24;
  --surface-3: #21262f;
  --line: #262b34;
  --line-strong: #363c48;

  /* text */
  --text: #f5f3ee;
  --text-2: #cfd2d8;
  --muted: #969ca7;  /* 6.1:1 on --surface-2 */
  --faint: #808691;  /* 4.6:1 on --surface-2: small faint text stays readable, still a step below --muted */

  /* royal gold */
  --gold: #d7b25d;
  --gold-strong: #ecc974;
  --gold-deep: #9f7d34;
  --gold-ink: #1c1505;
  --gold-soft: rgba(215, 178, 93, 0.12);
  --gold-line: rgba(215, 178, 93, 0.35);

  /* status */
  --green: #4fc283;
  --green-soft: rgba(79, 194, 131, 0.14);
  --red: #f0706a;
  --red-soft: rgba(240, 112, 106, 0.14);
  --blue: #74a7ff;
  --blue-soft: rgba(116, 167, 255, 0.14);

  /* shape */
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 22px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 12px 32px rgba(0, 0, 0, 0.38);
  --shadow-gold: 0 0 0 1px var(--gold-line), 0 14px 40px rgba(215, 178, 93, 0.10);

  /* type */
  --font-display: "Oswald", "Avenir Next Condensed", "Roboto Condensed", "Arial Narrow", system-ui, sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Inter, "Helvetica Neue", Arial, sans-serif;

  /* layout */
  --wrap: 1120px;
  --gutter: 20px;
  --header-h: 68px;
  --tabbar-h: 66px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  /* column so <main> can grow and short pages keep the footer at the bottom */
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1200px 520px at 50% -180px, rgba(215, 178, 93, 0.10), transparent 70%),
    radial-gradient(900px 400px at 100% 0, rgba(116, 167, 255, 0.04), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 400 16px/1.5 var(--font-body);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
img { max-width: 100%; display: block; }
a { color: var(--gold-strong); text-decoration: none; }
a:hover { color: #fff3cf; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; }
p { margin: 0 0 0.75em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
.icon { flex: none; vertical-align: middle; }

/* ---------- layout ---------- */
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.wrap.narrow { max-width: 560px; }
.wrap.medium { max-width: 820px; }
main.wrap { padding-top: 28px; padding-bottom: 56px; flex: 1 0 auto; }
.stack > * + * { margin-top: 16px; }
.stack-sm > * + * { margin-top: 8px; }
.stack-lg > * + * { margin-top: 28px; }
.row { display: flex; align-items: center; gap: 12px; }
.row-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grid { display: grid; gap: 16px; }
.grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { display: grid; gap: 16px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { display: grid; gap: 16px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.span-2 { grid-column: span 2; }
.grow { flex: 1 1 auto; min-width: 0; }
.right { text-align: right; }
.center { text-align: center; }
.mt-0 { margin-top: 0 !important; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mt-4 { margin-top: 36px; }
.mb-0 { margin-bottom: 0 !important; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.hide { display: none !important; }
.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; }

/* ---------- type ---------- */
.display, .h1, .h2, .h3, .eyebrow, .stat-value, .btn, .tab span, .top-link, .brand-name, .footer-title, .th-label {
  font-family: var(--font-display);
}
.display { font-size: clamp(34px, 6vw, 56px); font-weight: 700; letter-spacing: 0.025em; text-transform: uppercase; line-height: 1.05; }
.h1 { font-size: clamp(28px, 4.4vw, 40px); font-weight: 700; letter-spacing: 0.025em; text-transform: uppercase; line-height: 1.12; }
.h2 { font-size: 22px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.h3 { font-size: 17px; font-weight: 600; letter-spacing: 0.045em; text-transform: uppercase; }
.eyebrow { font-size: 12.5px; font-weight: 500; letter-spacing: 0.2em; text-transform: uppercase; color: var(--gold); }
.lede { font-size: 17px; color: var(--text-2); max-width: 62ch; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13.5px; }
.tiny { font-size: 12px; }
.gold { color: var(--gold-strong); }
.green { color: var(--green); }
.red { color: var(--red); }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.stars { color: var(--gold); letter-spacing: 0.4em; font-size: 11px; }

.page-head { margin-bottom: 24px; }
.page-head .eyebrow { margin-bottom: 8px; display: inline-flex; align-items: center; gap: 8px; }
.page-head .lede { margin-top: 10px; margin-bottom: 0; }
.page-head.between { align-items: flex-end; flex-wrap: wrap; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 32px 0 12px; }
.section-title .h2, .section-title .h3 { display: flex; align-items: center; gap: 10px; }
.section-title a { font-size: 14px; display: inline-flex; align-items: center; gap: 4px; }

/* ---------- preview strip + header ---------- */
.preview-strip {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 6px 12px; font-size: 12px; letter-spacing: 0.04em; color: var(--gold-strong);
  background: linear-gradient(90deg, transparent, rgba(215, 178, 93, 0.10), transparent);
  border-bottom: 1px solid rgba(215, 178, 93, 0.18);
  text-align: center;
}
.preview-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 10px var(--gold); flex: none; }

.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(8, 9, 11, 0.82);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.header-row { height: var(--header-h); display: flex; align-items: center; gap: 20px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); flex: 0 1 auto; min-width: 0; }
.brand:hover { color: var(--text); }
.brand-logo { width: 44px; height: 44px; filter: drop-shadow(0 0 12px rgba(215, 178, 93, 0.25)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; min-width: 0; }
.brand-name { font-size: 18px; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-size: 11px; letter-spacing: 0.26em; text-transform: uppercase; color: var(--gold); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-nav { display: flex; align-items: center; gap: 2px; margin-left: 8px; }
.top-link {
  color: var(--text-2); font-size: 15px; font-weight: 500; letter-spacing: 0.07em; text-transform: uppercase;
  padding: 8px 12px; border-radius: 999px;
}
.top-link:hover { color: var(--text); background: var(--surface-2); }
.top-link.is-active { color: var(--gold-ink); background: var(--gold); }
.top-link-admin { color: var(--gold-strong); }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; flex: none; }
.pill.header-admin { display: none; }
.me-chip { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 14px; }
.inline-form { display: inline; margin: 0; }
.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { color: var(--text); border-color: var(--line-strong); }

/* narrow desktops / tablets: tighten the top nav so the admin's six links fit on one line */
.top-link { white-space: nowrap; }
@media (min-width: 861px) and (max-width: 1100px) {
  .header-row { gap: 14px; }
  .top-nav { margin-left: 0; }
  .top-link { padding: 7px 9px; font-size: 14px; letter-spacing: 0.05em; }
  .me-name { display: none; }
}

/* ---------- mobile tab bar ---------- */
.tabbar { display: none; }
@media (max-width: 860px) {
  .top-nav { display: none; }
  .pill.header-admin { display: inline-flex; }
  .me-name { display: none; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    padding: 6px 6px calc(6px + var(--safe-bottom));
    background: rgba(10, 11, 14, 0.94);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--line);
  }
  .tab {
    display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px;
    color: var(--muted); border-radius: 12px;
  }
  .tab span { font-size: 11.5px; font-weight: 500; letter-spacing: 0.07em; text-transform: uppercase; white-space: nowrap; }
  .tab .icon { width: 22px; height: 22px; }
  .tab.is-active { color: var(--gold-strong); background: var(--gold-soft); }
  body { padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom)); }
  body.no-tabbar { padding-bottom: var(--safe-bottom); } /* sign-in pages hide the tab bar */
}
@media (max-width: 520px) {
  :root { --gutter: 16px; --header-h: 60px; }
  .header-row { gap: 12px; }
  .brand { gap: 10px; }
  .brand-logo { width: 38px; height: 38px; }
  .brand-name { font-size: 16px; letter-spacing: 0.08em; }
  .brand-sub { font-size: 10.5px; letter-spacing: 0.2em; }
  .header-actions { gap: 8px; }
  main.wrap { padding-top: 20px; }
}

/* ---------- cards ---------- */
.card {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.card-tight { padding: 14px 16px; }
.card-flush { padding: 0; overflow: hidden; }
.card-gold { border-color: var(--gold-line); box-shadow: var(--shadow-gold); background: linear-gradient(180deg, #1d1a12, var(--surface) 70%); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head .h3 { display: flex; align-items: center; gap: 8px; }
.card-foot { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
a.card { color: inherit; display: block; transition: border-color .15s, transform .15s; }
a.card:hover { border-color: var(--gold-line); transform: translateY(-1px); color: inherit; }

/* stat tile */
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat-label { font-size: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.stat-value { font-size: 30px; font-weight: 700; letter-spacing: 0.02em; line-height: 1; }
.stat-sub { font-size: 13px; color: var(--muted); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border-radius: 999px;
  font-size: 15px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; line-height: 1;
  border: 1px solid var(--line-strong); background: var(--surface-3); color: var(--text);
  cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: #2a303b; color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn-gold { background: linear-gradient(180deg, var(--gold-strong), var(--gold)); color: var(--gold-ink); border-color: var(--gold); }
.btn-gold:hover { background: linear-gradient(180deg, #f6d88a, var(--gold-strong)); color: var(--gold-ink); }
.btn-ghost { background: transparent; border-color: var(--line-strong); color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-outline-gold { background: transparent; border-color: var(--gold-line); color: var(--gold-strong); }
.btn-outline-gold:hover { background: var(--gold-soft); color: var(--gold-strong); }
.btn-danger { background: transparent; border-color: rgba(240, 112, 106, 0.45); color: var(--red); }
.btn-danger:hover { background: var(--red-soft); color: var(--red); }
.btn-sm { min-height: 34px; padding: 7px 13px; font-size: 13px; }
.btn-lg { min-height: 52px; padding: 14px 24px; font-size: 17px; }
.btn-block { display: flex; width: 100%; }
.btn[disabled], .btn.is-disabled { opacity: 0.45; pointer-events: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- badges / pills / chips ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.04em; white-space: nowrap;
  background: var(--surface-3); color: var(--text-2); border: 1px solid var(--line-strong);
}
.badge-gold { background: var(--gold-soft); color: var(--gold-strong); border-color: var(--gold-line); }
.badge-green { background: var(--green-soft); color: var(--green); border-color: rgba(79, 194, 131, 0.35); }
.badge-red { background: var(--red-soft); color: var(--red); border-color: rgba(240, 112, 106, 0.35); }
.badge-blue { background: var(--blue-soft); color: var(--blue); border-color: rgba(116, 167, 255, 0.35); }
.badge-muted { background: transparent; color: var(--muted); border-color: var(--line); }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  font-size: 13px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2);
}
.pill-gold { background: var(--gold-soft); border-color: var(--gold-line); color: var(--gold-strong); }
.chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line); font-size: 14px; color: var(--text-2);
}
.chip-open { padding: 6px 12px; border-style: dashed; border-color: var(--gold-line); color: var(--gold-strong); background: transparent; }

/* avatar (initials) */
.avatar {
  display: inline-grid; place-items: center; flex: none;
  width: 36px; height: 36px; border-radius: 50%;
  background: radial-gradient(circle at 30% 25%, #3a3f4b, #1b1f27);
  border: 1px solid var(--line-strong); color: var(--text);
  font-size: 13px; font-weight: 700; letter-spacing: 0.04em;
}
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg { width: 52px; height: 52px; font-size: 18px; }
.avatar-gold { background: linear-gradient(180deg, var(--gold-strong), var(--gold-deep)); color: var(--gold-ink); border-color: var(--gold); }
.avatar-open { background: transparent; border: 1.5px dashed var(--gold-line); color: var(--gold); }

/* ---------- lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.list-item:first-child { border-top: 0; }
.list-item .grow .title { font-weight: 600; }
.list-item .grow .sub { font-size: 13.5px; color: var(--muted); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th, .table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th { font-family: var(--font-display); font-size: 12.5px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); background: var(--bg-elev); position: sticky; top: 0; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: rgba(255, 255, 255, 0.02); }
.table .num, .table td.num, .table th.num { text-align: right; }
.table tr.is-me td { background: var(--gold-soft); }
.table tr.is-me td:first-child { box-shadow: inset 3px 0 0 var(--gold); }
.rank { font-family: var(--font-display); font-weight: 700; font-size: 18px; color: var(--muted); width: 2.2em; display: inline-block; }
.rank-1 { color: var(--gold-strong); }

/* ---------- forms ---------- */
.form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; }
.field label, .label { font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2); }
.field .hint { font-size: 13px; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; min-height: 46px; padding: 11px 14px; border-radius: var(--radius-sm);
  background: var(--bg-elev); color: var(--text); border: 1px solid var(--line-strong);
  font: inherit; font-size: 16px; /* 16px stops iOS zoom-on-focus */
}
.input::placeholder { color: var(--faint); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 38px; }
.check { display: inline-flex; align-items: center; gap: 10px; font-size: 15px; color: var(--text-2); cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--gold); }
.error-text { color: var(--red); font-size: 14px; }

/* segmented control (radio group styled as buttons) */
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; padding: 5px; border-radius: 14px; background: var(--bg-elev); border: 1px solid var(--line); }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 52px; padding: 8px 6px; border-radius: 10px; cursor: pointer; text-align: center;
  color: var(--text-2); font-weight: 700;
}
.segmented label small { font-weight: 500; color: var(--muted); font-size: 12px; }
.segmented input:checked + label { background: var(--gold); color: var(--gold-ink); }
.segmented input:checked + label small { color: rgba(28, 21, 5, 0.75); }
.segmented input:focus-visible + label { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- notices ---------- */
.notice {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius);
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2); font-size: 14.5px;
}
.notice .icon { margin-top: 1px; color: var(--muted); }
.notice-gold { background: var(--gold-soft); border-color: var(--gold-line); color: #f1e2bd; }
.notice-gold .icon { color: var(--gold); }
.notice-green { background: var(--green-soft); border-color: rgba(79, 194, 131, 0.35); color: #cdeedb; }
.notice-green .icon { color: var(--green); }
.notice-red { background: var(--red-soft); border-color: rgba(240, 112, 106, 0.35); color: #f8d3d0; }
.notice-red .icon { color: var(--red); }
.toast {
  display: flex; align-items: center; gap: 10px; margin-top: 16px; padding: 12px 16px; border-radius: var(--radius);
  background: var(--green-soft); border: 1px solid rgba(79, 194, 131, 0.35); color: #d8f3e3; font-weight: 600;
}
.toast .icon { color: var(--green); }

/* empty states */
.empty-state { text-align: center; padding: 40px 24px; }
/* error pages: the card sits in the middle of the space above the footer */
main.error-page { display: flex; flex-direction: column; justify-content: center; }
main.error-page > .card { width: 100%; }
.empty-state .h1 { margin: 6px 0 10px; }
.empty-state .btn { margin-top: 12px; }

/* tabs (in-page) */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a, .tabs button {
  flex: none; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  color: var(--text-2); font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.tabs .is-active { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); }

/* divider with crest stars */
.crest-rule { display: flex; align-items: center; gap: 14px; color: var(--gold); margin: 28px 0; }
.crest-rule::before, .crest-rule::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--gold-line), transparent); }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); margin-top: 24px; padding: 28px 0 36px; background: rgba(0, 0, 0, 0.25); }
.footer-row { display: flex; gap: 16px; align-items: center; }
.footer-row img { opacity: 0.9; }
.footer-title { font-size: 15px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 2px; }

/* ---------- responsive grid collapse ---------- */
@media (max-width: 960px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .card { padding: 16px; }
  .table th, .table td { padding: 10px 12px; }
  .hide-sm { display: none !important; }

  /* thumb-sized targets: shared small controls are at least 40px tall on phones */
  .btn-sm { min-height: 40px; }
  .pill.header-admin { min-height: 40px; }
  .icon-btn { width: 40px; height: 40px; }
  .tabs a, .tabs button { min-height: 40px; display: inline-flex; align-items: center; }
  /* text links beside section titles: grow the hit area without moving the layout */
  .section-title a { min-height: 40px; padding: 10px 0; margin: -10px 0; }
}
@media (min-width: 641px) { .show-sm { display: none !important; } }

/* installed (standalone) PWA: respect the notch */
@media (display-mode: standalone) {
  .preview-strip { padding-top: calc(6px + env(safe-area-inset-top, 0px)); }
  /* keep the sticky header (and scrolled content) out from under the notch / status bar */
  body::before { content: ""; position: fixed; top: 0; left: 0; right: 0; height: env(safe-area-inset-top, 0px); background: var(--bg); z-index: 60; }
  .site-header { top: env(safe-area-inset-top, 0px); }
}

/* very small phones (320px): drop the wordmark so the header never forces sideways scroll */
@media (max-width: 360px) {
  .brand-text { display: none; }
  .header-row { gap: 12px; }
  .preview-strip { font-size: 11.5px; letter-spacing: 0.01em; padding: 6px 8px; }
}

/* phones: standalone text links (back links, "see all" links, card links) get a 40px tap area */
@media (max-width: 640px) {
  .section-title a, .card-foot a:not(.btn), .sc-back, .stat-sub a, .scores-course a.title {
    display: inline-flex; align-items: center; min-height: 40px;
  }
}
