:root {
  color-scheme: light;
  --ink: #1f2421;
  --muted: #626c66;
  --paper: #f7f4ed;
  --panel: #ffffff;
  --line: #d9d1c1;
  --wine: #7b1e3a;
  --leaf: #2f6b4f;
  --gold: #b7791f;
  --blue: #315f7d;
  --clay: #a74d37;
  --danger: #a42d2d;
  --ok: #2f7d55;
  --shadow: 0 8px 20px rgba(31, 36, 33, 0.08);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--paper);
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 38px;
  border: 1px solid #b9ad9b;
  border-radius: 6px;
  color: var(--ink);
  background: #fffdfa;
  cursor: pointer;
}

button:hover:not(:disabled),
.choice:hover {
  border-color: var(--wine);
  box-shadow: 0 0 0 2px rgba(123, 30, 58, 0.12);
}

button:disabled {
  color: #9c9488;
  background: #ece7dd;
  cursor: not-allowed;
}

.app {
  min-height: 100vh;
}

.shell {
  max-width: 1440px;
  margin: 0 auto;
  padding: 16px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  backdrop-filter: blur(10px);
}

.topbar-inner {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(0, 3fr) auto;
  gap: 10px;
  align-items: center;
  max-width: 1440px;
  margin: 0 auto;
  padding: 8px 16px;
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.mark {
  display: grid;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 2px solid var(--wine);
  border-radius: 50%;
  color: var(--wine);
  background: #fffdfa;
}

.brand h1 {
  margin: 0;
  font-size: 17px;
  line-height: 1.1;
}

.brand p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.kpis {
  display: grid;
  grid-template-columns: minmax(90px, 1.15fr) repeat(10, minmax(52px, 1fr));
  gap: 4px;
}

.kpi-good {
  background: #eef7f1;
  border-color: #a8d5b8;
}

.kpi-good strong {
  color: #1e5c36;
}

.kpi-warn {
  background: #fef7e8;
  border-color: #e8c96a;
}

.kpi-warn strong {
  color: #7a5a10;
}

.kpi-danger {
  background: #fdf0f2;
  border-color: #e8a0b0;
}

.kpi-danger strong {
  color: #6b1624;
}

.kpi {
  min-width: 0;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fffdfa;
}

.kpi span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.2;
  white-space: nowrap;
}

