/* ==========================================================================
   Existlist components.

   The shared parts every page is built from, drawn off Eli's asset pack
   (design/eli/Concepts/asset pack concepts NOT FINAL.png) and the page
   concepts beside it. Class names and markup are documented, with examples,
   in design/eli/ARCHITECTURE.md. Tokens live in tokens.css.

   Rules for this file:
   - A component is here only if two pages use it. Page-only styles go in
     public/pages/<page>.css, scoped under .pg-<page>.
   - Colours come from tokens. Mode colour comes from --mode-*.
   - Every interactive thing has a :focus-visible ring.
   ========================================================================== */

/* ---------- base ---------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--page-deep); }
body {
  margin: 0;
  background:
    radial-gradient(1200px 520px at 50% -180px, rgba(var(--mode-rgb), .07), transparent 70%),
    var(--page);
  background-attachment: fixed;
  color: var(--text);
  font: 400 var(--fs-base)/var(--lh-body) var(--font-ui);
  min-height: 100vh; min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior-y: none;
}
h1, h2, h3, h4 { font-family: var(--font-ui); font-weight: 700; line-height: var(--lh-snug); margin: 0; letter-spacing: -.01em; }
p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
h1, h2, h3, p, div, span, input, pre { min-width: 0; overflow-wrap: anywhere; }

:focus-visible {
  outline: 2px solid var(--mode-highlight);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}
.sr, .sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: var(--s-3); top: -60px; z-index: 100;
  background: var(--mode-primary); color: var(--mode-ink); padding: var(--s-2) var(--s-4);
  border-radius: var(--r-sm); font-weight: 700; text-decoration: none;
}
.skip-link:focus { top: var(--s-3); }

/* Icons from /ds/icons.svg, via ui.icon(name). */
.i { width: 1.25em; height: 1.25em; flex: 0 0 auto; display: inline-block; vertical-align: -.22em; fill: currentColor; }
.i-lg { width: 28px; height: 28px; }

/* ---------- layout -------------------------------------------------------- */

.page {
  width: 100%; max-width: var(--content); margin: 0 auto;
  padding: var(--s-6) calc(var(--gutter) + env(safe-area-inset-right)) var(--s-9) calc(var(--gutter) + env(safe-area-inset-left));
}
.page-narrow { max-width: calc(var(--content-narrow) + 2 * var(--gutter)); }
.page-mid { max-width: calc(820px + 2 * var(--gutter)); }
.stack > * + * { margin-top: var(--s-4); }
.row-flex { display: flex; align-items: center; gap: var(--s-3); }
.divider { height: 1px; background: var(--border); border: 0; margin: var(--s-7) 0; }

/* ---------- type ---------------------------------------------------------- */

/* Micro caps: REAL PEOPLE. REAL SCENARIOS. / CREW SCORE / RECENT BOARDS */
.eyebrow {
  font: 500 var(--fs-micro)/1.3 var(--font-label);
  letter-spacing: var(--track-micro); text-transform: uppercase;
  color: var(--text-2);
}
.eyebrow.is-mode { color: var(--mode-primary); }
.eyebrow.is-gold { color: var(--gold); }
.page-title { font: 800 var(--fs-3xl)/1.02 var(--font-ui); letter-spacing: -.025em; }
.page-sub { color: var(--text-2); font-size: var(--fs-md); margin-top: var(--s-2); }
.section-title { /* BEST EVER BOARD, FIRST DISCOVERIES */
  font: 700 22px/1.1 var(--font-display); letter-spacing: .04em; text-transform: uppercase;
}
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); margin-bottom: var(--s-3); }
.link-more { /* View all runs → */
  display: inline-flex; align-items: center; gap: 6px; color: var(--mode-primary);
  font: 600 var(--fs-sm)/1 var(--font-ui); text-decoration: none; background: none; border: 0; padding: 4px 0; cursor: pointer;
}
.link-more.is-caps { font: 500 var(--fs-xs)/1 var(--font-label); letter-spacing: var(--track-micro); text-transform: uppercase; color: var(--text-2); }
.link-more:hover { color: var(--mode-highlight); }
.muted { color: var(--text-2); }
.fine { color: var(--text-muted); font-size: var(--fs-xs); }

