/* ============================================================
   TestLab 29119 — Main Stylesheet
   Dark laboratory theme with neon accents
   ============================================================ */

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

/* --- Design Tokens --- */
:root {
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-card: #1a2235;
  --bg-glass: rgba(26, 34, 53, 0.7);
  --border-glass: rgba(255,255,255,0.08);
  --text-primary: #f0f4f8;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --cyan: #00b4d8;
  --cyan-glow: rgba(0,180,216,0.35);
  --green: #06d6a0;
  --green-glow: rgba(6,214,160,0.35);
  --red: #ff6b6b;
  --red-glow: rgba(255,107,107,0.35);
  --amber: #f59e0b;
  --amber-glow: rgba(245,158,11,0.35);
  --magenta: #e040fb;
  --magenta-glow: rgba(224,64,251,0.3);
  --radius: 12px;
  --radius-lg: 20px;
  --radius-sm: 8px;
  --shadow: 0 8px 32px rgba(0,0,0,0.4);
  --transition: 0.3s cubic-bezier(.4,0,.2,1);
  --nav-bg: rgba(10,14,23,0.85);
}

:root[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #f1f5f9;
  --bg-card: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.8);
  --border-glass: rgba(0, 0, 0, 0.08);
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --cyan: #0077b6;
  --cyan-glow: rgba(0,119,182,0.2);
  --green: #059669;
  --green-glow: rgba(5,150,105,0.2);
  --red: #dc2626;
  --red-glow: rgba(220,38,38,0.2);
  --amber: #d97706;
  --amber-glow: rgba(217,119,6,0.2);
  --magenta: #c026d3;
  --magenta-glow: rgba(192,38,211,0.2);
  --shadow: 0 4px 16px rgba(0,0,0,0.06);
  --nav-bg: rgba(255,255,255,0.85);
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

body::before {
  content: '';
  position: fixed; inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(0,180,216,0.06) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(224,64,251,0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(6,214,160,0.04) 0%, transparent 50%);
  pointer-events: none; z-index: 0;
}

/* --- Utility --- */
.hidden { display: none !important; }

/* --- Header / Navbar --- */
.navbar {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.75rem 2rem;
  background: var(--nav-bg);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-glass);
}

.navbar-brand {
  display: flex; align-items: center; gap: 0.6rem;
  font-weight: 800; font-size: 1.25rem;
  background: linear-gradient(135deg, var(--cyan), var(--magenta));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

.navbar-brand .logo-icon { font-size: 1.5rem; -webkit-text-fill-color: initial; }

.navbar-stats {
  display: flex; align-items: center; gap: 1.5rem;
}

.stat-item {
  display: flex; align-items: center; gap: 0.4rem;
  font-size: 0.85rem; color: var(--text-secondary);
}

.stat-item .stat-value {
  font-weight: 700; font-family: 'JetBrains Mono', monospace;
  color: var(--cyan);
}

/* --- Phase Progress Bar --- */
.phase-progress {
  display: flex; align-items: center; justify-content: center;
  gap: 0; padding: 1.5rem 2rem 0.5rem;
  position: relative; z-index: 1;
}

.phase-step {
  display: flex; align-items: center; gap: 0;
}

.phase-dot {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.9rem;
  background: var(--bg-card);
  border: 2px solid var(--border-glass);
  color: var(--text-muted);
  transition: var(--transition);
  position: relative;
}

.phase-dot.active {
  border-color: var(--cyan);
  color: var(--cyan);
  box-shadow: 0 0 20px var(--cyan-glow);
}

.phase-dot.completed {
  background: var(--cyan);
  border-color: var(--cyan);
  color: var(--bg-primary);
}

.phase-dot .phase-label {
  position: absolute; top: 52px;
  font-size: 0.7rem; font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}

.phase-dot.active .phase-label { color: var(--cyan); }
.phase-dot.completed .phase-label { color: var(--green); }

.phase-connector {
  width: 80px; height: 2px;
  background: var(--border-glass);
  transition: var(--transition);
}

.phase-connector.completed { background: var(--cyan); }

/* --- Screen Container --- */
.screen {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2.5rem 2rem;
  position: relative; z-index: 1;
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* --- Welcome / Start Screen --- */
.welcome-screen {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: 80vh; text-align: center;
}

.welcome-title {
  font-size: 3.5rem; font-weight: 900;
  background: linear-gradient(135deg, var(--cyan), var(--green), var(--magenta));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.75rem;
  letter-spacing: -1px;
}

.welcome-subtitle {
  font-size: 1.15rem; color: var(--text-secondary);
  max-width: 550px; margin-bottom: 2.5rem;
}

.welcome-badge {
  display: inline-block;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  font-size: 0.8rem; font-weight: 600;
  background: rgba(0,180,216,0.12);
  border: 1px solid rgba(0,180,216,0.3);
  color: var(--cyan);
  margin-bottom: 1.5rem;
}

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.85rem 2rem;
  border: none; border-radius: var(--radius);
  font-family: 'Inter', sans-serif;
  font-size: 1rem; font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--cyan), #0096c7);
  color: #fff;
  box-shadow: 0 4px 20px var(--cyan-glow);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px var(--cyan-glow);
}

