/* Tokens and top bar copied from J:\claude\web\home\recipe\public\styles.css (accent swapped to indigo).
   Light by default, dark from the OS unless <html data-theme> (theme.js) says otherwise. Phone portrait first. */
:root {
  color-scheme: light;

  --page:           #f7f7fb;
  --surface-1:      #ffffff;
  --surface-2:      #ececf5;
  --text-primary:   #1d1d2b;
  --text-secondary: #4f4f66;
  --muted:          #7c7c93;
  --border:         rgba(29, 29, 43, 0.12);
  --accent:         #4b46c8;
  --accent-text:    #ffffff;
  --danger:         #b3261e;
  --danger-text:    #ffffff;
  --warn:           #9a5b00;
  --ok:             #1f7a3d;
  --series-1:       #2a78d6; /* chart series (dataviz palette, validated vs --surface-1 in both modes) */
  --series-2:       #eb6834;

  --radius:    12px;
  --radius-sm: 8px;
  --gutter:    16px;
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page:           #121219;
    --surface-1:      #1c1c26;
    --surface-2:      #272735;
    --text-primary:   #ecebf5;
    --text-secondary: #bdbcd1;
    --muted:          #8d8ca3;
    --border:         rgba(236, 235, 245, 0.12);
    --accent:         #9c97ff;
    --accent-text:    #14122e;
    --danger:         #f28b82;
    --danger-text:    #2a0d0b;
    --warn:           #f2b65c;
    --ok:             #7fd49a;
    --series-1:       #3987e5;
    --series-2:       #d95926;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page:           #121219;
  --surface-1:      #1c1c26;
  --surface-2:      #272735;
  --text-primary:   #ecebf5;
  --text-secondary: #bdbcd1;
  --muted:          #8d8ca3;
  --border:         rgba(236, 235, 245, 0.12);
  --accent:         #9c97ff;
  --accent-text:    #14122e;
  --danger:         #f28b82;
  --danger-text:    #2a0d0b;
  --warn:           #f2b65c;
  --ok:             #7fd49a;
  --series-1:       #3987e5;
  --series-2:       #d95926;
}

* { box-sizing: border-box; }

/* Pinch zoom stays on; double-tap zoom goes so quick taps never zoom. */
html { touch-action: manipulation; }

body {
  margin: 0;
  background: var(--page);
  color: var(--text-primary);
  font-family: var(--font);
  line-height: 1.45;
}

a { color: var(--accent); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding-top: max(10px, env(safe-area-inset-top));
  padding-bottom: 10px;
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
  background: var(--surface-1);
  border-bottom: 1px solid var(--border);
}

.topbar h1 { margin: 0; font-size: 1.2rem; flex: none; }
.brand { text-decoration: none; color: var(--text-primary); }

.nav-links { display: flex; gap: 4px; }

.menu { position: relative; }

/* Inline SVG rather than emoji so the icons share one stroke weight and take their color from the theme. */
.icon {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* 44px touch targets everywhere: phone portrait is the main target. */
.menu-toggle,
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
}
.menu-toggle:hover,
.theme-toggle:hover { background: var(--surface-2); color: var(--accent); }
.menu-toggle:focus-visible,
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.menu-toggle[aria-expanded="true"] {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--accent);
}

/* Light/dark switch (theme.js), pushed to the far end. Looks like a .menu-toggle but isn't one — app.js's menu
   listener must not see it. */
.theme-toggle { margin-left: auto; flex: none; }

/* The panel sets its own `display`, which would otherwise beat the browser's [hidden]{display:none} at equal
   specificity — hence the explicit override. */
.menu-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  min-width: 170px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-1);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14);
}
.menu-panel[hidden] { display: none; }
.menu-panel a {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  text-decoration: none;
  white-space: nowrap;
  color: var(--text-secondary);
}
.menu-panel a:hover { background: var(--surface-2); color: var(--accent); }
/* hosted Sign out: a form button that looks like the menu links */
.menu-panel .signout { margin: 0; border-top: 1px solid var(--border); padding-top: 4px; margin-top: 4px; }
.menu-panel .signout[hidden] { display: none; }
.menu-panel .signout button {
  display: flex; align-items: center; width: 100%; min-height: 44px; padding: 0 12px; border: 0;
  border-radius: var(--radius-sm); background: none; font: inherit; font-size: 0.95rem; text-align: left;
  color: var(--text-secondary); cursor: pointer;
}
.menu-panel .signout button:hover { background: var(--surface-2); color: var(--accent); }

