:root {
  --bg: #bfe3f2;
  --panel: #fff;
  --ink: #1d2a33;
  --mute: #62717c;
  --accent: #1f8a5b;
  --danger: #d62828;
}
body.night { --bg: #1b2238; }

* { box-sizing: border-box; }
body {
  margin: 0;
  font: 14px/1.4 system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  overflow: hidden;
  transition: background .6s;
}

#city { display: block; width: 100vw; height: 100vh; cursor: pointer; }

button {
  font: inherit; color: var(--ink);
  border: 0; border-radius: 10px; padding: 8px 12px;
  background: var(--panel); box-shadow: 0 2px 8px #0002; cursor: pointer;
}

/* Title + toggles */
.title {
  position: fixed; top: 12px; left: 50%; transform: translateX(-50%);
  background: var(--panel); border-radius: 99px; padding: 6px 14px;
  font-weight: 700; box-shadow: 0 2px 8px #0002;
}
.ctrls { position: fixed; top: 12px; right: 12px; display: flex; gap: 6px; }

/* City info panel */
.hud { position: fixed; top: 12px; left: 12px; display: flex; flex-direction: column; gap: 8px; max-width: 240px; }
.chip { background: var(--panel); border-radius: 12px; padding: 10px 12px; box-shadow: 0 2px 10px #0002; }
.chip h4 { margin: 0 0 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--mute); }
.big { font-size: 18px; font-weight: 700; }
.tag { color: var(--mute); font-size: 13px; }

/* Business card */
.card {
  position: fixed; left: 50%; bottom: 16px; transform: translate(-50%, 140%);
  width: min(360px, calc(100vw - 32px));
  background: var(--panel); border-radius: 16px; padding: 16px;
  box-shadow: 0 8px 30px #0004; transition: transform .3s;
}
.card.show { transform: translate(-50%, 0); }
.card h3 { margin: 0; }
.close { position: absolute; top: 8px; right: 8px; background: none; box-shadow: none; font-size: 18px; padding: 4px 8px; }
.status { display: inline-block; margin: 6px 0; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.open { background: #d7f5e5; color: #13643f; }
.closed { background: #f6dcdc; color: #8a2323; }

.acts { display: flex; gap: 8px; margin-top: 10px; }
.acts a, .acts button {
  flex: 1; text-align: center; text-decoration: none;
  background: var(--accent); color: #fff; border-radius: 10px; padding: 9px; box-shadow: none;
}
.acts .secondary { background: #888; }

.wide { width: 100%; margin-top: 8px; font-weight: 600; box-shadow: none; }
.stamp { background: #f4a261; color: var(--ink); }
.stamp:disabled { opacity: .6; }
.game-btn { background: #2b6cb0; color: #fff; }

/* Mini-game modal */
.modal { position: fixed; inset: 0; background: #0008; display: none; align-items: center; justify-content: center; z-index: 5; }
.modal.show { display: flex; }
.modal-box { background: var(--panel); border-radius: 16px; padding: 16px; width: min(340px, calc(100vw - 32px)); text-align: center; }
.modal-box h3 { margin: 0 0 4px; }
#haircutCanvas {
  display: block; margin: 10px auto 4px; width: 100%; max-width: 300px; aspect-ratio: 1;
  touch-action: none; background: #f3efe6; border-radius: 12px; cursor: crosshair;
}

/* Button-mash */
.mash {
  display: none; position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--danger); color: #fff; font-weight: 700; font-size: 16px;
  padding: 14px 22px; border-radius: 14px;
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
  animation: pulse .4s infinite alternate;
}
@keyframes pulse { to { transform: translateX(-50%) scale(1.06); } }
.meter { height: 6px; background: #fff4; border-radius: 3px; margin-top: 8px; overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: #fff; }

/* Toast */
.toast {
  position: fixed; top: 56px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 10px;
  opacity: 0; transition: opacity .3s; pointer-events: none;
  max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { opacity: 1; }

/* Phones */
@media (max-width: 600px) {
  .hud { top: auto; bottom: 16px; right: 12px; flex-direction: row; max-width: none; }
  .chip { flex: 1; padding: 8px; }
  .big { font-size: 15px; }
  .hud .tag { display: none; }
  .card { bottom: 90px; }
  .title { top: 56px; }
  .toast { top: 96px; }
}
