/* One centered 1040px column. Colour only for state; one filled button per screen. */
:root {
  --blue: #007BFF; --blue-ink: #0068D7; --blue-hover: #0068D7;
  --tint: #E3F1FF; --tint-2: #F2F8FF; --line-blue: #C9E3FF;
  --ink: #212121; --ink-2: #343A40; --muted: #5F6368; --faint: #8A8F96;
  --page: #F7FAFD; --surface: #FFFFFF; --sunken: #EEF2F7; --border: #E6E9EE;
  --ok: #15803D; --ok-tint: #E7F6EC; --warn: #B45309; --warn-tint: #FEF3E2;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --font-ui: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-head: "Urbanist", "Inter", ui-sans-serif, system-ui, sans-serif;
  --r: 12px; --r-sm: 8px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --blue: #3B95FF; --blue-ink: #7DB8FF; --blue-hover: #5AA6FF;
  --tint: #13305A; --tint-2: #0F2240; --line-blue: #23497E;
  --ink: #ECEFF3; --ink-2: #D6DBE2; --muted: #A6AEB9; --faint: #7F8894;
  --page: #0D1117; --surface: #151B23; --sunken: #1C2430; --border: #262F3B;
  --ok: #4ADE80; --ok-tint: #12301E; --warn: #FBBF24; --warn-tint: #33260C;
  --shadow: 0 1px 2px rgba(0,0,0,.4); color-scheme: dark; } }
