/* Layout additions on top of styles.css (which stays unchanged): navigation and small screens.
   Uses only the design tokens defined there. */

/* The logo is the way home. */
button.brand { padding: 0; text-align: left; }
button.brand:hover .title { color: var(--gold); }
button.brand:focus-visible, .nav button:focus-visible { outline: 1px solid var(--gold); outline-offset: 4px; }

/* Grid items may shrink below their content's width, so one wide row can't widen the page. */
.app > *, .coverage-grid > * { min-width: 0; }

/* Notched phones in landscape (812px and wider): viewport-fit=cover lets the page run under the
   side cutouts, so the edges keep clear of them. env() is 0 everywhere else, so these resolve to
   the usual paddings. */
.topbar { padding-left: max(28px, env(safe-area-inset-left)); padding-right: max(28px, env(safe-area-inset-right)); }
main { padding-left: max(28px, env(safe-area-inset-left)); padding-right: max(28px, env(safe-area-inset-right)); }
.drawer { padding-right: max(28px, env(safe-area-inset-right)); }

@media (max-width: 760px) {
  /* Logo and account on the first row; the sections on their own row, scrolling sideways. */
  .topbar { flex-wrap: wrap; gap: 8px 16px; padding: 10px 16px 0; }
  .brand .subtitle { display: none; }
  .topbar > :last-child { margin-left: auto; }
  .nav {
    order: 3; flex: 1 0 100%; margin-left: 0;
    overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav button { flex: 0 0 auto; padding: 10px 12px; }
  main { padding: 16px; }
}

/* Clickable tiles and rows (window.vaultPressable) show where keyboard focus is. */
[role="button"]:focus-visible { outline: 1px solid var(--gold); outline-offset: 2px; }

/* ---- Sign-in screen ---- */
.signin { min-height: 100vh; display: grid; justify-items: center; align-content: center; gap: 28px; padding: 32px 16px; }
.signin-card { width: min(880px, 100%); display: grid; grid-template-columns: 1fr 1fr; gap: 0; padding: 0; overflow: hidden; }
.signin-pitch { padding: 40px 36px; border-right: 1px solid var(--border); background: linear-gradient(160deg, var(--surface-2), transparent 70%); }
.signin-mark { font-family: var(--display); font-size: 40px; color: var(--gold); line-height: 1; margin-bottom: 12px; }
.signin-lede { font-size: 16px; color: var(--text); margin: 12px 0 20px; line-height: 1.5; }
.signin-points { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.signin-points li { position: relative; padding-left: 20px; color: var(--text-2); font-size: 14px; line-height: 1.5; }
.signin-points li::before { content: '◇'; position: absolute; left: 0; top: 0; color: var(--gold); font-size: 12px; }
.signin-form { padding: 40px 36px; display: grid; gap: 14px; align-content: start; }
.signin-sub { color: var(--text-2); font-size: 14px; margin: -6px 0 4px; }
.signin-options { display: grid; gap: 10px; }
.provider-btn {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 46px; padding: 0 16px;
  background: var(--bg-2); color: var(--text); border: 1px solid var(--border-2); border-radius: var(--radius);
  font-family: var(--sans); font-size: 15px; font-weight: 600; cursor: pointer; text-align: left;
  transition: border-color .15s, background .15s;
}
.provider-btn:hover:not(:disabled) { border-color: var(--gold); background: var(--surface); }
.provider-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.provider-btn:disabled { opacity: .6; cursor: progress; }
.provider-apple { background: #fff; color: #000; border-color: #fff; }  /* Apple asks for a black or white button */
.provider-apple:hover:not(:disabled) { background: #f2f2f2; border-color: var(--gold); }
.provider-logo { width: 20px; height: 20px; display: inline-grid; place-items: center; flex: none; color: var(--gold); font-size: 18px; }
.provider-logo svg { width: 20px; height: 20px; }
.provider-apple .provider-logo { color: #000; }
.provider-label { flex: 1; }
.signin-last { font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); border: 1px solid var(--gold); border-radius: 999px; padding: 2px 8px; }
.provider-apple .signin-last { color: #6b4e00; border-color: #6b4e00; }
.signin-or { display: flex; align-items: center; gap: 12px; color: var(--text-2); font-family: var(--mono); font-size: 10px; letter-spacing: .18em; text-transform: uppercase; margin: 6px 0 2px; }
.signin-or::before, .signin-or::after { content: ''; flex: 1; border-top: 1px solid var(--border); }
.signin-link { background: none; border: 0; padding: 6px 0; color: var(--gold); font-family: var(--sans); font-size: 14px; text-decoration: underline; cursor: pointer; justify-self: start; }
.signin-link:disabled { opacity: .6; cursor: progress; }
.signin-create { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-2); }
.signin-create p { margin: 0; color: var(--text-2); font-size: 13px; line-height: 1.5; }
.signin-field { display: grid; gap: 6px; font-size: 13px; color: var(--text-2); }
.signin-msg { margin: 0; padding: 10px 12px; border-radius: var(--radius); font-size: 14px; line-height: 1.45; border: 1px solid var(--border); }
.signin-msg.danger { border-color: var(--danger); color: var(--text); background: oklch(0.66 0.18 25 / 0.12); }
.signin-msg.info { border-color: var(--gold); color: var(--text); background: oklch(0.80 0.13 80 / 0.08); }
.signin-skeleton { display: grid; gap: 10px; }
.signin-skeleton span { height: 46px; border-radius: var(--radius); background: linear-gradient(90deg, var(--bg-2), var(--surface), var(--bg-2)); background-size: 200% 100%; animation: signin-shimmer 1.2s linear infinite; }
@keyframes signin-shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .signin-skeleton span { animation: none; } }
.signin-fine { margin: 6px 0 0; color: var(--text-2); font-size: 12px; line-height: 1.5; }
.signin-fine a { color: var(--gold); text-decoration: underline; }
.signin-footer { width: min(880px, 100%); }
@media (max-width: 760px) {
  .signin { align-content: start; padding-top: 20px; }
  .signin-card { grid-template-columns: 1fr; }
  .signin-pitch { border-right: 0; border-bottom: 1px solid var(--border); padding: 24px 20px; }
  .signin-pitch .h1 { font-size: 36px; }
  .signin-points { display: none; }  /* on a phone, get to the buttons */
  .signin-lede { margin-bottom: 0; }
  .signin-form { padding: 24px 20px; }
}

/* ---- Valuation: market value, day by day ---- */
.daily-empty { color: var(--text-2); font-size: 14px; line-height: 1.6; margin: 0; max-width: 640px; }
.daily-empty b { color: var(--gold); }
.daily-summary { display: flex; flex-wrap: wrap; gap: 12px 32px; margin-bottom: 14px; }
.daily-summary > div { display: grid; gap: 4px; }
.daily-summary b { font-family: var(--mono); font-size: 18px; font-weight: 500; font-variant-numeric: tabular-nums; }
.dv-axis { font-family: var(--mono); font-size: 10px; fill: var(--text-2); }
.daily-note { color: var(--text-2); font-size: 12px; line-height: 1.6; margin: 12px 0 0; max-width: 760px; }
/* Small labels on a panel's lighter background need the brighter text colour for contrast. */
.panel .eyebrow, .panel .label-mono { color: var(--text-2); }

/* A table row's main cell as a real button, so rows open from the keyboard too (Browse). */
.row-link { background: none; border: 0; padding: 0; margin: 0; color: inherit; font: inherit; font-weight: 600; text-align: left; cursor: pointer; }
.row-link:hover { color: var(--gold); }
.row-link:focus-visible { outline: 1px solid var(--gold); outline-offset: 3px; }
/* Table headers on a panel need the brighter text colour for contrast. */
.tbl th { color: var(--text-2); }
/* --muted is below 4.5:1 on a panel's background: small grey text there uses --text-2. */
.panel .muted, .tbl td.muted { color: var(--text-2); }
.panel .chip:not(.active), .tbl .chip:not(.active) { color: var(--text-2); }

/* Scrollbars in the theme, for the page and every scrolling panel (tables,
   drawers): standard properties (Firefox, current Chromium), and the WebKit ones for
   Safari and older Chromium. Elements that hide their scrollbar (.nav) keep doing so. */
* { scrollbar-color: var(--gold) var(--bg-2); scrollbar-width: thin; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: var(--bg-2); }
::-webkit-scrollbar-thumb { background: var(--gold); border-radius: 5px; border: 2px solid var(--bg-2); }
::-webkit-scrollbar-thumb:hover { background: var(--gold-2); }

/* ---- Overlays that dismiss, and tables on small screens (usability review) ---- */

/* The card panel's close button: its own sticky row at the top of the panel (never under the card header, always
   in reach while the panel scrolls), the whole 44px square clickable, and a visible focus ring. */
.drawer { padding-top: 0; }
.drawer .drawer-bar {
  position: sticky; top: 0; z-index: 5; display: flex; justify-content: flex-end; align-items: center;
  height: 60px; margin: 0 calc(-1 * max(28px, env(safe-area-inset-right))) 4px -28px; padding: 0 12px;
  background: linear-gradient(var(--bg-2) 70%, transparent);
}
.drawer .drawer-bar .close {
  position: static; width: 44px; height: 44px; border-radius: 50%; cursor: pointer;
  font-size: 26px; line-height: 1; color: var(--text); background: var(--bg-2);
  border: 1px solid var(--text-2);
}
.drawer .drawer-bar .close:hover { color: var(--gold); border-color: var(--gold); background: var(--surface-2, var(--bg-2)); }
.drawer .drawer-bar .close:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
/* ✕ buttons on the account panel and the message bar: a fingertip-sized target, not a 22px chip. */
/* .btn.xs.close-x so the phone rule for small buttons (min-height 34px) can't shrink it. */
.btn.xs.close-x, .close-x { min-width: 44px; min-height: 44px; font-size: 18px; display: inline-grid; place-items: center; padding: 0; }
.close-x:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
/* One target: the drawn × never takes the tap, the whole round button does; centred; no double-tap zoom. */
.drawer .drawer-bar .close, .close-x { display: inline-grid; place-items: center; padding: 0; touch-action: manipulation; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; }
.close-icon { pointer-events: none; display: block; }
.drawer .drawer-bar .close .close-icon { width: 18px; height: 18px; }
.nav button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* A wide table scrolls inside its panel. Without this the whole page grew wider than the phone, which pushed
   fixed overlays (the card panel and its close button) off the right edge of the screen. */
.panel-flush, .panel:has(> table.tbl) { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { min-width: 560px; }
html, body { max-width: 100%; overflow-x: clip; }

@media (max-width: 760px) {
  /* Filters: the search box on its own row, then two across, so labels are readable. */
  .filter-grid { grid-template-columns: 1fr 1fr !important; }
  .filter-grid > .input { grid-column: 1 / -1; }
  .drawer { padding: 0 16px 24px; width: 100vw; }
  .drawer .drawer-bar { margin: 0 -16px 4px; padding: 0 8px; }
  .drawer > div[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
}

/* Sections row on a phone scrolls sideways: fade its right edge so it is clear there is more. */
@media (max-width: 760px) {
  .nav { -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); mask-image: linear-gradient(90deg, #000 88%, transparent); }
}

/* ---- Decks: the library of your decks, and a deck's page ---- */
.deck-library { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.deck-tile { display: block; width: 100%; text-align: left; cursor: pointer; color: inherit; font: inherit; }
.deck-tile:hover { border-color: var(--gold); }
.deck-tile:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.deck-summary { display: grid; grid-template-columns: auto repeat(3, 1fr); gap: 16px; align-items: center; }
.deck-big { font-family: var(--display); font-size: 28px; font-weight: 600; line-height: 1; margin-top: 4px; }
.deck-tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin-bottom: 12px; padding-bottom: 2px; }
.deck-tabs::-webkit-scrollbar { display: none; }
.deck-tabs .chip { flex: 0 0 auto; }
.deck-group { padding: 10px 16px 6px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold); border-top: 1px solid var(--border); }
.deck-panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.deck-curve { display: flex; align-items: flex-end; gap: 6px; height: 150px; margin-top: 12px; }
.deck-curve-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.deck-curve-col > div { width: 100%; min-height: 2px; background: var(--gold); border-radius: 2px 2px 0 0; }
.deck-changes { list-style: none; margin: 6px 0 10px; padding: 0; font-size: 13px; }
.deck-changes li { padding: 2px 0; }
.deck-history ol { list-style: none; margin: 0; padding: 0; }
.deck-history li { padding: 12px 14px; border-bottom: 1px solid var(--border); }
.deck-history li:last-child { border-bottom: 0; }
.deck-version-text { margin: 8px 0 0; max-height: 320px; overflow: auto; white-space: pre-wrap; font-family: var(--mono); font-size: 12px; }
.deck-kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.deck-kv-details > summary { list-style: none; cursor: pointer; }
.deck-kv-details > summary::-webkit-details-marker { display: none; }
.deck-glance { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; margin-top: 12px; }
.deck-badge { margin-left: 8px; padding: 1px 6px; border-radius: 3px; font-family: var(--mono); font-size: 10px; color: var(--good); border: 1px solid var(--good); white-space: nowrap; }

/* ---- Deck page: the change flow (cut and add cards, check, confirm; views/deck_change.jsx) ---- */
.dc { margin-bottom: 16px; }
.dc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.dc-head h2 { font-size: 22px; margin: 0; outline: none; }
.dc-lede { font-size: 13px; line-height: 1.5; margin: 6px 0 10px; color: var(--text-2); }
.dc-note { font-size: 12px; line-height: 1.5; color: var(--gold); margin: 6px 0; }
.dc-small { font-size: 12px; line-height: 1.5; margin: 6px 0; }
.dc-error { font-size: 13px; line-height: 1.5; color: var(--danger); margin: 8px 0; }
.dc-step { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.dc-step .label-mono { display: block; margin: 8px 0 4px; }
.dc-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.dc-row .input { flex: 1 1 220px; min-width: 0; }
.dc-pick, .dc-chips, .dc-problems { list-style: none; margin: 8px 0 0; padding: 0; }
.dc-pick li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.dc-pick-name { min-width: 0; overflow-wrap: anywhere; }
.dc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.dc-chip { display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--border-2); border-radius: 999px; padding: 0 2px 0 12px; font-size: 13px; max-width: 100%; }
.dc-chip.cut { border-color: var(--danger); }
.dc-chip.add { border-color: var(--good); }
.dc-chip span { overflow-wrap: anywhere; }
.dc-x { min-width: 44px; min-height: 44px; background: none; border: 0; color: inherit; font-size: 18px; cursor: pointer; border-radius: 999px; }
.dc-x:hover { color: var(--gold); }
.dc-suggest, .dc-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.dc-result { margin-top: 12px; }
.dc-verdict { font-size: 20px; margin: 0 0 8px; }
.dc-problems li { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.dc-detail { display: block; font-size: 12px; margin-top: 2px; }
.dc-line { font-size: 13px; line-height: 1.5; margin: 4px 0; }
.dc-save { white-space: normal; text-align: left; height: auto; min-height: 44px; line-height: 1.35; }
.dc-saved { outline: none; margin-top: 12px; }
.dc-saved-line { font-size: 16px; font-weight: 600; line-height: 1.4; }

/* ---- In-app help: the "?" on each view, the Help view and the first-visit welcome ---- */
.help-row { display: flex; justify-content: flex-end; margin-bottom: 4px; }
.help-hint {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; min-height: 44px; border: 1px solid var(--border-2); border-radius: 50%;
  color: var(--gold); font-family: var(--mono); font-size: 14px; text-decoration: none;
}
.help-hint:hover { border-color: var(--gold); }
.help-hint:focus-visible, .help-toc a:focus-visible, .help a:focus-visible, .welcome a:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.help { max-width: 720px; overflow-wrap: anywhere; }
.help-toc { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 20px; }
.help-toc a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; border: 1px solid var(--border-2); border-radius: var(--radius); color: inherit; text-decoration: none; }
.help-toc a[aria-current="true"] { border-color: var(--gold); color: var(--gold); }
.help-section { margin: 0 0 24px; scroll-margin-top: 72px; }
.help-section h2 { scroll-margin-top: 72px; }  /* the heading the "?" lands on stays clear of the top bar */
.help-section h2:focus { outline: none; }
.help-section p { line-height: 1.55; }
.welcome { margin: 12px 24px 0; padding: 12px 16px; border: 1px solid var(--gold); border-radius: var(--radius); }
.welcome ol { margin: 6px 0; padding-left: 20px; }
.welcome p { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin: 6px 0 0; }
.welcome a { display: inline-flex; align-items: center; min-height: 44px; }
.welcome .btn { min-height: 44px; }

/* ---- Buckets in the app (#125): the switcher above Browse, the manager, moving copies ---- */
.bucket-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin-bottom: 14px; }
.bucket-bar .select { flex: 1 1 240px; max-width: 420px; }
.bucket-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.bucket-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.bucket-name { flex: 1 1 160px; font-weight: 600; overflow-wrap: anywhere; }
.bucket-count { font-family: var(--mono); font-size: 12px; }
.bucket-actions { display: flex; gap: 4px; }
.bucket-edit { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; width: 100%; }
.bucket-edit .input { flex: 1 1 220px; min-width: 0; }
.bucket-delete { margin-top: 14px; background: var(--bg-2); border-color: var(--gold); }
.bucket-import { margin-top: 14px; background: var(--bg-2); border-color: var(--gold); outline: none; }
.bucket-import-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.bucket-import .btn.confirm { text-transform: none; letter-spacing: 0; font-size: 12px; line-height: 1.4; text-align: left; white-space: normal; min-height: 44px; padding: 8px 12px; background: var(--gold); color: oklch(0.16 0.012 60); border-color: var(--gold); }
.bucket-import .btn.confirm:disabled { opacity: 0.6; }
.bucket-imported:focus { outline: none; }
.bucket-imported { margin-top: 14px; padding: 10px 12px; font-size: 13px; border: 1px solid var(--border-2); border-left: 3px solid var(--gold); border-radius: 6px; background: var(--bg-2); }
.bucket-holds { list-style: none; margin: 0 0 12px; padding: 0; }
.bucket-holds li { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; font-size: 13px; border-bottom: 1px solid var(--border); }
.bucket-move { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; }
.bucket-move label { display: grid; gap: 4px; }
.bucket-move .input { width: 84px; }
.bulk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 12px; padding: 10px 14px;
  background: var(--bg-2); border: 1px solid var(--gold); border-radius: 6px; font-family: var(--mono); font-size: 12px; }
.bulk-bar .select { min-width: 180px; max-width: 320px; }
.tick { display: grid; place-items: center; cursor: pointer; }
.tick input { width: 18px; height: 18px; accent-color: var(--gold); }
@media (max-width: 760px) {
  .bucket-bar .select, .bulk-bar .select, .bucket-move .select { flex: 1 1 100%; max-width: none; min-height: 44px; }
  .bucket-actions .btn { min-width: 44px; }
  .tick { min-width: 44px; min-height: 44px; margin: -8px; }
  .bucket-move .input { width: 100%; min-height: 44px; }
  .bucket-edit .input { min-height: 44px; }
}

/* ---- Reset collection in the account panel (#129) ---- */
.reset-options { display: grid; gap: 10px; justify-items: start; }
.reset-options .select { width: 100%; max-width: 420px; }
.reset-check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 13px; cursor: pointer; }
.reset-check input { width: 18px; height: 18px; flex: none; accent-color: var(--gold); }
.reset-confirm { margin-top: 14px; background: var(--bg-2); }
.reset-undo { margin: 0 0 12px; background: var(--bg-2); border-color: var(--gold); }
.reset-facts { list-style: none; margin: 0; padding: 0; font-size: 13px; display: grid; gap: 6px; }
.reset-facts li { padding-left: 14px; position: relative; overflow-wrap: anywhere; }
.reset-facts li::before { content: "\00b7"; position: absolute; left: 3px; color: var(--gold); }
.reset-typed { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.reset-typed .input { flex: 1 1 140px; min-width: 0; }
@media (max-width: 760px) {
  .reset-options .select, .reset-typed .input { min-height: 44px; max-width: none; }
}

/* ---- The Lab (#164, docs/lab-design.md): buy, sell or keep ---- */
.lab { display: grid; gap: 28px; min-width: 0; }
.lab > * { min-width: 0; }
.lab-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.lab [tabindex="-1"]:focus { outline: none; }
.lab [tabindex="-1"]:focus-visible { outline: 1px solid var(--gold); outline-offset: 4px; }
.lab-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; }
.lab-head .h1 { margin-top: 6px; }
.lab-lede { margin: 6px 0 0; color: var(--text-2); font-size: 15px; }
.lab-head-side { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px 14px; }
.lab-prices { margin: 0; color: var(--text-2); }
.lab-prices.stale { color: var(--gold); }

/* The decision strip: three counters, each scrolls to its section. */
.lab-counters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.lab-counter {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 88px; padding: 16px 18px;
  text-align: left; color: inherit; font: inherit; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); transition: border-color .15s;
}
.lab-counter:hover { border-color: var(--gold); }
.lab-counter:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.lab-counter.quiet { background: var(--bg-2); }
.lab-counter-text { display: grid; gap: 6px; min-width: 0; }
.lab-counter-head { font-family: var(--display); font-size: 24px; font-weight: 600; line-height: 1.1; overflow-wrap: anywhere; }
.lab-counter-detail { font-family: var(--mono); font-size: 12px; color: var(--text-2); overflow-wrap: anywhere; }
.lab-counter.quiet .lab-counter-head { color: var(--text-2); }
.lab-counter-go { flex: none; font-size: 24px; color: var(--gold); }

/* Buy on the left, Sell or hold on the right; one column below 1000px. */
.lab-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 32px; align-items: start; }
.lab-block, .lab-sub-block { min-width: 0; scroll-margin-top: 72px; }
.lab-sub { margin: 4px 0 14px; color: var(--text-2); }
.lab-sub-block { margin-top: 22px; padding-top: 4px; border-top: 1px solid var(--border); }
.lab-h3 { margin: 20px 0 6px; font-family: var(--mono); font-size: 12px; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); }
.lab-h3.big { margin-top: 14px; font-family: var(--display); font-size: 22px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--text); }
.lab-h3-note { margin-left: 8px; font-family: var(--mono); font-size: 12px; font-weight: 400; color: var(--text-2); letter-spacing: 0.02em; }
.lab-line { margin: 8px 0; line-height: 1.55; }
.lab-line.muted { color: var(--text-2); font-size: 13px; }
.lab-line.warn { color: var(--gold); }
.lab-fine { max-width: 760px; margin: 12px 0 0; color: var(--text-2); font-size: 12px; line-height: 1.6; }
.lab .good { color: var(--good); }
.lab .bad { color: var(--danger); }
.lab .gold { color: var(--gold); }
.lab-note { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0; }
.lab-note p { flex: 1 1 260px; margin: 0; line-height: 1.55; }
.lab-empty { display: grid; justify-items: start; gap: 14px; max-width: 560px; padding: 24px; }
.lab-empty p { margin: 0; line-height: 1.55; }
.lab-empty .lab-empty-text { font-family: var(--display); font-size: 26px; font-weight: 600; line-height: 1.2; }
.lab-fail { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 8px 0; padding: 10px 12px; font-size: 13px;
  border: 1px solid var(--danger); border-radius: var(--radius); background: oklch(0.66 0.18 25 / 0.1); }
