/* IETSC Score — static web edition.
 *
 * Plain CSS, no build step. Colours are defined once as custom properties on
 * :root and redefined for dark mode, so every component is written once and
 * themes for free.
 */

/* ── Design tokens ─────────────────────────────────────────────────── */

:root {
  color-scheme: light;

  --brand: #1e6fd9;
  --brand-strong: #1557ab;
  --brand-soft: #e8f1fd;
  --on-brand: #ffffff;

  /* Drawn from the chapter logo: the yellow ring and the green lettering. */
  --accent: #f0a91c;
  --accent-soft: #fdf3df;
  --success: #2e7d32;
  --success-soft: #e7f4e8;
  --danger: #c62828;
  --danger-soft: #fdeaea;

  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-sunken: #eef1f6;
  --border: #dfe4ec;
  --border-strong: #c7cedb;

  --text: #16202e;
  --text-muted: #5b6878;
  --text-faint: #8b97a6;

  --gold: #c9a227;
  --silver: #8d99a8;
  --bronze: #b06a2c;

  --shadow-1: 0 1px 2px rgba(16, 26, 42, .06), 0 1px 3px rgba(16, 26, 42, .08);
  --shadow-2: 0 2px 6px rgba(16, 26, 42, .07), 0 6px 18px rgba(16, 26, 42, .09);

  --radius: 14px;
  --radius-sm: 9px;
  --radius-pill: 999px;

  --topbar-h: 62px;
  --tabs-h: 48px;
  --maxw: 1120px;

  --font: "Segoe UI", Roboto, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
}

/* Dark mode follows the OS unless the visitor has chosen a theme, in which
 * case data-theme on <html> wins. Both blocks below are needed: the media
 * query for the automatic case, the attribute for the explicit one. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --brand: #6ba6f5;
    --brand-strong: #8fbdf8;
    --brand-soft: #172740;
    --on-brand: #0b1220;

    --accent: #f5c05a;
    --accent-soft: #2e2611;
    --success: #6cc070;
    --success-soft: #16271a;
    --danger: #f28b82;
    --danger-soft: #2d1616;

    --bg: #0d1420;
    --surface: #151d2b;
    --surface-2: #1a2434;
    --surface-sunken: #111927;
    --border: #26313f;
    --border-strong: #35414f;

    --text: #e6ecf4;
    --text-muted: #a3b0c0;
    --text-faint: #7b8798;

    --gold: #e3c35a;
    --silver: #aab6c4;
    --bronze: #cf8f52;

    --shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-2: 0 4px 16px rgba(0, 0, 0, .45);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --brand: #6ba6f5;
  --brand-strong: #8fbdf8;
  --brand-soft: #172740;
  --on-brand: #0b1220;

  --accent: #f5c05a;
  --accent-soft: #2e2611;
  --success: #6cc070;
  --success-soft: #16271a;
  --danger: #f28b82;
  --danger-soft: #2d1616;

  --bg: #0d1420;
  --surface: #151d2b;
  --surface-2: #1a2434;
  --surface-sunken: #111927;
  --border: #26313f;
  --border-strong: #35414f;

  --text: #e6ecf4;
  --text-muted: #a3b0c0;
  --text-faint: #7b8798;

  --gold: #e3c35a;
  --silver: #aab6c4;
  --bronze: #cf8f52;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-2: 0 4px 16px rgba(0, 0, 0, .45);
}

/* ── Base ──────────────────────────────────────────────────────────── */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 650; }
p { margin: 0; }
img { max-width: 100%; display: block; }
a { color: var(--brand); }

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

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--brand);
  color: var(--on-brand);
  padding: 10px 16px;
  border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }

.icon { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; }

/* ── Top bar ───────────────────────────────────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  height: var(--topbar-h);
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

.brand__logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #000;
  flex: none;
}

.brand__text { display: flex; flex-direction: column; min-width: 0; }
.brand__name { font-weight: 700; letter-spacing: -.2px; }
.brand__sub {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar__actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.session { display: flex; align-items: center; gap: 10px; min-width: 0; }
.session__who {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  cursor: pointer;
  flex: none;
  transition: background .15s, border-color .15s;
}
.icon-btn:hover { background: var(--surface-sunken); border-color: var(--border-strong); }

/* Only one of the two glyphs is ever shown. */
.icon--moon { display: none; }
:root[data-theme="dark"] .icon--sun { display: none; }
:root[data-theme="dark"] .icon--moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon--sun { display: none; }
  :root:not([data-theme="light"]) .icon--moon { display: block; }
}

/* ── Tabs ──────────────────────────────────────────────────────────── */

.tabs { border-top: 1px solid var(--border); background: var(--surface); }

.tabs__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 8px;
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs__inner::-webkit-scrollbar { display: none; }

