/* StackSandos app — redesign Oct 11, 2026.
   Mobile-first, bottom tab bar, brand olive + mint, typewriter scores. */

:root {
  --olive: #808000;
  --olive-deep: #4d4d00;
  --olive-ink: #33330a;
  --olive-pale: #f1f1dc;
  --olive-light: #a8a800; /* dark-mode-only lighter olive for outlines on espresso */
  --mint: #00D4BB;
  --mint-deep: #00a894;
  --mint-pale: #dcfbf5;
  --mustard: #E1AD01;
  --paper: #f7f5ea;
  --milk: #FDFBF4;
  --espresso: #4E312D;
  --ink: var(--espresso); /* Espresso — brand dark */
  --muted: #8a8a6e;
  --line: #e8e6d2;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --tabbar-h: 108px; /* raised Nov 9, 2026 for larger 54px tab tiles + labels (was 96px) */
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 560px;
  margin: 0 auto;
}

/* ---------- header ---------- */

.app-header {
  background: var(--olive);
  color: var(--milk);
  padding: calc(3rem + env(safe-area-inset-top)) 1.1rem 1.25rem;
  position: relative;
}
.lang-toggle {
  display: inline-flex;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px;
}
.lang-toggle button {
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
}
.lang-toggle button.active {
  background: var(--mint);
  color: var(--olive-ink);
}
.app-header .brand {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}
.app-header .tagline {
  font-size: 0.85rem;
  opacity: 0.85;
  margin-top: 0.2rem;
  letter-spacing: 0.06em;
}

.divider {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 1.2rem 0;
}

/* ---------- bottom tab bar ---------- */

.tabs {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 560px;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex;
  background: rgba(78,49,45,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  z-index: 50;
}
.tabs button {
  flex: 1 1 0;
  min-width: 0;
  border: 0;
  background: transparent;
  color: #d8d2c4;
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* flex-start, not center (Case, Nov 7): "My Ratings" has a two-line
     label, so its content is taller — centering pushed its tile higher
     than the other four. Top-aligning lines all five tiles up in a row. */
  justify-content: flex-start;
  gap: 2px;
  padding: 14px 2px 0; /* 14px top (was 6px, Case Nov 7: more height above the tiles) */
  line-height: 1.3;
  text-align: center;
}
.tabs button::before { content: none; }
/* Admin tab: logo mark replaces the person icon (see applyAccountTab). */
.tabs button.admin-tab::before { content: none; }
.tabs button .tab-logo { width: 40px; height: 40px; object-fit: contain; }
.tabs button .tab-icon { width: 40px; height: 40px; display: block; flex: none; color: var(--milk); }
/* Olive tile behind every tab icon, like the Stack logo mark (Case, Nov 7).
   54px tile holds the 40px icon/logo with 7px of olive around it. */
.tabs button .tab-tile { width: 54px; height: 54px; background: var(--olive); border-radius: 12px; display: flex; align-items: center; justify-content: center; flex: none; }
.tabs button .tab-icon .acc { fill: var(--mint); }
.tabs button .tab-icon .acc-stroke { stroke: var(--mint); fill: none; }
.tabs button .tab-icon .milk-bg { fill: var(--milk); }
.admin-head { text-align: center; margin: 4px 0 12px; }
.admin-head img { width: 72px; height: 72px; object-fit: contain; }
.tabs button.active { color: var(--milk); }
.tabs button.active::after {
  content: "";
  width: 36px;
  height: 3px;
  border-radius: 2px;
  background: var(--mint);
  margin-top: 2px;
}

/* ---------- layout ---------- */

main {
  flex: 1;
  padding: 1rem 1rem calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 1.5rem);
}

.app-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.72rem;
  padding: 0;
  line-height: 1.5;
}

h2 {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0.3rem 0 0.9rem;
}
h3 { font-size: 1rem; margin: 0 0 0.4rem; }
.muted { color: var(--muted); font-size: 0.85rem; }
.center { text-align: center; }