.lab-loading { display: flex; align-items: center; gap: 8px; margin: 10px 0; color: var(--text-2); font-size: 13px; }
.lab-inline-error { color: var(--danger); font-family: var(--mono); font-size: 12px; }
.lab-more { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 12px; }

/* Lists: one row per card, deck or holding. */
.lab-list { list-style: none; margin: 8px 0 0; padding: 0; border-top: 1px solid var(--border); }
.lab-item { padding: 10px 0; border-bottom: 1px solid var(--border); }
.lab-item-main { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.lab-name { text-align: left; overflow-wrap: anywhere; }
.lab-badge { padding: 2px 8px; font-family: var(--mono); font-size: 11px; white-space: nowrap; color: var(--gold); border: 1px solid var(--gold); border-radius: 999px; }
.lab-item-sub { margin: 2px 0 0; color: var(--text-2); font-family: var(--mono); font-size: 12px; }
.lab-item-note { margin: 6px 0 0; color: var(--text-2); font-size: 12px; line-height: 1.5; }
.lab-opts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.lab-opt { padding: 6px 10px; font-family: var(--mono); font-size: 12px; color: var(--text-2); background: var(--bg-2); border: 1px solid var(--border-2); border-radius: var(--radius); }
.lab-opt.buy { color: var(--gold); border-color: var(--gold); }
.lab-copy { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 14px; }
.lab-copy-note { color: var(--good); font-size: 13px; }
.lab-manual { display: grid; gap: 6px; margin-top: 10px; font-size: 13px; }
.lab-manual textarea { width: 100%; font-family: var(--mono); font-size: 16px; }
.lab-deck-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.lab-deck-row .lab-name { flex: 1 1 160px; font-weight: 600; }
.lab-status { font-family: var(--mono); font-size: 12px; color: var(--text-2); }
.lab-status.ok { color: var(--good); }
.lab-status.lacks { color: var(--gold); }
.lab-status.skipped { color: var(--danger); }
.lab-deck-detail { margin-top: 8px; padding: 10px 12px; font-size: 13px; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); }
.lab-deck-detail ul { margin: 4px 0 8px; padding-left: 18px; }
.lab-mini { margin: 4px 0 0; font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-2); }

