/*
 * Midnight Diner Dispatch
 * Canonical semantic color, elevation, typography, and responsive shell.
 * Component structure remains in style.css; final presentation lives here.
 */

:root {
  color-scheme: dark;
  --color-night-950: #050914;
  --color-night-900: #08111f;
  --color-night-850: #0b1628;
  --color-night-800: #0e1c30;
  --color-night-750: #13233a;
  --color-night-700: #192c46;
  --color-cloud: #f7f9ff;
  --color-haze: #aeb9cc;
  --color-dim: #77859f;
  --color-tomato: #ff6f70;
  --color-mango: #ffc857;
  --color-mint: #6ee7b7;
  --color-aqua: #53d8c9;
  --color-grape: #b995ff;
  --color-danger: #ff5c68;

  --bg: var(--color-night-900);
  --panel: var(--color-night-850);
  --panel-2: var(--color-night-750);
  --border: rgba(174, 185, 204, .2);
  --text: var(--color-cloud);
  --muted: var(--color-haze);
  --accent: var(--color-aqua);
  --gold: var(--color-mango);
  --green: var(--color-mint);
  --pink: var(--color-tomato);
  --purple: var(--color-grape);
  --danger: var(--color-danger);
  --shadow: 0 22px 65px rgba(0, 0, 0, .42);
  --shadow-soft: 0 12px 34px rgba(0, 0, 0, .24);
  --surface-glass: rgba(11, 22, 40, .91);
  --surface-card: linear-gradient(145deg, rgba(19, 35, 58, .97), rgba(10, 21, 39, .97));
  --surface-card-hover: linear-gradient(145deg, rgba(24, 44, 70, .98), rgba(12, 26, 46, .98));
  --focus-ring: 3px solid var(--color-mango);
  --cartoon-ink: #11172b;
  --cartoon-paper: #fff4d6;
  --cartoon-shadow: rgba(3, 7, 17, .72);
}

html,
body {
  background: var(--color-night-900);
  color: var(--text);
}

body::before {
  background:
    radial-gradient(circle at 7% -8%, rgba(255, 111, 112, .18), transparent 30%),
    radial-gradient(circle at 88% 108%, rgba(83, 216, 201, .12), transparent 34%);
}

#topbar {
  min-height: 70px;
  padding: 10px 18px;
  background: linear-gradient(90deg, rgba(12, 19, 38, .98), rgba(10, 31, 47, .97) 62%, rgba(8, 17, 31, .98));
  border-bottom: 1px solid rgba(255, 200, 87, .2);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .24);
}

.brand-mark {
  width: 40px;
  height: 40px;
  background: linear-gradient(145deg, var(--color-mango), var(--color-tomato) 62%);
  box-shadow: 0 7px 22px rgba(255, 111, 112, .24);
}

