[hidden] { display: none !important; }   /* elements hidden in markup must stay hidden whatever their display rule */
:root {
  --bg: #f6f5f1; --surface: #fff; --ink: #1b1f24; --muted: #66707b; --line: #e3e0d8;
  --accent: #2a5bd7; --accent-soft: #e8eefc; --good: #1e7b4a; --warm: #c46a12;
  --mono: ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light;
}
/* Theme: follows the device unless the header switch picked light or dark (theme.js sets data-theme on <html>). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #111418; --surface: #181c22; --ink: #e7ebef; --muted: #96a0ab; --line: #2a3038;
          --accent: #7aa2ff; --accent-soft: #1d2a47; --good: #6fd197; --warm: #f0a65a; color-scheme: dark; }
}
:root[data-theme="dark"] { --bg: #111418; --surface: #181c22; --ink: #e7ebef; --muted: #96a0ab; --line: #2a3038;
          --accent: #7aa2ff; --accent-soft: #1d2a47; --good: #6fd197; --warm: #f0a65a; color-scheme: dark; }
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.5 var(--sans); background: var(--bg); color: var(--ink); }
a { color: var(--accent); }
.muted { color: var(--muted); }
.top { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; align-items: flex-end; padding: 22px 28px 14px; }
.top h1 { margin: 0; font-size: 1.6rem; letter-spacing: -.02em; }
.tag { font: 600 .66rem/1 var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--warm); border: 1px solid currentColor; padding: 3px 6px; border-radius: 4px; vertical-align: middle; }
.sub { margin: 4px 0 0; color: var(--muted); max-width: 70ch; }
.fresh { font-size: .82rem; text-align: right; display: grid; gap: 2px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: end; padding: 10px 28px 14px; border-bottom: 1px solid var(--line); }
.filters label { display: grid; gap: 3px; font-size: .74rem; color: var(--muted); font-weight: 600; }
.filters label.check { display: flex; align-items: center; gap: 6px; font-size: .84rem; color: var(--ink); font-weight: 500; padding-bottom: 6px; }
.filters select { font: inherit; font-size: .9rem; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; max-width: 280px; }
.count { margin-left: auto; color: var(--muted); padding-bottom: 6px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 14px var(--split-detail, minmax(360px, 40%)); gap: 2px; padding: 16px 28px; align-items: stretch; }
.layout > .list, .layout > .detail { align-self: start; }
.list { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: auto; max-height: calc(100vh - 210px); }
table { width: 100%; border-collapse: collapse; }
th { position: sticky; top: 0; background: var(--surface); text-align: left; font-size: .72rem; color: var(--muted); font-weight: 600; padding: 10px 10px; border-bottom: 1px solid var(--line); z-index: 1; }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
#rows tr { cursor: pointer; }
#rows tr:hover td, #rows tr.sel td { background: var(--accent-soft); }
.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.score-col { width: 150px; }
.scorecell { display: flex; align-items: center; gap: 8px; }
.mname { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 320px; }
.scorebar { flex: 1; height: 7px; background: var(--line); border-radius: 4px; overflow: hidden; min-width: 60px; }
.scorebar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--warm)); }
.scorenum { font: 700 .9rem var(--mono); width: 28px; text-align: right; }
.open { display: inline-block; min-width: 22px; text-align: center; font-weight: 700; color: var(--good); background: color-mix(in srgb, var(--good) 14%, transparent); border-radius: 10px; padding: 0 7px; }
.detail { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 18px; position: sticky; top: 12px; max-height: calc(100vh - 210px); overflow: auto; }
.detail h2 { margin: 2px 0; font-size: 1.25rem; letter-spacing: -.01em; }
.detail h3 { font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 18px 0 8px; }
.empty ul { padding-left: 18px; }
.dhead { position: relative; padding-right: 90px; }
.place { font-weight: 600; }
.big { position: absolute; right: 0; top: 0; display: grid; justify-items: center; }
.big span { font: 700 2.2rem/1 var(--mono); color: var(--accent); }
.big small { color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; }
.parts { display: grid; gap: 10px; margin-top: 14px; }
.part p { margin: 4px 0 0; font-size: .86rem; color: var(--muted); }
.prow { display: flex; justify-content: space-between; font-size: .86rem; margin-bottom: 4px; }
.hist { display: flex; gap: 8px; align-items: end; height: 90px; }
.hbar { flex: 1; display: grid; grid-template-rows: 1fr auto; height: 100%; text-align: center; font-size: .76rem; color: var(--muted); }
.hbar i { align-self: end; display: block; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 2px; }
.hbar:first-child i { background: var(--warm); }
.list2 { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: .88rem; }
.list2 li span { display: block; }
.opps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: .88rem; }
.opps a { font-weight: 600; text-decoration: none; }
.opps a:hover { text-decoration: underline; }
.scroll { overflow-x: auto; }
table.small { font-size: .8rem; }
table.small td, table.small th { padding: 6px 6px; position: static; }
.note { font-size: .8rem; margin-top: 16px; }
.foot { padding: 14px 28px 26px; font-size: .78rem; color: var(--muted); }
@media (max-width: 1000px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .gutter { display: none; }
  .list, .detail { max-height: none; position: static; }
  .hide-s { display: none; }
  .top, .filters, .layout, .foot { padding-left: 16px; padding-right: 16px; }
}

/* navigation and intro */
.nav { display: flex; gap: 4px; margin-top: 8px; }
.nav a { text-decoration: none; color: var(--muted); padding: 5px 12px; border-radius: 6px; font-weight: 600; font-size: .9rem; }
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.intro { margin: 0 28px 4px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 8px; }
.intro p { margin: 0; max-width: 120ch; }
.small { font-size: .82rem; }