/* ---------- cards & board ---------- */

.card {
  background: var(--milk);
  border: 2px solid var(--line);
  border-radius: 18px;
  padding: 1rem 1.05rem;
  margin-bottom: 0.8rem;
  box-shadow: 0 2px 10px rgba(60, 60, 20, 0.07);
}

.board-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  cursor: pointer;
  position: relative;
  transition: transform 0.08s ease;
}
.board-row:active { transform: scale(0.985); }

.board-row .thumb {
  width: 3.4rem;
  height: 3.4rem;
  border-radius: 0.65rem;
  object-fit: cover;
  flex-shrink: 0;
}
.board-row .thumb-wrap { position: relative; flex-shrink: 0; }
.board-row .thumb-wrap .thumb { display: block; }
.board-row .thumb-seal { position: absolute; right: -3px; bottom: -3px; width: 20px; height: 20px; border-radius: 5px; border: 2px solid var(--milk); box-shadow: 0 1px 4px rgba(78,49,45,0.35); }

.detail-photo {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 0.8rem;
  margin-bottom: 0.9rem;
}

.watchbtn {
  display: block;
  text-align: center;
  margin: 0.9rem 0 0.2rem;
  padding: 0.7rem 1rem;
  border: 1.5px solid var(--mint-deep);
  color: var(--mint-deep);
  font-weight: 700;
  border-radius: 999px;
  text-decoration: none;
}

.rank {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  background: var(--olive);
  color: var(--mint);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
}
/* champion */
.board-row.champion .rank {
  background: var(--mustard);
  color: var(--espresso);
  border: 2px solid var(--espresso);
}

.board-info { flex: 1; min-width: 0; }
.board-info .name {
  font-weight: 800;
  font-size: 1.02rem;
  letter-spacing: -0.01em;
  line-height: 1.25;
}
.board-info .shop { color: var(--muted); font-size: 0.8rem; margin-top: 1px; }

.scores { display: flex; gap: 0.45rem; flex-shrink: 0; align-items: flex-start; width: 8rem; }
.score-badge { flex: 1; min-width: 0; text-align: center; }
.score-badge .votes {
  display: block;
  font-size: 0.55rem;
  color: var(--muted);
  white-space: nowrap;
  margin-top: 2px;
}
.score-badge .val {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.02rem;
  display: block;
  padding: 0.3rem 0.5rem;
  border-radius: 10px;
  line-height: 1.2;
}
.score-badge .lbl {
  font-size: 0.6rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-top: 3px;
  display: block;
}
.score-badge.stack .val { background: var(--olive); color: var(--mint); }
.board-row.champion .score-badge.stack .val { background: var(--mustard); color: var(--espresso); border: 1px solid var(--espresso); }
.score-badge.crowd .val { background: var(--mint-pale); color: var(--mint-deep); }
.score-badge.yours .val {
  background: var(--milk);
  color: var(--olive-deep);
  border: 1.5px solid var(--olive);
}
.votes { font-size: 0.66rem; color: var(--muted); display: block; margin-top: 2px; }

/* ---------- board row actions (bookmark + Score it; unrated rows only) ---------- */

.scores-col { width: 8rem; flex-shrink: 0; }
.row-actions { display: flex; align-items: center; gap: 0.45rem; margin-top: 0.45rem; }
.row-bookmark { background: none; border: none; padding: 0.15rem; cursor: pointer; line-height: 0; flex-shrink: 0; }
.row-bookmark svg { width: 22px; height: 22px; fill: none; stroke: var(--olive-deep); stroke-width: 1.8; stroke-linejoin: round; }
.row-bookmark.on svg { fill: var(--mint); stroke: var(--mint-deep); }
.score-it { flex: 1; background: var(--milk); border: 1.5px solid var(--mint-deep); color: var(--mint-deep); font-weight: 700; font-size: 0.78rem; padding: 0.32rem 0.2rem; border-radius: 999px; cursor: pointer; white-space: nowrap; }
.leaflet-popup-content .popup-link { color: var(--mint-deep); text-decoration: underline; }