.brand { font-size: 21px; }
.brand em { color: #ff8b85; }
.brand-tagline { color: #94a3b9; font-size: 9px; }

.stat {
  min-width: 116px;
  padding: 8px 11px;
  border-color: rgba(174, 185, 204, .17);
  background: rgba(255, 255, 255, .03);
}
.stat .label { color: #91a0b8; font-size: 9px; }
.stat span:last-child { font-size: 15px; }

#game-area,
#game-canvas { background: var(--color-night-900); }

#side-panel {
  width: 336px;
  background: linear-gradient(180deg, rgba(13, 29, 49, .98), rgba(7, 17, 31, .99));
  border-left-color: rgba(174, 185, 204, .18);
  box-shadow: -16px 0 42px rgba(0, 0, 0, .2);
}

.tabs {
  position: sticky;
  top: 0;
  z-index: 3;
  flex: 0 0 auto;
  gap: 4px;
  padding: 9px 9px 0;
  background: rgba(8, 17, 31, .96);
  border-bottom: 1px solid rgba(174, 185, 204, .12);
  scrollbar-color: rgba(83, 216, 201, .4) transparent;
}

.tab-btn {
  min-height: 42px;
  padding: 10px 11px;
  border-radius: 10px 10px 0 0;
  color: #9aa8bd;
  font-size: 11px;
}

.tab-btn.active {
  color: var(--text);
  border-bottom-color: var(--color-tomato);
  background: rgba(255, 111, 112, .1);
}

.tab-panel { padding: 15px; }
.tab-panel.active {
  flex: 1 1 auto;
  min-height: 0;
}

.zone-row,
.upgrade-row,
.skin-row,
.hub-row,
.achievement-row,
.panel-card,
.prestige-summary,
.settings-card,
.campaign-card,
.discover-card {
  background: var(--surface-card);
  border-color: rgba(174, 185, 204, .18);
  box-shadow: var(--shadow-soft);
}

.zone-row:hover,
.upgrade-row:hover,
.skin-row:hover,
.hub-row:hover {
  background: var(--surface-card-hover);
  border-color: rgba(83, 216, 201, .34);
}

.row-kicker,
.artist-card-topline,
.campaign-heading span,
.objective-head,
.radio-station-label span,
.volume-control,
.activity-feed-label { font-size: 9px; }

.row-title,
.panel-title,
.management-card-head .row-title {
  font-size: 14px;
  line-height: 1.25;
}

.row-desc,
.panel-sub,
.competitor-strip small,
.takeover-card span,
.rival-tactic-card > small,
.hub-relocate,
.priority-control small,
.contract-card > p,
.spotlight-campaign > p,
.artist-tagline,
.artist-bio {
  color: var(--color-haze);
  font-size: 10px;
  line-height: 1.5;
}

.status-pill,
.bay-tag,
.track-copy small,
.track-action,
.artist-location,
.artist-eyebrow { font-size: 9px; }

.buy-btn {
  min-height: 42px;
  border-radius: 11px;
  font-size: 11px;
}
.buy-btn.zone-btn { background: linear-gradient(135deg, var(--color-tomato), #ff9366); }
.buy-btn.upgrade-btn { background: linear-gradient(135deg, var(--color-mint), var(--color-aqua)); }
.buy-btn.skin-btn { background: linear-gradient(135deg, var(--color-mango), #ff9d57); }

.objective-card,
#toast-container,
.scene-support-card {
  background: rgba(7, 14, 29, .91);
  border-color: rgba(174, 185, 204, .2);
  box-shadow: 0 16px 42px rgba(0, 0, 0, .34);
}
.objective-body > strong { font-size: 14px; }
.objective-body > small,
.toast { font-size: 10px; }

.order-legend {
  color: #c8d0df;
  background: rgba(7, 14, 29, .88);
  border: 1px solid rgba(174, 185, 204, .16);
}

footer#radio-bar {
  min-height: 74px;
  background: radial-gradient(circle at 18% 125%, rgba(255, 111, 112, .14), transparent 34%), rgba(6, 12, 25, .98);
  border-top-color: rgba(255, 200, 87, .18);
  box-shadow: 0 -12px 34px rgba(0, 0, 0, .28);
}
.radio-now { font-size: 14px; }
.radio-release-note { color: #9eabc0; font-size: 9px; }
.radio-station-label strong { font-size: 11px; }

.icon-btn:focus-visible,
.buy-btn:focus-visible,
.tab-btn:focus-visible,
.radio-toggle:focus-visible,
#radio-skip:focus-visible,
.panel-toggle:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 3px;
}

@media (max-width: 1100px) and (min-width: 761px) {
  #side-panel { width: 304px; }
  .stat { min-width: 98px; }
  .tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    overflow: visible;
  }
  .tab-btn {
    min-width: 0;
    padding-inline: 4px;
    font-size: 10px;
  }
}

@media (max-width: 760px) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  #app {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  #topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 9px 10px;
    min-height: 0;
    padding: 9px 12px 10px;
  }

  .brand-wrap {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
  }
  .brand { gap: 8px; font-size: 17px; white-space: nowrap; }
  .brand-mark { width: 34px; height: 34px; }
  .brand-tagline { display: none; }
  .top-actions {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
  }
  .icon-btn { width: 40px; height: 40px; }

  .stats {
    grid-column: 1 / -1;
    grid-row: 2;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    order: initial;
    width: 100%;
    gap: 6px;
    padding-top: 8px;
    border-top: 1px solid rgba(174, 185, 204, .14);
  }

  .stat {
    min-width: 0;
    min-height: 42px;
    padding: 6px 9px;
    border-radius: 10px;
  }
  .stat .label { font-size: 8px; }
  .stat span:last-child { font-size: 14px; }

  #game-area {
    flex: 1 1 auto;
    flex-direction: column;
    height: auto;
    min-height: 0;
    overflow: hidden;
  }

  #game-canvas {
    flex: 1 1 auto;
    width: 100%;
    height: auto;
    min-height: 0;
  }

  #side-panel {
    flex: 0 0 min(430px, 46vh);
    width: 100%;
    height: min(430px, 46vh);
    min-height: 0;
    border-top-color: rgba(174, 185, 204, .2);
    box-shadow: 0 -18px 40px rgba(0, 0, 0, .34);
  }

  #side-panel.mobile-collapsed {
    flex-basis: 0;
    height: 0;
  }

  .panel-toggle.visible {
    top: auto;
    right: 12px;
    bottom: 12px;
    min-height: 44px;
    padding: 0 14px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--color-tomato), #ff9167);
  }

  .panel-toggle.visible[aria-expanded="true"] {
    bottom: calc(min(430px, 46vh) + 10px);
  }

  #left-hud-stack {
    top: 9px;
    left: 9px;
    width: min(220px, calc(100% - 18px));
  }
  .objective-card { width: min(220px, calc(100vw - 18px)); }
  #toast-container { width: min(230px, calc(100vw - 18px)); }
  .scene-support-card { right: 9px; bottom: 72px; width: 168px; }

  #game-area:has(#side-panel:not(.mobile-collapsed)) .scene-support-card,
  #game-area:has(#side-panel:not(.mobile-collapsed)) .rival-mascot-stage {
    display: none;
  }

  footer#radio-bar {
    display: grid;
    grid-template-columns: 40px 42px minmax(0, 1fr) 40px 40px;
    gap: 7px;
    min-height: 66px;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
  }

  .radio-station-label { display: none; }
  .radio-toggle,
  #radio-skip { width: 40px; height: 40px; min-height: 40px; }
  .radio-artwork { width: 42px; height: 42px; flex-basis: 42px; }
  .radio-info { min-width: 0; }
  .radio-now { gap: 5px; font-size: 12px; }
  .radio-now .badge { max-width: 74px; font-size: 8px; }
  .radio-progress { width: 100%; }

  .radio-release-note,
  .radio-links,
  .volume-control { display: none; }

  .radio-player-controls,
  .sfx-controls { display: contents; }

  .tabs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(68px, 1fr));
    overflow: visible;
    padding: 8px 10px 0;
  }
  .tab-btn {
    min-width: 0;
    min-height: 40px;
    padding: 8px 4px;
    font-size: 10px;
  }
}