/* Spare copies and profit and loss: columns on a wide screen, wrapped lines on a phone. */
.lab-colhead { display: grid; grid-template-columns: minmax(0, 1fr) 64px 150px 100px; gap: 4px 12px; margin-top: 10px; padding: 0 0 6px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-2); }
.lab-colhead.pnl { grid-template-columns: minmax(0, 1fr) 96px 96px 150px 96px; }
.lab-spare-row { display: grid; grid-template-columns: minmax(0, 1fr) 64px 150px 100px; align-items: center; gap: 4px 12px; }
.lab-pnl-row { display: grid; grid-template-columns: minmax(0, 1fr) 96px 96px 150px 96px; align-items: center; gap: 4px 12px; }
.lab-pnl-main { display: grid; min-width: 0; }
.lab-fig { font-family: var(--mono); font-size: 13px; font-variant-numeric: tabular-nums; }
.lab-fig.strong { font-weight: 700; }
.lab-fig.muted { color: var(--text-2); }
.lab-fig-l { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.lab-pct { font-weight: 400; font-size: 12px; }
.lab-link { font-family: var(--mono); font-size: 12px; color: var(--gold); text-decoration: underline; white-space: nowrap; }
.lab-toggle { margin-top: 8px; }
.lab-printings { margin-top: 8px; padding: 6px 12px; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); }
.lab-printings ul { list-style: none; margin: 0; padding: 0; }
.lab-printings li { display: grid; grid-template-columns: minmax(0, 1.5fr) 72px minmax(0, 1.4fr) minmax(0, 1fr) auto; align-items: center; gap: 4px 12px;
  padding: 6px 0; font-size: 13px; border-bottom: 1px solid var(--border); }
.lab-printings li:last-child { border-bottom: 0; }
.lab-tabs { display: flex; gap: 6px; margin: 12px 0 4px; }
.lab-value-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.lab-value-head .lab-line { flex: 1 1 280px; margin: 0; }
.lab-chart { margin-top: 12px; padding: 16px; }

@media (max-width: 1000px) {
  .lab-cols { grid-template-columns: minmax(0, 1fr); gap: 28px; }
}
@media (max-width: 760px) {
  .lab { gap: 22px; }
  .lab-head-side { justify-content: flex-start; }
  .lab-counters { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .lab-counter { min-height: 64px; padding: 12px 14px; }
  .lab-counter-head { font-size: 20px; }
  .lab-colhead { display: none; }
  .lab-spare-row, .lab-pnl-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px; }
  .lab-spare-row .lab-name, .lab-pnl-main { flex: 1 1 100%; }
  .lab-fig-l { position: static; width: auto; height: auto; margin: 0; overflow: visible; clip: auto; clip-path: none; color: var(--text-2); font-weight: 400; }
  .lab-link { display: inline-flex; align-items: center; min-height: 44px; }
  .lab-printings li { display: flex; flex-wrap: wrap; gap: 2px 12px; }
  .lab-printings li .lab-printing-name { flex: 1 1 100%; }
  .lab-h3-note { display: block; margin: 2px 0 0; }
  .lab-empty { padding: 14px; }
  .lab-chart { padding: 8px; }
}