.tab {
  appearance: none;
  border: 0;
  background: none;
  text-decoration: none;
  padding: 0 16px;
  height: var(--tabs-h);
  font-size: 14px;
  font-weight: 560;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 2.5px solid transparent;
  transition: color .15s, border-color .15s;
}
.tab:hover { color: var(--text); }
.tab[aria-current="page"] { color: var(--brand); border-bottom-color: var(--brand); }

/* ── Layout ────────────────────────────────────────────────────────── */

.main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 22px 16px 32px;
  outline: none;
}

.loading { color: var(--text-muted); padding: 40px 0; text-align: center; }

.page__head { margin-bottom: 18px; }
.page__title { font-size: 25px; letter-spacing: -.4px; }
.page__sub { color: var(--text-muted); font-size: 14px; margin-top: 3px; }

.section { margin-top: 26px; }
.section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 11px;
}
.section__title {
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
/* A short brand-coloured rule before the heading, which gives the page a
 * spine without adding another border line across the whole width. */
.section__head .section__title::before {
  content: "";
  width: 3px;
  height: 15px;
  border-radius: 2px;
  background: var(--brand);
  flex: none;
}
.section__link {
  font-size: 13.5px;
  font-weight: 560;
  text-decoration: none;
  white-space: nowrap;
}
.section__link:hover { text-decoration: underline; }

.grid { display: grid; gap: 14px; }
/* Explicit counts rather than auto-fit. With four cards, auto-fit picks
 * three-across at some widths and leaves a single orphan on the second row,
 * which reads as a mistake. Two or four always balance. */
.grid--stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 860px) {
  .grid--stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.grid--cards { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }

/* ── Cards ─────────────────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  padding: 16px;
  transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease;
}

/* Only the cards that represent a thing worth reading lift on hover; the
 * stat tiles stay put, because nothing happens when you click one. */
.grid--cards > .card:hover {
  box-shadow: var(--shadow-2);
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.card--flush { padding: 0; overflow: hidden; }

.stat__label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-muted);
  font-weight: 600;
}
.stat__value {
  font-size: 29px;
  font-weight: 700;
  letter-spacing: -.8px;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.stat__hint { font-size: 12.5px; color: var(--text-faint); margin-top: 2px; }

/* Hero */
.hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-strong) 100%);
  color: #fff;
  border: 0;
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-2);
}

/* A soft highlight in the top-right corner, so the panel reads as a surface
 * with light falling on it rather than a flat rectangle of colour. */
.hero::after {
  content: "";
  position: absolute;
  top: -55%;
  right: -12%;
  width: 62%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.17), rgba(255,255,255,0) 70%);
  pointer-events: none;
}
.hero > * { position: relative; }
.hero__avatar {
  width: 58px;
  height: 58px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, .18);
  display: grid;
  place-items: center;
  font-size: 21px;
  font-weight: 700;
  flex: none;
  border: 2px solid rgba(255, 255, 255, .35);
}
.hero__who { min-width: 0; }
.hero__hi { font-size: 13px; opacity: .85; }
.hero__name { font-size: 21px; font-weight: 700; letter-spacing: -.3px; }
.hero__meta { font-size: 13.5px; opacity: .9; }
.hero__score { margin-left: auto; text-align: right; }
.hero__points { font-size: 33px; font-weight: 750; letter-spacing: -1px; line-height: 1; font-variant-numeric: tabular-nums; }
.hero__pointsLabel { font-size: 12px; opacity: .85; text-transform: uppercase; letter-spacing: .7px; }

/* ── Chips, badges, buttons ────────────────────────────────────────── */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  background: var(--surface-sunken);
  color: var(--text-muted);
  border: 1px solid transparent;
  white-space: nowrap;
}
.chip--brand { background: var(--brand-soft); color: var(--brand-strong); }
.chip--accent { background: var(--accent-soft); color: var(--accent); }
.chip--success { background: var(--success-soft); color: var(--success); }
.chip--danger { background: var(--danger-soft); color: var(--danger); }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
  margin-bottom: 14px;
}

.filter-btn {
  appearance: none;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 560;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.filter-btn:hover { border-color: var(--border-strong); color: var(--text); }
.filter-btn[aria-pressed="true"] {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--on-brand);
}

.search {
  position: relative;
  flex: 1 1 210px;
  min-width: 180px;
}
.search__input {
  width: 100%;
  padding: 9px 14px 9px 36px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 14px;
}
.search__input::placeholder { color: var(--text-faint); }
.search__icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-faint);
  pointer-events: none;
}

.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 9px 16px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn--primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn--primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }

/* ── Leaderboard ───────────────────────────────────────────────────── */

.lb { list-style: none; margin: 0; padding: 0; }