/* hosted sign-in page (src/server.js signInPage) and the app's "Signed out" page */
.auth-page { max-width: 32rem; }
.auth-page form { margin: 0; }
.auth-btn {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; border: 0; border-radius: var(--radius-sm);
  background: var(--accent); color: var(--accent-text); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.auth-btn:hover { filter: brightness(1.1); }
.menu-panel a[aria-current="page"] { color: var(--accent); font-weight: 600; }

main {
  max-width: 960px;
  margin: 0 auto;
  padding-top: 20px;
  padding-bottom: max(32px, env(safe-area-inset-bottom));
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
  overflow-wrap: anywhere;
}
main h2 { margin: 0 0 12px; font-size: 1.5rem; }
main h2:focus { outline: none; } /* focused by the router for screen readers, not as a control */

.loading, .muted { color: var(--muted); }
.crumbs { display: block; margin: 0 0 4px; font-size: 0.9rem; color: var(--muted); }
.placeholder {
  padding: 12px 14px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface-1);
  color: var(--text-secondary);
}
.link-list { padding-left: 1.2em; }
.link-list a, .crumbs a { display: inline-flex; align-items: center; min-height: 44px; }

/* ---- Pages (Chunk 4). Phone portrait first: single column, 44px targets; wider screens get grids below. */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.small { font-size: 0.9rem; }
.pitch { font-size: 1.05rem; color: var(--text-secondary); }

.search-form { display: flex; gap: 8px; margin: 0 0 20px; }
.search-form input {
  flex: 1; min-width: 0; min-height: 44px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-1); color: var(--text-primary); font: inherit;
}
.search-form button, .toggle {
  min-height: 44px; padding: 0 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text-primary); font: inherit; cursor: pointer;
}
.search-form button:hover, .toggle:hover { color: var(--accent); }
.search-form input:focus-visible, .search-form button:focus-visible, .toggle:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.toggle[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }

.cards { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.card {
  padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-1);
}
.card h3, .card h4 { margin: 0 0 6px; font-size: 1.15rem; }
.card h3 a, .card h4 a { display: inline-flex; align-items: center; min-height: 44px; }
.card p { margin: 6px 0; }
.card progress { width: 100%; height: 8px; accent-color: var(--accent); }

.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0; }
.chip {
  display: inline-block; padding: 1px 8px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface-2); color: var(--text-secondary); font-size: 0.8rem; line-height: 1.5; white-space: nowrap;
}
.chip.status { color: var(--accent); border-color: var(--accent); background: none; }
.depth-none, .depth-stub { border-style: dashed; color: var(--muted); background: none; }
.depth-outline { color: var(--warn); }
.depth-draft { color: var(--text-primary); }
.depth-detailed { color: var(--ok); border-color: var(--ok); }
.depth-complete { color: var(--accent-text); background: var(--ok); border-color: var(--ok); }
.grade-ungraded { color: var(--muted); background: none; }
.grade-weak { color: var(--danger-text); background: var(--danger); border-color: var(--danger); }
.grade-fine { color: var(--warn); border-color: var(--warn); }
.grade-good { color: var(--ok); border-color: var(--ok); }
.grade-excellent { color: var(--accent-text); background: var(--accent); border-color: var(--accent); }

.meta { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 12px 0; font-size: 0.95rem; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; }

.notice {
  margin: 12px 0; padding: 10px 14px; border-left: 3px solid var(--warn); border-radius: var(--radius-sm);
  background: var(--surface-1);
}
.notice p { margin: 4px 0; }
.notice ul { margin: 4px 0; padding-left: 1.2em; }
.grade-notes { border-left-color: var(--accent); }