.btn-success {
  background: linear-gradient(135deg, var(--green), #05b890);
  color: #fff;
  box-shadow: 0 4px 20px var(--green-glow);
}
.btn-success:hover { transform: translateY(-2px); }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border-glass);
  color: var(--text-secondary);
}
.btn-outline:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

.btn-lg { padding: 1rem 2.5rem; font-size: 1.1rem; border-radius: var(--radius-lg); }

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

/* --- Glass Card --- */
.glass-card {
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow);
}

/* --- Tutorial / Slides --- */
.tutorial-container {
  max-width: 640px; margin: 0 auto; text-align: center;
}

.tutorial-icon { font-size: 3.5rem; margin-bottom: 1rem; }

.tutorial-title {
  font-size: 1.6rem; font-weight: 700;
  margin-bottom: 1rem;
}

.tutorial-content {
  color: var(--text-secondary);
  font-size: 1rem; line-height: 1.8;
  margin-bottom: 2rem;
}

.tutorial-categories {
  display: flex; gap: 0.75rem;
  margin: 1rem 0;
}

.tutorial-cat {
  flex: 1; padding: 1rem;
  border-radius: var(--radius);
  text-align: center;
  font-size: 0.85rem;
}
.tutorial-cat.spec  { background: rgba(0,180,216,0.12); border: 1px solid rgba(0,180,216,0.25); color: var(--cyan); }
.tutorial-cat.struct { background: rgba(6,214,160,0.12); border: 1px solid rgba(6,214,160,0.25); color: var(--green); }
.tutorial-cat.exp   { background: rgba(255,107,107,0.12); border: 1px solid rgba(255,107,107,0.25); color: var(--red); }

.tutorial-nav {
  display: flex; align-items: center; justify-content: center; gap: 1rem;
}

.slide-dots {
  display: flex; gap: 0.4rem;
}

.slide-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: var(--transition);
}
.slide-dot.active {
  background: var(--cyan);
  width: 24px; border-radius: 4px;
}

/* --- Phase 1: Classify — Drag & Drop --- */
.phase-header {
  text-align: center;
  margin-bottom: 2rem;
}

.phase-tag {
  display: inline-block;
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  font-size: 0.75rem; font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.75rem;
}
.phase-tag.p1 { background: rgba(0,180,216,0.15); color: var(--cyan); }
.phase-tag.p2 { background: rgba(6,214,160,0.15); color: var(--green); }
.phase-tag.p3 { background: rgba(245,158,11,0.15); color: var(--amber); }

.phase-title { font-size: 1.8rem; font-weight: 800; margin-bottom: 0.4rem; }
.phase-desc  { color: var(--text-secondary); font-size: 0.95rem; }

