:root {
  color-scheme: dark;
  font-family: "Avenir Next", Avenir, "Segoe UI", sans-serif;
  --ink: #e8e9df;
  --muted: #a7ad9f;
  --paper: rgba(23, 27, 23, 0.94);
  --line: rgba(226, 231, 213, 0.18);
  --accent: #e0b75b;
  --danger: #d5785b;
  --drawer-collapsed-visible-height: 54px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body,
#map {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background: #171b17;
  color: var(--ink);
}

body.prologue-resources-hidden .resources {
  opacity: 0;
}

body.prologue-resources-hidden .mobile-resource-hud {
  opacity: 0;
  pointer-events: none;
}

body.resources-revealed .resources {
  animation: resources-reveal 900ms ease-out;
}

body.resources-revealed .mobile-resource-hud {
  animation: resources-reveal 900ms ease-out;
}

/* Potential perf hot spot: scout-away animates gradient/background and panel
   shadow paint during discovery travel. Prefer static states if scout runs feel
   heavy on low-end devices. */
body.scout-away #map::after {
  animation: anxious-map-pulse 760ms ease-in-out infinite alternate;
}

body.scout-away .dispatch-panel {
  animation: anxious-panel-pulse 760ms ease-in-out infinite alternate;
}

body.scout-away .run-status {
  border-color: rgba(224, 183, 91, 0.8);
  box-shadow: 0 0 22px rgba(224, 183, 91, 0.18);
}

body.scout-debrief .dispatch-panel {
  border-color: rgba(102, 200, 176, 0.7);
}

@keyframes anxious-map-pulse {
  from {
    background:
      radial-gradient(circle at center, transparent 30%, rgba(9, 12, 9, 0.42) 100%),
      repeating-linear-gradient(0deg, transparent 0, transparent 3px, rgba(0, 0, 0, 0.025) 4px);
  }
  to {
    background:
      radial-gradient(circle at center, transparent 20%, rgba(9, 12, 9, 0.68) 100%),
      repeating-linear-gradient(0deg, transparent 0, transparent 3px, rgba(224, 183, 91, 0.035) 4px);
  }
}

@keyframes anxious-panel-pulse {
  from {
    border-color: var(--line);
    box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.25);
  }
  to {
    border-color: rgba(224, 183, 91, 0.75);
    box-shadow: 0 -12px 46px rgba(224, 183, 91, 0.17);
  }
}

@keyframes resources-reveal {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  60% {
    opacity: 1;
    transform: translateY(0);
    filter: drop-shadow(0 0 12px rgba(224, 183, 91, 0.42));
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: none;
  }
}

#map {
  position: fixed;
  inset: 0;
}

.day-title-card {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-content: center;
  gap: 10px;
  color: var(--ink);
  background: #020302;
  text-align: center;
  pointer-events: none;
}

.day-title-card.visible {
  animation: day-title-card 1500ms ease-in-out forwards;
}

.day-title-card p {
  margin: 0;
}

.day-title-card p {
  color: var(--accent);
  font-size: 44px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

@keyframes day-title-card {
  0% {
    opacity: 0;
  }
  18%,
  72% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

.name-reveal-card {
  position: fixed;
  inset: 0;
  z-index: 82;
  display: grid;
  place-content: center;
  gap: 12px;
  color: var(--ink);
  background: rgba(2, 3, 2, 0.88);
  text-align: center;
  pointer-events: none;
}

.name-reveal-card.visible {
  animation: name-reveal-card 2100ms ease-in-out forwards;
}

.name-reveal-card p {
  margin: 0 0 2px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.name-reveal-row {
  display: grid;
  grid-template-columns: 70px minmax(0, 180px);
  align-items: baseline;
  gap: 16px;
}

.name-reveal-row span,
.name-reveal-row b {
  display: block;
}

.name-reveal-row span {
  color: var(--muted);
  font-size: 16px;
  font-weight: 800;
  text-align: right;
}

.name-reveal-row b {
  color: var(--ink);
  font-size: 34px;
  font-weight: 900;
  text-align: left;
}

@keyframes name-reveal-card {
  0% {
    opacity: 0;
    transform: scale(0.98);
  }
  16%,
  76% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1.01);
  }
}

#map::after {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  content: "";
  background:
    radial-gradient(circle at center, transparent 35%, rgba(9, 12, 9, 0.34) 100%),
    repeating-linear-gradient(0deg, transparent 0, transparent 3px, rgba(0, 0, 0, 0.025) 4px);
}

#map::before {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  content: "";
  background: #020302;
  opacity: 0;
}

body.prologue-day1-map-hidden #map::before {
  opacity: 1;
}

body.prologue-day1-map-hidden .maplibregl-control-container {
  display: none;
}

.maplibregl-marker,
.maplibregl-marker * {
  pointer-events: none !important;
}

.pharmacy-search-marker {
  --pharmacy-search-radius: 88px;
  position: relative;
  width: 0;
  height: 0;
  overflow: visible;
  pointer-events: none !important;
}

.pharmacy-search-marker-fill,
.pharmacy-search-marker-pulse {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--pharmacy-search-radius);
  height: var(--pharmacy-search-radius);
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.pharmacy-search-marker-fill {
  border: 3px solid #c96d73;
  background: rgba(201, 109, 115, 0.14);
  opacity: 0.78;
  box-shadow: 0 0 18px rgba(201, 109, 115, 0.16);
}

.pharmacy-search-marker-pulse {
  border: 2px solid rgba(242, 219, 165, 0.72);
  background: transparent;
  opacity: 0.42;
  transform: translate(-50%, -50%) scale(1.08);
}

.building-clear-marker {
  --clear-marker-ring-size: 28px;
  position: relative;
  width: 0;
  height: 0;
  overflow: visible;
  pointer-events: none !important;
}

.building-clear-marker-pulse,
.building-clear-marker-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--clear-marker-ring-size);
  height: var(--clear-marker-ring-size);
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.building-clear-marker-pulse {
  /* Potential perf hot spot: active building work can overlap with map source
     updates, so keep this pulse simple or static if operation UI gets janky. */
  border: 2px solid rgba(224, 183, 91, 0.8);
  background: rgba(224, 183, 91, 0.08);
  animation: building-clear-marker-pulse 1200ms ease-out infinite;
}

.building-clear-marker[data-mode="stakeout"] .building-clear-marker-pulse {
  animation-duration: 1500ms;
}

.building-clear-marker-ring {
  border: 4px solid rgba(224, 183, 91, 0.95);
  background: rgba(224, 183, 91, 0.06);
  box-shadow: 0 0 16px rgba(224, 183, 91, 0.2);
}

.building-clear-marker-label {
  position: absolute;
  left: 50%;
  top: calc(50% + 20px);
  max-width: 112px;
  color: #f2dba5;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.05;
  text-align: center;
  text-shadow:
    0 0 3px #252b24,
    0 0 3px #252b24,
    0 1px 2px rgba(0, 0, 0, 0.75);
  pointer-events: none;
  transform: translateX(-50%);
  white-space: normal;
}

@keyframes building-clear-marker-pulse {
  from {
    opacity: 0.46;
    transform: translate(-50%, -50%) scale(1.25);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -50%) scale(2);
  }
}

.noisemaker-ring-marker {
  position: relative;
  width: 0;
  height: 0;
  overflow: visible;
  pointer-events: none !important;
}

.noisemaker-ring-marker-pulse {
  /* Potential perf hot spot: each active noisemaker owns an infinite scaling
     ring, so stacked noisemakers multiply the animation cost. */
  position: absolute;
  left: 50%;
  top: 50%;
  width: 16px;
  height: 16px;
  border: 3px solid #66c8b0;
  border-radius: 50%;
  background: rgba(102, 200, 176, 0.05);
  animation: noisemaker-ring-marker-pulse 1800ms linear infinite;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

@keyframes noisemaker-ring-marker-pulse {
  from {
    opacity: 0.72;
    transform: translate(-50%, -50%) scale(1);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -50%) scale(8.25);
  }
}

#map-veil {
  position: fixed;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  pointer-events: none;
  background: #020302;
}

body:not(.map-booting):not(.fog-pending) #map-veil {
  display: none;
}

.map-veil-status {
  display: grid;
  gap: 6px;
  width: min(300px, calc(100vw - 48px));
  padding: 14px 16px;
  border: 1px solid rgba(224, 183, 91, 0.34);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(17, 21, 17, 0.92);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.42);
}

