/* ─── Reset & Base ───────────────────────────────────────────────── */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0a0a0a;
  --bg-card: linear-gradient(135deg, rgba(30, 24, 18, 0.8), rgba(22, 18, 14, 0.6));
  --text: #ffffff;
  --text-muted: #a0a0a0;
  --accent: #e08a3a;
  --accent-10: rgba(224, 138, 58, 0.1);
  --accent-15: rgba(224, 138, 58, 0.15);
  --accent-08: rgba(224, 138, 58, 0.08);
  --accent-06: rgba(224, 138, 58, 0.06);
  --accent-25: rgba(224, 138, 58, 0.25);
  --danger: #f85149;
  --danger-bg: rgba(248, 81, 73, 0.08);
  --success: #3fb950;
  --border: rgba(224, 138, 58, 0.08);
  --border-hover: rgba(224, 138, 58, 0.25);
  --card-shadow: none;
  --card-hover-shadow: 0 24px 48px rgba(0, 0, 0, 0.5);
  --input-bg: rgba(255, 255, 255, 0.05);
  --nav-bg: transparent;
  --nav-blur: none;
  --nav-border: none;
  --nav-position: relative;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  top: -200px;
  left: -200px;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(224, 138, 58, 0.06) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  bottom: -200px;
  right: -200px;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(224, 138, 58, 0.04) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ─── Nav ────────────────────────────────────────────────────────── */
nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 48px;
  position: var(--nav-position);
  background: var(--nav-bg);
  backdrop-filter: var(--nav-blur);
  -webkit-backdrop-filter: var(--nav-blur);
  border-bottom: var(--nav-border);
  z-index: 10;
}

.nav-logo {
  font-size: 20px;
  font-weight: 700;
  text-decoration: none;
  color: var(--text);
}

.nav-logo span { color: var(--accent); }

.nav-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-btn {
  background: none;
  border: 1px solid var(--accent-15);
  color: var(--text-muted);
  min-width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, color 0.2s;
  padding: 0 8px;
}

.nav-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.back-home {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 18px;
  transition: color 0.2s;
}

.back-home:hover { color: var(--accent); }

/* ─── Container ──────────────────────────────────────────────────── */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 48px 60px;
  flex: 1;
  position: relative;
  z-index: 1;
  width: 100%;
}

/* ─── Hero ────────────────────────────────────────────────────────── */
.hero {
  text-align: center;
  margin-bottom: 48px;
}

.hero-badge {
  display: inline-block;
  padding: 6px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--danger);
  background: var(--danger-bg);
  border: 1px solid rgba(248, 81, 73, 0.2);
  border-radius: 50px;
  margin-bottom: 20px;
}

.hero h1 {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -1px;
  margin-bottom: 12px;
}

.hero h1 span {
  color: var(--danger);
}

.hero p {
  font-size: 16px;
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.7;
  font-weight: 300;
}

/* ─── Section Titles ─────────────────────────────────────────────── */
.section-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title .title-icon {
  font-size: 22px;
}

.section-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 40px 0;
}

/* ─── Network Info Cards ─────────────────────────────────────────── */
.network-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 40px;
}

.net-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  text-align: center;
}

.net-card .label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.net-card .value {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
}

.net-card .sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ─── Scenario Toggle ────────────────────────────────────────────── */
.scenario-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.scenario-option {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  cursor: pointer;
  transition: border-color 0.3s, transform 0.2s;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.scenario-option:hover {
  border-color: var(--accent-25);
  transform: translateY(-2px);
}

.scenario-option.active {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(224, 138, 58, 0.08), rgba(224, 138, 58, 0.02));
}

.scenario-option input[type="radio"] {
  display: none;
}

.scenario-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.scenario-desc {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 300;
  line-height: 1.5;
}

.scenario-detail {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.7;
  font-weight: 300;
  margin-bottom: 0;
  padding: 0 4px;
}

/* ─── Simulation Panel ───────────────────────────────────────────── */
.sim-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px;
  margin-bottom: 40px;
}

