/* ============================================================
   Bridlewood — app shell + Stable (Phase 1)
   Design tokens per design_handoff_bridlewood/README.md (final)
   ============================================================ */

:root {
  --forest: #2E3D30;
  --forest-ink: #283726;
  --sage: #9DAE86;
  --sage-pale: #C9D6B5;
  --meadow: #E4EAD6;
  --meadow-ink: #46583F;
  --clay: #C58A5A;
  --sand: #E8DFCF;
  --paper: #F4EEE2;
  --card: #FBF7EF;
  --card-border: #EAE0CD;
  --card-border-2: #E1D6C1;
  --stone: #CFC4AE;
  --gold: #C5A662;
  --shoe-ink: #7A632F;
  --shoe-bg: #EFE6D2;
  --shoe-border: #E1D5BC;
  --moon: #6B53A6;
  --moon-bg: #EEE9F6;
  --moon-border: #DDD3EE;
  --muted: #897F6C;
  --muted-2: #A89E8A;
  --ink: #2C2A24;
  --paper-text: #EFE8DA;
  --shadow-float: 0 12px 28px -10px rgba(40, 45, 32, 0.6);

  /* ---- Nightfall tokenization (ruling 27): every recurring chrome
     colour lives here so the [data-theme="dark"] block below can
     re-skin all four stylesheets at once. Light values are the
     original mock hexes, unchanged. ---- */
  --line: #EBE1CE;            /* hairline borders + bar tracks + neutral discs */
  --line-2: #E7DDC9;          /* search box / inventory chip borders */
  --seg-bg: #EDE4D2;          /* segmented-control troughs, steppers */
  --btn2-bg: #EFE6D2;         /* secondary button trio (README spec) */
  --btn2-border: #E1D5BC;
  --btn2-ink: #5C5444;
  --dim-ink: #7A7058;         /* back chips, close discs, steppers */
  --dim-bg: #EFE9DC;          /* muted badge / disabled herb bg */
  --off-bg: #E4D9C2;          /* disabled primary buttons */
  --dash: #D6CBB6;            /* empty-plot dashes, task tick rings */
  --ink-2: #3C3A32;           /* input text */
  --ink-3: #544E42;           /* strong soft body text */
  --text-soft: #6E6657;       /* secondary body */
  --text-mid: #857C6B;        /* ring labels, state blocks */
  --text-faint: #9A8F7C;      /* tertiary notes, inactive seg text */
  --faint-2: #B5AB96;         /* chevrons, empty-plot text */
  --reward-ink: #B0A78F;      /* unearned task reward */
  --sage-ink: #5C7350;        /* deep sage text (happy, stat values) */
  --sage-soft: #94A07E;       /* "fed" status */
  --sage-faint: #9AA682;      /* counts, task progress */
  --sage-dim: #8A9A6E;        /* ready-plot number */
  --sage-chip: #DCE3CF;       /* comp-boost pill bg */
  --sel-bg: #EAF0DC;          /* selected rows, ready plots, "me" rows */
  --plot-empty-bg: #F7F2E7;
  --amber-bg: #F5E8CB;        /* grow/gold badges, SOON pill */
  --amber-ink: #9A7321;
  --olive: #8A7F37;           /* card section kickers */
  --clay-bg: #F6EDE4;         /* vet patient / vet alert cards */
  --clay-border: #E8D5C0;
  --clay-chip: #EAD9C6;       /* clay icon tiles */
  --clay-ink: #A0805F;
  --clay-ink-2: #8A7460;
  --clay-strong: #A05B36;
  --clay-head: #7C4A28;
  --danger: #A9683C;          /* release/sell danger actions */
  --danger-border: #E8CFB8;
  --rose-bg: #F6E4DC;         /* vet/sign-out icon tiles */
  --rose-ink: #A0522D;
  --neutral-chip: #EBE6DA;    /* profile/settings icon tiles */
  --feed-bg: #F6EAD8;         /* garden feed-store pill */
  --feed-ink: #8A5E2E;
  --cookie-bg: #F3E7D0;       /* training-cookie pill */
  --cookie-border: #E6D3B4;
  --cookie-ink: #8A6320;
  --paper-deep: #E9DFC9;      /* wilds trail gradient foot */
  --miss: #C0673B;            /* rope-miss text */
  --forest-text: #2E3D30;     /* forest used AS TEXT/accent on paper (goes sage in dark) */
  --toast-bg: #283726;
  --toast-ink: #F4EEE2;
  --scrim: rgba(28, 26, 20, 0.42);
  --shadow-tile: 0 1px 2px rgba(40, 45, 32, 0.04);
  --shadow-seg: 0 1px 2px rgba(40, 45, 32, 0.12);
  --shadow-region: 0 8px 18px -12px rgba(40, 45, 32, 0.45);
  --shadow-btn: 0 2px 8px rgba(40, 45, 32, 0.10);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  /* iOS standalone height saga (see RULINGS.md chin-gap law): with the
     black-translucent bug gone, 100vh measures the FULL screen while the
     webview starts below the status bar -> content too tall. 100dvh is the
     honest "what's actually visible" unit and is only unreliable under
     black-translucent, which we never use. vh line kept as old-browser
     fallback only. */
  height: 100vh;
  height: 100dvh;
  background: var(--paper);
  overscroll-behavior: none;
}