:root[data-theme="dark"] {
  --blue: #3B95FF; --blue-ink: #7DB8FF; --blue-hover: #5AA6FF;
  --tint: #13305A; --tint-2: #0F2240; --line-blue: #23497E;
  --ink: #ECEFF3; --ink-2: #D6DBE2; --muted: #A6AEB9; --faint: #7F8894;
  --page: #0D1117; --surface: #151B23; --sunken: #1C2430; --border: #262F3B;
  --ok: #4ADE80; --ok-tint: #12301E; --warn: #FBBF24; --warn-tint: #33260C;
  --shadow: 0 1px 2px rgba(0,0,0,.4); color-scheme: dark; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { background: var(--page); color: var(--ink); font: 400 14.5px/1.5 var(--font-ui); -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
.wrap { max-width: 1040px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

/* ---------- header ---------- */
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--surface); border-bottom: 1px solid var(--border); }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--surface); }
.top .wrap { display: flex; align-items: center; gap: 20px; height: 60px; }
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--ink); flex: none; }
.brand img { width: 28px; height: 28px; border-radius: 8px; }
.brand span { font: 700 18px/1 var(--font-head); letter-spacing: -.01em; }
.brand em { font-style: normal; color: var(--muted); font-weight: 600; }
.nav { display: flex; gap: 2px; }
.nav a { color: var(--muted); text-decoration: none; font-weight: 500; padding: 7px 12px; border-radius: 8px; }
.nav a:hover { color: var(--ink); background: var(--sunken); }
.nav a[aria-current="page"] { color: var(--ink); font-weight: 600; background: var(--sunken); }
.top .right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.search { position: relative; }
.search input { width: 220px; height: 36px; border: 1px solid var(--border); background: var(--page); border-radius: 999px; padding: 0 14px 0 34px; }
.search input::placeholder { color: var(--faint); }
.search svg { position: absolute; left: 12px; top: 10px; color: var(--faint); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--tint); color: var(--blue-ink); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-weight: 600; white-space: nowrap; transition: background .15s, border-color .15s, color .15s; }
.btn:hover { background: var(--sunken); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-hover); border-color: var(--blue-hover); }
.btn.ghost { border-color: transparent; background: none; }
.btn.ghost:hover { background: var(--sunken); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- page ---------- */
main { padding-block: 28px 64px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
h1 { font: 700 28px/1.15 var(--font-head); letter-spacing: -.015em; margin: 0; text-wrap: balance; }
.sub { color: var(--muted); margin: 4px 0 0; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs { display: inline-flex; background: var(--sunken); border-radius: 999px; padding: 3px; }
.tabs button { border: 0; background: none; padding: 5px 13px; border-radius: 999px; color: var(--muted); font-weight: 500; }
.tabs button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 4px 11px; color: var(--muted); font-weight: 500; font-size: 13px; }
.chip:hover { color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--tint); border-color: var(--line-blue); color: var(--blue-ink); }

/* status pills: colour only for state */
.st { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.st::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-open { color: var(--muted); background: var(--sunken); }
.st-planned { color: var(--blue-ink); background: var(--tint); }
.st-progress { color: var(--warn); background: var(--warn-tint); }
.st-done { color: var(--ok); background: var(--ok-tint); }

/* list */
.list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); }
.row { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; border-top: 1px solid var(--border); cursor: pointer; transition: background .15s; }
.row:first-child { border-top: 0; border-radius: var(--r) var(--r) 0 0; }
.row:last-child { border-radius: 0 0 var(--r) var(--r); }
.row:hover { background: var(--tint-2); }
.row.sel { background: var(--tint); }
.row .body { min-width: 0; flex: 1; }
.row h3 { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.35; }
.row p { margin: 3px 0 0; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta { display: flex; align-items: center; gap: 12px; margin-top: 8px; color: var(--faint); font-size: 12.5px; flex-wrap: wrap; }
.meta .c { display: inline-flex; align-items: center; gap: 4px; }

.vote { flex: none; width: 48px; height: 54px; border: 1px solid var(--border); background: var(--surface); border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; font-weight: 700; font-variant-numeric: tabular-nums; transition: background .15s, border-color .15s, color .15s, transform .12s; }
.vote:hover { border-color: var(--line-blue); }
.vote:active { transform: scale(.96); }
.vote svg { color: var(--faint); }
.vote[aria-pressed="true"] { background: var(--tint); border-color: var(--line-blue); color: var(--blue-ink); }
.vote[aria-pressed="true"] svg { color: var(--blue); }
.vote.lg { width: 60px; height: 66px; font-size: 17px; }

/* composer (inline, never a modal) */
.composer { background: var(--surface); border: 1px solid var(--line-blue); border-radius: var(--r); padding: 16px; margin-bottom: 16px; display: grid; gap: 10px; }
.composer label { font-weight: 600; font-size: 13px; }
.field { width: 100%; border: 1px solid var(--border); background: var(--page); border-radius: var(--r-sm); padding: 10px 12px; }
.field:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px var(--tint); }
textarea.field { min-height: 84px; resize: vertical; }
.similar { border-radius: var(--r-sm); background: var(--tint-2); border: 1px solid var(--line-blue); padding: 10px 12px; display: grid; gap: 8px; }
.similar .h { font-size: 12.5px; font-weight: 600; color: var(--blue-ink); }
.similar .s { display: flex; align-items: center; gap: 10px; }
.similar .s span { flex: 1; min-width: 0; }
.composer .actions { display: flex; justify-content: flex-end; gap: 8px; }

