/* ---------- Tokens ---------- */
:root {
  --bg: #FAF8F5;
  --surface: #FFFFFF;
  --line: #E7E2DA;
  --text: #1C1A22;
  --text-2: #6B6878;
  --primary: #E8401C;
  --primary-ink: #C7300F;
  --on-primary: #FFFFFF;
  --accent: #1F2A6B;
  --up: #16794B;
  --down: #6B6878;
  --crown-tint: rgba(31, 42, 107, .06);
  --shadow: 0 12px 40px rgba(28, 26, 34, .18);

  --display: 'Anek Latin', 'Anek Devanagari', 'Arial Narrow', sans-serif;
  --body: 'Mukta', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141218; --surface: #1E1B24; --line: #322E3A; --text: #F3F0EA; --text-2: #A6A2B2;
    --primary: #FF5A36; --primary-ink: #FF7A5C; --on-primary: #1C0B06; --accent: #8C9AF0;
    --up: #4CC38A; --down: #A6A2B2; --crown-tint: rgba(140, 154, 240, .10);
    --shadow: 0 12px 40px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141218; --surface: #1E1B24; --line: #322E3A; --text: #F3F0EA; --text-2: #A6A2B2;
  --primary: #FF5A36; --primary-ink: #FF7A5C; --on-primary: #1C0B06; --accent: #8C9AF0;
  --up: #4CC38A; --down: #A6A2B2; --crown-tint: rgba(140, 154, 240, .10);
  --shadow: 0 12px 40px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 16px/1.5 var(--body);
  padding-bottom: 88px;
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p, ol, ul { margin: 0; padding: 0; }
ol, ul { list-style: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; z-index: 50; background: var(--surface); padding: 8px 12px; }
[hidden] { display: none !important; } /* class rules like .field { display: block } must not undo the hidden attribute */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
body.has-sheet { overflow: hidden; }
#view { outline: none; padding: 12px 16px 24px; min-width: 0; }

.display, h1, .card-title, .logo, .rank {
  font-family: var(--display); font-weight: 800; font-stretch: 85%;
}
h1 { font-size: 28px; line-height: 1.08; text-transform: uppercase; letter-spacing: .005em; text-wrap: balance; }
.eyebrow {
  font: 600 12px/1.4 var(--body); letter-spacing: .1em; text-transform: uppercase; color: var(--text-2);
}
.section { margin-top: 28px; }
.section > .eyebrow { margin-bottom: 8px; }
.muted { color: var(--text-2); }
.small { font-size: 13px; line-height: 18px; }

/* ---------- Header ---------- */
.top {
  position: sticky; top: 0; z-index: 10; height: 56px; padding: 0 8px 0 16px;
  display: flex; align-items: center; gap: 4px;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.logo { font-size: 24px; line-height: 1; font-stretch: 87.5%; display: inline-flex; align-items: center; margin-right: auto; }
.logo b { color: var(--primary-ink); font-weight: 800; }
.logo-mark { width: 1.3em; height: 1.3em; flex: none; margin-right: .3em; }
.searchlink, .iconbtn {
  width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: none;
  border-radius: 50%; color: var(--text); flex: none;
}
.searchlink span { display: none; }
/* The pill shrinks before the header overflows; a long place name ends in "…". */
.pill {
  order: 0; height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; gap: 4px;
  max-width: 132px; min-width: 0; white-space: nowrap; flex: 0 1 auto; position: relative;
}
.pill::after { content: ''; position: absolute; inset: -4px 0; } /* 44px touch target */
.pill span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.pill svg { flex: none; color: var(--primary-ink); }
/* Below desktop the header holds the bell instead of the theme button (theme stays under Me > Settings), so the place name fits. */
@media (max-width: 1023px) { .top [data-act="toggle-theme"] { display: none; } }
@media (max-width: 399px) { .pill { max-width: 150px; padding: 0 10px; } }
.offline { display: none; background: var(--accent); color: var(--bg); font-size: 13px; padding: 6px 16px; }
body.is-offline .offline { display: block; }

/* ---------- Chips, segmented, buttons ---------- */
.chips {
  display: flex; gap: 8px; overflow-x: auto; padding: 2px 16px 10px; margin: 0 -16px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); font-size: 14px; font-weight: 600; display: inline-flex; align-items: center;
  position: relative;
}
.chip::after { content: ''; position: absolute; inset: -4px 0; } /* 44px touch target */
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }

