/* ═══════════════════════════════════════════════════════════════════
   DFA Minimizer — Premium Black / Gold Theme
   ═══════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ─── Tokens ─── */
:root {
  --bg: #08080a;
  --bg-raised: #0f0f12;
  --bg-card: #131318;
  --bg-card-hover: #18181f;
  --bg-inset: #0c0c10;
  --bg-surface: #1a1a22;

  --border: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.1);

  --gold: #c9952e;
  --gold-light: #e8c36a;
  --gold-bright: #f5dfa0;
  --gold-dim: #8a6a20;
  --gold-glow: rgba(201, 149, 46, 0.15);
  --gold-glow-strong: rgba(201, 149, 46, 0.3);
  --gold-surface: rgba(201, 149, 46, 0.06);
  --gold-border: rgba(201, 149, 46, 0.18);

  --green: #4ade80;
  --green-dim: rgba(74, 222, 128, 0.12);
  --red: #f87171;
  --red-dim: rgba(248, 113, 113, 0.12);

  --cyan: #67e8f9;
  --cyan-dim: rgba(103, 232, 249, 0.12);
  --cyan-border: rgba(103, 232, 249, 0.25);

  --text: #eae6df;
  --text-mid: #a09a8f;
  --text-dim: #5c574f;
  --text-gold: var(--gold-light);

  --radius: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', monospace;
  --ease: cubic-bezier(.4, 0, .2, 1);
}

/* ─── Reset ─── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* ─── Background ambience ─── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 40% at 50% -5%, rgba(201, 149, 46, 0.06), transparent 70%),
    radial-gradient(ellipse 50% 30% at 80% 100%, rgba(201, 149, 46, 0.03), transparent 70%),
    radial-gradient(ellipse 40% 50% at 10% 50%, rgba(201, 149, 46, 0.02), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ═══════════════════════════════════════════════════════════════════
   HERO
   ═══════════════════════════════════════════════════════════════════ */
.hero {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 100px 24px 80px;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -80px;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 400px;
  background: radial-gradient(ellipse, rgba(201, 149, 46, 0.1) 0%, transparent 70%);
  pointer-events: none;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-border), transparent);
}

.hero-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 22px;
  background: linear-gradient(145deg, var(--gold) 0%, var(--gold-dim) 100%);
  font-size: 34px;
  margin-bottom: 28px;
  box-shadow:
    0 12px 40px rgba(201, 149, 46, 0.25),
    0 0 80px rgba(201, 149, 46, 0.1);
  position: relative;
}

.hero h1 {
  font-size: clamp(36px, 5vw, 52px);
  font-weight: 900;
  letter-spacing: -1.5px;
  line-height: 1.1;
  background: linear-gradient(145deg, var(--gold-bright) 0%, var(--gold) 50%, var(--gold-dim) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 16px;
  position: relative;
}

.hero .tagline {
  font-size: 17px;
  color: var(--text-mid);
  font-weight: 400;
  max-width: 500px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ═══════════════════════════════════════════════════════════════════
   CONTAINER
   ═══════════════════════════════════════════════════════════════════ */
.container {
  position: relative;
  z-index: 1;
  max-width: 880px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ═══════════════════════════════════════════════════════════════════
   SECTIONS
   ═══════════════════════════════════════════════════════════════════ */
.section {
  padding: 64px 0;
  position: relative;
}

.section+.section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-strong), transparent);
}

.section-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2.5px;
  color: var(--gold);
  margin-bottom: 16px;
}

.section-label .num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: var(--gold-surface);
  border: 1px solid var(--gold-border);
  font-size: 11px;
  font-weight: 800;
  color: var(--gold);
}

.section h2 {
  font-size: clamp(24px, 3.5vw, 32px);
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text);
  margin-bottom: 18px;
  line-height: 1.25;
}

.section p,
.section li {
  color: var(--text-mid);
  font-size: 15.5px;
  line-height: 1.85;
}

.section p+p {
  margin-top: 14px;
}

/* ─── Example name ─── */
.example-name {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--gold);
  margin-top: 8px;
  opacity: 0.8;
  font-weight: 500;
}

/* ─── Term highlight ─── */
.term {
  color: var(--gold-light);
  font-weight: 600;
}

/* ─── Card ─── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
  margin-top: 24px;
  transition: border-color .3s var(--ease), box-shadow .3s var(--ease);
}

.card:hover {
  border-color: var(--border-strong);
}

.card-gold {
  border-color: var(--gold-border);
  background: linear-gradient(160deg, rgba(201, 149, 46, 0.05) 0%, var(--bg-card) 50%);
  box-shadow: 0 0 40px rgba(201, 149, 46, 0.04);
}

/* ─── Highlight box ─── */
.highlight-box {
  background: var(--gold-surface);
  border-left: 3px solid var(--gold);
  padding: 18px 22px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 24px 0;
  font-size: 15px;
  color: var(--text);
  line-height: 1.8;
}