.map-veil-status b {
  color: var(--accent);
  font-size: 13px;
  text-transform: uppercase;
}

.map-veil-status span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.maplibregl-ctrl-bottom-right {
  bottom: calc(var(--drawer-visible-height, 120px) + 5px);
  transition: bottom 220ms ease;
}

.maplibregl-ctrl-attrib {
  font-size: 9px;
}

.topbar,
.resources,
.mobile-resource-hud,
.map-hint,
.poi-research-legend,
.dispatch-panel,
.utility-menu,
.event-log-panel,
.release-log-panel,
.chat-panel,
.toast {
  position: fixed;
  z-index: 5;
}

.utility-menu {
  top: calc(48px + env(safe-area-inset-top));
  right: 10px;
  z-index: 20;
  width: min(250px, calc(100% - 20px));
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(23, 27, 23, 0.98);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.32);
}

.utility-action {
  display: block;
  width: 100%;
  margin-top: 8px;
  min-height: 38px;
  color: var(--ink);
  text-align: left;
}

.report-lag-status {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--ink-soft, rgba(242, 219, 165, 0.75));
}

.report-lag-note {
  width: 100%;
  margin-top: 10px;
  padding: 8px;
  border: 1px solid rgba(242, 219, 165, 0.22);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.035);
  font: inherit;
  resize: vertical;
}

.report-lag-mute-toggle {
  margin-top: 8px;
}

.auth-menu-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px 10px;
  width: 100%;
  min-height: 48px;
  margin: 10px 0 8px;
  padding: 9px 10px;
  border: 1px solid rgba(242, 219, 165, 0.22);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.035);
  text-align: left;
}

.auth-menu-card:hover {
  border-color: rgba(242, 219, 165, 0.48);
  background: rgba(242, 219, 165, 0.08);
}

.auth-menu-card.signed-in {
  border-color: rgba(102, 200, 176, 0.36);
  background: rgba(102, 200, 176, 0.08);
}

.auth-menu-card span {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.auth-menu-card b {
  align-self: center;
  color: var(--accent);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.end-day-drawer-action {
  order: 999;
  width: 100%;
  flex-shrink: 0;
  margin-top: auto;
  justify-content: center;
}

.end-day-drawer-action.blocked-action {
  border-color: rgba(212, 83, 74, 0.55);
}

.build-version {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0 10px;
  color: var(--muted);
  font-size: 12px;
}

.build-version b {
  color: var(--ink);
}

.build-version code {
  margin-left: auto;
  padding: 2px 5px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
}

.poi-research-legend {
  display: none;
  top: calc(108px + env(safe-area-inset-top));
  left: 8px;
  gap: 5px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(23, 27, 23, 0.9);
  font-size: 10px;
}

body.show-poi-legend .poi-research-legend {
  display: grid;
}

.poi-research-legend b,
.poi-research-legend span,
.poi-research-legend small {
  display: flex;
  align-items: center;
  gap: 5px;
}

.poi-research-legend small {
  color: var(--muted);
}

.poi-research-legend i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.potential-dot {
  border: 1px solid #f2dba5;
  background: transparent;
}

.poi-research-legend .resource-icon {
  width: 12px;
  height: auto;
  color: var(--accent);
  font-size: 12px;
  font-style: normal;
  line-height: 1;
  text-align: center;
}

.research-poi-popup .maplibregl-popup-content {
  min-width: 190px;
  padding: 10px 12px;
  color: var(--ink);
  background: rgba(23, 27, 23, 0.98);
}

.research-poi-popup p,
.research-poi-popup h3,
.research-poi-popup span {
  display: block;
  margin: 0;
}

.research-poi-popup p {
  color: var(--accent);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.research-poi-popup h3 {
  margin: 3px 0 7px;
  font-size: 14px;
}

.research-poi-popup span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

@media (max-width: 759px) {
  .map-hint,
  .toast,
  .maplibregl-popup {
    display: none !important;
    pointer-events: none !important;
  }
}

.topbar {
  top: 0;
  left: 0;
  width: 100%;
  padding: calc(9px + env(safe-area-inset-top)) 12px 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: linear-gradient(to bottom, rgba(17, 21, 17, 0.96), rgba(17, 21, 17, 0.76), transparent);
  pointer-events: none;
}

.topbar h1 {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  min-width: 0;
}

.topbar h1 b {
  color: var(--accent);
  font-size: 17px;
  letter-spacing: 0.12em;
}

#game-clock {
  --clock-speed-color: var(--ink);
  --clock-pulse-duration: 1200ms;
  display: inline-flex;
  align-items: baseline;
  gap: 1px;
  color: var(--ink);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

#game-clock[data-time-state="paused"] {
  --clock-speed-color: #d5785b;
  color: #f2dba5;
}

#game-clock[data-time-state="slow"] {
  --clock-speed-color: var(--accent);
}

#game-clock[data-time-state="normal"] {
  --clock-speed-color: #76d6bf;
  color: #dff7ef;
  --clock-pulse-duration: 520ms;
}

.clock-colon {
  color: var(--clock-speed-color);
  animation: clockPulse var(--clock-pulse-duration) ease-in-out infinite;
  text-shadow: 0 0 10px currentColor;
}

#game-clock[data-time-state="paused"] .clock-colon {
  animation: none;
  opacity: 0.55;
}

@keyframes clockPulse {
  0%,
  100% {
    opacity: 0.42;
    transform: scale(0.92);
  }

  50% {
    opacity: 1;
    transform: scale(1.12);
  }
}

.time-controls {
  flex: 0 0 auto;
  display: flex;
  gap: 3px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(17, 21, 17, 0.84);
  pointer-events: auto;
}

.time-speed-button {
  --speed-color: var(--accent);
  min-width: 36px;
  height: 30px;
  padding: 0 8px;
  border: 0;
  border-radius: 5px;
  color: var(--muted);
  background: transparent;
  font-size: 11px;
  font-weight: 800;
}

.time-speed-button[data-time-scale="paused"] {
  --speed-color: #d5785b;
  min-width: 34px;
  margin-right: 4px;
  border: 1px solid rgba(232, 233, 223, 0.28);
  color: var(--ink);
  background: rgba(232, 233, 223, 0.08);
}

.time-speed-button[data-time-scale="normal"] {
  --speed-color: #76d6bf;
}

.time-speed-button.active {
  color: #171b17;
  background: var(--speed-color);
}

.time-speed-button[data-time-scale="paused"].active {
  color: #f2dba5;
  border-color: rgba(213, 120, 91, 0.72);
  background: rgba(213, 120, 91, 0.22);
}

.chat-toggle {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  padding: 0 9px;
  color: var(--ink);
  font-weight: 700;
  pointer-events: auto;
}

.event-log-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.event-log-toggle b,
.chat-toggle b {
  display: inline-grid;
  min-width: 18px;
  min-height: 18px;
  place-items: center;
  border-radius: 50%;
  color: #171b17;
  background: var(--accent);
  font-size: 10px;
}

.chat-toggle b:empty,
.event-log-toggle b:empty {
  display: none;
}

.event-log-panel {
  top: calc(86px + env(safe-area-inset-top));
  right: 10px;
  z-index: 18;
  display: flex;
  flex-direction: column;
  width: min(360px, calc(100% - 20px));
  max-height: min(62vh, 520px);
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(23, 27, 23, 0.98);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.42);
}

.release-log-panel {
  top: calc(86px + env(safe-area-inset-top));
  right: 10px;
  z-index: 18;
  display: flex;
  flex-direction: column;
  width: min(520px, calc(100% - 20px));
  max-height: min(70vh, 680px);
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(23, 27, 23, 0.98);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.42);
}

.chat-panel {
  right: 10px;
  bottom: calc(var(--drawer-visible-height, 120px) + 12px);
  z-index: 17;
  display: flex;
  flex-direction: column;
  width: min(380px, calc(100% - 20px));
  max-height: min(58vh, 520px);
  padding: 12px;
  border: 1px solid rgba(224, 183, 91, 0.34);
  border-radius: 10px;
  background: rgba(23, 27, 23, 0.98);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.42);
}

.event-log-header,
.release-log-header,
.chat-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line);
}

.event-log-header h2,
.release-log-header h2,
.chat-header h2 {
  margin: 3px 0 0;
  font-size: 16px;
}