.classify-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

.card-pool {
  display: flex; flex-wrap: wrap; gap: 0.6rem;
  justify-content: center;
  padding: 1.5rem;
  background: var(--bg-glass);
  border: 2px dashed rgba(255,255,255,0.08);
  border-radius: var(--radius-lg);
  min-height: 80px;
}

.drop-zones {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.drop-zone {
  background: var(--bg-glass);
  border: 2px dashed rgba(255,255,255,0.1);
  border-radius: var(--radius-lg);
  padding: 1rem;
  min-height: 220px;
  transition: var(--transition);
}

.drop-zone.drag-over {
  border-color: var(--cyan);
  background: rgba(0,180,216,0.05);
  box-shadow: inset 0 0 30px var(--cyan-glow);
}

.drop-zone.spec-zone .zone-header  { color: var(--cyan); border-bottom-color: rgba(0,180,216,0.2); }
.drop-zone.struct-zone .zone-header { color: var(--green); border-bottom-color: rgba(6,214,160,0.2); }
.drop-zone.exp-zone .zone-header   { color: var(--red); border-bottom-color: rgba(255,107,107,0.2); }

.zone-header {
  text-align: center;
  font-weight: 700; font-size: 0.9rem;
  padding-bottom: 0.75rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid;
}

.zone-cards {
  display: flex; flex-direction: column; gap: 0.5rem;
  min-height: 60px;
}

/* Technique Cards */
.tech-card {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.6rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  cursor: grab;
  font-size: 0.85rem; font-weight: 500;
  transition: var(--transition);
  user-select: none;
}

.tech-card:hover {
  border-color: var(--cyan);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.tech-card.dragging {
  opacity: 0.5;
  transform: rotate(2deg);
}

.tech-card.correct {
  border-color: var(--green);
  background: rgba(6,214,160,0.1);
}

.tech-card.wrong {
  border-color: var(--red);
  background: rgba(255,107,107,0.1);
  animation: shake 0.5s;
}

@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%     { transform: translateX(-6px); }
  40%     { transform: translateX(6px); }
  60%     { transform: translateX(-4px); }
  80%     { transform: translateX(4px); }
}

.tech-card .card-grip {
  color: var(--text-muted); font-size: 0.7rem;
}

/* --- Phase 2: Apply --- */
.scenario-card {
  max-width: 720px; margin: 0 auto;
}

.scenario-header {
  display: flex; align-items: center; gap: 1rem;
  margin-bottom: 1.5rem;
}

.scenario-icon { font-size: 2.5rem; }

.scenario-title { font-size: 1.3rem; font-weight: 700; }

.scenario-desc {
  color: var(--text-secondary);
  font-size: 0.95rem; line-height: 1.7;
  margin-bottom: 1.5rem;
  padding: 1rem 1.25rem;
  background: rgba(255,255,255,0.03);
  border-radius: var(--radius);
  border-left: 3px solid var(--cyan);
}

.scenario-question {
  font-size: 1.05rem; font-weight: 600;
  margin-bottom: 1rem;
}

.options-list {
  display: flex; flex-direction: column; gap: 0.6rem;
  margin-bottom: 1.5rem;
}

.option-btn {
  display: flex; align-items: center; gap: 0.75rem;
  width: 100%;
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border: 1.5px solid var(--border-glass);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem; text-align: left;
  cursor: pointer;
  transition: var(--transition);
}

.option-btn:hover {
  border-color: var(--cyan);
  background: rgba(0,180,216,0.05);
}

.option-btn.selected {
  border-color: var(--cyan);
  background: rgba(0,180,216,0.1);
}

.option-btn.correct-answer {
  border-color: var(--green);
  background: rgba(6,214,160,0.1);
}

.option-btn.wrong-answer {
  border-color: var(--red);
  background: rgba(255,107,107,0.08);
}

.option-letter {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.8rem;
  background: rgba(255,255,255,0.06);
  color: var(--text-secondary);
  flex-shrink: 0;
}

.option-btn.correct-answer .option-letter {
  background: var(--green); color: #fff;
}
.option-btn.wrong-answer .option-letter {
  background: var(--red); color: #fff;
}

/* Feedback Box */
.feedback-box {
  padding: 1.25rem;
  border-radius: var(--radius);
  font-size: 0.9rem; line-height: 1.7;
  margin-bottom: 1rem;
  animation: fadeIn 0.4s ease;
}
.feedback-box.correct {
  background: rgba(6,214,160,0.08);
  border: 1px solid rgba(6,214,160,0.25);
  color: var(--green);
}
.feedback-box.wrong {
  background: rgba(255,107,107,0.08);
  border: 1px solid rgba(255,107,107,0.25);
  color: var(--red);
}

.misconception-alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  background: rgba(245,158,11,0.08);
  border: 1px solid rgba(245,158,11,0.25);
  color: var(--amber);
  font-size: 0.85rem;
  margin-top: 0.75rem;
}
.misconception-alert strong { color: var(--amber); }