.lb__row {
  border-bottom: 1px solid var(--border);
  transition: background .12s;
}
.lb__row:last-child { border-bottom: 0; }
.lb__row:hover { background: var(--surface-2); }

/* The top three get a whisper of their medal colour down the left edge —
 * enough to find them while scrolling, not enough to shout.
 *
 * Keyed to the rank the row actually holds, not to its position in the list:
 * a three-way tie at the top is three rows of rank 1, and colouring them
 * gold/silver/bronze would state a placing that does not exist. */
.lb__row--podium1 .lb__inner { box-shadow: inset 3px 0 0 var(--gold); }
.lb__row--podium2 .lb__inner { box-shadow: inset 3px 0 0 var(--silver); }
.lb__row--podium3 .lb__inner { box-shadow: inset 3px 0 0 var(--bronze); }
.lb__row--me .lb__inner { box-shadow: inset 3px 0 0 var(--brand) !important; }
.lb__row--me { background: var(--brand-soft); }
.lb__row--me:hover { background: var(--brand-soft); }

.lb__rank {
  width: 38px;
  flex: none;
  text-align: center;
  font-weight: 700;
  font-size: 15px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.lb__rank--1 { color: var(--gold); }
.lb__rank--2 { color: var(--silver); }
.lb__rank--3 { color: var(--bronze); }
.lb__medal { font-size: 19px; line-height: 1; }

.lb__avatar {
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: var(--radius-pill);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
  background: var(--surface-sunken);
  color: var(--text-muted);
}
.lb__row--me .lb__avatar { background: var(--brand); color: var(--on-brand); }

.lb__who { min-width: 0; flex: 1; }
.lb__name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
}
.lb__name > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
}
.lb__meta {
  display: block;
  font-size: 12.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lb__points {
  font-weight: 700;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  flex: none;
}
.lb__points span { font-size: 11.5px; font-weight: 600; color: var(--text-faint); margin-left: 3px; }

/* The row is a plain box, not a button. A student may not read another
 * student's profile — the rules allow `users/{ownUid}` and nothing else — so
 * there is no destination for a tap and pretending otherwise would be a lie
 * about what the app can do. */
.lb__inner {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  padding: 12px 16px;
}

/* ── Events & announcements ────────────────────────────────────────── */

.item { display: flex; flex-direction: column; gap: 8px; }
.item__top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.item__title { font-size: 15.5px; font-weight: 650; }
.item__body { font-size: 14px; color: var(--text-muted); }
.item__facts {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12.5px;
  color: var(--text-faint);
  margin-top: 2px;
}
.item__fact { display: inline-flex; align-items: center; gap: 5px; }
.item__fact svg { width: 14px; height: 14px; }

.card--important { border-left: 3px solid var(--accent); }

/* ── Profile ───────────────────────────────────────────────────────── */

.profile__grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 13px; }
.field__label { font-size: 12.5px; font-weight: 600; color: var(--text-muted); }
.field__control {
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.kv { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.kv:last-child { border-bottom: 0; }
.kv__k { color: var(--text-muted); font-size: 13.5px; }
.kv__v { font-weight: 600; font-size: 13.5px; }

.note {
  font-size: 12.5px;
  color: var(--text-muted);
  background: var(--surface-sunken);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-top: 4px;
}

.empty {
  text-align: center;
  padding: 44px 18px;
  color: var(--text-muted);
  font-size: 13.5px;
}
.empty__title { font-weight: 650; color: var(--text); margin-bottom: 4px; }

/* ── Footer & bottom nav ───────────────────────────────────────────── */

.footer {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 22px 16px 26px;
  color: var(--text-faint);
  font-size: 12.5px;
  text-align: center;
  border-top: 1px solid var(--border);
}
.footer__note { margin-top: 2px; }

.bottomnav { display: none; }

/* ── Responsive ────────────────────────────────────────────────────── */

@media (max-width: 720px) {
  .brand__sub { display: none; }
  .session__who { display: none; }
  .page__title { font-size: 21px; }
  .hero { padding: 18px; }
  .hero__score { margin-left: 0; width: 100%; text-align: left; }
  .main { padding: 18px 14px 24px; }

  /* The top tabs give way to a thumb-reachable bar at the bottom. */
  .tabs { display: none; }

  /* `hidden` must still win. The bar is display:flex inside this media
   * query, which beats the user-agent rule that `hidden` relies on, so a
   * signed-out visitor would otherwise get a navigation bar to nowhere. */
  .bottomnav[hidden] { display: none; }

  .bottomnav {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .bottomnav .tab {
    flex: 1;
    height: 56px;
    padding: 0 4px;
    font-size: 11px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border-bottom: 0;
    border-top: 2.5px solid transparent;
  }
  .bottomnav .tab[aria-current="page"] { border-top-color: var(--brand); border-bottom-color: transparent; }
  .bottomnav .tab svg { width: 20px; height: 20px; }

  /* Clear the fixed bar so the last card is never trapped under it. */
  .footer { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
}

@media (max-width: 380px) {
  .grid--stats { grid-template-columns: 1fr 1fr; }
  .stat__value { font-size: 24px; }
  .lb__inner { padding: 11px 12px; gap: 10px; }
  .lb__avatar { display: none; }
}

@media (min-width: 1000px) {
  .grid--dash { grid-template-columns: 1.35fr 1fr; align-items: start; }
}

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

@media print {
  .topbar, .bottomnav, .filters, .footer { display: none; }
  .card { box-shadow: none; break-inside: avoid; }
}

/* ── Auth, alerts and destructive actions ──────────────────────────── */

.authwrap {
  display: grid;
  place-items: center;
  min-height: 62vh;
  padding: 8px 0;
}

.auth {
  width: 100%;
  max-width: 400px;
  padding: 26px 24px 22px;
}

.auth__logo {
  width: 64px;
  height: 64px;
  border-radius: 15px;
  background: #000;
  margin: 0 auto 14px;
}

.auth__title { font-size: 21px; text-align: center; }

.auth__sub {
  font-size: 13.5px;
  color: var(--text-muted);
  text-align: center;
  margin: 6px 0 18px;
}

.auth__note {
  font-size: 12px;
  color: var(--text-faint);
  text-align: center;
  margin-top: 14px;
  line-height: 1.5;
}

.alert {
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 14px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  border: 1px solid transparent;
}
.alert--danger { background: var(--danger-soft); color: var(--danger); }
.alert--success { background: var(--success-soft); color: var(--success); }
.alert--quiet {
  background: var(--surface-sunken);
  color: var(--text-muted);
  font-size: 12.5px;
}

.btn--block { width: 100%; justify-content: center; }
.btn--danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn--danger:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .6; cursor: not-allowed; }

.card--danger { border-color: var(--danger); }

/* An input inside a form needs a visible focus ring of its own; the global
 * :focus-visible rule does not fire for text fields on every browser. */
.auth .field__control:focus,
.field__control:focus {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
  border-color: var(--brand);
}

.banners { margin-bottom: 16px; }
.banners .alert:last-child { margin-bottom: 0; }

/* ── Touch targets and small-screen refinements ────────────────────── */

/* Anything tappable needs to be reachable with a thumb. The audit found the
 * event filter pills at 37px; Apple and Google both put the floor at 44.
 * Applied by pointer type rather than width, so a touchscreen laptop gets it
 * too and a mouse user is not given needlessly chunky controls. */
@media (pointer: coarse), (max-width: 720px) {
  .filter-btn { min-height: 44px; padding: 0 16px; }
  .search__input { min-height: 44px; }
  .btn { min-height: 44px; }
  .field__control { min-height: 44px; }
  .icon-btn { width: 44px; height: 44px; }
}

/* ── Motion and finish ─────────────────────────────────────────────── */

.filter-btn,
.btn,
.search__input,
.field__control {
  transition: background .15s ease, color .15s ease,
              border-color .15s ease, box-shadow .15s ease;
}

.btn:active:not(:disabled),
.filter-btn:active { transform: translateY(1px); }

/* A pressed filter should look pressed, not merely coloured. */
.filter-btn[aria-pressed="true"] { box-shadow: var(--shadow-1); }

/* The brand mark gets a hairline so it does not float on a dark header. */
.brand__logo,
.auth__logo { box-shadow: 0 0 0 1px var(--border); }

/* Numbers that sit in a column should share one width per digit, or the
 * leaderboard jitters as the points change under a live listener. */
.stat__value,
.hero__points,
.lb__points,
.lb__rank { font-variant-numeric: tabular-nums; }

/* The medal glyph and a plain numeral have different metrics; centring both
 * on the same box keeps the column straight whatever is in it. */
.lb__rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* Cards holding text read better with a slightly looser measure. */
.item__body { line-height: 1.6; }

/* Keep a long announcement from becoming a wall of text on a wide screen. */
.item__title { text-wrap: balance; }

/* The auth card earns a little more lift than an ordinary card: it is the
 * only thing on the page. */
.auth { box-shadow: var(--shadow-2); }

/* Respect a reduced-motion preference for the new transforms too. */
@media (prefers-reduced-motion: reduce) {
  .grid--cards > .card:hover,
  .btn:active:not(:disabled),
  .filter-btn:active { transform: none; }
}

/* The save button and its in-flight hint sit on one line, so the hint does
 * not push the surrounding copy around as it appears and disappears. */
.saverow { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.saverow__hint { font-size: 13px; color: var(--text-muted); }
