/* Suburban Dad Simulator. Menus are flat: solid fills, 1px borders, no gradients or shadows.
   All the light and haze lives inside the 3D view. */

:root {
  --bg: #14110d;
  --panel: #1d1915;
  --panel-2: #29231c;
  --line: #43392d;
  --ink: #f4eddf;
  --mute: #b9ac97;
  --accent: #f0892a;
  --accent-ink: #1c0f03;
  --good: #a5cf52;
  --warn: #e8604f;
  --gold: #f4c63a;
  --display: 'Barlow Condensed', 'Arial Narrow', system-ui, sans-serif;
  --body: 'Barlow', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-weight: 500;
  font-size: 16px;
  line-height: 1.5;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

#view {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  outline: none;
}

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

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--ink);
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
}
.btn:hover { border-color: var(--accent); }
.btn:focus-visible, .tile:focus-visible, .icon-btn:focus-visible, .seg-btn:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #ffb05c; border-color: #ffb05c; }
.btn.big { min-height: 52px; padding: 0 28px; font-size: 17px; }
.btn.small { min-height: 36px; padding: 0 14px; font-size: 14px; min-width: 58px; }
.btn[disabled] { opacity: 0.5; cursor: default; }

/* ---------- screens ---------- */

.screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  padding: 20px 16px 56px;
  background: rgba(20, 16, 11, 0.8);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.screen.on { display: flex; align-items: flex-start; }
#intro, #pause, #result { background: rgba(20, 16, 11, 0.56); }
#loading { background: var(--bg); }

.menu-inner {
  width: min(1080px, 100%);
  margin: auto;
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: 44px;
  align-items: center;
}

.kicker {
  margin: 0 0 6px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.title {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(3.4rem, 8vw, 6.2rem);
  line-height: 0.9;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}
.tag { margin: 16px 0 20px; font-size: 18px; color: var(--ink); max-width: 34ch; }
.play-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.total { color: var(--gold); font-weight: 600; font-size: 15px; }
.how { margin: 18px 0 0; color: var(--mute); font-size: 14px; max-width: 46ch; }

.options {
  margin-top: 18px;
  display: grid;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  max-width: 440px;
}
.options.in-card { margin: 14px 0 0; max-width: none; }
.opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 52px;
  padding: 8px 14px;
  border-top: 1px solid var(--line);
}
.opt:first-child { border-top: 0; }
.opt-label { font-size: 14px; font-weight: 600; color: var(--mute); white-space: nowrap; }
.opt:has(.opt-note) { flex-wrap: wrap; row-gap: 4px; }
.opt-note { flex-basis: 100%; margin: 0 0 4px; font-size: 13px; line-height: 1.35; color: var(--mute); }
input[type='range'] { width: min(190px, 46vw); accent-color: var(--accent); }
.seg { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg-btn {
  min-height: 34px;
  padding: 0 10px;
  border: 0;
  border-left: 1px solid var(--line);
  background: var(--panel-2);
  font-size: 13px;
  font-weight: 600;
  color: var(--mute);
}
.seg-btn:first-child { border-left: 0; }
.seg-btn.on { background: var(--accent); color: var(--accent-ink); }

/* ---------- yard list ---------- */

.list-head {
  margin: 0 0 10px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mute);
}
.levels { display: grid; gap: 8px; }
.tile {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 66px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  text-align: left;
}
.tile:hover:not([disabled]) { border-color: var(--accent); background: var(--panel-2); }
.tile[disabled] { opacity: 0.45; cursor: default; }
.tile-num {
  font-family: var(--display);
  font-weight: 700;
  font-size: 30px;
  line-height: 1;
  color: var(--accent);
}
.tile[disabled] .tile-num { color: var(--mute); }
.tile-name { display: block; font-weight: 600; font-size: 17px; line-height: 1.2; }
.tile-sub { display: block; font-size: 13px; color: var(--mute); }
.tile-right { text-align: right; white-space: nowrap; }
.tile-stars { display: block; font-size: 16px; letter-spacing: 2px; color: var(--line); }
.tile-stars b { color: var(--gold); font-weight: 400; }
.tile-best { display: block; font-size: 12px; color: var(--mute); }