/* ---- Tags in the app (#128): chips on the rows, the filter, the bulk bar, the card drawer's tags and notes ---- */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.tag-bar .tag-note { flex: 1 1 100%; margin: 0; font-size: 12px; }
p.tag-note { margin: 0 0 14px; font-size: 12px; }
.tag-row { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.tag-chip, .tag-chip-lg { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border: 1px solid var(--border-2); border-radius: 999px;
  background: var(--surface); font-family: var(--mono); font-size: 12px; font-weight: 400; color: var(--text-2); max-width: 100%; }
.tag-chip .tag-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag-chip-lg { overflow-wrap: anywhere; }
.tag-chip-lg { padding: 4px 10px; font-size: 13px; color: var(--text); }
.tag-chip.ai, .tag-item.ai .tag-chip-lg { border-style: dashed; border-color: var(--gold); }
.tag-mark { padding: 0 4px; border-radius: 3px; background: var(--gold); color: var(--bg); font-size: 10px; font-weight: 700; letter-spacing: 0.06em; }
.tag-list { list-style: none; margin: 0 0 12px; padding: 0; }
.tag-item { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.tag-by { flex: 1 1 60px; font-size: 12px; }
.tag-actions { display: flex; gap: 4px; }
.btn.tag-x { min-width: 32px; font-size: 18px; line-height: 1; }
.tag-bulk .input { flex: 1 1 200px; min-width: 0; max-width: 320px; }
.tag-confirm { flex: 1 1 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding-top: 8px; border-top: 1px solid var(--border); }
.tag-error { font-size: 12px; color: var(--danger); }
.meta-ns { padding: 8px 0; border-top: 1px solid var(--border); }
.meta-ns.ai { border-left: 3px dashed var(--gold); padding-left: 10px; }
.meta-head { display: flex; align-items: center; gap: 6px; margin: 0 0 2px; font-family: var(--mono); font-size: 12px; font-weight: 600; letter-spacing: 0.04em; }
.meta-when { margin: 0 0 6px; font-size: 12px; }
.meta-dl { margin: 0; display: grid; gap: 4px; font-size: 13px; }
.meta-dl dt { font-family: var(--mono); font-size: 12px; color: var(--text-2); }
.meta-dl dd { margin: 0 0 2px; overflow-wrap: anywhere; }
.meta-dl .meta-dl, .meta-dl .meta-list { padding-left: 10px; border-left: 1px solid var(--border); }
.meta-list { margin: 0; padding-left: 18px; font-size: 13px; overflow-wrap: anywhere; }
.meta-text { white-space: pre-wrap; }
@media (max-width: 760px) {
  .tag-bulk .input { flex: 1 1 100%; max-width: none; min-height: 44px; }
  .tag-x { min-width: 44px; min-height: 44px; }
  .tbl td:first-child .tag-chip { max-width: 150px; }  /* the name column is narrow on a phone: a long tag is cut with an ellipsis (the card drawer shows it whole) */
  .tag-actions .btn { min-width: 44px; }
}

/* ---- The scope of the analytics (#130): the bar above the Vault, Sets and Value pages ---- */
.scope-bar { margin-bottom: 20px; padding: 12px 14px; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); }
.scope-pickers { display: flex; flex-wrap: wrap; gap: 0 28px; }
.scope-bar .bucket-bar { margin-bottom: 10px; }
.scope-bar .bucket-bar .select { flex: 0 1 280px; }
.scope-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.scope-showing { margin: 0; flex: 1 1 260px; font-family: var(--mono); font-size: 12px; color: var(--text-2); overflow-wrap: anywhere; }
.scope-showing strong { color: var(--gold); font-weight: 600; }
.scope-note { margin: 8px 0 0; font-size: 12px; max-width: 760px; }
.scope-empty { text-align: center; padding: 32px 16px; }
.scope-empty .btn { margin-top: 12px; }
.scope-aside { margin: 0 0 14px; font-size: 12px; }
@media (max-width: 760px) {
  .scope-bar { padding: 10px 12px; }
  .scope-pickers, .scope-pickers .bucket-bar { width: 100%; }
  .scope-bar .bucket-bar .select { flex: 1 1 100%; }
}

/* ---- Ideas (#163, docs/deck-ideas-lab-design.md): a saved deck in role lanes, and what could stand in for a card ----
   Text first: plain rows (a dot, the name, a status word), small thumbnails only for the selected card and its alternatives. */
.ideas { display: grid; gap: 18px; min-width: 0; }
.ideas > * { min-width: 0; }
.ideas-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.ideas [tabindex="-1"]:focus { outline: none; }
.ideas [tabindex="-1"]:focus-visible { outline: 1px solid var(--gold); outline-offset: 4px; }
.ideas-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; }
.ideas-head .h1 { margin-top: 6px; overflow-wrap: anywhere; }
.ideas-lede { margin: 6px 0 0; color: var(--text-2); font-size: 15px; }
.ideas-facts { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 6px 0 0; color: var(--text-2); font-size: 13px; }
.ideas-colours { display: inline-flex; }
.ideas-head-side { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px 14px; }
.ideas-format { display: flex; align-items: center; gap: 8px; }
.ideas-counts { margin: 0; font-family: var(--display); font-size: 24px; line-height: 1.2; }
.ideas .gold { color: var(--gold); }
.ideas .good { color: var(--good); }
.ideas-note { display: grid; justify-items: start; gap: 14px; max-width: 560px; padding: 24px; }
.ideas-note p { margin: 0; line-height: 1.55; }
.ideas-note .ideas-note-text { font-family: var(--display); font-size: 26px; font-weight: 600; line-height: 1.2; }
.ideas-fail { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 8px 0; padding: 10px 12px; font-size: 13px;
  color: var(--danger); border: 1px solid var(--danger); border-radius: var(--radius); }
.ideas-loading { display: flex; align-items: center; gap: 8px; margin: 10px 0; color: var(--text-2); font-size: 13px; }
.ideas-inline-error { color: var(--danger); font-family: var(--mono); font-size: 12px; }
.ideas-fine { margin: 6px 0 0; color: var(--text-2); font-size: 12px; line-height: 1.6; max-width: 760px; }
.ideas-fine summary { cursor: pointer; padding: 6px 0; }
.ideas-credit { margin: 8px 0 0; color: var(--text-2); font-size: 12px; }
.ideas-h3 { margin: 4px 0 8px; font-family: var(--mono); font-size: 12px; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); }
.ideas-more { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 8px; }

/* the start: one tile per saved deck */
.ideas-decks { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.ideas-deck { display: grid; gap: 6px; height: 100%; padding: 16px; color: var(--text); text-decoration: none; }
.ideas-deck:hover { border-color: var(--gold); }
.ideas-deck:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.ideas-deck-name { font-weight: 600; font-size: 16px; overflow-wrap: anywhere; }
.ideas-deck-facts { color: var(--text-2); font-size: 12px; overflow-wrap: anywhere; }
.ideas-bar { display: block; height: 6px; margin-top: 4px; background: oklch(0.30 0.014 65); border-radius: 3px; overflow: hidden; }
.ideas-bar > span { display: block; height: 100%; }
.ideas-deck-owned { font-size: 13px; }
.ideas-deck-open { color: var(--gold); font-family: var(--mono); font-size: 12px; }
.ideas-add { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.ideas-add p { flex: 1 1 260px; margin: 0; line-height: 1.55; }

/* a deck: the lanes on the left, what needs a decision (or the selected card) on the right */
.ideas-covered { display: grid; gap: 12px; }
.ideas-covered-text { margin: 0; font-size: 16px; line-height: 1.5; }
.ideas-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ideas-main { display: grid; grid-template-columns: minmax(0, 1fr) 440px; gap: 28px; align-items: start; }
.ideas-main.has-card.compact { grid-template-columns: minmax(0, 1fr); }
.ideas-lanes-wrap { display: grid; gap: 14px; min-width: 0; }
.ideas-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--text-2); font-size: 12px; }
.ideas-legend span { display: inline-flex; align-items: center; gap: 6px; }
.ideas-lanes { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; align-items: start; }
.ideas-lane { min-width: 0; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.ideas-lane-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; margin: 0 0 6px; font-family: var(--mono); font-size: 12px; font-weight: 500;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold); }
.ideas-lane-note { font-size: 12px; letter-spacing: 0.02em; text-transform: none; color: var(--text-2); }
.ideas-lane-toggle { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; width: 100%; padding: 0; text-align: left; background: none; border: 0; color: inherit; font: inherit;
  letter-spacing: inherit; text-transform: inherit; cursor: pointer; }
