:root {
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.7);
  --bg-glass: rgba(255, 255, 255, 0.03);
  --border: rgba(255, 255, 255, 0.06);
  --border-glow: rgba(239, 68, 68, 0.2);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-red: #ef4444;
  --accent-orange: #f97316;
  --accent-yellow: #eab308;
  --accent-green: #22c55e;
  --accent-blue: #3b82f6;
  --accent-purple: #8b5cf6;
  --accent-cyan: #06b6d4;
  --gradient-danger: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  --gradient-warn: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
  --gradient-critical: linear-gradient(135deg, #dc2626 0%, #7f1d1d 100%);
  --gradient-glass: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.02) 100%);
  --shadow-lg: 0 25px 50px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 40px rgba(239, 68, 68, 0.15);
  --radius: 16px;
  --radius-sm: 8px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(239, 68, 68, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(59, 130, 246, 0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(139, 92, 246, 0.03) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ===== NAVIGATION ===== */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: rgba(10, 14, 23, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.nav-brand .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent-red);
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  50% { opacity: 0.8; box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}

.nav-links {
  display: flex;
  gap: 4px;
  list-style: none;
}

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 6px;
  transition: all 0.2s;
  letter-spacing: 0.02em;
}

.nav-links a:hover, .nav-links a.active {
  color: var(--text-primary);
  background: rgba(255,255,255,0.06);
}

.nav-status {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent-red);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===== MAIN LAYOUT ===== */
main {
  position: relative;
  z-index: 1;
  padding: 72px 2rem 4rem;
  max-width: 1440px;
  margin: 0 auto;
}

section {
  margin-bottom: 3rem;
  scroll-margin-top: 72px;
}

/* ===== HERO / WW3PI GAUGE ===== */
.hero {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 2rem;
  margin-bottom: 3rem;
}

.hero-gauge {
  background: var(--gradient-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-glow);
}

.hero-gauge::before {
  content: '';
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: radial-gradient(circle at center, rgba(239, 68, 68, 0.06) 0%, transparent 60%);
  animation: rotate-glow 20s linear infinite;
}

@keyframes rotate-glow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.gauge-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  position: relative;
}

.gauge-number {
  font-size: 7rem;
  font-weight: 800;
  line-height: 1;
  position: relative;
  background: linear-gradient(135deg, #ef4444, #f97316);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.gauge-subtitle {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  margin-top: 0.5rem;
  position: relative;
}

.gauge-velocity {
  display: flex;
  gap: 2rem;
  margin-top: 1.5rem;
  position: relative;
}

.velocity-chip {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 4px 12px;
  border-radius: 20px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--accent-red);
}

.velocity-chip.positive { color: var(--accent-red); border-color: rgba(239,68,68,0.2); background: rgba(239,68,68,0.1); }
.velocity-chip.negative { color: var(--accent-green); border-color: rgba(34,197,94,0.2); background: rgba(34,197,94,0.1); }

.hero-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ===== CARDS ===== */
.card {
  background: var(--gradient-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  backdrop-filter: blur(10px);
  transition: border-color 0.3s, box-shadow 0.3s;
}

.card:hover {
  border-color: rgba(255,255,255,0.1);
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.card-title {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.card-badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
}

.badge-critical { background: rgba(239,68,68,0.15); color: #ef4444; }
.badge-warning { background: rgba(249,115,22,0.15); color: #f97316; }
.badge-info { background: rgba(59,130,246,0.15); color: #3b82f6; }
.badge-success { background: rgba(34,197,94,0.15); color: #22c55e; }

/* ===== SECTION HEADERS ===== */
.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 1.5rem;
}

.section-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.section-header .section-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border) 0%, transparent 100%);
}

.section-header .section-tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-muted);
  padding: 2px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
}

/* ===== GRID LAYOUTS ===== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1.5rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }

/* ===== HISTORICAL COMPARISON BARS ===== */
.history-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  font-size: 0.82rem;
}

.history-bar .label {
  width: 180px;
  text-align: right;
  color: var(--text-secondary);
  font-size: 0.78rem;
  flex-shrink: 0;
}

.history-bar .bar-track {
  flex: 1;
  height: 28px;
  background: rgba(255,255,255,0.03);
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}

.history-bar .bar-fill {
  height: 100%;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 10px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: white;
  transition: width 1.5s ease;
}

.history-bar .bar-fill.current { background: linear-gradient(90deg, #ef4444, #f97316); }
.history-bar .bar-fill.historical { background: rgba(100, 116, 139, 0.4); }
.history-bar .bar-fill.above { border: 1px solid rgba(239, 68, 68, 0.3); }

.current-marker {
  position: absolute;
  top: 0; bottom: 0;
  width: 2px;
  background: #ef4444;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
  z-index: 2;
}

/* ===== DOMAIN RADAR & SCORES ===== */
.domain-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.domain-row:last-child { border-bottom: none; }

.domain-name {
  width: 200px;
  font-size: 0.82rem;
  font-weight: 500;
  flex-shrink: 0;
}

.domain-bar-track {
  flex: 1;
  height: 8px;
  background: rgba(255,255,255,0.05);
  border-radius: 4px;
  overflow: hidden;
}

.domain-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 1.2s ease;
}

.domain-score {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  width: 40px;
  text-align: right;
  flex-shrink: 0;
}

.domain-weight {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  width: 40px;
  text-align: right;
  flex-shrink: 0;
}

/* ===== BAYESIAN TABLE ===== */
.bayes-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.bayes-table th {
  text-align: left;
  font-weight: 600;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}

.bayes-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  vertical-align: middle;
}

.bayes-table tr:hover td {
  background: rgba(255,255,255,0.02);
}

.bayes-table .var-name {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent-cyan);
}

