/* ======================================================
   TRANSFORMER VISUALIZER — styles.css
   Zero dependencies. Dark/Light theme via CSS variables.
   ====================================================== */

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ===== THEME VARIABLES ===== */
:root {
  --bg-primary: #0f1419;
  --bg-secondary: #151b23;
  --bg-tertiary: #1c2530;
  --bg-card: #1a222d;
  --bg-card-hover: #212b38;
  --text-primary: #f0f4f8;
  --text-secondary: #a8b8c8;
  --text-muted: #6b7f94;
  --accent: #5cb8f0;
  --accent2: #8b9cf8;
  --accent-dim: rgba(92, 184, 240, 0.10);
  --accent-glow: rgba(92, 184, 240, 0.22);
  --accent2-dim: rgba(139, 156, 248, 0.10);
  --green: #4ade94;
  --green-dim: rgba(74, 222, 148, 0.10);
  --red: #f87171;
  --red-dim: rgba(248, 113, 113, 0.10);
  --purple: #b89afc;
  --purple-dim: rgba(184, 154, 252, 0.10);
  --amber: #fbbf24;
  --amber-dim: rgba(251, 191, 36, 0.10);
  --orange: #fb923c;
  --orange-dim: rgba(251, 146, 60, 0.10);
  --teal: #3de0cc;
  --teal-dim: rgba(61, 224, 204, 0.10);
  --pink: #f48cc8;
  --pink-dim: rgba(244, 140, 200, 0.10);
  --border: #253040;
  --border-light: #344458;
  --shadow: 0 4px 24px rgba(0,0,0,0.35);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: 0.3s ease;
  --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
}

[data-theme="light"] {
  --bg-primary: #f8f9fb;
  --bg-secondary: #eef1f5;
  --bg-tertiary: #dfe4eb;
  --bg-card: #ffffff;
  --bg-card-hover: #f4f6f9;
  --text-primary: #1a2332;
  --text-secondary: #4a5c6f;
  --text-muted: #8094a8;
  --accent: #1d6fb5;
  --accent2: #5254c7;
  --accent-dim: rgba(29, 111, 181, 0.07);
  --accent-glow: rgba(29, 111, 181, 0.16);
  --accent2-dim: rgba(82, 84, 199, 0.07);
  --green: #0f8a5f;
  --green-dim: rgba(15, 138, 95, 0.08);
  --red: #c93030;
  --red-dim: rgba(201, 48, 48, 0.07);
  --purple: #6b3fa0;
  --purple-dim: rgba(107, 63, 160, 0.07);
  --amber: #b57b00;
  --amber-dim: rgba(181, 123, 0, 0.07);
  --orange: #c54e0c;
  --orange-dim: rgba(197, 78, 12, 0.07);
  --teal: #0b7f74;
  --teal-dim: rgba(11, 127, 116, 0.07);
  --pink: #b52a6b;
  --pink-dim: rgba(181, 42, 107, 0.07);
  --border: #d4dae2;
  --border-light: #e4e9f0;
  --shadow: 0 4px 24px rgba(0,0,0,0.05);
}

/* ===== GLOBAL ===== */
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.65;
  transition: background var(--transition), color var(--transition);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--font-mono); font-size: 0.88em; }

/* ===== HEADER ===== */
.header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  position: sticky; top: 0; z-index: 100;
  transition: background var(--transition), border-color var(--transition);
}
.header-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  height: 56px;
}
.logo { font-size: 1.05rem; font-weight: 800; color: var(--accent); letter-spacing: -0.5px; white-space: nowrap; }
.logo span { color: var(--text-primary); font-weight: 600; }
.nav-tabs { display: flex; gap: 4px; list-style: none; }
.nav-tab {
  padding: 8px 18px; border-radius: 8px; cursor: pointer;
  font-size: 0.88rem; font-weight: 600; color: var(--text-secondary);
  transition: all var(--transition); border: none; background: none;
  position: relative; white-space: nowrap;
}
.nav-tab:hover { color: var(--text-primary); background: var(--accent-dim); }
.nav-tab.active { color: var(--accent); background: var(--accent-dim); }
.nav-tab.active::after {
  content: ''; position: absolute; bottom: -1px; left: 20%; width: 60%;
  height: 2px; background: var(--accent); border-radius: 1px;
}
.nav-tab .tab-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--bg-tertiary); font-size: 0.72rem; font-weight: 800; margin-right: 6px;
}
.nav-tab.active .tab-num { background: var(--accent); color: var(--bg-primary); }
.header-right { display: flex; align-items: center; gap: 10px; }
.theme-toggle {
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--bg-tertiary);
  color: var(--text-primary); font-size: 1.15rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.theme-toggle:hover { border-color: var(--accent); background: var(--accent-dim); }

/* ===== MAIN ===== */
.main {
  flex: 1; max-width: 1200px; width: 100%; margin: 0 auto;
  padding: 32px 24px 40px;
}
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeUp 0.4s ease; }

/* ===== STEP NAVIGATION ===== */
.step-nav-bar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 28px; gap: 12px;
}
.step-btn {
  padding: 9px 20px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-card);
  color: var(--text-primary); font-size: 0.88rem; font-weight: 600;
  cursor: pointer; transition: all var(--transition);
  display: inline-flex; align-items: center; gap: 6px;
}
.step-btn:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-dim); color: var(--accent); }
.step-btn:disabled { opacity: 0.25; cursor: not-allowed; }
.step-dots { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.step-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--border-light); cursor: pointer; transition: all var(--transition);
}
.step-dot.active { background: var(--accent); transform: scale(1.35); box-shadow: 0 0 8px var(--accent-glow); }
.step-dot:hover { background: var(--accent-glow); }
.breadcrumb { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 4px; }
.breadcrumb .current { color: var(--accent); font-weight: 600; }
.breadcrumb .sep { margin: 0 6px; opacity: 0.4; }