/* --- Phase 2: Key Insight Box (redesigned) --- */
.key-insight-box {
  margin-top: 1rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid rgba(245,158,11,0.4);
  background: rgba(245,158,11,0.06);
  overflow: hidden;
  animation: fadeIn 0.35s ease;
}
.key-insight-header {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.55rem 1rem;
  background: rgba(245,158,11,0.12);
  border-bottom: 1px solid rgba(245,158,11,0.2);
}
.key-insight-icon { font-size: 1rem; }
.key-insight-title {
  font-size: 0.7rem; font-weight: 800;
  letter-spacing: 1px;
  color: var(--amber);
  text-transform: uppercase;
}
.key-insight-clause {
  margin-left: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem; font-weight: 600;
  color: rgba(245,158,11,0.7);
  background: rgba(245,158,11,0.1);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  border: 1px solid rgba(245,158,11,0.2);
}
.key-insight-text {
  padding: 0.75rem 1rem 0.5rem;
  font-size: 0.85rem; color: var(--amber);
  margin: 0; line-height: 1.6;
}
.key-insight-note {
  padding: 0 1rem 0.65rem;
  font-size: 0.75rem; color: rgba(245,158,11,0.6);
  margin: 0; font-style: italic;
}

/* --- Phase 3: Strategy --- */
.strategy-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  max-width: 900px;
  margin: 0 auto;
}

.project-brief { grid-column: 1 / -1; }

.project-title {
  display: flex; align-items: center; gap: 0.75rem;
  font-size: 1.4rem; font-weight: 800;
  margin-bottom: 1rem;
}

.project-icon { font-size: 2rem; }

.constraints-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.constraint-item {
  padding: 0.75rem 1rem;
  background: rgba(255,255,255,0.03);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--cyan);
}