.seg { display: inline-flex; gap: 20px; border-bottom: 1px solid var(--line); width: 100%; margin: 4px 0 12px; }
.seg button, .seg a {
  border: 0; background: none; padding: 10px 0; min-height: 44px; font-weight: 600; font-size: 15px;
  color: var(--text-2); border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.seg .on { color: var(--text); border-bottom-color: var(--primary); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); font: 600 16px/20px var(--body); text-align: center;
}
/* --primary-ink, not --primary: white text on the brighter vermilion is below 4.5:1 in light mode. */
.btn-primary { background: var(--primary-ink); border-color: var(--primary-ink); color: var(--on-primary); }
.btn-strong { border-color: var(--text); }
.btn-ghost { border-color: transparent; background: none; color: var(--text-2); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn-block { width: 100%; }
.linkish { color: var(--primary-ink); font-weight: 600; border: 0; background: none; padding: 0; }

.notice {
  display: flex; align-items: center; gap: 12px; justify-content: space-between;
  border: 1.5px dashed var(--primary); border-radius: 12px; padding: 8px 8px 8px 14px; margin-bottom: 12px;
  font-size: 14px; line-height: 20px;
}
.notice .btn { min-height: 44px; padding: 0 14px; font-size: 14px; flex: none; }
ul.plain li { list-style: disc; margin: 0 0 6px 20px; }

/* ---------- Topic card ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 0 4px; margin-bottom: 12px; overflow: hidden;
}
.card-head { padding: 0 14px 8px; display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; align-items: start; }
.tags { font-size: 13px; line-height: 18px; color: var(--text-2); font-weight: 600; }
.tags a { color: var(--primary-ink); display: inline-block; padding: 13px 0; margin: -13px 0; } /* 44px tall to tap */
.card-title { font-size: 22px; line-height: 1.1; text-transform: uppercase; grid-column: 1; text-wrap: balance; }
.card-title a::after { content: ''; }
.card-meta { font-size: 13px; color: var(--text-2); grid-column: 1; }
.card-head .iconbtn { grid-column: 2; grid-row: 1 / span 3; margin: -8px -8px 0 0; color: var(--text-2); }
.seeall {
  display: flex; justify-content: center; align-items: center; min-height: 44px;
  font-weight: 600; font-size: 14px; color: var(--primary-ink); border-top: 1px solid var(--line);
}

/* ---------- Item rows ---------- */
.rows { border-top: 1px solid var(--line); }
.row {
  display: grid; grid-template-columns: 26px 40px minmax(0, 1fr) auto; align-items: center; gap: 10px;
  padding: 8px 10px 8px 12px; min-height: 60px; background: var(--surface);
  border-bottom: 1px solid var(--line); border-left: 4px solid transparent; position: relative;
}
.rows > .row:last-child { border-bottom: 0; }
.row--top { border-left-color: var(--accent); background: linear-gradient(var(--crown-tint), var(--crown-tint)), var(--surface); }
.rank {
  font-size: 22px; line-height: 1; color: var(--accent); text-align: center;
  font-variant-numeric: tabular-nums; display: grid; justify-items: center; gap: 1px;
}
.rank svg, .mini-t > svg { color: var(--accent); }
.mini-t > svg { vertical-align: -1px; }
.tile {
  width: 40px; height: 40px; border-radius: 8px; background: var(--tile, #6A5D8C); color: #fff;
  display: grid; place-items: center; font: 800 18px/1 var(--display);
}
.row-main { min-width: 0; }
.row-name { display: block; font-weight: 600; line-height: 20px; overflow-wrap: anywhere; }
.row-sub { display: block; font-size: 13px; line-height: 18px; color: var(--text-2); }
.card .row-sub { display: none; }
.mv { font-size: 12px; line-height: 16px; font-weight: 600; white-space: nowrap; }
.mv.up { color: var(--up); }
.mv.down { color: var(--down); }

.share { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 8px; margin-top: 4px; }
.share-bar { flex: 1 1 64px; max-width: 160px; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.share-bar i { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.row--mine .share-bar i { background: var(--primary); }
.share-n { font-size: 13px; line-height: 18px; color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.share-n b { color: var(--text); }
.share-n.just { animation: tick .22s ease-out; }

/* One vote per topic: a single stamp button per row. */
.vbtn { width: 44px; height: 44px; border: 0; background: none; padding: 0; display: grid; place-items: center; color: var(--text-2); border-radius: 50%; }
.vbtn .dot { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; position: relative; border: 2px solid var(--text-2); background: var(--surface); }
.vbtn[disabled] { cursor: not-allowed; opacity: .4; }
.row--new { box-shadow: inset 0 0 0 2px var(--accent); }
.votehint { display: flex; align-items: center; gap: 10px; font-size: 14px; line-height: 20px; color: var(--text-2); margin: -4px 0 12px; }
.votehint .vbtn { flex: none; width: 36px; height: 36px; }
.votehint .dot { width: 32px; height: 32px; }
.vbtn .hand { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.vbtn .ink { fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linecap: round; opacity: 0; }
.vbtn.on .hand { fill: currentColor; }
.vbtn.on .ink { opacity: 1; }
.vbtn.on.pending .hand { fill: none; }
.vbtn.on .dot { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.vbtn.on.pending .dot {
  background: color-mix(in srgb, var(--primary) 12%, var(--surface)); color: var(--primary-ink);
  border: 2px dashed var(--primary);
}
.vbtn.just .dot { animation: stamp .26s cubic-bezier(.2, .9, .3, 1.3); }
.vbtn.just .dot::after {
  content: ''; position: absolute; inset: -2px; border-radius: 50%; border: 2px solid var(--primary);
  animation: ring .45s ease-out forwards;
}
@keyframes stamp { 0% { transform: scale(1.8) rotate(-16deg); opacity: .2; } 60% { transform: scale(.88) rotate(3deg); opacity: 1; } 100% { transform: none; } }
@keyframes ring { from { transform: scale(1); opacity: .7; } to { transform: scale(1.9); opacity: 0; } }
@keyframes tick { from { transform: translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Topic page ---------- */
.back { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; font-weight: 600; color: var(--text-2); margin-left: -6px; }
.topic-head { margin-bottom: 8px; }
.topic-head h1 { margin: 4px 0 6px; }
.topic-actions { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.topic-actions .btn { min-height: 44px; }
.topic-actions .iconbtn { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.listwrap { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.listwrap .rows { border-top: 0; }
.addbar { position: sticky; bottom: 84px; margin-top: 12px; z-index: 5; }
.addbar .btn { box-shadow: var(--shadow); border-color: var(--text); }
/* On short screens a floating bar would cover the list, so it sits after it instead. */
@media (max-height: 720px) { .addbar { position: static; } .addbar .btn { box-shadow: none; } }

/* ---------- Mini lists ---------- */
.mini {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0 12px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--line); min-height: 56px;
}
.mini-n { font: 800 22px/1 var(--display); font-stretch: 85%; color: var(--accent); width: 24px; text-align: center; grid-row: span 2; }
.mini-t { font-weight: 600; line-height: 20px; grid-column: 2; }
.mini-m { font-size: 13px; line-height: 18px; color: var(--text-2); grid-column: 2; }
.mini:not(:has(.mini-n)) { grid-template-columns: minmax(0, 1fr); }
.mini:not(:has(.mini-n)) > * { grid-column: 1; }

/* ---------- Notifications ---------- */
.note { display: grid; gap: 2px; padding: 12px 0 12px 16px; border-bottom: 1px solid var(--line); min-height: 56px; position: relative; }
.note-t { line-height: 20px; }
.note-m { font-size: 13px; color: var(--text-2); }
.note.new .note-t { font-weight: 600; }
.note.new::before { content: ''; position: absolute; left: 2px; top: 19px; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
/* An inline link inside a meta line, with a 44px tap area that doesn't push the line apart. */
.metalink { border: 0; background: none; padding: 12px 0; margin: -12px 0; font: inherit; color: var(--primary-ink); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.bell { position: relative; }
.bell-n:empty { display: none; }
.bell-n {
  position: absolute; top: 4px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--primary); color: var(--on-primary); font: 700 11px/18px var(--body); text-align: center;
}
/* An on/off switch, 44px tall to tap. */
.toggle { width: 52px; height: 44px; border: 0; background: none; padding: 0; display: grid; place-items: center; flex: none; }
.toggle i { width: 44px; height: 26px; border-radius: 13px; background: var(--line); position: relative; transition: background .15s; }
.toggle i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s; }
.toggle[aria-checked="true"] i { background: var(--primary); }
.toggle[aria-checked="true"] i::after { transform: translateX(18px); }
@media (prefers-reduced-motion: reduce) { .toggle i, .toggle i::after { transition: none; } }

/* ---------- Explore ---------- */
.catgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.catcard {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px;
  min-height: 92px; display: flex; flex-direction: column; justify-content: space-between;
}
.catcard b { font: 800 20px/1.05 var(--display); overflow-wrap: anywhere; font-stretch: 85%; text-transform: uppercase; }
.catcard span { font-size: 13px; color: var(--text-2); }
.staterow { padding: 10px 0; border-bottom: 1px solid var(--line); }
.staterow > a, .staterow .locrow > a { font-weight: 600; display: flex; justify-content: space-between; min-height: 44px; align-items: center; }
.staterow { padding: 4px 0; }
.morestates > summary {
  display: flex; align-items: center; gap: 8px; min-height: 48px; font-weight: 600; color: var(--text-2);
  border-bottom: 1px solid var(--line); cursor: pointer; list-style: none;
}
.morestates > summary::-webkit-details-marker { display: none; }
.morestates > summary .ico { transition: transform .2s; }
.morestates[open] > summary .ico { transform: rotate(180deg); }
.staterow .locrow { display: flex; align-items: center; gap: 4px; }
.staterow .locrow > a { flex: 1; min-width: 0; }
.staterow .loc-tog { margin: -6px -10px -6px 0; }
.staterow .chips { padding-bottom: 2px; margin-top: 4px; }

/* ---------- States ---------- */
.empty { text-align: center; padding: 32px 16px; border: 1.5px dashed var(--line); border-radius: 12px; margin-bottom: 12px; }
.empty h2 { font: 800 24px/1.1 var(--display); font-stretch: 85%; text-transform: uppercase; margin-bottom: 6px; }
.empty p { color: var(--text-2); margin-bottom: 16px; }
.skel-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 12px; }
.skel-card i { display: block; height: 16px; border-radius: 6px; background: var(--line); margin-bottom: 14px; animation: pulse 1.1s ease-in-out infinite alternate; }
.skel-card i:first-child { width: 60%; height: 24px; }
@keyframes pulse { from { opacity: .45; } to { opacity: 1; } }

/* ---------- Forms ---------- */
.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.input, select.input {
  width: 100%; min-height: 48px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); font-size: 16px;
}
.input:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.hint { font-size: 13px; color: var(--text-2); margin-top: 6px; }
.placefield { display: flex; align-items: center; gap: 8px; text-align: left; color: var(--text); }
.placefield .ico { flex: none; color: var(--text-2); }
.placefield-name { flex: 1; min-width: 0; font-weight: 600; }
.placefield-name .muted { font-weight: 400; }
.placefield-change { flex: none; color: var(--primary-ink); font-weight: 600; font-size: 14px; }
.placefield:disabled .placefield-change { display: none; }
.steps { display: flex; gap: 6px; margin: 4px 0 16px; }
.steps i { flex: 1; height: 4px; border-radius: 2px; background: var(--line); }
.steps i.on { background: var(--primary); }
/* An option takes two lines: the name runs wide beside its number, and the image button sits under it, before the description. */
.optrow { display: grid; grid-template-columns: 24px 44px minmax(0, 1fr); gap: 8px; align-items: center; margin-bottom: 14px; }
.optrow .rank { font-size: 18px; grid-row: 1; grid-column: 1; }
.optrow [data-in="opt"] { grid-row: 1; grid-column: 2 / 4; }
.optrow .imgbtn { grid-row: 2; grid-column: 2; }
.optrow.has-rm { grid-template-columns: 24px 44px minmax(0, 1fr) 44px; }
.optrow.has-rm .iconbtn { grid-row: 1; grid-column: 4; }
.optrow .iconbtn { color: var(--text-2); }
/* An option's optional one-line description: a lighter second field under its name. */
.input.sub { min-height: 44px; padding: 8px 12px; color: var(--text-2); }
.input.sub:focus { color: var(--text); }
.optrow .input.sub { grid-row: 2; grid-column: 3; }
#place-pending:empty { display: none; }
#place-pending .ico { vertical-align: -2px; }
.welcome { position: relative; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 12px; padding: 14px 14px 12px; margin-bottom: 14px; }
.welcome h1 { font-size: 24px; padding-right: 36px; margin-bottom: 6px; }
.welcome > p { font-size: 15px; line-height: 21px; color: var(--text-2); margin-bottom: 12px; }
.welcome > p.small { margin: 10px 0 0; font-size: 13px; }
.welcome > .iconbtn { position: absolute; top: 4px; right: 4px; color: var(--text-2); }
.welcome .acts .btn { min-height: 44px; }
.welcome .btn-primary svg { color: inherit; }
.owner .changes { font-size: 14px; line-height: 20px; margin: -4px 0 10px; }
.owner .changes li { list-style: disc; margin-left: 18px; }
.reasons { border: 0; margin: 0; padding: 0; min-width: 0; }
.reasons legend { font-weight: 600; font-size: 14px; padding: 0; margin-bottom: 4px; }
.imgbtn { width: 44px; height: 44px; border-radius: 8px; border: 1.5px dashed var(--line); background: none; color: var(--text-2); font-size: 11px; font-weight: 600; }
.formnav { display: flex; gap: 8px; margin-top: 20px; }
.formnav .btn-primary { flex: 1; }
.dupes { border-left: 3px solid var(--accent); padding: 2px 0 2px 12px; margin: -4px 0 16px; }
.dupes a { display: block; font-weight: 600; padding: 6px 0; color: var(--primary-ink); }

/* ---------- Me ---------- */
.me-head { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.avatar { width: 64px; height: 64px; border-radius: 50%; background: var(--accent); color: var(--bg); display: grid; place-items: center; font: 800 28px/1 var(--display); flex: none; }
.me-head h1 { font-size: 26px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.stats div { padding: 12px 8px; text-align: center; border-left: 1px solid var(--line); }
.stats div:first-child { border-left: 0; }
.stats b { display: block; font: 800 28px/1 var(--display); font-stretch: 85%; color: var(--accent); }
.stats span { font-size: 13px; color: var(--text-2); }
.badges { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.badge { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--surface); }
.badge b { display: block; line-height: 20px; }
.badge span { font-size: 13px; line-height: 18px; color: var(--text-2); display: block; }
.badge.locked { background: none; border-style: dashed; }
.badge.locked b { color: var(--text-2); }
.setrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); min-height: 56px; }
.switch3 { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.switch3 button { border: 0; background: none; min-height: 44px; padding: 0 14px; font-weight: 600; font-size: 14px; color: var(--text-2); }
.switch3 button.on { background: var(--text); color: var(--bg); }

/* ---------- Icons ---------- */
.ico { flex: none; vertical-align: -.18em; }
.railnav .ico, .rail-left .btn .ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chip .ico { margin-right: 6px; }
.seg button { display: inline-flex; align-items: center; gap: 6px; }
.eyebrow .ico { margin-right: 6px; vertical-align: -3px; }
.tags .ico { margin-right: 4px; vertical-align: -2px; }
.h-ico { display: flex; align-items: center; gap: 10px; }
.h-ico .ico { color: var(--primary-ink); }
.cat-ico { width: 44px; height: 44px; border-radius: 10px; background: var(--crown-tint); color: var(--accent); display: grid; place-items: center; margin-bottom: 12px; }
.stats .ico { display: block; margin: 0 auto 6px; color: var(--text-2); }
.badge b .ico { color: var(--accent); margin-right: 6px; }
.setrow > span:first-child { display: inline-flex; align-items: center; gap: 10px; }
.setrow > span:first-child .ico { color: var(--text-2); }
.empty > .ico { color: var(--text-2); margin-bottom: 10px; }
.staterow span .ico, .loclist .ico { margin-right: 8px; color: var(--text-2); }
.imgbtn { display: grid; place-items: center; }

/* ---------- Review, edit and delete ---------- */
.owner { border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 12px; background: var(--surface); padding: 12px 14px; margin-bottom: 12px; }
.owner--declined { border-left-color: var(--primary); }
.owner h2 { font: 600 16px/22px var(--body); display: flex; align-items: center; gap: 8px; }
.owner p { font-size: 14px; line-height: 20px; color: var(--text-2); margin: 4px 0 10px; }
.acts { display: flex; flex-wrap: wrap; gap: 8px; }
.acts .btn { min-height: 44px; padding: 0 14px; font-size: 14px; }
.demo { border: 1.5px dashed var(--text-2); border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; }
.demo b { display: block; font-size: 12px; line-height: 16px; letter-spacing: .04em; text-transform: uppercase; color: var(--text-2); margin-bottom: 8px; }
.statchip { display: inline-block; font: 600 12px/18px var(--body); padding: 0 8px; border-radius: 999px; border: 1px solid currentColor; color: var(--text-2); margin-left: 8px; vertical-align: 1px; white-space: nowrap; }
.statchip.live { color: var(--up); }
.statchip.declined { color: var(--primary-ink); }
.statchip.closed { color: var(--accent); }

/* ---------- Time-bound topics: indigo for a final result, vermilion only while there is still time to act ---------- */
.ends { white-space: nowrap; }
.ends .ico { vertical-align: -2px; margin-right: 3px; }
.ends.soon { color: var(--primary-ink); font-weight: 600; }
.closedbar { border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 12px; background: linear-gradient(var(--crown-tint), var(--crown-tint)), var(--surface); padding: 12px 14px; margin-bottom: 12px; }
.closedbar h2 { font: 600 16px/22px var(--body); display: flex; align-items: center; gap: 8px; overflow-wrap: anywhere; }
.closedbar .ico { color: var(--accent); flex: none; }
.closedbar p { font-size: 14px; line-height: 20px; color: var(--text-2); margin-top: 4px; }
.winner { display: inline-block; font: 600 11px/16px var(--body); letter-spacing: .04em; text-transform: uppercase; color: var(--accent); border: 1px solid currentColor; border-radius: 999px; padding: 0 6px; margin-left: 4px; vertical-align: 1px; }
.runfield { margin-top: 8px; max-width: 240px; }
.myrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; border-bottom: 1px solid var(--line); }
.myrow .mini { border-bottom: 0; }
.locknote { display: flex; gap: 10px; align-items: flex-start; background: var(--crown-tint); border-radius: 10px; padding: 10px 12px; font-size: 14px; line-height: 20px; margin-bottom: 16px; }
.locknote .ico { margin-top: 1px; color: var(--accent); }
.input:disabled { background: var(--bg); color: var(--text-2); cursor: not-allowed; }
.editopt { display: grid; grid-template-columns: minmax(0, 1fr) 44px; gap: 6px 8px; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.editopt > .input, .editopt > .hint { grid-column: 1; }
.editopt > .hint { margin-top: 0; }
.editopt > .iconbtn { grid-column: 2; grid-row: 1; border: 1px solid var(--line); border-radius: 10px; color: var(--text-2); }
.editopt.gone .input { text-decoration: line-through; }
.rules { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; font-size: 14px; line-height: 20px; margin-top: 16px; background: var(--surface); }
.rules li { list-style: decimal; margin-left: 20px; }
.rules ol { margin: 4px 0 6px; }
.rules p { margin-top: 4px; }
.err { color: var(--primary-ink); font-size: 14px; min-height: 20px; margin-top: 8px; }
#toast.has-act { pointer-events: auto; }
.toast-act { border: 0; background: none; color: inherit; font: inherit; font-weight: 700; text-decoration: underline; margin-left: 12px; min-height: 44px; padding: 0 4px; }

/* ---------- Sheets ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(15, 13, 20, .55); z-index: 30; display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  background: var(--surface); width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto;
  border-radius: 20px 20px 0 0; padding: 20px 16px 24px; box-shadow: var(--shadow);
  animation: rise .22s ease-out;
}
@keyframes rise { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.sheet-head h2 { font: 800 26px/1.08 var(--display); font-stretch: 85%; text-transform: uppercase; text-wrap: balance; }
.sheet-head .iconbtn { margin: -8px -8px 0 0; }
.sheet p { margin-bottom: 16px; }
.sheet .btn + .btn { margin-top: 8px; }
.loclist a, .loclist button {
  display: flex; align-items: center; width: 100%; min-height: 48px; border: 0; background: none; text-align: left;
  border-bottom: 1px solid var(--line); font-weight: 600; padding: 6px 4px;
}
#loclist { min-height: 50vh; } /* the sheet keeps its height while search narrows the list */
.loclist .city { padding-left: 24px; font-weight: 400; }
.loclist .on { color: var(--primary-ink); }
.loclist .locrow { display: flex; border-bottom: 1px solid var(--line); }
.loclist .locrow > button { border-bottom: 0; }
.loclist .locrow > .loc-tog { width: 48px; flex: none; justify-content: center; padding: 0; }
.loc-h { padding: 20px 4px 4px; }
.loclist button > span { min-width: 0; }
.loc-more { padding: 10px 4px 10px 28px; border-bottom: 1px solid var(--line); }
.loc-credit { margin: 12px 0 0; }
.loclist .loc-suggest { color: var(--primary-ink); }
.section > .loc-h { margin-bottom: 0; }
.loc-tog { width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: none; color: var(--text-2); flex: none; }
.loc-tog .ico { margin: 0 !important; transition: transform .2s; }
.locgroup.open > .locrow .loc-tog .ico { transform: rotate(180deg); }
.locgroup:not(.open) > .lockids { display: none; }
@media (prefers-reduced-motion: reduce) { .loc-tog .ico { transition: none; } }
.radio { display: flex; align-items: center; gap: 12px; min-height: 48px; border-bottom: 1px solid var(--line); }
.radio input { width: 20px; height: 20px; accent-color: var(--primary); }
.check { display: flex; align-items: center; gap: 12px; min-height: 44px; font-weight: 600; margin-bottom: 4px; }
.check input { width: 20px; height: 20px; accent-color: var(--primary); flex: none; }
.field .err:empty { display: none; }

/* ---------- Share card: "ink stamp" (design/share-cards/option-a). Fixed colours: it is an image, not UI. ---------- */
/* Sized in cqw (the design is 540px wide, so 1cqw = 5.4px) so the card scales like the image it stands in for. */
.posterwrap { display: grid; place-items: center; margin-bottom: 12px; }
.poster {
  position: relative; overflow: hidden; width: 100%; max-width: 320px; aspect-ratio: 1 / 1; border-radius: 12px;
  background: #E8401C; color: #fff; font-family: var(--body); font-weight: 400; container-type: inline-size;
}
.poster.story { aspect-ratio: 9 / 16; max-width: 230px; }
.pc-dots { position: absolute; inset: 0; background-image: radial-gradient(rgba(110, 18, 0, .38) .28cqw, transparent .34cqw); background-size: 1.67cqw 1.67cqw;
  -webkit-mask-image: linear-gradient(155deg, transparent 35%, #000 100%); mask-image: linear-gradient(155deg, transparent 35%, #000 100%); }
.pc-wm { position: absolute; right: -20.4cqw; bottom: -13cqw; width: 80cqw; height: 80cqw; transform: rotate(-16deg); opacity: .16; }
.pc-hand { fill: #fff; }
.pc-ink { stroke: #1F2A6B; stroke-width: 2.4; stroke-linecap: round; fill: none; }
.pc-in { position: relative; height: 100%; padding: 5.2cqw 6.3cqw 6.4cqw; display: flex; flex-direction: column; }
.pc-top { display: flex; justify-content: space-between; align-items: center; gap: 2cqw; }
.pc-brand { display: flex; align-items: center; gap: 1.5cqw; font: 800 4.1cqw/1 var(--display); font-stretch: 85%; }
.pc-logo { width: 5.6cqw; height: 5.6cqw; flex: none; }
.pc-pill { display: inline-flex; align-items: center; gap: 1.1cqw; font: 700 2.8cqw/1 var(--body); padding: 1.5cqw 2.2cqw 1.3cqw; border-radius: 999px; background: #fff; color: #C7300F; white-space: nowrap; }
.pc-pill .ico { width: 3cqw; height: 3cqw; }
.pc-pill.closed { background: #1F2A6B; color: #fff; }
.pc-place { font: 800 13.7cqw/.86 var(--display); font-stretch: 75%; text-transform: uppercase; margin-top: 4.1cqw; overflow-wrap: anywhere; }
.pc-place.long { font-size: 10cqw; }
.pc-place.longer { font-size: 7.6cqw; }
/* A div, not a p: page rules for p (the right rail's grey 14px, the sheet's margins) would otherwise reach into the card. */
.pc-q { font: 600 3.5cqw/1.25 var(--body); opacity: .92; margin-top: 1.5cqw; max-width: 86%; }
.pc-win { position: relative; margin-top: 3.7cqw; background: #fff; color: #1F2A6B; padding: 3cqw 4.1cqw 3.3cqw; border-radius: .75cqw; transform: rotate(-1.6deg); box-shadow: 1.3cqw 1.3cqw 0 #1F2A6B; }
.pc-lbl { display: flex; align-items: center; gap: 1.1cqw; font: 700 2.6cqw/1 var(--body); color: #C7300F; }
.pc-lbl svg { width: 3cqw; height: 3cqw; }
.pc-win b { display: block; font: 800 9.3cqw/.95 var(--display); font-stretch: 78%; text-transform: uppercase; margin-top: 1.1cqw; padding-right: 19.3cqw; overflow-wrap: anywhere; }
.pc-win.empty b { padding-right: 0; }
.pc-win.long b { font-size: 7.4cqw; }
.pc-wbar { display: block; height: 1.85cqw; background: #E8401C; border-radius: 1cqw; margin: 2.2cqw 19.3cqw 0 0; }
.pc-seal { position: absolute; right: -3cqw; top: -5.6cqw; width: 23.7cqw; height: 23.7cqw; transform: rotate(16deg); filter: url(#ink); }
.pc-rest { margin-top: 4.4cqw; display: grid; gap: 2.2cqw; }
.pc-row { display: grid; grid-template-columns: 5.6cqw 1fr auto; align-items: baseline; column-gap: 1.5cqw; row-gap: 1.1cqw; }
.pc-n { font: 800 4.8cqw/1 var(--display); opacity: .75; }
.pc-nm { font: 700 4.1cqw/1.05 var(--display); font-stretch: 88%; text-transform: uppercase; overflow-wrap: anywhere; }
.pc-p { font: 800 4.4cqw/1 var(--display); font-variant-numeric: tabular-nums; }
.pc-bar { grid-column: 2 / 4; height: 1.3cqw; background: rgba(255, 255, 255, .25); border-radius: 1cqw; }
.pc-bar i { display: block; height: 100%; background: #fff; border-radius: 1cqw; }
.pc-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: flex-end; gap: 2cqw; }
.pc-count { font: 600 2.8cqw/1.25 var(--body); }
.pc-count b { display: block; font: 800 6.3cqw/1 var(--display); font-stretch: 85%; }
/* The card travels far from the site, so it carries the disclaimer too, small, in the bottom margin. */
.pc-legal { position: absolute; left: 0; right: 0; bottom: 1.5cqw; text-align: center; font: 600 2cqw/1 var(--body); opacity: .75; }
.pc-cta { background: #1F2A6B; color: #fff; font: 700 3.1cqw/1 var(--body); padding: 2.2cqw 3cqw 2cqw; border-radius: 999px; white-space: nowrap; }
/* Story: same parts, more room, five options */
.story .pc-in { padding: 10.4cqw 8.1cqw 8.9cqw; }
.story .pc-brand { font-size: 4.8cqw; }
.story .pc-logo { width: 6.7cqw; height: 6.7cqw; }
.story .pc-place { font-size: 19.3cqw; margin-top: 5.9cqw; }
.story .pc-place.long { font-size: 15cqw; }
.story .pc-place.longer { font-size: 11cqw; }
.story .pc-q { font-size: 4.3cqw; margin-top: 2.2cqw; }
.story .pc-win { margin-top: 6.7cqw; padding: 3.3cqw 4.1cqw 3.7cqw; }
.story .pc-win b { font-size: 10.4cqw; }
.story .pc-win.long b { font-size: 9cqw; }
.story .pc-seal { width: 27cqw; height: 27cqw; top: -8.1cqw; }
.story .pc-rest { margin-top: 5.2cqw; gap: 2.6cqw; }
.story .pc-nm { font-size: 4.8cqw; }
.story .pc-p { font-size: 5.2cqw; }
.story .pc-wm { width: 118.5cqw; height: 118.5cqw; right: -31.5cqw; bottom: -7.4cqw; }
.story .pc-count b { font-size: 7.8cqw; }
.story .pc-cta { font-size: 3.5cqw; padding: 2.6cqw 3.3cqw 2.4cqw; }

/* ---------- Toast, tab bar ---------- */
#toast {
  position: fixed; left: 50%; bottom: 96px; transform: translate(-50%, 20px); z-index: 40;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px); text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; height: 64px;
  background: var(--surface); border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, 1fr); padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a { display: grid; place-items: center; align-content: center; gap: 2px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.tabbar svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a.on { color: var(--primary-ink); }
.tab-create span {
  width: 52px; height: 52px; border-radius: 50%; background: var(--primary); color: var(--on-primary);
  display: grid; place-items: center; margin-top: -22px; box-shadow: var(--shadow); border: 3px solid var(--bg);
}
.tab-create svg { width: 26px; height: 26px; stroke-width: 2.5; }

.rail { display: none; }

/* ---------- Desktop ---------- */
@media (min-width: 1024px) {
  body { padding-bottom: 0; }
  .tabbar { display: none; }
  /* Left rail is pinned to the window's left edge; the feed and right rail are centred in the space that remains. */
  .app { display: grid; grid-template-columns: 256px minmax(24px, 1fr) minmax(0, 640px) 312px minmax(24px, 1fr); }
  .rail-left { grid-column: 1; }
  .main { grid-column: 3; min-width: 0; }
  .rail-right { grid-column: 4; }
  .rail { display: block; position: sticky; top: 0; align-self: start; max-height: 100vh; overflow-y: auto; scrollbar-width: none; }
  .rail::-webkit-scrollbar { display: none; }
  .rail-left { height: 100vh; padding: 0 16px 24px; border-right: 1px solid var(--line); }
  .rail-left .logo { font-size: 28px; height: 64px; padding-left: 12px; margin-bottom: 8px; }
  .railnav { display: grid; gap: 4px; }
  .railcats { display: grid; gap: 2px; }
  .railcats .ico { margin: 0 2px; }
  .railnav a, .railcats a { display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 0 12px; border-radius: 8px; font-weight: 600; }
  .railnav a.on .ico, .railcats a.on .ico { color: var(--primary-ink); }
  .railnav a { font-size: 17px; min-height: 44px; }
  .railnav a.on, .railcats a.on { background: var(--surface); box-shadow: inset 3px 0 0 var(--primary); }
  .railcats a { color: var(--text-2); font-size: 15px; }
  .rail-left .btn { width: 100%; margin: 20px 0 28px; }
  .rail-left .eyebrow { padding: 0 12px; margin-bottom: 8px; }
  .railfoot { margin-top: 20px; padding: 0 12px; font-size: 12px; line-height: 16px; color: var(--text-2); }
  .railfoot a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }
  .rail-right { padding: 72px 0 24px 32px; }
  .rail-right .box { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 16px; }
  .rail-right .box .mini:last-child { border-bottom: 0; padding-bottom: 0; }
  .rail-right .box p { color: var(--text-2); font-size: 14px; margin: 4px 0 12px; }
  .rail-right .box h2:not(.eyebrow) { font: 800 22px/1.1 var(--display); font-stretch: 85%; text-transform: uppercase; }

  .top { padding: 0; height: 64px; gap: 8px; }
  .logo-m { display: none; }
  .searchlink { flex: 1; width: auto; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); display: flex; justify-content: flex-start; gap: 8px; padding: 0 12px; color: var(--text-2); }
  .searchlink span { display: inline; }
  .pill { max-width: 200px; height: 40px; }
  #view { padding: 20px 0 48px; }
  h1 { font-size: 40px; line-height: 1.04; }
  .card-title { font-size: 26px; }
  .row { grid-template-columns: 32px 48px minmax(0, 1fr) auto; gap: 14px; padding: 10px 14px; }
  .tile { width: 48px; height: 48px; }
  .card .row-sub { display: block; }
  .catgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .catcard b { font-size: 17px; overflow-wrap: normal; }
  .addbar { bottom: 16px; }
  .backdrop { align-items: center; }
  .sheet { border-radius: 16px; max-width: 440px; padding: 24px; }
  #toast { bottom: 32px; }
  .chips { flex-wrap: wrap; overflow: visible; }
}

@media (min-width: 1024px) and (max-width: 1259px) {
  .app { grid-template-columns: 256px minmax(24px, 1fr) minmax(0, 640px) minmax(24px, 1fr); }
  .rail-right { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Review queue (reviewers only) ---------- */
.review-body { padding: 0 14px 12px; }
.review-body .plain { margin: 4px 0 12px; }

/* ---------- Stats page (reviewers only) ---------- */
.stats--wrap { grid-template-columns: repeat(2, 1fr); }
.stats--wrap div { border-left: 0; border-top: 1px solid var(--line); }
.stats--wrap div:nth-child(-n+2) { border-top: 0; }
.stats--wrap div:nth-child(even) { border-left: 1px solid var(--line); }
@media (min-width: 720px) {
  .stats--wrap { grid-template-columns: repeat(3, 1fr); }
  .stats--wrap div:nth-child(-n+3) { border-top: 0; }
  .stats--wrap div:nth-child(even) { border-left: 0; }
  .stats--wrap div:not(:nth-child(3n+1)) { border-left: 1px solid var(--line); }
}