@media (max-width: 390px) {
  .brand { font-size: 16px; }
  .top-actions { gap: 5px; }
  footer#radio-bar {
    grid-template-columns: 38px 40px minmax(0, 1fr) 38px 38px;
    gap: 5px;
    padding-inline: 7px;
  }
  .radio-toggle,
  #radio-skip { width: 38px; height: 38px; }
  .radio-artwork { width: 40px; height: 40px; }
}

/* Native pictogram language ------------------------------------------------ */
.ui-icon {
  display: inline-block;
  width: 1.15em;
  height: 1.15em;
  flex: 0 0 auto;
  overflow: visible;
  vertical-align: -.18em;
}

.icon-btn .ui-icon,
.panel-toggle .ui-icon { width: 19px; height: 19px; }
.pause-card > span .ui-icon { width: 30px; height: 30px; }
.radio-mark { width: 23px; height: 23px; }
.management-icon .ui-icon { width: 20px; height: 20px; }
.hub-hire-btn .ui-icon { width: 22px; height: 22px; }
.bay-tag .ui-icon { width: 13px; height: 13px; }
.row-title > .ui-icon { width: 15px; height: 15px; color: var(--color-mango); }
.rival-tactic-head .ui-icon { width: 12px; height: 12px; }

.rival-mascot-portrait {
  color: #07101f;
  font-size: initial;
}
.rival-mascot-portrait .rival-mark { width: 38px; height: 38px; stroke-width: 1.65; }

