/* The Board — Andy. Collector edition: royal blue, restrained game energy.
   Royal blue is Andy's pick. Tokens mirror the approved layout sketch. */

:root {
  --font-body: 'Satoshi', system-ui, sans-serif;
  --font-display: 'Cabinet Grotesk', 'Satoshi', system-ui, sans-serif;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: clamp(1.55rem, 1.15rem + 1.2vw, 2.2rem);
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 20px;
  --s6: 24px;
  --s8: 32px;
  --s10: 40px;

  --bg: #f0f3ff;
  --panel: #ffffff;
  --ink: #16264b;
  --muted: #526280;
  --line: #243e7826;
  --accent: #2451e6;
  --tint: #e3eaff;
  --nav: #122763;
  --navtext: #f0f4ff;
  --navmuted: #b6c6f0;

  --success: #1d7a4c;
  --success-bg: #d8f0e2;
  --warn: #8a5000;
  --warn-bg: #ffefc3;
  --danger: #a32036;
  --danger-bg: #ffe2e6;
  --text-faint: #8493b0;
  --gold: #b07000;
}

[data-theme='dark'] {
  --bg: #0b1530;
  --panel: #132342;
  --ink: #f0f4ff;
  --muted: #b3c2e1;
  --line: #b6caff30;
  --accent: #a8c0ff;
  --tint: #203765;
  --nav: #071129;
  --navtext: #f0f4ff;
  --navmuted: #9db0dc;

  --success: #6fd79f;
  --success-bg: #14402c;
  --warn: #ffde96;
  --warn-bg: #473618;
  --danger: #ff9fae;
  --danger-bg: #4a1a24;
  --text-faint: #8798bd;
  --gold: #ffcf70;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
body,
h1,
h2,
h3,
p,
ul,
ol {
  margin: 0;
}
body {
  font: var(--text-base) / 1.55 var(--font-body);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  border: 0;
  background: none;
}
button,
a,
select {
  touch-action: manipulation;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}
h1 {
  font: 800 var(--text-xl) / 1.12 var(--font-display);
  letter-spacing: -0.025em;
}
h2 {
  font-size: var(--text-lg);
  line-height: 1.3;
}
h3 {
  font-size: var(--text-base);
  line-height: 1.35;
}
[hidden] {
  display: none !important;
}
.muted {
  color: var(--muted);
}
.eyebrow {
  display: block;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.11em;
  color: var(--muted);
  margin-bottom: var(--s2);
}
.footnote {
  font-size: var(--text-xs);
  color: var(--muted);
  margin-top: var(--s5);
  line-height: 1.6;
}
.skip {
  position: absolute;
  left: 12px;
  top: -60px;
  background: var(--panel);
  color: var(--ink);
  padding: var(--s3);
  z-index: 40;
  border-radius: 6px;
}
.skip:focus {
  top: 8px;
}

/* ── Lock ───────────────────────────────────────────────── */
.lock {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--s6);
  background: radial-gradient(circle at 50% 0%, var(--tint), var(--bg) 60%);
}
.lock-card {
  width: 100%;
  max-width: 372px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: var(--s8) var(--s6);
  display: grid;
  gap: var(--s4);
  justify-items: center;
  text-align: center;
  box-shadow: 0 18px 40px #0e1c4014;
  color: var(--accent);
}
.lock-card h1 {
  color: var(--ink);
}
.lock-card p {
  color: var(--muted);
  font-size: var(--text-sm);
}
.lock-card input[type='password'] {
  width: 100%;
  padding: var(--s3) var(--s4);
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg);
  color: var(--ink);
}
.lock-remember {
  display: flex;
  align-items: center;
  gap: var(--s2);
  font-size: var(--text-xs);
  color: var(--muted);
}
.lock-remember input {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
}
.lock-card .act {
  width: 100%;
}
.lock-msg {
  font-size: var(--text-xs);
  color: var(--danger);
  min-height: 18px;
}