/* Studio ref link cards (public/refs.js) */
.studio-refs { margin: 24px 0 8px; }
.studio-refs h3 { margin: 0 0 4px; }
.ref-card { min-width: 0; }
.ref-card.ref-bad { border-color: var(--warn); }
.ref-path { overflow-wrap: anywhere; }
.ref-path .sep { color: var(--muted); padding: 0 1px; }
.ref-context { color: var(--text-secondary); overflow-wrap: anywhere; }
.ref-problems { margin: 8px 0; }
.chip.studio-art { color: var(--accent); border-color: var(--accent); background: none; }
.chip.studio-music { color: var(--ok); border-color: var(--ok); background: none; }
.ref-open { display: inline-flex; align-items: center; min-height: 44px; }
.ref-preview summary { display: flex; align-items: center; min-height: 44px; cursor: pointer; color: var(--accent); }
.ref-preview summary::before { content: "▸"; margin-right: 6px; }
.ref-preview[open] summary::before { content: "▾"; }
.ref-preview summary::-webkit-details-marker { display: none; }
.ref-iframe { display: block; width: 100%; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-1); }
.ref-iframe-art { height: 240px; }
.ref-iframe-music { height: 150px; }

/* Shared library (public/library.js): item links on game/section/character pages, "used by" on item pages */
.library-links, .library-used-by { margin: 20px 0 8px; }
.library-links h3, .library-used-by h3 { margin: 0 0 4px; }
.library-links ul, .library-used-by ul { margin: 4px 0; padding-left: 1.2em; }
.library-links li, .library-used-by li { padding: 6px 0; overflow-wrap: anywhere; }
.library-links li a, .library-used-by li a { display: inline-flex; align-items: center; min-height: 32px; }

.weak-spots {
  margin: 16px 0; padding: 4px 14px 8px; border: 1px solid var(--border); border-left: 3px solid var(--danger);
  border-radius: var(--radius-sm); background: var(--surface-1);
}
.weak-spots h3 { margin: 8px 0 4px; font-size: 1.05rem; }
.weak-spots > p { margin: 4px 0; }
.weak-spots ol { margin: 4px 0; padding-left: 1.4em; }
/* flex on an inner div, not the li: display:flex on an <li> drops its list number */
.weak-spots .spot { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; padding: 4px 0; }
.weak-spots .spot > a { display: inline-flex; align-items: center; min-height: 44px; }
.weak-spots .chips { margin: 0; }
.weak-spots .next { flex-basis: 100%; color: var(--text-secondary); }

.list-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin: 20px 0 4px; }
.list-head p { margin: 0; }
.list-head a { display: inline-flex; align-items: center; min-height: 44px; }
.group-title { margin: 18px 0 6px; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.section-list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--border); }
ol.section-list { margin-top: 12px; }
.section-row {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 2px 10px;
  border-bottom: 1px solid var(--border);
}
.section-row .chips { margin: 0 0 8px; }
.section-link { display: flex; align-items: center; min-height: 44px; flex: 1 1 12em; }
.not-started .section-link { color: var(--muted); }

.covers { margin: 12px 0; color: var(--text-secondary); }
.covers summary { display: flex; align-items: center; min-height: 44px; cursor: pointer; color: var(--accent); }
.covers summary::before { content: "▸"; margin-right: 6px; }
.covers[open] summary::before { content: "▾"; }
.covers summary::-webkit-details-marker { display: none; }
.covers p { margin: 0 0 8px; }

.prose { max-width: 70ch; }
.prose h3 { margin: 22px 0 8px; font-size: 1.2rem; }
.prose h4, .prose h5, .prose h6 { margin: 16px 0 6px; font-size: 1.05rem; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: 2px; }
.prose blockquote { margin: 12px 0; padding: 2px 14px; border-left: 3px solid var(--border); color: var(--text-secondary); }
.prose code, .meta code, .placeholder code, .notice code, .muted code {
  padding: 0 4px; border-radius: 4px; background: var(--surface-2); font-size: 0.9em;
}
.prose pre { overflow-x: auto; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); }
.prose pre code { padding: 0; background: none; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
.table-wrap { overflow-x: auto; margin: 12px 0; }
.prose table { border-collapse: collapse; font-size: 0.95rem; }
.prose th, .prose td { padding: 6px 10px; border: 1px solid var(--border); text-align: left; vertical-align: top; overflow-wrap: normal; }
.prose th { background: var(--surface-2); }
.prose .align-right { text-align: right; }
.prose .align-center { text-align: center; }

.field h3 { margin: 22px 0 6px; font-size: 1.1rem; }
.field .prose p:first-child { margin-top: 0; }

.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; padding-top: 12px; border-top: 1px solid var(--border); }
.pager span:last-child { text-align: right; }
.pager a { display: inline-flex; align-items: center; min-height: 44px; }