.event-log-list,
.release-log-list,
.chat-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  overflow-y: auto;
  padding-right: 2px;
}

.event-log-empty,
.release-log-empty,
.release-log-status,
.chat-empty {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.release-log-list {
  gap: 0;
}

.release-log-entry {
  display: grid;
  grid-template-columns: minmax(96px, 124px) minmax(0, 1fr);
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(226, 231, 213, 0.11);
}

.release-log-entry:last-child {
  border-bottom: 0;
}

.release-log-time {
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.35;
  text-transform: uppercase;
}

.release-log-main {
  min-width: 0;
}

.release-log-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
}

.release-log-title a {
  color: inherit;
  text-decoration: none;
}

.release-log-title a:hover,
.release-log-title a:focus-visible {
  color: var(--accent);
  text-decoration: underline;
}

.release-log-pr {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.release-log-highlight {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.chat-message {
  display: grid;
  gap: 4px;
  max-width: 94%;
  padding: 8px 9px;
  border: 1px solid rgba(226, 231, 213, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.chat-message.system {
  border-color: rgba(102, 200, 176, 0.24);
  background: rgba(102, 200, 176, 0.08);
}

.chat-message.urgent {
  border-color: rgba(224, 183, 91, 0.46);
  background: rgba(224, 183, 91, 0.08);
}

.chat-message header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.chat-speaker {
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
}

.chat-time {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chat-message p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.event-log-entry {
  display: grid;
  gap: 4px;
  padding: 8px;
  border: 1px solid rgba(226, 231, 213, 0.12);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.035);
}

.event-log-entry.urgent {
  border-color: rgba(224, 183, 91, 0.46);
  background: rgba(224, 183, 91, 0.08);
}

.event-log-entry header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.event-log-entry h3 {
  margin: 0;
  font-size: 12px;
}

.event-log-time {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.event-log-entry p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

@media (min-width: 760px) {
  body.chat-open .dispatch-panel {
    right: min(392px, 32vw);
  }

  .chat-panel {
    top: calc(54px + env(safe-area-inset-top));
    right: 10px;
    bottom: 10px;
    width: min(380px, 31vw);
    max-height: none;
  }
}

.eyebrow,
.section-label {
  margin: 0;
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

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

button:disabled {
  cursor: not-allowed;
}

button:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 2px solid rgba(224, 183, 91, 0.82);
  outline-offset: 2px;
}

.icon-button,
.text-button {
  border: 1px solid var(--line);
  background: rgba(25, 30, 25, 0.86);
}

.icon-button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 20px;
  pointer-events: auto;
}

.topbar h1 .icon-button {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  font-size: 18px;
}

.center-base-button {
  display: none;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  font-size: 17px;
}

.resources {
  position: static;
  display: none;
  gap: 4px;
  width: auto;
  margin-bottom: 8px;
  padding: 2px;
  overflow-x: auto;
  border: 1px solid rgba(226, 231, 213, 0.1);
  border-radius: 7px;
  background: rgba(17, 21, 17, 0.72);
  scrollbar-width: none;
}

.mobile-resource-hud[hidden] {
  display: none;
}

.resources span {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 3px 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
  background: rgba(23, 27, 23, 0.86);
  font-size: 10px;
  text-transform: uppercase;
}

.resources b {
  color: var(--ink);
}

.resources i {
  color: var(--muted);
  font-size: 8px;
  font-style: normal;
  letter-spacing: 0.06em;
}

.mobile-resource-hud {
  top: calc(50px + env(safe-area-inset-top));
  left: 8px;
  pointer-events: auto;
}

.mobile-resource-toggle {
  display: grid;
  gap: 4px;
  width: 50px;
  padding: 4px;
  border: 1px solid rgba(226, 231, 213, 0.14);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(17, 21, 17, 0.82);
  backdrop-filter: blur(12px);
  cursor: pointer;
  transition: width 180ms ease, border-color 180ms ease, background 180ms ease;
}

.mobile-resource-hud.expanded .mobile-resource-toggle {
  width: 138px;
  border-color: rgba(224, 183, 91, 0.34);
  background: rgba(17, 21, 17, 0.92);
}

.mobile-resource-toggle span {
  display: grid;
  grid-template-columns: 16px minmax(22px, 1fr);
  align-items: center;
  gap: 3px;
  min-height: 22px;
}

.mobile-resource-icon {
  position: relative;
  display: inline-block;
  width: 14px;
  height: 14px;
}

.mobile-resource-toggle b {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 11px;
  text-align: right;
  text-overflow: ellipsis;
}

.mobile-resource-toggle em {
  display: none;
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-resource-hud.expanded .mobile-resource-toggle span {
  grid-template-columns: 16px minmax(0, 1fr) auto;
}

.mobile-resource-hud.expanded .mobile-resource-toggle em {
  display: block;
}

.resource-food {
  border: 2px solid #d6b24a;
  transform: rotate(45deg) scale(0.74);
}

.resource-materials::before,
.resource-materials::after {
  position: absolute;
  content: "";
  border: 1px solid #a7ad9f;
  background: rgba(167, 173, 159, 0.34);
}

.resource-materials::before {
  top: 2px;
  left: 1px;
  width: 9px;
  height: 6px;
}

.resource-materials::after {
  right: 1px;
  bottom: 2px;
  width: 9px;
  height: 6px;
}

.resource-fuel {
  border-radius: 70% 45% 70% 45%;
  background: #7fb8a9;
  transform: rotate(45deg) scale(0.78);
}

.resource-medicine::before,
.resource-medicine::after {
  position: absolute;
  content: "";
  border-radius: 1px;
  background: #9fd08e;
}

.resource-medicine::before {
  top: 1px;
  left: 6px;
  width: 3px;
  height: 12px;
}

.resource-medicine::after {
  top: 6px;
  left: 1px;
  width: 12px;
  height: 3px;
}

.map-hint {
  top: calc(86px + env(safe-area-inset-top));
  left: 50%;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 32px);
  padding: 7px 8px 7px 11px;
  transform: translateX(-50%);
  border: 1px solid rgba(224, 183, 91, 0.4);
  border-radius: 20px;
  color: #f2dba5;
  background: rgba(32, 32, 24, 0.88);
  font-size: 12px;
  text-align: center;
  transition: opacity 180ms ease;
  pointer-events: auto;
}

.map-hint button {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 1px solid rgba(242, 219, 165, 0.28);
  border-radius: 50%;
  color: var(--muted);
  background: rgba(17, 21, 17, 0.72);
  font-size: 12px;
  line-height: 1;
}

body.toast-visible .map-hint {
  opacity: 0;
  pointer-events: none;
}

.dispatch-panel {
  position: fixed;
  display: flex;
  flex-direction: column;
  right: 0;
  bottom: 0;
  left: 0;
  max-height: min(68vh, calc(100vh - 116px));
  padding: 6px 14px calc(9px + env(safe-area-inset-bottom));
  overflow-y: auto;
  overscroll-behavior-y: contain;
  border-top: 1px solid var(--line);
  border-radius: 18px 18px 0 0;
  background: var(--paper);
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(16px);
  transform: translateY(0);
  transition: transform 220ms ease;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

.dispatch-panel.collapsed {
  padding-bottom: 0;
  transform: translateY(calc(100% - var(--drawer-collapsed-visible-height) - env(safe-area-inset-bottom)));
  overflow: hidden;
}

@supports (height: 100dvh) {
  .dispatch-panel {
    max-height: min(68dvh, calc(100dvh - 116px));
  }
}

.dispatch-panel.drawer-scrollable:not(.collapsed):not(.drawer-at-bottom)::after {
  position: sticky;
  order: 999;
  bottom: calc(-9px - env(safe-area-inset-bottom));
  display: block;
  height: 34px;
  margin: -34px -14px calc(-9px - env(safe-area-inset-bottom));
  pointer-events: none;
  content: "";
  background: linear-gradient(to bottom, rgba(23, 27, 23, 0), rgba(23, 27, 23, 0.94));
}

.grabber {
  position: absolute;
  z-index: 2;
  top: 8px;
  right: 12px;
  display: grid;
  width: 34px;
  height: 28px;
  margin: 0;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(242, 219, 165, 0.16);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
  font-size: 17px;
  font-weight: 900;
  line-height: 1;
}

.dispatch-panel.collapsed .grabber {
  width: 42px;
  color: #171b17;
  border-color: rgba(224, 183, 91, 0.58);
  background: var(--accent);
}

.dispatch-panel.collapsed .panel-heading {
  align-items: center;
}

.dispatch-panel.collapsed .panel-heading .eyebrow,
.dispatch-panel.collapsed .selection-detail,
.dispatch-panel.collapsed .state-guidance,
.dispatch-panel.collapsed .survivor-roster,
.dispatch-panel.collapsed .location-search,
.dispatch-panel.collapsed .territory-picker,
.dispatch-panel.collapsed #tile-section,
.dispatch-panel.collapsed #survivor-section,
.dispatch-panel.collapsed #clear-button {
  display: none;
}

.dispatch-panel.collapsed .panel-heading h2 {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer-tabs {
  display: none;
}

body.drawer-collapsed .maplibregl-ctrl-bottom-right {
  bottom: 73px;
}

.panel-heading {
  order: 20;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  padding-right: 42px;
}

.panel-heading h2 {
  margin: 3px 0 0;
  font-size: 18px;
}

.text-button {
  padding: 5px 9px;
  border-radius: 5px;
  color: var(--muted);
  font-size: 12px;
  transition:
    border-color 160ms ease,
    color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.text-button:hover,
.icon-button:hover {
  border-color: rgba(224, 183, 91, 0.52);
  color: var(--ink);
  background: rgba(35, 41, 35, 0.94);
}

.selection-detail {
  order: 21;
  margin: 4px 0 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.state-guidance {
  margin: 4px 0 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.cargo-summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 6px 0 10px;
  padding: 0;
  border: 0;
  background: transparent;
}

.cargo-summary span {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.cargo-summary b {
  font-size: 13px;
}

.building-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 7px;
}

.building-actions .dispatch-button {
  flex: 1 1 auto;
  min-width: 0;
}

.building-actions .stakeout-action {
  color: #10261f;
  background: #66c8b0;
  box-shadow: 0 0 0 1px rgba(191, 241, 229, 0.28) inset;
}

.building-debug {
  margin-top: 9px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
}

.building-debug summary {
  padding: 9px 0 0;
  color: var(--accent);
  cursor: pointer;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

#building-debug-fields {
  display: grid;
  gap: 5px;
  margin-top: 7px;
}

#building-debug-fields span {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 8px;
}

#building-debug-fields i {
  color: var(--muted);
  font-style: normal;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

#building-debug-fields b {
  color: var(--ink);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.discovery-route-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 8px 0;
  color: var(--muted);
  font-size: 11px;
}

.location-search {
  margin: 0 0 10px;
}

.location-search label {
  display: block;
  margin-bottom: 4px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.location-search div {
  display: flex;
  gap: 5px;
}

.location-search input {
  min-width: 0;
  flex: 1;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.04);
  font: inherit;
  font-size: 12px;
}

.location-search input:focus {
  border-color: var(--accent);
  outline: none;
}

.location-search small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
}

.gated-search-button {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 7px 9px;
  border: 1px solid rgba(242, 219, 165, 0.28);
  border-radius: 5px;
  color: var(--accent);
  background: rgba(242, 219, 165, 0.08);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.search-ready-button {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 7px 12px;
  border: 1px solid rgba(102, 200, 176, 0.36);
  border-radius: 5px;
  color: #bff1d8;
  background: rgba(102, 200, 176, 0.1);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.territory-picker {
  display: grid;
  gap: 6px;
  margin: 0 0 10px;
}

.territory-picker-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.territory-picker-heading span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.territory-list {
  display: grid;
  gap: 5px;
}

.territory-option {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px 8px;
  width: 100%;
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.035);
  text-align: left;
}

.territory-option:hover {
  border-color: rgba(224, 183, 91, 0.45);
  background: rgba(255, 255, 255, 0.055);
}

.territory-option.active {
  border-color: rgba(224, 183, 91, 0.76);
  background: rgba(224, 183, 91, 0.09);
}

.territory-option.generated-ready {
  animation: generated-territory-pulse 1300ms ease-in-out 5;
  border-color: rgba(159, 208, 142, 0.86);
  background: rgba(159, 208, 142, 0.1);
}

.territory-option:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.territory-label {
  overflow: hidden;
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.territory-ready {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: nowrap;
}

.territory-option.ready .territory-ready {
  color: #9fd08e;
}

.territory-note,
.territory-tile {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.25;
}

.territory-note {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.poi-load-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  margin-top: 6px;
}

.poi-load-row .text-button {
  flex: 1;
  color: var(--ink);
}

.poi-load-row span {
  color: var(--muted);
  font-size: 9px;
  white-space: nowrap;
}

.poi-load-row b {
  color: var(--ink);
}

.route-editor {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.route-summary {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-top: 3px;
}

.route-summary span {
  color: var(--muted);
  font-size: 11px;
}

.route-summary b {
  font-size: 11px;
}

.route-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
}

.route-actions .text-button {
  color: var(--ink);
}

.route-actions .text-button.active {
  border-color: var(--accent);
  color: var(--accent);
}

.survivor-roster {
  order: 10;
  margin: 8px 0 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(226, 231, 213, 0.12);
}

#tile-section,
#building-section,
#survivor-section,
#discovery-section,
.territory-picker,
.location-search {
  order: 30;
}

.play-mode-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin: 8px 0 10px;
}

.play-mode-option {
  position: relative;
  overflow: hidden;
  min-width: 0;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: inherit;
  background: rgba(255, 255, 255, 0.025);
  text-align: left;
  cursor: pointer;
}

.play-mode-option.active {
  border-color: var(--accent);
  background: rgba(224, 183, 91, 0.1);
}

.play-mode-option b,
.play-mode-option span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.play-mode-option b {
  color: var(--ink);
  font-size: 11px;
}

.play-mode-option span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.play-mode-option.campaign-disabled {
  opacity: 0.74;
  cursor: not-allowed;
}

.play-mode-option.campaign-disabled::before {
  content: "";
  position: absolute;
  left: -10%;
  right: -10%;
  top: 50%;
  border-top: 2px solid rgba(255, 63, 63, 0.9);
  transform: rotate(-14deg);
  transform-origin: center;
  pointer-events: none;
}

.play-mode-option.campaign-disabled b,
.play-mode-option.campaign-disabled span {
  color: #ff8888;
}

.play-mode-lock-note {
  display: block;
  margin: 4px 2px 6px;
  color: #ff7b7b;
  font-size: 11px;
  font-weight: 700;
}

.play-mode-option.campaign-available {
  opacity: 1;
}

.survivor-roster-list {
  display: flex;
  gap: 7px;
  margin-top: 6px;
  padding: 1px 2px 6px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.survivor-roster-card {
  position: relative;
  display: grid;
  flex: 0 0 68px;
  grid-template-rows: 32px auto;
  justify-items: center;
  gap: 4px;
  min-width: 68px;
  width: 68px;
  padding: 6px 5px;
  scroll-snap-align: start;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: inherit;
  background: rgba(255, 255, 255, 0.025);
  text-align: center;
  cursor: pointer;
  overflow: hidden;
}

.survivor-roster-card::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3px;
  content: "";
  background:
    linear-gradient(
      to right,
      #e0b75b 0 calc(var(--survivor-health-ratio, 0) * 100%),
      rgba(224, 183, 91, 0.16) calc(var(--survivor-health-ratio, 0) * 100%) 100%
    );
}

.survivor-roster-card.selected {
  border-color: var(--accent);
  background: rgba(224, 183, 91, 0.1);
}

.survivor-roster-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.survivor-avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--survivor-stroke, rgba(242, 219, 165, 0.46));
  border-radius: 6px;
  color: var(--survivor-text, var(--ink));
  background: var(--survivor-fill, rgba(23, 27, 23, 0.88));
  font-size: 12px;
  font-weight: 700;
}

.survivor-roster-card b,
.survivor-roster-card span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.survivor-roster-card b,
.survivor-roster-card span:not(:first-of-type) {
  display: none;
}

.survivor-roster-card b {
  color: var(--ink);
  font-size: 12px;
}

.survivor-roster-card span {
  margin-top: 0;
  color: var(--muted);
  font-size: 10px;
}

.survivor-detail {
  margin-top: 7px;
}

.survivor-detail-accordion {
  border: 1px solid rgba(242, 219, 165, 0.18);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.025);
}

.survivor-detail-accordion summary {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 8px;
  color: var(--accent);
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  list-style: none;
}

.survivor-detail-accordion summary::-webkit-details-marker {
  display: none;
}

.survivor-detail-accordion summary::after {
  content: "v";
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 5px;
  color: #f6f4ea;
  background: rgba(255, 255, 255, 0.055);
  font-size: 12px;
  font-weight: 900;
  transition: transform 160ms ease;
}

.survivor-detail-accordion[open] summary::after {
  transform: rotate(180deg);
}

.survivor-detail-accordion summary b,
.survivor-detail-accordion summary span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.survivor-detail-accordion summary b {
  color: var(--accent);
  font-size: 11px;
}

.survivor-detail-accordion summary span,
.survivor-detail-grid span {
  color: var(--muted);
  font-size: 10px;
}

.survivor-detail-summary-health {
  display: none;
}

.survivor-detail-summary-background {
  color: var(--muted);
}

.survivor-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 10px;
  padding: 0 8px 8px;
}

.survivor-detail-grid b,
.survivor-detail-grid span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.survivor-detail-grid b {
  margin-top: 1px;
  color: var(--ink);
  font-size: 11px;
}

.survivor-detail-more {
  padding: 2px 0 7px;
}

.survivor-detail-more .survivor-detail-grid {
  margin-top: 2px;
}

.survivor-detail-alert {
  padding: 3px 5px;
  margin: -3px -5px;
  border-radius: 5px;
  animation: survivor-health-pulse 900ms ease-out 3;
}

.survivor-detail-alert span,
.survivor-detail-alert b {
  color: #ffd0bc;
}

@keyframes survivor-health-pulse {
  0% {
    background: rgba(240, 100, 69, 0.28);
    box-shadow: 0 0 0 0 rgba(240, 100, 69, 0.55);
  }

  100% {
    background: rgba(240, 100, 69, 0);
    box-shadow: 0 0 0 8px rgba(240, 100, 69, 0);
  }
}

.character-creation {
  display: grid;
  gap: 9px;
  margin: 0 0 10px;
  padding: 9px;
  border: 1px solid rgba(242, 219, 165, 0.18);
  border-radius: 7px;
  background: rgba(23, 27, 23, 0.72);
}

.character-creation-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.dispatch-panel.intake-open .panel-heading {
  display: none;
}

.character-creation-title {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.15;
}

.starter-load-status {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
  min-height: 20px;
  padding: 2px 7px;
  border: 1px solid rgba(242, 219, 165, 0.16);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.starter-load-status[data-status="ready"] {
  border-color: rgba(102, 200, 176, 0.44);
  color: #bff1d8;
  background: rgba(102, 200, 176, 0.1);
}

.starter-load-status[data-status="failed"] {
  border-color: rgba(240, 100, 69, 0.48);
  color: #ffd0bc;
  background: rgba(240, 100, 69, 0.1);
}

.starter-load-status i {
  display: grid;
  flex: 0 0 auto;
  width: 11px;
  height: 11px;
  place-items: center;
  border-radius: 50%;
  font-style: normal;
  line-height: 1;
}

.status-spinner {
  border: 2px solid rgba(242, 219, 165, 0.18);
  border-top-color: var(--accent);
  animation: status-spin 800ms linear infinite;
}

@keyframes status-spin {
  to {
    transform: rotate(360deg);
  }
}

.starter-step-panel {
  display: grid;
  gap: 8px;
}

.starter-step-panel[hidden] {
  display: none;
}

.starter-preset-list,
.starter-slot-list {
  display: grid;
  gap: 6px;
}

.starter-preset-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.starter-preset-option,
.starter-slot-option {
  min-width: 0;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: inherit;
  background: rgba(255, 255, 255, 0.025);
  text-align: left;
  cursor: pointer;
}

.starter-preset-option {
  min-height: 72px;
}

.starter-preset-option.active,
.starter-slot-option.active {
  border-color: var(--accent);
  background: rgba(224, 183, 91, 0.1);
}

.starter-slot-add {
  display: grid;
  place-items: center;
  min-height: 54px;
  border-color: rgba(102, 200, 176, 0.42);
  color: #bff1d8;
  background: rgba(102, 200, 176, 0.08);
  text-align: center;
}

.starter-slot-add:hover {
  border-color: rgba(102, 200, 176, 0.72);
  background: rgba(102, 200, 176, 0.14);
}

.starter-preset-option b,
.starter-preset-option span,
.starter-slot-option b,
.starter-slot-option span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.starter-preset-option b,
.starter-slot-option b {
  color: var(--ink);
  font-size: 11px;
}

.starter-slot-add b {
  color: #bff1d8;
  font-size: 20px;
  line-height: 1;
}

.starter-preset-option span,
.starter-slot-option span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.starter-slot-add span {
  color: #bff1d8;
}

.starter-slot-option span {
  white-space: nowrap;
}

.starter-back-button {
  justify-self: start;
}

.starter-roster-actions {
  display: grid;
  grid-template-columns: minmax(104px, 0.42fr) minmax(0, 1fr);
  gap: 7px;
}

.starter-roster-actions .text-button,
.starter-roster-actions .dispatch-button {
  min-height: 38px;
}

.starter-roster-panel,
.starter-slot-list {
  min-width: 0;
}

.starter-roster-panel {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid rgba(242, 219, 165, 0.16);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.025);
}

.starter-slot-list {
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.starter-editor {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  padding: 9px;
  border-top: 1px solid rgba(242, 219, 165, 0.22);
  background: rgba(2, 3, 2, 0.2);
}

.starter-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  order: 4;
}

.starter-detail-actions .text-button {
  flex: 1 1 120px;
}

.starter-detail-actions .text-button,
.dialog-actions .danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.starter-remove-button {
  border-color: rgba(240, 100, 69, 0.42);
  color: #ffd0bc;
  background: rgba(240, 100, 69, 0.08);
}

.starter-remove-button:hover {
  border-color: rgba(240, 100, 69, 0.72);
  background: rgba(240, 100, 69, 0.14);
}

.danger-button {
  background: #d5785b;
}

.starter-editor label {
  display: grid;
  gap: 3px;
  min-width: 0;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
}

.starter-hometown-field {
  grid-column: 1 / -1;
}

.starter-profession-field {
  grid-column: 1 / -1;
}

.starter-hometown-field span {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px;
  gap: 6px;
}

.starter-hometown-field .text-button {
  min-height: 31px;
  padding: 0;
}

.starter-editor input,
.starter-editor select {
  min-width: 0;
  width: 100%;
  min-height: 36px;
  padding: 6px 7px;
  border: 1px solid rgba(242, 219, 165, 0.2);
  border-radius: 6px;
  color: var(--ink);
  background: rgba(2, 3, 2, 0.62);
  font: inherit;
  font-size: 12px;
}

.starter-background-flavor {
  grid-column: 1 / -1;
  box-sizing: border-box;
  min-height: 82px;
  margin: 0;
  padding: 8px 9px;
  border: 1px solid rgba(242, 219, 165, 0.12);
  border-radius: 6px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.025);
  font-size: 11px;
  line-height: 1.45;
}