/* ── Shell ──────────────────────────────────────────────── */
.shell {
  display: grid;
  grid-template-columns: 234px minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  background: var(--nav);
  color: var(--navtext);
  padding: var(--s8) var(--s5);
  display: flex;
  flex-direction: column;
  gap: var(--s8);
}
.brand {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--s1) var(--s3);
  align-items: center;
  font: 900 var(--text-lg) / 1.1 var(--font-display);
  letter-spacing: 0.09em;
}
.brand svg {
  flex-shrink: 0;
}
/* Subtitle spans the full sidebar width instead of squeezing beside the mark. */
.brand small {
  grid-column: 1 / -1;
  display: block;
  font: 500 var(--text-xs) / 1.5 var(--font-body);
  letter-spacing: 0.02em;
  color: var(--navmuted);
  margin-top: var(--s2);
  text-wrap: balance;
}
nav {
  display: grid;
  gap: var(--s2);
}
nav button {
  min-height: 52px;
  text-align: left;
  padding: var(--s3);
  display: flex;
  align-items: center;
  gap: var(--s3);
  color: inherit;
  border-radius: 7px;
  font-size: var(--text-sm);
  font-weight: 500;
}
nav button:hover {
  background: #ffffff14;
}
nav button[aria-current='page'] {
  background: var(--navtext);
  color: var(--nav);
  font-weight: 700;
}
.navnum {
  font-size: var(--text-xs);
  opacity: 0.6;
}
.navcount {
  margin-left: auto;
  font-size: var(--text-xs);
  font-weight: 700;
}
.sidebar-bottom {
  margin-top: auto;
  display: grid;
  gap: var(--s4);
}
.collector-mark {
  border-top: 1px solid #ffffff26;
  padding-top: var(--s5);
}
.collector-mark strong {
  font: 800 var(--text-xl) / 1 var(--font-display);
}
.collector-mark strong span {
  font: 400 var(--text-xs) / 1 var(--font-body);
}
.collector-mark p {
  font-size: var(--text-xs);
  color: var(--navmuted);
  margin-top: var(--s3);
}
.mini-track {
  display: flex;
  gap: 3px;
  margin-top: var(--s3);
}
.mini-track i {
  height: 5px;
  flex: 1;
  border-radius: 2px;
  background: #ffffff26;
}
.mini-track i.on {
  background: #9fe6c0;
}
#theme {
  min-height: 44px;
  color: var(--navmuted);
  font-size: var(--text-xs);
  text-align: left;
  text-decoration: underline;
}
.sidebar-bottom small {
  display: block;
  font-size: var(--text-xs);
  line-height: 1.5;
  color: var(--navmuted);
}

.main-col {
  padding: var(--s6) clamp(18px, 3.2vw, 46px) var(--s10);
  max-width: 1180px;
  width: 100%;
  min-width: 0;
}
.view {
  min-width: 0;
}
.pagehead {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--s5);
  margin-bottom: var(--s6);
  flex-wrap: wrap;
}
.pagehead p.muted {
  margin-top: var(--s2);
  font-size: var(--text-sm);
}

/* ── Buttons ────────────────────────────────────────────── */
.act,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  padding: var(--s3) var(--s5);
  min-height: 44px;
  border-radius: 7px;
  font-size: var(--text-sm);
  font-weight: 700;
  background: var(--accent);
  color: var(--panel);
  text-decoration: none;
  white-space: nowrap;
}
[data-theme='dark'] .act,
[data-theme='dark'] .button {
  color: #0b1530;
}
.act:hover,
.button:hover {
  filter: brightness(0.94);
}
.button.quiet,
.act[data-variant='ghost'] {
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
}
.button.quiet:hover,
.act[data-variant='ghost']:hover {
  background: var(--tint);
  filter: none;
}
.ctrl {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  flex-wrap: wrap;
  min-width: 0;
  max-width: 100%;
  min-height: 40px;
  padding: var(--s2) var(--s3);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--muted);
}
.ctrl:hover {
  background: var(--tint);
  color: var(--ink);
}

