:root {
  --ink: #0b1018;
  --panel: #121a26;
  --panel-2: #182233;
  --line: rgba(184, 210, 233, 0.18);
  --muted: #8c9bae;
  --text: #edf5f3;
  --mint: #72f3c5;
  --lime: #d7f779;
  --coral: #ff6b59;
  --gold: #ffcc66;
  --blue: #83b9ff;
  --mono: "DM Mono", "SFMono-Regular", Consolas, monospace;
  --display: "Space Grotesk", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { background: #080d14; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 75% -10%, rgba(95, 115, 255, .18), transparent 31rem),
    radial-gradient(circle at 0% 40%, rgba(66, 212, 178, .10), transparent 28rem),
    linear-gradient(160deg, #0f1722 0%, #090f18 48%, #070b12 100%);
  font-family: var(--display);
}

body::before {
  position: fixed;
  z-index: 0;
  inset: 0;
  pointer-events: none;
  opacity: .32;
  content: "";
  background-image: linear-gradient(rgba(132, 178, 202, .045) 1px, transparent 1px), linear-gradient(90deg, rgba(132, 178, 202, .045) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, black, transparent 92%);
}

button {
  color: inherit;
  font: inherit;
  cursor: pointer;
}

button:focus-visible, a:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 3px;
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1500px, calc(100% - 48px));
  margin: auto;
  padding: 24px 0 30px;
}

.topbar, .week-row, .zone-header, .meter-heading, .command-deck, footer, .topbar-actions, .command-actions, .briefing, .signal-meta, .operations-action, .action-row {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-bottom: 21px;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: .14em;
  text-decoration: none;
}

.wordmark-mark {
  display: inline-flex;
  align-items: end;
  gap: 3px;
  width: 24px;
  height: 19px;
  padding-bottom: 2px;
  border-bottom: 2px solid var(--mint);
}

.wordmark-mark i { width: 5px; background: var(--mint); box-shadow: 0 0 12px var(--mint); }
.wordmark-mark i:nth-child(1) { height: 8px; } .wordmark-mark i:nth-child(2) { height: 15px; } .wordmark-mark i:nth-child(3) { height: 11px; }

.topbar-actions { gap: 9px; }

.sound-button, .reset-button {
  border: 1px solid var(--line);
  padding: 9px 11px;
  background: rgba(17, 28, 42, .52);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .08em;
}
.sound-button:hover, .reset-button:hover { border-color: rgba(114, 243, 197, .65); color: var(--mint); }
.sound-button[aria-pressed="true"] { color: var(--mint); border-color: rgba(114, 243, 197, .6); }

.intro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 53px 0 42px;
}

.eyebrow, .label, .zone-index, .meter-heading span, footer, .status-pill, .plan-indicator, .signal-meta span, .ledger span {
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .1em;
  line-height: 1.4;
}

h1, h2, p { margin-top: 0; }
h1, h2 { letter-spacing: -.055em; }

h1 {
  max-width: 680px;
  margin: 6px 0 14px;
  font-size: clamp(42px, 6.4vw, 90px);
  font-weight: 600;
  line-height: .91;
}
h1 em { color: var(--mint); font-style: normal; text-shadow: 0 0 36px rgba(114, 243, 197, .17); }

.lede { max-width: 555px; margin: 0; color: #b7c4cf; font-size: 16px; line-height: 1.55; }

.briefing {
  width: min(320px, 30%);
  gap: 12px;
  border-left: 1px solid var(--mint);
  padding: 5px 0 5px 16px;
}
.briefing strong { display: block; margin-top: 4px; font-size: 13px; font-weight: 500; line-height: 1.35; }
.pulse-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 0 rgba(114, 243, 197, .6); animation: pulse 2.3s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(114, 243, 197, 0); } 100% { box-shadow: 0 0 0 0 rgba(114, 243, 197, 0); } }