.sim-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.sim-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sim-field.full-width {
  grid-column: 1 / -1;
}

.sim-field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.sim-field .input-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sim-field input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: var(--input-bg);
  border-radius: 3px;
  outline: none;
}

.sim-field input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--bg);
  box-shadow: 0 2px 8px rgba(224, 138, 58, 0.3);
}

.sim-field input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--bg);
  box-shadow: 0 2px 8px rgba(224, 138, 58, 0.3);
}

.sim-field .slider-value {
  font-size: 16px;
  font-weight: 600;
  color: var(--accent);
  min-width: 70px;
  text-align: right;
}

.sim-field input[type="number"],
.sim-field select {
  background: var(--input-bg);
  border: 1px solid var(--accent-15);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  font-weight: 500;
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
}

.sim-field input[type="number"]:focus,
.sim-field select:focus {
  border-color: var(--accent);
}

.sim-field select option {
  background: #1a1610;
  color: #ffffff;
}

/* ─── Results Grid ───────────────────────────────────────────────── */
.results-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

.result-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  text-align: center;
  transition: border-color 0.3s, transform 0.2s;
}

.result-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.result-card .label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.result-card .value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
}

.result-card.total {
  border-color: rgba(248, 81, 73, 0.3);
  background: linear-gradient(135deg, rgba(248, 81, 73, 0.08), rgba(248, 81, 73, 0.02));
}

.result-card.total .value {
  color: var(--danger);
  font-size: 28px;
}

.total-row {
  margin-bottom: 40px;
}

/* ─── Comparison Cards Grid ──────────────────────────────────────── */
.comp-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.comp-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  text-align: center;
  transition: border-color 0.3s, transform 0.2s;
}

.comp-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.comp-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.comp-count {
  font-size: 28px;
  font-weight: 700;
  color: var(--danger);
  line-height: 1.1;
}

.comp-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  margin: 4px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.comp-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-top: 4px;
}

/* ─── Charts ─────────────────────────────────────────────────────── */
.chart-section {
  margin-bottom: 40px;
}

.chart-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  overflow: hidden;
}

.chart-container canvas {
  display: block;
  width: 100%;
}

.chart-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  align-items: start;
}

.chart-main {
  min-width: 0;
}

.chart-side {
  width: 220px;
  flex-shrink: 0;
}

.breakdown-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-dot.asic { background: var(--accent); }
.legend-dot.energy { background: var(--danger); }

/* ─── Conclusion ─────────────────────────────────────────────────── */
.conclusion {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px;
  margin-bottom: 40px;
}

.conclusion h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--accent);
}

.conclusion p {
  font-size: 15px;
  line-height: 1.8;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.conclusion p:last-child {
  margin-bottom: 0;
}

.conclusion strong {
  color: var(--text);
  font-weight: 600;
}

/* ─── Footer ─────────────────────────────────────────────────────── */
footer {
  text-align: center;
  padding: 28px;
  color: var(--text-muted);
  font-size: 13px;
  border-top: 1px solid var(--border);
  position: relative;
  z-index: 1;
}

footer a {
  color: var(--text-muted);
  text-decoration: none;
}

footer a:hover { color: var(--accent); }

/* ─── Light Mode (system) ────────────────────────────────────────── */
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f9fb;
    --bg-card: #ffffff;
    --text: #1a2b3c;
    --text-muted: #7a8a98;
    --border: rgba(224, 138, 58, 0.08);
    --card-shadow: 0 1px 3px rgba(0, 40, 60, 0.04);
    --card-hover-shadow: 0 12px 32px rgba(0, 40, 60, 0.08);
    --input-bg: rgba(0, 0, 0, 0.04);
    --nav-bg: rgba(246, 249, 251, 0.85);
    --nav-blur: blur(16px);
    --nav-border: 1px solid rgba(224, 138, 58, 0.08);
    --nav-position: sticky;
  }

  body::before, body::after { display: none; }

  nav { top: 0; }

  .net-card, .result-card, .comp-card, .sim-panel,
  .chart-container, .conclusion {
    box-shadow: var(--card-shadow);
  }

  .result-card:hover, .comp-card:hover {
    box-shadow: var(--card-hover-shadow);
  }

  .sim-field select option {
    background: #ffffff;
    color: #1a2b3c;
  }
}