/* ── Warn bar / greeting / verdict ──────────────────────── */
.warnbar {
  background: var(--warn-bg);
  color: var(--warn);
  padding: var(--s3) var(--s4);
  border-radius: 7px;
  font-size: var(--text-sm);
  margin-bottom: var(--s5);
}
.greet {
  background: var(--tint);
  border-radius: 8px;
  padding: var(--s4) var(--s5);
  margin-bottom: var(--s5);
}
.greet-kind {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.greet-text {
  margin-top: var(--s1);
  font-size: var(--text-sm);
}
.verdict {
  display: flex;
  gap: var(--s5);
  align-items: center;
  padding: var(--s6);
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  border-radius: 9px;
  margin-bottom: var(--s8);
}
.verdict-num {
  font: 900 clamp(2.2rem, 1.6rem + 2vw, 3.1rem) / 1 var(--font-display);
  color: var(--accent);
}
.verdict h2 {
  font-family: var(--font-display);
}
.verdict p {
  font-size: var(--text-sm);
  color: var(--muted);
  margin-top: var(--s1);
}

/* ── Sections & items ───────────────────────────────────── */
section + section,
.view > section {
  margin-top: var(--s8);
}
.sec-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--s3);
  padding-bottom: var(--s2);
  border-bottom: 1px solid var(--line);
}
.sec-head h2 {
  font-family: var(--font-display);
}
.sec-head span {
  font-size: var(--text-xs);
  color: var(--muted);
  white-space: nowrap;
}
.sec-note {
  font-size: var(--text-sm);
  color: var(--muted);
  margin: var(--s3) 0;
  max-width: 74ch;
}
.list {
  display: grid;
  gap: var(--s3);
  margin-top: var(--s4);
}
.item {
  display: flex;
  gap: var(--s4);
  align-items: flex-start;
  flex-wrap: wrap;
  padding: var(--s4) var(--s5);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.item[data-tone='bad'] {
  border-left: 4px solid var(--danger);
}
.item[data-tone='warn'] {
  border-left: 4px solid var(--warn);
}
.item[data-tone='good'] {
  border-left: 4px solid var(--success);
}
.item-main {
  flex: 1 1 190px;
  min-width: 0;
}
.item-name {
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  align-items: center;
  margin-top: var(--s2);
  font-size: var(--text-xs);
  color: var(--muted);
}
.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}
.note {
  font-size: var(--text-xs);
  color: var(--muted);
  margin-top: var(--s2);
  line-height: 1.5;
}
.badge {
  display: inline-block;
  padding: 2px var(--s2);
  border-radius: 4px;
  background: var(--tint);
  color: var(--ink);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.5;
}
.badge[data-tone='bad'] {
  background: var(--danger-bg);
  color: var(--danger);
}
.badge[data-tone='warn'] {
  background: var(--warn-bg);
  color: var(--warn);
}
.badge[data-tone='good'] {
  background: var(--success-bg);
  color: var(--success);
}
.tick {
  display: flex;
  align-items: center;
  gap: var(--s2);
  font-size: var(--text-xs);
  color: var(--muted);
  min-height: 44px;
  cursor: pointer;
}
.tick input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  flex-shrink: 0;
}
.pick {
  padding: var(--s2) var(--s3);
  min-height: 40px;
  min-width: 0;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  font-size: var(--text-xs);
}
.empty {
  padding: var(--s5);
  border: 1px dashed var(--line);
  border-radius: 8px;
  font-size: var(--text-sm);
  color: var(--muted);
  text-align: center;
}

/* ── Habit / feedback / foot ────────────────────────────── */
.habit,
.feedback {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: var(--s6);
}
.habit h2,
.feedback h2 {
  font-family: var(--font-display);
}
.habit p,
.feedback p {
  font-size: var(--text-sm);
  color: var(--muted);
  margin-top: var(--s2);
  max-width: 74ch;
}
.habit ol {
  margin-top: var(--s4);
  padding-left: 0;
  list-style: none;
  counter-reset: h;
  display: grid;
  gap: var(--s3);
}
.habit li {
  counter-increment: h;
  display: flex;
  gap: var(--s3);
  font-size: var(--text-sm);
}
.habit li::before {
  content: counter(h);
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--tint);
  color: var(--accent);
  font-size: var(--text-xs);
  font-weight: 700;
}
.feedback .act {
  margin-top: var(--s4);
}
.foot {
  margin-top: var(--s8);
  padding-top: var(--s5);
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--s5);
  font-size: var(--text-xs);
  color: var(--muted);
  flex-wrap: wrap;
}
.foot span {
  max-width: 78ch;
  line-height: 1.6;
}
#reset {
  text-decoration: underline;
  color: var(--muted);
  min-height: 44px;
  white-space: nowrap;
}