.bayes-table .var-bar {
  width: 120px;
}

.mini-bar {
  height: 6px;
  background: rgba(255,255,255,0.05);
  border-radius: 3px;
  overflow: hidden;
}

.mini-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 1s ease;
}

.var-delta { font-family: var(--font-mono); font-size: 0.72rem; }
.var-delta.up { color: var(--accent-red); }
.var-delta.down { color: var(--accent-green); }
.var-delta.new { color: var(--accent-purple); }

/* ===== SCENARIO TABLE ===== */
.scenario-row {
  display: grid;
  grid-template-columns: 2fr 60px 80px 80px 1fr;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
  transition: background 0.2s;
}

.scenario-row:hover { background: rgba(255,255,255,0.02); }

.scenario-row .name { font-weight: 600; }
.scenario-row .mono {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-align: center;
}

.p90-bar {
  height: 6px;
  background: rgba(255,255,255,0.05);
  border-radius: 3px;
  overflow: hidden;
}

.p90-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--gradient-danger);
}

/* ===== MARKET CARDS ===== */
.metric-card {
  background: var(--gradient-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.2rem;
  text-align: center;
}

.metric-value {
  font-size: 1.8rem;
  font-weight: 800;
  font-family: var(--font-mono);
  margin: 0.3rem 0;
}

.metric-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.metric-delta {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  margin-top: 4px;
}

.metric-delta.negative { color: var(--accent-red); }
.metric-delta.positive { color: var(--accent-green); }

/* ===== WATCH SIGNALS ===== */
.signal-row {
  display: grid;
  grid-template-columns: 30px 1fr 80px 80px 60px;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  font-size: 0.8rem;
}

.signal-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
}

.signal-dot.red { background: #ef4444; box-shadow: 0 0 8px rgba(239,68,68,0.5); }
.signal-dot.yellow { background: #eab308; box-shadow: 0 0 8px rgba(234,179,8,0.5); }
.signal-dot.green { background: #22c55e; box-shadow: 0 0 8px rgba(34,197,94,0.5); }

/* ===== NAVAL FORCE TABLE ===== */
.force-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.force-table th {
  text-align: left;
  font-weight: 600;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}

.force-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

.force-table .asset-name { font-weight: 600; color: var(--accent-cyan); }

/* ===== INTERVENTION LADDER ===== */
.ladder-row {
  display: grid;
  grid-template-columns: 100px 60px 60px 1fr;
  gap: 10px;
  align-items: center;
  padding: 8px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  font-size: 0.8rem;
}

.ladder-level {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  text-align: center;
}

.level-high { background: rgba(239,68,68,0.15); color: #ef4444; }
.level-med { background: rgba(249,115,22,0.15); color: #f97316; }
.level-low { background: rgba(34,197,94,0.15); color: #22c55e; }

/* ===== MALDIVES IMPACT ===== */
.impact-meter {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.impact-meter .meter-label {
  width: 80px;
  font-size: 0.8rem;
  font-weight: 600;
  flex-shrink: 0;
}

.impact-meter .meter-track {
  flex: 1;
  height: 12px;
  background: rgba(255,255,255,0.05);
  border-radius: 6px;
  overflow: hidden;
}

.impact-meter .meter-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 1.2s ease;
}

.impact-meter .meter-value {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  width: 50px;
  text-align: right;
  flex-shrink: 0;
}

/* ===== REPORT VIEWER ===== */
.report-list {
  list-style: none;
}

.report-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.2s;
}

.report-item:hover { background: rgba(255,255,255,0.03); }

.report-item .icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: rgba(59,130,246,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.report-item .info { flex: 1; }
.report-item .info .title { font-weight: 600; font-size: 0.85rem; }
.report-item .info .meta { font-size: 0.72rem; color: var(--text-muted); }

/* ===== ALERT BANNER ===== */
.alert-banner {
  background: linear-gradient(90deg, rgba(239,68,68,0.1) 0%, rgba(249,115,22,0.05) 100%);
  border: 1px solid rgba(239,68,68,0.2);
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 2rem;
  font-size: 0.82rem;
}

.alert-banner .alert-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.alert-banner strong { color: var(--accent-red); }

/* ===== CANVAS CONTAINERS ===== */
.chart-container {
  position: relative;
  height: 300px;
  width: 100%;
}

/* ===== TIMELINE ===== */
.timeline-container {
  position: relative;
  padding-left: 30px;
}

.timeline-container::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 0; bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, var(--accent-red), var(--accent-orange), var(--accent-yellow));
}

.timeline-item {
  position: relative;
  padding: 12px 0 24px 20px;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -27px; top: 16px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--accent-red);
  border: 2px solid var(--bg-primary);
}

.timeline-item .day-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
}

.timeline-item .event {
  font-size: 0.82rem;
  font-weight: 500;
  margin-top: 2px;
}

/* ===== DECISION TREE ===== */
.tree-container {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-secondary);
  overflow-x: auto;
  padding: 1rem;
  white-space: pre;
  line-height: 1.5;
  background: rgba(0,0,0,0.2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* ===== NEW SECTIONS ===== */
#disconfirming ul li {
  margin-bottom: 8px;
  position: relative;
}
#disconfirming ul li::before {
  content: "—";
  position: absolute;
  left: -16px;
  color: var(--accent-blue);
}
#methodology h3 {
  color: var(--accent-blue);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
  .hero { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  main { padding: 72px 1rem 2rem; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .gauge-number { font-size: 4.5rem; }
  .nav-links { display: none; }
}

/* ===== ANIMATION ===== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-in {
  animation: fadeInUp 0.6s ease forwards;
  opacity: 0;
}

.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }
.delay-5 { animation-delay: 0.5s; }