body {
  font-family: 'Hanken Grotesk', sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
}

::selection { background: var(--sage); color: #23261F; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

.bw-scroll::-webkit-scrollbar { width: 0; height: 0; }
.bw-scroll { scrollbar-width: none; }

/* ---------- app frame: true full-screen, no bezel ---------- */

.screen {
  height: 100vh;   /* fallback */
  height: 100dvh;  /* actual visible viewport — correct without black-translucent */
  display: flex;
  flex-direction: column;
  background: var(--paper);
  overflow: hidden;
}

.view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  /* No env(safe-area-inset-top) here: with status-bar-style=default the
     webview already starts below the status bar — adding the inset again
     double-shifts the content down (the first bug Alice caught). */
  padding-top: 4px;
  overflow: hidden;
}

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

.tabbar {
  flex-shrink: 0;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 11px 10px calc(12px + env(safe-area-inset-bottom));
  background: var(--card);
  border-top: 1px solid var(--line);
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: 56px;
  color: var(--muted-2);
  transition: transform .1s;
}
.tab:active { transform: scale(0.96); }
.tab span { font-size: 9.5px; font-weight: 600; }
.tab.active { color: var(--forest-text); }
.tab.active span { font-weight: 700; }
.tab.active svg { stroke-width: 1.9; }

/* ---------- Stable: yard strip (name + wallet) ---------- */

.yard-strip {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 20px 0;
}