.constraint-label {
  font-size: 0.7rem; font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.constraint-value {
  font-size: 0.85rem; color: var(--text-primary);
}

.technique-selection-panel,
.selection-summary-panel {
  min-height: 300px;
}

.technique-selection-panel h3,
.selection-summary-panel h3 {
  font-size: 1rem; font-weight: 700;
  margin-bottom: 1rem;
  display: flex; align-items: center; gap: 0.5rem;
}

.tech-select-list {
  display: flex; flex-direction: column; gap: 0.5rem;
}

.tech-select-item {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.65rem 0.85rem;
  background: var(--bg-card);
  border: 1.5px solid var(--border-glass);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  transition: var(--transition);
}

.tech-select-item:hover { border-color: rgba(255,255,255,0.15); }

.tech-select-item.selected {
  border-color: var(--cyan);
  background: rgba(0,180,216,0.08);
}

.tech-select-item .cat-dot {
  width: 8px; height: 8px;
  border-radius: 50%; flex-shrink: 0;
}
.cat-dot.spec  { background: var(--cyan); }
.cat-dot.struct { background: var(--green); }
.cat-dot.exp   { background: var(--red); }

.selection-count {
  text-align: center;
  padding: 0.6rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.75rem;
}
.selection-count strong { color: var(--cyan); font-family: 'JetBrains Mono', monospace; }

.selected-list {
  display: flex; flex-direction: column; gap: 0.5rem;
  margin-bottom: 1rem;
}

.selected-tag {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem; font-weight: 500;
  background: rgba(0,180,216,0.1);
  border: 1px solid rgba(0,180,216,0.2);
}

.remove-btn {
  background: none; border: none;
  color: var(--red); cursor: pointer;
  font-size: 1rem; padding: 0 0.25rem;
}

/* Strategy Results */
.strategy-result {
  grid-column: 1 / -1;
  animation: fadeIn 0.5s ease;
}

.result-bar {
  height: 8px;
  background: var(--bg-card);
  border-radius: 4px;
  overflow: hidden;
  margin: 1rem 0;
}

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

/* --- Results / Score Screen --- */
.results-screen {
  text-align: center;
  max-width: 600px;
  margin: 0 auto;
}

.results-emoji { font-size: 5rem; margin-bottom: 0.5rem; }

.results-title {
  font-size: 2rem; font-weight: 800;
  margin-bottom: 0.25rem;
}

.results-label {
  font-size: 1.1rem; color: var(--cyan);
  font-weight: 600; margin-bottom: 1.5rem;
}

.score-breakdown {
  display: flex; flex-direction: column; gap: 0.75rem;
  margin: 1.5rem 0;
  text-align: left;
}

.score-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.85rem 1rem;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
}

.score-row .score-phase { font-weight: 600; font-size: 0.9rem; }

.score-row .score-val {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700; color: var(--cyan);
}

.total-score-bar {
  width: 100%; height: 12px;
  background: var(--bg-card);
  border-radius: 6px;
  overflow: hidden;
  margin: 1rem 0;
}

.total-score-fill {
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--cyan), var(--green));
  transition: width 1.5s ease;
}

.results-message {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin: 1rem 0 2rem;
}

.results-actions {
  display: flex; gap: 1rem; justify-content: center;
}

/* --- Misconception Summary (Results) --- */
.misconceptions-summary {
  text-align: left;
  margin-top: 2rem;
}

.misconceptions-summary h3 {
  font-size: 1rem; font-weight: 700;
  margin-bottom: 1rem;
  color: var(--amber);
}

.misconception-item {
  padding: 0.85rem 1rem;
  background: rgba(245,158,11,0.05);
  border: 1px solid rgba(245,158,11,0.15);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .welcome-title { font-size: 2.2rem; }
  .drop-zones { grid-template-columns: 1fr; }
  .strategy-layout { grid-template-columns: 1fr; }
  .tutorial-categories { flex-direction: column; }
  .navbar { padding: 0.75rem 1rem; }
  .screen { padding: 1.5rem 1rem; }
  .phase-connector { width: 40px; }
}

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* ============================================================
   NEW FEATURES — v2.0
   ============================================================ */

/* --- Mute Button --- */
.mute-btn, .theme-toggle-btn {
  background: transparent; border: 1.5px solid var(--border-glass);
  border-radius: var(--radius-sm); padding: 0.35rem 0.6rem;
  cursor: pointer; font-size: 1rem;
  transition: var(--transition); color: var(--text-secondary);
}
.mute-btn:hover, .theme-toggle-btn:hover { border-color: var(--cyan); }