.skill-modifier {
  font-weight: 800;
}

.skill-modifier.positive {
  color: #9fe8ba;
}

.skill-modifier.negative {
  color: #f0a389;
}

.skill-modifier.neutral {
  color: rgba(167, 173, 159, 0.68);
}

.starter-skill-summary {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.starter-summary-label {
  grid-column: 1 / -1;
  margin: 2px 0 -3px;
  color: rgba(167, 173, 159, 0.74);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.starter-trait-section {
  grid-column: 1 / -1;
  display: grid;
  gap: 5px;
}

.starter-trait-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.starter-trait-none {
  color: rgba(167, 173, 159, 0.62);
  font-size: 10px;
}

.starter-skill-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  padding: 6px 7px 11px;
  border: 1px solid rgba(242, 219, 165, 0.14);
  border-radius: 6px;
  color: var(--muted);
  font-size: 10px;
  text-align: left;
}

.starter-skill-row::after {
  content: "";
  position: absolute;
  right: 7px;
  bottom: 4px;
  left: 7px;
  height: 3px;
  border-radius: 99px;
  pointer-events: none;
}

.starter-skill-row.level-1::after {
  background: linear-gradient(to right, #9fe8ba 1% 24%, transparent 24% 100%);
}

.starter-skill-row.level-2::after {
  background: linear-gradient(to right, #9fe8ba 1% 24%, transparent 24% 26%, #9fe8ba 26% 49%, transparent 49% 100%);
}

.starter-skill-row.level-3::after {
  background: linear-gradient(to right, #9fe8ba 1% 24%, transparent 24% 26%, #9fe8ba 26% 49%, transparent 49% 51%, #9fe8ba 51% 74%, transparent 74% 100%);
}

.starter-skill-row.level-4::after {
  background: linear-gradient(to right, #9fe8ba 1% 24%, transparent 24% 26%, #9fe8ba 26% 49%, transparent 49% 51%, #9fe8ba 51% 74%, transparent 74% 76%, #9fe8ba 76% 99%);
}

.starter-skill-row.empty {
  border-style: dashed;
  color: rgba(167, 173, 159, 0.42);
}

.starter-skill-row i {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.starter-skill-row.empty i {
  color: rgba(167, 173, 159, 0.42);
}

.starter-skill-formula {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
  color: rgba(167, 173, 159, 0.74);
  font-size: 10px;
}

.starter-skill-formula em {
  color: rgba(167, 173, 159, 0.68);
  font-style: normal;
}

.starter-skill-formula b {
  flex: 0 0 auto;
  min-width: 18px;
  margin-top: 0;
  color: var(--ink);
  font-size: 12px;
  text-align: right;
}

.starter-skill-row.empty .starter-skill-formula,
.starter-skill-row.empty .starter-skill-formula b {
  color: rgba(167, 173, 159, 0.42);
}

.starter-trait-row {
  min-width: 0;
  padding: 7px;
  overflow: hidden;
  border: 1px solid rgba(242, 219, 165, 0.14);
  border-radius: 6px;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.starter-trait-row.positive {
  border-color: rgba(102, 200, 176, 0.54);
  color: #bff1d8;
}

.starter-trait-row.negative {
  border-color: rgba(240, 100, 69, 0.56);
  color: #ffd0bc;
}

.survivor-list {
  display: flex;
  gap: 7px;
  margin-top: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.survivor-card {
  min-width: 116px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.025);
  text-align: left;
}

.survivor-card.selected {
  border-color: var(--accent);
  color: var(--ink);
  background: rgba(224, 183, 91, 0.1);
}

.survivor-card b,
.survivor-card span {
  display: block;
}

.survivor-card span {
  margin-top: 2px;
  font-size: 10px;
}

.scout-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 8px 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.scout-section b {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.dispatch-button {
  width: 100%;
  padding: 11px 14px;
  border: 0;
  border-radius: 7px;
  color: #221d10;
  background: var(--accent);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition:
    filter 160ms ease,
    transform 160ms ease;
}

.dispatch-button.generation-loading {
  position: relative;
  padding-left: 38px;
}

.dispatch-button.generation-loading::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 15px;
  width: 13px;
  height: 13px;
  margin-top: -8px;
  border: 2px solid rgba(34, 29, 16, 0.24);
  border-top-color: rgba(34, 29, 16, 0.82);
  border-radius: 50%;
  animation: status-spin 800ms linear infinite;
}

.dispatch-button.generation-ready-pulse {
  animation: generated-load-button-pulse 1100ms ease-in-out infinite;
  background: #9fd08e;
}

.dispatch-button:hover:not(:disabled) {
  filter: brightness(1.08);
}

.dispatch-button:disabled {
  opacity: 0.45;
}

.dispatch-button.generation-loading:disabled {
  opacity: 0.82;
}

@keyframes generated-load-button-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(159, 208, 142, 0.0);
    filter: brightness(1);
  }

  50% {
    box-shadow: 0 0 0 5px rgba(159, 208, 142, 0.18);
    filter: brightness(1.08);
  }
}

@keyframes generated-territory-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(159, 208, 142, 0.0);
  }

  50% {
    box-shadow: 0 0 0 4px rgba(159, 208, 142, 0.16);
  }
}

.building-actions .secondary-base-action {
  flex: 0 1 118px;
  width: auto;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.base-summary {
  display: grid;
  gap: 8px;
  margin: 8px 0 10px;
}

.base-summary > div {
  display: grid;
  gap: 5px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(23, 27, 23, 0.58);
}

.base-summary span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.base-summary i {
  font-style: normal;
}

.base-summary b {
  color: var(--ink);
}

.scenario-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 7px;
}

.scenario-actions .dispatch-button {
  grid-column: 1 / -1;
}

.discovery-actions {
  display: grid;
  gap: 8px;
}

.cutscene-thread {
  display: grid;
  gap: 12px;
  margin: 8px 0 12px;
}

.cutscene-thread-list {
  display: grid;
  align-content: start;
  gap: 9px;
  max-height: min(48vh, 430px);
  overflow-y: auto;
  padding: 2px 2px 4px;
  scrollbar-width: thin;
}

.cutscene-bubble {
  display: grid;
  gap: 3px;
  width: fit-content;
  max-width: 88%;
  padding: 9px 11px;
  border: 1px solid rgba(226, 231, 213, 0.12);
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.36;
}

.cutscene-bubble b {
  font-size: 11px;
  line-height: 1.1;
}

.cutscene-bubble span {
  overflow-wrap: anywhere;
}

.cutscene-bubble.other {
  justify-self: start;
  color: #f3f5eb;
  background: rgba(255, 255, 255, 0.08);
}

.cutscene-bubble.other b {
  color: #bda8ff;
}

.cutscene-bubble.self {
  justify-self: end;
  border-color: rgba(102, 200, 176, 0.32);
  color: #08251e;
  background: #bff1d8;
}

.cutscene-bubble.self b {
  color: #236857;
}

.cutscene-bubble.narrator {
  justify-self: center;
  max-width: 96%;
  border-color: rgba(226, 231, 213, 0.1);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.045);
  text-align: center;
}

.cutscene-bubble.current {
  border-color: rgba(224, 183, 91, 0.5);
}

.cutscene-thread-actions {
  display: grid;
  grid-template-columns: minmax(0, 0.6fr) minmax(0, 1fr);
  gap: 8px;
}

.cutscene-thread-actions .dispatch-button,
.cutscene-thread-actions .action-button {
  min-height: 40px;
}

.tactical-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-top: 8px;
}

.tactical-actions .active {
  border-color: rgba(102, 200, 176, 0.7);
  color: #bff1e5;
  background: rgba(102, 200, 176, 0.1);
}

.tactical-actions .action-button {
  display: grid;
  align-content: center;
  gap: 2px;
}

.tactical-actions .action-button small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.1;
}