.yard-name {
  font-family: 'Newsreader', serif;
  font-size: 17px;
  font-weight: 600;
  color: var(--forest-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wallet { display: flex; align-items: center; gap: 7px; flex-shrink: 0; }

.pill {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 11px;
  border-radius: 20px;
}
.pill-shoes {
  background: var(--shoe-bg);
  border: 1px solid var(--shoe-border);
}
.pill-shoes .amt { font-size: 13px; font-weight: 700; color: var(--shoe-ink); }
.pill-moons {
  background: var(--moon-bg);
  border: 1px solid var(--moon-border);
  padding: 7px 10px;
  gap: 4px;
}
.pill-moons .glyph { font-size: 11px; color: var(--moon); line-height: 1; }
.pill-moons .amt { font-size: 13px; font-weight: 700; color: var(--moon); }

/* tiny CSS horseshoe glyph (per mock) */
.shoe-glyph {
  width: 11px;
  height: 11px;
  border: 2.5px solid #C29A4F;
  border-bottom: none;
  border-radius: 50% 50% 2px 2px;
  margin-top: 2px;
}

/* ---------- Stable: header ---------- */

.stable-head {
  flex-shrink: 0;
  padding: 8px 22px 4px;
}
.stable-title {
  font-family: 'Newsreader', serif;
  font-size: 27px;
  font-weight: 600;
  color: var(--forest-ink);
  line-height: 1.05;
}
.stable-sub {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 500;
  margin-top: 2px;
}

/* ---------- search ---------- */

.search-wrap { flex-shrink: 0; padding: 12px 18px 8px; }
.search-box {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--card);
  border: 1px solid var(--line-2);
  border-radius: 14px;
  padding: 11px 14px;
}
.search-box input {
  border: none;
  outline: none;
  background: transparent;
  font-family: 'Hanken Grotesk', sans-serif;
  font-size: 14px;
  color: var(--ink-2);
  width: 100%;
}
.search-box input::placeholder { color: var(--muted-2); }

/* ---------- filter chips ---------- */

.chips {
  flex-shrink: 0;
  display: flex;
  gap: 8px;
  padding: 4px 18px 10px;
  overflow-x: auto;
}
.chip {
  padding: 7px 14px;
  border-radius: 18px;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background .12s;
  background: var(--card);
  color: var(--text-soft);
  border: 1px solid var(--card-border);
}
.chip.active {
  background: var(--forest);
  color: var(--paper-text);
  border-color: var(--forest);
}

/* ---------- sort + count row ---------- */

.sort-row {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px 10px;
}
.count-label {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.sort-seg {
  display: flex;
  gap: 5px;
  background: var(--seg-bg);
  border-radius: 11px;
  padding: 3px;
}
.sort-btn {
  padding: 6px 12px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-faint);
  transition: all .12s;
}
.sort-btn.active {
  background: var(--card);
  color: var(--forest-text);
  box-shadow: var(--shadow-seg);
}

/* ---------- horse grid ---------- */

.grid-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 2px 16px 18px;
}
.horse-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.horse-tile {
  border-radius: 18px;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--line);
  cursor: pointer;
  text-align: left;
  padding: 0;
  display: block;
  width: 100%;
  transition: transform .12s, box-shadow .12s;
  box-shadow: var(--shadow-tile);
}
.horse-tile:active { transform: scale(0.97); }

.tile-coat { position: relative; height: 96px; }
.coat-fill { position: absolute; inset: 0; }
.coat-sheen {
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 80% at 72% 18%, rgba(255, 248, 232, 0.28), transparent 58%);
}

.rarity-badge {
  position: absolute;
  top: 7px;
  right: 7px;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 3px 7px;
  border-radius: 10px;
  text-transform: uppercase;
}

/* five tiers per RULINGS.md #14 — rarity badges are BRAND: literal
   hexes on purpose so Nightfall's token overrides never touch them. */