/* --- Score Popup Animation --- */
.score-popup {
  position: fixed; top: 80px; right: 2rem;
  font-size: 1.5rem; font-weight: 900;
  font-family: 'JetBrains Mono', monospace;
  pointer-events: none; z-index: 9999;
  opacity: 0; transform: translateY(0);
  transition: none;
}
.score-popup.popup-correct { color: var(--green); text-shadow: 0 0 20px var(--green-glow); }
.score-popup.popup-wrong   { color: var(--red);   text-shadow: 0 0 20px var(--red-glow); }
.score-popup.popup-visible {
  animation: scoreFloat 1.1s ease forwards;
}
@keyframes scoreFloat {
  0%   { opacity: 0; transform: translateY(0); }
  15%  { opacity: 1; transform: translateY(-8px); }
  70%  { opacity: 1; transform: translateY(-32px); }
  100% { opacity: 0; transform: translateY(-50px); }
}

/* --- Card Actions Group (Phase 1) --- */
.tech-card {
  flex-wrap: wrap; /* allow hint row to wrap */
}

.card-name {
  flex: 1;
}

.card-actions {
  display: flex; align-items: center; gap: 0.3rem;
  margin-left: auto; flex-shrink: 0;
}

/* --- Card Hint Button --- */
.card-hint-btn {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1.5px solid rgba(245,158,11,0.4);
  background: transparent;
  color: var(--amber);
  font-size: 0.65rem;
  cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
  line-height: 1;
}
.card-hint-btn:hover {
  border-color: var(--amber);
  background: rgba(245,158,11,0.12);
  box-shadow: 0 0 8px rgba(245,158,11,0.3);
}

/* --- Card Info Button (Phase 1) --- */
.card-info-btn {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 1.5px solid var(--text-muted);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.7rem; font-weight: 700;
  cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
  line-height: 1;
}
.card-info-btn:hover {
  border-color: var(--cyan); color: var(--cyan);
  background: rgba(0,180,216,0.1);
}

/* --- Hint Text Panel (below card) --- */
.card-hint-text {
  width: 100%;
  margin-top: 0.4rem;
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  font-size: 0.75rem;
  color: var(--amber);
  background: rgba(245,158,11,0.08);
  border: 1px solid rgba(245,158,11,0.2);
  font-style: italic;
  animation: fadeIn 0.25s ease;
}

/* --- Results: Hint Summary Box --- */
.hint-summary-box {
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius-sm);
  background: rgba(245,158,11,0.07);
  border: 1px solid rgba(245,158,11,0.2);
  color: var(--amber);
  font-size: 0.88rem;
}
.hint-summary-perfect {
  background: rgba(6,214,160,0.07);
  border-color: rgba(6,214,160,0.2);
  color: var(--green);
}

/* --- Tech Modal --- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(6px);
  z-index: 200;
}
.tech-modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.92);
  z-index: 201;
  width: min(480px, 90vw);
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: 0 24px 60px rgba(0,0,0,0.6);
  transition: transform 0.25s cubic-bezier(.34,1.56,.64,1), opacity 0.2s;
  opacity: 0;
}
.tech-modal.modal-open {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}
.modal-close {
  position: absolute; top: 1rem; right: 1rem;
  background: transparent; border: none;
  color: var(--text-muted); font-size: 1.1rem;
  cursor: pointer; padding: 0.25rem 0.4rem;
  border-radius: 4px; transition: var(--transition);
}
.modal-close:hover { color: var(--red); background: rgba(255,107,107,0.1); }
.modal-category {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--text-muted); margin-bottom: 0.25rem;
}
.modal-clause {
  font-size: 0.72rem; color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  margin-bottom: 0.5rem;
}
.modal-title {
  font-size: 1.35rem; font-weight: 800;
  color: var(--text-primary); margin-bottom: 0.75rem;
}
.modal-desc {
  font-size: 0.9rem; color: var(--text-secondary);
  line-height: 1.7; margin-bottom: 1.25rem;
}
.modal-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem;
}
.modal-info-box {
  padding: 0.85rem;
  background: rgba(255,255,255,0.03);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-glass);
}
.modal-info-label {
  font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-muted); margin-bottom: 0.4rem;
}
.modal-info-val {
  font-size: 0.82rem; color: var(--text-secondary);
  line-height: 1.5;
}

/* --- ISO 25010 Quality Badge (Phase 2) --- */
.iso-quality-badge {
  display: inline-flex; align-items: center; gap: 0.4rem;
  margin-top: 0.35rem;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  border: 1px solid;
  font-size: 0.72rem; font-weight: 600;
  background: rgba(255,255,255,0.03);
  flex-wrap: wrap;
}
.iso-quality-sub {
  opacity: 0.75;
  font-weight: 400;
}
.iso-clause-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  opacity: 0.6;
  margin-left: 0.2rem;
}