.kpi strong {
  display: block;
  overflow: hidden;
  margin-top: 1px;
  font-size: 13px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kpi:first-child strong {
  font-size: 12px;
}

.top-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.primary {
  border-color: var(--wine);
  color: white;
  background: var(--wine);
}

.primary:hover:not(:disabled) {
  box-shadow: 0 0 0 3px rgba(123, 30, 58, 0.18);
}

.danger {
  border-color: var(--danger);
  color: white;
  background: var(--danger);
}

.ghost {
  background: transparent;
}

.alert-banner {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding: 12px 14px;
  border: 1px solid #c9332a;
  border-radius: 6px;
  background: #fdf0ee;
}

.alert-body strong {
  display: block;
  color: var(--danger);
  font-size: 14px;
}

.alert-body span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.alert-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.alert-actions button {
  min-height: 31px;
  padding: 4px 10px;
  font-size: 12px;
}

.harvest-report {
  border-color: #c49b5e;
  background: #fff7df;
}

.harvest-head {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
}

.harvest-title {
  display: block;
  font-size: 15px;
}

.harvest-note {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.harvest-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.setup {
  min-height: 100vh;
  background:
    linear-gradient(rgba(31, 36, 33, 0.08), rgba(31, 36, 33, 0.12)),
    url("assets/setup-vineyard.png");
  background-size: cover;
  background-position: center;
}

.setup-inner {
  display: grid;
  grid-template-columns: minmax(360px, 1.2fr) minmax(320px, 1.4fr);
  gap: 22px;
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 16px;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  align-self: start;
  gap: 14px;
  width: 100%;
  max-width: 760px;
  padding-top: 12vh;
  text-align: center;
  color: #171c18;
}

.hero-title {
  width: min(860px, 100%);
  aspect-ratio: 3 / 2;
  background: url("assets/title-plaque-with-title.png") center center / 100% 100% no-repeat;
}


.hero-blurb {
  max-width: 560px;
  padding: 12px 18px;
  border: 1px solid rgba(82, 70, 54, 0.18);
  border-radius: 8px;
  background: rgba(255, 253, 250, 0.68);
  box-shadow: 0 8px 20px rgba(31, 36, 33, 0.08);
  backdrop-filter: blur(6px);
}

.hero-copy p {
  margin: 0;
  font-size: 18px;
  line-height: 1.45;
  text-shadow: none;
}

.setup-panel {
  align-self: start;
  padding: 16px;
  border: 1px solid rgba(82, 70, 54, 0.32);
  border-radius: 8px;
  background: rgba(255, 253, 250, 0.94);
  box-shadow: var(--shadow);
}

.setup-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.setup-section {
  margin-top: 14px;
}

.winery-name-row {
  margin-bottom: 14px;
}

.winery-name-label span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.winery-name-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 16px;
  font-weight: 700;
  background: #fffdfa;
}

.winery-name-input:focus {
  outline: none;
  border-color: var(--wine);
  box-shadow: 0 0 0 2px rgba(123, 30, 58, 0.12);
}

.setup-progress {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 14px;
}

.setup-progress button {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 4px 7px;
  color: var(--muted);
  font-size: 12px;
  text-transform: capitalize;
}

.setup-progress button span {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: #9b8e7d;
  font-size: 11px;
}

.setup-progress button.active {
  border-color: var(--wine);
  color: white;
  background: var(--wine);
}

.setup-progress button.done {
  border-color: #9fb59b;
}

.setup-kicker {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.setup-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.setup-summary div {
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffdfa;
}

.setup-summary span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.setup-summary strong {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.section-title,
.panel h2,
.modal-card h2 {
  margin: 0 0 10px;
  font-size: 17px;
  line-height: 1.2;
}

.choice {
  display: block;
  width: 100%;
  min-height: 106px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  text-align: left;
  background: #fffdfa;
}

.choice.selected {
  border-color: var(--wine);
  border-width: 2px;
  background: #fff7fb;
  box-shadow: 0 0 0 3px rgba(123, 30, 58, 0.08);
}

.choice strong {
  display: flex;
  gap: 7px;
  align-items: center;
  font-size: 14px;
}

.choice p {
  margin: 6px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.tag {
  padding: 2px 6px;
  border: 1px solid #d8cdbb;
  border-radius: 999px;
  color: #4e5b52;
  background: #f5efe3;
  font-size: 11px;
  line-height: 1.4;
}

.tag.tag-capacity {
  border-color: #a8c4b0;
  color: #2e5c3a;
  background: #eaf3ec;
}

.tag.trait-virtue {
  border-color: #c4a84a;
  color: #6b5010;
  background: #fdf5dc;
}

.tag.trait-vice {
  border-color: #b0a090;
  color: #5a4f44;
  background: #eee8df;
}

.personality-traits {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 5px;
}

/* ── Intro modal ─────────────────────────────────��─────────────── */
.intro-modal-card {
  max-width: 860px;
  width: 100%;
}

.intro-scene {
  margin: 4px 0 8px;
  color: #5a5040;
  font-style: italic;
}

.intro-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 20px;
  margin-bottom: 16px;
}

.intro-goals {
}

.intro-section {
  background: #faf6ee;
  border: 1px solid #e2d9cc;
  border-radius: 7px;
  padding: 10px 12px;
}

.intro-head {
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #8a7050;
  margin-bottom: 7px;
}

.intro-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  padding: 2px 0;
}

.intro-row span { color: #5a5040; }
.intro-row strong { color: #2c2018; text-align: right; }
.intro-row em { color: #7a6a58; font-style: normal; text-align: right; }

.intro-row.score-guide span { font-family: monospace; font-size: 11px; color: #6a5840; }

.intro-goal {
  font-size: 12px;
  color: #3a3028;
  padding: 4px 0 4px 14px;
  position: relative;
}

.intro-goal::before {
  content: "→";
  position: absolute;
  left: 0;
  color: #a08850;
}

/* ── Setup start footer ───────────────────────────────────────── */
.setup-start-footer {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

/* ── Quick start cards ────────────────────────────────────────── */
.quick-start-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.quick-start-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 14px 16px;
  border-radius: 8px;
  text-align: left;
  height: auto;
  width: 100%;
  cursor: pointer;
}

.quick-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.quick-start-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.quick-card-easy .quick-start-badge {
  color: #1e5c36;
  background: #d4edda;
}

.quick-card-standard .quick-start-badge {
  color: #5a4010;
  background: #fce5b0;
}

.quick-card-challenging .quick-start-badge {
  color: #6b3a10;
  background: #fde8d0;
}

.quick-card-expert .quick-start-badge {
  color: #6b1624;
  background: #f5d0d8;
}

.quick-start-card strong {
  font-size: 15px;
  color: #2c2018;
}

.quick-start-card p {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}

.quick-card-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.quick-card-meta span {
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 11px;
  color: var(--muted);
  background: #faf6ee;
}

.quick-card-custom .quick-start-badge {
  color: var(--blue);
  background: #dceaf3;
}

/* ── Guide trait grid ─────────────────────────────────────────── */
.guide-trait-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

.guide-trait {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 5px 8px;
  border-radius: 5px;
}

.guide-trait span {
  font-size: 12px;
  font-weight: 600;
}

.guide-trait em {
  font-size: 11px;
  font-style: normal;
  color: var(--muted);
}

.guide-trait.virtue {
  background: #edf5f0;
  border-left: 3px solid #2f7d55;
}

.guide-trait.virtue span {
  color: #1e5c36;
}

.guide-trait.vice {
  background: #fdf0ee;
  border-left: 3px solid #c96050;
}

.guide-trait.vice span {
  color: #7a2818;
}

/* ── Guide modal ──────────────────────────────────────────────── */
.guide-modal-card {
  width: min(800px, 100%);
  max-height: min(800px, 92vh);
}

.guide-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.guide-header h2 {
  margin: 0 0 3px;
}

.guide-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.guide-page-counter {
  flex-shrink: 0;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: #faf6ee;
  font-size: 11px;
  font-weight: 600;
}

.guide-body {
  margin-bottom: 16px;
}

.guide-body p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.guide-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.guide-dots {
  display: flex;
  gap: 6px;
}

.guide-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #cfc4b4;
  transition: background 0.15s;
}

.guide-dot.active {
  background: var(--wine);
}

.guide-season-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.guide-season {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #faf6ee;
}

.guide-season-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--wine);
}

.guide-season-window {
  display: block;
  margin-bottom: 5px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.guide-season p {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: #5a5040;
}

.guide-note {
  padding: 8px 12px;
  border-left: 3px solid var(--gold);
  border-radius: 0 5px 5px 0;
  background: #fdf8ee;
  font-size: 12px;
  color: #4a3c20 !important;
  line-height: 1.45 !important;
}

.guide-two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.guide-section-head {
  margin-bottom: 5px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #8a7050;
}

.guide-section-head + p {
  margin-top: 0;
}

.guide-ul {
  margin: 0 0 12px;
  padding-left: 16px;
}

.guide-ul li {
  margin-bottom: 5px;
  font-size: 12px;
  line-height: 1.4;
  color: #5a5040;
}

.guide-score-table {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 6px 0 10px;
}

.guide-score-table div {
  display: grid;
  grid-template-columns: 80px 110px 1fr;
  align-items: baseline;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 4px;
  background: #faf6ee;
  font-size: 12px;
}

.guide-score-table span {
  color: var(--gold);
  font-size: 11px;
  letter-spacing: 1px;
  white-space: nowrap;
}

.guide-score-table strong {
  font-weight: 600;
  color: #2c2018;
}

.guide-score-table em {
  color: var(--muted);
  font-style: normal;
  font-size: 11px;
}

.guide-channel-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}

.guide-channel-list div {
  display: grid;
  grid-template-columns: 110px 42px 1fr;
  align-items: baseline;
  gap: 0 8px;
  padding: 4px 8px;
  border-radius: 4px;
  background: #faf6ee;
  font-size: 12px;
}

.guide-channel-list span {
  font-weight: 600;
  color: #2c2018;
  white-space: nowrap;
}

.guide-channel-list .guide-channel-pct {
  font-weight: 600;
  color: var(--wine);
  font-size: 11px;
  text-align: right;
  white-space: nowrap;
}

.guide-channel-list em {
  color: var(--muted);
  font-style: normal;
  font-size: 11px;
}

.game-grid {
  display: grid;
  grid-template-columns: minmax(350px, 1.1fr) minmax(360px, 1fr) minmax(320px, 0.95fr);
  gap: 12px;
  align-items: start;
  padding-top: 14px;
}

.tabs {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 0;
}

.tabs button {
  min-height: 36px;
  padding: 6px 11px;
  white-space: nowrap;
}

.tabs button.active {
  border-color: var(--wine);
  color: white;
  background: var(--wine);
}

.tabs .help-toggle {
  margin-left: auto;
}

.tab-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 12px;
  align-items: start;
}

.tab-main,
.side-rail {
  min-width: 0;
}

.side-rail {
  position: sticky;
  top: 144px;
}

.tutorial {
  margin-bottom: 12px;
  border-color: #c5a05b;
  background: #fff8e5;
}

.tutorial-grid,
.brief-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.tutorial-grid div,
.brief-card {
  min-width: 0;
  padding: 10px;
  border: 1px solid #e0cfaa;
  border-radius: 6px;
  background: #fffdfa;
}

.tutorial-grid strong,
.brief-card span {
  display: block;
  font-size: 13px;
}

.tutorial-grid p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.season-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.season-strip span {
  padding: 4px 7px;
  border: 1px solid #e0cfaa;
  border-radius: 999px;
  color: var(--muted);
  background: #fffdfa;
  font-size: 11px;
}

.season-strip strong {
  color: var(--ink);
}

.brief-card {
  text-align: left;
}

.brief-card strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
}

.brief-card em {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.scene-art {
  display: flex;
  align-items: flex-end;
  min-height: 180px;
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: white;
  background-color: #516b50;
  background-position: center;
  background-size: cover;
  box-shadow: var(--shadow);
}

.scene-art.commercial {
  background-color: #7a5c45;
}

.scene-art.cellar {
  background-color: #524239;
}

.scene-art strong {
  max-width: 560px;
  font-size: 22px;
  line-height: 1.15;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}

.estate-dash {
  margin-bottom: 12px;
  padding: 0;
  overflow: hidden;
}

.dash-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
}

.dash-col {
  display: block;
  padding: 14px 16px;
  border: none;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}

.dash-col:last-child {
  border-right: none;
}

.dash-col:hover {
  background: #f9f5ec;
  box-shadow: none;
}

.dash-col-head {
  margin-bottom: 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.dash-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid #ece6da;
  font-size: 13px;
}

.dash-row:last-child {
  border-bottom: none;
}

.dash-row span {
  color: var(--ink);
  white-space: nowrap;
}

.dash-row em {
  color: var(--muted);
  font-style: normal;
  text-align: right;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-row.danger span {
  color: var(--danger);
}

.dash-row.warn span {
  color: var(--gold);
}

.dash-row.muted span {
  color: var(--muted);
}

.dash-row.profile-row {
  align-items: center;
}

.profile-meter-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  min-width: 90px;
}

.profile-meter-track {
  position: relative;
  width: 90px;
  height: 6px;
  background: linear-gradient(to right, #c8a050, #c8a050 50%, #5a8a3d 50%);
  border-radius: 3px;
  overflow: visible;
}

.profile-meter-center {
  position: absolute;
  left: 50%;
  top: -1px;
  width: 2px;
  height: 8px;
  background: #bbb;
  transform: translateX(-50%);
}

.profile-meter-track::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to right, transparent 50%, rgba(255,255,255,0.55) 50%);
  pointer-events: none;
}

/* cursor dot on the meter */
.profile-meter-track::before {
  content: "";
  position: absolute;
  left: var(--profile-pct, 50%);
  top: 50%;
  width: 9px;
  height: 9px;
  background: white;
  border: 2px solid #888;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.compact {
  min-height: 30px;
  padding: 3px 8px;
  font-size: 12px;
}