.zone-reveal-icon {
  color: var(--zone-accent);
  font-size: initial;
}
.zone-reveal-icon .zone-reveal-mark { width: 42px; height: 42px; stroke-width: 1.55; }
.zone-reveal-radio i { display: grid; place-items: center; }
.zone-reveal-radio .ui-icon { width: 18px; height: 18px; }

.artist-monogram {
  display: inline-grid;
  place-items: center;
  min-width: 1.7em;
  height: 1.7em;
  border: 1px solid color-mix(in srgb, var(--artist-accent, var(--color-grape)) 58%, transparent);
  border-radius: .5em;
  color: var(--artist-accent, var(--color-grape));
  background: color-mix(in srgb, var(--artist-accent, var(--color-grape)) 12%, transparent);
  font: 900 .72em/1 "DM Sans", sans-serif;
  letter-spacing: .03em;
}
.artist-monogram.mini { min-width: 24px; height: 24px; font-size: 9px; }

/* District cards now echo the map identity instead of sharing one treatment. */
.zone-row {
  position: relative;
  overflow: hidden;
  border-color: color-mix(in srgb, var(--zone-accent, var(--color-aqua)) 28%, rgba(174,185,204,.16));
  background:
    linear-gradient(112deg, color-mix(in srgb, var(--zone-accent, var(--color-aqua)) 9%, transparent), transparent 45%),
    rgba(11, 22, 40, .88);
}
.zone-row::after {
  content: "";
  position: absolute;
  inset: 0 0 auto auto;
  width: 74px;
  height: 74px;
  pointer-events: none;
  opacity: .09;
  background: repeating-linear-gradient(135deg, var(--zone-accent), var(--zone-accent) 1px, transparent 1px, transparent 8px);
  clip-path: polygon(34% 0,100% 0,100% 100%);
}
.zone-row .zone-icon {
  color: var(--zone-accent);
  border-color: color-mix(in srgb, var(--zone-accent) 40%, transparent);
  background: color-mix(in srgb, var(--zone-accent) 12%, rgba(5,10,22,.9));
  box-shadow: inset 0 0 18px color-mix(in srgb, var(--zone-accent) 8%, transparent);
}
.zone-personality-copy { margin-top: 9px; line-height: 1.48; }
.zone-facts,
.zone-hazards {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}
.zone-facts span,
.zone-hazard-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 23px;
  padding: 3px 7px;
  border: 1px solid rgba(174,185,204,.14);
  border-radius: 999px;
  color: #c7d0df;
  background: rgba(5,10,22,.5);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .02em;
}
.zone-hazard-tag { color: var(--color-mango); }
.zone-hazard-tag.is-clear { color: var(--color-mint); }
.zone-hazard-tag .ui-icon { width: 11px; height: 11px; }

@media (max-width: 760px) {
  .zone-personality-copy { font-size: 9px; }
  .zone-reveal-icon .zone-reveal-mark { width: 32px; height: 32px; }
  .rival-mascot-portrait .rival-mark { width: 30px; height: 30px; }
}

/* After-hours cartoon pass ------------------------------------------------- */
#topbar {
  border-bottom: 3px solid var(--cartoon-ink);
  box-shadow: 0 4px 0 rgba(83,216,201,.18), 0 11px 28px rgba(0,0,0,.26);
}

.brand-mark {
  border: 2px solid var(--cartoon-ink);
  border-radius: 15px 12px 17px 11px;
  box-shadow: 3px 4px 0 var(--cartoon-ink), 0 8px 22px rgba(255,111,112,.22);
  transform: rotate(-2deg);
}

.brand { letter-spacing: -.025em; text-shadow: 1px 2px 0 rgba(17,23,43,.7); }

.stat,
.icon-btn,
.radio-toggle,
#radio-skip {
  border: 2px solid var(--cartoon-ink);
  box-shadow: 2px 3px 0 rgba(3,7,17,.6), inset 0 1px rgba(255,255,255,.09);
}