/* columns (roadmap + concept C) */
.cols { display: grid; grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); gap: 14px; align-items: start; }
.col { background: var(--sunken); border-radius: var(--r); padding: 12px; display: grid; gap: 8px; }
.col-h { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 4px; }
.col-h .n { color: var(--faint); font-weight: 600; font-variant-numeric: tabular-nums; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 11px 12px; display: flex; gap: 10px; align-items: flex-start; cursor: pointer; transition: border-color .15s; }
.card:hover { border-color: var(--line-blue); }
.card h4 { margin: 0; font-size: 14px; font-weight: 600; line-height: 1.35; flex: 1; min-width: 0; }
.card .v { flex: none; display: inline-flex; align-items: center; gap: 3px; color: var(--muted); font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.card .v.on { color: var(--blue-ink); }

/* post detail */
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-weight: 500; margin-bottom: 14px; }
.back:hover { color: var(--ink); }
.post { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 20px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 22px; }
.post-h { display: flex; gap: 16px; align-items: flex-start; }
.post-h h2 { font: 700 22px/1.25 var(--font-head); letter-spacing: -.01em; margin: 0 0 6px; text-wrap: balance; }
.post .text { margin: 16px 0 0; color: var(--ink-2); max-width: 65ch; }
.side { display: grid; gap: 14px; }
.side .panel { padding: 16px; }
.kv { display: grid; gap: 10px; font-size: 13px; }
.kv div { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; text-align: right; }
.voters { display: flex; }
.voters .avatar { width: 26px; height: 26px; font-size: 11px; border: 2px solid var(--surface); margin-left: -6px; }
.voters .avatar:first-child { margin-left: 0; }
.comments { margin-top: 22px; border-top: 1px solid var(--border); padding-top: 18px; display: grid; gap: 16px; }
.comments h3 { margin: 0; font-size: 14px; }
.cm { display: flex; gap: 10px; }
.cm .who { font-weight: 600; font-size: 13.5px; }
.cm .who small { color: var(--faint); font-weight: 400; margin-left: 6px; }
.cm p { margin: 2px 0 0; color: var(--ink-2); }
.team { font-size: 11px; font-weight: 700; color: var(--blue-ink); background: var(--tint); border-radius: 999px; padding: 1px 7px; margin-left: 6px; vertical-align: 1px; }
.cm-box { display: flex; gap: 10px; align-items: flex-start; }
.cm-box .field { min-height: 44px; }
.admin { border: 1px dashed var(--line-blue); background: var(--tint-2); }
.admin h4 { margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--blue-ink); }
.admin select { width: 100%; height: 36px; border: 1px solid var(--border); background: var(--surface); border-radius: var(--r-sm); padding: 0 10px; }
.admin .gap { display: grid; gap: 8px; }
.admin .note { font-size: 12.5px; color: var(--muted); margin: 0; }

/* changelog */
.feed { display: grid; gap: 0; max-width: 720px; }
.entry { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 20px; padding: 22px 0; border-top: 1px solid var(--border); }
.entry:first-child { border-top: 0; padding-top: 4px; }
.entry time { color: var(--muted); font-weight: 500; font-size: 13px; padding-top: 3px; font-variant-numeric: tabular-nums; }
.entry h3 { margin: 0; font: 700 18px/1.3 var(--font-head); }
.entry p { margin: 6px 0 0; color: var(--ink-2); max-width: 62ch; }
.closes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.closes a { font-size: 12.5px; color: var(--ok); background: var(--ok-tint); border-radius: 999px; padding: 2px 9px; text-decoration: none; font-weight: 600; }
.rss { color: var(--muted); font-size: 13px; display: inline-flex; gap: 6px; align-items: center; }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 16px); opacity: 0; z-index: 60; background: var(--ink); color: var(--surface); padding: 10px 16px; border-radius: 999px; font-weight: 500; box-shadow: 0 6px 20px rgba(0,0,0,.18); transition: opacity .2s, transform .2s cubic-bezier(.22,1,.36,1); max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.empty { padding: 36px 16px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--ink); margin-bottom: 4px; }
.hide-sm { }

