/* Foodieville: full-screen town map with a neon-night HUD over it. */
:root {
  --bg: #0f1420;
  --panel: rgba(16, 18, 28, 0.94);
  --line: rgba(255, 255, 255, 0.12);
  --ink: #f5f3ef;
  --muted: #a9a6b3;
  --accent: #ff3347;
  --gold: #ffcf4a;
  --green: #3ddc84;
  --red: #ff8a8a;
  --glow: 0 0 18px rgba(255, 51, 71, 0.55);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); }
body {
  font: 15px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
canvas#map { position: fixed; inset: 0; width: 100%; height: 100%; touch-action: none; display: block; cursor: grab; }

/* HUD */
.hud {
  position: fixed; left: 0; right: 0; top: 0; z-index: 5;
  padding: max(8px, env(safe-area-inset-top)) 12px 7px;
  background: linear-gradient(var(--panel), rgba(16, 18, 28, 0.78));
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.hud-row { display: flex; align-items: center; gap: 12px; min-width: 0; white-space: nowrap; }
.hud-row.small { margin-top: 4px; font-size: 0.8rem; color: var(--muted); }
.stat b { font-weight: 800; color: var(--ink); }
#cash { color: var(--gold); font-size: 1.1rem; }
.ride { margin-left: auto; font-size: 1.2rem; }
.timebar { flex: 1; max-width: 160px; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
#time-bar { display: block; height: 100%; width: 100%; background: var(--green); transition: width 0.3s, background 0.3s; }
#title-rank { color: var(--ink); font-weight: 700; }

/* Toolbar */
.toolbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; gap: 4px; align-items: stretch;
  padding: 6px 8px max(8px, env(safe-area-inset-bottom));
  background: var(--panel); border-top: 1px solid var(--line);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.toolbar button {
  position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 5px 2px; border: 0; border-radius: 12px; background: none; cursor: pointer;
  font-size: 0.72rem; font-weight: 600; color: var(--muted);
}
.toolbar button span { font-size: 1.35rem; line-height: 1.1; }
.toolbar button.next { flex: 1.4; background: var(--accent); color: #fff; box-shadow: var(--glow); }
.toolbar .badge {
  position: absolute; top: 2px; right: calc(50% - 22px); min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--accent); color: #fff; font: 700 0.7rem/18px system-ui, sans-serif; font-style: normal;
}

/* Building card */
.card, .panel {
  position: fixed; z-index: 6; left: 50%; transform: translateX(-50%);
  width: min(94vw, 400px); padding: 14px 16px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.card { bottom: calc(74px + env(safe-area-inset-bottom)); max-height: 62vh; overflow-y: auto; }
.panel { top: 50%; transform: translate(-50%, -50%); max-height: 82vh; overflow-y: auto; z-index: 7; }
.card h3, .panel h2 { margin: 0 0 4px; font-size: 1.15rem; padding-right: 30px; }
.panel h3 { margin: 16px 0 6px; font-size: 0.95rem; }
.card p, .panel p { margin: 4px 0; font-size: 0.88rem; }
.card .x { position: absolute; top: 10px; right: 10px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.08); cursor: pointer; }
.muted { color: var(--muted); }
.small { font-size: 0.8rem; }
.good { color: var(--green); }
.bad { color: var(--red); }
.gold { color: var(--gold); }
.actions { display: grid; gap: 8px; margin-top: 12px; }
.act {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%;
  padding: 11px 14px; border: 1px solid var(--line); border-radius: 12px;
  background: rgba(255, 255, 255, 0.06); text-align: left; cursor: pointer;
}
.act b { font-weight: 700; }
.act small { color: var(--muted); font-size: 0.78rem; white-space: nowrap; }
.act.primary { background: var(--accent); border-color: var(--accent); box-shadow: var(--glow); }
.act.primary small { color: rgba(255, 255, 255, 0.85); }
.act:disabled { opacity: 0.45; cursor: default; box-shadow: none; }
.act .why { display: block; font-size: 0.74rem; color: var(--red); font-weight: 500; }
.btn {
  display: block; width: 100%; margin-top: 10px; padding: 12px 14px; border: 0; border-radius: 12px;
  background: var(--accent); color: #fff; font-weight: 700; text-align: center; text-decoration: none; cursor: pointer;
  box-shadow: var(--glow);
}
.btn.ghost { background: rgba(255, 255, 255, 0.08); box-shadow: none; }
.list { margin: 6px 0 0; padding: 0; list-style: none; }
.list li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 0.88rem; }
.list li:last-child { border-bottom: 0; }
.list li button { border: 0; background: none; color: var(--accent); font-weight: 700; cursor: pointer; padding: 0; text-align: left; }
#goals ol { margin: 8px 0 0; padding-left: 22px; }
#goals li { margin: 6px 0; font-size: 0.9rem; }
#goals li.done { color: var(--muted); text-decoration: line-through; }
#goals li span { color: var(--gold); font-weight: 600; }
.report-total { display: flex; justify-content: space-between; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); font-weight: 800; }

.ballot { padding: 8px 0; border-bottom: 1px solid var(--line); }
.vote-row { display: flex; gap: 8px; margin-top: 6px; }
.vote { flex: 1; padding: 9px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255, 255, 255, 0.06); font-weight: 700; cursor: pointer; }
.vote.on { background: var(--accent); border-color: var(--accent); box-shadow: var(--glow); color: #fff; }
.row-btns { display: flex; gap: 10px; align-items: center; flex: none; }
.row-btns button { border: 0; background: none; color: var(--accent); font-weight: 700; cursor: pointer; padding: 4px; }

.pick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 6px; }
.pick { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 8px 4px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255, 255, 255, 0.06); cursor: pointer; }
.pick span { font-size: 1.4rem; line-height: 1.1; }
.pick b { font-size: 0.74rem; line-height: 1.15; text-align: center; }
.pick small { font-size: 0.68rem; color: var(--gold); }
.linkish { border: 0; background: none; color: var(--accent); font-weight: 700; cursor: pointer; padding: 0 4px; }

/* Title screen */
.title {
  position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(circle at 50% 35%, rgba(255, 51, 71, 0.25), transparent 60%), rgba(10, 9, 12, 0.86);
}
.title-inner { width: min(100%, 380px); text-align: center; }
.kicker { margin: 0; color: var(--muted); letter-spacing: 0.12em; text-transform: uppercase; font-size: 0.75rem; }
.title h1 {
  margin: 6px 0 8px; font-size: clamp(2.6rem, 13vw, 3.6rem); letter-spacing: -0.02em; color: #fff;
  text-shadow: 0 0 8px #ff3347, 0 0 24px #ff3347, 0 0 48px rgba(255, 51, 71, 0.6);
}
.tag { margin: 0 0 18px; color: var(--ink); }
.btn.big { padding: 14px; font-size: 1.05rem; }
.back { display: inline-block; margin-top: 18px; color: var(--muted); text-decoration: none; font-size: 0.9rem; }

.toast {
  position: fixed; z-index: 9; left: 50%; transform: translateX(-50%); margin: 0;
  top: calc(96px + env(safe-area-inset-top)); width: max-content; max-width: 92vw;
  padding: 9px 14px; border-radius: 12px; background: rgba(16, 18, 28, 0.96); border: 1px solid var(--accent);
  box-shadow: var(--glow); font-size: 0.88rem; font-weight: 600; text-align: center; white-space: pre-line;
}
@media (min-width: 760px) {
  .toolbar { justify-content: center; }
  .toolbar button { flex: 0 0 96px; font-size: 0.78rem; }
  .toolbar button.next { flex: 0 0 140px; }
}