/* ---------- pairwise scoring (star picker + compare) ---------- */

.star-head { font-weight: 700; margin: 0.9rem 0 0.5rem; }
.star-row { display: flex; gap: 0.5rem; }
.star-opt { flex: 1; background: var(--milk); border: 1.5px solid var(--line); border-radius: 0.8rem; padding: 0.6rem 0.2rem; cursor: pointer; }
.star-opt .star-glyph { display: block; font-size: 1.6rem; color: var(--muted); letter-spacing: 0.1em; line-height: 1.2; }
.star-opt .star-lbl { display: block; font-size: 0.72rem; color: var(--muted); margin-top: 0.2rem; }
.star-opt.on { border-color: var(--olive); }
.star-opt.on .star-glyph { color: var(--olive-deep); }
.star-opt.on .star-lbl { color: var(--ink); font-weight: 700; }
.compare-head { font-weight: 700; margin: 0.9rem 0 0.5rem; }
.compare-pair { display: flex; gap: 0.6rem; }
.compare-card { flex: 1; background: var(--milk); border: 1.5px solid var(--line); border-radius: 0.8rem; padding: 0.5rem; cursor: pointer; text-align: left; }
.compare-photo { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 0.5rem; }
.compare-card .c-name { font-weight: 800; font-size: 0.9rem; margin-top: 0.4rem; }
.compare-card .c-shop { color: var(--muted); font-size: 0.75rem; }
.linkish { background: none; border: none; color: var(--mint-deep); font-weight: 700; cursor: pointer; padding: 0.4rem 0; }

/* ---------- detail ---------- */

.back {
  color: var(--mint-deep);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  margin-bottom: 0.7rem;
  display: inline-block;
}

/* ---------- detail pager (carousel) ---------- */
.detail-pager { display: flex; justify-content: space-between; gap: 0.5rem; margin: 0 0 0.7rem; }
.detail-pager > span { flex: 1; }
.pager-btn { background: none; border: none; color: var(--mint-deep); font: inherit; font-size: 0.9rem; font-weight: 700; cursor: pointer; padding: 0.2rem 0; max-width: 48%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.pager-btn:last-child { text-align: right; }

.score-trio {
  display: flex;
  margin: 1rem -1.05rem 0.4rem;
  border-top: 1px solid var(--line);
}
.score-trio .score-badge {
  flex: 1;
  min-width: 0;
  padding: 0.85rem 0.3rem 0.2rem;
}
.score-trio .score-badge + .score-badge { border-left: 1px solid var(--line); }
.score-trio .score-badge .val {
  font-size: 1.65rem;
  background: none !important;
  border: 0 !important;
  padding: 0;
  color: var(--ink);
}
.score-trio .score-badge.stack .val { color: var(--olive-deep); }
.score-trio.champion .score-badge.stack .val { background: var(--mustard) !important; color: var(--espresso); border: 1px solid var(--espresso) !important; padding: 0.3rem 0.6rem; border-radius: 10px; display: inline-block; }
.score-trio .score-badge.crowd .val { color: var(--mint-deep); }

/* ---------- forms ---------- */

label.row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 700;
  font-size: 0.95rem;
  margin: 1rem 0 0.4rem;
  cursor: pointer;
}
input[type="checkbox"] {
  width: 1.35rem;
  height: 1.35rem;
  accent-color: var(--olive);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--olive);
  margin: 0.4rem 0 0.8rem;
}
.range-val {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--olive-deep);
  text-align: center;
  margin-top: 0.6rem;
}

button.primary {
  display: block;
  width: 100%;
  background: var(--olive);
  color: var(--milk);
  border: 0;
  border-radius: 14px;
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 800;
  padding: 0.9rem;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease;
}
button.primary:active { background: var(--olive-deep); transform: scale(0.99); }
button.primary:disabled { opacity: 0.5; }