.r-common    { background: #EAE3D4; color: #8A8070; }
.r-uncommon  { background: #DCE3CF; color: #5C7350; }
.r-rare      { background: #F5E8CB; color: #9A7321; }
.r-very-rare { background: #EEE9F6; color: #6B53A6; }
.r-fantasy   { background: #C5A662; color: #FBF6EC; }

.total-pill {
  position: absolute;
  left: 9px;
  bottom: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(20, 16, 10, 0.34);
  padding: 3px 8px;
  border-radius: 11px;
}
.total-pill .n { font-size: 10px; font-weight: 700; color: #FBF6EC; }
.total-pill .l { font-size: 8.5px; color: rgba(255, 248, 235, 0.78); letter-spacing: 0.04em; }

.tile-body { padding: 9px 11px 11px; }
.tile-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--forest-ink);
  line-height: 1.1;
  white-space: nowrap;         /* long names ellipsis on tiles (ruling 13) */
  overflow: hidden;
  text-overflow: ellipsis;
}
.tile-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tile-hunger {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  font-size: 10.5px;
  font-weight: 600;
}
.tile-hunger .dot { font-size: 9px; line-height: 1; }

.h-happy  { color: var(--sage-ink); }
.h-fed    { color: var(--sage-soft); }
.h-hungry { color: var(--clay); }

/* ---------- empty / loading / error states ---------- */

.state-block {
  text-align: center;
  padding: 54px 20px;
  color: var(--muted-2);
}
.state-block .icon { display: flex; justify-content: center; margin-bottom: 10px; }
.state-block .head { font-size: 14px; font-weight: 600; color: var(--text-mid); }
.state-block .sub { font-size: 12.5px; margin-top: 3px; line-height: 1.5; }

.error-card {
  margin: 22px 18px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 26px 20px;
  text-align: center;
}
.error-card .icon {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
  color: var(--clay);
}
.error-card .head {
  font-family: 'Newsreader', serif;
  font-size: 19px;
  font-weight: 600;
  color: var(--forest-ink);
}
.error-card .sub {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  margin-top: 6px;
}
.btn-primary {
  display: inline-block;
  margin-top: 16px;
  background: var(--forest);
  color: var(--paper-text);
  font-size: 14px;
  font-weight: 600;
  padding: 12px 26px;
  border-radius: 13px;
  transition: transform .1s;
}
.btn-primary:active { transform: scale(0.96); }

/* ---------- "Soon" placeholder tabs ---------- */

.soon-page {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px 34px calc(24px + 46px);
}
.soon-icon {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  background: var(--meadow);
  color: var(--meadow-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.soon-title {
  font-family: 'Newsreader', serif;
  font-size: 27px;
  font-weight: 600;
  color: var(--forest-ink);
}
.soon-pill {
  display: inline-block;
  margin-top: 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--stone);
  border-radius: 20px;
  padding: 4px 11px;
}
.soon-sub {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
  margin-top: 12px;
  max-width: 24em;
}

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

.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
}
.scrim {
  position: absolute;
  inset: 0;
  background: var(--scrim);
  animation: bwFade .2s ease;
}
.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: min(88%, 712px);
  background: var(--paper);
  border-radius: 30px 30px 0 0;
  animation: bwSheet .32s cubic-bezier(0.22, 1, 0.36, 1) both;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

@keyframes bwSheet { from { transform: translateY(34px); } to { transform: translateY(0); } }
@keyframes bwFade  { from { opacity: 0; } to { opacity: 1; } }

.sheet-hero { position: relative; height: 204px; flex-shrink: 0; }
.sheet-hero .coat-sheen {
  background: radial-gradient(130% 78% at 66% 22%, rgba(255, 246, 224, 0.22), transparent 58%);
}
.hero-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(22, 17, 10, 0.66) 0%, rgba(22, 17, 10, 0.16) 30%, transparent 54%);
}
.sheet-handle {
  position: absolute;
  top: 11px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.6);
}
.sheet-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(28, 22, 14, 0.34);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FBF6EC;
}
.hero-id {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.82;
}
.hero-text {
  position: absolute;
  left: 20px;
  bottom: 16px;
  right: 96px;
  color: #FBF6EC;
}
.hero-name {
  font-family: 'Newsreader', serif;
  font-size: 34px;
  font-weight: 600;
  line-height: 1.02;
  overflow-wrap: anywhere;
}
.hero-sub { font-size: 13.5px; opacity: 0.9; font-weight: 500; }
.hero-rarity {
  position: absolute;
  right: 16px;
  bottom: 16px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 4px 9px;
  border-radius: 11px;
  text-transform: uppercase;
}

.sheet-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 20px calc(24px + env(safe-area-inset-bottom));
}