/* help buttons and popover */
.help { width: 17px; height: 17px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  font: 700 .66rem/1 var(--sans); cursor: pointer; padding: 0; vertical-align: middle; }
.help:hover, .help:focus-visible { color: var(--accent); border-color: var(--accent); }
.pop { position: absolute; z-index: 20; max-width: 320px; background: var(--ink); color: var(--bg); padding: 10px 12px; border-radius: 8px;
  font-size: .84rem; line-height: 1.45; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); }

/* detail tabs, story, cards */
.tabs { display: flex; gap: 4px; margin: 14px 0 4px; border-bottom: 1px solid var(--line); }
.tabs button { border: 0; background: none; color: var(--muted); font: 600 .88rem var(--sans); padding: 8px 10px; border-bottom: 2px solid transparent; cursor: pointer; }
.tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.dsec p { margin: 0 0 6px; }
.story { font-size: .95rem; line-height: 1.6; }
.hbar b { font-size: .72rem; color: var(--ink); }
.hbar { grid-template-rows: auto 1fr auto; }
.chip { display: inline-block; margin-left: 6px; font-size: .68rem; font-weight: 700; padding: 0 6px; border-radius: 8px; border: 1px solid var(--line); color: var(--muted); }
.chip.local { color: var(--good); border-color: currentColor; }
.cards { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 10px; }
.card { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; display: grid; gap: 6px; }
.ctop { display: flex; justify-content: space-between; gap: 10px; align-items: start; }
.bids { flex: none; font: 700 .72rem var(--mono); padding: 2px 7px; border-radius: 10px; border: 1px solid var(--line); color: var(--muted); }
.bids.one { color: var(--warm); border-color: currentColor; }
.kv { display: grid; grid-template-columns: 84px 1fr; gap: 3px 10px; margin: 0; font-size: .84rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.ext { font-size: .84rem; font-weight: 600; text-decoration: none; }
.ext:hover { text-decoration: underline; }
.badge { flex: none; display: inline-block; font-size: .7rem; font-weight: 700; padding: 2px 8px; border-radius: 10px; white-space: nowrap; }
.badge.bid { background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good); }
.badge.soon { background: var(--accent-soft); color: var(--accent); }
.badge.research { background: color-mix(in srgb, var(--warm) 16%, transparent); color: var(--warm); }
.legend { display: grid; gap: 4px; font-size: .8rem; color: var(--muted); margin: 8px 0; }

/* guide page */
.guide { display: grid; grid-template-columns: 220px minmax(0, 760px); gap: 32px; padding: 8px 28px 40px; }
.toc { position: sticky; top: 16px; align-self: start; display: grid; gap: 2px; }
.toc a { text-decoration: none; color: var(--muted); padding: 4px 8px; border-left: 2px solid var(--line); font-size: .9rem; }
.toc a:hover { color: var(--ink); border-left-color: var(--accent); }
.guide article { line-height: 1.65; font-size: .97rem; }
.guide h2 { font-size: 1.25rem; letter-spacing: -.01em; margin: 30px 0 8px; scroll-margin-top: 16px; }
.guide section:first-child h2 { margin-top: 4px; }
.steps { padding-left: 22px; display: grid; gap: 6px; }
.explain { border-collapse: collapse; margin: 10px 0; font-size: .9rem; }
.explain th, .explain td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; position: static; }
.gloss { display: grid; grid-template-columns: 200px 1fr; gap: 6px 16px; }
.gloss dt { font-weight: 700; }
.gloss dd { margin: 0; }
@media (max-width: 900px) {
  .guide { grid-template-columns: minmax(0, 1fr); padding: 8px 16px 32px; }
  .toc { position: static; grid-auto-flow: row; }
  .gloss { grid-template-columns: minmax(0, 1fr); }
  .intro { margin: 0 16px 4px; }
}