input[type="email"] {
  width: 100%;
  font-family: var(--sans);
  font-size: 1rem;
  padding: 0.85rem 1rem;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  margin-bottom: 0.75rem;
  background: var(--paper);
  color: var(--ink);
}
input[type="email"]:focus {
  outline: none;
  border-color: var(--mint);
  background: var(--milk);
}

input#code {
  width: 100%;
  box-sizing: border-box;
  font-family: var(--mono);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-align: center;
  text-transform: uppercase;
  padding: 0.9rem 1rem;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  margin-bottom: 0.75rem;
  background: var(--paper);
  color: var(--ink);
}
input#code:focus {
  outline: none;
  border-color: var(--mint);
  background: var(--milk);
}
input#code::placeholder {
  letter-spacing: 0.2em;
  color: var(--muted);
}

/* ---------- taste match ---------- */

.taste-big {
  font-family: var(--mono);
  font-size: 3.6rem;
  font-weight: 700;
  color: var(--mint-deep);
  text-align: center;
  margin: 0.6rem 0 0.2rem;
  letter-spacing: -0.03em;
}

/* ---------- messages ---------- */

.err { color: var(--espresso); font-size: 0.85rem; margin-top: 0.6rem; text-align: center; }
.okmsg {
  color: var(--mint-deep);
  font-size: 0.9rem;
  margin-top: 0.6rem;
  font-weight: 700;
  text-align: center;
}

.tm { font-size: 0.62em; vertical-align: super; line-height: 0; }

.brand-mark { height: 1.6em; width: 1.6em; border-radius: 0.35em; vertical-align: -0.35em; margin-right: 0.25rem; }

.app-header .mint { color: var(--mint); }

/* ---------- install prompt ---------- */
.install-banner { display: flex; align-items: center; gap: 0.6rem; background: var(--olive-pale); border: 1px solid var(--line); border-radius: 0.75rem; padding: 0.6rem 0.8rem; margin-bottom: 0.9rem; font-size: 0.9rem; }
.install-banner span { flex: 1; }
.linkbtn { background: none; border: none; color: var(--olive-deep); font-weight: 700; font-size: 0.9rem; padding: 0.2rem 0.4rem; cursor: pointer; }
.install-card h3 { margin: 0 0 0.5rem; font-size: 1.05rem; }
.benefits { margin: 0 0 0.8rem 1.1rem; padding: 0; font-size: 0.92rem; }
.benefits li { margin: 0.25rem 0; }
.steps { margin: 0 0 0.2rem 1.1rem; padding: 0; font-size: 0.92rem; }
.steps li { margin: 0.35rem 0; }

/* ---------- want to try ---------- */
.wantbtn { display: block; width: 100%; background: var(--olive-pale); border: 1px solid var(--line); border-radius: 0.75rem; padding: 0.7rem; font-size: 0.95rem; font-weight: 700; color: var(--olive-deep); margin-bottom: 0.8rem; cursor: pointer; }
.wantbtn.on { background: var(--mint-pale); border-color: var(--mint); }
.wantbtn:disabled { opacity: 0.5; }
.section-head { font-size: 0.95rem; margin: 1.1rem 0 0.5rem; color: var(--muted); }
.section-head:first-of-type { margin-top: 0.4rem; }

