:root {
  --bg: #101820;
  --ink: #f4efe6;
  --muted: #b7c4ce;
  --amber: #ffc857;
  --amber-2: #ff9f1c;
  --mint: #5ee0b5;
  --danger: #ff6b6b;
  --paper: #f6f1e7;
  --line: rgba(255, 255, 255, 0.12);
  --card: #1a2833;
  color-scheme: dark;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 17px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: #070d12;
  color: var(--ink);
  display: grid;
  place-items: center;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }

#app {
  width: min(480px, 100%);
  height: 100dvh;
  max-height: 980px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
@media (min-width: 800px) {
  body {
    padding: 24px;
    background:
      radial-gradient(circle at 50% 30%, #1c3348 0, transparent 42%),
      #070d12;
  }
  #app {
    width: min(560px, 100%);
    height: min(1040px, calc(100dvh - 48px));
    max-height: none;
    border-radius: 28px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  }
}
@media (min-width: 1400px) {
  #app { width: min(640px, 100%); }
  .money b { font-size: 40px; }
}
body.has-sticky #app { padding-bottom: 64px; }

#hud {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: calc(8px + env(safe-area-inset-top)) 10px 4px;
}
.money { flex: 1; min-width: 0; }
.money b {
  display: block;
  font-size: 26px;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--amber);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.money small { color: var(--muted); font-size: 15px; }
.iconbtn {
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 14px;
  background: #1c2b36;
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  color: var(--ink);
}
.iconbtn .ico { width: 26px; height: 26px; display: block; }
#rep, #tokens { display: flex; flex-direction: column; gap: 0; color: var(--amber); }
#rep .ico, #tokens .ico { width: 20px; height: 20px; }
#rep b, #tokens b { font-size: 13px; line-height: 1; }
.iconbtn.on-gift::after,
#dock button.dot::after {
  content: "";
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
}
#sound.is-off { opacity: 0.45; }

#goalbar {
  position: relative;
  margin: 4px 10px 0;
  padding: 4px 8px 7px;
  min-height: 26px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 16px;
}
#goalbar span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#goalbar em { font-style: normal; color: var(--amber); flex: none; }
#goalfill {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: 0;
  background: linear-gradient(90deg, var(--amber-2), var(--amber));
  border-radius: 4px;
}
#eventbar {
  margin: 4px 10px 0;
  background: rgba(255, 200, 87, 0.12);
  color: #ffe3a3;
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 15px;
}
#eventbar[hidden] { display: none !important; }

#scene {
  flex: 1;
  min-height: 180px;
  margin: 8px 10px 0;
  border-radius: 22px;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  background: #152433;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
#street {
  flex: 1.45;
  position: relative;
  background:
    radial-gradient(circle at 78% 16%, #fff4d2 0 7px, rgba(255, 244, 210, 0.25) 8px, transparent 18px),
    linear-gradient(#243e56, #152433 72%);
  overflow: hidden;
}
#street::after {
  content: "";
  position: absolute;
  left: -10%;
  right: -10%;
  bottom: 0;
  height: 32%;
  background: linear-gradient(#e7eef3, #c5d4df);
  border-radius: 50% 50% 0 0;
}
#sign {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--amber);
  color: #1a120c;
  border-radius: 10px;
  padding: 4px 14px 5px;
  text-align: center;
  z-index: 3;
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.18);
}
#sign span { display: block; font-weight: 800; letter-spacing: 0.14em; font-size: 18px; }
#sign small { display: block; font-size: 14px; letter-spacing: 0; opacity: 0.8; white-space: nowrap; }
body.skin-neon #sign span { text-shadow: 0 0 10px #9fd7ff; }
#garland {
  position: absolute;
  top: 52px;
  left: 8px;
  right: 8px;
  display: none;
  justify-content: space-between;
  z-index: 3;
  pointer-events: none;
}
body.event-ny #garland, body.skin-lights #garland { display: flex; }
#garland i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff5d5d;
  box-shadow: 0 8px 0 #2a9d4a;
  animation: blink 1.4s infinite;
}
body.skin-lights #garland i { background: #5ee0b5; box-shadow: 0 8px 0 #7aa2ff; }
#garland i:nth-child(odd) { animation-delay: 0.4s; }
@keyframes blink { 50% { filter: brightness(1.6); } }