/* stat rings */
.rings {
  display: flex;
  justify-content: space-around;
  padding: 2px 6px 18px;
}
.ring-wrap { text-align: center; }
.ring {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}
.ring-inner {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 700;
  color: var(--forest-ink);
}
.ring-label {
  font-size: 10.5px;
  color: var(--text-mid);
  font-weight: 600;
  margin-top: 6px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* favourite food row */
.food-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 12px 13px;
  margin-bottom: 10px;
}
.food-icon {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: var(--meadow);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.food-main { flex: 1; min-width: 0; }
.food-title { font-size: 13.5px; font-weight: 600; color: var(--forest-ink); }
.food-line { font-size: 11.5px; }
.comp-pill {
  font-size: 11px;
  font-weight: 700;
  color: var(--sage-ink);
  background: var(--sage-chip);
  padding: 5px 10px;
  border-radius: 11px;
  flex-shrink: 0;
}

/* health + origin cards */
.fact-row { display: flex; gap: 10px; margin-bottom: 18px; }
.fact-card {
  flex: 1;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 12px 13px;
  min-width: 0;
}
.fact-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.fact-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--forest-ink);
  margin-top: 3px;
  text-transform: capitalize;
}
.fact-value.clay { color: var(--clay); }
.fact-value.well { color: var(--sage-ink); }

/* ==== LOGIN + TOAST (core chrome) ==== */

.logged-out .tabbar { display: none; }

.login-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 28px calc(48px + env(safe-area-inset-bottom));
}

.login-mark {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--forest);
  color: var(--sage-pale);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.login-wordmark {
  font-family: 'Newsreader', serif;
  font-weight: 600;
  font-size: 38px;
  color: var(--forest-ink, #283726);
}

.login-sub {
  font-size: 14px;
  color: var(--muted);
  margin-top: 6px;
}

.login-divider {
  width: 46px;
  height: 1px;
  background: var(--stone, #CFC4AE);
  margin: 26px 0;
}

.btn-discord {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  max-width: 320px;
  background: #5865F2;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  padding: 15px 18px;
  border-radius: 16px;
  box-shadow: 0 10px 22px -8px rgba(88, 101, 242, 0.55);
  transition: transform .12s ease, background .12s ease;
}
.btn-discord:active { transform: scale(0.96); background: #4E5AE8; }

.login-note {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--muted);
  margin-top: 22px;
  max-width: 300px;
}

.login-privacy {
  font-size: 11px;
  color: var(--muted-2, #A89E8A);
  margin-top: 10px;
}

#bw-toast {
  position: fixed;
  left: 50%;
  bottom: calc(92px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(12px);
  background: var(--toast-bg);
  color: var(--toast-ink);
  font-size: 13.5px;
  font-weight: 600;
  padding: 11px 20px;
  border-radius: 999px;
  box-shadow: var(--shadow-float);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
  z-index: 90;
  max-width: 84vw;
}
#bw-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ==== BUG REPORTER (core chrome) ==== */

#bugBtn {
  position: fixed;
  /* bottom-right, clear of the tab bar (Alice's call — top-right kept
     photobombing every screen's header) */
  bottom: calc(86px + env(safe-area-inset-bottom));
  right: 14px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--card-border-2);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-btn);
  z-index: 60;
  transition: transform .12s ease;
}
#bugBtn:active { transform: scale(0.92); }
.logged-out #bugBtn { display: none; }