/* --- Phase 3 Technique Score Breakdown --- */
.tech-score-breakdown {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
}
.tech-score-title {
  font-size: 0.75rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-muted); margin-bottom: 0.6rem;
}
.tech-score-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.35rem 0;
  font-size: 0.82rem; color: var(--text-secondary);
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.tech-score-row:last-child { border-bottom: none; }

/* --- Constraint Clause 4 Tag (Phase 3) --- */
.constraint-clause4 {
  font-size: 0.65rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
  margin-bottom: 0.25rem;
  display: flex; align-items: center; gap: 0.3rem;
}
.constraint-clause-num {
  font-family: 'JetBrains Mono', monospace;
  opacity: 0.7; font-weight: 400; font-size: 0.6rem;
}

/* --- Phase 3 Strategy Insights (Results) --- */
.insights-summary {
  text-align: left;
  margin-top: 2rem;
}
.insights-summary h3 {
  font-size: 1rem; font-weight: 700;
  margin-bottom: 1rem;
  color: var(--cyan);
}
.insight-item {
  display: flex; align-items: flex-start; gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: rgba(0,180,216,0.05);
  border: 1px solid rgba(0,180,216,0.15);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  animation: fadeIn 0.4s ease;
}
.insight-num {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(0,180,216,0.2);
  color: var(--cyan);
  font-size: 0.72rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

/* --- Tutorial: Clause 4 Grid (Selection Criteria slide) --- */
.tutorial-clause4-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin: 0.75rem 0;
  text-align: left;
}
.clause4-item {
  display: flex; align-items: flex-start; gap: 0.6rem;
  padding: 0.65rem 0.85rem;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
}
.c4-icon { font-size: 1.1rem; flex-shrink: 0; }
.clause4-item small { color: var(--text-muted); font-size: 0.72rem; display: block; margin-top: 0.15rem; }

@media (max-width: 500px) {
  .tutorial-clause4-grid { grid-template-columns: 1fr; }
}

/* ── Comparison Panel (Phase 2 comparison scenarios) ── */
.comparison-panel { display:flex; align-items:stretch; border-radius:10px; overflow:hidden; margin:1rem 0 1.2rem; border:1px solid var(--border-glass); }
.compare-side { flex:1; padding:0.9rem 1.1rem; }
.compare-left  { background:rgba(0,180,216,0.07); border-right:1px solid var(--border-glass); }
.compare-right { background:rgba(6,214,160,0.07); }
.compare-vs { display:flex; align-items:center; justify-content:center; padding:0 0.75rem; font-weight:900; font-size:0.85rem; color:var(--text-muted); background:var(--bg-card); flex-shrink:0; }
.compare-name { font-weight:700; font-size:0.88rem; margin-bottom:0.35rem; }
.compare-key  { font-size:0.8rem; color:var(--text-secondary); line-height:1.55; }

