:root {
  --ink: #1b140c;
  --panel: #2c2218;
  --wood: #6b3f24;
  --plank: #8a5530;
  --rust: #c45c26;
  --olive: #6a7d3a;
  --cream: #f3e2b3;
  --amber: #e8b84a;
  --sky: #3d5a6c;
  --hp: #c0392b;
  --en: #3d9be9;
  --hap: #e8b84a;
  --ok: #6aa84f;
  --bad: #c44536;
  --glow: #4cc3ff;
  --shop-y: #ffcc00;
  --shop-k: #111111;
}

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

html, body {
  height: 100%;
  background: #0d0a07;
  color: var(--cream);
  font-family: "VT323", monospace;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

button {
  font-family: "Press Start 2P", monospace;
  cursor: pointer;
  border: none;
  image-rendering: pixelated;
}

.hidden, [hidden] { display: none !important; }

#device {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 12px;
}

#bezel {
  width: min(420px, 100vw);
  height: min(860px, 100dvh);
  background: linear-gradient(#3a2a1c, #24180f);
  border: 6px solid #120d08;
  border-radius: 28px;
  box-shadow: 0 0 0 4px #5a3d24, 0 18px 0 #0a0704;
  padding: 18px 16px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#brand {
  font-family: "Press Start 2P", monospace;
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--amber);
  text-align: center;
}
#brand span { color: var(--glow); }

#screen {
  position: relative;
  flex: 1;
  background: var(--ink);
  border: 4px solid #0a0704;
  box-shadow: inset 0 0 0 3px #4a3724;
  overflow: hidden;
  image-rendering: pixelated;
}
#crt {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 50;
  background: repeating-linear-gradient(
    to bottom,
    rgb(0 0 0 / 0.08) 0 2px,
    transparent 2px 4px
  );
  mix-blend-mode: multiply;
}

#speaker {
  height: 18px;
  margin: 0 40px;
  background: repeating-linear-gradient(#1a120c 0 3px, #3a2a1c 3px 6px);
  border-radius: 8px;
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
}
.screen.active { display: flex; }

.overlay {
  position: absolute;
  inset: 0;
  z-index: 60;
  background: rgb(10 6 3 / 0.72);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 10px;
}