/* ── Grades ─────────────────────────────────────────────── */
.source-strip {
  display: flex;
  justify-content: space-between;
  gap: var(--s4);
  padding: var(--s3) 0;
  border-block: 1px solid var(--line);
  font-size: var(--text-xs);
  color: var(--muted);
  margin-bottom: var(--s6);
  flex-wrap: wrap;
}
.source-strip .dot {
  margin-right: var(--s2);
}
.collection-total strong {
  font: 800 var(--text-lg) / 1 var(--font-display);
  color: var(--ink);
}
.grades {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: var(--s5);
}
.gcard {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: var(--s5);
  min-width: 0;
}
.gcard-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--s3);
}
.gcard-name {
  font-weight: 700;
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
}
.gcard-pct {
  font: 800 var(--text-lg) / 1 var(--font-display);
  white-space: nowrap;
}
.gcard-teacher {
  font-size: var(--text-xs);
  color: var(--muted);
  margin-top: var(--s1);
}
.bar {
  height: 7px;
  border-radius: 4px;
  background: var(--tint);
  overflow: hidden;
  margin-top: var(--s4);
}
.bar i {
  display: block;
  height: 100%;
  border-radius: 4px;
}
.gcard-flag {
  margin-top: var(--s3);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--danger);
}
/* trend chart appended by app.js */
.trend {
  margin-top: var(--s4);
  padding-top: var(--s4);
  border-top: 1px solid var(--line);
}
.trend-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--s2);
  font-size: var(--text-xs);
  color: var(--muted);
  margin-bottom: var(--s2);
}
.trend-move {
  font-weight: 700;
}
.trend-move[data-dir='up'] {
  color: var(--success);
}
.trend-move[data-dir='down'] {
  color: var(--danger);
}
.trend svg {
  display: block;
  width: 100%;
  height: 76px;
  overflow: visible;
}
.trend svg circle {
  cursor: pointer;
}
.trend-read {
  font-size: var(--text-xs);
  color: var(--muted);
  min-height: 32px;
  margin-top: var(--s2);
  line-height: 1.45;
}
.trend-flat {
  font-size: var(--text-xs);
  color: var(--muted);
  padding: var(--s4) 0;
}

/* ── Collection ─────────────────────────────────────────── */
.progress {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: var(--s6);
}
.streak {
  display: flex;
  gap: var(--s5);
  align-items: center;
}
.streak-num {
  font: 900 clamp(2.4rem, 1.8rem + 2.2vw, 3.4rem) / 1 var(--font-display);
  color: var(--accent);
}
.streak-head {
  display: flex;
  align-items: center;
  gap: var(--s2);
  font-weight: 700;
}
.streak-flame {
  font-size: var(--text-sm);
}
.streak-copy p {
  font-size: var(--text-sm);
  color: var(--muted);
  margin-top: var(--s1);
}
.streak-track {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: var(--s5);
}
.streak-track i {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  background: var(--danger);
}
.streak-track i[data-ok='1'] {
  background: var(--success);
}
.track-key {
  font-size: var(--text-xs);
  color: var(--muted);
  margin-top: var(--s3);
}
.badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  margin-top: var(--s5);
}
.badges .badge {
  padding: var(--s2) var(--s3);
  background: var(--tint);
  font-weight: 700;
}
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--s5);
  margin-top: var(--s6);
  padding-top: var(--s5);
  border-top: 1px solid var(--line);
}
/* Engine emits .stat-big and .stat-small as inline spans; force the label
   onto its own line so a long label cannot collide with the number. */
.stat {
  min-width: 0;
}
.stat-big {
  display: block;
  font: 800 var(--text-xl) / 1.05 var(--font-display);
}
.stat-small {
  display: block;
  font-size: var(--text-xs);
  color: var(--muted);
  margin-top: var(--s2);
  line-height: 1.45;
}
.wins-label {
  display: block;
  margin-top: var(--s6);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.wins {
  list-style: none;
  padding: 0;
  margin-top: var(--s3);
  display: grid;
  gap: var(--s2);
}
.wins li {
  font-size: var(--text-sm);
  padding-left: var(--s4);
  position: relative;
}
.wins li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
}
.progress-foot {
  margin-top: var(--s6);
  padding-top: var(--s4);
  border-top: 1px solid var(--line);
  font-size: var(--text-xs);
  color: var(--muted);
  line-height: 1.6;
}