/* ─── Light Mode (manual override) ───────────────────────────────── */
html[data-theme="light"] {
  --bg: #f6f9fb;
  --bg-card: #ffffff;
  --text: #1a2b3c;
  --text-muted: #7a8a98;
  --border: rgba(224, 138, 58, 0.08);
  --card-shadow: 0 1px 3px rgba(0, 40, 60, 0.04);
  --card-hover-shadow: 0 12px 32px rgba(0, 40, 60, 0.08);
  --input-bg: rgba(0, 0, 0, 0.04);
  --nav-bg: rgba(246, 249, 251, 0.85);
  --nav-blur: blur(16px);
  --nav-border: 1px solid rgba(224, 138, 58, 0.08);
  --nav-position: sticky;
}

html[data-theme="light"] body::before,
html[data-theme="light"] body::after { display: none; }

html[data-theme="light"] nav { top: 0; }

html[data-theme="light"] .net-card,
html[data-theme="light"] .result-card,
html[data-theme="light"] .comp-card,
html[data-theme="light"] .sim-panel,
html[data-theme="light"] .chart-container,
html[data-theme="light"] .conclusion {
  box-shadow: var(--card-shadow);
}

html[data-theme="light"] .result-card:hover,
html[data-theme="light"] .comp-card:hover {
  box-shadow: var(--card-hover-shadow);
}

html[data-theme="light"] .sim-field select option {
  background: #ffffff;
  color: #1a2b3c;
}

/* ─── Dark Mode (manual override) ────────────────────────────────── */
html[data-theme="dark"] {
  --bg: #0a0a0a;
  --bg-card: linear-gradient(135deg, rgba(30, 24, 18, 0.8), rgba(22, 18, 14, 0.6));
  --text: #ffffff;
  --text-muted: #a0a0a0;
  --border: rgba(224, 138, 58, 0.08);
  --card-shadow: none;
  --card-hover-shadow: 0 24px 48px rgba(0, 0, 0, 0.5);
  --input-bg: rgba(255, 255, 255, 0.05);
  --nav-bg: transparent;
  --nav-blur: none;
  --nav-border: none;
  --nav-position: relative;
}

html[data-theme="dark"] body::before,
html[data-theme="dark"] body::after { display: block; }

html[data-theme="dark"] .sim-field select option {
  background: #1a1610;
  color: #ffffff;
}

/* ─── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
  nav { padding: 20px 24px; }
  .container { padding: 16px 24px 48px; }
  .hero h1 { font-size: 28px; }
  .hero p { font-size: 14px; }

  .network-grid { grid-template-columns: repeat(2, 1fr); }
  .scenario-toggle { grid-template-columns: 1fr; }
  .sim-grid { grid-template-columns: 1fr; }
  .sim-panel { padding: 24px; }
  .results-grid { grid-template-columns: repeat(2, 1fr); }
  .comp-grid { grid-template-columns: repeat(2, 1fr); }

  .chart-row {
    grid-template-columns: 1fr;
  }

  .chart-side {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 20px;
  }

  .chart-side canvas {
    width: 120px !important;
    height: 120px !important;
  }
}

@media (max-width: 480px) {
  nav { padding: 16px 20px; }
  .container { padding: 12px 16px 32px; }
  .hero h1 { font-size: 24px; }

  .network-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .net-card { padding: 14px; }
  .net-card .value { font-size: 18px; }

  .sim-panel { padding: 20px; }
  .results-grid { grid-template-columns: 1fr; }
  .comp-grid { grid-template-columns: 1fr; }

  .result-card .value { font-size: 20px; }
  .result-card.total .value { font-size: 24px; }
  .comp-count { font-size: 24px; }

  .chart-container { padding: 16px; }
}

@media (max-width: 360px) {
  .hero h1 { font-size: 22px; }
  .net-card .value { font-size: 16px; }
}
