:root {
  --glass: rgba(15, 20, 24, 0.78);
  --glass-strong: rgba(15, 20, 24, 0.90);
  --glass-border: rgba(252, 251, 247, 0.16);
  --glass-border-hover: rgba(252, 251, 247, 0.34);
  --text: #f8fafc;
  --muted: #b6c0c9;
  --teal: #0f766e;
  --teal-hover: #0d625c;
  --teal-bright: #5eead4;
  --amber-soft: #fde68a;
  --warn-text: #fecaca;
  --ok-text: #a7f3d0;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #101b24;
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

#map-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  cursor: crosshair;
  touch-action: none;
}

.hidden {
  display: none !important;
}

/* Top Floating HUD */
.hud-top {
  position: fixed;
  top: 16px;
  left: 16px;
  right: 16px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  pointer-events: none;
}

.hud-pill {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 0.48rem 0.85rem;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.34);
}

.hud-title-pill {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.12rem;
  padding: 0.5rem 0.95rem;
}

.top-prompt {
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.hud-title-pill h1 {
  margin: 0;
  font-family: Georgia, "Iowan Old Style", "Palatino Linotype", serif;
  font-size: 1.32rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

.hud-top-right {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.badge-challenge {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--amber-soft);
  font-variant-numeric: tabular-nums;
}

.badge-free {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--teal-bright);
}

.dev-toggle {
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--teal-bright);
  cursor: pointer;
}

.dev-toggle:hover {
  border-color: var(--glass-border-hover);
  background: var(--glass-strong);
}

/* Bottom Floating Action Dock */
.hud-bottom {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 38px;
  z-index: 20;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.dock-card {
  pointer-events: auto;
  width: fit-content;
  max-width: min(640px, 100%);
  background: var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 0.62rem 0.85rem;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.42);
}

.status-line {
  font-size: 0.88rem;
  line-height: 1.4;
  color: var(--text);
  margin-bottom: 0.55rem;
}

.status-ok {
  color: var(--ok-text);
}

.status-warn {
  color: var(--warn-text);
}

.insight-line {
  margin-top: -0.15rem;
  margin-bottom: 0.55rem;
  padding-top: 0.42rem;
  border-top: 1px solid rgba(255, 255, 255, 0.10);
  font-size: 0.82rem;
  line-height: 1.45;
  color: #e2e8f0;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
}

button {
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text);
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  padding: 0.46rem 0.88rem;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, opacity 120ms ease;
}

button:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.30);
}

button:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.btn-primary {
  background: #f8fafc;
  border-color: #f8fafc;
  color: #0f1418;
}

.btn-primary:hover:not(:disabled) {
  background: #e2e8f0;
  border-color: #e2e8f0;
}

.btn-teal {
  background: var(--teal);
  border-color: var(--teal);
  color: #f8fafc;
}

.btn-teal:hover:not(:disabled) {
  background: var(--teal-hover);
  border-color: var(--teal-hover);
}

.btn-ghost {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.14);
  color: var(--muted);
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

/* Dev-Only Floating Atlas Drawer (`?dev=1`) */
.dev-drawer {
  position: fixed;
  top: 70px;
  right: 16px;
  bottom: 16px;
  width: 268px;
  z-index: 25;
  display: flex;
  flex-direction: column;
  background: var(--glass-strong);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 0.85rem;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
}

.dev-drawer-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.55rem;
}

.dev-drawer-header h2 {
  margin: 0;
  font-size: 0.94rem;
  font-weight: 700;
}

.sidebar-count {
  font-size: 0.74rem;
  color: var(--muted);
}

.region-search {
  width: 100%;
  margin-bottom: 0.55rem;
  padding: 0.44rem 0.65rem;
  font-family: inherit;
  font-size: 0.82rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 7px;
  outline: none;
}

.region-search:focus {
  border-color: var(--teal-bright);
  background: rgba(255, 255, 255, 0.11);
}

.region-search::placeholder {
  color: var(--muted);
}

.region-list {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  overflow-y: auto;
}

.region-item {
  width: 100%;
  text-align: left;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.42rem 0.6rem;
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.region-item:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
}

.region-item.active {
  border-color: var(--teal-bright);
  background: rgba(15, 118, 110, 0.34);
  font-weight: 600;
}

.region-item.played {
  color: var(--teal-bright);
}

/* Centered Floating Daily Summary Card */
.summary-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(8, 12, 16, 0.46);
  backdrop-filter: blur(4px);
}

.summary-card {
  width: min(440px, 100%);
  background: var(--glass-strong);
  border: 1px solid rgba(94, 234, 212, 0.35);
  border-radius: 14px;
  padding: 1.15rem 1.25rem;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
}

.summary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.summary-sub {
  font-size: 0.9rem;
  color: var(--teal-bright);
  margin-top: 0.18rem;
  font-weight: 600;
}

.summary-list {
  display: flex;
  flex-direction: column;
  gap: 0.38rem;
  font-size: 0.88rem;
  color: #e2e8f0;
  margin-bottom: 1rem;
}

.summary-footer {
  display: flex;
  gap: 0.55rem;
  justify-content: flex-end;
}

.sat-credit {
  position: fixed;
  right: 14px;
  bottom: 10px;
  z-index: 15;
  font-size: 0.68rem;
  color: rgba(248, 250, 252, 0.72);
  background: rgba(15, 20, 24, 0.58);
  padding: 0.2rem 0.48rem;
  border-radius: 5px;
  pointer-events: none;
}