.hits { margin: 0; padding: 0; list-style: none; }
.hit { padding: 8px 0; border-bottom: 1px solid var(--border); }
.hit p { margin: 4px 0; }
.hit a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }
.snippet { color: var(--text-secondary); }
mark { padding: 0 2px; border-radius: 3px; background: var(--accent); color: var(--accent-text); }

/* ---- Ideas board (Chunk 7). Phone portrait first: one column, 44px targets, action buttons wrap under the text. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px;
  padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text-primary); font: inherit; cursor: pointer;
}
.btn:hover { color: var(--accent); }
.btn:focus-visible, .idea-form input:focus-visible, .idea-form textarea:focus-visible, .idea-dialog textarea:focus-visible,
.idea-dialog input:focus-visible, .genre-picks summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.danger { color: var(--danger); }
.btn.danger.armed { background: var(--danger); border-color: var(--danger); color: var(--danger-text); }
.btn[aria-disabled="true"] { opacity: 0.4; cursor: default; }
.btn[aria-disabled="true"]:hover { color: var(--text-primary); }
.icon-btn { padding: 0; font-size: 1.15rem; }
.icon-btn[aria-pressed="true"] { color: var(--warn); }

.idea-form { display: flex; flex-direction: column; gap: 6px; margin: 0 0 8px; }
.idea-form label { font-weight: 600; }
.idea-form input:not([type]), .idea-form textarea, .idea-dialog input:not([type]), .idea-dialog textarea {
  width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-1); color: var(--text-primary); font: inherit;
}
.idea-form textarea, .idea-dialog textarea { resize: vertical; }
.genre-picks { margin: 4px 0; padding: 0; border: 0; }
.genre-picks summary { display: flex; align-items: center; min-height: 44px; cursor: pointer; color: var(--accent); }
.genre-picks summary::before { content: "▸"; margin-right: 6px; }
.genre-picks[open] summary::before { content: "▾"; }
.genre-picks summary::-webkit-details-marker { display: none; }
.genre-picks legend { padding: 0; font-weight: 600; }
.genre-options { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 0; }
.genre-pick {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface-1); font-weight: 400 !important; cursor: pointer;
}
.genre-pick:has(input:checked) { border-color: var(--accent); color: var(--accent); }
.genre-pick input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.status-line { min-height: 1.4em; margin: 4px 0 12px; color: var(--text-secondary); }

.idea-list { margin: 0; padding-left: 1.6em; }
.idea { padding: 0; }
.idea + .idea { margin-top: 10px; }
.idea::marker { color: var(--muted); font-weight: 600; }
/* flex on an inner div, not the li: display:flex on an <li> drops its list number */
.idea-card {
  display: flex; flex-direction: column; gap: 8px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-1);
}
.idea.starred .idea-card { border-color: var(--warn); }
.idea-title { margin: 0; font-size: 1.1rem; }
.star-mark { display: none; color: var(--warn); }
.idea.starred .star-mark { display: inline; }
.idea-body .chips { margin: 4px 0; }
.idea-pitch { margin: 4px 0; white-space: pre-line; color: var(--text-secondary); }
.promoted { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 4px 0 0; }
.promoted a { display: inline-flex; align-items: center; min-height: 44px; }
.promoted code, .idea-dialog code, .idea-form code { padding: 0 4px; border-radius: 4px; background: var(--surface-2); font-size: 0.9em; }
.idea-actions { display: flex; flex-wrap: wrap; gap: 6px; }