#windows {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: space-around;
  align-items: flex-start;
  padding: 16% 8% 0;
  pointer-events: none;
}
#windows i {
  width: 16%;
  height: 22%;
  border-radius: 6px;
  background: #122433;
  box-shadow: inset 0 0 0 3px #2a4254, 0 0 16px rgba(255, 200, 87, 0.12);
}
#windows i:nth-child(odd) { background: #1c3344; }
#snow { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
#snow b {
  position: absolute;
  top: -8px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: white;
  opacity: 0.8;
  animation: fall linear infinite;
}
@keyframes fall { to { transform: translateY(240px); } }

#queue {
  position: absolute;
  left: 8px;
  right: 78px;
  bottom: 10px;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  z-index: 3;
}
.cust { flex: 1; max-width: 68px; position: relative; }
.cust.front { transform: scale(1.08); transform-origin: bottom center; }
.person { display: block; }
.person .sprite { width: 100%; height: auto; display: block; }
.hat-1 .hat { fill: #8d3a34; }
.hat-2 .hat { fill: #1d3557; }
.hat-3 .hat { fill: #3d4f6a; }
.cust.gold .parcel { fill: #ffd15c; stroke: #8a6a20; }
.heat { display: none; height: 4px; background: rgba(0,0,0,.25); border-radius: 4px; margin-bottom: 3px; overflow: hidden; }
.cust.hot .heat { display: block; }
.heat i { display: block; height: 100%; background: var(--danger); width: 100%; }
.cust.hot .sprite { filter: drop-shadow(0 0 4px #ff6b6b); }
#scene.pop .cust.front .sprite { animation: hop 0.22s ease; }
@keyframes hop { 40% { transform: translateY(-7px); } }
.speech {
  display: none;
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  background: white;
  color: #1b2430;
  font-size: 14px;
  padding: 3px 8px;
  border-radius: 8px;
  white-space: nowrap;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cust.front .speech { display: block; left: 0; transform: none; }
.more {
  align-self: center;
  font-size: 15px;
  font-weight: 700;
  color: #1b2430;
  background: rgba(255,255,255,.8);
  border-radius: 999px;
  padding: 4px 6px;
}

#van {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 4;
  background: rgba(8, 16, 24, 0.78);
  border-radius: 12px;
  padding: 6px 8px;
  min-width: 86px;
  max-width: 148px;
  font-size: 15px;
}
#vanart .van-art { width: 72px; height: 40px; display: block; margin: 0 auto 2px; }
#van b { display: block; font-weight: 700; }
#van button {
  margin-top: 4px;
  width: 100%;
  border: 0;
  border-radius: 8px;
  background: var(--mint);
  color: #06281c;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  white-space: normal;
  padding: 6px;
}
#van button[hidden] { display: none !important; }

#interior {
  flex: 0.62;
  position: relative;
  background: linear-gradient(#4a2e1c, #24150e 80%);
}
#staff {
  position: absolute;
  left: 10px;
  bottom: 18px;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  z-index: 2;
}
.mate { text-align: center; animation: bob 2.4s ease-in-out infinite; }
.mate em { display: block; font-style: normal; font-size: 14px; color: #f0d7b0; margin-top: 2px; }
.mate .sprite, .mate-art { width: 58px; height: auto; display: block; margin: 0 auto; }
#lena { animation-delay: 0.4s; }
#gosha { animation-delay: 0.8s; }
body:not(.has-lena) #lena, body:not(.has-gosha) #gosha { display: none; }
@keyframes bob { 50% { transform: translateY(-3px); } }
body.skin-hat #neyra .sprite { filter: drop-shadow(0 -6px 0 #c4473a); }
body.skin-glasses #neyra .sprite { filter: drop-shadow(0 0 2px #f4efe6); }
#shelves {
  position: absolute;
  right: 14px;
  bottom: 28px;
  display: grid;
  grid-template-columns: repeat(3, 26px);
  gap: 6px;
}
#shelves i {
  display: block;
  height: 16px;
  border-radius: 2px;
  background: linear-gradient(#f0d2a4, #c4844a);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.15);
}
body.event-ny #shelves i:nth-child(3n) { background: linear-gradient(#ffe08a, #e0a322); }
#counter {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 14px;
  background: linear-gradient(#e7b06a, #8a552c);
}

#floats { position: absolute; inset: 0; pointer-events: none; z-index: 5; overflow: hidden; }
.float {
  position: absolute;
  bottom: 48%;
  font-weight: 800;
  font-size: 18px;
  color: var(--amber);
  text-shadow: 0 2px 0 rgba(0,0,0,.35);
  animation: floatup 0.9s ease-out forwards;
}
.float.gold { color: #fff1b8; font-size: 22px; }
.float.bad { color: var(--danger); font-size: 14px; }
@keyframes floatup {
  to { transform: translateY(-72px); opacity: 0; }
}
#rushbanner {
  position: absolute;
  top: 46%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #ff4d3a;
  color: white;
  font-weight: 800;
  padding: 8px 14px;
  border-radius: 999px;
  z-index: 6;
  box-shadow: 0 8px 20px rgba(0,0,0,.3);
}
#rushbanner[hidden] { display: none !important; }
#scene.shake { animation: shake 0.28s linear; }
@keyframes shake {
  25% { transform: translateX(-4px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-2px); }
}

#action {
  display: flex;
  gap: 8px;
  padding: 8px 10px 4px;
  position: relative;
}
#serve {
  flex: 1;
  min-height: 64px;
  border: 0;
  border-radius: 18px;
  background: linear-gradient(#ffd56a, #ff9f1c);
  color: #1a120c;
  font-size: 18px;
  font-weight: 800;
  box-shadow: 0 6px 0 #c67412;
  touch-action: none;
}
#serve:active { transform: translateY(2px); box-shadow: 0 4px 0 #c67412; }
#serve.hint { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { filter: brightness(1.08); } }
#serve.wait { background: #31414d; color: var(--muted); box-shadow: 0 6px 0 #1b2832; }
#contextad {
  width: 42%;
  min-height: 64px;
  border: 0;
  border-radius: 18px;
  background: var(--mint);
  color: #06281c;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.2;
  padding: 8px;
}
#contextad[hidden] { display: none !important; }
#combo {
  position: absolute;
  top: -6px;
  left: 18px;
  background: #ff4d3a;
  color: white;
  font-size: 15px;
  font-weight: 800;
  border-radius: 999px;
  padding: 2px 8px;
}
#combo[hidden] { display: none !important; }

#dock {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 6px 10px calc(8px + env(safe-area-inset-bottom));
}
#dock button {
  border: 0;
  background: #1c2b36;
  border-radius: 14px;
  min-height: 58px;
  font-size: 14px;
  font-weight: 700;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