/* ---------- what people love tags ---------- */
.tags-section { margin-top: 1.1rem; border-top: 1px solid var(--line); padding-top: 0.9rem; }
.tags-head { font-size: 0.95rem; margin: 0 0 0.55rem; }
.tag-chips { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.tagchip {
  border: 1.5px solid var(--mint-deep);
  background: var(--mint-pale);
  color: var(--mint-deep);
  border-radius: 999px;
  padding: 0.38rem 0.75rem;
  font-family: var(--sans);
  font-size: 0.83rem;
  font-weight: 700;
  cursor: pointer;
}
.tagchip:active { transform: scale(0.96); }
.tagchip.mine { background: var(--olive); border-color: var(--olive-deep); color: var(--milk); }
.tagchip:disabled { opacity: 0.55; }
.tags-note { margin-top: 0.55rem; }

/* ---------- tasted count ---------- */
.tasted-progress { margin: -0.25rem 0 0.6rem; }

/* ---------- map view ---------- */
#app-map, #app-trails-map {
  border-radius: 0.9rem;
  border: 1px solid var(--line);
  box-shadow: 0 2px 12px rgba(78,49,45,0.08);
  z-index: 0;
}
#app-map {
  height: 40vh;
  min-height: 15rem;
  margin-bottom: 0;
}
/* Back-to-top below the leaderboard map (Case, Nov 14): the map was the
   last thing on the page, so there was nothing to grab and no way back up.
   The button gives the page an end and a one-tap way back to the board. */
.back-top-wrap { text-align: center; margin: 1rem 0 0.5rem; }
/* Recenter button on the maps (Case, Nov 14): target control under the
   zoom buttons; restores the default view. */
.leaflet-bar a.recenter-btn { display: flex !important; align-items: center; justify-content: center; width: 30px; height: 30px; background: var(--milk); color: var(--espresso); cursor: pointer; }
.leaflet-bar a.recenter-btn svg { display: block; }
/* Leaderboard map at 2/3 height (Nov 2) so it stops filling the screen.
   Trails map stays short on purpose: the first trail listing peeks in
   below it, so there's page to grab and scroll instead of a thumb
   landing only on map. */
#app-trails-map {
  height: 42vh;
  min-height: 17rem;
  margin-bottom: 5rem;
}
/* Trail legend pills (Case, Nov 9): big-finger tap targets. Each pill gets
   its trail color as a dark outline with a light tint of that color inside,
   so it reads as a button. Selected pill fills solid with the trail color. */
#trail-legend .trail-pill {
  border: 2px solid;
  border-radius: 999px;
  padding: 0.6rem 1rem;
  min-height: 44px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--ink);
}
#trail-legend .trail-pill .dot {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  flex: none;
}
/* Trail leg distance connector between stops in a trail listing (Case, Nov 9). */
.leg-dist { text-align: center; color: var(--muted); font-size: 0.8rem; font-weight: 700; padding: 0.35rem 0; letter-spacing: 0.02em; }
.map-pin-wrap { background: none; border: none; }
.map-pin {
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--olive); color: var(--mint);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 0.95rem; font-family: var(--sans);
  box-shadow: 0 2px 8px rgba(78,49,45,0.35);
}
.map-pin.champion { background: var(--mustard); color: var(--espresso); border: 3px solid var(--espresso); }
.leaflet-popup-content { font-family: var(--sans); line-height: 1.45; }
.leaflet-popup-content a { color: var(--mint-deep); font-weight: 700; }

.score-legend {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.8;
  margin: 1.25rem 0 5rem;
}
.score-legend .k {
  font-weight: 800;
  color: var(--ink);
}

/* ---------- trends tab ---------- */
.trend-card { cursor: pointer; }
.trend-name { font-weight: 800; font-size: 1.05rem; margin-top: 0.5rem; }
.trend-shop { color: var(--muted); font-size: 0.85rem; }
.trend-sub { margin-top: 0.35rem; font-size: 0.92rem; }
.mono { font-family: ui-monospace, Menlo, monospace; }
.pill {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
}
.pill-new { background: var(--mint); color: #00332c; }
.pill-up { background: var(--mint-pale); color: var(--mint-deep); }
.pill-down { background: var(--espresso); color: var(--milk); }
.pill-hold { background: var(--olive-pale); color: var(--olive-deep); }
.pill-steady { background: var(--paper); color: var(--muted); }
.tbars {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 84px;
  margin-top: 0.8rem;
  padding-top: 0.4rem;
  border-top: 1px solid var(--line);
}
.tbar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
}
.tbar {
  width: 100%;
  max-width: 44px;
  background: var(--olive);
  border-radius: 4px 4px 0 0;
  min-height: 8px;
}
.tbar-lbl { font-size: 0.68rem; color: var(--muted); margin-top: 3px; font-family: ui-monospace, Menlo, monospace; }