/* ---------- the wordmark -------------------------------------------------- */
/* Live text so Eli's vector can replace it in one place (ui.wordmark()). */
.wordmark {
  display: inline-flex; align-items: baseline; gap: 0;
  font: 800 30px/.9 var(--font-display); letter-spacing: -.005em; text-transform: uppercase;
  text-decoration: none; color: var(--brand-cream); white-space: nowrap;
}
.wordmark .wm-list {
  background: var(--brand-gradient); -webkit-background-clip: text; background-clip: text;
  color: transparent; -webkit-text-fill-color: transparent;
}
.wordmark.is-mono .wm-list { background: none; color: var(--brand-cream); -webkit-text-fill-color: currentColor; }
.wordmark.is-xl { font-size: clamp(56px, 13vw, 120px); }

/* ---------- buttons ------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-3);
  min-height: 44px; padding: 10px 18px; border-radius: var(--r-md);
  border: 1px solid transparent; background: none; cursor: pointer;
  font: 600 var(--fs-base)/1.2 var(--font-ui); text-decoration: none; text-align: left;
  transition: transform var(--t-fast) var(--ease-out), box-shadow var(--t-med) var(--ease-out),
              background-color var(--t-med), border-color var(--t-med), filter var(--t-med);
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; transform: none; }
.btn .btn-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.btn .btn-title { font-weight: 700; font-size: var(--fs-md); line-height: 1.2; display: inline-flex; align-items: center; gap: 8px; }
.btn .btn-sub { font-weight: 400; font-size: var(--fs-sm); line-height: 1.3; opacity: .78; }
.btn .i { width: 22px; height: 22px; }
.btn .btn-icon .i, .btn > .i.is-lead { width: 30px; height: 30px; }
.btn-block { display: flex; width: 100%; }

/* Primary: the one action per screen. Mode gradient, dark text on History. */
.btn-primary {
  background: var(--mode-gradient); color: var(--mode-ink);
  min-height: 56px; padding: 12px 22px; border-radius: var(--r-md);
  box-shadow: 0 10px 30px -12px rgba(var(--mode-rgb), .7), inset 0 1px 0 rgba(255,255,255,.25);
}
.btn-primary:hover { filter: brightness(1.06); box-shadow: 0 14px 36px -12px rgba(var(--mode-rgb), .85), inset 0 1px 0 rgba(255,255,255,.3); }
/* Always the orange, whatever the mode: Share / Continue to After Action Report. */
.btn-primary.is-brand { background: linear-gradient(180deg, #FFC04D 0%, #FFAE34 60%, #FF9F1C 100%); color: #1A0E04; --mode-rgb: 255,160,40; }
.btn-primary.is-center { justify-content: center; text-align: center; }
.btn-primary.is-center .btn-text { align-items: center; }

/* Secondary: dark card button with an icon and a subline. */
.btn-secondary {
  background: var(--surface); color: var(--text); border-color: var(--border);
  min-height: 56px; padding: 12px 22px;
}
.btn-secondary:hover { background: #202128; border-color: var(--hover); }

/* Outline: Send Feedback →, View scenario →, Edit Profile. */
.btn-outline {
  background: transparent; color: var(--text); border-color: var(--hover);
  min-height: 40px; padding: 8px 16px; font-size: var(--fs-sm);
}
.btn-outline:hover { border-color: var(--text-2); background: rgba(255,255,255,.03); }
.btn-outline.is-mode { color: var(--mode-primary); border-color: var(--mode-line); }
.btn-outline.is-mode:hover { box-shadow: var(--mode-glow); }
.btn-outline .i { width: 18px; height: 18px; }

/* Quiet: text-only action. */
.btn-quiet { background: none; border: 0; color: var(--text-2); min-height: 36px; padding: 6px 8px; font-weight: 500; }
.btn-quiet:hover { color: var(--text); }
.btn-quiet.is-underline { text-decoration: underline; text-underline-offset: 3px; }

/* Round icon button: header search / ? / a seat's collapse. */
.icon-btn, .btn-round {
  display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0;
  border-radius: 50%; border: 0; background: none; color: var(--text); cursor: pointer;
  transition: background-color var(--t-med), color var(--t-med), box-shadow var(--t-med);
}
.icon-btn:hover, .btn-round:hover { background: rgba(255,255,255,.06); }
.icon-btn .i, .btn-round .i { width: 24px; height: 24px; }
.btn-round.is-ringed { box-shadow: inset 0 0 0 2px var(--text-2); }
.btn-round.is-filled { background: var(--surface-2); width: 30px; height: 30px; }
.btn-round.is-filled .i { width: 16px; height: 16px; }
/* Square tool button from the asset pack (grid / clock / moon / ?). */
.btn-square {
  display: inline-grid; place-items: center; width: 56px; height: 40px; border-radius: var(--r-sm);
  background: var(--surface); border: 1px solid var(--border); color: var(--text-2); cursor: pointer;
}
.btn-square:hover { color: var(--text); border-color: var(--hover); }

/* ---------- pills, chips and tags ----------------------------------------- */

/* Mode pill: [🏛 HISTORY] [🎲 RERUNS]. Uses its own tone, not the page's. */
.mode-pill {
  display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 14px;
  border-radius: var(--r-sm); border: 1px solid var(--mode-line);
  background: var(--mode-tint); color: var(--mode-primary);
  font: 700 var(--fs-xs)/1 var(--font-label); letter-spacing: var(--track-caps); text-transform: uppercase;
  white-space: nowrap;
}
.mode-pill .i { width: 16px; height: 16px; }
.mode-pill.is-quiet { border-color: transparent; }
.mode-pill[data-tone="history"] { color: var(--gold-strong); border-color: rgba(245,181,61,.55); background: rgba(245,181,61,.10); }
.mode-pill[data-tone="reruns"] { color: #DDD6FE; border-color: rgba(139,92,246,.75); background: rgba(139,92,246,.20); }

/* Tag chips on the board: COMPLETE THE JOB (filled) · RERUNS · CORE DECK. */
.tag {
  display: inline-flex; align-items: center; height: 30px; padding: 0 14px; border-radius: var(--r-pill);
  border: 1px solid var(--hover); color: var(--text); background: transparent;
  font: 600 var(--fs-xs)/1 var(--font-label); letter-spacing: var(--track-caps); text-transform: uppercase; white-space: nowrap;
}
.tag.is-fill { background: var(--mode-gradient); border-color: transparent; color: var(--mode-ink); }
.tags { display: flex; flex-wrap: wrap; gap: var(--s-2); }

/* Constraint chips on a seat: ORIGIN / Live action. OPEN SEAT is neutral. */
.constraint {
  display: inline-flex; flex-direction: column; justify-content: center; gap: 2px;
  min-height: 48px; padding: 7px 15px; border-radius: var(--r-sm);
  background: rgba(59,130,246,.16); color: #93C5FD;
}
.constraint .c-k { font: 600 10px/1.1 var(--font-label); letter-spacing: .14em; text-transform: uppercase; color: #60A5FA; }
.constraint .c-v { font: 500 var(--fs-base)/1.2 var(--font-ui); color: #BFDBFE; }
body[data-mode="history"] .constraint, [data-tone="history"] .constraint { background: rgba(255,138,61,.13); }
body[data-mode="history"] .constraint .c-k, [data-tone="history"] .constraint .c-k { color: var(--history-primary); }
body[data-mode="history"] .constraint .c-v, [data-tone="history"] .constraint .c-v { color: var(--history-highlight); }
.constraint.is-open { background: var(--surface-2); }
.constraint.is-open .c-k { color: var(--text-2); }
.constraint.is-open .c-v { color: var(--text); font-weight: 600; }
.constraints { display: flex; flex-wrap: wrap; gap: var(--s-2); }

/* The beta pill beside the wordmark. */
.beta-pill {
  display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 6px;
  border: 1.5px solid var(--history-primary); color: var(--history-primary);
  font: 700 11px/1 var(--font-label); letter-spacing: .1em;
}

/* ---------- result tags: FIRST DISCOVERY / MVP / COST YOU ---------------- */

.result-tag {
  display: inline-flex; align-items: center; gap: 10px; min-height: 40px; padding: 8px 18px;
  border-radius: var(--r-sm); border: 1px solid; font: 700 var(--fs-sm)/1.1 var(--font-ui);
  text-transform: uppercase; letter-spacing: .02em; white-space: nowrap;
}
.result-tag .i { width: 22px; height: 22px; }
.result-tag.is-first { color: var(--gold-strong); background: var(--gold-bg); border-color: var(--gold-line); }
.result-tag.is-mvp   { color: var(--green-soft); background: var(--green-bg); border-color: var(--green-line); --medal-ink: var(--green-bg); }
.result-tag.is-cost  { color: var(--red-soft);  background: var(--red-bg);   border-color: var(--red-line); --alert-ink: var(--red-bg); }
.result-tag.is-first .i { color: var(--gold-strong); }
.result-tag.is-cost .i { color: var(--red); }
/* Inline mini version inside a card label row: ★ MVP / 🏆 FIRST DISCOVERY. */
.result-tag.is-mini { min-height: 22px; padding: 2px 9px; gap: 5px; font: 700 10.5px/1 var(--font-label); letter-spacing: .1em; border-radius: var(--r-pill); }
.result-tag.is-mini .i { width: 13px; height: 13px; }
.result-tag.is-mini.is-mvp { background: var(--green); color: #052E14; border-color: var(--green); --medal-ink: var(--green); }
.result-tag.is-mini.is-first { background: none; border-color: transparent; padding-left: 0; }

/* Summary tiles under the reveal: icon square + label + name. */
.tag-tile {
  display: flex; align-items: center; gap: var(--s-3); padding: 12px 14px;
  border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--border); min-width: 0;
}
.tag-tile .tt-icon { width: 48px; height: 48px; flex: 0 0 48px; border-radius: var(--r-sm); display: grid; place-items: center; }
.tag-tile .tt-icon .i { width: 28px; height: 28px; }
.tag-tile .tt-text { flex: 1; min-width: 0; }
.tag-tile .tt-k { display: block; font-weight: 700; font-size: var(--fs-base); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag-tile .tt-v { display: block; color: var(--text-2); font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag-tile.is-first .tt-icon { background: var(--gold-bg); color: var(--gold-strong); }
.tag-tile.is-mvp .tt-icon { background: var(--green-bg); color: var(--green); --medal-ink: var(--green-bg); }
.tag-tile.is-cost .tt-icon { background: var(--red-bg); color: var(--red); --alert-ink: var(--red-bg); }

/* ---------- stamps: APPROVED / COST YOU ------------------------------------ */

.stamp {
  display: inline-block; padding: 3px 10px 2px; transform: rotate(-16deg);
  font: 800 19px/1 var(--font-serif); letter-spacing: .06em; text-transform: uppercase;
  color: var(--green-soft); border: 2.5px solid currentColor; border-radius: 6px;
  background: rgba(10, 40, 20, .35);
  text-shadow: 0 0 10px rgba(34,197,94,.5); box-shadow: 0 0 14px -2px rgba(34,197,94,.45), inset 0 0 8px rgba(34,197,94,.25);
  mix-blend-mode: normal; user-select: none; pointer-events: none;
  -webkit-mask-image: repeating-linear-gradient(105deg, #000 0 3px, rgba(0,0,0,.82) 3px 4px);
          mask-image: repeating-linear-gradient(105deg, #000 0 3px, rgba(0,0,0,.82) 3px 4px);
}
/* COST YOU is red spaced caps, no box (the concept). */
.stamp.is-cost {
  transform: none; border: 0; background: none; box-shadow: none; padding: 0;
  font: 700 var(--fs-sm)/1 var(--font-label); letter-spacing: .18em; color: var(--red);
  text-shadow: 0 0 12px rgba(239,68,68,.55); -webkit-mask-image: none; mask-image: none;
}
/* Thump on. Pages add .is-thump when the card lands. */
@keyframes stamp-thump {
  0% { opacity: 0; transform: rotate(-16deg) scale(1.9); }
  60% { opacity: 1; transform: rotate(-16deg) scale(.94); }
  100% { opacity: 1; transform: rotate(-16deg) scale(1); }
}
.stamp.is-thump { animation: stamp-thump 360ms var(--ease-out) both; }
.stamp.is-cost.is-thump { animation-name: fade-in; }

/* ---------- cards --------------------------------------------------------- */

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: var(--s-5); box-shadow: var(--shadow-1);
}
.card.is-flat { box-shadow: none; }
.card.is-sunk { background: var(--surface-2); }
/* The lit card: History mode card, today's archive row, your leaderboard row. */
.card.is-mode, .is-lit {
  border-color: var(--mode-line);
  background: linear-gradient(90deg, rgba(var(--mode-rgb), .16), rgba(var(--mode-rgb), .04) 70%), var(--surface);
  box-shadow: var(--mode-glow);
}
a.card, button.card { display: block; color: inherit; text-decoration: none; text-align: left; width: 100%; cursor: pointer; font: inherit; }
a.card:hover, button.card:hover { border-color: var(--hover); }
a.card.is-mode:hover, button.card.is-mode:hover { border-color: var(--mode-primary); }

/* Icon tile: the square that sits at the left of a mode card / archive row. */
.icon-tile {
  width: 64px; height: 64px; flex: 0 0 64px; border-radius: var(--r-md); display: grid; place-items: center;
  background: var(--surface-2); color: var(--text);
}
.icon-tile .i { width: 32px; height: 32px; }
.icon-tile.is-mode { background: var(--mode-tint); color: var(--mode-primary); }
.icon-tile.is-lg { width: 120px; height: 120px; flex-basis: 120px; border-radius: var(--r-lg); }
.icon-tile.is-lg .i { width: 64px; height: 64px; }

/* ---------- list rows ------------------------------------------------------ */
/* Archive / recent boards / leaderboard rows. A row is a link when it goes somewhere. */
.list { display: flex; flex-direction: column; gap: var(--s-2); list-style: none; margin: 0; padding: 0; }
.list-row {
  display: flex; align-items: center; gap: var(--s-4); min-height: 64px; padding: 10px 14px;
  border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--border);
  color: inherit; text-decoration: none;
}
a.list-row:hover, button.list-row:hover { border-color: var(--hover); background: #1D1E23; }
button.list-row { width: 100%; font: inherit; text-align: left; cursor: pointer; }
.list-row .lr-main { flex: 1; min-width: 0; }
.list-row .lr-title { font-weight: 700; font-size: var(--fs-md); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .lr-meta { font: 500 var(--fs-xs)/1.3 var(--font-label); letter-spacing: .14em; text-transform: uppercase; color: var(--text-2); margin-top: 2px; }
.list-row .lr-chev { color: var(--text-2); }
.list-row.is-lit { border-color: var(--mode-line); }

/* ---------- score badge ---------------------------------------------------- */
/* <span class="score-badge" data-band="good">82</span>. ui.scoreBadge(n) sets the band. */
.score-badge {
  --band: var(--band-good);
  display: inline-grid; place-items: center; min-width: 48px; height: 40px; padding: 0 8px;
  border-radius: var(--r-sm); border: 1.5px solid var(--band); color: var(--band);
  background: color-mix(in srgb, var(--band) 10%, transparent);
  font: 700 var(--fs-lg)/1 var(--font-ui); font-variant-numeric: tabular-nums;
}
.score-badge[data-band="great"] { --band: var(--band-great); }
.score-badge[data-band="good"]  { --band: var(--band-good); }
.score-badge[data-band="mid"]   { --band: var(--band-mid); }
.score-badge[data-band="low"]   { --band: var(--band-low); }
.score-badge.is-solid { background: var(--band); color: #0B0B0E; border-color: transparent; }
.score-badge.is-sm { min-width: 38px; height: 32px; font-size: var(--fs-md); }
.score-badge.is-lg { min-width: 88px; height: 88px; flex-direction: column; font-size: 40px; border-width: 2px; border-radius: var(--r-md); }
.score-badge.is-lg small { font: 500 var(--fs-xs)/1 var(--font-label); color: var(--text-2); }
.score-text[data-band="great"] { color: var(--band-great); }
.score-text[data-band="good"]  { color: var(--band-good); }
.score-text[data-band="mid"]   { color: var(--band-mid); }
.score-text[data-band="low"]   { color: var(--band-low); }

/* The crew-score bar under the reveal number. Fill width = score %. */
.score-bar { height: 10px; border-radius: var(--r-pill); background: var(--surface-2); overflow: hidden; }
.score-bar > i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--band, var(--band-good)); transition: width 900ms var(--ease-out); }
.score-bar[data-band="great"] { --band: var(--band-great); }
.score-bar[data-band="good"]  { --band: var(--band-good); }
.score-bar[data-band="mid"]   { --band: var(--band-mid); }
.score-bar[data-band="low"]   { --band: var(--band-low); }

/* ---------- crowns, avatars, portrait chips -------------------------------- */

.crown { display: inline-grid; place-items: center; width: 28px; height: 28px; }
.crown .i { width: 24px; height: 24px; }
.crown.is-1 { color: var(--gold-strong); filter: drop-shadow(0 0 6px rgba(245,181,61,.5)); }
.crown.is-2 { color: var(--silver); filter: drop-shadow(0 0 6px rgba(203,213,225,.35)); }
.crown.is-3 { color: var(--bronze); filter: drop-shadow(0 0 6px rgba(240,138,75,.45)); }

/* Avatar initial: a circle with a thin coloured ring. ui.avatar(name) picks the hue. */
.avatar {
  --av: 220; display: inline-grid; place-items: center; width: 40px; height: 40px; flex: 0 0 40px;
  border-radius: 50%; background: hsl(var(--av) 30% 16%); color: var(--text);
  box-shadow: inset 0 0 0 1.5px hsl(var(--av) 55% 55% / .75);
  font: 600 var(--fs-md)/1 var(--font-ui); text-transform: uppercase; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.is-sm { width: 28px; height: 28px; flex-basis: 28px; font-size: var(--fs-xs); }
.avatar.is-lg { width: 120px; height: 120px; flex-basis: 120px; font-size: 44px; box-shadow: 0 0 0 3px var(--mode-primary), 0 0 30px -6px rgba(var(--mode-rgb), .7); }
.avatar.is-me { box-shadow: inset 0 0 0 2px var(--mode-primary); }

/* Portrait chip: a crew member's face, or their monogram, in a small square. */
.portrait-chip {
  width: 40px; height: 40px; flex: 0 0 40px; border-radius: var(--r-sm); overflow: hidden;
  background: var(--surface-2); color: var(--text-muted); display: grid; place-items: center;
  font: 600 var(--fs-xs)/1 var(--font-ui);
}
.portrait-chip img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(1) contrast(1.05); }
.portrait-chip .i { width: 22px; height: 22px; }
.portrait-chips { display: flex; gap: 6px; }

/* ---------- segmented controls -------------------------------------------- */

/* The mode switch: History (book) / Reruns (dice). Board and archive. */
.mode-switch {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
}
.mode-switch button, .mode-switch a {
  display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 60px; padding: 8px 12px;
  border-radius: calc(var(--r-lg) - 4px); border: 1.5px solid transparent; background: none;
  color: var(--text-2); cursor: pointer; text-decoration: none; text-align: left;
  transition: background-color var(--t-med), color var(--t-med), box-shadow var(--t-med), border-color var(--t-med);
}
.mode-switch .ms-name { display: block; font: 600 var(--fs-md)/1.2 var(--font-ui); }
.mode-switch .ms-sub { display: block; font-size: var(--fs-xs); line-height: 1.3; opacity: .85; }
.mode-switch .i { width: 26px; height: 26px; --dice-pip: var(--surface); }
.mode-switch button:hover, .mode-switch a:hover { color: var(--text); }
.mode-switch [aria-pressed="true"], .mode-switch [aria-current="page"] {
  color: var(--text); border-color: var(--mode-primary);
  background: linear-gradient(180deg, rgba(var(--mode-rgb), .14), rgba(var(--mode-rgb), .05));
  box-shadow: 0 0 0 1px rgba(var(--mode-rgb), .35), 0 0 28px -6px rgba(var(--mode-rgb), .75);
}
.mode-switch [aria-pressed="true"] .i, .mode-switch [aria-current="page"] .i { --dice-pip: #1A1530; }
.mode-switch.is-compact button, .mode-switch.is-compact a { min-height: 44px; }

/* Plain segmented tabs: Today / This Week / All Time, Global / Friends. */
.seg { display: inline-flex; gap: 4px; padding: 3px; border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--border); }
.seg button, .seg a {
  min-height: 34px; padding: 0 16px; border-radius: 6px; border: 1px solid transparent; background: none;
  color: var(--text-2); font: 500 var(--fs-sm)/1 var(--font-ui); cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center;
}
.seg [aria-pressed="true"], .seg [aria-selected="true"], .seg [aria-current="page"] {
  color: var(--mode-primary); border-color: var(--mode-primary); background: var(--mode-tint);
}

/* ---------- dropdown ------------------------------------------------------- */
/* A styled native <select>: accessible, keyboard-able, no JS. */
.select { position: relative; display: inline-flex; }
.select select {
  appearance: none; -webkit-appearance: none; min-height: 42px; padding: 0 40px 0 16px;
  border-radius: var(--r-sm); border: 1px solid var(--hover); background: var(--surface); color: var(--text);
  font: 500 var(--fs-base)/1 var(--font-ui); cursor: pointer;
}
.select .i { position: absolute; right: 12px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); pointer-events: none; color: var(--text-2); }
.select.is-mode select { color: var(--mode-primary); border-color: var(--mode-line); font: 600 var(--fs-sm)/1 var(--font-label); letter-spacing: var(--track-caps); text-transform: uppercase; }
.select.is-mode .i { color: var(--mode-primary); }
.select select:hover { border-color: var(--text-2); }

/* ---------- inputs ---------------------------------------------------------- */
.input {
  width: 100%; min-height: 50px; padding: 12px 16px; border-radius: var(--r-md);
  background: var(--page-deep); border: 1px solid var(--border); color: var(--text);
  font: 400 var(--fs-md)/1.3 var(--font-ui);
}
.input::placeholder { color: var(--text-muted); }
.input:focus { outline: none; border-color: var(--mode-primary); box-shadow: 0 0 0 3px rgba(var(--mode-rgb), .22); }

/* ---------- banners ---------------------------------------------------------- */
.notice {
  display: flex; align-items: flex-start; gap: var(--s-4); padding: var(--s-4) var(--s-5);
  border-radius: var(--r-lg); border: 1px solid var(--gold-line);
  background: linear-gradient(90deg, rgba(245,181,61,.10), rgba(245,181,61,.03)), var(--surface);
}
.notice .notice-icon { width: 52px; height: 52px; flex: 0 0 52px; border-radius: var(--r-sm); display: grid; place-items: center; background: rgba(245,181,61,.12); color: var(--gold-strong); }
.notice .notice-icon .i { width: 30px; height: 30px; }

/* ---------- empty states ------------------------------------------------------ */
.empty {
  text-align: center; padding: var(--s-7) var(--s-5); border-radius: var(--r-lg);
  border: 1px dashed var(--hover); color: var(--text-2);
}
.empty .empty-title { color: var(--text); font-weight: 700; font-size: var(--fs-md); margin-bottom: 4px; }

/* ---------- skeleton ---------------------------------------------------------- */
.skel { background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; border-radius: var(--r-md); animation: skel 1.3s linear infinite; }
@keyframes skel { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- motion helpers ----------------------------------------------------- */
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.enter { animation: rise-in var(--t-slow) var(--ease-out) both; }
.enter-stagger > * { animation: rise-in var(--t-slow) var(--ease-out) both; }
.enter-stagger > *:nth-child(2) { animation-delay: 60ms; }
.enter-stagger > *:nth-child(3) { animation-delay: 120ms; }
.enter-stagger > *:nth-child(4) { animation-delay: 180ms; }
.enter-stagger > *:nth-child(5) { animation-delay: 240ms; }
.enter-stagger > *:nth-child(6) { animation-delay: 300ms; }

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