/* binder: original placeholder card art, pending a real catalog */
.binder {
  margin-top: var(--s8);
}
.binder-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--s3);
  padding-bottom: var(--s2);
  border-bottom: 1px solid var(--line);
  margin-bottom: var(--s4);
}
.binder-head h2 {
  font-family: var(--font-display);
}
.binder-head span {
  font-size: var(--text-xs);
  color: var(--muted);
}
.binder-note {
  font-size: var(--text-sm);
  color: var(--muted);
  margin-bottom: var(--s5);
  max-width: 74ch;
}
.slots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(124px, 1fr));
  gap: var(--s4);
}
.slot {
  aspect-ratio: 2.5 / 3.5;
  border-radius: 6px;
  background: var(--tint);
  border: 2px dashed var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  padding: var(--s3);
  text-align: center;
}
.slot b {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.25;
}
.slot small {
  font-size: var(--text-xs);
  color: var(--muted);
  line-height: 1.3;
}
.baseball {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: var(--panel);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}
.baseball::before,
.baseball::after {
  content: '';
  position: absolute;
  border: 2px dashed var(--accent);
  border-radius: 50%;
  height: 140%;
  width: 65%;
  top: -20%;
  opacity: 0.75;
}
.baseball::before {
  left: -39%;
}
.baseball::after {
  right: -39%;
}

/* ── Mail sheet ─────────────────────────────────────────── */
.mailbar {
  position: fixed;
  left: 50%;
  bottom: var(--s5);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s3) var(--s4);
  background: var(--nav);
  color: var(--navtext);
  border-radius: 10px;
  box-shadow: 0 12px 30px #06102c40;
  z-index: 30;
  max-width: calc(100vw - 32px);
  flex-wrap: wrap;
  justify-content: center;
}
.mailbar span {
  font-size: var(--text-xs);
  font-weight: 600;
}
.overlay {
  position: fixed;
  inset: 0;
  background: #06102ca8;
  display: grid;
  place-items: center;
  padding: var(--s5);
  z-index: 50;
}
.sheet {
  background: var(--panel);
  border-radius: 11px;
  border: 1px solid var(--line);
  width: 100%;
  max-width: 660px;
  max-height: 86vh;
  overflow: auto;
  padding: var(--s6);
}
.sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--s4);
}
.sheet-head h2 {
  font-family: var(--font-display);
}
.sheet-note {
  font-size: var(--text-sm);
  color: var(--muted);
  margin-top: var(--s3);
  line-height: 1.6;
}
.mail {
  display: grid;
  gap: var(--s5);
  margin-top: var(--s5);
}
.mail-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: var(--s4);
  background: var(--bg);
}
.mail-label {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--muted);
  display: block;
  margin-bottom: var(--s2);
}
.mail-block textarea {
  width: 100%;
  min-height: 220px;
  padding: var(--s3);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  font-size: var(--text-sm);
  line-height: 1.55;
  resize: vertical;
}
.sheet-foot {
  display: flex;
  gap: var(--s3);
  justify-content: flex-end;
  margin-top: var(--s5);
  flex-wrap: wrap;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 860px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
  }
  .sidebar {
    gap: var(--s5);
    padding: var(--s5);
  }
  .sidebar-bottom {
    margin-top: var(--s3);
  }
  nav {
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: var(--s1);
  }
  nav button {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    min-height: 58px;
    font-size: var(--text-xs);
    padding: var(--s2);
  }
  .navcount {
    margin-left: 0;
  }
  /* On a phone the sidebar sits above the work, so keep it to a thin strip:
     the streak headline and theme toggle stay, the detail moves out of the way
     (the same freshness stamp is still in the footer). */
  .collector-mark {
    padding-top: var(--s4);
    display: flex;
    align-items: baseline;
    gap: var(--s3);
  }
  .collector-mark p,
  .mini-track,
  .sidebar-bottom small {
    display: none;
  }
  .sidebar-bottom {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--s4);
  }
  #theme {
    margin: 0;
  }
  .main-col {
    padding: var(--s5) var(--s4) var(--s10);
  }
  .verdict {
    padding: var(--s5);
    gap: var(--s4);
  }
  .item {
    padding: var(--s4);
  }
  .mailbar {
    bottom: var(--s3);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .view {
    animation: rise 0.22s ease-out;
  }
  @keyframes rise {
    from {
      opacity: 0;
      transform: translateY(5px);
    }
    to {
      opacity: 1;
      transform: none;
    }
  }
}