/* TITLE */
#screen-title {
  background: #1a1418;
}
.title-art-wrap {
  position: absolute;
  inset: 0;
}
.title-art {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 58% 22%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
#screen-title h1 {
  position: absolute;
  z-index: 3;
  top: 5%;
  left: 0;
  right: 0;
  font-family: "Press Start 2P", monospace;
  font-size: 26px;
  line-height: 1.28;
  color: var(--rust);
  text-align: center;
  pointer-events: none;
  text-shadow:
    3px 3px 0 #1b140c,
    -2px 0 0 #1b140c,
    2px 0 0 #1b140c,
    0 -2px 0 #1b140c,
    0 2px 0 #1b140c,
    4px 5px 0 #3a1608;
}
.title-card {
  position: relative;
  z-index: 2;
  margin-top: auto;
  padding: 40px 16px 18px;
  background: linear-gradient(
    to bottom,
    rgb(27 20 12 / 0) 0%,
    rgb(27 20 12 / 0.78) 36%,
    rgb(27 20 12 / 0.94) 58%
  );
  text-align: center;
}
.title-sub {
  margin: 0 0 16px;
  font-size: 20px;
  color: var(--cream);
}
.title-actions { display: grid; gap: 8px; }
.title-hint { margin-top: 14px; font-size: 16px; color: var(--amber); }
.blink { animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* HUD */
.hud {
  background: #120d08;
  border-bottom: 3px solid #4a3724;
  padding: 8px 8px 6px;
}
.hud-meters { display: grid; gap: 5px; }
.meter { display: grid; grid-template-columns: 18px 36px 1fr 22px; align-items: center; gap: 6px; }
.meter-icon { display: grid; place-items: center; }
.meter-name {
  font-family: "Press Start 2P", monospace;
  font-size: 6px;
  letter-spacing: 0.5px;
}
.meter[data-stat="health"] .meter-name { color: var(--hp); }
.meter[data-stat="energy"] .meter-name { color: #7ec8ff; }
.meter[data-stat="happiness"] .meter-name { color: var(--hap); }
.meter[data-stat="energy"].low .meter-track { box-shadow: 0 0 0 1px #3d9be9; }
.meter-track {
  height: 10px;
  background: #2a1b10;
  border: 2px solid #f3e2b3;
  image-rendering: pixelated;
}
.meter-fill { height: 100%; width: 80%; transition: width 180ms linear; }
.meter-fill.health { background: var(--hp); }
.meter-fill.energy { background: linear-gradient(90deg, #1a5fa8, var(--en)); }
.meter-fill.happiness { background: linear-gradient(90deg, #c7922a, var(--hap)); }
.meter-val { font-family: "Press Start 2P", monospace; font-size: 8px; }
.hud-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  font-family: "Press Start 2P", monospace;
  font-size: 7px;
  gap: 6px;
  color: var(--amber);
}
.ico {
  width: 14px;
  height: 14px;
  display: block;
  image-rendering: pixelated;
}
.wallet {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--hap);
}
.shop-wallet {
  display: flex;
  align-items: center;
  gap: 8px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.chip-ico { display: inline-flex; }
.chip-ico .ico { width: 12px; height: 12px; }
.chip.energy { border-color: var(--en); color: #9fd4ff; }
.chip.happiness { border-color: var(--hap); color: #f3e2b3; }
.chip.health { border-color: var(--hp); color: #f5c4be; }
.chip.bolts { border-color: var(--hap); color: #f3e2b3; }
#btn-endday.must-sleep {
  border-color: var(--en);
  color: #9fd4ff;
  box-shadow:
    0 0 0 2px #1a5fa8,
    0 0 0 4px var(--en),
    3px 3px 0 #0a1a28;
  animation: sleep-nudge 1.1s steps(2) infinite;
}
@keyframes sleep-nudge {
  50% {
    border-color: #9fd4ff;
    box-shadow:
      0 0 0 2px var(--en),
      0 0 0 5px #7ec8ff,
      3px 3px 0 #0a1a28;
  }
}
#btn-endday.must-sleep:active {
  box-shadow:
    0 0 0 2px #1a5fa8,
    0 0 0 3px var(--en),
    1px 1px 0 #0a1a28;
}
.fade-overlay {
  z-index: 90;
  background: #000;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.7s ease;
}
.fade-overlay.in { opacity: 1; }
#sleep-line {
  font-family: "Press Start 2P", monospace;
  font-size: 10px;
  color: var(--hap);
  text-align: center;
  line-height: 1.6;
  white-space: pre-line;
  padding: 16px;
}

/* GARAGE — top-down floor plan */
#garage-viewport {
  flex: 1;
  overflow: hidden;
  position: relative;
  background: #3a3a3e;
}
#garage-world {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: minmax(72px, 26%) minmax(0, 1fr) minmax(72px, 26%);
  grid-template-rows: minmax(76px, 24%) minmax(0, 1fr) minmax(84px, 26%);
  padding: 6px;
  gap: 2px;
}
.garage-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  object-position: center;
  image-rendering: pixelated;
  pointer-events: none;
}

.prop {
  position: relative;
  width: 100%;
  min-width: 44px;
  min-height: 44px;
  background: rgb(27 20 12 / 0.22);
  border: 2px solid transparent;
  box-shadow: none;
  padding: 3px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 2px;
  z-index: 2;
  overflow: visible;
}
.prop.wall-n { grid-area: 1 / 1 / 2 / 4; min-height: 72px; justify-content: flex-start; }
.prop.wall-w { grid-area: 2 / 1 / 3 / 2; min-height: 88px; align-items: flex-start; }
.prop.wall-e { grid-area: 2 / 3 / 3 / 4; min-height: 88px; align-items: flex-end; }
.prop.wall-s { grid-area: 3 / 2 / 4 / 3; min-height: 72px; justify-content: flex-end; }
.prop:focus-visible {
  outline: 3px solid var(--glow);
  outline-offset: -3px;
}
.prop:active {
  transform: translate(1px, 1px);
}
.prop.event {
  background: rgb(232 184 74 / 0.12);
  border-color: rgb(232 184 74 / 0.7);
}
.prop-label {
  font-family: "Press Start 2P", monospace;
  font-size: 6px;
  background: #120d08;
  color: var(--cream);
  padding: 3px 4px;
  border: 2px solid var(--cream);
}
.prop.event .prop-label { border-color: var(--amber); color: var(--amber); }
.prop.upgraded .prop-label { background: #183126; border-color: var(--ok); color: #d7f3bf; }
.prop.upgraded.event .prop-label { border-color: var(--amber); color: var(--amber); }
.prop-art {
  position: relative;
  width: 104px;
  height: 60px;
  display: grid;
  place-items: end center;
  image-rendering: pixelated;
}
.wall-n .prop-art { width: min(220px, 86%); height: 56px; }
.wall-w .prop-art,
.wall-e .prop-art { width: 72px; height: 78px; }
.wall-s .prop-art { width: 88px; height: 58px; }
.prop-img {
  display: block;
  object-fit: contain;
  image-rendering: pixelated;
}
.computer-img {
  position: absolute;
  right: 5px;
  bottom: 9px;
  width: 64px;
  height: 64px;
  filter: drop-shadow(4px 4px 0 #1b140c);
}
.framework-img,
.mill-img,
.truck-normal,
.truck-job { display: none; }
.prop.upgraded .computer-img { display: none; }
.prop.upgraded .framework-img { display: block; }
.desk {
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: 0;
  height: 18px;
  background: #3d2918;
  border: 2px solid #1b140c;
  box-shadow: inset 0 4px 0 #8a5530;
}
.prop.fire .computer-fire,
.prop.glow .computer-glow { display: block; }
.computer-fire, .computer-glow {
  display: none;
  position: absolute;
  z-index: 2;
  inset: -4px 10px auto;
  height: 30px;
  pointer-events: none;
}
.prop.event:not(.fire):not(.glow) .computer-glow { display: block; }
.computer-fire {
  background: radial-gradient(circle at 40% 80%, #ffdd55, #c45c26 50%, transparent 70%);
  animation: flicker 0.2s infinite;
}
.computer-glow {
  background: radial-gradient(circle, var(--glow), transparent 70%);
  animation: pulse 1s ease-in-out infinite;
}
@keyframes flicker { 50% { opacity: 0.55; transform: scaleX(1.08); } }
@keyframes pulse { 50% { opacity: 0.45; } }

.bench-img {
  width: 70px;
  height: 54px;
  filter: drop-shadow(4px 4px 0 #1b140c);
}
.prop.upgraded .bench-img { display: none; }
.prop.upgraded .mill-img {
  display: block;
  width: 70px;
  height: 68px;
}
.station-fx, .event-badge {
  display: none;
  pointer-events: none;
}
.bench-sparks {
  position: absolute;
  inset: 4px 10px 20px;
  background:
    radial-gradient(circle at 20% 40%, #fff 0 2px, transparent 3px),
    radial-gradient(circle at 60% 10%, var(--amber) 0 3px, transparent 4px),
    radial-gradient(circle at 82% 58%, #fff 0 2px, transparent 3px);
  animation: flicker 0.35s steps(2) infinite;
}
.prop.event .bench-sparks,
.prop.event .car-smoke,
.prop.event .door-visitor,
.prop.event .door-knock,
.prop.event .event-badge {
  display: block;
}
.car-sprite { place-items: end center; }
.bay {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #1a1c20;
  border: 3px solid #1b140c;
  box-shadow: inset 0 8px 0 #2a3038;
}
.garage-door {
  position: absolute;
  inset: 0 0 18%;
  z-index: 3;
  background:
    repeating-linear-gradient(
      to bottom,
      #4a5560 0 7px,
      #2a3038 7px 9px
    );
  border-bottom: 3px solid #1b140c;
  transition: transform 160ms steps(2);
}
.prop.event .garage-door,
.prop.broken .garage-door {
  transform: translateY(-78%);
}
.prop.upgraded .garage-door {
  transform: translateY(-78%);
}
.car-img {
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 92px;
  height: 42px;
  margin-left: -46px;
  opacity: 0.2;
  filter: drop-shadow(0 4px 0 #1b140c);
}
.prop.event .car-img,
.prop.broken .car-img { opacity: 1; }
.prop.upgraded .car-img { opacity: 1; }
.car-damaged { display: none; }
.prop.broken .car-normal { display: none; }
.prop.broken .car-damaged { display: block; }
.prop.upgraded .car-normal,
.prop.upgraded .car-damaged { display: none; }
.prop.upgraded .truck-normal { display: block; }
.prop.upgraded.event .truck-normal { display: none; }
.prop.upgraded.event .truck-job { display: block; }
.prop.upgraded .car-img { filter: drop-shadow(0 4px 0 #1b140c); }

.door-sprite { place-items: end center; isolation: isolate; }
.people-door {
  position: relative;
  width: 44px;
  height: 50px;
  background: #8a5530;
  border: 3px solid #1b140c;
  box-shadow: inset 0 6px 0 #6b3f24, 4px 4px 0 #1b140c;
}
.door-window {
  position: absolute;
  left: 8px;
  top: 6px;
  width: 24px;
  height: 14px;
  background: #3d5a6c;
  border: 2px solid #1b140c;
}
.door-knob {
  position: absolute;
  right: 5px;
  top: 26px;
  width: 6px;
  height: 6px;
  background: #e8b84a;
}
.door-visitor {
  position: absolute;
  left: 14px;
  top: 6px;
  width: 12px;
  height: 16px;
  background:
    linear-gradient(#1b140c, #1b140c) 2px 0 / 8px 7px no-repeat,
    linear-gradient(#2c2218, #2c2218) 1px 7px / 10px 9px no-repeat;
  z-index: 2;
}
.door-knock {
  position: absolute;
  right: -10px;
  top: 8px;
  width: 14px;
  height: 16px;
  background:
    linear-gradient(#f3e2b3, #f3e2b3) 0 2px / 10px 2px no-repeat,
    linear-gradient(#f3e2b3, #f3e2b3) 3px 7px / 8px 2px no-repeat,
    linear-gradient(#f3e2b3, #f3e2b3) 6px 12px / 6px 2px no-repeat;
  animation: knock 0.55s steps(2) infinite;
}
@keyframes knock { 50% { transform: translate(2px, -2px); opacity: 0.5; } }
.prop.upgraded .people-door {
  width: 50px;
  height: 52px;
  background: #c45c26;
  border-color: #f3e2b3;
  box-shadow: inset 0 6px 0 #8a5530, 4px 4px 0 #1b140c, -15px 0 0 #f3e2b3, 15px 0 0 #f3e2b3;
}
.prop.upgraded .door-sprite::before {
  content: "";
  position: absolute;
  left: 5px;
  right: 5px;
  top: 0;
  height: 15px;
  background: #3d5a6c;
  border: 3px solid #1b140c;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
.prop.upgraded .door-sprite::after {
  content: "";
  position: absolute;
  left: 3px;
  right: 3px;
  bottom: 0;
  height: 42px;
  z-index: -1;
  background: repeating-linear-gradient(to bottom, #f3e2b3 0 6px, #d4bd8b 6px 8px);
  border: 3px solid #1b140c;
}
.car-smoke {
  position: absolute;
  right: 8px;
  top: 0;
  width: 24px;
  height: 28px;
  background:
    radial-gradient(circle at 30% 80%, #aaa 0 5px, transparent 6px),
    radial-gradient(circle at 70% 45%, #777 0 7px, transparent 8px),
    radial-gradient(circle at 40% 10%, #bbb 0 5px, transparent 6px);
  animation: smoke 1s steps(3) infinite;
}
@keyframes smoke { 50% { transform: translateY(-5px); opacity: 0.6; } }
.event-badge {
  position: absolute;
  z-index: 5;
  top: 5px;
  right: 6px;
  width: 24px;
  height: 24px;
  padding-top: 4px;
  background: var(--bad);
  color: #fff;
  border: 2px solid var(--cream);
  font: 12px/1 "Press Start 2P", monospace;
  animation: pulse 0.8s steps(2) infinite;
}

.garage-clutter {
  position: absolute;
  z-index: 1;
  width: 28px;
  height: 28px;
  object-fit: contain;
  image-rendering: pixelated;
  pointer-events: none;
  filter: sepia(0.18) drop-shadow(3px 3px 0 rgb(27 20 12 / 0.5));
}
.garage-clutter.drum {
  width: 22px;
  height: 34px;
  left: 32%;
  top: 40%;
}
.garage-clutter.puddle {
  width: 42px;
  height: 14px;
  left: 46%;
  top: 58%;
}

.garage-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 8px;
  background: #120d08;
}

/* BUTTONS */
.btn {
  min-height: 44px;
  padding: 8px 10px;
  background: var(--rust);
  color: var(--cream);
  border: 3px solid var(--cream);
  box-shadow: 3px 3px 0 #3a1608;
  font-size: 10px;
}
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 #3a1608; }
.btn-primary { background: var(--rust); }
.btn-ghost { background: #2c2218; font-size: 8px; }
.btn-dpad { background: #3d2918; font-size: 16px; }
.btn-tiny {
  min-height: 28px;
  font-size: 10px;
  margin-left: auto;
  display: block;
}
.icon-btn {
  background: transparent;
  color: var(--cream);
  min-width: 44px;
  min-height: 44px;
  font-size: 14px;
}
.icon-btn.light { color: #111; }

/* DIALOGUE */
.dialogue-box {
  width: 100%;
  background: #120d08;
  border: 3px solid var(--cream);
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 8px;
  padding: 8px;
}
#portrait {
  width: 64px;
  height: 64px;
  image-rendering: pixelated;
  background: #2c2218;
  border: 2px solid var(--amber);
}
.nameplate {
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  color: var(--amber);
  margin-bottom: 4px;
}
#dlg-text {
  font-size: 20px;
  line-height: 1.15;
  min-height: 48px;
}
.event-chips { margin-top: 6px; }
.choices { display: grid; gap: 6px; margin-top: 8px; }
.choices .btn { font-size: 8px; text-align: left; line-height: 1.4; }

/* MENUS */
.menu-panel, .shop-panel, .mini-frame, .ending-panel {
  width: 100%;
  max-height: 92%;
  overflow: auto;
  background: #120d08;
  border: 3px solid var(--cream);
  padding: 12px;
}
.menu-head, .shop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
h2, .ending-title {
  font-family: "Press Start 2P", monospace;
  font-size: 12px;
  line-height: 1.4;
  color: var(--amber);
}
#btn-shop.event {
  border-color: var(--amber);
  color: var(--amber);
}
.menu-hint, .shop-tag, .shop-note, .mini-help, .mini-status, .ending-blurb {
  font-size: 18px;
  margin-bottom: 8px;
}
.menu-list, .shop-list, .score-list {
  list-style: none;
  display: grid;
  gap: 6px;
}
.menu-list li, .shop-item {
  background: #2c2218;
  border: 2px solid var(--cream);
  padding: 8px;
  font-size: 18px;
}
.menu-list li button, .shop-item button {
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--cream);
  font-family: "VT323", monospace;
  font-size: 18px;
  min-height: 44px;
}
.menu-list .tag { color: var(--amber); font-family: "Press Start 2P", monospace; font-size: 7px; }
.menu-list .bad { border-color: var(--bad); }
.menu-list .good { border-color: var(--ok); }
.menu-list .done { opacity: 0.45; }

#overlay-dayend {
  align-items: stretch;
  padding: 8px;
}
.dayend-panel.menu-panel {
  flex: 1;
  max-height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.dayend-panel .menu-head {
  flex-shrink: 0;
}
.dayend-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 4px;
}
.dayend-section h3 {
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  letter-spacing: 1px;
  color: var(--amber);
  margin-bottom: 6px;
}
.dayend-section.done h3 { color: var(--ok); }
.dayend-section.missed h3 { color: var(--bad); }
.dayend-section .menu-list {
  margin: 0;
}
.dayend-empty {
  opacity: 0.55;
  font-style: italic;
}
.dayend-extras:empty { display: none; }
#overlay-dayend #btn-nextday {
  flex-shrink: 0;
  width: 100%;
  margin-top: 10px;
}

.overlay.blankout {
  z-index: 90;
  background: #0a0704;
  display: grid;
  place-items: center;
  padding: 20px;
  text-align: center;
}
.blankout .static {
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background: repeating-linear-gradient(#fff 0 1px, #000 1px 3px);
  animation: static 0.08s infinite;
}
@keyframes static { 50% { transform: translateY(3px); } }
#blankout-line {
  position: relative;
  font-size: 22px;
  animation: shake 0.12s infinite;
}
@keyframes shake { 50% { transform: translateX(3px); } }

/* SHOP */
#overlay-shop {
  align-items: stretch;
  padding: 6px;
}
#shop-panel.shop-panel {
  flex: 1;
  max-height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 8px 8px 10px;
  background: var(--shop-k);
  border-color: var(--shop-y);
  color: var(--shop-y);
}
.shop-head {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.amazong-logo {
  font-family: "Press Start 2P", monospace;
  font-size: 12px;
  transform: rotate(-4deg);
  color: var(--shop-y);
}
.amazong-logo .arrow { color: #48f; }
.shop-prime {
  flex-shrink: 0;
  height: 4px;
  margin: 2px 0 6px;
  background: repeating-linear-gradient(
    90deg,
    var(--shop-y) 0 10px,
    #111 10px 14px,
    #48f 14px 18px,
    #111 18px 22px
  );
}
.shop-tag, .shop-note { flex-shrink: 0; }
.shop-tag { font-size: 16px; margin-bottom: 4px; }
.shop-note { font-size: 15px; margin-bottom: 6px; opacity: 0.85; }
.btn-shop-close {
  background: var(--shop-y);
  color: #111;
  border-color: #111;
  min-height: 36px;
  font-size: 8px;
  box-shadow: 3px 3px 0 #664;
}
#btn-shop-back { width: 100%; margin-top: 8px; flex-shrink: 0; }
.btn-shop-tolist { width: auto; min-height: 32px; margin-bottom: 6px; align-self: flex-start; }
.shop-wallet {
  flex-shrink: 0;
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  margin: 4px 0 6px;
}
.shop-browse, .shop-detail {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.shop-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  gap: 0;
  border-top: 2px solid var(--shop-y);
}
.shop-item {
  background: transparent;
  border: 0;
  border-bottom: 1px solid #2a2a2a;
  padding: 0;
  color: #f3e2b3;
}
.shop-item button {
  width: 100%;
  min-height: 40px;
  text-align: left;
  background: transparent;
  color: #f3e2b3;
  font-family: "VT323", monospace;
  font-size: 17px;
  padding: 4px 2px;
  box-shadow: none;
  border: 0;
}
.shop-item-main {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}
.shop-item-copy { min-width: 0; }
.shop-item-name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.1;
}
.shop-item-icon-wrap {
  position: relative;
  width: 32px;
  height: 32px;
}
.shop-item-icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
  image-rendering: pixelated;
  background: transparent;
  border: 0;
  padding: 0;
}
.shop-item .price {
  font-family: "Press Start 2P", monospace;
  font-size: 7px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--shop-y);
  margin-top: 2px;
}
.shop-item.cant-afford { color: #7a7a7a; }
.shop-item.cant-afford button { color: #8a8a8a; }
.shop-item.cant-afford .shop-item-name { color: #8a8a8a; }
.shop-item.cant-afford .price { color: #6a6a6a; }
.shop-item.cant-afford .shop-item-icon {
  filter: grayscale(1) brightness(0.55);
}
.shop-item.cant-afford .shop-item-icon-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgb(17 17 17 / 0.35);
}
.shop-empty {
  padding: 12px 4px;
  font-size: 18px;
  color: #888;
  border: 0;
  background: transparent;
}
.shop-detail-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.shop-detail-icon {
  display: block;
  width: 56px;
  height: 56px;
  object-fit: contain;
  image-rendering: pixelated;
  margin: 0 auto 6px;
  border: 0;
  background: transparent;
}
.shop-detail-name {
  font-family: "Press Start 2P", monospace;
  font-size: 9px;
  line-height: 1.35;
  color: var(--shop-y);
  margin-bottom: 4px;
}
.shop-detail-kind {
  font-family: "Press Start 2P", monospace;
  font-size: 7px;
  color: #48f;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.shop-detail-blurb {
  font-size: 17px;
  color: #f3e2b3;
  margin-bottom: 4px;
}
.shop-detail-review {
  font-size: 15px;
  color: #c4b48a;
  margin-bottom: 8px;
}
.shop-perks-lbl {
  font-family: "Press Start 2P", monospace;
  font-size: 7px;
  color: var(--shop-y);
  margin-bottom: 4px;
}
.shop-perks ul {
  list-style: none;
  display: grid;
  gap: 3px;
}
.shop-perks li {
  font-size: 16px;
  color: #f3e2b3;
  padding: 2px 0 2px 10px;
  position: relative;
}
.shop-perks li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  width: 5px;
  height: 5px;
  background: var(--shop-y);
}
.shop-buy-reason {
  flex-shrink: 0;
  min-height: 16px;
  font-size: 15px;
  color: #c44536;
  margin: 6px 0 4px;
}
.btn-shop-buy {
  flex-shrink: 0;
  width: 100%;
  background: var(--shop-y);
  color: #111;
  border: 2px solid #111;
  min-height: 40px;
  font-size: 10px;
  box-shadow: 3px 3px 0 #664;
}
.btn-shop-buy:disabled {
  background: #3a3a3a;
  color: #777;
  border-color: #222;
  box-shadow: none;
}

.chips, .event-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.chip {
  font-family: "Press Start 2P", monospace;
  font-size: 7px;
  padding: 4px 5px;
  border: 2px solid var(--cream);
  background: #2c2218;
  color: var(--cream);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.chip.cost { border-color: var(--bad); color: #f5c4be; }
.chip.gain { border-color: var(--ok); color: #c8e6b0; }
.chip.energy { border-color: var(--en); color: #9fd4ff; }
.chip.happiness { border-color: var(--hap); color: #f3e2b3; }
.chip.health { border-color: var(--hp); color: #f5c4be; }
.chip.bolts { border-color: var(--hap); color: #f3e2b3; }
.chip.perk { border-color: var(--glow); }
.chip-row { margin-top: 4px; }
.chip-row .lbl {
  font-family: "Press Start 2P", monospace;
  font-size: 6px;
  color: var(--amber);
  display: block;
  margin-bottom: 2px;
}
.chip-row .lbl.win { color: var(--ok); }
.chip-row .lbl.fail { color: var(--bad); }

.morning-list {
  list-style: none;
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}
.morning-card {
  background: #2c2218;
  border: 2px solid var(--cream);
  padding: 8px;
  text-align: left;
}
.morning-card.bad { border-color: var(--bad); }
.morning-card.good { border-color: var(--ok); }
.morning-card.upgrade-offer { border-color: var(--glow); background: #183126; }
.morning-card.upgrade-offer.cant-afford { opacity: 0.7; }
.morning-card.done { opacity: 0.45; }
.morning-card .who {
  font-family: "Press Start 2P", monospace;
  font-size: 7px;
  color: var(--amber);
}
.morning-card .title { font-size: 20px; }
.morning-card .where {
  font-size: 16px;
  color: var(--amber);
}
.morning-card button {
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--cream);
  font-family: "VT323", monospace;
  font-size: 18px;
  min-height: 44px;
  border: 0;
  box-shadow: none;
}

/* MINIGAMES */
.mini-frame { align-self: stretch; margin: auto 0; }
.mini-hud {
  display: flex;
  justify-content: space-between;
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  margin-bottom: 8px;
  color: var(--amber);
}
.whack-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(3, 84px);
  gap: 8px;
  height: 268px;
}
.hole {
  appearance: none;
  width: 100%;
  height: 84px;
  min-height: 80px;
  max-height: 84px;
  background: #2c2218;
  border: 3px solid #5a3d24;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 4px;
  overflow: hidden;
  font-family: "VT323", monospace;
  font-size: 14px;
  line-height: 1;
  color: var(--cream);
  transform: none;
}
.hole:active, .hole:focus { transform: none; outline: none; }
.hole-face {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  line-height: 44px;
  font-size: 36px;
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
  text-align: center;
}
.hole:not(.pop) .hole-face::before {
  content: "";
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #1a120c;
}
.hole.pop .hole-face {
  animation: hole-show 280ms ease-out;
}
@keyframes hole-show {
  from { opacity: 0; }
  to { opacity: 1; }
}
.hole-who {
  display: block;
  width: 100%;
  height: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}
.hole.pop.good { background: #1f3d2a; border-color: var(--ok); }
.hole.pop.bad { background: #3d1a16; border-color: var(--bad); }
#whack-status {
  min-height: 40px;
  overflow: hidden;
}

#road-canvas {
  width: 100%;
  height: auto;
  background: #2a2a2a;
  image-rendering: pixelated;
  border: 3px solid var(--cream);
}

.battle-stage { display: grid; gap: 10px; margin-bottom: 8px; }
.hp-row { display: grid; grid-template-columns: 70px 1fr; align-items: center; gap: 6px; font-size: 16px; }
.foe-art, .hero-art {
  font-family: "Press Start 2P", monospace;
  font-size: 10px;
  padding: 10px;
  background: #2c2218;
  border: 2px solid var(--cream);
  margin-bottom: 4px;
  text-align: center;
}
.battle-ail {
  min-height: 22px;
  font-size: 18px;
  color: var(--amber);
  margin: 0 0 6px;
}
.battle-log {
  min-height: 84px;
  font-size: 18px;
  background: #0a0704;
  border: 2px solid var(--cream);
  padding: 6px;
  margin-bottom: 8px;
  white-space: pre-wrap;
}
.battle-moves { display: grid; gap: 6px; }
.battle-move {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  text-align: left;
  min-height: 52px;
}
.battle-move .move-name {
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
}
.battle-move .move-hint {
  font-family: "VT323", monospace;
  font-size: 16px;
  line-height: 1.15;
  opacity: 0.88;
  font-weight: normal;
  text-transform: none;
}
.battle-move.suggested {
  border-color: var(--amber);
}

.timing-track {
  position: relative;
  height: 32px;
  margin: 10px 0 12px;
  background: #2c2218;
  border: 3px solid var(--cream);
  overflow: hidden;
}
.timing-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  background: var(--ok);
  opacity: 0.85;
}
.timing-needle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--cream);
  box-shadow: 0 0 0 1px #1b140c;
  transform: translateX(-50%);
}
#meter-tap { width: 100%; }
#pick-prompt { min-height: 64px; margin-bottom: 8px; }

#overlay-ending,
#overlay-gameover {
  align-items: stretch;
  padding: 0;
  background: #1b140c;
}
.ending-screen {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
}
.ending-art-wrap {
  flex: 0 1 34%;
  max-height: 40%;
  min-height: 96px;
  display: grid;
  place-items: center;
  padding: 8px 8px 0;
  background: #1b140c;
}
#overlay-gameover .ending-art-wrap {
  flex-basis: 46%;
  max-height: 52%;
}
.ending-art {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
#overlay-ending .ending-panel,
#overlay-gameover .ending-panel {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  width: 100%;
  overflow: auto;
  display: flex;
  flex-direction: column;
  border-width: 3px 0 0;
}
#overlay-ending #btn-again,
#overlay-gameover #btn-restart {
  flex-shrink: 0;
  width: 100%;
  margin-top: 10px;
  position: sticky;
  bottom: 0;
}

.ending-cast {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0;
}
.ending-cast span {
  border: 2px solid var(--cream);
  padding: 4px 6px;
  font-size: 16px;
}
.score-list li { font-size: 18px; }
.grim { text-align: center; }
.grim .ending-title { color: var(--bad); margin: 10px 0; }

@media (max-width: 520px) {
  #device { padding: 0; }
  #bezel {
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
    border: 0;
    box-shadow: none;
    padding: 8px 6px 10px;
  }
  #brand, #speaker { display: none; }
}