/* keep the market name readable next to the help buttons */
#rows td:nth-child(2), thead th:nth-child(2) { min-width: 210px; }
.list2 li .chip { display: inline-block; }
.score-col { width: 110px; }
.scorebar { min-width: 40px; }
th { white-space: nowrap; padding-left: 7px; padding-right: 7px; }
td { padding-left: 7px; padding-right: 7px; }

/* pursue tab and brief link */
.brieflink { display: inline-block; margin-top: 10px; font-size: .85rem; font-weight: 600; text-decoration: none; }
.plan { padding-left: 22px; display: grid; gap: 12px; }
.plan h4 { margin: 0 0 4px; font-size: .95rem; }
.plan p { font-size: .88rem; }
.plan ul { padding-left: 18px; margin: 4px 0 6px; font-size: .88rem; }

/* start here checklist */
.callout { background: var(--accent-soft); border-radius: 10px; padding: 14px 16px; margin: 10px 0; }
.callout p { margin: 0 0 8px; } .callout p:last-child { margin: 0; }
.tasks { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 10px; counter-reset: t; }
.tasks li { display: grid; grid-template-columns: 22px 1fr; gap: 2px 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.tasks li input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--good); cursor: pointer; }
.tasks li label { cursor: pointer; }
.tasks li p { grid-column: 2; margin: 2px 0 0; color: var(--muted); font-size: .9rem; }
.tasks li.done { border-color: color-mix(in srgb, var(--good) 45%, var(--line)); }
.tasks li.done label b { text-decoration: line-through; text-decoration-color: var(--good); }
.stagecount { font: 600 .8rem var(--mono); color: var(--muted); margin-left: 6px; }
.stage.complete h2 .stagecount { color: var(--good); }
.stage.complete h2 .stagecount::after { content: " ✓"; }
.bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin: 4px 0; min-width: 160px; }
.bar i { display: block; height: 100%; width: 0; background: var(--good); transition: width .2s; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--muted); font: inherit; font-size: .78rem; text-decoration: underline; cursor: pointer; }
.subs { color: var(--accent); font-weight: 700; }

