:root {
  color-scheme: dark;
  --panel: rgba(10, 15, 19, 0.9);
  --panel-border: rgba(161, 206, 214, 0.22);
  --text: #eef7f8;
  --muted: #a9bec4;
  --accent: #45c7b8;
  --warn: #ffb545;
  --danger: #f0695d;
}

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

body {
  overflow: hidden;
  background: #071014;
  color: var(--text);
  font-family: "Microsoft JhengHei", "Noto Sans TC", "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

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

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

#controlPanel {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 10;
  width: min(360px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  box-sizing: border-box;
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(12px);
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-header h1 {
  margin: 0 0 4px;
  font-size: 21px;
  line-height: 1.2;
}

.panel-header span,
.panel-header strong {
  color: var(--muted);
  font-size: 12px;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

button {
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  background: rgba(69, 199, 184, 0.18);
  color: var(--text);
  cursor: pointer;
}

button:hover {
  background: rgba(69, 199, 184, 0.32);
}

.range-control {
  display: grid;
  gap: 8px;
  margin: 13px 0;
}

.range-control span {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
}

.range-control strong {
  color: var(--text);
  white-space: nowrap;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.time-presets {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: -4px 0 14px;
}

.time-presets button {
  min-height: 32px;
  padding: 4px 8px;
}

.toggle-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  margin: 14px 0;
  font-size: 13px;
  color: var(--muted);
}

.hint-list {
  display: grid;
  gap: 4px;
  margin: 12px 0;
  color: var(--muted);
  font-size: 12px;
}

.status-line {
  min-height: 20px;
  color: var(--accent);
  font-size: 13px;
}

#crosshair {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 9;
  width: 18px;
  height: 18px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

#crosshair::before,
#crosshair::after {
  content: "";
  position: absolute;
  background: rgba(255, 255, 255, 0.8);
}

#crosshair::before {
  left: 8px;
  top: 0;
  width: 2px;
  height: 18px;
}

#crosshair::after {
  left: 0;
  top: 8px;
  width: 18px;
  height: 2px;
}

#crosshair.is-firing {
  animation: crosshair-fire 95ms ease-out;
}

#crosshair.is-firing::before,
#crosshair.is-firing::after {
  background: #fff2a8;
  box-shadow: 0 0 10px rgba(255, 181, 69, 0.85);
}

@keyframes crosshair-fire {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.7);
  }

  100% {
    opacity: 0.72;
    transform: translate(-50%, -50%) scale(1);
  }
}

#statsHud {
  position: absolute;
  left: 16px;
  bottom: 16px;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: calc(100vw - 32px);
}

#statsHud span {
  min-height: 28px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(8, 12, 16, 0.82);
  box-sizing: border-box;
  color: var(--muted);
  font-size: 13px;
}

#statsHud strong {
  color: var(--text);
}

@media (max-width: 760px) {
  #controlPanel {
    left: 10px;
    right: 10px;
    top: 10px;
    width: auto;
    max-height: 48vh;
  }

  #statsHud {
    left: 10px;
    right: 10px;
    bottom: 10px;
  }
}