.idea-dialog {
  width: min(640px, calc(100vw - 2 * var(--gutter))); max-height: calc(100dvh - 32px); padding: 16px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-1); color: var(--text-primary);
}
.idea-dialog::backdrop { background: rgba(0, 0, 0, 0.5); }
.idea-dialog h3 { margin: 0 0 8px; font-size: 1.15rem; }
.idea-dialog > label { display: block; margin-top: 10px; font-weight: 600; }
.idea-dialog > p { margin: 6px 0; }
.idea-dialog #promote-text { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 0.85rem; }
.idea-dialog [aria-invalid="true"] { border-color: var(--danger); }

@media (min-width: 700px) {
  .idea-card { flex-direction: row; align-items: flex-start; justify-content: space-between; }
  .idea-body { flex: 1 1 auto; min-width: 0; }
  .idea-actions { flex: 0 0 auto; max-width: 300px; justify-content: flex-end; }
  .promoted a { min-height: 0; }
}

/* ---- Roadmap tracker (Chunk 8). Phone portrait first: the whole row label is the tick target (44px tall). */
.roadmap-progress { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 12px 0 0; }
.roadmap-progress progress, .card progress { flex: 1 1 160px; height: 8px; accent-color: var(--accent); }
.milestones { margin: 12px 0 0; padding: 0; list-style: none; }
.milestone {
  margin: 0 0 14px; padding: 4px 14px 10px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-1);
}
.milestone.current { border-color: var(--accent); }
.milestone-title { margin: 10px 0 2px; font-size: 1.15rem; }
.tasks { margin: 6px 0 0; padding: 0 0 0 12px; list-style: none; border-left: 2px solid var(--border); }
.task + .task { margin-top: 4px; }
.tick-row { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; }
.tick { flex: 0 0 auto; width: 22px; height: 22px; margin: 0; accent-color: var(--ok); cursor: pointer; }
.tick:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.tick-label { flex: 1 1 12em; display: flex; align-items: center; min-height: 44px; cursor: pointer; }
.tick-row.done .tick-label { color: var(--text-secondary); text-decoration: line-through; text-decoration-color: var(--muted); }
.item-body { margin: 0 0 4px 32px; color: var(--text-secondary); }
.item-body p:first-child { margin-top: 0; }
.tick-notes { margin: 2px 0 4px 32px; padding: 4px 10px; border-left: 3px solid var(--accent); white-space: pre-line; }
.notes-edit { margin: 0 0 4px 32px; }
.notes-edit summary { display: inline-flex; align-items: center; min-height: 44px; color: var(--accent); cursor: pointer; font-size: 0.9rem; }
.notes-edit summary:focus-visible, .move-select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.notes-form textarea {
  width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--page); color: var(--text-primary); font: inherit; resize: vertical;
}
.notes-form textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.build dd { overflow-wrap: anywhere; }
.build a { display: inline-flex; align-items: center; min-height: 44px; }
.build code, .orphans code, .card code { padding: 0 4px; border-radius: 4px; background: var(--surface-2); font-size: 0.9em; overflow-wrap: anywhere; }
.build .btn { min-height: 36px; margin-left: 4px; font-size: 0.9rem; }
.orphans h3 { margin: 6px 0; font-size: 1.05rem; }
.orphan-list { margin: 0; padding: 0; list-style: none; }
.orphan-list > li + li { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.orphan-list li li { margin: 4px 0; }
.orphan p { margin: 4px 0; }
.orphan .tick-notes { margin-left: 0; }
.move-select {
  min-height: 44px; max-width: 100%; padding: 0 8px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-1); color: var(--text-primary); font: inherit;
}
.next-list { margin: 4px 0; padding-left: 1.2em; color: var(--text-secondary); }

@media (min-width: 700px) {
  .tick-label { min-height: 36px; }
  .build a, .notes-edit summary { min-height: 0; }
}

