:root {
  --bg: #0b0e14;
  --panel: #111621;
  --card: #181f2e;
  --border: #283247;
  --text: #f3f6fc;
  --muted: #93a1b8;
  --orange: #ff6b35;
  --amber: #f7b801;
  --red: #ff3b5c;
  --cyan: #38bdf8;
}

* {
  box-sizing: border-box;
}

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

button, select, input {
  font: inherit;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.app-shell {
  display: grid;
  grid-template-columns: 1fr 410px;
  width: 100vw;
  height: 100dvh;
}

/* Interactive Map Area */
.map-viewport {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #070b12;
}

#map-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

.map-top-left {
  position: absolute;
  top: 18px;
  left: 20px;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.brand-badge {
  text-decoration: none;
  color: #ffffff;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.4px;
  padding: 8px 14px;
  background: rgba(17, 22, 33, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(10px);
  border-radius: 10px;
}

.brand-badge:hover {
  border-color: rgba(255, 255, 255, 0.35);
}

.city-picker select {
  background: rgba(17, 22, 33, 0.88);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(10px);
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.map-bottom-left {
  position: absolute;
  bottom: 20px;
  left: 20px;
  z-index: 15;
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

.zoom-controls {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.zoom-controls button {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(17, 22, 33, 0.85);
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
}

.zoom-controls button:hover {
  background: #232c40;
}

.scale-legend {
  background: rgba(17, 22, 33, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 6px 12px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.scale-bar {
  width: 44px;
  height: 5px;
  border: 1.5px solid #fff;
  border-top: none;
  display: inline-block;
}

.ring-legend {
  position: absolute;
  bottom: 20px;
  right: 20px;
  z-index: 15;
  background: rgba(17, 22, 33, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(8px);
  padding: 8px 14px;
  border-radius: 10px;
  display: flex;
  gap: 14px;
  font-size: 12.5px;
  font-weight: 600;
}

.ring-legend[hidden],
.panel-view[hidden] {
  display: none !important;
}

.ring-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ring-legend i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

/* Right Control Sidebar */
.control-sidebar {
  background: var(--panel);
  border-left: 1px solid var(--border);
  height: 100dvh;
  overflow-y: auto;
  padding: 24px 22px 32px;
}

.sidebar-header h1,
.sidebar-header h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 27px;
  margin: 0 0 6px;
  letter-spacing: -0.4px;
}

.sidebar-header p {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 13.5px;
}

.control-group {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 15px 16px;
  margin-bottom: 14px;
}

.group-title {
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  margin: 0 0 12px;
}

.material-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.mat-card {
  background: #101520;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 10px 4px;
  color: var(--text);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  transition: transform 0.12s, border-color 0.15s, background 0.15s;
}

.mat-card:hover {
  transform: translateY(-2px);
  border-color: #4b5d82;
}

.mat-card.active {
  border-color: var(--orange);
  background: rgba(255, 107, 53, 0.12);
}

.mat-sphere {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: block;
  box-shadow: inset -5px -5px 10px rgba(0, 0, 0, 0.65);
}

.mat-sphere.iron {
  background: radial-gradient(circle at 35% 30%, #cbd5e1, #475569 70%, #1e293b);
}

.mat-sphere.stone {
  background: radial-gradient(circle at 35% 30%, #d6ccc2, #7f6a58 70%, #3d312a);
}

.mat-sphere.carbon {
  background: radial-gradient(circle at 35% 30%, #64748b, #1e293b 70%, #090d16);
}

.mat-sphere.comet {
  background: radial-gradient(circle at 35% 30%, #e0f2fe, #38bdf8 65%, #0369a1);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.45), inset -4px -4px 8px rgba(0, 0, 0, 0.5);
}

.mat-sphere.gold {
  background: radial-gradient(circle at 35% 30%, #fef08a, #eab308 65%, #854d0e);
}

.mat-name {
  font-size: 11.5px;
  font-weight: 700;
}

.slider-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}

.slider-head label {
  font-size: 14px;
  font-weight: 700;
}

.slider-head strong {
  font-size: 14px;
  color: var(--amber);
  font-variant-numeric: tabular-nums;
}

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

.slider-sub {
  margin-top: 7px;
  font-size: 12px;
  color: var(--muted);
}

.launch-btn {
  width: 100%;
  padding: 16px 20px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, #ff6b35 0%, #f72585 100%);
  color: #ffffff;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  margin-top: 6px;
  box-shadow: 0 8px 24px rgba(255, 107, 53, 0.35);
  transition: transform 0.12s, box-shadow 0.12s;
}

.launch-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(255, 107, 53, 0.5);
}

.launch-btn.reset {
  background: #253047;
  box-shadow: none;
  margin-top: 14px;
}

.launch-btn.reset:hover {
  background: #303e5c;
}

/* Aftermath Report Cards */
.impact-tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--orange);
  margin-bottom: 4px;
}

.report-cards {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.report-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 15px 16px;
}

.report-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin-bottom: 6px;
}

.report-stat {
  font-size: 22px;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 6px;
}

.report-desc {
  font-size: 13.5px;
  line-height: 1.5;
  color: #cbd5e1;
  margin: 0;
}

@media (max-width: 860px) {
  html, body {
    overflow: auto;
  }
  .app-shell {
    grid-template-columns: 1fr;
    height: auto;
  }
  .map-viewport {
    height: 52dvh;
  }
  .control-sidebar {
    height: auto;
    border-left: none;
    border-top: 1px solid var(--border);
  }
}