/* Sourced card catalog. These are digital trophies, never a cash balance. */
.collection-meter{display:flex;align-items:center;gap:20px;margin:24px 0 16px}
.collection-meter>strong{font:900 3rem/1 var(--font-display);color:var(--accent)}
.collection-meter p{font-size:var(--text-sm);color:var(--muted);margin-top:4px}
#binder>progress{display:block;width:100%;height:10px;accent-color:var(--accent);margin-bottom:16px;border:0;border-radius:5px}
#binder>progress::-webkit-progress-bar{background:var(--tint);border-radius:5px}
#binder>progress::-webkit-progress-value{background:var(--accent);border-radius:5px}
.collection-rules,.school-record{padding:16px 0;margin:20px 0;border-block:1px solid var(--line)}
.collection-rules summary,.school-record summary{cursor:pointer;font-size:var(--text-sm);font-weight:700;min-height:32px}
.collection-rules ul{padding-left:22px;display:grid;gap:10px;margin-top:12px;font-size:var(--text-sm);color:var(--muted);max-width:80ch}
.card-catalog{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:20px}
.catalog-card{min-width:0;text-align:left;display:flex;flex-direction:column;gap:8px;padding:16px;border:1px solid var(--line);border-radius:10px;background:var(--panel);transition:border-color .15s}
.catalog-card:hover{border-color:var(--accent)}
.catalog-card img{width:100%;height:260px;object-fit:contain;margin:8px 0 12px}
.catalog-card.locked img{filter:grayscale(.85);opacity:.7}
.catalog-card.earned{border-color:var(--gold)}
.catalog-card>b{font:800 1.25rem/1.2 var(--font-display)}
.card-state{font-size:var(--text-xs);font-weight:700;letter-spacing:.04em;color:var(--muted)}
.earned .card-state{color:var(--gold)}
.card-issue,.card-sale{font-size:var(--text-xs);color:var(--muted)}
.card-learn{font-size:var(--text-xs);font-weight:700;color:var(--accent);padding-top:8px;margin-top:auto}
.catalog-sheet{max-width:880px}
.card-detail{display:grid;grid-template-columns:minmax(180px,.8fr) minmax(0,1.2fr);gap:28px;margin-top:24px}
.card-detail figure{margin:0;min-width:0}
.card-detail img{width:100%;max-height:480px;object-fit:contain}
.card-detail figcaption{font-size:var(--text-xs);color:var(--muted);margin-top:12px;line-height:1.6}
.card-facts{font-size:var(--text-sm);min-width:0}
.card-facts p{margin:8px 0;color:var(--muted)}
.card-facts h3{margin-top:20px}
.card-facts h3:first-child{margin-top:0}
.card-facts a{display:block;color:var(--accent);padding:8px 0;text-underline-offset:3px;overflow-wrap:anywhere}
.card-facts .auction-amount{font:900 2rem/1.2 var(--font-display);color:var(--ink)}
.card-facts .collector-lesson{padding:12px;background:var(--tint);color:var(--ink);border-radius:6px;margin-top:16px}
.school-record>.progress{margin-top:16px}
@media(max-width:650px){
  .card-catalog{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
  .catalog-card{padding:12px}
  .catalog-card img{height:180px}
  .catalog-card>b{font-size:1rem}
  .card-detail{grid-template-columns:1fr;gap:16px}
  .card-detail img{max-height:280px}
  .catalog-sheet{padding:20px}
  .binder-head{align-items:flex-start}
}
@media(max-width:350px){.card-catalog{grid-template-columns:1fr}}

/* ── Sealed cards + the Boxseat outing ──────────────────────────── */
.catalog-card.sealed {
  cursor: default;
  border-style: dashed;
  background: var(--tint);
  color: var(--muted);
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: var(--s3);
}
.catalog-card.sealed b {
  color: var(--ink);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: var(--text-xs);
}
.card-seal {
  position: relative;
  display: grid;
  place-items: center;
  padding: var(--s5) 0;
}
.card-seal .baseball {
  width: 54px;
  height: 54px;
  opacity: 0.5;
}
.card-seal span {
  position: absolute;
  font: 800 var(--text-lg) / 1 var(--font-display);
  color: var(--accent);
}

.trip {
  margin-top: var(--s8);
  padding: var(--s6);
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--panel);
}
.trip.trip-earned {
  border-color: var(--gold);
  border-left: 5px solid var(--gold);
}
.trip h2 {
  font-family: var(--font-display);
  margin-bottom: var(--s3);
}
.trip p {
  font-size: var(--text-sm);
  color: var(--muted);
  max-width: 70ch;
}
.trip .trip-status {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--ink);
}
.trip progress {
  width: 100%;
  max-width: 420px;
  height: 9px;
  margin-top: var(--s4);
}