.highlight-box strong {
  color: var(--gold-light);
}

/* ─── KV Grid (DFA components) ─── */
.kv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 24px;
}

.kv-item {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: border-color .25s var(--ease), transform .25s var(--ease);
}

.kv-item:hover {
  border-color: var(--gold-border);
  transform: translateY(-2px);
}

.kv-item .kv-label {
  font-size: 13px;
  font-weight: 700;
  font-family: var(--mono);
  color: var(--gold);
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.kv-item .kv-value {
  font-size: 13.5px;
  color: var(--text-mid);
  line-height: 1.65;
}

/* ═══════════════════════════════════════════════════════════════════
   THEOREM
   ═══════════════════════════════════════════════════════════════════ */
.theorem-card {
  position: relative;
  background: linear-gradient(160deg, rgba(201, 149, 46, 0.07) 0%, rgba(201, 149, 46, 0.02) 40%, var(--bg-card) 100%);
  border: 1px solid var(--gold-border);
  border-radius: var(--radius);
  padding: 36px;
  margin-top: 24px;
  overflow: hidden;
}

.theorem-card::before {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 150px;
  height: 150px;
  background: radial-gradient(circle, rgba(201, 149, 46, 0.08), transparent 70%);
  pointer-events: none;
}

.theorem-card h3 {
  font-size: 19px;
  font-weight: 700;
  color: var(--gold-bright);
  margin-bottom: 14px;
}

.theorem-card .formal {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--gold-light);
  background: rgba(0, 0, 0, 0.4);
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(201, 149, 46, 0.1);
  margin: 16px 0;
  line-height: 2;
}

/* ─── Steps list ─── */
.steps-list {
  counter-reset: steps;
  list-style: none;
  padding: 0;
  margin-top: 24px;
}

.steps-list li {
  counter-increment: steps;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.steps-list li:last-child {
  border-bottom: none;
}

.steps-list li::before {
  content: counter(steps);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(145deg, var(--gold-surface), rgba(201, 149, 46, 0.12));
  border: 1px solid var(--gold-border);
  color: var(--gold);
  font-size: 13px;
  font-weight: 800;
  margin-top: 2px;
}

/* ═══════════════════════════════════════════════════════════════════
   EXAMPLE DFA
   ═══════════════════════════════════════════════════════════════════ */
.graph-container {
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}

.graph-container .graph-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--gold);
  padding: 16px 20px 0;
}

.graph-container svg {
  display: block;
}

/* Transition Table */
.trans-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
  margin-top: 14px;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.trans-table th {
  background: var(--gold-surface);
  color: var(--gold);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--gold-border);
}

.trans-table td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-family: var(--mono);
  font-size: 13.5px;
}

.trans-table tr:last-child td {
  border-bottom: none;
}

.trans-table tr:hover td {
  background: rgba(201, 149, 46, 0.03);
}

.state-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 13.5px;
}

.state-badge .indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.state-badge .indicator.start {
  background: var(--gold);
  box-shadow: 0 0 8px var(--gold-glow);
}

.state-badge .indicator.accept {
  background: var(--green);
  box-shadow: 0 0 8px var(--green-dim);
}

.state-badge .indicator.both {
  background: linear-gradient(135deg, var(--gold), var(--green));
}

/* ═══════════════════════════════════════════════════════════════════
   SPEED CONTROL SLIDER
   ═══════════════════════════════════════════════════════════════════ */
.speed-control {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  margin-top: 24px;
}

.speed-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.speed-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.3px;
}

.speed-value {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--gold-light);
  background: var(--gold-surface);
  border: 1px solid var(--gold-border);
  padding: 4px 12px;
  border-radius: 20px;
}

.slider-track {
  position: relative;
}

.slider-track input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--gold-dim) 0%, var(--gold-surface) 100%);
  outline: none;
  cursor: pointer;
}

.slider-track input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--gold-light), var(--gold));
  border: 2px solid var(--gold-bright);
  cursor: pointer;
  box-shadow:
    0 2px 8px rgba(201, 149, 46, 0.4),
    0 0 20px rgba(201, 149, 46, 0.15);
  transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.slider-track input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow:
    0 4px 16px rgba(201, 149, 46, 0.5),
    0 0 30px rgba(201, 149, 46, 0.2);
}

.slider-track input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--gold-light), var(--gold));
  border: 2px solid var(--gold-bright);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(201, 149, 46, 0.4);
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 500;
}