.panel {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel + .panel {
  margin-top: 12px;
}

.panel-head {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.panel-head h2 {
  margin: 0;
}

.help-dot {
  position: relative;
  display: inline-grid;
  width: 18px;
  height: 18px;
  margin-left: 4px;
  place-items: center;
  border: 1px solid #c7baa8;
  border-radius: 50%;
  color: var(--blue);
  background: #f6f0e6;
  font-size: 12px;
  font-weight: 700;
  vertical-align: 1px;
  cursor: help;
}

[data-tip] {
  position: relative;
}

[data-tip]::after {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 30;
  display: none;
  width: min(260px, 80vw);
  padding: 8px 9px;
  border: 1px solid #4a4037;
  border-radius: 6px;
  color: white;
  background: #2e332f;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  white-space: normal;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
  content: attr(data-tip);
}

[data-tip]:hover::after,
[data-tip]:focus-visible::after {
  display: block;
}


.kpis [data-tip]::after {
  top: calc(100% + 8px);
  right: auto;
  bottom: auto;
  left: 0;
}

.kpis .kpi:nth-last-child(-n + 3)[data-tip]::after {
  right: 0;
  left: auto;
}

.help-dot[data-tip]::after {
  right: auto;
  left: 0;
}

.side-rail .help-dot[data-tip]::after {
  top: calc(100% + 8px);
  bottom: auto;
  left: auto;
  right: 0;
}

.tabs button:nth-child(-n+2)[data-tip]::after {
  right: auto;
  left: 0;
}

.trait-virtue[data-tip]::after,
.trait-vice[data-tip]::after {
  right: auto;
  left: 0;
}

.small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.vineyard {
  display: grid;
  gap: 8px;
}

.row-card {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fcf9f1;
}

.row-info {
  min-width: 0;
}

.row-name {
  font-weight: 700;
  font-size: 13px;
}

.row-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 5px;
  border-radius: 4px;
  background: #e8e0cc;
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
}
.row-badge-oldvine {
  background: #f0e6d0;
  color: var(--gold);
  font-weight: 600;
}

.row-pressure {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  text-transform: capitalize;
}

.row-meters {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.row-meter-group {
  display: grid;
  grid-template-columns: 52px 1fr 80px;
  align-items: center;
  gap: 6px;
}

.row-meter-label {
  font-size: 11px;
  color: var(--muted);
  text-align: right;
}

.row-meter-track {
  position: relative;
  height: 8px;
  border-radius: 4px;
  background: var(--line);
  overflow: visible;
}

.row-meter-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s;
}

.row-meter-fill.health      { background: var(--leaf); }
.row-meter-fill.disease-ok  { background: #a8c87a; }
.row-meter-fill.disease-warn{ background: var(--gold); }
.row-meter-fill.disease-danger{ background: var(--danger); }
.row-meter-fill.water-ok    { background: var(--blue); }
.row-meter-fill.water-warn  { background: #d49a40; }
.row-meter-fill.water-danger{ background: var(--clay); }

.water-track {
  overflow: visible;
}

.water-optimal-marker {
  position: absolute;
  top: -2px;
  width: 2px;
  height: 12px;
  border-radius: 1px;
  background: rgba(49, 95, 125, 0.55);
  transform: translateX(-50%);
}

.row-meter-val {
  font-size: 11px;
  color: var(--muted);
}

.text-danger { color: var(--danger); font-weight: 600; }
.text-warn   { color: var(--gold);   font-weight: 600; }

.vineyard-summary {
  display: flex;
  gap: 18px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}

.actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.capacity-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: -3px 0 9px;
}

.capacity-strip span {
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #fffdfa;
  font-size: 11px;
}

.capacity-strip strong {
  color: var(--ink);
}

.action-card {
  display: grid;
  gap: 4px;
  min-height: 76px;
  padding: 8px 9px;
  text-align: left;
}

.action-card b {
  font-size: 13px;
}

.action-card span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.28;
}

.action-card .effect {
  color: #315f7d;
  font-size: 11px;
  font-weight: 700;
}

.action-card .effect-note {
  color: #8a6a2a;
  font-size: 11px;
  font-weight: 600;
  font-style: italic;
}

.action-card.offseason {
  opacity: 0.66;
}

.action-card em {
  color: var(--blue);
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
}

.market-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 70px;
  gap: 10px;
  align-items: center;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--wine);
}

.meter {
  overflow: hidden;
  height: 9px;
  border-radius: 999px;
  background: #ebe4d8;
}

.meter > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--leaf);
}

.meter.wine > span {
  background: var(--wine);
}

.meter.gold > span {
  background: var(--gold);
}

.meter.danger > span {
  background: var(--danger);
}

.flow-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  margin-top: 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffdfa;
}