.tactical-actions .action-button.resource-blocked {
  border-color: rgba(242, 219, 165, 0.14);
  color: rgba(226, 231, 213, 0.58);
  background: rgba(255, 255, 255, 0.018);
  cursor: not-allowed;
}

.tactical-actions .action-button.resource-flash {
  animation: resource-blocked-flash 720ms ease-out;
}

.action-button.resource-flash {
  animation: resource-blocked-flash 720ms ease-out;
}

@keyframes resource-blocked-flash {
  0% {
    border-color: rgba(240, 100, 69, 0.9);
    background: rgba(240, 100, 69, 0.16);
  }

  100% {
    border-color: rgba(242, 219, 165, 0.14);
    background: rgba(255, 255, 255, 0.018);
  }
}

.scout-section .action-button {
  flex: 0 0 auto;
}

.action-button {
  min-height: 40px;
  color: var(--ink);
}

.danger-action {
  border-color: var(--danger);
  color: #f2b7a5;
}

.run-status {
  margin: 9px 0;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.025);
}

.run-status div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 10px;
}

.run-status b {
  color: var(--ink);
}

.run-status progress {
  display: block;
  width: 100%;
  height: 5px;
  overflow: hidden;
  border: 0;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.1);
  accent-color: var(--accent);
}

.run-status progress::-webkit-progress-bar {
  background: rgba(255, 255, 255, 0.1);
}