/* account menu, sign-in page, admin */
.headright { display: grid; justify-items: end; gap: 8px; }
.who { display: flex; gap: 12px; align-items: center; font-size: .86rem; }
.who a { text-decoration: none; font-weight: 600; }
.whoname { color: var(--muted); }
.authpage { display: grid; place-items: center; min-height: 100vh; padding: 24px 16px; }
.authbox { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 26px; }
.authbox h1 { margin: 0 0 4px; font-size: 1.5rem; }
.field { display: grid; gap: 4px; margin-bottom: 12px; }
.field label { font-size: .84rem; font-weight: 600; }
.field input, .inviteform input, .inviteform select { font: inherit; padding: 9px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); color: var(--ink); width: 100%; }
.authbox button[type=submit], .panelbox button[type=submit], .inviteform button { font: 600 .95rem var(--sans); background: var(--accent); color: #fff; border: 0; border-radius: 7px; padding: 10px 16px; cursor: pointer; }
.authbox button[type=submit] { width: 100%; }
.err { color: #c0392b; min-height: 1.2em; margin: 0 0 8px; font-size: .88rem; }
.err.ok { color: var(--good); }
.switch { text-align: center; font-size: .9rem; color: var(--muted); }
.adminpage { padding: 8px 28px 40px; max-width: 1200px; }
.panelbox { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin-bottom: 16px; }
.panelbox.narrow { max-width: 440px; }
.panelbox h3 { margin: 0 0 10px; }
.inviteform { display: grid; grid-template-columns: minmax(180px, 2fr) 90px 140px auto; gap: 10px; align-items: end; }
.inviteform label { display: grid; gap: 4px; font-size: .78rem; color: var(--muted); font-weight: 600; }
.newlink { margin-top: 12px; padding: 12px; border: 1px dashed var(--accent); border-radius: 8px; background: var(--accent-soft); display: grid; gap: 8px; }
.newlink p { margin: 0; }
.newlink code { font: 600 .9rem var(--mono); word-break: break-all; user-select: all; }
button.small { font: 600 .8rem var(--sans); border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 6px; padding: 4px 10px; cursor: pointer; justify-self: start; }
button.small.armed { border-color: #c0392b; color: #c0392b; }
.flash { padding: 8px 12px; border-radius: 6px; background: var(--accent-soft); margin: 0 0 10px; }
.flash.bad { background: #fde8e6; color: #8a1f14; }
.adminpage .list { max-height: none; }
@media (max-width: 760px) { .inviteform { grid-template-columns: 1fr 1fr; } .adminpage { padding: 8px 16px 32px; } }

.authbox .brandline { font-weight: 700; color: var(--muted); font-size: .9rem; margin-bottom: 14px; }
.authbox h1 { font-size: 1.6rem; letter-spacing: -.02em; margin: 0 0 4px; }
.invited { display: inline-block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--good);
  background: color-mix(in srgb, var(--good) 14%, transparent); padding: 3px 9px; border-radius: 10px; margin-bottom: 8px; }
.registering .authbox { border-top: 4px solid var(--good); }
.registering .authbox button[type=submit] { background: var(--good); }

/* ---------- drag handle between the market list and the detail panel (splitter.js) */
.gutter { position: relative; cursor: col-resize; touch-action: none; outline: 0; border-radius: 4px; min-height: 120px; }
.gutter::after { content: ""; position: absolute; top: 0; bottom: 0; left: 6px; width: 2px; border-radius: 2px; background: var(--line); transition: background .12s; }
.gutter:hover::after, .gutter:focus-visible::after, .gutter.active::after { background: var(--accent); }
body.resizing { user-select: none; }
body.resizing-x, body.resizing-x * { cursor: col-resize !important; }

/* ---------- header extras: theme switch and feedback */
.iconbtn { background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 6px; padding: 2px 8px; font: inherit; font-size: .82rem; cursor: pointer; }
.iconbtn:hover { color: var(--ink); border-color: var(--accent); }

/* ---------- feedback dialog (native <dialog>) */
.fb-dialog { width: min(520px, calc(100vw - 32px)); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
.fb-dialog::backdrop { background: rgba(0, 0, 0, .45); }
.fb-head { display: flex; justify-content: space-between; align-items: center; }
.fb-head h3 { margin: 0; }
.fb-x { background: none; border: 0; color: var(--muted); font-size: 1.4rem; line-height: 1; cursor: pointer; }
.fb-kinds { border: 0; padding: 0; margin: 12px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.fb-kinds legend { font-size: .86rem; font-weight: 600; margin-bottom: 6px; }
.fb-kind { display: flex; gap: 8px; align-items: center; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: .88rem; cursor: pointer; }
.fb-kind:has(input:checked) { border-color: var(--accent); }
.fb-form textarea { font: inherit; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); resize: vertical; min-height: 120px; }
.fb-actions { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.fb-actions button[type=submit] { font: 600 .95rem var(--sans); background: var(--accent); color: #fff; border: 0; border-radius: 7px; padding: 9px 16px; cursor: pointer; }
.toast { position: fixed; right: 18px; bottom: 18px; z-index: 50; background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: 8px; font-size: .9rem; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); }
@media (max-width: 520px) { .fb-kinds { grid-template-columns: 1fr; } }

/* ---------- recovery codes and copyable links */
.recovery { display: grid; gap: 10px; padding: 14px; border: 1px dashed var(--accent); border-radius: 10px; margin: 8px 0 14px; }
.recovery-code { font: 600 1.3rem/1.2 var(--mono); letter-spacing: .08em; text-align: center; user-select: all; padding: 4px 0; }
.check-line { display: flex; gap: 8px; align-items: center; margin: 4px 0 14px; font-size: .9rem; cursor: pointer; }
.linkbox { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; margin: 8px 0; }
.linkbox input { font: .8rem var(--mono); width: 100%; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); color: var(--ink); }
.linkbox p { grid-column: 1 / -1; margin: 0; }

/* ---------- admin: feedback inbox */
.fb-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 10px; }
.fb-item { display: grid; gap: 8px; }
.fb-item.handled { opacity: .7; }
.fb-row { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: center; }
.fb-msg { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }
.filters-inline { display: flex; gap: 6px; flex-wrap: wrap; }
.filters-inline button[aria-selected="true"] { border-color: var(--accent); color: var(--accent); }

.authbox button.primary { font: 600 .95rem var(--sans); background: var(--accent); color: #fff; border: 0; border-radius: 7px; padding: 10px 16px; cursor: pointer; width: 100%; }
.authbox button.primary:disabled { opacity: .55; cursor: default; }
.authbox .recovery button.small { justify-self: center; }