.responsible-use {
  margin-top: var(--s6);
  padding: var(--s6);
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
}
.responsible-use h2 { margin-bottom: var(--s3); }
.responsible-use p, .habit-rules {
  max-width: 70ch;
  font-size: var(--text-sm);
  color: var(--muted);
  line-height: 1.6;
}
.responsible-use .habit-rate {
  color: var(--ink);
  font-weight: 700;
  font-size: var(--text-base);
}
.habit-rules { padding-left: var(--s6); margin-block: var(--s4); }
.habit-rules li + li { margin-top: var(--s2); }
.responsible-use .habit-status {
  border-top: 1px solid var(--line);
  padding-top: var(--s4);
  color: var(--ink);
}
.habit-stats { display:flex; flex-wrap:wrap; gap:var(--s6); margin-block:var(--s4); }
.habit-stats p { margin:0; }
.habit-stats strong { display:block; font-size:var(--text-lg); color:var(--ink); }
.habit-stats span { display:block; font-size:var(--text-xs); }
.habit-form { display:grid; gap:var(--s3); max-width:42rem; padding-block:var(--s4); }
.habit-form > label { color:var(--ink); font-size:var(--text-sm); font-weight:600; }
.habit-form input[type="date"], .habit-form select, .habit-form textarea {
  width:100%; min-width:0; min-height:44px; border:1px solid var(--line);
  background:var(--bg); color:var(--ink); border-radius:6px; padding:var(--s3); font:inherit;
}
.habit-form .habit-check { display:flex; align-items:flex-start; gap:var(--s3); font-weight:400; padding-block:var(--s2); }
.habit-check input { width:20px; height:20px; flex-shrink:0; }
.habit-actions { display:flex; flex-wrap:wrap; gap:var(--s3); margin-block:var(--s4); }
.habit-entry summary, .habit-history summary { cursor:pointer; padding-block:var(--s3); min-height:44px; }
.habit-day { padding-block:var(--s3); border-top:1px solid var(--line); }
.habit-day p { overflow-wrap:anywhere; margin-block:var(--s2); }
.habit-sync:empty { display:none; }
@media (max-width:640px) {
  #daily-checkin .sec-head { flex-direction:column; align-items:flex-start; gap:var(--s2); }
}

/* Board check before screen time */
.board-check {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  border-radius: 9px;
  padding: var(--s4) var(--s5);
  margin-bottom: var(--s5);
  display: grid;
  gap: var(--s2);
  justify-items: start;
}
.board-check[data-done='true'] {
  background: var(--success-bg);
  border-left-color: var(--success);
}
.check-eyebrow {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.board-check[data-done='true'] .check-eyebrow,
.board-check[data-done='true'] .check-title { color: var(--success); }
.check-title {
  font: 800 var(--text-lg) / 1.2 var(--font-display);
  color: var(--ink);
}
.check-body { font-size: var(--text-sm); color: var(--ink); }
.board-check .button[disabled] { opacity: 0.7; cursor: not-allowed; }

/* Teacher outreach + FAQ */
.outreach { margin: var(--s6) 0; }
.outreach-entry, .board-faq {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: var(--s3) var(--s5);
}
.outreach-entry > summary, .board-faq > summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--ink);
  padding: var(--s2) 0;
}
.outreach-log { margin: var(--s3) 0; padding-left: var(--s5); font-size: var(--text-sm); color: var(--ink); }
.outreach-log li { margin: var(--s1) 0; }
.board-faq { margin: var(--s6) 0; }
.board-faq dl { margin: var(--s2) 0 var(--s3); }
.board-faq dt { font-weight: 700; margin-top: var(--s3); color: var(--ink); }
.board-faq dd { margin: var(--s1) 0 0; font-size: var(--text-sm); color: var(--ink); line-height: 1.5; }
.points-caption { font-size: var(--text-xs); color: var(--muted); margin-top: var(--s1); }
.habit-payday { font-weight: 700; color: var(--success); }
.habit-form .habit-field { display:grid; gap:var(--s1); }
.habit-form .habit-field input:not([type]) { width:100%; min-width:0; min-height:44px; border:1px solid var(--line); background:var(--bg); color:var(--ink); border-radius:6px; padding:var(--s3); font:inherit; }