.ideas-lane-toggle:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.ideas-chev { margin-left: auto; color: var(--gold); font-size: 18px; }
.ideas-rows { list-style: none; margin: 0; padding: 0; }
.ideas-rows > li { box-sizing: border-box; }
.ideas-window { overflow-y: auto; overscroll-behavior: contain; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.ideas-row { display: flex; align-items: center; gap: 8px; box-sizing: border-box; width: 100%; height: 100%; padding: 0 6px; background: none; border: 0;
  border-left: 2px solid transparent; border-radius: 3px; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.ideas-row:hover { background: var(--bg-2); }
.ideas-row:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
.ideas-row.selected { background: var(--bg-2); border-left-color: var(--gold); }
.ideas-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.ideas-state { flex: none; font-family: var(--mono); font-size: 12px; color: var(--text-2); }
.ideas-state.missing { color: var(--danger); }
.ideas-state.partial, .ideas-state.borrowed { color: var(--gold); }
.ideas-tag { flex: none; padding: 0 6px; font-family: var(--mono); font-size: 11px; color: var(--gold); border: 1px solid var(--gold); border-radius: 999px; }
.ideas-dot { flex: none; display: inline-block; width: 10px; height: 10px; box-sizing: border-box; border-radius: 50%; border: 2px solid var(--good); background: var(--good); }
.ideas-dot.missing { border-color: var(--danger); background: transparent; }
.ideas-dot.partial { border-color: var(--gold); background: linear-gradient(90deg, var(--gold) 50%, transparent 50%); }
.ideas-dot.borrowed { border: 2px dashed var(--gold); background: transparent; }
.ideas-list { min-width: 0; }
.ideas-list .ideas-rows, .ideas-list .ideas-window { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 4px 6px; }
.ideas-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.ideas-combos { display: grid; gap: 8px; }
.ideas-combo-list { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.7; }

/* the selected card */
.ideas-panel { display: grid; gap: 14px; padding: 18px; min-width: 0; }
.ideas-panel-top { display: flex; }
.ideas-target { display: flex; gap: 12px; }
.ideas-target-body { min-width: 0; display: grid; gap: 4px; }
.ideas-panel-h { margin: 0; font-family: var(--display); font-size: 28px; font-weight: 600; line-height: 1.15; overflow-wrap: anywhere; }
.ideas-meta { margin: 0; color: var(--text-2); font-size: 13px; }
.ideas-role { margin: 0; font-family: var(--mono); font-size: 12px; color: var(--gold); }
.ideas-badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 0; }
.ideas-badge { padding: 1px 8px; font-family: var(--mono); font-size: 12px; color: var(--text-2); border: 1px solid var(--border-2); border-radius: 999px; }
.ideas-badge.missing { color: var(--danger); border-color: var(--danger); }
.ideas-badge.partial, .ideas-badge.borrowed { color: var(--gold); border-color: var(--gold); border-style: dashed; }
.ideas-badge.owned { color: var(--good); border-color: var(--good); }
.ideas-thumb { flex: none; align-self: flex-start; display: block; width: 44px; padding: 0; background: none; border: 0; cursor: zoom-in; }
.ideas-thumb img { display: block; width: 40px; height: 56px; border: 1px solid var(--border-2); border-radius: 4px; background: var(--bg-2); }
.ideas-thumb:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.ideas-alts { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.ideas-alt { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.ideas-alt-body { min-width: 0; display: grid; gap: 4px; flex: 1 1 auto; }
.ideas-alt-body p { margin: 0; }
.ideas-alt-name { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; font-weight: 600; }
.ideas-copies { font-family: var(--mono); font-size: 12px; font-weight: 400; color: var(--text-2); }
.ideas-why { color: var(--text); font-size: 13px; line-height: 1.5; }
.ideas-or { margin: 0; font-size: 13px; line-height: 1.8; color: var(--text-2); }
.ideas-or a, .ideas-fine a, .ideas-combo-list a { color: var(--gold); text-decoration: underline; }
.ideas-none { display: grid; gap: 12px; padding: 12px 14px; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); }
.ideas-none-text { margin: 0; font-size: 15px; line-height: 1.5; }
.ideas-move { flex: 1 1 100%; display: grid; gap: 8px; padding: 10px 12px; font-size: 13px; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); }
.ideas-move p { margin: 0; line-height: 1.5; }
.ideas-zoom-backdrop { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; overflow: auto; background: rgb(0 0 0 / 0.6); }
.ideas-zoom { position: relative; display: grid; gap: 8px; width: min(360px, 100%); padding: 16px; outline: none; }
.ideas-zoom img { display: block; width: 100%; height: auto; border-radius: 12px; }
.ideas-zoom .close-x { position: absolute; top: 4px; right: 4px; }
/* #166: what a candidate does and does not do, both Oracle texts, the similar tier (collapsed until asked for) */
.ideas-does, .ideas-lacks { margin: 0; font-family: var(--mono); font-size: 12px; line-height: 1.5; color: var(--gold); }
.ideas-lacks { color: var(--text-2); }
.ideas-texts { font-size: 13px; }
.ideas-texts summary { cursor: pointer; padding: 6px 0; color: var(--text-2); }
.ideas-texts summary:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.ideas-text-name { margin: 8px 0 0; font-weight: 600; }
.ideas-text { margin: 2px 0 0; white-space: pre-line; line-height: 1.5; color: var(--text); overflow-wrap: anywhere; }
.ideas-similar { display: grid; gap: 8px; justify-items: start; }
.ideas-similar .ideas-alts { width: 100%; }
.ideas-norole { border-style: dashed; }

@media (max-width: 1000px) {
  .ideas-main { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .ideas { gap: 14px; }
  .ideas-head-side { justify-content: flex-start; }
  .ideas-counts { font-size: 20px; }
  .ideas-note { padding: 14px; }
  .ideas-decks { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .ideas-deck { min-height: 44px; }
  .ideas-lanes { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .ideas-lane { padding: 0 12px; }
  .ideas-lane-h { margin: 0; }
  .ideas-lane-toggle { min-height: 48px; align-items: center; }
  .ideas-lane-toggle[aria-expanded="true"] { border-bottom: 1px solid var(--border); margin-bottom: 4px; }
  .ideas-panel { padding: 14px; }
  .ideas-panel-h { font-size: 24px; }
  .ideas-alt { gap: 10px; }
  .ideas-more .btn, .ideas-actions .btn { min-height: 44px; }
  .ideas-fine summary, .ideas-texts summary { display: flex; align-items: center; min-height: 44px; }
  .ideas-similar .btn { min-height: 44px; }
}

/* "Sign out everywhere" first lists the sign-in methods added in the last 24 hours (#347): rows and buttons are at least 44px tall at every width. */
.signout-all { margin-top: 12px; padding: 12px; border: 1px solid var(--border-2); border-radius: var(--radius); display: flex; flex-direction: column; gap: 8px; }
.signout-all:focus { outline: none; }
.signout-all:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.signout-all-title { font-weight: 600; margin: 0; }
.signout-methods { list-style: none; margin: 0; padding: 0; }
.signout-method { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; padding: 4px 0; border-top: 1px solid var(--border); }
.signout-method .btn { min-height: 44px; min-width: 44px; flex: none; }
.signout-recent { border-left: 3px solid var(--gold); padding-left: 8px; }
.signout-flag { color: var(--gold); }
.signout-why { color: var(--text-2); font-size: 12px; text-transform: none; letter-spacing: 0; }
.signout-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.signout-actions .btn { min-height: 44px; }
/* Confirm it's you (#347): a step at the top of the Account panel that stays in view while the panel scrolls. */
.confirm-its-you { position: sticky; top: 0; z-index: 5; margin: 0 0 16px; padding: 12px; background: var(--surface); border: 1px solid var(--gold); border-radius: var(--radius); display: flex; flex-direction: column; gap: 8px; }
.confirm-its-you:focus { outline: none; }
.confirm-its-you:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.confirm-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.confirm-actions .btn { min-height: 44px; font-size: 12px; }
.confirm-code { min-height: 44px; font-size: 20px; letter-spacing: 0.25em; text-align: center; max-width: 12em; }

/* ---- Value (#95): the ledger of months is a list on a phone, the summary leads ----
   The table (wider screens) and the list (phones) are both in the page; one of them is display: none. */
.ledger-list, .ledger-more { display: none; }
@media (max-width: 760px) {
  .ledger-scroll { display: none; }
  .ledger-list { display: block; list-style: none; margin: 0; padding: 0; }
  .ledger-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: baseline; padding: 12px 14px; border-top: 1px solid var(--border); }
  .ledger-item:first-child { border-top: 0; }
  .ledger-month { font-size: 15px; font-weight: 600; }
  .ledger-added { font-family: var(--mono); font-size: 14px; color: var(--gold); text-align: right; }
  .ledger-sub { grid-column: 1 / -1; font-size: 12px; color: var(--text-2); line-height: 1.5; }
  .ledger-none { display: block; text-align: center; color: var(--text-2); font-size: 13px; padding: 24px 14px; }
  .ledger-more { display: block; padding: 12px 14px; border-top: 1px solid var(--border); }
  .ledger-more .btn { width: 100%; }
  .ledger-tools { width: 100%; }
  .ledger-tools .input { flex: 1 1 0; min-width: 0; width: auto !important; }
  .ledger-tools .select { flex: 0 0 auto; max-width: 48%; }
  /* The title, then the figures; the price date and the refresh buttons come under the title in a row, not a column to the right. */
  .val-head { display: block !important; margin-bottom: 18px !important; }
  .val-calc { text-align: left !important; margin-top: 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; }
  .val-calc > * { margin: 0 !important; }
  .val-calc .freshness { justify-content: flex-start !important; }
  .val-calc > div { flex-direction: row !important; align-items: center !important; flex-wrap: wrap; gap: 8px; }
}

/* ---- Deck page: Opening turns (#138, docs/deck-simulation-design.md; views/deck_opening.jsx) ----
   Rows with a bar and the value in words, not a drawn chart: it reads at 390 px and the number is its own text alternative.
   Colours are the tokens above: gold and copper separate two series in one panel, neutral and danger are for discard. */
.ds { display: grid; gap: 12px; min-width: 0; }
.ds-body { display: grid; gap: 12px; min-width: 0; transition: opacity .15s; }
.ds-dim { opacity: 0.55; }
.ds .panel { min-width: 0; }
.ds-h { font-weight: 400; }
.ds-gap { margin-top: 6px; }
.ds-meta { margin: 8px 0 6px; font-size: 13px; color: var(--text-2); overflow-wrap: anywhere; }
.ds-lead { margin: 0 0 4px; font-size: 15px; line-height: 1.5; }
.ds-asplayed { margin: 10px 0 0; font-size: 13px; color: var(--text-2); overflow-wrap: anywhere; }
.ds-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 12px; }
.ds-seg { display: inline-flex; }
.ds-seg .chip { border-radius: 0; min-height: 44px; padding: 0 14px; font-size: 11px; }
.ds-seg .chip:first-child { border-radius: 999px 0 0 999px; }
.ds-seg .chip:last-child { border-radius: 0 999px 999px 0; border-left: 0; }
.ds-field { display: inline-flex; align-items: center; gap: 8px; font-size: 11px; }
.ds-field .select { width: auto; min-height: 44px; }
.ds-controls .btn { min-height: 44px; }
.ds-status { min-height: 24px; margin-top: 8px; display: flex; align-items: center; gap: 8px; font-size: 13px; }
.ds-warn { color: var(--gold); font-size: 13px; margin: 8px 0 0; overflow-wrap: anywhere; }
.ds-problem { font-size: 13px; line-height: 1.5; }
.ds-problem p { margin: 10px 0 0; }
.ds-danger-text { color: var(--danger); }
.ds-notice { border: 1px solid var(--gold); border-left: 4px solid var(--gold); border-radius: var(--radius); padding: 10px 12px; background: var(--bg-2); font-size: 13px; line-height: 1.5; }
.ds-grid2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.ds-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.ds-tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 12px 14px; min-width: 0; }
.ds-k { margin: 0; font-family: var(--mono); font-size: 12px; line-height: 1.3; color: var(--text-2); }
.ds-v { margin: 4px 0 2px; font-family: var(--display); font-weight: 600; font-size: 30px; line-height: 1.1; color: var(--gold-2); }
.ds-u { margin: 0; font-size: 12px; color: var(--text-2); }
.ds-sub { margin: 6px 0 8px; font-size: 13px; line-height: 1.5; color: var(--text-2); }
.ds-tight { margin-top: 14px; }
.ds-numbers { margin: 8px 0; }
.ds-numbers summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-size: 13px; }
.ds-small { max-width: 260px; }
.ds-bars { list-style: none; margin: 0; padding: 0; }
.ds-bars li { display: grid; grid-template-columns: 52px minmax(0, 1fr) 118px; gap: 8px; align-items: center; min-height: 26px; font-size: 13px; }
.ds-bl { color: var(--text-2); font-size: 12px; }
.ds-bv { text-align: right; font-variant-numeric: tabular-nums; }
.ds-track { display: block; height: 10px; background: var(--bg-2); border-radius: 2px; overflow: hidden; }
.ds-fill { display: block; height: 100%; background: var(--gold); }
.ds-copper .ds-fill { background: var(--copper); }
.ds-neutral .ds-fill { background: var(--text-2); }
.ds-danger .ds-fill { background: var(--danger); }
.ds-plan { margin-top: 14px; border: 1px solid var(--border-2); border-left: 4px solid var(--gold); border-radius: var(--radius); padding: 10px 12px; background: var(--bg-2); font-size: 13px; }
.ds-plan ul, .ds-assump { margin: 6px 0; padding-left: 18px; }
.ds-plan li, .ds-assump li { margin: 3px 0; line-height: 1.5; }
.ds-cn { font-weight: 600; }
.ds-why { color: var(--text-2); }
.ds-game { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 0 14px 10px; min-width: 0; }
.ds-game summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 600; font-size: 13px; }
.ds-turns, .ds-small { border-collapse: collapse; width: 100%; }
.ds-turns th, .ds-turns td, .ds-small th, .ds-small td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: top; }
.ds-turns thead th, .ds-small thead th { font-family: var(--mono); font-size: 11px; font-weight: 400; color: var(--text-2); text-transform: uppercase; }
.ds-flag { display: inline-block; font-size: 12px; padding: 1px 6px; border-radius: 3px; margin: 1px 4px 1px 0; }
.ds-flag.ds-f-warn { background: oklch(0.35 0.06 80); color: var(--gold-2); margin-top: 1px; }
.ds-flag.ds-f-bad { background: oklch(0.35 0.09 25); color: oklch(0.9 0.05 25); }
.ds-prov { color: var(--text-2); font-size: 12px; line-height: 1.5; margin: 12px 0 0; overflow-wrap: anywhere; }
@media (min-width: 761px) {
  .ds-grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ds-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .ds-bars li { grid-template-columns: 60px minmax(0, 1fr) 130px; }
}
@media (max-width: 760px) {
  /* a turn of a sample game becomes a block: the turn as its heading, Drew and Land played side by side, Mana and Hand side by side,
     then Cast and Notes (dropped when empty), each cell with its small label above the value */
  .ds-turns, .ds-turns thead, .ds-turns tbody, .ds-turns tr, .ds-turns th, .ds-turns td { display: block; }
  .ds-turns thead { position: absolute; left: -9999px; }
  .ds-turns tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2px 12px; border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 8px; margin: 8px 0; background: var(--bg-2); }
  .ds-turns th[scope="row"] { grid-column: 1 / -1; border: 0; padding: 2px 0; font-family: var(--sans); font-size: 13px; font-weight: 600; text-transform: none; color: var(--text); }
  .ds-turns th[scope="row"]::before { content: "Turn "; }
  .ds-turns td { border: 0; padding: 2px 0; overflow-wrap: anywhere; }
  .ds-turns td::before { content: attr(data-l); display: block; font-family: var(--mono); font-size: 11px; color: var(--text-2); text-transform: uppercase; }
  .ds-turns td[data-l="Cast"], .ds-turns td[data-l="Notes"] { grid-column: 1 / -1; }
  .ds-turns td[data-l="Mana"] { grid-row: 3; grid-column: 1; }
  .ds-turns td[data-l="Hand"] { grid-row: 3; grid-column: 2; }
  .ds-turns td[data-l="Cast"] { grid-row: 4; }
  .ds-turns td[data-l="Notes"] { grid-row: 5; }
  .ds-turns td.ds-none { display: none; }
  .ds-bars li { grid-template-columns: 48px minmax(0, 1fr) 104px; gap: 6px; }
  .ds-controls .btn { flex: 1 1 100%; justify-content: center; }
  .ds-field { flex: 1 1 40%; }
  .ds-field .select { flex: 1; min-width: 0; }
  .ds-v { font-size: 26px; }
}
/* ---- The landing page (#437): index.html's own markup, for a visitor of / who is not signed in ----
   The head script of index.html puts .in-app on <html> for a signed-in browser or any other address; app.jsx keeps it right. */
