/* ── Themes ────────────────────────────────────────────────────────────────
   Every colour in the app comes from these variables, so a theme is just one
   more block below. `data-theme` is set on <html> from a cookie; the default
   (no attribute) is Midnight.
   ------------------------------------------------------------------------ */
:root, [data-theme="midnight"] {
  --bg: #0f1220;
  --surface: #181c30;
  --surface2: #232741;
  --text: #e8eaf6;
  --muted: #8b90a8;
  --accent: #7c5cff;
  --green: #35d07f;
  --red: #ff5c72;
  --amber: #ffce56;
  --radius: 14px;
}

/* warm charcoal, no blue — cover art supplies the colour */
[data-theme="charcoal"] {
  --bg: #131211;
  --surface: #1d1b19;
  --surface2: #2a2724;
  --text: #efe9e0;
  --muted: #a89e91;
  --accent: #d98b4a;
  --green: #6cba7f;
  --red: #d1685e;
  --amber: #e0b455;
  --radius: 6px;
}
/* phosphor terminal: near-black with a green bias, amber signals */
[data-theme="terminal"] {
  --bg: #0a0c0b;
  --surface: #111614;
  --surface2: #1a221d;
  --text: #d8e0d5;
  --muted: #6d7a6c;
  --accent: #e8b04b;
  --green: #4ade80;
  --red: #f87171;
  --amber: #e8b04b;
  --radius: 4px;
}

/* daylight: paper ground, ink text, red sale marks */
[data-theme="paper"] {
  --bg: #f2f0eb;
  --surface: #ffffff;
  --surface2: #e7e3da;
  --text: #14120f;
  --muted: #6f6a5f;
  --accent: #1f5c9e;
  --green: #1a7f45;
  --red: #d8232a;
  --amber: #b5820a;
  --radius: 8px;
}

/* deep sea: teal-leaning dark, cool but not violet */
[data-theme="deepsea"] {
  --bg: #08171c;
  --surface: #0e2128;
  --surface2: #163038;
  --text: #dceef2;
  --muted: #7fa0a8;
  --accent: #2dd4bf;
  --green: #34d399;
  --red: #fb7185;
  --amber: #fbbf24;
  --radius: 10px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
/* animate between pages (Safari 18.4+/Chrome; harmless elsewhere) */
@view-transition { navigation: auto; }
a, button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
}
main { max-width: 960px; margin: 0 auto; padding: 12px 14px; }
a { color: inherit; text-decoration: none; }
h1 { font-size: 1.3rem; margin: 0 0 6px; }
h2 { font-size: 1rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 18px 0 8px; }
.muted { color: var(--muted); }

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px calc(12px);
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--surface2);
}
.brand { font-weight: 700; font-size: 1.1rem; }
.brand span { color: var(--accent); }
.push-btn { background: var(--surface2); border: none; border-radius: 50%; width: 38px; height: 38px; font-size: 1rem; cursor: pointer; color: var(--muted); }
.topbar-right { display: flex; gap: 8px; align-items: center; }

/* bottom tab bar */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  display: flex; justify-content: space-around;
  background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(10px);
  border-top: 1px solid var(--surface2);
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
}
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .68rem; color: var(--muted); }
.tabbar a span { font-size: 1.15rem; }
.tabbar a.on { color: var(--text); }

/* shown when the service worker finds the live page differs from the cached
   one it just served — sits clear of the tab bar */
.refresh-toast {
  position: fixed; z-index: 20; left: 50%; transform: translateX(-50%);
  bottom: calc(64px + env(safe-area-inset-bottom));
  background: var(--accent); color: #fff; border: 0; cursor: pointer;
  font: inherit; font-size: .78rem; font-weight: 700;
  padding: 8px 16px; border-radius: 999px;
  box-shadow: 0 6px 20px -6px rgba(0, 0, 0, .6);
}