/* ===== SHARED COMPONENTS ===== */
.section-title { font-size: 1.55rem; font-weight: 800; margin-bottom: 8px; line-height: 1.3; }
.section-subtitle { font-size: 0.95rem; color: var(--text-secondary); margin-bottom: 24px; max-width: 700px; line-height: 1.7; }
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; transition: all var(--transition);
}
.analogy-card {
  background: var(--accent-dim); border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 14px 18px; margin-bottom: 20px; max-width: 680px;
}
.analogy-card p { font-size: 0.88rem; color: var(--text-secondary); line-height: 1.65; }
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.3px;
}
.badge-encoder  { background: rgba(96,165,250,0.15); color: #60a5fa; }
.badge-decoder  { background: var(--green-dim); color: var(--green); }
.badge-encdec   { background: var(--purple-dim); color: var(--purple); }
.badge-transformer { background: var(--accent-dim); color: var(--accent); }
.badge-ssm   { background: var(--amber-dim); color: var(--amber); }
.badge-rnn   { background: var(--teal-dim); color: var(--teal); }
.badge-hybrid { background: var(--orange-dim); color: var(--orange); }
.badge-moe   { background: var(--pink-dim); color: var(--pink); }
.badge-yes   { background: var(--green-dim); color: var(--green); }
.badge-no    { background: var(--red-dim); color: var(--red); }

/* ================================================================
   TAB 1: TOKENIZATION (single view)
   ================================================================ */
.tok-link-btn {
  padding: 7px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-card);
  color: var(--accent); font-size: 0.82rem; font-weight: 600;
  text-decoration: none; transition: all var(--transition);
  display: inline-flex; align-items: center; gap: 5px;
}
.tok-link-btn:hover { border-color: var(--accent); background: var(--accent-dim); text-decoration: none; }
.tok-section { margin-bottom: 32px; }
.tok-section-label {
  font-size: 0.72rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: 1.5px; color: var(--accent); margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
}
.tok-section-label .tok-step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%; background: var(--accent);
  color: var(--bg-primary); font-size: 0.7rem; font-weight: 800;
}
.tok-input-area { margin-bottom: 24px; }
.tok-paragraph-box {
  width: 100%; min-height: 80px; padding: 16px 20px;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--bg-card); color: var(--text-primary);
  font-family: inherit; font-size: 1rem; line-height: 1.7;
  resize: vertical; outline: none; transition: border-color var(--transition);
}
.tok-paragraph-box:focus { border-color: var(--accent); }
.tok-paragraph-box::placeholder { color: var(--text-muted); }
.tok-preset-row { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.tok-preset-btn {
  padding: 6px 14px; border-radius: 20px; font-size: 0.82rem;
  font-weight: 600; border: 1px solid var(--border); background: var(--bg-card);
  color: var(--text-secondary); cursor: pointer; transition: all var(--transition);
}
.tok-preset-btn:hover { border-color: var(--accent); color: var(--accent); }
.tok-preset-btn.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

/* Stats */
.tok-stats {
  display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; align-items: stretch;
}
.tok-stat {
  padding: 14px 18px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); text-align: center; flex: 1; min-width: 90px;
}
.tok-stat-num { font-size: 1.8rem; font-weight: 800; color: var(--accent); line-height: 1.2; }
.tok-stat-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 2px; }
.tok-stat-arrow { display: flex; align-items: center; font-size: 1.4rem; color: var(--text-muted); padding: 0 2px; }