.run-status progress::-webkit-progress-value {
  background: var(--accent);
}

.debug-details {
  margin-top: 5px;
  color: var(--muted);
  font-size: 9px;
}

.debug-details summary {
  width: max-content;
  margin-left: auto;
  cursor: pointer;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.debug-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 9px;
  margin-top: 4px;
}

.debug-stats span {
  white-space: nowrap;
}

.debug-stats b {
  color: var(--ink);
  font-weight: 600;
}

.debug-toggle {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  margin-top: 9px;
  color: #e690d7;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.debug-toggle input {
  accent-color: #d95dc5;
}

.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  top: calc(126px + env(safe-area-inset-top));
  left: 50%;
  max-width: calc(100% - 36px);
  padding: 8px 8px 8px 12px;
  transform: translate(-50%, -10px);
  border: 1px solid var(--line);
  border-radius: 7px;
  opacity: 0;
  background: rgba(23, 27, 23, 0.96);
  font-size: 12px;
  text-align: left;
  transition: 180ms ease;
  pointer-events: none;
}

.toast.visible {
  transform: translate(-50%, 0);
  opacity: 1;
  pointer-events: auto;
  cursor: pointer;
}

#toast-message {
  flex: 1 1 auto;
}

.toast-dismiss {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  font-size: 13px;
  line-height: 1;
}