.bug-sheet { padding: 20px 22px calc(26px + env(safe-area-inset-bottom)); }
.bug-title {
  font-family: 'Newsreader', serif;
  font-size: 21px;
  font-weight: 600;
  color: var(--forest-ink);
  margin-top: 10px;
}
.bug-sub { font-size: 12.5px; color: var(--muted); margin: 6px 0 14px; line-height: 1.5; }
.bug-text {
  width: 100%;
  border: 1px solid var(--card-border-2);
  border-radius: 12px;
  background: var(--card);
  font-family: 'Hanken Grotesk', sans-serif;
  font-size: 14px;
  color: var(--ink);
  padding: 12px;
  resize: none;
  outline: none;
  margin-bottom: 12px;
}
.bug-text:focus { border-color: var(--sage); }
.bug-cancel {
  width: 100%;
  text-align: center;
  padding: 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

/* ==== STABLE FEED ACTIONS (core) ==== */

.stable-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.feed-all-btn {
  flex-shrink: 0;
  background: var(--forest);
  color: var(--paper-text);
  font-size: 13px;
  font-weight: 700;
  padding: 9px 16px;
  border-radius: 12px;
  transition: transform .12s ease;
}
.feed-all-btn:active { transform: scale(0.95); }
.feed-all-btn:disabled { opacity: 0.5; }

.sheet-feed {
  width: 100%;
  margin-top: 14px;
}
.sheet-feed:disabled { opacity: 0.5; }

/* ============================================================
   NIGHTFALL — dark mode (RULINGS.md ruling 27)
   Charcoal + moss: #21231E / screen #23251F, NEVER pure #000.
   Sage on charcoal is #9DB083. Two identical token blocks:
   [data-theme="dark"] (explicit choice, set by theme.js) and a
   prefers-color-scheme mirror scoped so an explicit
   data-theme="light" always wins over the phone's setting.
   Keep the two blocks IDENTICAL when editing.
   ============================================================ */

[data-theme="dark"] {
  --forest-ink: #DCE2CE;
  --sage: #9DB083;
  --meadow: #38412F;
  --meadow-ink: #C2D0A8;
  --clay: #D09A6C;
  --sand: #1E201A;
  --paper: #23251F;
  --card: #2A2D26;
  --card-border: #3A3E35;
  --card-border-2: #434840;
  --stone: #4A4D42;
  --shoe-ink: #D9BF7B;
  --shoe-bg: #35301F;
  --shoe-border: #4B422C;
  --moon: #B7A6E3;
  --moon-bg: #322B48;
  --moon-border: #473C64;
  --muted: #A7A093;
  --muted-2: #7E7A6E;
  --ink: #EDE8DC;
  --shadow-float: 0 12px 28px -10px rgba(0, 0, 0, 0.75);
  --line: #3A3E35;
  --line-2: #383C33;
  --seg-bg: #1C1E19;
  --btn2-bg: #343830;
  --btn2-border: #464B3F;
  --btn2-ink: #D6D0C0;
  --dim-ink: #B1AA97;
  --dim-bg: #31342B;
  --off-bg: #383B31;
  --dash: #4C5044;
  --ink-2: #E4DFD1;
  --ink-3: #D6D0C0;
  --text-soft: #B5AE9E;
  --text-mid: #A29B8B;
  --text-faint: #8D8778;
  --faint-2: #6C6759;
  --reward-ink: #7E7A6E;
  --sage-ink: #9DB083;
  --sage-soft: #92A47A;
  --sage-faint: #8C9B74;
  --sage-dim: #97A87E;
  --sage-chip: #3B4433;
  --sel-bg: #303827;
  --plot-empty-bg: #262820;
  --amber-bg: #413823;
  --amber-ink: #D9B765;
  --olive: #B5AC64;
  --clay-bg: #362D24;
  --clay-border: #4D3F31;
  --clay-chip: #46392A;
  --clay-ink: #C39C73;
  --clay-ink-2: #B29070;
  --clay-strong: #D69A6B;
  --clay-head: #E3B98F;
  --danger: #C07A48;
  --danger-border: #5C4732;
  --rose-bg: #3F2F2A;
  --rose-ink: #D28C6B;
  --neutral-chip: #34372E;
  --feed-bg: #3A3226;
  --feed-ink: #D3A977;
  --cookie-bg: #3A3222;
  --cookie-border: #4F4530;
  --cookie-ink: #D5AF63;
  --paper-deep: #1E211B;
  --miss: #D98E62;
  --forest-text: #9DB083;
  --toast-bg: #C9D6B5;   /* sage-pale so the toast still pops on charcoal */
  --toast-ink: #21231E;
  --scrim: rgba(8, 9, 7, 0.6);
  --shadow-tile: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-seg: 0 1px 2px rgba(0, 0, 0, 0.45);
  --shadow-region: 0 8px 18px -12px rgba(0, 0, 0, 0.7);
  --shadow-btn: 0 2px 8px rgba(0, 0, 0, 0.4);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --forest-ink: #DCE2CE;
    --sage: #9DB083;
    --meadow: #38412F;
    --meadow-ink: #C2D0A8;
    --clay: #D09A6C;
    --sand: #1E201A;
    --paper: #23251F;
    --card: #2A2D26;
    --card-border: #3A3E35;
    --card-border-2: #434840;
    --stone: #4A4D42;
    --shoe-ink: #D9BF7B;
    --shoe-bg: #35301F;
    --shoe-border: #4B422C;
    --moon: #B7A6E3;
    --moon-bg: #322B48;
    --moon-border: #473C64;
    --muted: #A7A093;
    --muted-2: #7E7A6E;
    --ink: #EDE8DC;
    --shadow-float: 0 12px 28px -10px rgba(0, 0, 0, 0.75);
    --line: #3A3E35;
    --line-2: #383C33;
    --seg-bg: #1C1E19;
    --btn2-bg: #343830;
    --btn2-border: #464B3F;
    --btn2-ink: #D6D0C0;
    --dim-ink: #B1AA97;
    --dim-bg: #31342B;
    --off-bg: #383B31;
    --dash: #4C5044;
    --ink-2: #E4DFD1;
    --ink-3: #D6D0C0;
    --text-soft: #B5AE9E;
    --text-mid: #A29B8B;
    --text-faint: #8D8778;
    --faint-2: #6C6759;
    --reward-ink: #7E7A6E;
    --sage-ink: #9DB083;
    --sage-soft: #92A47A;
    --sage-faint: #8C9B74;
    --sage-dim: #97A87E;
    --sage-chip: #3B4433;
    --sel-bg: #303827;
    --plot-empty-bg: #262820;
    --amber-bg: #413823;
    --amber-ink: #D9B765;
    --olive: #B5AC64;
    --clay-bg: #362D24;
    --clay-border: #4D3F31;
    --clay-chip: #46392A;
    --clay-ink: #C39C73;
    --clay-ink-2: #B29070;
    --clay-strong: #D69A6B;
    --clay-head: #E3B98F;
    --danger: #C07A48;
    --danger-border: #5C4732;
    --rose-bg: #3F2F2A;
    --rose-ink: #D28C6B;
    --neutral-chip: #34372E;
    --feed-bg: #3A3226;
    --feed-ink: #D3A977;
    --cookie-bg: #3A3222;
    --cookie-border: #4F4530;
    --cookie-ink: #D5AF63;
    --paper-deep: #1E211B;
    --miss: #D98E62;
    --forest-text: #9DB083;
    --toast-bg: #C9D6B5;
    --toast-ink: #21231E;
    --scrim: rgba(8, 9, 7, 0.6);
    --shadow-tile: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-seg: 0 1px 2px rgba(0, 0, 0, 0.45);
    --shadow-region: 0 8px 18px -12px rgba(0, 0, 0, 0.7);
    --shadow-btn: 0 2px 8px rgba(0, 0, 0, 0.4);
  }
}

/* ---- Nightfall component tweaks (things tokens alone can't fix).
   Selectors out-specify the base rules in the w* sheets that load
   after this file, so order doesn't matter. Keep both variants. ---- */

[data-theme="dark"] .vt-well { border-color: #55694A; }
[data-theme="dark"] .hx-tick.done { color: #23251F; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .vt-well { border-color: #55694A; }
  :root:not([data-theme="light"]) .hx-tick.done { color: #23251F; }
}