/* ─── Buttons ─── */
.btn-group {
  display: flex;
  gap: 14px;
  margin-top: 32px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 15px 32px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all .25s var(--ease);
  position: relative;
  overflow: hidden;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.btn-primary {
  background: linear-gradient(145deg, var(--gold-light) 0%, var(--gold) 50%, var(--gold-dim) 100%);
  color: #0a0a0a;
  box-shadow:
    0 6px 24px rgba(201, 149, 46, 0.3),
    0 0 60px rgba(201, 149, 46, 0.08);
  letter-spacing: 0.3px;
}

.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.15), transparent 60%);
  opacity: 0;
  transition: opacity .25s var(--ease);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow:
    0 12px 40px rgba(201, 149, 46, 0.4),
    0 0 80px rgba(201, 149, 46, 0.12);
}

.btn-primary:hover::before {
  opacity: 1;
}

.btn-primary:active:not(:disabled) {
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-mid);
  border: 1px solid var(--border-strong);
}

.btn-secondary:hover {
  border-color: var(--gold-border);
  color: var(--gold-light);
  background: rgba(201, 149, 46, 0.04);
}

.btn-accent {
  background: linear-gradient(145deg, rgba(103, 232, 249, 0.15), rgba(103, 232, 249, 0.05));
  color: var(--cyan);
  border: 1px solid var(--cyan-border);
  letter-spacing: 0.3px;
}

.btn-accent:hover {
  background: linear-gradient(145deg, rgba(103, 232, 249, 0.25), rgba(103, 232, 249, 0.1));
  box-shadow: 0 6px 24px rgba(103, 232, 249, 0.15), 0 0 40px rgba(103, 232, 249, 0.06);
  transform: translateY(-2px);
}

.btn-accent:active {
  transform: translateY(-1px);
}

.btn-sm {
  padding: 11px 22px;
  font-size: 13.5px;
}

/* ═══════════════════════════════════════════════════════════════════
   STEP-BY-STEP WALKTHROUGH
   ═══════════════════════════════════════════════════════════════════ */
#walkthrough-section {
  display: none;
}

#walkthrough-section.visible {
  display: block;
  animation: revealSection 0.6s var(--ease);
}

/* Progress dots */
.step-progress-bar {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 36px;
  padding: 4px 0;
  justify-content: center;
}

.step-pip {
  display: flex;
  align-items: center;
}

.step-pip .dot {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  border: 2px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--text-dim);
  transition: all .3s var(--ease);
  flex-shrink: 0;
}

.step-pip .dot.active {
  border-color: var(--gold);
  background: linear-gradient(145deg, var(--gold-surface), rgba(201, 149, 46, 0.15));
  color: var(--gold-light);
  box-shadow: 0 0 20px var(--gold-glow), 0 0 60px rgba(201, 149, 46, 0.06);
}

.step-pip .dot.done {
  border-color: transparent;
  background: linear-gradient(145deg, var(--gold), var(--gold-dim));
  color: #0a0a0a;
}

.step-pip .connector {
  width: 36px;
  height: 2px;
  background: var(--border-strong);
  transition: background .3s var(--ease);
}

.step-pip .connector.done {
  background: linear-gradient(90deg, var(--gold-dim), var(--gold));
}

/* ─── Step card ─── */
.step-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px;
  animation: fadeSlideIn 0.35s var(--ease);
}

.step-card .step-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.step-card .step-number {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--gold-light), var(--gold), var(--gold-dim));
  color: #0a0a0a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 900;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(201, 149, 46, 0.25);
}

.step-card .step-title {
  font-size: 21px;
  font-weight: 700;
  color: var(--text);
}

.step-card .step-explanation {
  background: var(--gold-surface);
  border: 1px solid var(--gold-border);
  border-radius: var(--radius-md);
  padding: 22px 24px;
  margin: 18px 0;
  font-size: 15px;
  line-height: 1.85;
  color: var(--text);
}

.step-card .step-explanation .explain-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--gold);
  margin-bottom: 10px;
}

.step-card .step-detail {
  font-size: 14px;
  color: var(--text-mid);
  line-height: 1.75;
  margin-top: 16px;
}

.step-card .step-detail strong {
  color: var(--text);
}

.step-card .step-detail code {
  font-family: var(--mono);
  font-size: 12.5px;
  background: rgba(201, 149, 46, 0.08);
  border: 1px solid var(--gold-border);
  padding: 3px 8px;
  border-radius: 5px;
  color: var(--gold-light);
}

/* ─── Step status (replaces step-nav) ─── */
.step-status {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 28px;
  gap: 12px;
}

.step-counter {
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 600;
  font-family: var(--mono);
}

/* ─── Pair table ─── */
.pair-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 18px;
  font-size: 13px;
  font-family: var(--mono);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.pair-table th {
  background: var(--gold-surface);
  color: var(--gold);
  padding: 10px 12px;
  text-align: center;
  font-weight: 700;
  border-bottom: 1px solid var(--gold-border);
}