/* cards: full-width horizontal rows on mobile, controlled columns on web */
.grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 720px) { .grid { grid-template-columns: repeat(2, 1fr); gap: 14px; } }
@media (min-width: 1080px) { .grid { grid-template-columns: repeat(3, 1fr); } }
.card { background: var(--surface); border-radius: 10px; display: flex; flex-direction: column; gap: 10px; padding: 10px; transition: transform .08s, background .08s; }
.card:active { transform: scale(.98); background: var(--surface2); }
/* fixed three-column grid: square art | text | price. Every card is the same
   shape regardless of title length, which is what made the old flex version
   look ragged down the list. */
.card-top { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.card-thumb {
  position: relative; width: 96px; aspect-ratio: 1; flex-shrink: 0;
  background: var(--surface2); border-radius: 6px;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.card-thumb img { width: 100%; height: 100%; object-fit: contain; }
.thumb-placeholder { font-size: 1.8rem; }
.thumb-badge { position: absolute; left: 0; bottom: 0; background: var(--green); color: var(--bg); font-weight: 800; font-size: .72rem; padding: 1px 6px; border-radius: 0 4px 0 0; }
.card-body { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.card-title {
  font-weight: 600; font-size: .95rem; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.card-price-col { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; white-space: nowrap; }
.card-price-col .was { font-size: .78rem; }
.card-price-col .ends, .card-price-col .target { font-size: .72rem; color: var(--muted); }
.card-price-col .target.hit { color: var(--green); font-weight: 700; }
.from-label { font-size: .58rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

/* score + platform chips */
.score { font-size: .72rem; font-weight: 700; padding: 2px 6px; border-radius: 6px; background: var(--surface2); }
.score.mc { background: color-mix(in srgb, var(--green) 26%, var(--surface2)); color: var(--text); }
.score.steam { background: color-mix(in srgb, #66c0f4 20%, var(--surface2)); color: var(--text); }
.stores { margin-left: auto; font-size: .8rem; letter-spacing: 2px; }

/* platform badges */
.plat-badges { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.plat { font-size: .68rem; font-weight: 700; padding: 2px 7px; border-radius: 6px; white-space: nowrap; }
.plat.steam { background: #1b2838; color: #66c0f4; }
.plat.playstation { background: rgba(0, 67, 156, .25); color: #66a9ff; box-shadow: inset 0 0 0 1px #2b5dad; }
.plat.xbox { background: rgba(16, 124, 16, .2); color: #4ccb4c; box-shadow: inset 0 0 0 1px #1d661d; }
.plat.nintendo { background: rgba(230, 0, 18, .18); color: #ff6b7a; box-shadow: inset 0 0 0 1px #a3202c; }
.plat.gamepass { background: var(--green); color: var(--bg); }

/* buy-now-or-wait verdict, precomputed per listing (insights.DEAL_BADGES).
   Deliberately quieter than the platform chips: it's advice, not a fact. */
.verdict { font-size: .68rem; font-weight: 700; padding: 2px 7px; border-radius: 6px; white-space: nowrap; background: var(--surface2); color: var(--muted); }
.verdict.best { background: var(--green); color: var(--bg); }
.verdict.good { background: color-mix(in srgb, var(--green) 22%, var(--surface2)); color: var(--green); }
.verdict.ok { background: var(--surface2); color: var(--muted); }
.verdict.wait,
.verdict.soon { background: color-mix(in srgb, var(--amber) 20%, var(--surface2)); color: var(--amber); }
.verdict.overdue { background: color-mix(in srgb, var(--accent) 20%, var(--surface2)); color: var(--accent); }

/* per-platform strip: only on games tracked on more than one platform */
.strip { display: grid; gap: 4px; }
.cell { background: var(--surface2); border-radius: 6px; padding: 6px 4px; text-align: center; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cell.cheapest { background: rgba(53, 208, 127, .13); box-shadow: inset 0 0 0 1px var(--green); }
.cell-plat { font-size: .58rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-plat.steam { color: #66c0f4; }
.cell-plat.xbox { color: #4ccb4c; }
.cell-plat.nintendo { color: #ff6b7a; }
.cell-plat.playstation { color: #66a9ff; }
.cell-price { font-size: .76rem; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cell-price.low { color: var(--green); }
.cell-score { font-size: .56rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* toolbar: platform filter as one segmented control, sort on its own row */
.toolbar { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 16px; }
.chips {
  display: flex; gap: 2px; background: var(--surface); border: 1px solid var(--surface2);
  border-radius: 999px; padding: 3px; overflow-x: auto; scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 1 0 auto; text-align: center; color: var(--muted); border-radius: 999px;
  padding: 7px 14px; font-size: .8rem; font-weight: 600; cursor: pointer;
  white-space: nowrap; border: none; background: transparent; transition: background .12s, color .12s;
}
.chip.on { background: var(--accent); color: #fff; }
.viewrow { display: flex; gap: 8px; align-items: center; }
.viewtoggle {
  flex: 0 0 auto; background: var(--surface); border: 1px solid var(--surface2);
  color: var(--muted); border-radius: 999px; padding: 9px 14px;
  font-size: .8rem; font-weight: 600; white-space: nowrap;
}
.viewtoggle.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip:has(input:checked) { background: var(--accent); color: white; }
.chip input { display: none; }
.sortform { display: flex; }
.sortform select {
  width: 100%; background: var(--surface); border: 1px solid var(--surface2); color: var(--text);
  border-radius: 999px; padding: 9px 14px; font-size: .82rem; font-weight: 600;
}
@media (min-width: 620px) {
  .toolbar { flex-direction: row; align-items: center; justify-content: space-between; }
  .chips { flex: 1; }
  .viewrow { flex: 0 0 auto; }
  .sortform { flex: 0 0 auto; }
  .sortform select { width: auto; }
}

.chips.sub, .chips.seg-kind { margin-top: 6px; }
.chips.seg-kind { margin: 0 0 8px; }
.chip input[type="radio"] { display: none; }
.chips.sub .chip { font-size: .75rem; padding: 6px 12px; }

/* buy now or wait */
.advice { background: var(--surface); border-radius: 10px; padding: 14px; border-left: 3px solid var(--accent); }
.advice-verdict { margin: 0 0 4px; font-size: 1rem; font-weight: 600; }
.advice-line { margin: 0; font-size: .88rem; color: var(--text); }
.advice-facts { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 9px; font-size: .74rem; color: var(--muted); }

/* section headers within a sorted list */
.sect { margin-bottom: 18px; }
.sect-head {
  display: flex; align-items: center; gap: 9px;
  font-size: .74rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 8px; padding: 0 2px 6px;
  border-bottom: 1px solid var(--surface2);
}
.sect-count {
  margin-left: auto; background: var(--surface2); color: var(--muted);
  font-size: .7rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; letter-spacing: 0;
}

/* clickable Metacritic score */
.score.mc.link { text-decoration: none; }
.score.mc.link:hover { filter: brightness(1.25); }

/* alert settings */
.alert-form { background: var(--surface); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.alert-form h2 { margin: 0; }
.switch { display: flex; align-items: center; gap: 8px; font-size: .9rem; }
.switch input { width: 18px; height: 18px; accent-color: var(--accent); }
.small-note { font-size: .75rem; margin: 0; }

/* "adding a platform to X" banner */
.addbanner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: rgba(124,92,255,.14); border: 1px solid var(--accent); border-radius: 10px; padding: 10px 14px; font-size: .88rem; margin-bottom: 10px; }
.addbanner strong { font-weight: 700; }

/* search */
.searchbar { display: flex; gap: 8px; margin: 6px 0 12px; }
.searchbar input { flex: 1; background: var(--surface); border: 1px solid var(--surface2); color: var(--text); border-radius: var(--radius); padding: 12px 14px; font-size: 1rem; outline: none; }
.searchbar input:focus { border-color: var(--accent); }
.spinner { color: var(--muted); padding: 10px 2px; display: none; }
.htmx-request .spinner, .spinner.htmx-request { display: block; }

.store-block h2 { margin-top: 20px; }
.result-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
/* square art | title | price | action — one shape for every row */
.result {
  display: grid; grid-template-columns: 56px minmax(0, 1fr) auto auto;
  gap: 11px; align-items: center;
  background: var(--surface); border-radius: 10px; padding: 10px;
}
.result-thumb {
  width: 56px; aspect-ratio: 1; border-radius: 5px; overflow: hidden;
  background: var(--surface2); display: flex; align-items: center; justify-content: center;
}
.result-thumb img { width: 100%; height: 100%; object-fit: contain; }
.result-info { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.result-title {
  font-weight: 600; font-size: .88rem; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.result-sub { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.result-price {
  display: flex; flex-direction: column; align-items: flex-end; gap: 1px;
  text-align: right; white-space: nowrap;
}
.result-price .now { font-size: .92rem; }
.price-was { display: flex; align-items: center; gap: 4px; font-size: .7rem; }
.tracked-tag { color: var(--green); font-size: .76rem; white-space: nowrap; text-align: right; }

/* Generic list row — notifications, purchased, admin. Kept separate from
   .result (which is search-specific and has its own price/action columns), so
   changing one can't silently wreck the others. */
.listrow {
  display: grid; grid-template-columns: 52px minmax(0, 1fr);
  gap: 11px; align-items: center;
  background: var(--surface); border-radius: 10px; padding: 10px;
}
.listrow.no-art { grid-template-columns: minmax(0, 1fr); }
.listrow-art {
  width: 52px; aspect-ratio: 1; border-radius: 5px; overflow: hidden;
  background: var(--surface2); display: flex; align-items: center; justify-content: center;
}
.listrow-art img { width: 100%; height: 100%; object-fit: contain; }
.listrow-body { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.listrow-title { font-weight: 600; font-size: .9rem; line-height: 1.3; }
.listrow-text { font-size: .82rem; color: var(--text); }
.listrow-end { margin-left: auto; text-align: right; white-space: nowrap; }

/* content-type marker on search results */
.kind { font-size: .58rem; font-weight: 800; letter-spacing: .04em; padding: 2px 6px; border-radius: 4px; }
.kind.dlc { background: color-mix(in srgb, var(--amber) 26%, var(--surface2)); color: var(--text); }
.kind.bundle { background: color-mix(in srgb, var(--accent) 26%, var(--surface2)); color: var(--text); }

/* buttons */
.btn { background: var(--surface2); color: var(--text); border: none; border-radius: 10px; padding: 10px 16px; font-size: .9rem; font-weight: 600; cursor: pointer; display: inline-block; text-align: center; }
.btn.primary { background: var(--accent); color: white; }
.btn.small { padding: 7px 12px; font-size: .8rem; }
.btn.ghost { background: transparent; border: 1px solid var(--surface2); }
.btn.danger { background: transparent; border: 1px solid var(--red); color: var(--red); }

/* detail */
.detail-head { display: flex; gap: 14px; margin-top: 8px; }
.detail-cover { width: 130px; border-radius: 4px; object-fit: contain; align-self: flex-start; background: var(--surface2); }
.detail-sub, .detail-status { color: var(--muted); font-size: .85rem; margin-top: 6px; }
.listings { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
/* identity | price | action, fixed — rows no longer change height when a
   BEST REVIEWED flag or an end-date appears */
.listing {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px; align-items: center;
  background: var(--surface); border-radius: 10px; padding: 11px 12px;
}
.listing-id { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.listing-chips, .listing-flags { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }
.listing-flags:empty { display: none; }
.listing-price { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; white-space: nowrap; }
.listing-go { display: flex; }
.ends { color: var(--muted); font-size: .72rem; }
.chart-wrap { background: var(--surface); border-radius: var(--radius); padding: 12px; margin-top: 16px; }
.chart-wrap canvas { max-height: 260px; }
.range-btns { display: flex; gap: 4px; margin-bottom: 8px; }
.range-btns button {
  flex: 1; background: var(--surface2); border: none; color: var(--muted);
  border-radius: 8px; padding: 6px 0; font-size: .74rem; font-weight: 700; cursor: pointer;
}
.range-btns button.on { background: var(--accent); color: #fff; }
.shot-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; -webkit-overflow-scrolling: touch; }
.shot { position: relative; flex-shrink: 0; }
.shot img { height: 150px; border-radius: 4px; display: block; }
.shot-cover-btn { position: absolute; right: 6px; bottom: 6px; background: rgba(15,18,32,.85); color: var(--text); border: 1px solid var(--surface2); border-radius: 6px; font-size: .68rem; font-weight: 600; padding: 4px 8px; cursor: pointer; }
.shot-cover-btn.current { background: var(--accent); border-color: var(--accent); color: white; cursor: default; }

/* lightbox */
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(5, 7, 15, .96); display: flex; align-items: center; justify-content: center; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100vw; max-height: 100vh; object-fit: contain; }
.lb-btn { position: absolute; z-index: 101; background: rgba(35, 39, 65, .8); color: var(--text); border: none; border-radius: 50%; width: 44px; height: 44px; font-size: 1.3rem; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.lb-close { top: calc(12px + env(safe-area-inset-top)); right: 14px; }
.lb-prev { left: 10px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 10px; top: 50%; transform: translateY(-50%); }
.lb-count { position: absolute; bottom: calc(14px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); color: var(--muted); font-size: .85rem; }

/* detail: buy rows, flags, reviews panel */
.listing.is-best { box-shadow: inset 0 0 0 1.5px var(--green); background: rgba(53,208,127,.08); }
.rowflag { font-size: .58rem; font-weight: 800; letter-spacing: .03em; background: var(--green); color: #05240f; padding: 2px 6px; border-radius: 4px; }
.rowflag.alt { background: #ffce56; color: #3a2c00; }
.review-panel { background: var(--surface); border-radius: 10px; padding: 12px; margin-bottom: 8px; }
.panel-label { font-size: .62rem; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); margin: 0 0 9px; }
.bar-row { display: flex; align-items: center; gap: 10px; font-size: .8rem; margin-bottom: 8px; }
.bar-row:last-child { margin-bottom: 0; }
.bar-label { width: 92px; flex-shrink: 0; color: var(--muted); }
.bar { flex: 1; height: 6px; border-radius: 3px; background: var(--surface2); overflow: hidden; }
.bar span { display: block; height: 100%; border-radius: 3px; background: var(--green); }
.bar-val { width: 26px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.players-line { display: flex; align-items: center; gap: 9px; font-size: .82rem; }
.players-line + .players-line { margin-top: 6px; }

/* admin: duplicate merge */
.dupe { background: var(--surface); border-radius: 10px; padding: 12px; margin-bottom: 8px; }
.dupe-title { font-weight: 600; font-size: .92rem; margin-bottom: 6px; }
.dupe-plats { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 9px; }
.dupe-warn { color: #ffce56; font-size: .75rem; margin-bottom: 8px; }

/* settings rows */
.setting-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--surface2);
  border-radius: 10px; padding: 12px;
}
.setting-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.setting-copy b { font-size: .92rem; }
.setting-copy .muted { font-size: .78rem; }

/* theme picker */
.theme-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.theme-row button {
  width: 100%; display: flex; align-items: center; gap: 12px; text-align: left;
  background: var(--surface); border: 1px solid var(--surface2); color: var(--text);
  border-radius: 10px; padding: 11px 12px; cursor: pointer; font: inherit;
}
.theme-row.on button { border-color: var(--accent); }
.theme-swatch { display: flex; border-radius: 6px; overflow: hidden; flex-shrink: 0; box-shadow: inset 0 0 0 1px rgba(128,128,128,.25); }
.theme-swatch i { width: 15px; height: 34px; display: block; }
.theme-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.theme-copy b { font-size: .9rem; }
.theme-copy .muted { font-size: .76rem; }
.theme-on { font-size: .64rem; font-weight: 800; letter-spacing: .05em; background: var(--accent); color: #fff; padding: 3px 8px; border-radius: 999px; }

/* alerts log */
.alert-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 4px; font-size: .75rem; }
.alert-kind { font-size: .68rem; font-weight: 700; padding: 2px 7px; border-radius: 6px; background: var(--surface2); color: var(--muted); text-transform: capitalize; }
.alert-kind.price_drop { background: rgba(53, 208, 127, .18); color: var(--green); }
/* the stored kind is `new_low`; `all_time_low` never existed in the data */
.alert-kind.new_low { background: var(--green); color: #05240f; }
.alert-kind.target_reached { background: var(--accent); color: #fff; }
.alert-kind.gamepass_added { background: rgba(16, 124, 16, .25); color: #4ccb4c; }
.alert-kind.gamepass_leaving { background: var(--amber); color: #2a1e00; }
.alert-kind.gamepass_removed { background: var(--surface2); color: var(--muted); }
.alert-kind.sale_ending { background: var(--red); color: #fff; }

/* discover / top-rated charts */
.picker-row { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; margin-top: 8px; }
.picker-row label { display: flex; flex-direction: column; gap: 3px; font-size: .72rem; color: var(--muted); }
.picker-row select { background: var(--surface); color: var(--text); border: 1px solid var(--surface2); border-radius: 8px; padding: 8px 10px; font: inherit; font-size: .85rem; }
.chart-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 14px 0 8px; font-size: .8rem; font-weight: 600; }
.chart-head .muted { font-weight: 400; font-size: .74rem; }
/* rank | art | body | action — the base .listrow is 2 columns */
.listrow.chart-row { grid-template-columns: 26px 52px minmax(0, 1fr) auto; }
.chart-rank { font-size: .8rem; font-weight: 700; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }

/* admin health */
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tbl th { text-align: left; color: var(--muted); font-weight: 600; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; padding: 8px 10px; border-bottom: 1px solid var(--surface2); }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--surface2); }
.tbl td.ok { color: var(--green); font-weight: 600; }
.tbl td.bad, .result-sub.bad { color: var(--red); }
.result-sub.bad { font-size: .78rem; word-break: break-word; }

/* cover picker */
.cover-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.cover-option button { background: var(--surface2); border: 2px solid transparent; border-radius: 6px; padding: 0; cursor: pointer; width: 100%; aspect-ratio: 4/3; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.cover-option button:hover, .cover-option button:focus { border-color: var(--accent); }
.cover-option img { width: 100%; height: 100%; object-fit: contain; }

/* description + video links + price stats */
.desc { color: var(--text); font-size: .9rem; line-height: 1.5; }
.desc-box summary { color: var(--accent); cursor: pointer; font-size: .85rem; margin-top: 6px; }
.video-links { display: flex; gap: 8px; flex-wrap: wrap; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--surface); border-radius: 8px; padding: 10px 12px; text-align: center; }
.stat .label { color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; }
.stat .value { font-weight: 700; font-size: 1.05rem; margin-top: 2px; }
.stat .value.low { color: var(--green); }
.stat .value.high { color: var(--red); }

/* forms */
.actions { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
.inline-form { display: flex; align-items: end; gap: 8px; }
.inline-form label, .stack-form label { display: flex; flex-direction: column; gap: 4px; font-size: .8rem; color: var(--muted); }
input[type=number], input[type=date], select { background: var(--surface); border: 1px solid var(--surface2); color: var(--text); border-radius: 10px; padding: 9px 11px; font-size: .95rem; }
.purchase-box summary { list-style: none; width: fit-content; }
.purchase-box summary::-webkit-details-marker { display: none; }
.stack-form { display: flex; flex-direction: column; gap: 10px; background: var(--surface); padding: 14px; border-radius: var(--radius); margin-top: 10px; max-width: 320px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }

.empty { text-align: center; color: var(--muted); padding: 60px 20px; display: flex; flex-direction: column; gap: 16px; align-items: center; }

/* login */
.login-wrap { min-height: 85vh; display: flex; align-items: center; justify-content: center; }
.login-box { width: min(340px, 90vw); display: flex; flex-direction: column; gap: 18px; align-items: center; }
.brand.big { font-size: 1.5rem; font-weight: 700; }
.login-form { width: 100%; max-width: none; }
.login-form input { font-size: 1rem; }
.login-error { background: rgba(255, 92, 114, .15); border: 1px solid var(--red); color: var(--red); border-radius: 10px; padding: 10px 14px; margin: 0; font-size: .88rem; }

@media (min-width: 700px) {
  .tabbar { position: sticky; border-radius: 0; }
  h1 { font-size: 1.6rem; }
  .detail-cover { width: 180px; }
}