html.in-app .landing { display: none; }
html:not(.in-app) #root { display: none; }
.landing { position: relative; z-index: 1; max-width: 1160px; margin: 0 auto; padding: 0 max(24px, env(safe-area-inset-right)) 0 max(24px, env(safe-area-inset-left)); }
.landing a { color: var(--gold); text-underline-offset: 2px; }
.landing p a, .landing li a { text-decoration: underline; } /* links in running text are underlined, not told apart by colour alone */
.landing a.btn { text-decoration: none; justify-content: center; }
.landing a.btn:not(.primary) { color: var(--text); }
.landing a.btn:not(.primary):hover { color: var(--gold); }
.landing a:focus-visible, .landing button:focus-visible, .landing video:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.landing-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.landing-brand { display: inline-flex; align-items: center; gap: 12px; min-height: 44px; color: var(--text) !important; text-decoration: none; }
.landing-brand .mark { width: 28px; height: 28px; display: inline-grid; place-items: center; border: 1px solid var(--gold); color: var(--gold); font-family: var(--display); font-weight: 700; font-size: 18px; transform: rotate(45deg); }
.landing-brand .mark span { transform: rotate(-45deg); }
.landing-brand .title { font-family: var(--display); font-size: 24px; font-weight: 600; letter-spacing: 0.02em; }
.landing-nav { display: flex; align-items: center; gap: 4px; }
.landing-nav .btn { min-height: 44px; }
.landing-navlink { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; font-family: var(--mono); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-2) !important; text-decoration: none; }
.landing-navlink:hover { color: var(--gold) !important; }
.landing-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 48px; align-items: center; padding: 56px 0 40px; }
.landing .eyebrow { font-size: 12px; color: var(--gold); }
.landing-hero .h1 { margin: 14px 0 18px; font-size: clamp(34px, 4.2vw, 52px); }
.landing-lede { font-size: 17px; line-height: 1.6; color: var(--text-2); margin: 0 0 24px; }
.landing-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.landing-cta { min-height: 48px; padding: 12px 20px; font-size: 12px; }
.landing-fine { margin: 16px 0 0; font-size: 13px; color: var(--muted); }
.landing-demo { margin: 0; scroll-margin-top: 24px; }
.landing-demo video { display: block; width: 100%; height: auto; aspect-ratio: 1280 / 668; border: 1px solid var(--border-2); border-radius: var(--radius-lg); background: #111; box-shadow: 0 20px 60px oklch(0 0 0 / 0.45); }
.landing-demo figcaption { margin-top: 10px; font-size: 13px; line-height: 1.55; color: var(--muted); }
.landing-section { padding: 48px 0; border-top: 1px solid var(--border); scroll-margin-top: 8px; }
.landing-section > .h2 { font-size: clamp(28px, 3vw, 36px); margin-bottom: 10px; }
.landing-sub { color: var(--text-2); font-size: 15px; line-height: 1.6; margin: 0 0 20px; max-width: 760px; }
.landing-steps { list-style: none; margin: 24px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.landing-step { display: grid; grid-template-rows: 220px auto; gap: 16px; padding: 20px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.landing-step img { width: 100%; height: 220px; object-fit: contain; object-position: center top; border-radius: var(--radius); }
.landing-step h3 { margin: 0 0 6px; font-family: var(--display); font-size: 24px; font-weight: 600; }
.landing-step p { margin: 0; font-size: 15px; line-height: 1.6; color: var(--text-2); }
.landing-address { display: grid; align-content: center; justify-items: center; gap: 12px; height: 220px; padding: 16px; border-radius: var(--radius); background: var(--bg-2); text-align: center; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.landing-address code { display: block; max-width: 100%; padding: 10px 12px; border: 1px solid var(--gold); border-radius: var(--radius); color: var(--gold); font-family: var(--mono); font-size: 13px; overflow-wrap: anywhere; }
.landing-ask { margin-top: 28px; padding: 20px 24px; border-left: 2px solid var(--gold); background: linear-gradient(90deg, var(--surface), transparent); }
.landing-ask h3 { margin: 0 0 8px; font-family: var(--display); font-size: 22px; font-weight: 600; }
.landing-ask ul { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: 15px; color: var(--text-2); }
.landing-hosts { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.host { display: grid; gap: 4px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.host-name { font-weight: 700; font-size: 15px; }
.host-status { font-family: var(--mono); font-size: 12px; letter-spacing: 0.06em; color: var(--text-2); }
.host-tested { border-color: var(--good); }
.host-tested .host-status { color: var(--good); }
.host-tested .host-status::before { content: '✓ '; }
.host-cannot .host-status { color: var(--danger); }
.host-note { font-size: 13px; color: var(--text-2); line-height: 1.5; }
.landing-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; margin-bottom: 16px; }
.landing .card { min-width: 0; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); font-size: 14px; line-height: 1.6; }
.landing .card h3 { margin: 0 0 8px; font-family: var(--display); font-size: 24px; font-weight: 600; }
.landing .card p, .landing .card ol { margin: 8px 0; }
.landing .card ol { padding-left: 20px; display: grid; gap: 6px; overflow-wrap: anywhere; }
.landing .card .note { color: var(--text-2); font-size: 13px; }
.landing .card .btn.sm { min-height: 44px; padding: 10px 12px; font-size: 11px; text-align: center; }
.landing .code { position: relative; margin: 10px 0; }
.landing .code pre { margin: 0; padding: 12px 84px 12px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); font-family: var(--mono); font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
.landing .copy { position: absolute; top: 50%; right: 4px; transform: translateY(-50%); min-height: 44px; min-width: 72px; padding: 0 12px; border: 1px solid var(--border-2); border-radius: var(--radius); background: var(--surface-2); color: var(--text); font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; cursor: pointer; }
.landing .copy:hover { border-color: var(--gold); color: var(--gold); }
.landing-final { text-align: center; }
.landing-final .landing-actions { justify-content: center; margin-top: 18px; }
.landing-footer { padding: 24px 0 40px; border-top: 1px solid var(--border); font-family: var(--mono); font-size: 12px; line-height: 1.7; color: var(--muted); }
.landing-footer p { margin: 0 0 8px; }
.landing-links a { display: inline-block; padding: 6px 0; }
.signin-back { margin: 20px 0 0; font-size: 14px; }
.signin-link { min-height: 44px; } /* the sign-in screen is where the landing page leads: full-size tap targets */
.signin-back a { display: inline-block; padding: 12px 0; color: var(--gold); text-decoration: underline; text-underline-offset: 2px; }
@media (max-width: 1000px) {
  .landing-hero { grid-template-columns: 1fr; gap: 28px; padding-top: 36px; }
  .landing-steps, .landing-cards { grid-template-columns: 1fr; }
  .landing-step { grid-template-rows: auto; grid-template-columns: 140px minmax(0, 1fr); align-items: start; }
  .landing-step img, .landing-address { height: auto; max-height: 260px; }
}
@media (max-width: 760px) {
  .landing { padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); }
  .landing-navlink { display: none; }
  .landing-hero { padding: 24px 0 28px; }
  .landing-hero .h1 { font-size: 32px; }
  .landing-lede { font-size: 16px; }
  .landing-actions .landing-cta { flex: 1 1 100%; }
  .landing-section { padding: 36px 0; }
  .landing-step { grid-template-columns: 1fr; }
  .landing-step img { max-height: 320px; }
  .landing-address { font-size: 12px; }
  .landing-hosts { grid-template-columns: 1fr; }
/* ---- Where to buy (#212, docs/where-to-buy-design.md): a text-only menu of plain links, opened in place (no pop-over, so nothing is clipped on a phone) ---- */
.buy { display: block; margin: 6px 0 0; min-width: 0; max-width: 100%; }
.ideas-or p { margin: 0 0 6px; }
.buy-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.buy-chev { margin-left: 8px; color: var(--gold); }
.buy-menu { display: grid; gap: 8px; margin-top: 8px; padding: 10px 12px; max-width: 460px; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); }
.buy-menu p, .buy-menu ul { margin: 0; }
.buy-line { font-size: 13px; line-height: 1.5; color: var(--text); }
.buy-change { margin-left: 4px; }
.buy-list { list-style: none; padding: 0; display: grid; gap: 0; }
.buy-list > li { border-top: 1px solid var(--border); }
.buy-list > li:first-child { border-top: 0; }
.buy-link { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 10px; box-sizing: border-box; min-height: 44px; padding: 8px 4px; color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.buy a.buy-link { color: var(--text); text-decoration: none; }
.buy-link:hover { background: var(--surface); }
.buy-link:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
.buy-link-name { font-weight: 600; font-size: 14px; }
.buy-link-name::after { content: ' ↗'; color: var(--gold); font-weight: 400; }
.buy-link-note { font-family: var(--mono); font-size: 12px; color: var(--text-2); }
.buy-scry { border-top: 1px solid var(--border); }
.buy-fine { font-size: 12px; line-height: 1.6; color: var(--text-2); }
.buy-fine summary { display: flex; align-items: center; min-height: 44px; cursor: pointer; }
.buy-fine a { color: var(--gold); text-decoration: underline; }
.buy-about { padding-left: 18px; }
.buy-error { color: var(--danger); font-size: 13px; line-height: 1.5; }
.buy-picker, .buy-form { display: grid; gap: 8px; }
.buy-label { font-family: var(--mono); font-size: 12px; color: var(--text-2); }
.buy-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.buy-store { display: grid; gap: 6px; margin: 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); min-width: 0; }
.buy-hint { font-size: 12px; line-height: 1.5; }
.buy-more { justify-self: start; }

/* ---- What a card does (#435): the card panel's list, Browse's filter, the deck page's "What it does" ---- */
.role-list { list-style: none; margin: 0; padding: 0; }
.role-item { border-bottom: 1px solid var(--border); }
.role-item:last-child { border-bottom: 0; }
.role-row { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; width: 100%; min-height: 44px; box-sizing: border-box; padding: 6px 2px; margin: 0;
  background: none; border: 0; color: var(--text); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.role-row:hover { background: var(--surface); }
.role-row:focus-visible, .role-toggle:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
.role-point { flex: 1 1 140px; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.role-strength { font-family: var(--mono); font-size: 12px; color: var(--text-2); }
.role-strength.core { color: var(--gold); }
.role-more { font-family: var(--mono); font-size: 12px; color: var(--text-2); text-decoration: underline; }
.role-count { min-width: 28px; text-align: right; font-family: var(--mono); font-size: 14px; color: var(--gold); }
.role-item.empty .role-point, .role-item.empty .role-count { color: var(--text-2); font-weight: 400; }
.role-why { padding: 4px 2px 12px; font-size: 13px; line-height: 1.5; }
.role-why p { margin: 0 0 8px; }
.role-label { margin: 10px 0 0; font-size: 12px; line-height: 1.5; color: var(--text-2); }
.role-cards { list-style: none; margin: 0; padding: 0; }
.role-cards li { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; min-height: 44px; font-size: 13px; }
.role-card-name { font-weight: 600; }
.role-rule { font-family: var(--mono); font-size: 12px; }
.role-filter { margin-top: 14px; }
.role-filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.role-chosen { max-width: 100%; }
.role-picker { margin-top: 10px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-2); }
.role-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.chip.role-toggle, .chip.role-chosen, .chip.role-toggle span, .chip.role-chosen span { font-size: 13px !important; }
.role-toggle, .role-chosen { min-height: 44px; box-sizing: border-box; max-width: 100%; text-align: left; white-space: normal; text-transform: none; letter-spacing: 0; font-family: inherit; font-size: 13px; }
.role-toggle-count { margin-left: 6px; color: var(--text-2); font-family: var(--mono); }
.role-match { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.role-match .chip { min-height: 44px; box-sizing: border-box; }
@media (max-width: 760px) {
  .role-picker { padding: 10px; }
  .role-grid { gap: 6px; }
  .chip.role-toggle, .chip.role-chosen, .chip.role-toggle span, .chip.role-chosen span { font-size: 12px !important; }
  .role-toggle { padding: 6px 10px; }
}

/* ==== Phone layout (up to 760px wide) ====
   Everything from here to the end of the file is inside phone-width media queries (only .m-only,
   phone-only elements, is hidden outside them), so wider screens render exactly as before; a test
   enforces it.
   Markup carries a few phone-only hooks: .page-head (a view's title row), .card-rail (a card row
   that scrolls sideways), .m-2col / .m-4col (inline grids that reflow), .acct-menu. */

@media (max-width: 760px) {
  /* ---- Navigation: the sections become a bottom tab bar, in thumb reach ---- */
  /* No backdrop-filter here: it would make the top bar the containing block of the fixed tab bar
     (which then sits on the top bar instead of the bottom of the screen). */
  .topbar {
    flex-wrap: nowrap; gap: 8px; padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top));
    padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right));
    backdrop-filter: none; -webkit-backdrop-filter: none; background: oklch(0.20 0.014 65 / 0.97);
  }
  .brand .title { font-size: 19px; }
  .brand .mark { width: 24px; height: 24px; font-size: 15px; }
  .nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 0;  /* five tabs on a shared collection (no Lab), six otherwise */
    margin: 0; padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    background: oklch(0.18 0.013 65 / 0.94); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
    overflow: visible; -webkit-mask-image: none; mask-image: none;
  }
  .nav button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    min-height: 58px; padding: 6px 2px;
    font-size: 11px; letter-spacing: 0.06em; color: var(--text-2);
    border-bottom: 0; border-top: 2px solid transparent;
  }
  /* Drawn icons (masks filled with the text colour, so the active tab turns gold with its label). */
  .nav button::before {
    content: ''; width: 22px; height: 22px; background: currentColor;
    -webkit-mask: center / contain no-repeat; mask: center / contain no-repeat;
  }
  .nav button[data-nav="vault"]::before { -webkit-mask-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='4' width='18' height='16' rx='2'/><circle cx='12' cy='12' r='4'/><path d='M12 8v1M12 15v1M8 12h1M15 12h1M6 20v1.5M18 20v1.5'/></svg>"); mask-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='4' width='18' height='16' rx='2'/><circle cx='12' cy='12' r='4'/><path d='M12 8v1M12 15v1M8 12h1M15 12h1M6 20v1.5M18 20v1.5'/></svg>"); } /* Vault (a vault door) */
  .nav button[data-nav="browse"]::before { -webkit-mask-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'><circle cx='10.5' cy='10.5' r='6'/><path d='M15 15l5.5 5.5'/></svg>"); mask-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'><circle cx='10.5' cy='10.5' r='6'/><path d='M15 15l5.5 5.5'/></svg>"); } /* Browse (search) */
  .nav button[data-nav="sets"]::before { -webkit-mask-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'><path d='M12 3l9 4.5-9 4.5-9-4.5z'/><path d='M3 12l9 4.5 9-4.5'/><path d='M3 16.5l9 4.5 9-4.5'/></svg>"); mask-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'><path d='M12 3l9 4.5-9 4.5-9-4.5z'/><path d='M3 12l9 4.5 9-4.5'/><path d='M3 16.5l9 4.5 9-4.5'/></svg>"); } /* Sets (stacked set layers) */
  .nav button[data-nav="decks"]::before { -webkit-mask-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'><rect x='3.5' y='6' width='10' height='14' rx='1.5' transform='rotate%28-10 8.5 13%29'/><rect x='10' y='4' width='10' height='14' rx='1.5' transform='rotate%288 15 11%29'/></svg>"); mask-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'><rect x='3.5' y='6' width='10' height='14' rx='1.5' transform='rotate%28-10 8.5 13%29'/><rect x='10' y='4' width='10' height='14' rx='1.5' transform='rotate%288 15 11%29'/></svg>"); } /* Decks (two fanned cards) */
  .nav button[data-nav="lab"]::before { -webkit-mask-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'><path d='M9 3h6M10 3v6l-5.5 9.5A1.5 1.5 0 0 0 5.8 21h12.4a1.5 1.5 0 0 0 1.3-2.5L14 9V3'/><path d='M7.5 15h9'/></svg>"); mask-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'><path d='M9 3h6M10 3v6l-5.5 9.5A1.5 1.5 0 0 0 5.8 21h12.4a1.5 1.5 0 0 0 1.3-2.5L14 9V3'/><path d='M7.5 15h9'/></svg>"); } /* Lab (flask) */
  .nav button[data-nav="ideas"]::before { -webkit-mask-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'><path d='M9 18h6M10 21h4'/><path d='M12 3a6 6 0 0 0-3.5 10.9c.6.5 1 1.2 1 2.1h5c0-.9.4-1.6 1-2.1A6 6 0 0 0 12 3z'/></svg>"); mask-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'><path d='M9 18h6M10 21h4'/><path d='M12 3a6 6 0 0 0-3.5 10.9c.6.5 1 1.2 1 2.1h5c0-.9.4-1.6 1-2.1A6 6 0 0 0 12 3z'/></svg>"); } /* Ideas (a light bulb) */
  .nav button.active { color: var(--gold); border-top-color: var(--gold); background: oklch(0.78 0.13 80 / 0.06); }
  main { padding: 14px max(12px, env(safe-area-inset-right)) 24px max(12px, env(safe-area-inset-left)); }
  /* Room for the tab bar after the last thing on the page (the footer). */
  .app.with-tabs { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }

  /* Account actions: compact, one row with the logo. */
  .acct-menu { gap: 6px !important; min-width: 0; }
  .acct-menu .btn { padding: 8px 9px; font-size: 11px; letter-spacing: 0.04em; min-height: 44px; }
  .acct-menu .btn { white-space: nowrap; }
  .acct-menu .acct-name { max-width: 110px; overflow: hidden; text-overflow: ellipsis; display: inline-block; }
  .acct-menu .acct-signout { display: none; }   /* in the Account panel instead */
  /* The automatic price refresh note would push the account actions off the row: screen readers
     still hear it, the dashboard shows the progress bar. */
  .topbar .auto-refresh {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
    overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
  }

  /* ---- Headings and a view's title row ---- */
  .h1 { font-size: 30px; line-height: 1.08; }
  .h2 { font-size: 22px; }
  .page-head { flex-wrap: wrap; align-items: flex-start !important; gap: 12px; margin-bottom: 18px !important; }
  .page-head > :last-child { text-align: left !important; }
  .page-head > :last-child > * { justify-content: flex-start !important; align-items: flex-start !important; }
  .section { margin-top: 24px; }
  .section-head { flex-wrap: wrap; align-items: flex-end; gap: 8px; }

  .deck-summary { grid-template-columns: 1fr 1fr 1fr; gap: 10px; padding: 12px; }
  /* Deck rows: the card name gets the width; the "need × price" column folds into the cost. */
  .deck-row { grid-template-columns: 26px minmax(0, 1fr) 56px 64px; gap: 8px; padding: 9px 10px; }
  .deck-row > :nth-child(4) { display: none; }
  .deck-group { padding: 10px 10px 6px; }
  .deck-summary > :first-child { grid-column: 1 / -1; }
  .deck-summary .deck-big { font-size: 22px; }
  .deck-library { grid-template-columns: 1fr; }

  /* ---- Stats: two by two ---- */
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 14px; }
  .stat .value { font-size: 28px; }
  .stat .value .currency { font-size: 15px; top: 4px; }
  .stat .delta { font-size: 10.5px; margin-top: 6px; }
  .stat-link-cue { opacity: 1; }

  /* ---- Cards: two (three on a wide phone) per row; the dashboard's rows scroll sideways ---- */
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .card-tile:hover { transform: none; }
  .card-tile .meta { padding: 8px 10px; }
  .card-tile .meta .name { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .card-tile .meta .sub { font-size: 10px; gap: 4px; }
  .card-grid.card-rail {
    display: grid; grid-auto-flow: column; grid-template-columns: none; grid-auto-columns: 42%;
    overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch;
    margin: 0 -12px; padding: 2px 12px 10px; scroll-padding: 0 12px;
  }
  .card-grid.card-rail > * { scroll-snap-align: start; }

  /* ---- Panels, rows and tables ---- */
  .panel { padding: 14px; }
  .panel.panel-flush { padding: 0; }   /* flush panels (tables) stay edge to edge */
  .panel.panel-tight { padding: 10px; }
  .col-2 { grid-template-columns: 1fr; gap: 12px; }
  .bar-row { grid-template-columns: 44px minmax(0, 1fr) 54px 56px; gap: 8px; }
  .tbl th, .tbl td { padding: 9px 8px; }
  .tbl td { font-size: 13px; }
  /* The card's name stays in view while a wide table scrolls sideways. */
  .tbl th:first-child, .tbl td:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); box-shadow: 1px 0 0 var(--border); }
  .tbl td:first-child { min-width: 130px; max-width: 170px; }

  /* ---- Controls: fingertip-sized ---- */
  button.brand { min-height: 44px; }   /* the logo is a button: the way home */
  .btn { min-height: 44px; }
  .btn.sm, .btn.xs { min-height: 44px; padding: 6px 10px; }
  .chip { min-height: 44px; padding: 6px 12px; font-size: 11px; }
  .input, .select { min-height: 44px; font-size: 16px !important; } /* 16px stops iOS zooming into a focused field */
  .pip { min-width: 28px; min-height: 28px; }
  .row-link { display: inline-flex; align-items: center; min-height: 44px; }   /* a row's name opens the card */
  .row { flex-wrap: wrap; }

  /* ---- Inline grids that reflow ---- */
  .m-2col { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .m-4col { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
}

/* Phone-only elements (hidden on wider screens). */
.m-only { display: none !important; }
@media (max-width: 760px) { .m-only { display: inline-flex !important; } }

/* A wide phone or a small tablet in portrait: three cards per row. */
@media (min-width: 520px) and (max-width: 760px) {
  .card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .card-grid.card-rail { grid-auto-columns: 30%; }
}

/* In-app help on phones */
@media (max-width: 760px) {
  .acct-menu .acct-help { display: none; }   /* the "?" on each page and the welcome link to it */
  .welcome { margin: 12px 16px 0; }
}

/* ---- Phone-first pass (#95): tap targets of 44 px, text of 12 px, labels of 11 px ----
   Measured at 390 x 844 on every view with a collection of 21,950 copies (scripts/measure_phone.js). Last in the file so it
   wins over the sizes set above and in styles.css. SVG chart text scales with its chart and is not counted. */
@media (max-width: 760px) {
  button.brand, .btn, .btn.sm, .btn.xs, .chip, .row-link, [role="button"], [role="tab"], .acct-menu .btn { min-height: 44px; }
  .btn, .btn.sm, .btn.xs, .chip { font-size: 11px; }
  .acct-menu .btn { font-size: 11px; letter-spacing: 0.04em; padding: 8px 10px; }
  .nav button { font-size: 11px; letter-spacing: 0.02em; }
  .eyebrow, .label-mono, .label, .badge, .tbl th, th { font-size: 11px !important; }
  .chip span { font-size: 11px; }
  .brand .subtitle { font-size: 11px; }
  td.muted, .tbl td.muted, .qty, .delta, .stat .delta, .card-tile .meta .sub { font-size: 12px !important; }
  .vault-footer, .vault-footer p, .vault-footer a, main p > a, .welcome a { font-size: 12px; }
  .stat-link-cue, .ledger-foot, .chip span { font-size: 11px !important; }
  .freshness, .freshness span, .placeholder, .placeholder span, .code, .code span, p.muted, .panel > p.muted { font-size: 12px !important; }
  .deck-row.head, .deck-row.head div { font-size: 11px !important; }
  span.pip.sm { width: 22px; height: 22px; font-size: 12px; }   /* the letter in a small colour pip */
  /* Bigger text must not crowd the stat cards: the label and its cue wrap as whole words, the freshness line breaks between its parts. */
  .stat .label { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 8px; letter-spacing: 0.1em; }
  .stat-link-cue { white-space: nowrap; letter-spacing: 0.04em; }
  .freshness { flex-wrap: wrap; gap: 2px 6px; letter-spacing: 0.02em; }
  .freshness > span { white-space: nowrap; }
  /* Text sized in the markup (a style attribute) below 12 px: raised to 12 px. */
  [style*="font-size: 11px"], [style*="font-size: 11.5px"], [style*="font-size: 10.5px"], [style*="font-size: 10px"],
  [style*="font-size: 9.5px"], [style*="font-size: 9px"], [style*="font-size: 7.5px"] { font-size: 12px !important; }
}