/* Token chips */
.tok-chips-area {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 20px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); min-height: 56px;
}
.tok-chip {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  animation: chipPop 0.35s ease both;
}
@keyframes chipPop {
  from { opacity: 0; transform: scale(0.85) translateY(6px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.tok-chip-text {
  padding: 5px 13px; border-radius: 6px; font-weight: 600;
  font-size: 0.92rem; border: 1px solid rgba(255,255,255,0.06);
  white-space: pre; line-height: 1.4;
}
.tok-chip-id { font-size: 0.68rem; color: var(--text-muted); font-family: var(--font-mono); }

/* 12 chip colors */
.chip-c0  { background: rgba(96,165,250,0.18);  color: #93bbfc; }
.chip-c1  { background: rgba(52,211,153,0.18);  color: #6ee7b7; }
.chip-c2  { background: rgba(251,191,36,0.18);  color: #fcd34d; }
.chip-c3  { background: rgba(167,139,250,0.18); color: #c4b5fd; }
.chip-c4  { background: rgba(251,146,60,0.18);  color: #fdba74; }
.chip-c5  { background: rgba(244,114,182,0.18); color: #f9a8d4; }
.chip-c6  { background: rgba(45,212,191,0.18);  color: #5eead4; }
.chip-c7  { background: rgba(248,113,113,0.18); color: #fca5a5; }
.chip-c8  { background: rgba(163,230,53,0.18);  color: #bef264; }
.chip-c9  { background: rgba(129,140,248,0.18); color: #a5b4fc; }
.chip-c10 { background: rgba(232,121,249,0.18); color: #e879f9; }
.chip-c11 { background: rgba(34,211,238,0.18);  color: #67e8f9; }
[data-theme="light"] .chip-c0  { background: rgba(59,130,246,0.10);  color: #2563eb; }
[data-theme="light"] .chip-c1  { background: rgba(16,185,129,0.10);  color: #059669; }
[data-theme="light"] .chip-c2  { background: rgba(245,158,11,0.10);  color: #d97706; }
[data-theme="light"] .chip-c3  { background: rgba(139,92,246,0.10);  color: #7c3aed; }
[data-theme="light"] .chip-c4  { background: rgba(249,115,22,0.10);  color: #ea580c; }
[data-theme="light"] .chip-c5  { background: rgba(236,72,153,0.10);  color: #db2777; }
[data-theme="light"] .chip-c6  { background: rgba(20,184,166,0.10);  color: #0d9488; }
[data-theme="light"] .chip-c7  { background: rgba(239,68,68,0.10);   color: #dc2626; }
[data-theme="light"] .chip-c8  { background: rgba(132,204,22,0.10);  color: #65a30d; }
[data-theme="light"] .chip-c9  { background: rgba(99,102,241,0.10);  color: #4f46e5; }
[data-theme="light"] .chip-c10 { background: rgba(192,38,211,0.10);  color: #a21caf; }
[data-theme="light"] .chip-c11 { background: rgba(6,182,212,0.10);   color: #0891b2; }

/* Embedding lookup visual */
.tok-embed-visual { margin-top: 20px; display: flex; flex-direction: column; gap: 6px; overflow-x: auto; }
.tok-embed-row { display: flex; align-items: center; gap: 8px; animation: fadeUp 0.4s ease both; }
.tok-embed-token { min-width: 70px; text-align: right; font-weight: 700; font-size: 0.85rem; padding: 5px 10px; border-radius: 6px; white-space: pre; }
.tok-embed-arrow { color: var(--text-muted); font-size: 0.85rem; flex-shrink: 0; }
.tok-embed-id { font-family: var(--font-mono); font-size: 0.8rem; color: var(--accent); background: var(--accent-dim); padding: 5px 10px; border-radius: 6px; min-width: 55px; text-align: center; }
.tok-embed-vector { display: flex; gap: 3px; }
.tok-embed-num { padding: 4px 6px; background: var(--bg-tertiary); border-radius: 4px; font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-secondary); min-width: 38px; text-align: center; }
.tok-embed-dots { padding: 4px 6px; color: var(--text-muted); font-size: 0.8rem; }

/* ================================================================
   TAB 2: ARCHITECTURE
   ================================================================ */

/* Encoder-Decoder Overview Diagram */
.enc-dec-diagram {
  display: flex; gap: 12px; align-items: stretch; justify-content: center;
  margin: 16px 0; flex-wrap: wrap;
}
.enc-dec-side {
  flex: 1; min-width: 240px; max-width: 320px;
  border: 3px solid var(--purple, #a78bfa); border-radius: var(--radius);
  padding: 14px; display: flex; flex-direction: column; align-items: center; gap: 8px;
  position: relative;
}
.enc-dec-label {
  position: absolute; top: -14px; left: 12px;
  font-weight: 800; font-size: 0.85rem; color: var(--purple, #a78bfa);
  background: var(--bg-primary); padding: 0 8px;
}
.enc-dec-stack {
  display: flex; flex-direction: column; gap: 6px; width: 100%;
}
.enc-dec-block {
  padding: 10px; border-radius: var(--radius-sm); text-align: center;
  font-size: 0.78rem; font-weight: 700; color: #fff;
}
.enc-dec-block.ffn-block { background: #1a7a3a; }
.enc-dec-block.attn-block { background: #1a6b8a; }
.enc-dec-table {
  width: 100%; background: var(--bg-tertiary); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px; font-size: 0.72rem;
  font-family: var(--font-mono);
}
.enc-dec-table-row { display: grid; grid-template-columns: 1fr 2fr 3fr; gap: 4px; padding: 2px 0; }
.enc-dec-th { font-weight: 800; color: var(--text-primary); text-decoration: underline; }
.enc-dec-pe {
  width: 100%; padding: 8px; text-align: center; border-radius: var(--radius-sm);
  background: #0ea5e9; color: #fff; font-size: 0.78rem; font-weight: 700;
}
.enc-dec-input-text { font-size: 0.82rem; font-weight: 600; color: var(--text-primary); margin-top: 4px; }
.enc-dec-output-text { font-size: 0.9rem; font-weight: 800; color: var(--accent); text-align: center; }
.enc-dec-arrow {
  font-size: 2rem; font-weight: 800; color: var(--text-primary);
  display: flex; align-items: center; animation: flowRight 2s ease-in-out infinite;
}
.enc-dec-note {
  flex: 1; min-width: 200px; padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--bg-tertiary); border: 1px solid var(--border); font-size: 0.8rem;
  color: var(--text-secondary); line-height: 1.5;
}

/* Embedding Vector Space Canvas */
.embed-vector-wrap {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px; margin: 16px 0;
}
.embed-vector-canvas { width: 100%; height: 340px; display: block; }

.arch-layout { display: grid; grid-template-columns: 220px 1fr; gap: 36px; align-items: start; }
.arch-sidebar {
  position: sticky; top: 74px;
  display: flex; flex-direction: column; gap: 3px;
}
.arch-nav-item {
  padding: 10px 14px; border-radius: var(--radius-sm);
  font-size: 0.82rem; font-weight: 600; cursor: pointer;
  color: var(--text-secondary); transition: all 0.25s ease;
  border-left: 3px solid transparent;
  display: flex; align-items: center; gap: 8px;
}
.arch-nav-item:hover { color: var(--text-primary); background: var(--accent-dim); }
.arch-nav-item.active { color: var(--accent); background: var(--accent-dim); border-left-color: var(--accent); }
.arch-nav-item .nav-icon { font-size: 1rem; width: 22px; text-align: center; }
.arch-nav-bracket {
  border-left: 2px dashed var(--border-light); margin-left: 18px; padding-left: 0;
}
.arch-nav-bracket .arch-nav-item { font-size: 0.78rem; padding: 8px 12px; }
.arch-bracket-label {
  font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 1px; padding: 4px 0 4px 16px; font-weight: 700;
}
.arch-content { min-height: 500px; }
.arch-step { display: none; }
.arch-step.active { display: block; animation: fadeUp 0.4s ease; }

/* QKV */
.qkv-visual { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 20px 0; }
.qkv-box { padding: 16px; border-radius: var(--radius); text-align: center; border: 1px solid var(--border); }
.qkv-box h4 { font-size: 0.82rem; font-weight: 700; margin-bottom: 6px; }
.qkv-box.q-box { background: rgba(56,189,248,0.06); border-color: rgba(56,189,248,0.2); }
.qkv-box.q-box h4 { color: var(--accent); }
.qkv-box.k-box { background: rgba(52,211,153,0.06); border-color: rgba(52,211,153,0.2); }
.qkv-box.k-box h4 { color: var(--green); }
.qkv-box.v-box { background: rgba(167,139,250,0.06); border-color: rgba(167,139,250,0.2); }
.qkv-box.v-box h4 { color: var(--purple); }
.qkv-desc { font-size: 0.82rem; color: var(--text-secondary); margin-top: 6px; }

/* Attention heatmap */
.attn-heatmap-wrap {
  display: inline-block; margin: 16px 0; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; overflow-x: auto;
}
.attn-heatmap { display: grid; gap: 2px; }
.attn-hm-cell {
  display: flex; align-items: center; justify-content: center;
  border-radius: 4px; font-size: 0.72rem; font-weight: 700;
  transition: transform 0.15s, opacity 0.3s; cursor: default; aspect-ratio: 1; min-width: 48px;
  border: 1px solid rgba(255,255,255,0.05);
}
.attn-hm-cell:hover { transform: scale(1.12); z-index: 2; }
[data-theme="light"] .attn-hm-cell { border: 1px solid rgba(0,0,0,0.06); }
.attn-hm-label { font-size: 0.78rem; font-weight: 700; color: var(--text-primary); display: flex; align-items: center; justify-content: center; }

/* Attention sentence */
.attn-sentence {
  display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px;
  padding: 14px; background: var(--bg-card); border-radius: var(--radius); border: 1px solid var(--border);
}
.attn-word {
  padding: 8px 16px; border-radius: var(--radius-sm); background: var(--bg-tertiary);
  font-weight: 600; font-size: 0.95rem; cursor: pointer; transition: all 0.2s;
  border: 2px solid var(--border-light); color: var(--text-primary);
}
.attn-word:hover { border-color: var(--accent); background: var(--accent-dim); }
.attn-word.focused { border-color: var(--accent); background: var(--accent-dim); color: var(--accent); }
.attn-word-all {
  font-size: 0.82rem; background: var(--accent-dim); border-color: var(--accent);
  color: var(--accent); font-style: italic;
}

/* Multi-head */
.multihead-row { display: flex; gap: 16px; flex-wrap: wrap; margin: 16px 0; }
.multihead-card {
  flex: 1; min-width: 160px; padding: 12px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.multihead-title { font-size: 0.75rem; font-weight: 700; color: var(--text-muted); margin-bottom: 6px; }

/* Multi-Head Attention Animated Visual */
.multihead-anim {
  display: grid; grid-template-columns: auto 1fr auto auto;
  gap: 20px; align-items: center; margin: 20px 0;
  padding: 20px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden;
}
.mh-input-col, .mh-output-col { display: flex; flex-direction: column; gap: 8px; }
.mh-input-token, .mh-output-token {
  padding: 8px 14px; border-radius: var(--radius-sm); font-weight: 700; font-size: 0.85rem;
  background: var(--bg-tertiary); border: 1px solid var(--border); text-align: center;
}
.mh-output-token { border-color: var(--accent); color: var(--accent); }
.mh-heads-col {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
}
.mh-head {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 8px; border-radius: var(--radius-sm); border: 2px solid var(--border);
  background: var(--bg-tertiary); transition: all 0.3s;
  animation: headPulse 3s ease-in-out infinite;
}
.mh-head:nth-child(1) { border-color: #38bdf8; animation-delay: 0s; }
.mh-head:nth-child(2) { border-color: #34d399; animation-delay: 0.3s; }
.mh-head:nth-child(3) { border-color: #a78bfa; animation-delay: 0.6s; }
.mh-head:nth-child(4) { border-color: #fb923c; animation-delay: 0.9s; }
.mh-head:nth-child(5) { border-color: #f472b6; animation-delay: 1.2s; }
.mh-head:nth-child(6) { border-color: #fbbf24; animation-delay: 1.5s; }
.mh-head:nth-child(7) { border-color: #22d3ee; animation-delay: 1.8s; }
.mh-head:nth-child(8) { border-color: #e879f9; animation-delay: 2.1s; }
.mh-head-label {
  font-size: 0.72rem; font-weight: 800; color: var(--text-primary);
  background: var(--bg-primary); padding: 2px 8px; border-radius: 4px;
}
.mh-head-focus { font-size: 0.65rem; color: var(--text-muted); text-align: center; }
.mh-concat-col { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.mh-concat-box {
  padding: 10px 16px; border-radius: var(--radius-sm); font-weight: 700; font-size: 0.8rem;
  background: var(--accent-dim); border: 2px solid var(--accent); color: var(--accent);
  animation: concatPulse 2s ease-in-out infinite;
}
.mh-project-arrow { font-size: 1.2rem; color: var(--accent); animation: flowRight 2s ease-in-out infinite; }
.mh-project-box {
  padding: 8px 14px; border-radius: var(--radius-sm); font-size: 0.75rem; font-weight: 600;
  background: var(--green-dim); border: 1px solid var(--green); color: var(--green); text-align: center;
}
@keyframes headPulse {
  0%, 100% { transform: scale(1); box-shadow: none; }
  50% { transform: scale(1.05); box-shadow: 0 0 12px var(--accent-glow); }
}
@keyframes concatPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); box-shadow: 0 0 16px var(--accent-glow); }
}

/* Normalization Animated Visual */
.norm-anim {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 20px; align-items: center;
  margin: 16px 0; padding: 20px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.norm-stage { text-align: center; }
.norm-stage-label { font-size: 0.75rem; font-weight: 700; color: var(--text-muted); margin-bottom: 10px; text-transform: uppercase; letter-spacing: 1px; }
.norm-bars { display: flex; gap: 6px; align-items: flex-end; justify-content: center; height: 120px; }
.norm-bar {
  width: 24px; border-radius: 4px 4px 0 0; transition: height 1.5s ease, background 1.5s ease;
  position: relative;
}
.norm-bar::after {
  content: attr(data-val); position: absolute; top: -18px; left: 50%; transform: translateX(-50%);
  font-size: 0.6rem; font-weight: 700; color: var(--text-muted); white-space: nowrap;
}
.norm-bars-before .norm-bar { background: var(--accent); }
.norm-bars-after .norm-bar { background: var(--green); }
.norm-arrow-col { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.norm-arrow-anim {
  font-size: 2rem; color: var(--accent); font-weight: 800;
  animation: flowRight 2s ease-in-out infinite;
}
.norm-formula {
  font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-secondary);
  padding: 4px 10px; background: var(--bg-tertiary); border-radius: 4px;
}

/* Add & Norm */
.residual-visual {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 20px 0; justify-content: center;
}
.residual-box {
  padding: 12px 18px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); text-align: center; font-weight: 600; font-size: 0.85rem;
}
.residual-op { font-size: 1.4rem; font-weight: 800; color: var(--accent); min-width: 28px; text-align: center; }

/* Feed-Forward / MLP neural network */
.ffn-network { position: relative; margin: 20px auto; max-width: 580px; }
.ffn-layers {
  display: flex; align-items: stretch; justify-content: space-between;
  margin: 20px 0; position: relative; min-height: 260px;
}
.ffn-layer-col {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 6px; position: relative; z-index: 2;
  flex: 0 0 auto;
}
.ffn-neuron {
  width: 30px; height: 30px; border-radius: 50%;
  border: 2px solid var(--border-light); background: var(--bg-card);
  transition: all 0.5s ease; display: flex; align-items: center; justify-content: center;
  font-size: 0.55rem; font-weight: 700; color: var(--text-muted);
}
.ffn-neuron.active { border-color: var(--accent); background: var(--accent-dim); box-shadow: 0 0 12px var(--accent-glow); color: var(--accent); }
.ffn-neuron.gelu { border-color: var(--green); background: var(--green-dim); box-shadow: 0 0 10px rgba(52,211,153,0.15); color: var(--green); }
.ffn-layer-label { font-size: 0.7rem; font-weight: 700; color: var(--text-muted); text-align: center; margin-top: 6px; }
.ffn-connections { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; }
.ffn-connection { stroke: var(--border-light); stroke-width: 0.8; transition: stroke 0.5s, opacity 0.5s; opacity: 0.2; }
.ffn-connection.active { stroke: var(--accent); opacity: 0.5; stroke-width: 1.2; }
.ffn-dim-label { font-size: 0.78rem; font-weight: 700; color: var(--accent); text-align: center; padding: 4px 12px; border-radius: 6px; background: var(--accent-dim); display: inline-block; }

/* Stack */
.stack-layers { display: flex; flex-direction: column; gap: 5px; align-items: center; margin: 20px 0; }
.stack-layer-box {
  width: 260px; padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--bg-card); border: 1px solid var(--border);
  text-align: center; font-size: 0.8rem; font-weight: 600;
  transition: all 0.4s; opacity: 0.3;
}
.stack-layer-box.lit { opacity: 1; border-color: var(--accent); background: var(--accent-dim); box-shadow: 0 0 14px var(--accent-glow); }
.stack-arrow { color: var(--text-muted); font-size: 0.75rem; text-align: center; }

/* Output probs */
.prob-bars { display: flex; flex-direction: column; gap: 7px; margin: 20px 0; max-width: 420px; }
.prob-row { display: flex; align-items: center; gap: 10px; }
.prob-token { min-width: 70px; text-align: right; font-weight: 700; font-size: 0.85rem; font-family: var(--font-mono); }
.prob-track { flex: 1; height: 26px; background: var(--bg-tertiary); border-radius: 6px; overflow: hidden; }
.prob-fill { height: 100%; border-radius: 6px; transition: width 1.2s ease; display: flex; align-items: center; padding-left: 8px; font-size: 0.7rem; font-weight: 700; color: var(--bg-primary); }
.prob-pct { font-size: 0.75rem; color: var(--text-muted); min-width: 40px; text-align: right; }

/* Architecture type cards */
.arch-types-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin: 20px 0; }
.arch-type-card {
  padding: 18px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); text-align: center; transition: all var(--transition);
}
.arch-type-card:hover { border-color: var(--border-light); transform: translateY(-2px); }
.arch-type-icon { font-size: 2rem; margin-bottom: 6px; }
.arch-type-blocks { display: flex; gap: 4px; justify-content: center; margin: 10px 0; }
.arch-mini-block { padding: 5px 12px; border-radius: 6px; font-size: 0.72rem; font-weight: 700; }
.block-encoder { background: rgba(96,165,250,0.18); color: #60a5fa; border: 1px solid rgba(96,165,250,0.25); }
.block-decoder { background: var(--green-dim); color: var(--green); border: 1px solid rgba(52,211,153,0.25); }
.arch-type-name { font-weight: 800; font-size: 0.95rem; margin-bottom: 3px; }
.arch-type-desc { font-size: 0.82rem; color: var(--text-secondary); margin-bottom: 5px; }
.arch-type-examples { font-size: 0.72rem; color: var(--text-muted); }

/* ================================================================
   TAB 3: MODELS
   ================================================================ */
.models-intro { margin-bottom: 24px; }
.models-note {
  font-size: 0.85rem; color: var(--text-secondary);
  padding: 12px 16px; background: var(--accent-dim);
  border-left: 3px solid var(--accent); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-top: 14px;
}
.models-filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; align-items: center; }
.filter-select, .filter-input {
  padding: 8px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-tertiary);
  color: var(--text-primary); font-size: 0.85rem; font-family: inherit; outline: none;
  transition: border-color var(--transition);
}
.filter-select:focus, .filter-input:focus { border-color: var(--accent); }
.filter-input { min-width: 200px; }
.filter-input::placeholder { color: var(--text-muted); }
.models-table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
.models-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.models-table th {
  background: var(--bg-secondary); padding: 11px 14px; text-align: left;
  font-weight: 700; font-size: 0.7rem; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--text-muted); cursor: pointer;
  user-select: none; transition: color var(--transition);
  white-space: nowrap; border-bottom: 2px solid var(--border);
}
.models-table th:hover { color: var(--accent); }
.models-table th .sort-arrow { margin-left: 4px; font-size: 0.65rem; opacity: 0.3; }
.models-table th.sorted .sort-arrow { opacity: 1; color: var(--accent); }
.models-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); transition: background var(--transition); }
.models-table tr:hover td { background: var(--accent-dim); }
.models-table .model-name { font-weight: 700; }
.models-table .ctx { font-family: var(--font-mono); font-size: 0.8rem; }

/* ===== FOOTER ===== */
.footer {
  text-align: center; padding: 28px 24px; border-top: 1px solid var(--border);
  color: var(--text-muted); font-size: 0.82rem; margin-top: auto;
}
.footer a { color: var(--accent); }
.footer-links { display: flex; gap: 20px; justify-content: center; margin-top: 6px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .arch-layout { grid-template-columns: 1fr; }
  .arch-sidebar {
    position: static; flex-direction: row; flex-wrap: wrap; gap: 4px;
    border-bottom: 1px solid var(--border); padding-bottom: 12px; margin-bottom: 12px;
  }
  .arch-nav-item { padding: 6px 10px; font-size: 0.72rem; border-left: none; border-bottom: 2px solid transparent; }
  .arch-nav-item.active { border-bottom-color: var(--accent); border-left-color: transparent; }
  .arch-nav-bracket { border-left: none; margin-left: 0; padding-left: 0; display: contents; }
  .arch-bracket-label { display: none; }
}
@media (max-width: 768px) {
  .header-inner { flex-wrap: wrap; height: auto; padding: 8px 0; gap: 6px; }
  .main { padding: 20px 16px 32px; }
  .section-title { font-size: 1.25rem; }
  .qkv-visual { grid-template-columns: 1fr; }
  .ffn-layers { min-height: 200px; }
  .arch-types-grid { grid-template-columns: 1fr; }
  .multihead-row { flex-direction: column; }
  .multihead-anim { grid-template-columns: 1fr; gap: 14px; }
  .mh-heads-col { grid-template-columns: repeat(2, 1fr); }
  .norm-anim { grid-template-columns: 1fr; gap: 14px; }
  .enc-dec-diagram { flex-direction: column; align-items: center; }
  .enc-dec-arrow { transform: rotate(90deg); }
}
@media (max-width: 480px) {
  .nav-tabs { gap: 2px; }
  .nav-tab { padding: 6px 8px; font-size: 0.76rem; }
  .nav-tab .tab-num { width: 16px; height: 16px; font-size: 0.6rem; margin-right: 3px; }
  .tok-stats { flex-direction: column; }
  .tok-stat-arrow { transform: rotate(90deg); }
}

/* ===== PRINT ===== */
@media print {
  .header, .step-nav-bar, .theme-toggle, .arch-sidebar, .arch-controls { display: none !important; }
  .tab-content, .arch-step { display: block !important; }
  body { background: #fff; color: #000; }
}

/* ===== STEP ANIMATIONS ===== */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-glow); }
  50% { box-shadow: 0 0 18px 4px var(--accent-glow); }
}
@keyframes flowRight {
  0% { transform: translateX(-8px); opacity: 0; }
  20% { opacity: 1; }
  100% { transform: translateX(8px); opacity: 0; }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes slideIn {
  from { opacity: 0; transform: translateX(-16px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes dataStream {
  0% { background-position: 200% center; }
  100% { background-position: -200% center; }
}

/* Token chips in Step 0 — staggered pop in */
.arch-step.active .tok-chip {
  animation: scaleIn 0.4s ease both;
}
.arch-step.active .tok-chip:nth-child(1) { animation-delay: 0.05s; }
.arch-step.active .tok-chip:nth-child(2) { animation-delay: 0.12s; }
.arch-step.active .tok-chip:nth-child(3) { animation-delay: 0.19s; }
.arch-step.active .tok-chip:nth-child(4) { animation-delay: 0.26s; }
.arch-step.active .tok-chip:nth-child(5) { animation-delay: 0.33s; }
.arch-step.active .tok-chip:nth-child(6) { animation-delay: 0.40s; }
.arch-step.active .tok-chip:nth-child(7) { animation-delay: 0.47s; }

/* Embedding lookup rows — slide in */
.arch-step.active .embed-lookup-row {
  animation: slideIn 0.5s ease both;
}
.arch-step.active .embed-lookup-row:nth-child(2) { animation-delay: 0.1s; }
.arch-step.active .embed-lookup-row:nth-child(3) { animation-delay: 0.2s; }
.arch-step.active .embed-lookup-row:nth-child(4) { animation-delay: 0.3s; }

/* QKV boxes — float effect on hover */
.qkv-box { animation: fadeUp 0.5s ease both; }
.qkv-box:nth-child(1) { animation-delay: 0.1s; }
.qkv-box:nth-child(2) { animation-delay: 0.2s; }
.qkv-box:nth-child(3) { animation-delay: 0.3s; }
.qkv-box:hover { animation: float 2s ease-in-out infinite; }

/* Residual flow — animated arrows */
.arch-step.active .residual-op {
  animation: flowRight 2s ease-in-out infinite;
}
.arch-step.active .residual-box {
  animation: fadeUp 0.4s ease both;
}
.arch-step.active .residual-box:nth-child(1) { animation-delay: 0s; }
.arch-step.active .residual-box:nth-child(3) { animation-delay: 0.15s; }
.arch-step.active .residual-box:nth-child(5) { animation-delay: 0.3s; }
.arch-step.active .residual-box:nth-child(7) { animation-delay: 0.45s; }
.arch-step.active .residual-box:nth-child(9) { animation-delay: 0.6s; }

/* FFN neurons — pulse glow when active */
.ffn-neuron.active { animation: pulseGlow 2s ease-in-out infinite; }

/* Stack layers — cascade animation */
.arch-step.active .stack-layer-box {
  animation: slideIn 0.4s ease both;
}
.arch-step.active .stack-layer-box:nth-child(1) { animation-delay: 0.05s; }
.arch-step.active .stack-layer-box:nth-child(3) { animation-delay: 0.15s; }
.arch-step.active .stack-layer-box:nth-child(5) { animation-delay: 0.25s; }
.arch-step.active .stack-layer-box:nth-child(7) { animation-delay: 0.35s; }
.arch-step.active .stack-layer-box:nth-child(9) { animation-delay: 0.45s; }
.arch-step.active .stack-layer-box:nth-child(11) { animation-delay: 0.55s; }
.arch-step.active .stack-layer-box:nth-child(13) { animation-delay: 0.65s; }
.arch-step.active .stack-layer-box:nth-child(15) { animation-delay: 0.75s; }
.arch-step.active .stack-layer-box:nth-child(17) { animation-delay: 0.85s; }

/* Architecture type cards — staggered scale in */
.arch-step.active .arch-type-card {
  animation: scaleIn 0.4s ease both;
}
.arch-step.active .arch-type-card:nth-child(1) { animation-delay: 0.05s; }
.arch-step.active .arch-type-card:nth-child(2) { animation-delay: 0.15s; }
.arch-step.active .arch-type-card:nth-child(3) { animation-delay: 0.25s; }

/* Probability bars — grow animation */
.arch-step.active .prob-row {
  animation: slideIn 0.5s ease both;
}
.arch-step.active .prob-row:nth-child(1) { animation-delay: 0.1s; }
.arch-step.active .prob-row:nth-child(2) { animation-delay: 0.2s; }
.arch-step.active .prob-row:nth-child(3) { animation-delay: 0.3s; }
.arch-step.active .prob-row:nth-child(4) { animation-delay: 0.4s; }
.arch-step.active .prob-row:nth-child(5) { animation-delay: 0.5s; }

/* Multi-head cards — stagger */
.arch-step.active .multihead-card {
  animation: scaleIn 0.35s ease both;
}
.arch-step.active .multihead-card:nth-child(1) { animation-delay: 0.05s; }
.arch-step.active .multihead-card:nth-child(2) { animation-delay: 0.15s; }
.arch-step.active .multihead-card:nth-child(3) { animation-delay: 0.25s; }
.arch-step.active .multihead-card:nth-child(4) { animation-delay: 0.35s; }

/* Data stream shimmer on lit stack layers */
.stack-layer-box.lit {
  background-image: linear-gradient(90deg, var(--accent-dim) 0%, var(--accent-glow) 50%, var(--accent-dim) 100%);
  background-size: 200% 100%;
  animation: dataStream 3s linear infinite, slideIn 0.4s ease both;
}

/* Attention heatmap cells — fade in with stagger */
.arch-step.active .attn-hm-cell {
  animation: scaleIn 0.3s ease both;
}

/* ===== NEW DEMO SECTIONS STYLES ===== */

/* Position Encoding Impact Demo (Step 1) */
.pos-impact-demo {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; margin: 16px 0;
}
.slider-container {
  display: flex; align-items: center; gap: 12px; margin-bottom: 16px;
}
.slider-container label { font-weight: 600; color: var(--text-primary); font-size: 0.9rem; }
.pos-impact-slider {
  flex: 1; height: 6px; border-radius: 3px; background: var(--border-light);
  outline: none; -webkit-appearance: none; appearance: none;
}
.pos-impact-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 18px; height: 18px;
  border-radius: 50%; background: var(--accent); cursor: pointer;
  box-shadow: 0 2px 8px rgba(92, 184, 240, 0.3);
}
.pos-impact-slider::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%; background: var(--accent);
  cursor: pointer; border: none; box-shadow: 0 2px 8px rgba(92, 184, 240, 0.3);
}
#pos-impact-value { font-weight: 700; color: var(--accent); min-width: 40px; text-align: right; }
.pos-impact-heatmap-section { margin-top: 12px; }

/* Q·K·V Computation Demo (Step 2) */
.qkv-demo { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.qkv-word-buttons {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px;
}
.qkv-word-btn {
  padding: 8px 14px; border: 2px solid var(--border); background: transparent;
  color: var(--text-secondary); border-radius: var(--radius-sm); cursor: pointer;
  font-weight: 600; transition: all var(--transition);
}
.qkv-word-btn:hover { color: var(--accent); border-color: var(--accent); }
.qkv-word-btn.active { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); }
.qkv-computation-details { margin-top: 12px; }
.qkv-step {
  margin-bottom: 16px; padding: 12px; background: var(--bg-secondary); border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent);
}
.qkv-step h4 { color: var(--accent); font-size: 0.9rem; margin-bottom: 8px; }
.vector-display {
  display: flex; gap: 4px; flex-wrap: wrap; padding: 8px;
  background: var(--bg-tertiary); border-radius: 6px;
}
.vec-component {
  padding: 4px 8px; background: var(--accent-dim); color: var(--accent);
  border-radius: 4px; font-family: var(--font-mono); font-size: 0.8rem; font-weight: 600;
}
.scores-table, .softmax-table { display: flex; flex-direction: column; gap: 6px; }
.score-row, .softmax-row {
  display: flex; align-items: center; gap: 12px; padding: 8px;
  background: var(--bg-tertiary); border-radius: 4px;
}
.score-word, .softmax-word { font-weight: 600; min-width: 50px; }
.score-value { font-family: var(--font-mono); color: var(--accent); }
.softmax-bar {
  flex: 1; height: 24px; background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 3px; transition: width 0.3s ease;
}
.softmax-pct { font-weight: 700; color: var(--green); font-size: 0.9rem; min-width: 50px; text-align: right; }
.weighted-values { display: flex; flex-direction: column; gap: 8px; }
.weighted-item {
  display: flex; align-items: center; gap: 8px; padding: 8px;
  background: var(--bg-tertiary); border-radius: 4px; border-left: 3px solid var(--green);
}
.wv-word { font-weight: 600; min-width: 40px; }
.wv-weight { color: var(--text-muted); font-size: 0.85rem; }
.wv-vector { display: flex; gap: 2px; margin-left: auto; }
.wv-vector span {
  padding: 2px 4px; background: var(--green-dim); color: var(--green);
  border-radius: 2px; font-family: var(--font-mono); font-size: 0.7rem;
}

/* Sentence Examples Demo (Step 2) */
.sentence-examples {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px;
}
.sentence-toggles { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.sentence-btn {
  padding: 8px 14px; border: 2px solid var(--border); background: transparent;
  color: var(--text-secondary); border-radius: var(--radius-sm); cursor: pointer;
  font-weight: 600; transition: all var(--transition); font-size: 0.9rem;
}
.sentence-btn:hover { color: var(--accent); border-color: var(--accent); }
.sentence-btn.active { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); }
.example-text {
  font-size: 1.1rem; font-weight: 500; padding: 12px; background: var(--bg-secondary);
  border-radius: var(--radius-sm); border-left: 3px solid var(--teal); margin-bottom: 8px;
}
.example-note {
  padding: 10px 12px; background: var(--amber-dim); color: var(--amber); border-radius: var(--radius-sm);
  font-size: 0.85rem; margin-bottom: 12px; border-left: 3px solid var(--amber);
}
.example-tokens h4 { font-size: 0.9rem; margin-bottom: 8px; color: var(--text-secondary); }
.token-list { display: flex; flex-wrap: wrap; gap: 6px; }
.ex-token {
  padding: 6px 12px; background: var(--bg-secondary); border: 2px solid var(--border);
  border-radius: 20px; cursor: pointer; transition: all var(--transition);
  font-weight: 600;
}
.ex-token:hover { background: var(--accent-dim); border-color: var(--accent); }
.ex-token.highlighted {
  background: var(--accent-dim); border-color: var(--accent); color: var(--accent);
  box-shadow: 0 0 12px rgba(92, 184, 240, 0.4);
}

/* Sentence Details Container */
#sentence-details {
  position: relative;
}

/* Interpretations & Attention Arrows */
.interpretations-section {
  margin-top: 20px; padding-top: 12px; border-top: 1px solid var(--border);
  position: relative;
}
.interpretations-section h4 {
  font-size: 0.9rem; margin-bottom: 12px; color: var(--text-secondary);
}
.interpretations-container {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px;
  position: relative;
}
.interpretation-box {
  padding: 16px; background: var(--bg-secondary); border-radius: var(--radius-sm);
  font-size: 0.85rem; line-height: 1.6; border-left: 4px solid var(--border);
  transition: all var(--transition);
}
.interpretation-box:hover {
  background: var(--bg-card-hover); transform: translateY(-2px);
}
.interpretation-box p { margin: 6px 0 0; color: var(--text-secondary); }
.arrow-overlay {
  position: absolute; top: 0; left: 0; pointer-events: none;
  z-index: 1;
}
@keyframes drawArrowPath {
  0% { stroke-dashoffset: 200; opacity: 0; }
  30% { opacity: 0.8; }
  70% { opacity: 0.8; }
  100% { stroke-dashoffset: 0; opacity: 0.7; }
}

/* Head Comparison Demo (Step 2) */
.head-comparison {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px;
}
.comparison-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.comp-tab {
  padding: 8px 14px; border: 2px solid var(--border); background: transparent;
  color: var(--text-secondary); border-radius: var(--radius-sm); cursor: pointer;
  font-weight: 600; transition: all var(--transition); font-size: 0.9rem;
}
.comp-tab:hover { color: var(--accent); border-color: var(--accent); }
.comp-tab.active { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); }
.single-head-demo { display: flex; flex-direction: column; gap: 8px; }
.demo-item {
  padding: 10px 12px; background: var(--bg-secondary); border-radius: 6px;
  font-size: 0.9rem; border-left: 3px solid var(--border-light);
}
.demo-item:nth-child(3), .demo-item:nth-child(4), .demo-item:nth-child(5) {
  border-left-color: var(--red);
}
.multi-head-comparison {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px;
}
.comp-head-card {
  padding: 12px; background: var(--bg-secondary); border-radius: var(--radius-sm);
  border: 2px solid var(--border-light); border-left-width: 4px;
}
.head-label {
  font-size: 0.75rem; font-weight: 700; padding: 4px 6px;
  border-radius: 4px; margin-bottom: 6px; display: inline-block;
}
.head-focus { font-weight: 700; font-size: 0.95rem; margin-bottom: 4px; }
.head-example { font-size: 0.8rem; color: var(--text-muted); }

/* Autoregressive Generation Demo (Step 7) */
.generation-demo {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px;
}
.generation-controls { display: flex; gap: 8px; margin-bottom: 16px; }
.gen-control-btn {
  padding: 10px 16px; background: var(--accent); color: #000; border: none;
  border-radius: var(--radius-sm); font-weight: 700; cursor: pointer;
  transition: all var(--transition); font-size: 0.9rem;
}
.gen-control-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(92, 184, 240, 0.4); }
.gen-control-btn:active { transform: translateY(0); }
.generation-timeline { margin-bottom: 12px; }
.timeline-steps {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px;
}
.timeline-step {
  padding: 8px 12px; background: var(--bg-secondary); border: 2px solid var(--border);
  border-radius: 20px; font-size: 0.85rem; font-weight: 600;
  transition: all var(--transition);
}
.timeline-step.completed {
  background: var(--green-dim); border-color: var(--green); color: var(--green);
}
.gen-section {
  margin-bottom: 16px; padding: 12px; background: var(--bg-secondary); border-radius: var(--radius-sm);
}
.gen-section h4 { font-size: 0.9rem; color: var(--accent); margin-bottom: 8px; }
.gen-tokens-box {
  display: flex; gap: 6px; flex-wrap: wrap;
}
.gen-token {
  padding: 6px 12px; background: var(--accent-dim); color: var(--accent);
  border-radius: 20px; font-weight: 600; font-size: 0.9rem;
}
.gen-vocab-sample { display: flex; flex-direction: column; gap: 6px; }
.vocab-item {
  display: flex; align-items: center; gap: 10px; padding: 8px;
  background: var(--bg-tertiary); border-radius: 4px;
}
.vocab-token { font-weight: 700; min-width: 60px; font-family: var(--font-mono); }
.prob-bar-small {
  height: 20px; background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 3px; min-width: 20px; transition: width 0.3s ease;
}
.vocab-prob { font-weight: 700; color: var(--accent); font-size: 0.85rem; min-width: 45px; text-align: right; }
.gen-note {
  font-size: 0.85rem; color: var(--text-muted); padding: 8px 0; margin-top: 4px;
}

/* RNN vs Transformer Comparison (Step 7) */
.rnn-transformer-comp {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px;
}
.comparison-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; margin-bottom: 16px;
}
.comp-type {
  padding: 14px; background: var(--bg-secondary); border-radius: var(--radius-sm);
  border: 2px solid var(--border);
}
.comp-title {
  font-weight: 700; font-size: 1rem; margin-bottom: 12px; padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
}
.comp-timeline {
  display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px;
  min-height: 80px; justify-content: center;
}
.rnn-step {
  padding: 10px; background: var(--red-dim); border: 2px solid var(--red);
  border-radius: 6px; color: var(--red); font-weight: 600; font-size: 0.9rem;
  animation: slideIn 0.5s ease;
}
.transformer-parallel {
  align-items: center; justify-content: center;
}
.transformer-step {
  padding: 16px; background: var(--green-dim); border: 2px solid var(--green);
  border-radius: 8px; color: var(--green); font-weight: 700; font-size: 1rem;
  text-align: center; line-height: 1.4; animation: scaleIn 0.5s ease;
}
.comp-desc {
  font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 6px;
}
.comp-con { color: var(--red); font-weight: 600; font-size: 0.85rem; }
.comp-pro { color: var(--green); font-weight: 600; font-size: 0.85rem; }
.processing-details {
  background: var(--bg-secondary); padding: 14px; border-radius: var(--radius-sm);
  border-left: 4px solid var(--accent);
}
.processing-details h4 { color: var(--accent); margin-bottom: 10px; }
.details-list {
  list-style: none; display: flex; flex-direction: column; gap: 8px;
}
.details-list li {
  font-size: 0.9rem; color: var(--text-secondary); padding-left: 0;
}
.details-list strong { color: var(--text-primary); }