.stat { border-radius: 14px 11px 15px 10px; }
.stat-icon { border: 1.5px solid var(--cartoon-ink); }

#side-panel {
  border-left: 3px solid var(--cartoon-ink);
  box-shadow: -5px 0 0 rgba(83,216,201,.12), -18px 0 42px rgba(0,0,0,.22);
}

.tab-btn {
  border: 2px solid transparent;
  border-bottom: 0;
  transform-origin: bottom center;
}
.tab-btn:hover { transform: translateY(-2px) rotate(-1deg); }
.tab-btn.active {
  border-color: var(--cartoon-ink);
  border-bottom: 0;
  box-shadow: 2px -2px 0 rgba(255,111,112,.22);
}

.zone-row,
.upgrade-row,
.skin-row,
.hub-row,
.achievement-row,
.panel-card,
.prestige-summary,
.settings-card,
.campaign-card,
.discover-card {
  border: 2px solid var(--cartoon-ink);
  border-radius: 17px 13px 18px 12px;
  box-shadow: 4px 5px 0 rgba(3,7,17,.62), inset 0 1px rgba(255,255,255,.06);
}

.zone-row:hover,
.upgrade-row:hover,
.skin-row:hover,
.hub-row:hover {
  transform: translate(-1px, -3px) rotate(-.25deg);
  box-shadow: 6px 8px 0 rgba(3,7,17,.64), inset 0 1px rgba(255,255,255,.08);
}

.management-icon {
  border: 2px solid var(--cartoon-ink);
  border-radius: 13px 10px 14px 9px;
  box-shadow: 2px 3px 0 rgba(3,7,17,.55), inset 0 1px rgba(255,255,255,.13);
  transform: rotate(-2deg);
}

.status-pill,
.zone-facts span,
.zone-hazard-tag,
.bay-tag,
.next-zone-tag {
  border-width: 1.5px;
  border-color: var(--cartoon-ink);
  box-shadow: 1px 2px 0 rgba(3,7,17,.46);
}

.buy-btn,
.popup-btn,
.zone-reveal-continue,
.panel-toggle.visible {
  border: 2px solid var(--cartoon-ink);
  border-radius: 13px 10px 14px 11px;
  box-shadow: 3px 4px 0 var(--cartoon-ink);
  transform: translate(-1px, -1px);
}
.buy-btn:hover:not(:disabled),
.popup-btn:hover,
.zone-reveal-continue:hover,
.panel-toggle.visible:hover {
  transform: translate(1px, 1px) rotate(-.4deg);
  box-shadow: 1px 2px 0 var(--cartoon-ink);
}

.objective-card,
#toast-container,
.scene-support-card,
.rival-mascot-card {
  border: 2px solid var(--cartoon-ink);
  border-radius: 16px 12px 17px 11px;
  box-shadow: 4px 5px 0 rgba(3,7,17,.68), 0 16px 38px rgba(0,0,0,.25);
}

.order-legend {
  border: 2px solid var(--cartoon-ink);
  border-radius: 11px 8px 12px 8px;
  box-shadow: 2px 3px 0 rgba(3,7,17,.55);
}

footer#radio-bar {
  border-top: 3px solid var(--cartoon-ink);
  box-shadow: 0 -4px 0 rgba(185,149,255,.12), 0 -14px 34px rgba(0,0,0,.28);
}

.radio-artwork {
  border: 2px solid var(--cartoon-ink);
  border-radius: 13px 10px 15px 9px;
  box-shadow: 3px 3px 0 rgba(3,7,17,.62);
  transform: rotate(-1.5deg);
}

.zone-reveal-card,
.pause-card,
.confirm-card,
.how-to-card {
  border: 3px solid var(--cartoon-ink);
  border-radius: 24px 18px 26px 17px;
  box-shadow: 8px 10px 0 var(--cartoon-ink), 0 28px 70px rgba(0,0,0,.46);
}

@media (max-width: 760px) {
  #side-panel { border-top: 3px solid var(--cartoon-ink); border-left: 0; }
  .zone-row:hover,
  .upgrade-row:hover,
  .skin-row:hover,
  .hub-row:hover { transform: none; }
}
