:root {
  --bg: #090d13;
  --panel: #111823;
  --panel-2: #0e141e;
  --border: #223148;
  --text: #edf3ff;
  --muted: #9bb0cb;
  --accent: #55d8ff;
  --accent-2: #7effb3;
  --danger: #ff8c8c;
  --low: #1f2c45;
  --high: #73e2ff;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: "Segoe UI", "Inter", system-ui, -apple-system, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 0%, rgba(85, 216, 255, 0.14), transparent 32%),
    radial-gradient(circle at 88% 100%, rgba(126, 255, 179, 0.1), transparent 28%),
    var(--bg);
}

.app {
  width: min(1240px, calc(100% - 2rem));
  margin: 1rem auto 2rem;
  display: grid;
  gap: 1rem;
}

.panel {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem;
}

.header h1 {
  margin: 0;
  font-size: clamp(1.1rem, 1.6vw, 1.8rem);
}

.sub {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

h2,
h3,
p {
  margin: 0;
}

.counter-head,
.map-head,
.projection-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.8rem;
}

.controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

label {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-size: 0.82rem;
}

input,
select {
  width: 100%;
  color: var(--text);
  background: #0a111a;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.64rem;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(85, 216, 255, 0.2);
}

.counter-grid,
.projection-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
}

.metric-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.9rem;
  background: rgba(9, 14, 22, 0.58);
}

.metric-card h3 {
  margin-bottom: 0.5rem;
  letter-spacing: 0.02em;
}

.big-number {
  margin: 0.1rem 0 0.55rem;
  font-size: clamp(2rem, 4.5vw, 4rem);
  line-height: 1;
  letter-spacing: 0.01em;
  color: var(--accent);
  text-shadow: 0 0 16px rgba(85, 216, 255, 0.2);
  transition: transform 120ms ease;
}

.big-number.bump {
  transform: scale(1.008);
}

.stats-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.3rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.93rem;
}

.stats-row strong {
  font-variant-numeric: tabular-nums;
}

.note {
  margin-top: 0.7rem;
  color: #f5c181;
  font-size: 0.92rem;
}

.muted {
  color: var(--muted);
}

.legend-wrap {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.legend-gradient {
  width: 180px;
  height: 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: linear-gradient(90deg, var(--low), var(--high));
}

.legend-label {
  color: var(--muted);
  font-size: 0.75rem;
}

.map-shell {
  position: relative;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #090f18;
}

#world-map {
  width: 100%;
  height: auto;
  display: block;
}

.country-path {
  stroke: rgba(170, 196, 226, 0.25);
  stroke-width: 0.7;
  fill: #1a2640;
  transition: fill 160ms ease, stroke 120ms ease;
  cursor: pointer;
}

.country-path:hover {
  stroke: rgba(255, 255, 255, 0.65);
  stroke-width: 1;
}

.country-path.selected {
  stroke: var(--accent-2);
  stroke-width: 1.2;
}

.tooltip {
  position: fixed;
  z-index: 20;
  min-width: 220px;
  pointer-events: none;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid #3b4d66;
  background: rgba(6, 12, 20, 0.94);
  color: var(--text);
  font-size: 0.8rem;
  line-height: 1.4;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.35);
}

.slider-block {
  margin-bottom: 0.8rem;
}

#efficiency-slider {
  width: 100%;
}

.negative {
  color: var(--danger);
}

@media (max-width: 900px) {
  .controls,
  .counter-grid,
  .projection-grid {
    grid-template-columns: 1fr;
  }

  .legend-gradient {
    width: 120px;
  }
}