@media (min-width: 700px) {
  .cards { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
  .gallery { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
  .card h3 a, .card h4 a, .list-head a, .pager a, .hit a, .covers summary, .ref-open { min-height: 0; }
  .section-link { min-height: 40px; }
  .section-row .chips { margin: 0; }
}

@media (min-width: 700px) {
  :root { --gutter: 24px; }
  .topbar { gap: 8px 20px; }
  .topbar h1 { font-size: 1.3rem; }
  main { padding-top: 28px; }
  .link-list a, .crumbs a { min-height: 0; }
}

/* ---- Progression calculator (Chunk 10). Tables scroll inside their own box; the page never scrolls sideways. */
.calculator { min-width: 0; margin-top: 24px; }
.calculator h3 { margin: 0 0 4px; font-size: 1.3rem; }
.calculator h4 { margin: 20px 0 6px; font-size: 1.05rem; }
.calculator details { margin: 10px 0; }
.calculator summary { display: inline-flex; align-items: center; min-height: 44px; color: var(--accent); cursor: pointer; }
.calculator summary:focus-visible, .table-wrap:focus-visible, .chart:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 12px 0 0; padding: 0; list-style: none; }
.tile { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-1); }
.tile-label { color: var(--text-secondary); font-size: 0.85rem; }
.tile-value { font-size: 1.4rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.tile-note { color: var(--muted); font-size: 0.8rem; }
.targets { margin: 0; padding: 0; list-style: none; }
.targets li { display: flex; gap: 8px; align-items: baseline; margin: 4px 0; }
.targets .mark { flex: 0 0 auto; width: 1.2em; font-weight: 700; text-align: center; }
.targets .ok .mark { color: var(--ok); }
.targets .miss .mark { color: var(--danger); }
.charts { display: grid; gap: 12px; margin-top: 16px; }
.chart-fig { min-width: 0; margin: 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-1); }
.chart-fig figcaption { margin-bottom: 4px; }
.chart { min-height: 220px; overflow: hidden; touch-action: pan-y; }
.chart svg { display: block; }
.chart .grid, .chart .axis { stroke: var(--border); stroke-width: 1; }
.chart .axis { stroke: var(--muted); }
.chart .tick, .chart .end-label { fill: var(--text-secondary); font-size: 11px; font-family: var(--font); }
.chart .end-label { fill: var(--text-primary); }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .line.s1 { stroke: var(--series-1); }
.chart .line.s2 { stroke: var(--series-2); }
.chart .dot { stroke: var(--surface-1); stroke-width: 2; }
.chart .dot.s1 { fill: var(--series-1); }
.chart .dot.s2 { fill: var(--series-2); }
.chart .crosshair { stroke: var(--muted); stroke-width: 1; }
.chart-readout { min-height: 1.45em; margin: 4px 0 0; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0 0 4px; padding: 0; list-style: none; font-size: 0.85rem; color: var(--text-secondary); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.legend .key { display: inline-block; width: 14px; height: 3px; border-radius: 2px; }
.legend .key.s1 { background: var(--series-1); }
.legend .key.s2 { background: var(--series-2); }
table.data { border-collapse: collapse; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
table.data caption { padding: 0 0 6px; color: var(--text-secondary); font-size: 0.85rem; text-align: left; }
table.data th, table.data td { padding: 5px 9px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; white-space: nowrap; }
table.data thead th { color: var(--text-secondary); font-weight: 600; }
table.data tbody th { font-weight: 600; }
table.data .cell-note { display: block; max-width: 22em; color: var(--muted); font-size: 0.8rem; font-weight: 400; white-space: normal; }
table.data.numeric td { text-align: right; }
@media (min-width: 700px) {
  .charts { grid-template-columns: 1fr 1fr; }
  .calculator summary { min-height: 0; }
}

/* Landscape phone: the sticky bar would eat a third of a ~390px-tall screen. */
@media (orientation: landscape) and (max-height: 500px) {
  .topbar { position: static; }
}

/* Build brief: download + preview links on the overview, and the /games/:slug/brief preview page */
.brief-links { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; margin: 0.75rem 0; }
a.button {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: var(--radius-sm);
  background: var(--accent); color: var(--accent-text); font-weight: 600; text-decoration: none;
}
a.button:hover { filter: brightness(1.08); }
a.button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.brief-links > a:not(.button) { display: inline-flex; align-items: center; min-height: 44px; }
.prose.brief { overflow-wrap: anywhere; }