.pair-table td {
  padding: 10px 12px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
  transition: all .25s var(--ease);
}

.pair-table tr:last-child td {
  border-bottom: none;
}

.pair-table td.marked {
  background: var(--red-dim);
  color: var(--red);
  font-weight: 700;
}

.pair-table td.equivalent {
  background: var(--green-dim);
  color: var(--green);
  font-weight: 700;
}

.pair-table td.just-marked {
  background: rgba(201, 149, 46, 0.18);
  color: var(--gold-bright);
  font-weight: 800;
  animation: pulseGold 0.5s var(--ease);
  box-shadow: inset 0 0 16px rgba(201, 149, 46, 0.12);
}

.pair-table td.pending-cell {
  color: var(--text-dim);
}

.pair-table td.comparing {
  background: var(--cyan-dim) !important;
  color: var(--cyan) !important;
  font-weight: 700;
  box-shadow: inset 0 0 20px rgba(103, 232, 249, 0.15), 0 0 12px rgba(103, 232, 249, 0.1);
  animation: pulseCompare 0.6s var(--ease);
  border: 1px solid var(--cyan-border);
}

.pair-table td.empty-cell {
  background: var(--bg-inset);
}

/* ─── Comparison info box ─── */
.comparison-info-box {
  background: linear-gradient(135deg, rgba(103, 232, 249, 0.06), rgba(103, 232, 249, 0.02));
  border: 1px solid rgba(103, 232, 249, 0.15);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin-top: 16px;
  font-size: 13px;
  font-family: var(--mono);
  color: var(--text);
  line-height: 1.7;
  min-height: 48px;
  transition: all 0.25s var(--ease);
  opacity: 0;
}

.comparison-info-box.visible {
  opacity: 1;
}

.comparison-info-box .compare-arrow {
  color: var(--cyan);
  font-weight: 700;
  margin-right: 6px;
}

.comparison-info-box .compare-check {
  font-weight: 700;
  margin-right: 6px;
}

/* ─── Partition display ─── */
.partition-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.partition-group {
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs);
  padding: 8px 16px;
  font-family: var(--mono);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  transition: all .25s var(--ease);
}

.partition-group.highlight {
  border-color: var(--gold-border);
  background: var(--gold-surface);
  color: var(--gold-light);
  box-shadow: 0 0 16px rgba(201, 149, 46, 0.06);
}

/* ═══════════════════════════════════════════════════════════════════
   FINAL RESULT
   ═══════════════════════════════════════════════════════════════════ */
#final-section {
  display: none;
}

#final-section.visible {
  display: block;
  animation: revealSection 0.6s var(--ease);
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 24px;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px 18px;
  text-align: center;
  transition: border-color .25s var(--ease);
}

.stat-card:hover {
  border-color: var(--gold-border);
}

.stat-value {
  font-size: 32px;
  font-weight: 900;
  background: linear-gradient(145deg, var(--gold-bright), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-family: var(--mono);
  letter-spacing: -1px;
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  margin-top: 8px;
}

/* ═══════════════════════════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════════════════════════ */
@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes revealSection {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulseGold {
  0% {
    box-shadow: inset 0 0 0 rgba(201, 149, 46, 0);
  }

  50% {
    box-shadow: inset 0 0 24px rgba(201, 149, 46, 0.25);
  }

  100% {
    box-shadow: inset 0 0 16px rgba(201, 149, 46, 0.12);
  }
}

@keyframes pulseCompare {
  0% {
    box-shadow: inset 0 0 0 rgba(103, 232, 249, 0), 0 0 0 rgba(103, 232, 249, 0);
  }

  50% {
    box-shadow: inset 0 0 24px rgba(103, 232, 249, 0.2), 0 0 16px rgba(103, 232, 249, 0.15);
  }

  100% {
    box-shadow: inset 0 0 20px rgba(103, 232, 249, 0.15), 0 0 12px rgba(103, 232, 249, 0.1);
  }
}

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .hero {
    padding: 60px 20px 50px;
  }

  .section {
    padding: 44px 0;
  }

  .result-grid {
    grid-template-columns: 1fr;
  }

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

  .btn-group {
    flex-direction: column;
  }

  .card {
    padding: 20px;
  }

  .step-card {
    padding: 24px;
  }

  .theorem-card {
    padding: 24px;
  }

  .kv-grid {
    grid-template-columns: 1fr;
  }
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--gold-dim);
}

/* ─── Selection ─── */
::selection {
  background: rgba(201, 149, 46, 0.25);
  color: var(--text);
}

/* ─── Focus ─── */
.btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}