/* ── Phase 4 Tag ── */
.phase-tag.p4 { background:rgba(160,100,255,0.15); color:#a064ff; border:1px solid rgba(160,100,255,0.3); }

/* ── Phase 4 Exercise Card ── */
.p4-exercise-card { max-width:760px; margin:0 auto; padding:2rem; }
.p4-header { margin-bottom:1rem; }
.p4-title  { font-size:1.15rem; font-weight:700; margin:0.4rem 0; }
.p4-desc   { color:var(--text-secondary); line-height:1.7; margin:0; }
.p4-legend { font-size:0.78rem; color:var(--text-muted); margin-bottom:1rem; display:flex; flex-wrap:wrap; gap:0.3rem; align-items:center; }
.p4-actions { margin-top:1.5rem; text-align:center; }

/* ── Coverage Items ── */
.coverage-items-grid { display:grid; gap:0.45rem; }
.coverage-item {
  display:flex; align-items:center; gap:0.6rem;
  padding:0.6rem 0.9rem; border-radius:8px;
  border:1px solid var(--border-glass); cursor:pointer;
  transition:border-color 0.15s, background 0.15s;
  background:var(--bg-card);
}
.coverage-item:hover { border-color:var(--cyan); }
.coverage-item.selected { border-color:var(--green); background:rgba(6,214,160,0.08); }
.coverage-item.cov-correct { border-color:var(--green)!important; background:rgba(6,214,160,0.12)!important; }
.coverage-item.cov-missed  { border-color:var(--red)!important;   background:rgba(255,107,107,0.1)!important; }
.coverage-item.cov-wrong   { border-color:var(--amber)!important; background:rgba(245,158,11,0.1)!important; }
.cov-checkbox { font-size:1.05rem; min-width:1.15rem; }
.cov-label    { font-size:0.85rem; }

/* ── Category Badges ── */
.cov-badge { font-size:0.65rem; font-weight:700; padding:2px 7px; border-radius:4px; white-space:nowrap; flex-shrink:0; }
.cat-EP    { background:rgba(0,180,216,0.15); color:var(--cyan); }
.cat-BVA   { background:rgba(0,180,216,0.1);  color:var(--cyan); border:1px solid rgba(0,180,216,0.3); }
.cat-EXTRA { background:rgba(255,107,107,0.1); color:var(--red); }

/* ── Reference Panel ── */
.reference-panel {
  position: fixed;
  top: 0; right: 0;
  width: 320px; height: 100vh;
  z-index: 600;
  background: var(--bg-card);
  border-left: 1px solid var(--border-glass);
  display: flex; flex-direction: column;
  box-shadow: -6px 0 32px rgba(0,0,0,0.35);
  animation: slide-in-right 0.22s ease;
}
.reference-panel.hidden { display: none; }
@keyframes slide-in-right {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
.ref-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 599;
}
.ref-overlay.hidden { display: none; }

.ref-panel-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--border-glass);
  font-weight: 700; font-size: 0.95rem;
  flex-shrink: 0;
}
.ref-close-btn {
  background: none; border: none; cursor: pointer;
  font-size: 1.1rem; color: var(--text-muted);
  transition: color 0.15s;
}
.ref-close-btn:hover { color: var(--text-primary); }

.ref-search-input {
  margin: 0.75rem;
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border-glass);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.85rem;
  width: calc(100% - 1.5rem);
  box-sizing: border-box;
  flex-shrink: 0;
  outline: none;
  transition: border-color 0.15s;
}
.ref-search-input:focus { border-color: var(--cyan); }

.ref-list {
  flex: 1; overflow-y: auto;
  padding: 0 0.75rem 1.5rem;
}
.ref-item {
  padding: 0.7rem 0.8rem;
  border-radius: 8px;
  border: 1px solid var(--border-glass);
  margin-bottom: 0.45rem;
  background: var(--bg-primary);
}
.ref-item-header {
  display: flex; align-items: center; gap: 0.4rem;
  margin-bottom: 0.3rem; flex-wrap: wrap;
}
.ref-name   { font-weight: 700; font-size: 0.84rem; }
.ref-clause {
  margin-left: auto;
  font-size: 0.68rem; color: var(--cyan);
  padding: 2px 6px; border-radius: 4px;
  border: 1px solid rgba(0,180,216,0.3);
  white-space: nowrap;
}
.ref-desc  { font-size: 0.78rem; color: var(--text-secondary); line-height: 1.55; margin: 0; }
.ref-empty { color: var(--text-muted); text-align: center; padding: 1.5rem; font-size: 0.85rem; }