.flow-step span,
.flow-step em {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.flow-step strong {
  display: block;
  margin: 2px 0;
  font-size: 14px;
}

.flow-arrow {
  color: var(--muted);
  font-weight: 700;
}

.debt-panel {
  display: grid;
  gap: 7px;
  margin-top: 10px;
  padding: 8px;
  border: 1px solid #d8c5a6;
  border-radius: 6px;
  background: #fff8e8;
}

.debt-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.debt-actions button {
  min-height: 31px;
  padding: 4px 8px;
  font-size: 12px;
}

.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.stat-box {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffdfa;
}

.stat-box span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.stat-box strong {
  font-size: 16px;
}

.stat-box em {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.channel-grid,
.archive-grid {
  display: grid;
  gap: 8px;
}

.channel-row {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffdfa;
}

.channel-row.warn {
  border-color: #d7af55;
  background: #fff9e9;
}

.channel-row.danger {
  border-color: #d48a82;
  background: #fff1ee;
}

.channel-row strong,
.channel-row span {
  display: block;
}

.channel-row span {
  color: var(--muted);
  font-size: 11px;
}

.channel-bars {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.channel-bars label {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 32px;
  gap: 6px;
  align-items: center;
  font-size: 11px;
  color: var(--muted);
}

.channel-bars meter {
  width: 100%;
  height: 10px;
  accent-color: var(--wine);
}

.archive-card {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffdfa;
}

.archive-card.sold-out {
  border-color: #d3b066;
  background: #fff9e8;
}

.archive-head {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  justify-content: space-between;
}

.archive-head strong,
.archive-head span {
  display: block;
}

.archive-head span,
.archive-card p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.archive-card p {
  margin: 7px 0;
}

.archive-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 7px 0;
}

.archive-stats span {
  padding: 5px 6px;
  border: 1px solid #eadfce;
  border-radius: 5px;
  color: var(--muted);
  background: #fcf8f0;
  font-size: 11px;
}

.archive-stats strong {
  color: var(--ink);
}

.forecast-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.pnl-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.pnl-block {
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffdfa;
}

.pnl-title {
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 800;
}

.pnl-line {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
  border-top: 1px solid #eee7dc;
  font-size: 12px;
}

.pnl-line:first-of-type {
  border-top: 0;
}

.pnl-line span {
  color: var(--muted);
}

.pnl-line strong {
  font-size: 12px;
  white-space: nowrap;
}

.pnl-line.pos strong {
  color: var(--ok);
}

.pnl-line.neg strong {
  color: var(--danger);
}

.pnl-line.total {
  margin-top: 4px;
  padding-top: 7px;
  border-top: 2px solid #ded3c2;
}

.pnl-note {
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.chart-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.chart-card {
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffdfa;
}

.chart-head {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.chart-head strong {
  font-size: 13px;
}

.chart-head span {
  color: var(--muted);
  font-size: 11px;
}

.bar-chart {
  display: grid;
  grid-template-columns: repeat(12, minmax(8px, 1fr));
  gap: 5px;
  align-items: end;
  height: 138px;
  padding-top: 6px;
}

.bar-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
  height: 100%;
}

.bar-wrap span {
  display: block;
  width: 100%;
  min-height: 3px;
  border-radius: 4px 4px 0 0;
  background: var(--gold);
}

.bar-chart.gold .bar-wrap span {
  background: var(--gold);
}

.bar-wrap em {
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
}

.bar-wrap[data-chart-tip]::after {
  position: absolute;
  top: 8px;
  left: 50%;
  z-index: 30;
  display: none;
  width: max-content;
  max-width: 180px;
  padding: 6px 8px;
  border: 1px solid #4a4037;
  border-radius: 6px;
  color: white;
  background: #2e332f;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
  content: attr(data-chart-tip);
  transform: translateX(-50%);
  pointer-events: none;
}

.bar-wrap[data-chart-tip]:hover::after,
.bar-wrap[data-chart-tip]:focus-visible::after {
  display: block;
}

.bar-wrap.edge-start[data-chart-tip]::after {
  left: 0;
  transform: none;
}

.bar-wrap.edge-end[data-chart-tip]::after {
  right: 0;
  left: auto;
  transform: none;
}

.line-chart {
  display: block;
  width: 100%;
  height: 156px;
  border: 1px solid #eee6da;
  border-radius: 6px;
  background: linear-gradient(#fffdfa, #faf5ec);
}

.line-chart line {
  stroke: #d6cbbb;
  stroke-width: 1;
}

.line-chart polyline {
  fill: none;
  stroke: var(--blue);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.line-chart.wine polyline,
.metric-card.wine .sparkline polyline {
  stroke: var(--wine);
}

.line-chart.gold polyline,
.metric-card.gold .sparkline polyline {
  stroke: var(--gold);
}

.line-chart.leaf polyline,
.metric-card.leaf .sparkline polyline {
  stroke: var(--leaf);
}

.line-chart.clay polyline,
.metric-card.clay .sparkline polyline {
  stroke: var(--clay);
}

.line-chart circle {
  fill: var(--wine);
  stroke: white;
  stroke-width: 1.5;
}

.chart-axis-label {
  font-size: 6.5px;
  fill: var(--muted);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.metric-card {
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffdfa;
}

.metric-card span,
.metric-card em {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.metric-card strong {
  display: block;
  margin-top: 2px;
  font-size: 16px;
}

.metric-card em {
  margin-top: 2px;
}

.sparkline,
.spark-empty {
  width: 100%;
  height: 44px;
  margin-top: 7px;
}

.sparkline polyline {
  fill: none;
  stroke: var(--blue);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
}

.sparkline circle {
  fill: var(--wine);
  stroke: white;
  stroke-width: 1.3;
}

.spark-empty {
  border-radius: 6px;
  background: #f2eadf;
}

.orders,
.morale-breakdown {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffdfa;
  padding: 8px 10px;
  margin-bottom: 12px;
}

.morale-breakdown-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.morale-breakdown-head span {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.morale-breakdown-head strong {
  font-size: 15px;
}

.morale-breakdown-head em {
  font-style: normal;
  font-size: 12px;
  margin-left: auto;
}

.morale-breakdown-list {
  display: grid;
  gap: 2px;
}

.morale-breakdown-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 12px;
  padding: 1px 0;
}

.morale-breakdown-row span {
  color: var(--ink);
}

.morale-breakdown-row strong {
  font-size: 12px;
  font-weight: 600;
  min-width: 28px;
  text-align: right;
}

.staff-list,
.buildings,
.log {
  display: grid;
  gap: 6px;
}

.order,
.staff,
.building,
.log-entry {
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffdfa;
}

.order-head,
.staff-head,
.building-head {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  justify-content: space-between;
}

.order strong,
.staff strong,
.building strong {
  font-size: 13px;
}

.order p,
.staff p,
.building p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.staff .staff-agenda {
  color: #6d4611;
  font-size: 11px;
}

.order-actions,
.staff-actions,
.building-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.order-actions button,
.staff-actions button,
.building-actions button {
  min-height: 31px;
  padding: 4px 8px;
  font-size: 12px;
}

/* ── Capex / Buildings tier panel ─────────────────────────────── */
.capex-grid {
  display: grid;
  gap: 16px;
}

.capex-cat {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.capex-cat-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 12px;
  background: #f6f2ec;
  border-bottom: 1px solid var(--line);
}

.capex-cat-head strong {
  font-size: 12px;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.capex-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(160px, 1fr);
  overflow-x: auto;
}

.capex-tier {
  padding: 10px 12px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: #fffdfa;
  position: relative;
}

.capex-tier:last-child { border-right: none; }

.capex-tier p {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.35;
  flex: 1;
}

.capex-tier-head {
  display: flex;
  gap: 6px;
  align-items: flex-start;
}

.capex-tier-head strong {
  font-size: 12px;
  line-height: 1.25;
}

.capex-check {
  color: #5a8a3d;
  font-size: 11px;
  flex-shrink: 0;
  margin-top: 1px;
}

.capex-num {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  flex-shrink: 0;
  margin-top: 2px;
  background: #eee;
  border-radius: 3px;
  padding: 1px 4px;
}

.capex-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.capex-tags .tag {
  font-size: 10px;
  padding: 1px 5px;
}

.capex-cost {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

.capex-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 4px;
}

.capex-actions button {
  font-size: 11px;
  padding: 3px 8px;
  min-height: 26px;
}

/* owned tiers: subtle green wash */
.capex-past, .capex-current {
  background: #f3faee;
}

/* next purchasable tier: light highlight */
.capex-next {
  background: #fffdf4;
  border-top: 2px solid #c0a865;
}

/* locked future tiers: greyed out */
.capex-locked {
  background: #f8f7f6;
  opacity: 0.55;
}

.capex-locked .capex-cost {
  color: #aaa;
}

/* ── Staff traits ──────────────────────────────────────────────── */
.staff-traits {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.staff-id {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.staff-id img:not(.portrait-popup-img) {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 5px;
  object-fit: cover;
  object-position: center top;
  background: #efe8dc;
}

.portrait-hover-wrap {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
}

.portrait-popup {
  display: none;
  position: absolute;
  left: 52px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 50;
  width: 380px;
  padding: 12px;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.28);
  pointer-events: none;
}

.portrait-hover-wrap:hover .portrait-popup {
  display: flex;
  align-items: flex-start;
}

.portrait-popup-img {
  width: 160px;
  height: 208px;
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  object-fit: cover;
  object-position: center top;
  background: #efe8dc;
}

.portrait-popup-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.portrait-name {
  font-size: 14px;
  color: var(--ink);
}

.portrait-role {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.portrait-hometown {
  font-size: 11px;
  color: var(--muted);
  margin-top: 1px;
}

.portrait-bio {
  margin-top: 6px !important;
  font-size: 11px;
  line-height: 1.45;
  color: var(--ink) !important;
}

.advancement {
  margin-top: 7px;
  padding-top: 6px;
  border-top: 1px solid #e6ddcf;
}

.advancement-head {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
}

.advancement-head strong {
  font-size: 12px;
}

.perk-tree {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.perk {
  min-width: 0;
  padding: 8px;
  border: 1px solid #d9cfbf;
  border-radius: 6px;
  background: #fbf7ee;
}

.perk.unlocked {
  border-color: rgba(47, 125, 85, 0.55);
  background: #eef8f0;
}

.perk.ready {
  border-color: rgba(123, 30, 58, 0.5);
  background: #fff8fb;
}

.perk.blocked,
.perk.locked {
  opacity: 0.78;
}

.perk-head span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
}

.perk-head strong {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.2;
}

.perk p {
  margin: 5px 0 7px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.perk button {
  width: 100%;
  min-height: 28px;
  padding: 3px 6px;
  font-size: 11px;
}

.log {
  max-height: 320px;
  overflow: auto;
}

.log-entry {
  font-size: 12px;
  line-height: 1.35;
}

.event-banner {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid #c49b5e;
  border-radius: 6px;
  background: #fff7df;
}

.event-result {
  margin-bottom: 12px;
  border-color: #b8c6a1;
  background: #f5faed;
}

.event-result p {
  margin: 0 0 5px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.event-result-gains {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 6px 0 8px;
}

.event-gain {
  padding: 2px 9px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.event-gain.pos {
  background: #d4edda;
  color: #155724;
}

.event-gain.neg {
  background: #f8d7da;
  color: #721c24;
}

.event-banner.with-art {
  grid-template-columns: 112px minmax(0, 1fr);
  align-items: start;
}

.event-banner.with-art-large {
  grid-template-columns: 1fr;
}

.event-banner img {
  width: 112px;
  aspect-ratio: 1;
  border: 1px solid #d5be8a;
  border-radius: 6px;
  object-fit: cover;
  object-position: center top;
  background: #f1e3bf;
}

.event-banner.with-art-large img {
  width: 80%;
  height: auto;
  max-height: 400px;
  display: block;
  margin: 0 auto;
  object-fit: cover;
  object-position: top;
  background: transparent;
  border: none;
  border-radius: 4px;
}

.event-banner.with-art-large .event-buttons {
  margin-top: 14px;
}

.event-banner.with-art-large .event-buttons .event-choice:only-child {
  grid-column: 1 / -1;
  padding: 12px 20px;
  align-items: center;
  text-align: center;
}

.event-banner strong {
  color: #6d4611;
}

.event-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
  margin-bottom: 4px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(21, 24, 22, 0.58);
}

.modal-card {
  width: min(680px, 100%);
  max-height: min(720px, 90vh);
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.28);
}

.modal-card p {
  color: var(--muted);
  line-height: 1.45;
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.empty {
  padding: 12px;
  border: 1px dashed #cfc4b4;
  border-radius: 6px;
  color: var(--muted);
  background: #fffdfa;
  font-size: 13px;
}

@media (max-width: 900px) {
  .harvest-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .guide-season-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .guide-two-col {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1120px) {
  .topbar-inner {
    grid-template-columns: 1fr;
  }

  .top-actions {
    justify-content: flex-start;
  }

  .kpis {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .game-grid,
  .tab-layout,
  .setup-inner {
    grid-template-columns: 1fr;
  }

  .tabs,
  .side-rail {
    position: static;
  }

  .tabs {
    overflow-x: auto;
    padding-bottom: 8px;
  }

  .tabs .help-toggle {
    margin-left: 0;
  }

  .tutorial-grid,
  .brief-grid,
  .setup-summary,
  .pnl-panel,
  .forecast-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chart-grid {
    grid-template-columns: 1fr;
  }

  .metric-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .shell,
  .topbar-inner {
    padding-inline: 10px;
  }

  .kpis,
  .setup-grid,
  .setup-progress,
  .setup-summary,
  .actions,
  .two-col,
  .channel-row,
  .channel-bars,
  .archive-stats,
  .event-buttons,
  .flow-panel,
  .score-grid,
  .tutorial-grid,
  .brief-grid,
  .metric-grid,
  .pnl-panel,
  .perk-tree,
  .forecast-grid,
  .guide-season-grid,
  .guide-two-col {
    grid-template-columns: 1fr;
  }

  .flow-arrow {
    display: none;
  }

  .row-card {
    grid-template-columns: 1fr;
  }

  .dash-grid {
    grid-template-columns: 1fr;
  }

  .dash-col {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .dash-col:last-child {
    border-bottom: none;
  }

  .event-banner.with-art {
    grid-template-columns: 1fr;
  }

  .event-banner img {
    width: 100%;
    max-height: 220px;
  }


  .top-actions {
    flex-wrap: wrap;
  }
}

/* Vintage cellar panel */
/* Gantt / vintage cellar panel */
.gantt-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
  font-size: 11px;
  color: var(--muted);
}

.gantt-swatch {
  display: inline-block;
  width: 12px;
  height: 10px;
  border-radius: 2px;
  margin-right: 3px;
  vertical-align: middle;
}

.gantt-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 12px;
}

.gantt-row {
  display: grid;
  grid-template-columns: 180px 1fr 130px;
  align-items: center;
  gap: 8px 10px;
  grid-template-rows: auto auto;
}

.lot-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: -2px;
}

.bulk-sell-btn,
.early-release-btn {
  font-size: 11px;
  padding: 3px 8px;
  color: var(--muted);
}

.early-release-btn {
  color: color-mix(in srgb, #b04020 70%, var(--muted));
  border-color: color-mix(in srgb, #b04020 40%, var(--line));
}

.early-badge {
  font-size: 10px;
  font-style: normal;
  font-weight: 600;
  color: #b04020;
  opacity: 0.75;
  margin-left: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.gantt-meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.gantt-label {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gantt-score {
  font-size: 11px;
  color: var(--gold);
  letter-spacing: 0.02em;
}

.gantt-track {
  display: flex;
  height: 14px;
  border-radius: 4px;
  background: var(--line);
  overflow: hidden;
}

.gantt-bar {
  height: 100%;
  min-width: 3px;
  transition: width 0.25s;
}

.gantt-grapes  { background: #adc97a; }
.gantt-aged    { background: var(--gold); }
.gantt-remain  { background: #e2cfa0; }
.gantt-ready   { background: var(--ok); }

.gantt-status {
  font-size: 12px;
  color: var(--muted);
  text-align: right;
  line-height: 1.4;
}

.gantt-status.ready {
  color: var(--ok);
  font-weight: 600;
}

.vintage-buy-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.muted {
  color: var(--muted);
}

/* ── Region color theming ─────────────────────────────────────── */
/* napa: default warm amber/wine — no override needed */
body[data-region="bordeaux"] { --wine: #5c243c; --paper: #f5f3f0; --line: #d6d0c8; }
body[data-region="mendoza"]  { --wine: #5f2268; --paper: #f6f2f5; --line: #d8d0d6; }
body[data-region="mosel"]    { --wine: #1e4f5a; --paper: #f2f5f4; --line: #cdd4d2; }
body[data-region="burgundy"] { --wine: #501e5a; --paper: #f4f2f6; --line: #d4cfd8; }
body[data-region="barossa"]  { --wine: #8a2a10; --paper: #f8f1e6; --line: #ddd4c4; }
body[data-region="piedmont"] { --wine: #5a2010; --paper: #f6f1e8; --line: #dad2c2; }
body[data-region="rioja"]    { --wine: #881a14; --paper: #f7f0e8; --line: #dcd3c2; }
body[data-region="fingerlakes"] { --wine: #255c68; --paper: #f1f5f3; --line: #cad7d4; }

/* ── Event choice hints ───────────────────────────────────────── */
.event-choice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  text-align: left;
  padding: 8px 12px;
}

.event-choice-label {
  font-weight: 600;
  font-size: 13px;
}

.event-choice-hint {
  font-size: 11px;
  font-weight: 400;
  color: color-mix(in srgb, currentColor 60%, transparent);
  line-height: 1.3;
}

/* ── Critic score in gantt ────────────────────────────────────── */
.critic-score {
  font-size: 11px;
  font-weight: 600;
  color: var(--gold);
  margin-left: 4px;
  opacity: 0.9;
}

/* ── Naming modal ─────────────────────────────────────────────── */
.naming-modal-card {
  max-width: 440px;
}

.naming-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 18px 0 8px;
}

.naming-btn {
  padding: 10px 14px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  font-size: 14px;
  font-style: italic;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  text-align: center;
}

.naming-btn:hover {
  border-color: var(--wine);
  background: color-mix(in srgb, var(--wine) 8%, var(--paper));
}

/* ── Price anchor note ────────────────────────────────────────── */
.price-anchor-note {
  font-weight: 400;
  color: var(--muted);
  margin-left: 6px;
}

/* ── Insurance row ────────────────────────────────────────────── */
.insurance-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  background: color-mix(in srgb, var(--paper) 60%, white);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 10px 0;
}

.insurance-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.insurance-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--wine);
  cursor: pointer;
}

/* ── Stash control ────────────────────────────────────────────── */
.stash-control {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 5px;
}

.stash-control .micro {
  padding: 2px 8px;
  font-size: 11px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
  cursor: pointer;
  line-height: 1.6;
}

.stash-control .micro:disabled {
  opacity: 0.4;
  cursor: default;
}

.stash-control span {
  font-size: 12px;
  font-weight: 600;
  min-width: 24px;
  text-align: center;
}

/* Achievement toast */
@keyframes toast-in-out {
  0%   { opacity: 0; transform: translateY(12px); }
  12%  { opacity: 1; transform: translateY(0); }
  75%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(-6px); }
}

.achievement-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 40;
  background: var(--panel);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 13px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.18);
  white-space: nowrap;
  animation: toast-in-out 4.2s ease forwards;
  pointer-events: none;
}

/* Score screen achievements */
.score-tagline {
  color: var(--muted);
  margin: 2px 0 12px;
}

.achievement-section {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.achievement-section h3 {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 10px;
}

.achievement-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.achievement-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 3px 10px 3px 8px;
  font-size: 12px;
  cursor: default;
}

.achievement-chip span {
  font-weight: 500;
}

/* ── Cup of Wrath path ──────────────────────────────────────────────────── */

/* Log italic cues */
.cue-italic {
  color: #6a4a4a;
  font-style: italic;
}

/* Hidden staff card */
.staff.staff-hidden {
  border-color: #c8b8b8;
  background: #fdf8f5;
}
.staff-name-hidden {
  font-style: italic;
  color: #6a4a4a;
}

/* Iniquity event choice */
.event-choice-iniquity {
  grid-column: 1 / -1;
  border-color: #8b2222;
  opacity: 0.65;
  color: #6a1a1a;
}
.event-choice-iniquity:hover:not(:disabled) {
  opacity: 1;
  border-color: var(--wine);
}

/* Character-level font corruption */
.corrupt-char {
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-size: 0.97em;
  color: #5a2a2a;
  display: inline;
}

/* Block Aceldama */
.row-name-aceldama {
  font-family: Georgia, "Times New Roman", serif;
  color: #6a2222;
}

/* Measurement panel */
.measurement-panel .measurement-bar {
  height: 4px;
  background: #e8ddd0;
  border-radius: 2px;
  margin-bottom: 12px;
}
.measurement-panel .measurement-bar-fill {
  height: 100%;
  background: var(--wine);
  border-radius: 2px;
  transition: width 0.4s;
}
.measurement-panel .measurement-faith-cup {
  display: flex;
  gap: 20px;
  margin-top: 12px;
  font-size: 13px;
}
.measurement-step h3 {
  font-size: 15px;
  margin-bottom: 8px;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 500;
}
.measurement-verse {
  font-style: italic;
  color: #4a3838;
  line-height: 1.65;
  margin-bottom: 14px;
}
.measurement-scales {
  display: flex;
  gap: 24px;
  margin-top: 12px;
}
.scale-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.scale-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.scale-col.scale-cup .scale-label { color: #8b2222; }
.scale-col.scale-faith .scale-label { color: var(--gold); }
.scale-bar {
  height: 8px;
  background: #e8ddd0;
  border-radius: 4px;
  overflow: hidden;
}
.scale-col.scale-cup .scale-bar .scale-fill { background: #8b2222; height: 100%; border-radius: 4px; }
.scale-col.scale-faith .scale-bar.scale-bar-faith .scale-fill { background: var(--gold); height: 100%; border-radius: 4px; }
.measurement-record {
  margin: 0;
  padding-left: 18px;
  line-height: 1.8;
  color: #3a2a2a;
}
.measurement-verdict {
  font-size: 16px;
  font-style: italic;
  color: #4a2222;
  line-height: 1.6;
  margin-top: 12px;
}
.measurement-cup-text {
  text-align: center;
  font-style: italic;
  color: #4a2222;
  margin-top: 8px;
}
.measurement-final {
  font-size: 15px;
  line-height: 1.75;
  color: #2a1a1a;
  font-style: italic;
}

/* Smooth transitions so stage changes ease in rather than snap */
body, .panel, .topbar, .kpi, button {
  transition: background-color 2s ease, border-color 1.5s ease, color 1s ease;
}

@keyframes clock-flicker {
  0%, 94%, 100% { opacity: 1; }
  96% { opacity: 0.25; }
  97% { opacity: 0.9; }
  98.5% { opacity: 0.4; }
}

/* Seal 1 — barely perceptible */
body.corruption-stage-1 .cue-italic { color: #6a3a3a; }
body.corruption-stage-1 .staff.staff-hidden { border-color: #b89898; }

/* Seal 2 — faint panel tint */
body.corruption-stage-2 .panel { border-color: rgba(139,34,34,0.09); }
body.corruption-stage-2 .staff.staff-hidden { border-color: rgba(139,34,34,0.30); }

/* Seal 3 — row names shift font */
body.corruption-stage-3 .panel { border-color: rgba(139,34,34,0.14); }
body.corruption-stage-3 .row-name { font-family: Georgia, "Times New Roman", serif; }

/* Seal 4 — background breathes warm */
body.corruption-stage-4 { background: color-mix(in srgb, var(--paper) 97%, #3a0a0a 3%); }
body.corruption-stage-4 .panel { border-color: rgba(139,34,34,0.18); }
body.corruption-stage-4 .topbar { background: color-mix(in srgb, #fff 97%, #3a0a0a 3%); }

/* Seal 5 — deepens */
body.corruption-stage-5 { background: color-mix(in srgb, var(--paper) 94%, #3a0a0a 6%); }
body.corruption-stage-5 .panel { border-color: rgba(139,34,34,0.22); }
body.corruption-stage-5 .topbar { background: color-mix(in srgb, #fff 94%, #3a0a0a 6%); }
body.corruption-stage-5 .row-name { font-family: Georgia, "Times New Roman", serif; color: #5a2222; }

/* Seal 6 — pronounced, numbers flicker */
body.corruption-stage-6 { background: color-mix(in srgb, var(--paper) 89%, #3a0a0a 11%); }
body.corruption-stage-6 .panel { border-color: rgba(139,34,34,0.28); background: color-mix(in srgb, var(--panel) 96%, #3a0a0a 4%); }
body.corruption-stage-6 .topbar { background: color-mix(in srgb, #fff 90%, #3a0a0a 10%); }
body.corruption-stage-6 .kpi strong { animation: clock-flicker 6s infinite; }
body.corruption-stage-6 .chart-card,
body.corruption-stage-6 .staff,
body.corruption-stage-6 .building { background: color-mix(in srgb, #fffdfa 93%, #3a0a0a 7%); border-color: rgba(139,34,34,0.22); }

/* Seal 7 — blood red (Joel: sun to sackcloth, moon to blood) */
body.corruption-stage-7 { background: #2e0d0d; color: #eacfcf; }
body.corruption-stage-7 .panel { background: #3a1212; border-color: #7a2424; color: #eacfcf; }
body.corruption-stage-7 .chart-card,
body.corruption-stage-7 .staff,
body.corruption-stage-7 .building { background: #361010; border-color: #7a2424; color: #eacfcf; }
body.corruption-stage-7 .topbar { background: #260a0a; border-bottom-color: #7a2424; }
body.corruption-stage-7 .kpi { background: #3e1414; border-color: #7a2424; color: #dab8b8; }
body.corruption-stage-7 strong { color: #fff4f4; }
body.corruption-stage-7 button:not(.primary) { background: #421616; border-color: #7a2424; color: #dab8b8; }
body.corruption-stage-7 .kpi strong { animation: clock-flicker 2.5s infinite; color: #f0c8c8; }
body.corruption-stage-7 .cue-italic { color: #d07070; }
body.corruption-stage-7 .stat-box { background: #3e1414; border-color: #7a2424; color: #eacfcf; }
body.corruption-stage-7 .stat-box span { color: #a05858; }
body.corruption-stage-7 .stat-box strong { color: #f0d0d0; }
body.corruption-stage-7 .row-card { background: #361010; border-color: #7a2424; color: #eacfcf; }
body.corruption-stage-7 .row-badge { background: #4e1818; color: #b88080; }
body.corruption-stage-7 .row-meter-track { background: #4e1818; }
body.corruption-stage-7 .row-meter-fill.health { background: #8a2828; }
body.corruption-stage-7 .action-card { background: #361010; border-color: #7a2424; }
body.corruption-stage-7 .action-card span { color: #b07070; }
body.corruption-stage-7 .action-card .effect { color: #d09090; }
body.corruption-stage-7 .empty { background: #361010; border-color: #7a2424; color: #a07070; }
body.corruption-stage-7 .channel-row { background: #200808; border-color: #5a1414; color: #d4b0b0; }
body.corruption-stage-7 .channel-row.warn { background: #260a0a; border-color: #7a2020; }
body.corruption-stage-7 .channel-row.danger { background: #2a0808; border-color: #8a1a1a; }
body.corruption-stage-7 .channel-row span { color: #8a4040; }
body.corruption-stage-7 .pnl-block { background: #200808; border-color: #5a1414; }
body.corruption-stage-7 .debt-panel { background: #200808; border-color: #5a1414; }
body.corruption-stage-7 .flow-step { background: #200808; border-color: #5a1414; }
body.corruption-stage-7 .flow-step span, body.corruption-stage-7 .flow-step em { color: #8a4040; }
body.corruption-stage-7 .capacity-strip span { background: #200808; border-color: #5a1414; color: #9a6060; }
body.corruption-stage-7 .archive-card { background: #200808; border-color: #5a1414; }
body.corruption-stage-7 .archive-card.sold-out { background: #260808; border-color: #7a2020; }
body.corruption-stage-7 .archive-stats span { background: #1c0606; border-color: #5a1414; color: #9a6060; }
body.corruption-stage-7 .archive-head span, body.corruption-stage-7 .archive-card p { color: #8a4040; }

/* Stage 9 / measurement — near-black, KPIs and log hidden */
body.corruption-stage-9 { background: #1a1210; color: #d4c4b4; }
body.corruption-stage-9 .panel { background: #221a16; border-color: #3a2a22; color: #d4c4b4; }
body.corruption-stage-9 .topbar { background: #161008; border-bottom-color: #3a2a22; }
body.corruption-stage-9 button:not(.primary) { background: #2a1e18; border-color: #3a2a22; color: #c4b4a4; }
body.corruption-stage-9 .kpi { color: #c4b4a4; }
body.corruption-stage-9 strong { color: #e8d8c8; }
body.corruption-stage-9 .kpis { visibility: hidden; }
body.corruption-stage-9 .side-rail > *:not(.measurement-panel) { visibility: hidden; }

.wrath-ending-modal {
  background: rgba(10, 4, 4, 0.92);
}

.wrath-ending-card {
  background: #1c0808;
  border-color: #5a1414;
  color: #d4b0b0;
}

.wrath-ending-card h2 {
  color: #e8c8c8;
  letter-spacing: 0.06em;
  text-transform: lowercase;
}

.wrath-ending-card .score-tagline {
  color: #a07070;
  font-style: italic;
}

.wrath-ending-card .score-grid .stat-box {
  background: #240c0c;
  border-color: #5a1414;
  color: #d4b0b0;
}

.wrath-ending-card .score-grid .stat-box span {
  color: #8a5050;
}

.wrath-ending-card .score-grid .stat-box strong {
  color: #e8c0c0;
}

.wrath-ending-card .achievement-section {
  border-top-color: #5a1414;
}

.wrath-ending-card .achievement-section h3 {
  color: #8a5050;
}

.wrath-ending-card button.primary {
  background: #4a1010;
  border-color: #7a2020;
  color: #e8c8c8;
}

.wrath-ending-card button.primary:hover {
  background: #5a1414;
}

.staff-arrival-banner {
  width: 100%;
  border-radius: 4px 4px 0 0;
  display: block;
  object-fit: cover;
  max-height: 180px;
  margin-bottom: 8px;
}

.measurement-img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 320px;
  border-radius: 4px;
  object-fit: contain;
  margin: 0 auto 16px;
}

/* ── Pest Infestation Overlay ─────────────────────────────────────────────── */

#pest-overlay {
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  overflow: hidden;
}

.pest-bug {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: all;
  cursor: crosshair;
  user-select: none;
  will-change: transform;
  display: grid;
  place-items: center;
  min-width: 48px;
  min-height: 48px;
  transition: filter 0.08s;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.25));
}

.pest-bug:hover {
  filter: drop-shadow(0 0 6px rgba(180,80,0,0.7));
  transform-origin: center;
}

.pest-bug-hit {
  animation: pest-hit 0.12s ease-out;
}

@keyframes pest-hit {
  0%   { filter: brightness(3) drop-shadow(0 0 4px orange); }
  100% { filter: drop-shadow(0 1px 2px rgba(0,0,0,0.25)); }
}

.pest-bug-dying {
  animation: pest-die 0.28s ease-out forwards;
  pointer-events: none;
}

@keyframes pest-die {
  0%   { opacity: 1; transform: scale(1.3) rotate(0deg); filter: brightness(2); }
  60%  { opacity: 0.6; transform: scale(0.6) rotate(120deg); }
  100% { opacity: 0; transform: scale(0) rotate(180deg); }
}

#pest-hud {
  display: none;
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  align-items: center;
  gap: 14px;
  padding: 6px 18px;
  background: rgba(22, 14, 6, 0.88);
  color: #e8d5a0;
  font-size: 13px;
  border-radius: 8px 8px 0 0;
  border: 1px solid #5a3c1a;
  border-bottom: none;
  pointer-events: none;
  white-space: nowrap;
}

.pest-hud-bug {
  font-size: 16px;
}

.pest-hud-label {
  font-weight: 600;
  color: #f0c060;
  letter-spacing: 0.03em;
}

.pest-hud-killed {
  color: #7ec87e;
}

.pest-hud-escaped {
  color: #e07070;
}

/* ── Papal Envoy Quiz ─────────────────────────────────────────────────────── */

.pq-backdrop {
  background: rgba(12, 8, 4, 0.82);
  z-index: 30;
}

.pq-card {
  width: min(560px, 100%);
  background: #fdf6e3;
  border: 2px solid #8b1a1a;
  border-radius: 4px;
  box-shadow:
    0 0 0 4px #c8a44a,
    0 24px 64px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  font-family: Georgia, "Times New Roman", serif;
}

.pq-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: #8b1a1a;
  color: #f5d87e;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pq-crest {
  font-size: 16px;
  opacity: 0.85;
}

.pq-title {
  font-weight: bold;
  letter-spacing: 0.12em;
}

.pq-body {
  padding: 24px 28px 20px;
}

.pq-progress-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #6b4c12;
  margin-bottom: 8px;
  letter-spacing: 0.04em;
}

.pq-score {
  font-style: italic;
}

.pq-timer-track {
  height: 6px;
  background: #e8dfc8;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 4px;
}

.pq-timer-bar {
  height: 100%;
  background: linear-gradient(90deg, #c8a44a, #8b1a1a);
  border-radius: 3px;
  transition: width 0.08s linear;
}

.pq-timer-text-row {
  text-align: right;
  font-size: 11px;
  color: #8b1a1a;
  font-variant-numeric: tabular-nums;
  margin-bottom: 16px;
}

.pq-question {
  font-size: 16px;
  line-height: 1.55;
  color: #1a0f0a;
  margin-bottom: 24px;
  min-height: 56px;
}

.pq-dim {
  color: #6b4c30;
  font-size: 14px;
}

.pq-tf-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.pq-true-btn,
.pq-false-btn {
  padding: 14px 0;
  font-size: 16px;
  font-family: Georgia, serif;
  border-radius: 3px;
  cursor: pointer;
  border: 2px solid;
  letter-spacing: 0.04em;
  font-weight: bold;
  transition: filter 0.1s;
}

.pq-true-btn {
  background: #1a3a1a;
  color: #c8e6c8;
  border-color: #2f5c2f;
}

.pq-true-btn:hover {
  filter: brightness(1.2);
  box-shadow: none;
  border-color: #4a8a4a;
}

.pq-false-btn {
  background: #3a0a0a;
  color: #f0c0c0;
  border-color: #7a1a1a;
}

.pq-false-btn:hover {
  filter: brightness(1.2);
  box-shadow: none;
  border-color: #b03030;
}

.pq-key-hint {
  font-size: 11px;
  opacity: 0.65;
  font-weight: normal;
  margin-left: 6px;
  letter-spacing: 0;
}

.pq-feedback-verdict {
  font-size: 20px;
  font-weight: bold;
  margin-bottom: 12px;
  letter-spacing: 0.04em;
}

.pq-correct {
  color: #2f6b2f;
}

.pq-incorrect {
  color: #8b1a1a;
}

.pq-correct-answer {
  font-size: 13px;
  color: #5a3a12;
  margin-bottom: 8px;
  font-style: italic;
}

.pq-flavor {
  font-size: 14px;
  color: #3a2410;
  line-height: 1.5;
  background: #f5ead4;
  border-left: 3px solid #c8a44a;
  padding: 8px 12px;
  margin-bottom: 20px;
  border-radius: 0 2px 2px 0;
}

.pq-continue-row {
  text-align: right;
}

.pq-continue-btn {
  background: #8b1a1a;
  color: #f5d87e;
  border: 1px solid #6b1010;
  border-radius: 3px;
  padding: 8px 20px;
  font-family: Georgia, serif;
  font-size: 14px;
  cursor: pointer;
  letter-spacing: 0.04em;
}

.pq-continue-btn:hover {
  background: #a82020;
  border-color: #8b1a1a;
  box-shadow: none;
}

.pq-result-header {
  font-size: 22px;
  font-weight: bold;
  color: #6b1010;
  margin-bottom: 8px;
  text-align: center;
  letter-spacing: 0.04em;
}

.pq-result-score {
  text-align: center;
  font-size: 28px;
  color: #c8a44a;
  font-weight: bold;
  margin-bottom: 16px;
}

.pq-result-body {
  font-size: 14px;
  color: #3a2410;
  line-height: 1.65;
  text-align: center;
  margin-bottom: 16px;
  font-style: italic;
}

.pq-result-prestige {
  text-align: center;
  font-size: 16px;
  font-weight: bold;
  color: #2f6b2f;
  margin-bottom: 20px;
  letter-spacing: 0.04em;
}

/* ── Wine Battle Minigame ────────────────────────────────────────────────── */
/* Retro Game Boy palette: #0f380f / #306230 / #8bac0f / #9bbc0f */

.wb-backdrop {
  position: fixed;
  inset: 0;
  background: url("assets/wine-battle-bg.png") center center / cover no-repeat;
  background-color: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
}

.wb-screen {
  background: #0f380f;
  color: #9bbc0f;
  font-family: 'Courier New', Courier, monospace;
  width: min(520px, 96vw);
  max-height: 92vh;
  border-radius: 4px;
  border: 3px solid #306230;
  box-shadow: 0 0 0 2px #8bac0f, 0 0 30px #0f380f;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.wb-header {
  background: #306230;
  padding: 6px 12px;
  text-align: center;
  border-bottom: 2px solid #8bac0f;
}

.wb-header-txt {
  color: #9bbc0f;
  font-size: 11px;
  letter-spacing: 0.12em;
  font-weight: bold;
}

.wb-body {
  padding: 14px 16px;
  overflow-y: auto;
  flex: 1;
}

/* ── Intro phase ─────────────────────────────────── */
.wb-intro-opp {
  font-size: 17px;
  font-weight: bold;
  color: #9bbc0f;
  text-align: center;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}

.wb-intro-wine {
  font-size: 12px;
  color: #8bac0f;
  text-align: center;
  margin-bottom: 10px;
}

.wb-intro-desc {
  font-size: 12px;
  color: #8bac0f;
  text-align: center;
  line-height: 1.55;
  margin-bottom: 16px;
  font-style: italic;
}

.wb-vs-row {
  display: flex;
  align-items: center;
  justify-content: space-around;
  margin-bottom: 18px;
  gap: 8px;
}

.wb-vs-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.wb-vs-text {
  font-size: 20px;
  font-weight: bold;
  color: #8bac0f;
  flex-shrink: 0;
}

.wb-vs-name {
  font-size: 11px;
  font-weight: bold;
  color: #9bbc0f;
  text-align: center;
  letter-spacing: 0.03em;
}

.wb-vs-sub {
  font-size: 10px;
  color: #8bac0f;
  text-align: center;
}

/* ── Battle field ────────────────────────────────── */
.wb-field {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
  min-height: 100px;
}

.wb-combatant {
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: opacity 0.3s;
}

.wb-combatant.opp-side { align-items: flex-start; }
.wb-combatant.player-side { align-items: flex-end; text-align: right; }

.wb-combatant.wb-fainted { opacity: 0.35; }

.wb-sprite {
  font-size: 36px;
  line-height: 1;
  display: block;
  image-rendering: pixelated;
}

.opp-side .wb-sprite { font-size: 32px; margin-left: 8px; }
.player-side .wb-sprite { font-size: 40px; margin-right: 8px; }

.wb-name-plate {
  font-size: 11px;
  font-weight: bold;
  color: #9bbc0f;
  letter-spacing: 0.02em;
  line-height: 1.35;
}

.wb-sub {
  color: #8bac0f;
  font-size: 10px;
  font-weight: normal;
}

/* ── HP bars ─────────────────────────────────────── */
.wb-hp-row {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
}

.wb-hp-row.opp    { flex-direction: row; }
.wb-hp-row.player { flex-direction: row-reverse; }

.wb-hp-label {
  font-size: 9px;
  font-weight: bold;
  color: #8bac0f;
  letter-spacing: 0.08em;
  flex-shrink: 0;
}

.wb-hp-track {
  flex: 1;
  height: 7px;
  background: #0f380f;
  border: 1px solid #306230;
  border-radius: 2px;
  overflow: hidden;
}

.wb-hp-fill {
  height: 100%;
  transition: width 0.4s ease;
  border-radius: 1px;
}

.wb-hp-ok   { background: #9bbc0f; }
.wb-hp-warn { background: #e8b800; }
.wb-hp-crit { background: #d94f00; }

.wb-hp-num {
  font-size: 10px;
  color: #8bac0f;
  flex-shrink: 0;
  min-width: 40px;
}
.wb-hp-row.player .wb-hp-num { text-align: right; }

/* ── Text box ────────────────────────────────────── */
.wb-textbox {
  background: #1a4a1a;
  border: 2px solid #306230;
  border-radius: 2px;
  padding: 10px 12px;
  font-size: 12px;
  color: #9bbc0f;
  line-height: 1.6;
  margin-bottom: 10px;
}

.wb-textbox p {
  margin: 0 0 4px 0;
}

.wb-textbox p:last-child { margin-bottom: 0; }

.wb-super  { display: block; color: #e8b800; font-weight: bold; font-size: 12px; }
.wb-resist { display: block; color: #8bac0f; font-style: italic; font-size: 11px; }
.wb-vintage-boost { display: block; color: #7de89a; font-size: 11px; }
.wb-vintage-drag  { display: block; color: #d4a85a; font-style: italic; font-size: 11px; }
.wb-vs-vintage { font-size: 10px; color: #e8b800; letter-spacing: 0.02em; }
.wb-matchup-row { display: flex; flex-direction: column; gap: 2px; align-items: center; margin-top: 4px; }
.wb-weak-tag    { font-size: 9px; color: #d94f00; letter-spacing: 0.04em; }
.wb-resist-tag  { font-size: 9px; color: #7de89a; letter-spacing: 0.04em; }

.wb-divider { color: #306230; text-align: center; }

.wb-faint-msg {
  color: #e8b800;
  font-weight: bold;
  margin-top: 4px !important;
}

/* ── Move grid ───────────────────────────────────── */
.wb-move-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.wb-move-btn {
  background: #1a4a1a;
  border: 2px solid #306230;
  border-radius: 2px;
  padding: 8px 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-align: left;
  font-family: inherit;
  color: #9bbc0f;
  transition: background 0.1s, border-color 0.1s;
}

.wb-move-btn:hover {
  background: #255025;
  border-color: #9bbc0f;
}

.wb-move-name {
  font-size: 12px;
  font-weight: bold;
  letter-spacing: 0.02em;
}

.wb-move-type {
  font-size: 9px;
  font-weight: bold;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 1px 5px;
  border-radius: 2px;
  align-self: flex-start;
}

.wb-type-tannin  { background: #5a2d0c; color: #e8b800; }
.wb-type-acid    { background: #1a4a35; color: #7de89a; }
.wb-type-floral  { background: #3d1a4a; color: #e89bbc; }
.wb-type-fruit   { background: #4a1a1a; color: #e87a5a; }
.wb-type-earth   { background: #2d2d0c; color: #c8c87a; }
.wb-type-oak     { background: #3d2d10; color: #d4a85a; }

/* ── Continue button ─────────────────────────────── */
.wb-continue-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.wb-btn-primary {
  background: #306230;
  border: 2px solid #9bbc0f;
  border-radius: 2px;
  color: #9bbc0f;
  font-family: inherit;
  font-size: 13px;
  font-weight: bold;
  padding: 8px 18px;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: background 0.15s;
}

.wb-btn-primary:hover {
  background: #4a8a4a;
}

/* ── Result phase ────────────────────────────────── */
.wb-result-medal {
  font-size: 52px;
  text-align: center;
  margin-bottom: 8px;
  line-height: 1;
}

.wb-result-title {
  font-size: 18px;
  font-weight: bold;
  text-align: center;
  color: #9bbc0f;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.wb-result-body {
  font-size: 12px;
  color: #8bac0f;
  text-align: center;
  line-height: 1.6;
  font-style: italic;
  margin-bottom: 14px;
}

.wb-result-gains {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 14px;
}

.wb-gain {
  font-size: 13px;
  font-weight: bold;
  color: #e8b800;
  letter-spacing: 0.03em;
}