@media (max-width: 860px) {
  .post { grid-template-columns: minmax(0, 1fr); }
  .cols { grid-template-columns: minmax(0, 1fr); }
  .search input { width: 160px; }
}
@media (max-width: 640px) {
  .top .wrap { gap: 10px; height: auto; padding-block: 10px; flex-wrap: wrap; }
  .nav { order: 3; width: 100%; overflow-x: auto; }
  .search { display: none; }
  .brand em { display: none; }
  .entry { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  h1 { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation-duration: .001ms !important; }
  .spin { animation: none; border-top-color: var(--blue); }
}

/* ---------- server-rendered board additions ---------- */
body { margin: 0; }
a { color: var(--blue-ink); }
.tabs a { display: inline-block; padding: 5px 13px; border-radius: 999px; color: var(--muted); font-weight: 500; text-decoration: none; }
.tabs a[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow); }
.chip { text-decoration: none; }
.btn { text-decoration: none; color: var(--ink); }
.btn.primary { color: #fff; }
.searching { color: var(--muted); font-size: 13px; }

.row { position: relative; cursor: default; }
.row h3 a { color: inherit; text-decoration: none; }
.row h3 a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.row h3 a:focus-visible { outline: none; }
.row:has(h3 a:focus-visible) { outline: 2px solid var(--blue); outline-offset: -2px; }
.row .vote { position: relative; z-index: 1; }
.vote { color: var(--ink); text-decoration: none; }
.flag { color: var(--warn); font-weight: 600; }

.card { text-decoration: none; color: var(--ink); }
.card h3 { margin: 0; font-size: 14px; font-weight: 600; line-height: 1.35; flex: 1; min-width: 0; }
.col-empty { margin: 4px; color: var(--faint); font-size: 13px; }

.post-title { font: 700 22px/1.25 var(--font-head); letter-spacing: -.01em; margin: 0 0 6px; text-wrap: balance; }
.post .post-h .meta { margin-top: 2px; }
.text p, .text ul { margin: 0 0 10px; }
.text p:last-child, .text ul:last-child { margin-bottom: 0; }
.text ul { padding-left: 20px; }
.text img { max-width: 100%; }
.text-sm { color: var(--ink-2); }
.text-sm p, .text-sm ul { margin: 2px 0 6px; }
.text-sm ul { padding-left: 18px; }
.shipped { margin: 16px 0 0; color: var(--ok); font-weight: 600; }
.shipped a { color: inherit; }
.h-sm { margin: 0; font-size: 14px; }
.cm-main { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.cm.is-hidden { opacity: .5; }
.replies { margin-top: 12px; display: grid; gap: 14px; }
.linkish { border: 0; background: none; padding: 0; color: var(--muted); font-size: 12.5px; font-weight: 500; margin-left: 8px; }
.linkish:hover { color: var(--ink); text-decoration: underline; }
.reply { margin-left: 0; margin-top: 4px; }
.cm-field { flex: 1; display: grid; gap: 8px; min-width: 0; }
.cm-field .actions { display: flex; justify-content: flex-end; }
.replying { font-size: 12.5px; color: var(--muted); }
.replying .linkish { margin-left: 0; }
.h-admin { margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--blue-ink); }
.admin label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }

.entry-title { margin: 0; font: 700 18px/1.3 var(--font-head); }
.entry-title a { color: inherit; text-decoration: none; }
.entry-title a:hover { text-decoration: underline; }
.entry .text { margin-top: 6px; color: var(--ink-2); max-width: 62ch; }
.rss { text-decoration: none; }
.composer select.field { height: 40px; padding: 0 10px; }

.menu { position: relative; }
.menu summary { list-style: none; cursor: pointer; }
.menu summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; min-width: 220px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: 0 8px 24px rgba(16,24,40,.12); padding: 6px; display: grid; }
.menu-who { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; display: grid; }
.menu-who span { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; }
.menu-pop a, .menu-pop button { text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; font-weight: 500; }
.menu-pop a:hover, .menu-pop button:hover { background: var(--sunken); }

.message { max-width: 460px; margin: 64px auto; text-align: center; display: grid; gap: 14px; justify-items: center; }
.message .sub { margin: 0; }
.similar .btn { height: 30px; padding: 0 10px; font-variant-numeric: tabular-nums; }
.similar .btn[aria-pressed="true"] { background: var(--tint); border-color: var(--line-blue); color: var(--blue-ink); }