.toast-copy {
  flex: 0 0 auto;
  min-height: 24px;
  padding: 0 9px;
  border: 1px solid rgba(187, 205, 168, 0.42);
  border-radius: 6px;
  color: var(--text);
  background: rgba(118, 154, 93, 0.18);
  font-size: 11px;
  font-weight: 700;
}

.toast-copy:hover {
  background: rgba(118, 154, 93, 0.28);
}

.cutscene-dialog,
.day-report,
.auth-dialog,
.auth-connected-dialog,
.end-day-dialog,
.starter-remove-dialog,
.tactical-confirm-dialog {
  width: min(360px, calc(100% - 28px));
  padding: 0;
  border: 1px solid rgba(224, 183, 91, 0.58);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(23, 27, 23, 0.98);
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.58);
}

.cutscene-dialog::backdrop,
.day-report::backdrop,
.auth-dialog::backdrop,
.auth-connected-dialog::backdrop,
.end-day-dialog::backdrop,
.starter-remove-dialog::backdrop,
.tactical-confirm-dialog::backdrop {
  background: rgba(0, 0, 0, 0.54);
}

.cutscene-dialog form,
.day-report form,
.auth-dialog form,
.auth-connected-dialog form,
.end-day-dialog form,
.starter-remove-dialog form,
.tactical-confirm-dialog form {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 18px;
}

.cutscene-dialog h2,
.day-report h2,
.auth-dialog h2,
.auth-connected-dialog h2,
.end-day-dialog h2,
.starter-remove-dialog h2,
.tactical-confirm-dialog h2 {
  margin: 0;
  font-size: 20px;
}

.cutscene-dialog {
  width: min(460px, calc(100% - 28px));
}

.auth-dialog {
  width: min(720px, calc(100% - 28px));
  max-height: min(760px, calc(100dvh - 28px));
  border-color: rgba(102, 200, 176, 0.58);
}

.auth-connected-dialog {
  width: min(540px, calc(100% - 28px));
  border-color: rgba(102, 200, 176, 0.58);
}

.auth-dialog form,
.auth-connected-dialog form {
  gap: 16px;
  padding: 22px;
}

.auth-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.auth-dialog-header .text-button {
  min-width: 72px;
  justify-content: center;
}

.auth-dialog-copy {
  display: grid;
  gap: 12px;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
}

.auth-dialog-copy p,
.auth-dialog-error,
.auth-dialog-note,
.auth-data-list {
  margin: 0;
}

.auth-data-list {
  display: grid;
  gap: 8px;
}

.auth-data-list div {
  display: grid;
  gap: 3px;
  padding: 9px 10px;
  border: 1px solid rgba(242, 219, 165, 0.16);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.035);
}

.auth-data-list dt {
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-data-list dd {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
}

.auth-connected-done {
  justify-self: start;
  width: auto;
}

.auth-dialog-note {
  padding: 9px 10px;
  border: 1px solid rgba(224, 183, 91, 0.36);
  border-radius: 7px;
  color: var(--accent);
  background: rgba(224, 183, 91, 0.08);
  font-size: 13px;
  line-height: 1.35;
}

.auth-dialog-error {
  padding: 10px 12px;
  border: 1px solid rgba(212, 83, 74, 0.62);
  border-radius: 6px;
  color: #ffd1cd;
  background: rgba(90, 27, 24, 0.28);
  font-size: 13px;
  line-height: 1.35;
}

.auth-discord-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: start;
  gap: 9px;
  width: auto;
  min-width: 0;
  color: #fff;
  background: #5865f2;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12) inset;
  letter-spacing: 0;
  text-transform: none;
}

.auth-discord-button:hover:not(:disabled) {
  filter: brightness(1.03);
  background: #4752c4;
}