.scoreboard {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line);
  background: rgba(16, 26, 39, .62);
  box-shadow: 0 16px 50px rgba(0, 0, 0, .16);
}
.meter { min-width: 0; padding: 17px 19px 15px; border-right: 1px solid var(--line); }
.meter:last-child { border: 0; }
.meter-heading { justify-content: space-between; gap: 8px; }
.meter-heading strong { color: var(--text); font-family: var(--mono); font-size: 13px; font-weight: 500; }
.meter-track { height: 4px; margin: 14px 0 8px; overflow: hidden; background: rgba(232, 247, 241, .1); }
.meter-track i { display: block; width: 50%; height: 100%; transition: width .65s cubic-bezier(.2,.8,.2,1); }
.meter-track .cash { background: var(--gold); box-shadow: 0 0 13px rgba(255, 204, 102, .65); }
.meter-track .trust { background: var(--mint); box-shadow: 0 0 13px rgba(114, 243, 197, .65); }
.meter-track .crew { background: var(--lime); box-shadow: 0 0 13px rgba(215, 247, 121, .65); }
.meter-track .eco { background: var(--blue); box-shadow: 0 0 13px rgba(131, 185, 255, .65); }
.meter small { display: block; overflow: hidden; color: #76879a; font-family: var(--mono); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }

.week-row {
  justify-content: space-between;
  padding: 19px 1px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .08em;
}
.week-row p { margin: 0; }
.week-row strong { color: var(--text); font-size: 13px; }
.slash { padding: 0 4px; color: #526276; }
.status-copy { color: #b6c2ce; letter-spacing: .04em; }

.city-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: auto auto;
  border-left: 1px solid var(--line);
}

.zone {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(16, 26, 39, .58);
}
.farm-zone, .kitchen-zone, .neighborhood-zone { min-height: 374px; }
.farm-zone { grid-column: span 1; }
.kitchen-zone { grid-column: span 1; }
.neighborhood-zone { grid-column: span 1; }
.ops-zone { grid-column: span 1; }
.zone-header { position: relative; z-index: 2; justify-content: space-between; padding: 17px 18px 0; }
.zone-header > div { display: flex; align-items: baseline; gap: 8px; }
.zone-index { color: var(--mint); }
.zone h2 { margin: 0; color: #dce7e7; font-size: 14px; font-weight: 600; }
.status-pill { border: 1px solid rgba(114, 243, 197, .3); padding: 4px 6px; color: var(--mint); font-size: 8px; }
.status-pill.hot { border-color: rgba(255, 107, 89, .42); color: var(--coral); }
.status-pill.blue { border-color: rgba(131, 185, 255, .42); color: var(--blue); }

.scene { position: relative; height: 208px; margin-top: 9px; overflow: hidden; border-top: 1px solid rgba(230, 247, 247, .06); border-bottom: 1px solid rgba(230, 247, 247, .08); }
.zone-copy { min-height: 39px; margin: 13px 18px 9px; color: #a5b7c4; font-size: 12px; line-height: 1.45; }
.action-row { gap: 5px; padding: 0 13px 14px; }
.choice {
  display: grid;
  flex: 1;
  gap: 3px;
  min-width: 0;
  border: 1px solid transparent;
  padding: 8px 6px;
  background: transparent;
  text-align: left;
  transition: background .18s, border-color .18s, transform .18s;
}
.choice span { color: #64798c; font-family: var(--mono); font-size: 8px; }
.choice b { overflow: hidden; color: #d5e4e2; font-size: 11px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.choice small { overflow: hidden; color: #7e91a2; font-family: var(--mono); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.choice:hover { background: rgba(114, 243, 197, .06); }
.choice.selected { border-color: rgba(114, 243, 197, .55); background: rgba(114, 243, 197, .10); }
.choice.selected b { color: var(--mint); }
.choice:active { transform: translateY(1px); }

.farm-scene {
  background: linear-gradient(180deg, #111b34 0%, #182947 50%, #111b22 50%, #0d1820 100%);
}
.moon { position: absolute; top: 18px; right: 30px; width: 38px; height: 38px; border-radius: 50%; background: #e1f9ff; box-shadow: 0 0 32px rgba(177, 234, 255, .65); }
.skyline { position: absolute; bottom: 96px; left: -3%; width: 106%; height: 42px; opacity: .75; background: linear-gradient(90deg, #1a2944 7%, transparent 7% 9%, #1c2a42 9% 20%, transparent 20% 24%, #1a2944 24% 42%, transparent 42% 46%, #1c2a42 46% 68%, transparent 68% 72%, #1a2944 72%); clip-path: polygon(0 46%, 5% 46%, 5% 8%, 15% 8%, 15% 63%, 25% 63%, 25% 22%, 36% 22%, 36% 54%, 45% 54%, 45% 0, 59% 0, 59% 42%, 70% 42%, 70% 15%, 85% 15%, 85% 58%, 100% 58%, 100% 100%, 0 100%); }
.skyline-b { bottom: 80px; height: 35px; opacity: .45; transform: scaleX(-1); }
.drone { position: absolute; top: 63px; left: 25%; width: 30px; height: 5px; border-radius: 5px; background: var(--mint); box-shadow: 0 0 10px var(--mint); animation: drone 8s ease-in-out infinite; }
.drone::before, .drone::after { position: absolute; top: -4px; width: 8px; height: 8px; border: 1px solid var(--mint); border-radius: 50%; content: ""; }
.drone::before { left: -6px; } .drone::after { right: -6px; }
@keyframes drone { 50% { transform: translateX(120px) translateY(-13px); opacity: .6; } }
.farm-bed { position: absolute; bottom: 14px; width: 63%; height: 64px; border: 1px solid rgba(114, 243, 197, .35); background: repeating-linear-gradient(90deg, rgba(114, 243, 197, .17) 0 1px, transparent 1px 20px), linear-gradient(160deg, #223e38, #13221f); transform: skewX(-27deg); }
.bed-one { left: -10%; } .bed-two { right: -44%; bottom: 38px; opacity: .7; }
.farm-bed i { position: relative; display: inline-block; top: 22px; width: 12px; height: 25px; margin-left: 13px; border-radius: 100% 0; background: #79d99b; box-shadow: 0 0 12px rgba(121, 217, 155, .6); transform: rotate(20deg); }
.water-line { position: absolute; bottom: 0; left: 0; width: 100%; height: 4px; background: var(--blue); box-shadow: 0 0 12px var(--blue); animation: water 2s linear infinite; }
@keyframes water { 50% { opacity: .35; } }

.kitchen-scene { background: radial-gradient(ellipse at 50% 95%, #653520 0%, #24202a 35%, #141c29 74%); }
.haze { position: absolute; width: 160%; height: 75%; top: -10px; left: -30%; opacity: .17; background: radial-gradient(ellipse, white 0%, transparent 60%); filter: blur(18px); animation: haze 7s ease-in-out infinite alternate; }
@keyframes haze { to { transform: translateX(80px); } }
.lamp { position: absolute; top: 0; width: 1px; height: 64px; background: #8999a3; }
.lamp::after { position: absolute; bottom: 0; left: -18px; width: 37px; height: 15px; border-radius: 0 0 22px 22px; background: #f5b960; box-shadow: 0 14px 35px 18px rgba(250, 155, 57, .2); content: ""; }
.lamp-one { left: 29%; } .lamp-two { left: 74%; }
.steam { position: absolute; bottom: 80px; width: 21px; height: 65px; border-left: 2px solid rgba(211, 238, 236, .56); border-radius: 50%; filter: blur(.5px); animation: steam 3s ease-out infinite; }
.steam-one { left: 54%; } .steam-two { left: 60%; animation-delay: 1.3s; }
@keyframes steam { to { transform: translateY(-65px) translateX(13px) rotate(13deg); opacity: 0; } }
.counter { position: absolute; right: -4%; bottom: 48px; width: 94%; height: 43px; border-top: 4px solid #c38148; background: #2b2630; transform: skewX(-15deg); box-shadow: 0 14px 0 #1b1b24; }
.pan { position: absolute; bottom: 75px; left: 54%; width: 46px; height: 16px; border: 3px solid #b5b5ac; border-radius: 50%; background: #1b2025; transform: rotate(-6deg); }
.pan::after { position: absolute; top: 3px; right: -37px; width: 38px; height: 5px; border-radius: 4px; background: #abb7b4; content: ""; transform: rotate(-8deg); }
.flame { position: absolute; bottom: 54px; left: 60%; width: 20px; height: 24px; border-radius: 70% 20% 70% 20%; background: var(--coral); box-shadow: 0 0 24px var(--coral); transform: rotate(45deg); animation: flame .7s ease-in-out infinite alternate; }
@keyframes flame { to { transform: scale(.7) rotate(45deg); } }
.cook { position: absolute; bottom: 50px; width: 28px; height: 71px; border-radius: 15px 15px 4px 4px; background: #31414b; }
.cook::before { position: absolute; top: -22px; left: 4px; width: 20px; height: 20px; border: 4px solid #e6dfd1; border-radius: 50%; background: #bb7855; content: ""; }
.cook::after { position: absolute; top: -33px; left: -3px; width: 34px; height: 14px; border-radius: 50% 50% 3px 3px; background: #eef8f2; content: ""; }
.cook-one { left: 15%; } .cook-two { left: 36%; transform: scale(.78); }

.block-scene { background: linear-gradient(180deg, #111a2a, #1a1a29 63%, #10151e 63%); }
.block-scene::before { position: absolute; bottom: 63px; left: 7%; width: 78%; height: 85px; background: #202737; box-shadow: 62px 10px 0 #1c2330; content: ""; clip-path: polygon(0 0, 46% 0, 46% 22%, 100% 22%, 100% 100%, 0 100%); }
.sign { position: absolute; z-index: 1; border: 1px solid; padding: 5px 7px; color: var(--coral); font-family: var(--mono); font-size: 10px; box-shadow: 0 0 13px currentColor; }
.sign-one { top: 48px; left: 16%; transform: rotate(-3deg); } .sign-two { top: 78px; right: 14%; color: var(--mint); }
.window { position: absolute; z-index: 1; top: 100px; width: 15px; height: 21px; background: #f4c36d; box-shadow: 0 0 12px rgba(244, 195, 109, .6); }
.window-one { left: 20%; } .window-two { left: 29%; } .window-three { left: 61%; background: #74d7e9; }
.pavement { position: absolute; bottom: 0; left: 0; width: 100%; height: 65px; background: linear-gradient(170deg, #303342 0 42%, #181e2a 43%); }
.person { position: absolute; z-index: 2; bottom: 37px; width: 11px; height: 30px; border-radius: 8px 8px 3px 3px; background: #bd7666; }
.person::before { position: absolute; top: -10px; left: 1px; width: 9px; height: 9px; border-radius: 50%; background: #dca178; content: ""; }
.person-one { left: 25%; } .person-two { left: 40%; background: #6b91bc; transform: scale(.75); } .person-three { left: 71%; background: #a57abe; transform: scale(.9); }
.bike { position: absolute; z-index: 2; bottom: 25px; right: 17%; width: 30px; height: 15px; border-bottom: 2px solid var(--mint); border-radius: 50%; transform: skewX(-24deg); }
.bike::before, .bike::after { position: absolute; bottom: -9px; width: 12px; height: 12px; border: 2px solid var(--mint); border-radius: 50%; content: ""; }
.bike::before { left: 0; }.bike::after { right: 0; }

.ops-zone { min-height: 374px; background: linear-gradient(150deg, rgba(22, 35, 52, .95), rgba(12, 20, 31, .88)); }
.ops-body { padding: 27px 18px 20px; }
.signal-panel { border-left: 1px solid rgba(131, 185, 255, .58); padding-left: 12px; }
.signal-meta { justify-content: space-between; }
.signal-meta b { color: var(--blue); font-family: var(--mono); font-size: 15px; font-weight: 500; }
#demandChart { display: block; width: 100%; height: 88px; margin-top: 9px; overflow: visible; }
.chart-grid { fill: none; stroke: rgba(195, 217, 239, .10); stroke-width: 1; }
#chartLine { fill: none; stroke: url(#chartStroke); stroke-width: 2.5; stroke-linecap: square; stroke-linejoin: miter; transition: points .6s ease; }
.ledger { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; padding-top: 18px; }
.ledger p { display: flex; justify-content: space-between; gap: 9px; margin: 0; padding-bottom: 8px; border-bottom: 1px solid rgba(195, 217, 239, .09); }
.ledger b { color: #c9d6dc; font-family: var(--mono); font-size: 10px; font-weight: 400; white-space: nowrap; }
.operations-action { align-items: stretch; gap: 13px; margin: 0 13px 13px; border: 1px solid rgba(131, 185, 255, .22); padding: 11px; background: rgba(131, 185, 255, .04); }
.operations-action > div:first-child { flex: 1; min-width: 0; }
.operations-action strong { display: block; margin-top: 3px; color: #dfebfa; font-size: 11px; font-weight: 500; line-height: 1.3; }
.operations-action p { display: -webkit-box; overflow: hidden; margin: 5px 0 0; color: #8394a8; font-size: 10px; line-height: 1.3; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.event-choices { display: grid; align-content: center; gap: 5px; width: 91px; }
.event-choice { border: 1px solid rgba(131, 185, 255, .20); padding: 6px; background: transparent; color: #7f92a6; font-family: var(--mono); font-size: 8px; }
.event-choice:hover, .event-choice.active { border-color: var(--blue); color: var(--blue); background: rgba(131, 185, 255, .09); }

.command-deck {
  justify-content: space-between;
  gap: 28px;
  padding: 28px 2px 25px;
  border-bottom: 1px solid var(--line);
}
.command-deck h2 { margin: 4px 0 5px; font-size: clamp(24px, 3vw, 38px); font-weight: 600; }
.command-deck p:not(.eyebrow) { margin: 0; color: var(--muted); font-size: 12px; }
.command-actions { gap: 15px; }
.plan-indicator { color: var(--mint); }
.advance-button {
  display: inline-flex;
  align-items: center;
  gap: 29px;
  border: 1px solid var(--mint);
  padding: 15px 15px 15px 17px;
  background: var(--mint);
  color: #092219;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .06em;
  transition: transform .18s, box-shadow .18s;
}
.advance-button b { font-size: 19px; line-height: 10px; }
.advance-button:hover { box-shadow: 0 0 30px rgba(114, 243, 197, .32); transform: translateY(-2px); }
.advance-button:active { transform: translateY(0); }

footer { justify-content: space-between; gap: 12px; padding: 18px 0 0; color: #667789; font-size: 9px; }
footer p { margin: 0; }
kbd { border: 1px solid #48576a; border-radius: 2px; padding: 1px 3px; color: #aabac7; font: inherit; }

.toast {
  position: fixed;
  z-index: 10;
  right: 24px;
  bottom: 24px;
  max-width: 310px;
  transform: translateY(14px);
  border-left: 2px solid var(--mint);
  padding: 11px 14px;
  opacity: 0;
  background: #13251f;
  box-shadow: 0 14px 35px rgba(0, 0, 0, .35);
  color: #d8f5e9;
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.5;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.toast.show { transform: translateY(0); opacity: 1; }

.end-screen {
  position: fixed;
  z-index: 9;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  visibility: hidden;
  opacity: 0;
  background: rgba(4, 8, 13, .82);
  backdrop-filter: blur(8px);
  transition: opacity .3s, visibility .3s;
}
.end-screen.open { visibility: visible; opacity: 1; }
.end-card { width: min(590px, 100%); border: 1px solid rgba(114, 243, 197, .45); padding: clamp(26px, 5vw, 48px); background: linear-gradient(145deg, #15262b, #0b141d); box-shadow: 0 0 60px rgba(114, 243, 197, .13); }
.end-card h2 { margin: 7px 0 12px; color: var(--mint); font-size: clamp(35px, 6vw, 62px); font-weight: 600; line-height: .9; }
.end-card > p:not(.eyebrow) { max-width: 470px; color: #b7c5ce; font-size: 14px; line-height: 1.55; }
.final-score { display: flex; align-items: baseline; gap: 15px; margin: 27px 0 17px; }
.final-score span { color: var(--muted); font-family: var(--mono); font-size: 10px; letter-spacing: .1em; }
.final-score strong { color: var(--gold); font-family: var(--mono); font-size: 38px; font-weight: 400; }
.final-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin-bottom: 26px; background: rgba(255,255,255,.1); }
.final-stats div { padding: 10px; background: #122029; }
.final-stats span, .final-stats b { display: block; font-family: var(--mono); }
.final-stats span { color: #8291a1; font-size: 8px; letter-spacing: .06em; }
.final-stats b { margin-top: 5px; color: #e6f0ef; font-size: 12px; font-weight: 400; }

@media (max-width: 1050px) {
  .city-grid { grid-template-columns: repeat(2, 1fr); }
  .ops-zone { grid-column: span 1; }
}
@media (max-width: 720px) {
  .shell { width: min(100% - 26px, 600px); padding-top: 14px; }
  .intro { align-items: start; flex-direction: column; padding: 34px 0 30px; }
  .briefing { width: auto; }
  .scoreboard { grid-template-columns: repeat(2, 1fr); }
  .meter:nth-child(2) { border-right: 0; } .meter:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .week-row { flex-wrap: wrap; gap: 12px; } .status-copy { order: 3; width: 100%; }
  .city-grid { grid-template-columns: 1fr; }
  .farm-zone, .kitchen-zone, .neighborhood-zone, .ops-zone { grid-column: span 1; }
  .topbar-actions .sound-button { display: none; }
  .command-deck { align-items: start; flex-direction: column; gap: 18px; }
  .command-actions { width: 100%; justify-content: space-between; }
  footer { align-items: start; flex-direction: column; }
}
@media (max-width: 410px) {
  .wordmark { font-size: 11px; }
  .reset-button { font-size: 9px; }
  .meter { padding: 13px 11px; }
  .meter-heading span { font-size: 8px; }
  .meter small { font-size: 8px; }
  .event-choices { width: 77px; }
  .operations-action { gap: 8px; padding: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