/* ---------- detail actions (bookmark + Score it, mirrors board rows) ---------- */
.detail-actions { display: flex; gap: 0.6rem; align-items: center; margin-bottom: 0.8rem; }
.detail-actions .row-bookmark { padding: 0.3rem; }

/* ---------- board filter ---------- */
.board-filter { display: flex; gap: 0.6rem; align-items: center; margin: 0.2rem 0 0.9rem; }
.board-filter label { font-weight: 700; color: var(--olive-deep); }
.board-filter select { flex: 1; padding: 0.45rem 0.6rem; border: 1.5px solid var(--line); border-radius: 0.75rem; background: var(--milk); font: inherit; font-size: 0.95rem; }

.share-pill { display: inline-flex; align-items: center; gap: 0.35rem; margin: 0.6rem 0 0; padding: 0.35rem 0.75rem; background: var(--milk); border: 1.5px solid var(--olive-deep); color: var(--olive-deep); font: inherit; font-size: 0.85rem; font-weight: 700; border-radius: 999px; cursor: pointer; }
.share-pill:active { background: var(--olive-pale); }
.share-pill .share-ic { width: 15px; height: 15px; }

/* ---------- theme picker (Account tab) ---------- */

.theme-toggle {
  display: inline-flex;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px;
}
.theme-toggle button {
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
}
.theme-toggle button.active { background: var(--mint); color: var(--olive-ink); }

/* ---------- dark theme (Light / Dark / Auto) ----------
   Dark mode flips the light surfaces to espresso with milk text. The
   already-dark pieces (olive header, olive buttons, mint accents, mustard
   marks) are left alone, so light mode is unchanged. */
html[data-theme="dark"] {
  color-scheme: dark;
  --paper: #4E312D;
  --ink: #FDFBF4;
  --muted: #C4B8A6;
  --line: #a89a86;
  --olive-pale: #4d4d00;
  --mint-pale: #0d3b35;
}
html[data-theme="dark"] .card { background: var(--espresso); border: 2px solid var(--line); }
html[data-theme="dark"] .tabs { background: var(--espresso); }
html[data-theme="dark"] .tabs button { color: var(--muted); }
html[data-theme="dark"] .tabs button.active { color: var(--milk); }
html[data-theme="dark"] .score-badge.yours .val { background: var(--espresso); color: var(--milk); }
html[data-theme="dark"] .score-it { background: var(--espresso); }
html[data-theme="dark"] .star-opt { background: var(--espresso); }
html[data-theme="dark"] .star-opt.on .star-glyph { color: var(--olive-light); }
html[data-theme="dark"] .star-opt.on { border-color: var(--olive-light); }
html[data-theme="dark"] .compare-card { background: var(--espresso); }
html[data-theme="dark"] input[type="email"]:focus,
html[data-theme="dark"] input#code:focus { background: var(--espresso); }
html[data-theme="dark"] .board-filter select { background: var(--espresso); }
html[data-theme="dark"] .share-pill { background: var(--espresso); color: var(--milk); border-color: var(--olive-light); }
html[data-theme="dark"] .score-trio:not(.champion) .score-badge.stack .val { color: var(--milk); }
html[data-theme="dark"] .range-val { color: var(--milk); }
html[data-theme="dark"] .board-filter label { color: var(--milk); }
html[data-theme="dark"] .linkbtn { color: var(--milk); }
html[data-theme="dark"] .wantbtn { color: var(--milk); }
html[data-theme="dark"] .pill-hold { color: var(--milk); }
html[data-theme="dark"] .err { color: var(--milk); }
html[data-theme="dark"] .row-bookmark:not(.on) svg { stroke: var(--olive-light); }