#dock .ico { width: 22px; height: 22px; display: block; }
#dock button.on { background: var(--amber); color: #1a120c; }

#sheet {
  flex: 0 0 42%;
  overflow: auto;
  padding: 8px 10px 12px;
  background: #0d161d;
}
#sheet[hidden] { display: none !important; }
#sheet h3 { margin: 8px 0 6px; font-size: 16px; color: var(--muted); font-weight: 700; }
.city-card { border-color: #e7b84a; }
.card {
  background: var(--card);
  border-radius: 16px;
  padding: 10px 12px;
  margin-bottom: 8px;
  position: relative;
  border: 1px solid transparent;
}
.card.best { border-color: var(--amber); }
.ribbon {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--amber);
  color: #1a120c;
  font-style: normal;
  font-size: 14px;
  font-weight: 800;
  border-radius: 999px;
  padding: 2px 6px;
}
.card header { display: flex; justify-content: space-between; gap: 8px; padding-right: 64px; }
.card header span, .card p { color: var(--muted); font-size: 15px; margin: 4px 0; }
.card .fx { color: var(--ink) !important; }
.card .btn { margin-top: 6px; }
.btn {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 14px;
  background: var(--amber);
  color: #1a120c;
  font-weight: 800;
  margin-top: 8px;
}
.btn:disabled { background: #31414d; color: var(--muted); }
.btn.mint { background: var(--mint); color: #06281c; }
.btn.ghost {
  background: transparent;
  color: var(--ink);
  box-shadow: inset 0 0 0 2px var(--line);
}
.btn.tiny { min-height: 40px; width: auto; padding: 0 14px; }
.btn.danger { background: var(--danger); color: white; }
.link {
  background: none;
  border: 0;
  color: var(--muted);
  width: 100%;
  padding: 12px;
  text-decoration: underline;
}
.point {
  width: 100%;
  text-align: left;
  border: 0;
  background: var(--card);
  border-radius: 16px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.point.on { box-shadow: inset 0 0 0 2px var(--amber); }
.point b { display: block; }
.point span, .point em { display: block; color: var(--muted); font-size: 15px; font-style: normal; margin-top: 2px; }
.token-hero { font-size: 28px; font-weight: 800; color: var(--mint); margin: 0; }
.pips { display: flex; gap: 6px; margin: 8px 0; }
.pips i {
  flex: 1;
  text-align: center;
  background: #1c2b36;
  border-radius: 10px;
  padding: 6px 0;
  font-style: normal;
  font-size: 15px;
}
.pips i.on { background: var(--mint); color: #06281c; font-weight: 800; }
.note { color: var(--muted); font-size: 15px; }
.modal-card .note { color: #5c4636; }
.meter { height: 12px; background: #31414d; border-radius: 99px; overflow: hidden; margin: 8px 0 12px; }
.meter i { display: block; height: 100%; background: #e7b84a; }
.devad-card .note { word-break: break-all; }

#modal[hidden] { display: none !important; }
#modal {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: rgba(5, 10, 14, 0.72);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
}
.modal-card {
  width: min(420px, 100%);
  background: var(--paper);
  color: #1a120c;
  border-radius: 22px;
  padding: 16px 16px 14px;
  margin-bottom: calc(8px + env(safe-area-inset-bottom));
}
.modal-card h3 { margin: 0 0 6px; font-size: 24px; }
.modal-card p { margin: 6px 0; }
.modal-card .kicker { color: #8a5a32; font-size: 14px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; }
.modal-card .big { font-size: 36px; font-weight: 800; margin: 8px 0; }
.modal-card .warn { color: #9a3412; font-size: 16px; }
.modal-card .btn.ghost { color: #1a120c; box-shadow: inset 0 0 0 2px rgba(26,18,12,.2); }
.board-row { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid rgba(0,0,0,.06); }

#toasts {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 168px;
  z-index: 25;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}
.toast {
  background: rgba(8, 16, 24, 0.92);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 14px;
}

.devad {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.86);
  display: grid;
  place-items: center;
  padding: 20px;
}
.devad-card {
  width: min(420px, 100%);
  background: #162028;
  border-radius: 20px;
  padding: 18px;
}
.devad-kicker { color: var(--amber); font-size: 12px; font-weight: 800; }
.devad-actions { display: flex; flex-direction: column; gap: 8px; }
.devbar {
  position: fixed;
  left: 8px;
  bottom: 8px;
  z-index: 40;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  max-width: 280px;
}
.devbar button {
  border: 0;
  background: #ff4d3a;
  color: white;
  border-radius: 8px;
  padding: 4px 6px;
  font-size: 11px;
}

.confetti {
  position: absolute;
  top: 30%;
  width: 8px;
  height: 8px;
  z-index: 6;
  animation: pop 0.8s ease-out forwards;
}
@keyframes pop { to { transform: translateY(80px) rotate(120deg); opacity: 0; } }

#menu {
  position: absolute;
  inset: 0;
  z-index: 18;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(7, 13, 18, 0.92);
}
#menu[hidden] { display: none !important; }
.menu-card {
  width: min(420px, 100%);
  background: #142430;
  color: var(--ink);
  border-radius: 24px;
  padding: 22px 18px 16px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}
.menu-card h1 {
  margin: 0 0 8px;
  font-size: 42px;
  letter-spacing: 0.04em;
  color: var(--amber);
}
.menu-card .kicker {
  margin: 0;
  color: #e7c27a;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.menu-card p { font-size: 17px; line-height: 1.35; }
.menu-card .btn { font-size: 18px; }
.modal-card a.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  text-align: center;
}

.star-row { display: flex; gap: 6px; color: #e09020; }
.star-row .ico { width: 28px; height: 28px; display: block; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
  }
}