/* ---------- cards ---------- */

.card {
  width: min(460px, 100%);
  margin: auto;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
}
.card.wide {
  width: min(860px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 300px);
  gap: 26px;
  align-items: center;
}
.card-title {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.1rem, 5vw, 3rem);
  line-height: 1;
  text-transform: uppercase;
}
.card-text { margin: 12px 0 0; color: var(--ink); font-size: 16px; max-width: 46ch; }
.card-text.small { font-size: 14px; color: var(--mute); }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 18px 0 0; }
.stats > div { border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); padding: 9px 10px; }
.stats dt { font-size: 12px; color: var(--mute); line-height: 1.25; }
.stats dd { margin: 2px 0 0; font-family: var(--display); font-weight: 700; font-size: 26px; line-height: 1.1; }
.card-btns { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.big-stars { margin-top: 10px; font-size: 44px; line-height: 1; letter-spacing: 6px; color: var(--line); }
.big-stars b { color: var(--gold); font-weight: 400; }

.card-map canvas { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: 8px; background: #20281a; }
.legend { margin: 8px 0 0; font-size: 13px; color: var(--mute); display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; }
.legend .k { display: inline-block; width: 12px; height: 12px; border-radius: 2px; margin-left: 8px; }
.legend .k:first-child { margin-left: 0; }
.goal-k { background: var(--accent); }
.you-k { background: #ffffff; border-radius: 50% !important; }
.leaf-k { background: #d8a236; }

/* ---------- in-game display ---------- */

.hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; display: none; }
body[data-state='play'] .hud, body[data-state='pause'] .hud { display: block; }
.hud-top {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  left: 12px;
  right: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}
.hud-level { display: flex; align-items: center; gap: 10px; min-width: 0; }
.hud-num {
  flex: none;
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--display);
  font-weight: 700;
  font-size: 22px;
}
.hud-name {
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(20, 16, 11, 0.82);
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hud-timer {
  min-width: 92px;
  padding: 2px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(20, 16, 11, 0.82);
  font-family: var(--display);
  font-weight: 700;
  font-size: 30px;
  line-height: 1.2;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.hud-timer.low { color: var(--warn); border-color: var(--warn); }
.hud-btns { display: flex; justify-content: flex-end; gap: 8px; pointer-events: auto; }
.icon-btn {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(20, 16, 11, 0.82);
  color: var(--ink);
}
.icon-btn:hover { border-color: var(--accent); }
.icon-btn .slash { display: none; }
.icon-btn.off .slash { display: inline; }
.icon-btn.off .wave { display: none; }

.goal {
  position: absolute;
  top: calc(max(10px, env(safe-area-inset-top)) + 54px);
  left: 50%;
  transform: translateX(-50%);
  width: min(420px, calc(100% - 24px));
  padding: 8px 12px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(20, 16, 11, 0.82);
}
.goal-row { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; font-weight: 600; }
.goal-pct { color: var(--mute); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar { position: relative; height: 10px; margin-top: 6px; border-radius: 5px; background: #3a3127; overflow: hidden; }
.bar-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--accent); }
.bar-fill.done { background: var(--good); }
.bar-mark { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--ink); }

.dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(0, 0, 0, 0.5);
}
.toast {
  position: absolute;
  left: 50%;
  top: calc(max(10px, env(safe-area-inset-top)) + 122px);
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(20, 16, 11, 0.88);
  font-weight: 600;
  font-size: 15px;
  text-align: center;
  opacity: 0;
  transition: opacity 0.25s;
}
.toast.on { opacity: 1; }
/* Hints sit under the goal bar, clear of the tool in your hands and of the touch controls. */

/* Touch: the stick is the only control on screen, solid so it reads over any yard. It sits at the bottom
   left and walks you. Any other finger on the screen runs the blower and aims it, so there is no button. */
.stick { display: none; }
body.touch[data-state='play'] .stick { display: flex; }
.stick {
  position: absolute;
  left: max(18px, env(safe-area-inset-left));
  bottom: calc(58px + env(safe-area-inset-bottom));
  width: 124px;
  height: 124px;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: var(--panel);
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  touch-action: none;
}
/* A wider ring that still counts as the stick, so a thumb landing just outside it is not a miss. */
.stick::before { content: ''; position: absolute; inset: -22px; border-radius: 50%; }
.stick.live { border-color: var(--accent); }
.knob { width: 54px; height: 54px; border-radius: 50%; background: var(--ink); border: 2px solid var(--panel-2); pointer-events: none; }
.stick.live .knob { background: var(--accent); }

/* ---------- credit ---------- */

.credit {
  position: fixed;
  left: 0;
  right: 0;
  bottom: max(6px, env(safe-area-inset-bottom));
  z-index: 30;
  display: flex;
  justify-content: center;
  gap: 16px;
  font-size: 12px;
  pointer-events: none;
}
.credit a {
  pointer-events: auto;
  padding: 3px 9px;
  border-radius: 6px;
  background: rgba(20, 16, 11, 0.72);
  color: var(--mute);
  text-decoration: none;
  white-space: nowrap;
}
.credit a:hover { color: var(--ink); }
.noscript { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; margin: 0; padding: 20px; background: var(--bg); text-align: center; }

/* ---------- narrow screens ---------- */

@media (max-width: 860px) {
  .menu-inner { grid-template-columns: minmax(0, 1fr); gap: 26px; align-items: start; }
  .card.wide { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .card-map { max-width: 320px; }
}
@media (max-width: 520px) {
  .screen { padding: 14px 12px 56px; }
  .card { padding: 18px 16px; }
  .tag { font-size: 16px; }
  .hud-name { display: none; }
  .hud-timer { font-size: 26px; min-width: 80px; }
  .stats dd { font-size: 22px; }
  .stats dt { font-size: 11px; }
  .big-stars { font-size: 38px; }
  .seg-btn { padding: 0 8px; }
  .opt { flex-wrap: wrap; }
  .credit { gap: 8px; font-size: 11px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .goal { top: max(8px, env(safe-area-inset-top)); left: auto; right: 116px; transform: none; width: min(300px, 38vw); }
  .hud-top { grid-template-columns: auto auto 1fr; }
  .hud-name { display: none; }
  .toast { top: 78px; }
}
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

/* ---------- the shed ---------- */
/* The room is the 3D view. The panel sits over its right side (wide screens) or its lower half (phones). */

#shed { padding: 0; background: none; overflow: hidden; pointer-events: none; }
#shed.on { display: block; }
#shed .brand { position: absolute; left: 22px; top: max(16px, env(safe-area-inset-top)); width: min(420px, calc(100% - 500px)); }
.shed-title { font-size: clamp(2rem, 4.4vw, 3.6rem); }
.shed-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(440px, 100%);
  padding: 16px 16px 52px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-left: 1px solid var(--line);
  background: var(--bg);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  pointer-events: auto;
}
.day { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); padding: 12px 14px; }
.day-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.day-when { margin: 0; font-family: var(--display); font-weight: 700; font-size: 30px; line-height: 1; text-transform: uppercase; }
.day-num { display: inline-block; margin-left: 6px; font-size: 16px; font-weight: 600; letter-spacing: 0.06em; color: var(--mute); }
.fund { margin: 0; text-align: right; white-space: nowrap; font-size: 12px; color: var(--mute); line-height: 1.2; }
.fund b { display: block; font-family: var(--display); font-weight: 700; font-size: 28px; line-height: 1; color: var(--gold); font-variant-numeric: tabular-nums; }
.day-weather { margin: 8px 0 0; font-weight: 600; font-size: 15px; }
.day-note { margin: 2px 0 0; font-size: 14px; color: var(--mute); }
.day-left { margin: 8px 0 0; font-size: 13px; font-weight: 600; color: var(--accent); }

.tools { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.tool {
  position: relative;
  min-height: 58px;
  padding: 8px 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  text-align: left;
  line-height: 1.2;
}
.tool:hover { border-color: var(--accent); }
.tool:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.tool.on { background: var(--panel-2); border-color: var(--accent); }
.tool-name { display: block; font-family: var(--display); font-weight: 700; font-size: 18px; text-transform: uppercase; letter-spacing: 0.03em; }
.tool-tier { display: block; font-size: 11px; color: var(--mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-badge {
  position: absolute;
  top: -7px;
  right: -5px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 12px;
  font-weight: 600;
  line-height: 20px;
  text-align: center;
}

.tool-card { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); padding: 14px; }
.kicker.small { font-size: 14px; margin-bottom: 4px; }
.tool-title { margin: 0; font-family: var(--display); font-weight: 700; font-size: 30px; line-height: 1; text-transform: uppercase; }
.tool-blurb { margin: 6px 0 14px; font-size: 14px; color: var(--mute); }
.tool-card .list-head { font-size: 14px; margin-bottom: 8px; }
.jobs { display: grid; gap: 8px; }
.job {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}
.job.done { background: none; }
.job-name { display: block; font-weight: 600; font-size: 16px; line-height: 1.25; }
.job-sub { display: block; font-size: 13px; color: var(--mute); }
.job-nums { display: flex; flex-wrap: wrap; gap: 2px 12px; margin-top: 4px; font-size: 13px; color: var(--mute); font-variant-numeric: tabular-nums; }
.job-pay { color: var(--gold); font-weight: 600; }
.job-stars { letter-spacing: 2px; color: var(--line); }
.job-stars b { color: var(--gold); font-weight: 400; }
.job-none { margin: 0; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 8px; font-size: 14px; color: var(--mute); }
.upgrade {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.up-label { display: block; font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--mute); }
.up-name { display: block; font-weight: 600; font-size: 16px; }
.up-blurb { display: block; font-size: 13px; color: var(--mute); }
.shed-foot { display: flex; gap: 8px; }
.shed-foot .btn { flex: 1; }
.endday { border: 1px solid var(--accent); border-radius: 10px; background: var(--panel); padding: 12px 14px; }
.endday p { margin: 0; font-size: 14px; }
.endday .card-btns { margin-top: 10px; }
#settings { background: rgba(20, 16, 11, 0.72); }
#stats-line { margin-top: 14px; }

/* Touch, with a snow blower: two buttons at the bottom right turn the chute. */
.chute-btns { display: none; }
body.touch.chute[data-state='play'] .chute-btns {
  position: absolute;
  right: max(18px, env(safe-area-inset-right));
  bottom: calc(58px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}
.chute-btn { width: 56px; height: 56px; background: var(--panel); border-width: 2px; touch-action: none; }
.chute-label { font-size: 12px; font-weight: 600; color: var(--ink); padding: 2px 6px; border-radius: 6px; background: rgba(20, 16, 11, 0.82); }

@media (max-width: 860px) {
  #shed .brand { left: 14px; right: 14px; width: auto; }
  .shed-title { font-size: clamp(1.7rem, 8vw, 2.4rem); }
  #shed .kicker { font-size: 13px; }
  .shed-panel { top: auto; left: 0; width: 100%; max-height: 60%; padding: 12px 12px 48px; border-left: 0; border-top: 1px solid var(--line); gap: 10px; }
  .day-when { font-size: 24px; }
  .fund b { font-size: 24px; }
  .tool-title { font-size: 24px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  #shed .brand { display: none; }
  .shed-panel { top: 0; left: auto; width: min(440px, 62%); max-height: none; border-top: 0; border-left: 1px solid var(--line); }
}