.auth-discord-logo {
  display: inline-flex;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.auth-discord-logo svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.cutscene-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cutscene-progress {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
}

.cutscene-speaker {
  margin: 0 0 -4px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.cutscene-block {
  min-height: 112px;
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
}

.tactical-confirm-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.tactical-confirm-stats span {
  display: grid;
  gap: 3px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
}

.tactical-confirm-stats i {
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  text-transform: uppercase;
}

.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.tactical-confirm-dialog {
  width: min(280px, calc(100% - 24px));
  margin: auto 12px 12px auto;
  border-color: rgba(102, 200, 176, 0.62);
  box-shadow: 0 12px 38px rgba(0, 0, 0, 0.46);
}

.tactical-confirm-dialog::backdrop {
  background: rgba(0, 0, 0, 0.18);
}

.tactical-confirm-dialog form {
  gap: 8px;
  padding: 10px;
}

.tactical-confirm-dialog .section-label {
  margin-bottom: -2px;
}

.tactical-confirm-dialog h2 {
  font-size: 15px;
  line-height: 1.15;
}

.tactical-confirm-dialog .selection-detail {
  margin: 0;
  font-size: 11px;
  line-height: 1.35;
}

.tactical-confirm-dialog .action-button,
.tactical-confirm-dialog .dispatch-button {
  min-height: 34px;
  padding: 7px 8px;
  font-size: 11px;
}

.tactical-confirm-dialog .tactical-confirm-stats {
  gap: 6px;
}

.tactical-confirm-dialog .tactical-confirm-stats span {
  padding: 6px;
}

.day-report-body {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.day-report-body span {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.day-report-body .nested-report-row {
  margin-top: -3px;
  padding-left: 16px;
  font-size: 12px;
}

.day-report-body .muted-report-row {
  opacity: 0.68;
}

.day-report-body .positive-report-row b {
  color: #9fd08e;
}

.day-report-body .negative-report-row b {
  color: #e08278;
}

.tooltip-help {
  display: inline-grid;
  width: 16px;
  height: 16px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(226, 231, 213, 0.2);
  border-radius: 50%;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  font-size: 11px;
  line-height: 1;
}

.day-report-note {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.intel-popup .maplibregl-popup-content {
  padding: 10px 12px;
  border: 1px solid rgba(240, 100, 69, 0.65);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(23, 27, 23, 0.98);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.32);
  font-size: 11px;
}

.intel-popup strong {
  color: #f28b72;
  font-size: 12px;
}

.intel-popup p {
  margin: 4px 0 0;
  color: var(--muted);
}

@media (min-width: 760px) {
  :root {
    --desktop-panel-right: 0px;
    --desktop-panel-width: clamp(320px, 34vw, 390px);
    --desktop-panel-top: 0px;
    --desktop-map-left: 18px;
    --desktop-map-center: calc((100vw - var(--desktop-panel-right) - var(--desktop-panel-width)) / 2);
  }

  .topbar {
    justify-content: flex-start;
    gap: 14px;
    width: calc(100% - var(--desktop-panel-right) - var(--desktop-panel-width));
    padding: calc(13px + env(safe-area-inset-top)) 18px 28px;
  }

  .topbar h1 {
    flex: 0 0 auto;
    gap: 10px;
  }

  .center-base-button:not([hidden]) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .topbar h1 b {
    font-size: 21px;
  }

  #game-clock {
    font-size: 15px;
  }

  .time-controls {
    gap: 4px;
    padding: 3px;
  }

  .time-speed-button {
    min-width: 46px;
    height: 36px;
    font-size: 13px;
  }

  .time-speed-button[data-time-scale="paused"] {
    min-width: 42px;
    margin-right: 5px;
  }

  .chat-toggle {
    display: none;
    margin-left: auto;
    min-height: 38px;
    padding: 0 12px;
    font-size: 13px;
  }

  .icon-button {
    width: 42px;
    height: 42px;
  }

  .topbar h1 .icon-button {
    width: 38px;
    height: 38px;
    font-size: 20px;
  }

  body.chat-open .dispatch-panel {
    right: var(--desktop-panel-right);
  }

  .dispatch-panel {
    top: var(--desktop-panel-top);
    right: var(--desktop-panel-right);
    bottom: 0;
    left: auto;
    width: var(--desktop-panel-width);
    max-height: none;
    padding: calc(18px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom));
    border: 0;
    border-left: 1px solid var(--line);
    border-radius: 0;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.36);
    transform: none;
    touch-action: auto;
    scrollbar-color: rgba(224, 183, 91, 0.42) rgba(255, 255, 255, 0.06);
  }

  .drawer-tabs {
    display: none;
    gap: 4px;
    margin-bottom: 14px;
    padding: 3px;
    border: 1px solid rgba(226, 231, 213, 0.12);
    border-radius: 8px;
    background: rgba(17, 21, 17, 0.72);
  }

  .drawer-tab {
    flex: 1 1 0;
    min-width: 0;
    min-height: 32px;
    padding: 0 8px;
    border: 0;
    border-radius: 6px;
    color: var(--muted);
    background: transparent;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0;
  }

  .drawer-tab.active {
    color: #171b17;
    background: var(--accent);
  }

  .drawer-tab b {
    display: inline-grid;
    min-width: 17px;
    min-height: 17px;
    margin-left: 4px;
    place-items: center;
    border-radius: 50%;
    color: #171b17;
    background: #bff1d8;
    font-size: 10px;
  }

  .survivor-roster-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
    padding: 0;
    overflow: visible;
    scroll-snap-type: none;
  }

  .survivor-roster-card {
    grid-template-rows: none;
    grid-template-columns: 34px minmax(0, 1fr);
    justify-items: stretch;
    gap: 8px;
    min-width: 0;
    width: 100%;
    padding: 7px;
    text-align: left;
  }

  .survivor-roster-card b,
  .survivor-roster-card span:not(:first-of-type) {
    display: block;
  }

  .survivor-avatar {
    width: 34px;
    height: 34px;
  }

  .dispatch-panel[data-drawer-context="chat"] .location-search,
  .dispatch-panel[data-drawer-context="chat"] .territory-picker,
  .dispatch-panel[data-drawer-context="chat"] #tile-section,
  .dispatch-panel[data-drawer-context="chat"] #building-section,
  .dispatch-panel[data-drawer-context="chat"] #survivor-section,
  .dispatch-panel[data-drawer-context="chat"] #discovery-section,
  .dispatch-panel[data-drawer-context="chat"] .survivor-roster,
  .dispatch-panel[data-drawer-context="chat"] .selection-detail,
  .dispatch-panel[data-drawer-context="chat"] #clear-button {
    display: none !important;
  }

  .dispatch-panel[data-drawer-context="actions"] #chat-panel,
  .dispatch-panel[data-drawer-context="story"] #chat-panel {
    display: none !important;
  }

  .dispatch-panel[data-drawer-context="actions"] .cutscene-thread {
    display: none !important;
  }

  .dispatch-panel[data-drawer-context="story"] .location-search,
  .dispatch-panel[data-drawer-context="story"] .territory-picker,
  .dispatch-panel[data-drawer-context="story"] #tile-section,
  .dispatch-panel[data-drawer-context="story"] #building-section,
  .dispatch-panel[data-drawer-context="story"] #survivor-section,
  .dispatch-panel[data-drawer-context="story"] .survivor-roster,
  .dispatch-panel[data-drawer-context="story"] .selection-detail,
  .dispatch-panel[data-drawer-context="story"] #clear-button {
    display: none !important;
  }

  .panel-heading {
    align-items: center;
    padding-right: 0;
  }

  .panel-heading h2 {
    font-size: 20px;
    line-height: 1.15;
  }

  .selection-detail,
  .state-guidance {
    margin: 8px 0 12px;
    font-size: 13px;
  }

  .location-search {
    margin-bottom: 14px;
  }

  .location-search div {
    gap: 8px;
  }

  .location-search input {
    min-height: 40px;
    font-size: 13px;
  }

  .location-search small {
    font-size: 10px;
  }

  .grabber {
    display: none;
  }

  .building-actions,
  .route-editor,
  .scout-section,
  .cargo-summary,
  .discovery-route-summary {
    gap: 10px;
  }

  .building-actions {
    flex-wrap: wrap;
  }

  .building-actions .dispatch-button {
    min-width: 150px;
  }

  .building-actions .stakeout-action {
    flex-basis: 100%;
  }

  .scenario-actions,
  .discovery-actions,
  .tactical-actions {
    gap: 9px;
  }

  .cutscene-thread {
    margin-top: 12px;
  }

  .cutscene-thread-list {
    max-height: min(54vh, 520px);
    padding-right: 4px;
  }

  .cutscene-bubble {
    font-size: 14px;
    line-height: 1.38;
  }

  .cutscene-bubble.other {
    border-bottom-left-radius: 3px;
  }

  .cutscene-bubble.self {
    border-bottom-right-radius: 3px;
  }

  .cutscene-bubble.narrator {
    padding: 8px 10px;
    font-size: 12px;
  }

  .cutscene-bubble.summary {
    border-color: rgba(224, 183, 91, 0.28);
    color: #ddd7c4;
    background: rgba(224, 183, 91, 0.08);
  }

  .discovery-actions:has(#prologue-continue-button:not([hidden])) {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(226, 231, 213, 0.12);
  }

  #prologue-continue-button {
    border-radius: 8px;
    background: #bff1d8;
    box-shadow: 0 8px 22px rgba(102, 200, 176, 0.14);
  }

  .run-status {
    margin: 12px 0;
    padding: 10px;
  }

  .dispatch-button {
    min-height: 42px;
  }

  .resources {
    position: static;
    display: flex;
    gap: 6px;
    max-width: none;
    margin-bottom: 10px;
    padding: 3px;
    border: 1px solid rgba(226, 231, 213, 0.1);
    border-radius: 8px;
    background: rgba(17, 21, 17, 0.74);
    backdrop-filter: blur(12px);
  }

  .resources span {
    min-height: 28px;
    padding: 5px 8px;
    border-radius: 6px;
    font-size: 11px;
  }

  .resources i {
    font-size: 9px;
  }

  .mobile-resource-hud {
    display: none;
  }

  .map-hint {
    top: calc(72px + env(safe-area-inset-top));
    left: var(--desktop-map-center);
    max-width: min(520px, calc(100vw - var(--desktop-panel-width) - 110px));
    padding: 9px 11px 9px 14px;
    transform: translateX(-50%);
    border-radius: 8px;
    font-size: 13px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
  }

  .poi-research-legend {
    top: calc(122px + env(safe-area-inset-top));
    left: var(--desktop-map-left);
    padding: 9px 10px;
    border-radius: 8px;
    background: rgba(23, 27, 23, 0.94);
    font-size: 11px;
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.28);
  }

  .utility-menu {
    top: calc(70px + env(safe-area-inset-top));
    right: auto;
    left: 16px;
    width: 280px;
    border-radius: 8px;
  }

  .event-log-panel,
  .release-log-panel {
    top: calc(78px + env(safe-area-inset-top));
    right: auto;
    left: 16px;
    width: min(410px, 32vw);
    max-height: min(70vh, 680px);
    border-radius: 8px;
  }

  .release-log-panel {
    width: min(560px, calc(100vw - var(--desktop-panel-width) - 54px));
  }

  .chat-panel {
    position: static;
    z-index: auto;
    width: auto;
    max-height: none;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    box-shadow: none;
  }

  .toast {
    top: calc(92px + env(safe-area-inset-top));
    left: var(--desktop-map-center);
    max-width: min(520px, calc(100vw - var(--desktop-panel-width) - 110px));
    transform: translate(-50%, -10px);
  }

  .toast.visible {
    transform: translate(-50%, 0);
  }

  .maplibregl-ctrl-bottom-right {
    bottom: 12px;
    right: calc(var(--desktop-panel-right) + var(--desktop-panel-width) + 12px);
  }

  .maplibregl-ctrl-bottom-left {
    left: 12px;
    bottom: 8px;
  }

  .cutscene-dialog,
  .day-report,
  .end-day-dialog {
    width: min(500px, calc(100% - 48px));
  }

  .tactical-confirm-dialog {
    width: 320px;
    margin: auto 18px 18px auto;
  }
}
