/* ============================================================
   components.css — Light theme components
   ============================================================ */

/* ── Sidebar label ───────────────────────────────────────── */
.sidebar-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--text4);
  margin-bottom: 10px;
  font-family: var(--font-mono);
}

/* ── System buttons ──────────────────────────────────────── */
.system-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 8px;
  border-radius: var(--r);
  border: 1px solid transparent;
  background: none;
  cursor: pointer;
  color: var(--text2);
  font-size: 12.5px;
  text-align: left;
  font-family: var(--font-body);
  font-weight: 500;
  transition: background var(--dur-fast), color var(--dur-fast),
              border-color var(--dur-fast);
  position: relative;
}
.system-btn::before {
  content: '';
  position: absolute;
  left: -12px; top: 50%;
  transform: translateY(-50%) scaleY(0);
  width: 3px; height: 60%;
  background: var(--indigo);
  border-radius: 2px;
  transition: transform var(--dur) var(--ease-spring);
}
.system-btn:hover {
  background: var(--bg2);
  color: var(--text);
  border-color: var(--border);
}
.system-btn.active {
  background: var(--indigo3);
  color: var(--indigo);
  border-color: rgba(var(--indigo-rgb), 0.18);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.system-btn.active::before { transform: translateY(-50%) scaleY(1); }

.system-btn .s-icon {
  font-size: 14px;
  flex-shrink: 0;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm);
  background: var(--bg2);
  border: 1px solid var(--border);
  transition: background var(--dur-micro) var(--ease-snappy),
              transform var(--dur) var(--ease-spring);
}
.system-btn.active .s-icon {
  background: var(--indigo3);
  border-color: rgba(var(--indigo-rgb), 0.20);
}
.system-btn:hover .s-icon { transform: scale(1.08); }
.system-btn .s-name { flex: 1; line-height: 1.3; }

/* ── Param controls ──────────────────────────────────────── */
.param-group { margin-bottom: 18px; }

.param-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10.5px;
  color: var(--text3);
  margin-bottom: 9px;
  font-weight: 500;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}
.param-label span {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--indigo);
  background: var(--indigo3);
  padding: 1px 7px;
  border-radius: 20px;
  border: 1px solid rgba(var(--indigo-rgb), 0.18);
  letter-spacing: 0.03em;
  transition: box-shadow var(--dur-fast), background var(--dur-fast);
}
.param-label span.flash {
  animation: value-flash 0.32s var(--ease-out);
}

/* ── Metric pills ────────────────────────────────────────── */
.metric-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px 24px 14px;
  min-width: 132px;
  background: var(--bg1);
  border: none;
  border-right: 1px solid var(--border);
  cursor: default;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  transition: background var(--dur-micro) var(--ease-snappy);
}
.metric-pill:last-child { border-right: none; }
.metric-pill:hover { background: rgba(248,250,252,0.8); }

.metric-pill::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--bg3);
}

.metric-pill-val {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
  letter-spacing: -1px;
  position: relative;
  z-index: 1;
  font-variant-numeric: tabular-nums;
}
.metric-pill-lbl {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .10em;
  text-transform: uppercase;
  color: var(--text4);
  margin-top: 5px;
  font-family: var(--font-mono);
  position: relative;
  z-index: 1;
}

.metric-pill.accent::before { background: var(--indigo); }
.metric-pill.teal::before   { background: var(--teal); }
.metric-pill.amber::before  { background: var(--amber); }
.metric-pill.green::before  { background: var(--green); }
.metric-pill.purple::before { background: var(--purple); }

.metric-pill.accent .metric-pill-val { color: var(--indigo); }
.metric-pill.teal   .metric-pill-val { color: var(--teal); }
.metric-pill.amber  .metric-pill-val { color: var(--amber); }
.metric-pill.green  .metric-pill-val { color: var(--green); }
.metric-pill.purple .metric-pill-val { color: var(--purple); }

/* ── Step cards ──────────────────────────────────────────── */
.step-card {
  background: var(--bg1);
  border: 1px solid var(--border);
  border-left: 3px solid transparent;
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--dur-micro) var(--ease-snappy),
              border-left-color var(--dur) var(--ease-out),
              box-shadow var(--dur) var(--ease-out);
}
.step-card:hover {
  border-color: var(--border2);
  border-left-color: rgba(var(--indigo-rgb), 0.35);
  box-shadow: var(--shadow);
}
.step-card.open {
  border-color: rgba(var(--indigo-rgb), 0.22);
  border-left-color: var(--indigo);
  box-shadow: var(--shadow), 0 0 0 1px rgba(var(--indigo-rgb), 0.06);
}

.step-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  cursor: pointer;
  user-select: none;
  background: var(--bg1);
  transition: background var(--dur-micro) var(--ease-snappy);
}
.step-head:hover { background: var(--bg2); }
.step-card.open .step-head { background: var(--bg2); }

.step-num-badge {
  width: 26px; height: 26px;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800;
  font-family: var(--font-mono);
  flex-shrink: 0;
  background: var(--bg2);
  color: var(--text3);
  border: 1px solid var(--border2);
  transition: all var(--dur) var(--ease-spring);
}
.step-card.open .step-num-badge {
  background: var(--indigo);
  color: white;
  border-color: var(--indigo);
  transform: scale(1.06);
  box-shadow: 0 2px 8px rgba(var(--indigo-rgb), 0.35);
}

.step-title-wrap { flex: 1; min-width: 0; }
.step-counter {
  font-size: 9px;
  font-family: var(--font-mono);
  color: var(--text4);
  font-weight: 600;
  margin-top: 2px;
  letter-spacing: 0.04em;
}
.step-card.open .step-counter { color: rgba(var(--indigo-rgb), 0.55); }

.step-title {
  font-size: 13.5px;
  font-weight: 700;
  font-family: var(--font-head);
  color: var(--text);
  flex: 1;
  letter-spacing: -0.2px;
}

.step-summary {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--indigo);
  padding: 2px 8px;
  background: var(--indigo3);
  border-radius: 20px;
  white-space: nowrap;
  font-weight: 700;
  border: 1px solid rgba(var(--indigo-rgb), 0.15);
  letter-spacing: 0.02em;
}

.chevron {
  color: var(--text4);
  font-size: 9px;
  transition: transform var(--dur) var(--ease-out), color var(--dur-fast);
  flex-shrink: 0;
}
.step-card.open .chevron  { transform: rotate(180deg); color: var(--indigo); }
.step-card:hover .chevron { color: var(--text3); }

.step-body-wrap {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.30s var(--ease-out);
}
.step-card.open .step-body-wrap { grid-template-rows: 1fr; }
.step-body-inner {
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.20s var(--ease-snappy);
  transition-delay: 0s;
}
.step-card.open .step-body-inner {
  opacity: 1;
  transition-delay: 0.10s;
}
.step-body {
  padding: 18px 18px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg0);
}

/* ── Formula box ─────────────────────────────────────────── */
.formula-box {
  background: #0F172A;
  border: 1px solid rgba(var(--indigo-rgb),0.25);
  border-left: 3px solid var(--indigo);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: #94A3B8;
  margin-bottom: 14px;
  line-height: 2.2;
  overflow-x: auto;
  white-space: nowrap;
  position: relative;
  box-shadow: 0 2px 12px rgba(15,23,42,0.10);
}
.formula-box::before {
  content: 'FORMULA';
  position: absolute;
  top: 8px; right: 10px;
  font-size: 7.5px; font-weight: 800; letter-spacing: .14em;
  color: rgba(var(--indigo-rgb),0.5);
}
.formula-box .v { color: #818CF8; font-weight: 700; }
.formula-box .r { color: #FCD34D; font-weight: 700; }

/* ── Metrics table ───────────────────────────────────────── */
.metrics-table { width: 100%; border-collapse: collapse; }
.metrics-table tr { border-bottom: 1px solid var(--border); }
.metrics-table tr:last-child { border-bottom: none; }
.metrics-table td { padding: 7px 0; font-size: 11.5px; vertical-align: middle; }
.metrics-table td:first-child  { color: var(--text3); width: 57%; padding-right: 12px; font-weight: 500; }
.metrics-table td:last-child   { text-align: right; font-family: var(--font-mono); font-size: 11.5px; color: var(--text2); font-weight: 600; }
.metrics-table .hl   { color: var(--indigo); font-weight: 700; }
.metrics-table .warn { color: var(--amber);  font-weight: 700; }
.metrics-table .good { color: var(--teal);   font-weight: 700; }

/* ── Tags ────────────────────────────────────────────────── */
.tag { display: inline-block; font-size: 10px; padding: 1px 6px; border-radius: 3px; margin-left: 5px; font-family: var(--font-mono); font-weight: 700; letter-spacing: 0.03em; }
.tag-blue  { background: var(--indigo3);                   color: var(--indigo); }
.tag-amber { background: rgba(245,158,11,0.10);            color: var(--amber);  }
.tag-red   { background: rgba(var(--red-rgb),0.10);        color: var(--red);    }
.tag-teal  { background: rgba(var(--teal-rgb),0.10);       color: var(--teal);   }

/* ── Info box ────────────────────────────────────────────── */
.info-box {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--r);
  padding: 11px 13px;
  margin-top: 12px;
}
.info-box-title {
  font-size: 10.5px; font-weight: 700; color: var(--amber);
  margin-bottom: 5px; font-family: var(--font-mono);
  letter-spacing: 0.04em; text-transform: uppercase;
}
.info-box-body { font-size: 11.5px; color: var(--text2); line-height: 1.65; }

/* ── Tips box ────────────────────────────────────────────── */
.tips-box {
  background: var(--bg1);
  border: 1px solid var(--border);
  border-left: 3px solid var(--indigo);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  margin-top: 4px;
  box-shadow: var(--shadow-sm);
}
.tips-box-head {
  font-size: 9px; font-weight: 700; letter-spacing: .16em;
  color: var(--indigo); text-transform: uppercase;
  margin-bottom: 10px; font-family: var(--font-mono);
}
.tips-list { list-style: none; }
.tips-list li {
  font-size: 11.5px; color: var(--text2);
  padding: 5px 0 5px 16px; position: relative;
  line-height: 1.6; border-bottom: 1px solid var(--border);
}
.tips-list li:last-child { border-bottom: none; }
.tips-list li::before {
  content: '›'; position: absolute; left: 0;
  color: var(--indigo); font-weight: 700; font-size: 14px; line-height: 1.3;
  transition: transform var(--dur-fast) var(--ease-out);
}
.tips-list li:hover::before { transform: translateX(3px); }
.tips-list li strong { color: var(--indigo); font-weight: 600; }

/* ── Right panel tabs ────────────────────────────────────── */
.rp-tab {
  flex: 1;
  padding: 10px 6px;
  border-radius: 0;
  font-size: 9.5px; font-weight: 500;
  text-align: center;
  cursor: pointer;
  color: var(--text3);
  border: none; background: none;
  border-bottom: 2px solid transparent;
  transition: color var(--dur-fast), border-color var(--dur-fast);
  font-family: var(--font-mono);
  letter-spacing: 0.04em; text-transform: uppercase;
}
.rp-tab:hover:not(.active) { color: var(--text2); }
.rp-tab.active {
  color: var(--indigo);
  font-weight: 700;
  border-bottom-color: var(--indigo);
}

.rp-section-title {
  font-size: 9px; font-weight: 700; letter-spacing: .16em;
  text-transform: uppercase; color: var(--text4);
  padding: 8px 0 7px; margin-top: 2px;
  font-family: var(--font-mono);
}

/* ── Architecture canvas ─────────────────────────────────── */
.arch-canvas {
  background: var(--bg1);
  border: 1px solid var(--border2);
  border-radius: var(--r);
  overflow: hidden;
  margin-bottom: 10px;
  padding: 8px;
  box-shadow: var(--shadow-sm);
}
.arch-canvas svg { display: block; width: 100%; }

/* ── Component cards ─────────────────────────────────────── */
.comp-card {
  background: var(--bg1);
  border: 1px solid var(--border);
  border-left: 3px solid transparent;
  border-radius: var(--r-lg);
  padding: 12px 13px;
  margin-bottom: 7px;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--dur-micro) var(--ease-snappy),
              border-left-color var(--dur) var(--ease-out),
              box-shadow var(--dur) var(--ease-out),
              background var(--dur-micro) var(--ease-snappy);
}
.comp-card:hover {
  border-color: var(--border2);
  border-left-color: var(--teal);
  background: rgba(16,185,129,0.02);
  box-shadow: var(--shadow);
}
.comp-card-head { display: flex; align-items: center; gap: 9px; margin-bottom: 7px; }

.comp-icon {
  font-size: 15px; width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg2); border-radius: var(--r-sm);
  border: 1px solid var(--border2); flex-shrink: 0;
}
.comp-name {
  font-size: 12px; font-weight: 700; font-family: var(--font-head);
  color: var(--text); flex: 1; letter-spacing: -0.1px;
}
.best-badge {
  font-size: 8.5px; padding: 2px 7px; border-radius: 3px;
  background: rgba(16,185,129,0.10); color: var(--green);
  font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  border: 1px solid rgba(16,185,129,0.22); font-family: var(--font-mono);
}
.alt-badge {
  font-size: 8.5px; padding: 2px 7px; border-radius: 3px;
  background: var(--bg2); color: var(--text3);
  font-weight: 600; letter-spacing: .04em;
  border: 1px solid var(--border2); font-family: var(--font-mono);
}
.comp-reason { font-size: 11.5px; color: var(--text2); line-height: 1.6; }
.comp-stats  { display: flex; gap: 4px; margin-top: 9px; flex-wrap: wrap; }
.comp-stat {
  font-size: 9.5px; font-family: var(--font-mono); font-weight: 700;
  padding: 2px 7px; border-radius: 3px;
  background: rgba(var(--teal-rgb), 0.08);
  color: var(--teal); border: 1px solid rgba(var(--teal-rgb), 0.18);
  letter-spacing: 0.03em;
}

/* ── Bottleneck warning ──────────────────────────────────── */
.bottleneck-warn {
  background: rgba(239,68,68,0.05);
  border: 1px solid rgba(239,68,68,0.20);
  border-left: 3px solid var(--red);
  border-radius: var(--r);
  padding: 10px 14px;
  margin-bottom: 4px;
  font-size: 11.5px;
  color: #991B1B;
  line-height: 1.55;
  animation: shake-in 0.4s var(--ease-out);
  box-shadow: 0 2px 8px rgba(239,68,68,0.08);
}
.bottleneck-warn strong { font-weight: 700; color: var(--red); }

/* ── Tradeoff table ──────────────────────────────────────── */
.tradeoff-table { width: 100%; border-collapse: collapse; }
.tradeoff-table th {
  font-size: 9px; text-transform: uppercase; letter-spacing: .12em;
  color: var(--text4); padding: 0 0 8px; text-align: left;
  font-weight: 700; font-family: var(--font-mono);
}
.tradeoff-table td {
  padding: 7px 0; font-size: 11px;
  border-bottom: 1px solid var(--border);
  vertical-align: top; line-height: 1.5;
}
.tradeoff-table tr:last-child td { border-bottom: none; }
.tradeoff-table td:first-child {
  color: var(--text2); font-weight: 600; font-family: var(--font-mono);
  padding-right: 10px; width: 38%; font-size: 10.5px;
}
.pro { color: var(--teal) !important; font-weight: 600; }
.con { color: var(--red)  !important; font-weight: 600; }

/* ── Cheat sheet ─────────────────────────────────────────── */
.cheat-title {
  font-family: var(--font-head); font-size: 22px; font-weight: 700;
  margin-bottom: 18px; color: var(--text); letter-spacing: -0.5px;
}

/* ── Interview timer ─────────────────────────────────────── */
.timer-wrap { display: flex; align-items: center; gap: 7px; }

.timer-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 13px;
  background: var(--indigo3);
  border: 1px solid rgba(var(--indigo-rgb), 0.20);
  border-radius: 20px;
  color: var(--indigo); font-size: 12px; font-weight: 600;
  cursor: pointer; font-family: var(--font-mono);
  transition: background var(--dur-fast), box-shadow var(--dur-fast);
  letter-spacing: 0.03em;
}
.timer-btn:hover {
  background: rgba(var(--indigo-rgb), 0.13);
  box-shadow: var(--shadow-violet);
}

.timer-display {
  display: flex; align-items: center; gap: 8px;
  background: var(--indigo3);
  border: 1px solid rgba(var(--indigo-rgb), 0.22);
  border-radius: 20px;
  padding: 5px 12px;
  box-shadow: var(--shadow-sm);
}
#timer-countdown {
  font-family: var(--font-mono); font-size: 13px; font-weight: 700;
  color: var(--indigo); letter-spacing: 0.06em; min-width: 36px;
}
#timer-countdown.timer-warn {
  color: var(--red);
  animation: timer-pulse 1s var(--ease-in-out) infinite;
}
.timer-stop {
  font-size: 10px; color: var(--text3); background: none;
  border: none; cursor: pointer; padding: 0 2px; line-height: 1;
  transition: color var(--dur-fast);
}
.timer-stop:hover { color: var(--red); }

.timer-toast {
  position: fixed;
  top: calc(var(--header-h) + 12px);
  left: 50%; transform: translateX(-50%);
  z-index: 200;
  background: var(--bg1);
  border: 1px solid rgba(var(--indigo-rgb), 0.20);
  border-left: 3px solid var(--indigo);
  border-radius: var(--r-lg);
  padding: 12px 18px;
  font-size: 12.5px; font-weight: 500; color: var(--text);
  max-width: 540px; width: calc(100vw - 48px);
  box-shadow: var(--shadow-lg);
  line-height: 1.55;
}
.toast-enter { animation: toast-slide-in 0.38s var(--ease-out) forwards; }
.toast-exit  { animation: toast-slide-out 0.38s var(--ease-in-out) forwards; }

/* ── Export button ───────────────────────────────────────── */
.export-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 12px;
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: 20px; color: var(--text3);
  font-size: 12px; font-weight: 500; cursor: pointer;
  font-family: var(--font-mono);
  transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast);
  letter-spacing: 0.02em;
}
.export-btn:hover { background: var(--bg3); border-color: var(--border3); color: var(--text); }

/* ── Glossary tooltip ────────────────────────────────────── */
.g-tip {
  border-bottom: 1px dashed rgba(var(--indigo-rgb), 0.45);
  color: var(--indigo); cursor: help; font-weight: 600;
  transition: background var(--dur-fast);
}
.g-tip:hover { background: var(--indigo3); border-radius: 2px; }

.glossary-tooltip {
  position: fixed; z-index: 300;
  background: var(--bg1); color: var(--text2);
  font-size: 11.5px; line-height: 1.65;
  padding: 10px 14px;
  border-radius: var(--r);
  border: 1px solid var(--border2);
  box-shadow: var(--shadow-lg);
  pointer-events: none;
  animation: fade-in 0.14s var(--ease-out);
  font-family: var(--font-body); max-width: 280px;
}

/* ── Glossary right-panel list ───────────────────────────── */
.glossary-list { display: flex; flex-direction: column; }
.glossary-entry { padding: 8px 0; border-bottom: 1px solid var(--border); }
.glossary-entry:last-child { border-bottom: none; }
.glossary-term-label {
  font-size: 11px; font-weight: 700; font-family: var(--font-mono);
  color: var(--indigo); margin-bottom: 3px; letter-spacing: 0.03em;
}
.glossary-def { font-size: 11px; color: var(--text3); line-height: 1.6; }

/* ── Arch tab header + 2D/3D toggle ─────────────────────── */
.arch-tab-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.arch-view-toggle {
  display: flex;
  gap: 2px;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 7px;
  padding: 2px;
}
.arch-tog-btn {
  padding: 4px 12px;
  font-size: 10.5px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text3);
  background: transparent;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: all var(--dur-fast) var(--ease-snappy);
}
.arch-tog-btn:hover { color: var(--text); background: var(--bg3); }
.arch-tog-btn.active {
  background: var(--indigo);
  color: white;
  box-shadow: 0 1px 6px rgba(var(--indigo-rgb), 0.35);
}

.arch-hint {
  font-size: 10.5px;
  color: var(--text4);
  line-height: 1.55;
  margin-top: 10px;
  font-style: italic;
}

/* ── 3D Architecture Scene ───────────────────────────────── */
.arch3d-wrap { width: 100%; }

.arch3d-scene {
  width: 100%;
  height: 290px;
  perspective: 1400px;
  perspective-origin: 50% 5%;
  position: relative;
  overflow: hidden;
}

.arch3d-stage {
  transform-style: preserve-3d;
  transform: rotateX(44deg) rotateY(-3deg);
  position: absolute;
  top: 260px; left: 8px; right: 8px;
  height: 44px;
}

.arch3d-tier {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 44px;
  transform: translateZ(calc(var(--z) * 1px));
  transform-style: preserve-3d;
}

.arch3d-tier-face {
  position: absolute;
  inset: 0;
  background: rgba(var(--tcr), 0.07);
  border: 1.5px solid rgba(var(--tcr), 0.45);
  border-radius: 9px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(var(--tcr), 0.12), 0 1px 0 rgba(255,255,255,0.5) inset;
}

.arch3d-tier-face::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 50%;
  background: linear-gradient(180deg, rgba(255,255,255,0.06) 0%, transparent 100%);
  pointer-events: none;
  border-radius: 9px 9px 0 0;
}

.arch3d-tier-bn .arch3d-tier-face {
  border-color: rgba(239,68,68,0.65);
  background: rgba(239,68,68,0.06);
  animation: tier3d-pulse 1.6s ease-in-out infinite;
}

@keyframes tier3d-pulse {
  0%, 100% { border-color: rgba(239,68,68,0.55); box-shadow: none; }
  50%       { border-color: rgba(239,68,68,0.9); box-shadow: 0 0 12px rgba(239,68,68,0.22); }
}

.arch3d-tier-nodes {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: nowrap;
  overflow: hidden;
  width: 100%;
}

.arch3d-node {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  background: rgba(var(--ncr), 0.10);
  border: 1px solid rgba(var(--ncr), 0.38);
  border-radius: 5px;
  flex-shrink: 0;
  max-width: 120px;
}

.arch3d-node-dim { opacity: 0.4; }

.arch3d-node-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--nc, #2BA07E);
  flex-shrink: 0;
}

.arch3d-node-lbl {
  font-size: 9.5px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--nc, #2BA07E);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.arch3d-node-hot .arch3d-node-dot {
  background: #ef4444;
  animation: node-pulse 1.3s ease-in-out infinite;
}

.arch3d-edge-label {
  position: absolute;
  top: -18px; left: 10px;
  font-size: 8px;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--tc, #2BA07E);
  opacity: 0.65;
  white-space: nowrap;
  letter-spacing: 0.04em;
}

.arch3d-flows {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px 8px;
}

.arch3d-flow-tag {
  font-size: 8.5px;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text3);
  background: var(--bg2);
  border: 1px solid var(--border2);
  padding: 1px 6px;
  border-radius: 4px;
}

/* ── Print ───────────────────────────────────────────────── */
@media print {
  .header, .left-sidebar, .right-panel, .timer-wrap, .export-btn,
  .version-badge, .glossary-tooltip, .timer-toast { display: none !important; }
  body, .body-wrap, .center-panel, .steps-area { overflow: visible; height: auto; }
  .body-wrap { display: block; }
  .center-panel { display: block; width: 100%; }
  .steps-area { padding: 0; display: block; background: var(--bg1); }
  .steps-inner { max-width: 100%; }
  .step-card { box-shadow: none; border: 1px solid #ddd; margin-bottom: 8px; break-inside: avoid; }
  .step-body-wrap { grid-template-rows: 1fr !important; }
}

/* ── Achievements ──────────────────────────────────────── */
.ach-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}
.ach-badge {
  aspect-ratio: 1;
  border-radius: 8px;
  background: var(--bg2);
  border: 1.5px solid var(--border2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  transition: transform var(--dur-fast), border-color var(--dur-fast);
  position: relative;
  overflow: hidden;
}
.ach-badge-icon {
  font-size: 16px;
  filter: grayscale(1) opacity(0.35);
  line-height: 1;
}
.ach-badge-done .ach-badge-icon { filter: none; }
.ach-badge-done {
  background: rgba(var(--indigo-rgb),0.06);
  border-color: rgba(var(--indigo-rgb),0.30);
}
.ach-badge-done:hover { transform: scale(1.12); border-color: var(--indigo); }

/* ── Achievement unlock toast ───────────────────────────── */
.ach-toast {
  position: fixed;
  bottom: 28px;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg);
  border: 1.5px solid rgba(var(--indigo-rgb),0.35);
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  z-index: 9999;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
  max-width: 300px;
}
.ach-toast.ach-toast-show {
  opacity: 1;
  transform: translateY(0);
}
.ach-toast-icon {
  font-size: 28px;
  line-height: 1;
  flex-shrink: 0;
}
.ach-toast-eyebrow {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--indigo);
  text-transform: uppercase;
  margin-bottom: 2px;
}
.ach-toast-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text1);
}
.ach-toast-desc {
  font-size: 11px;
  color: var(--text3);
  margin-top: 1px;
}

/* ── Extra keyframes ─────────────────────────────────────── */
@keyframes timer-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}
@keyframes toast-slide-in {
  from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@keyframes toast-slide-out {
  from { opacity: 1; transform: translateX(-50%) translateY(0); }
  to   { opacity: 0; transform: translateX(-50%) translateY(-8px); }
}

/* ── Phase content sections ──────────────────────────────── */
.req-section {
  background: var(--bg1);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-sm);
}

.req-section-title {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--indigo);
  font-family: var(--font-mono);
}

.req-list {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 13px;
  color: var(--text2);
  line-height: 1.55;
}

.req-list li { padding-left: 3px; }

.req-list.req-list-q li::marker {
  content: '? ';
  color: var(--amber);
  font-weight: 700;
}

.req-list.req-list-oos {
  color: var(--text3);
}
.req-list.req-list-oos li::marker {
  content: '✕ ';
  color: var(--red);
}

.req-list.req-list-warn li::marker {
  content: '⚠ ';
}

/* ── Architecture canvas (large, phase 3) ────────────────── */
.arch-canvas-lg {
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg0);
  min-height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
}
.arch-canvas-lg svg {
  width: 100%;
  height: auto;
  max-height: 480px;
}

/* ── HLD data flow & API items ───────────────────────────── */
.hld-api-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.hld-api-item {
  background: var(--bg0);
  border: 1px solid var(--border2);
  border-radius: 6px;
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text2);
  line-height: 1.5;
}

/* ── HLD hero arch card ──────────────────────────────────── */
.hld-arch-hero {
  padding: 14px 16px 12px;
}
.hld-arch-header {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
}

/* ── Write / Read flow cards ─────────────────────────────── */
.hld-flows {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.hld-flow-title { margin-bottom: 4px; }
.hld-write { color: var(--indigo) !important; }
.hld-read  { color: var(--amber)  !important; }

.hld-step-chain {
  display: flex;
  flex-direction: column;
}

.hld-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  opacity: 0;
  animation: hld-step-in 0.28s ease forwards;
}

@keyframes hld-step-in {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}
@media (prefers-reduced-motion: reduce) {
  .hld-step { animation: none; opacity: 1; }
}

.hld-step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--indigo3);
  border: 1px solid rgba(var(--indigo-rgb), 0.20);
  color: var(--indigo);
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-mono);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.hld-step-label {
  font-size: 12.5px;
  color: var(--text2);
  font-weight: 500;
  line-height: 1.35;
}

.hld-step-connector {
  width: 1px;
  height: 10px;
  background: var(--border2);
  margin-left: 10px;
}

/* ── API items with method badge ─────────────────────────── */
.hld-api-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.hld-api-item {
  display: flex;
  align-items: baseline;
  gap: 9px;
  background: var(--bg0);
  border: 1px solid var(--border2);
  border-radius: 6px;
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text2);
  line-height: 1.5;
  opacity: 0;
  animation: hld-step-in 0.28s ease forwards;
}
@media (prefers-reduced-motion: reduce) {
  .hld-api-item { animation: none; opacity: 1; }
}

.api-method {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .06em;
  padding: 2px 6px;
  border-radius: 3px;
  flex-shrink: 0;
  font-family: var(--font-mono);
}
.api-get  .api-method { background: rgba(43,160,126,0.10); color: var(--green); border: 1px solid rgba(43,160,126,0.22); }
.api-post .api-method { background: rgba(99,102,241,0.10); color: #6366f1;      border: 1px solid rgba(99,102,241,0.22); }
.api-del  .api-method { background: rgba(217,72,72,0.10);  color: var(--red);   border: 1px solid rgba(217,72,72,0.22); }
.api-ws   .api-method { background: rgba(212,130,14,0.10); color: var(--amber); border: 1px solid rgba(212,130,14,0.22); }
.api-put  .api-method { background: rgba(124,92,246,0.10); color: var(--purple);border: 1px solid rgba(124,92,246,0.22); }
.api-rpc  .api-method { background: var(--bg3);            color: var(--text3); border: 1px solid var(--border2); }

.api-sig { color: var(--text2); }

@media (max-width: 680px) {
  .hld-flows { grid-template-columns: 1fr; }
}

/* ── Design Decision cards (Phase 4) ─────────────────────── */
.dd-list { display: flex; flex-direction: column; gap: 12px; }

.dd-card-simple {
  display: flex; gap: 10px; align-items: flex-start;
  font-size: 13px; color: var(--text2); line-height: 1.6;
  padding: 10px 12px; background: var(--bg0);
  border: 1px solid var(--border2); border-radius: 8px;
}
.dd-bullet { color: var(--indigo); flex-shrink: 0; font-size: 10px; margin-top: 4px; }

.dd-card {
  background: var(--bg1);
  border: 1px solid var(--border2);
  border-radius: 12px;
  overflow: hidden;
}

.dd-card-title {
  font-size: 12px; font-weight: 700; font-family: var(--font-head);
  color: var(--text); padding: 12px 14px 0;
  letter-spacing: -0.2px;
}

.dd-problem {
  font-size: 12px; color: var(--text3); line-height: 1.55;
  padding: 4px 14px 10px; border-bottom: 1px solid var(--border2);
}

.dd-options {
  display: flex; align-items: stretch;
  background: var(--bg0);
}

.dd-opt {
  flex: 1; padding: 10px 12px;
  border-right: 1px solid var(--border2);
}
.dd-opt:last-child { border-right: none; }
.dd-opt-vs {
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700; font-family: var(--font-mono);
  color: var(--text4); letter-spacing: .10em;
  width: 28px; flex-shrink: 0;
  border-right: 1px solid var(--border2);
  background: var(--bg0);
}

.dd-opt-name {
  font-size: 11.5px; font-weight: 700; font-family: var(--font-head);
  color: var(--text2); margin-bottom: 4px;
  display: flex; align-items: center; gap: 6px;
}
.dd-opt-chosen .dd-opt-name { color: var(--indigo); }
.dd-chosen-tag {
  font-size: 8px; font-weight: 700; font-family: var(--font-mono);
  letter-spacing: .10em; text-transform: uppercase;
  background: var(--indigo); color: white;
  padding: 1px 5px; border-radius: 3px;
}
.dd-opt-pro { font-size: 11.5px; color: var(--green); line-height: 1.5; margin-bottom: 2px; }
.dd-opt-con { font-size: 11.5px; color: var(--text4); line-height: 1.5; }
.dd-opt-chosen { background: rgba(var(--indigo-rgb), 0.04); }

.dd-verdict {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  border-top: 1px solid var(--border2);
  border-bottom: 1px solid var(--border2);
  background: rgba(var(--indigo-rgb), 0.04);
}
.dd-verdict-label {
  font-size: 9px; font-weight: 700; font-family: var(--font-mono);
  letter-spacing: .12em; text-transform: uppercase; color: var(--text4);
}
.dd-verdict-choice {
  font-size: 12px; font-weight: 700; color: var(--indigo); font-family: var(--font-head);
}

.dd-rationale {
  font-size: 12px; color: var(--text3); line-height: 1.6;
  padding: 10px 14px;
}

/* ── Failure mode chain cards (Phase 4) ──────────────────── */
.fm-list { display: flex; flex-direction: column; gap: 12px; }

.fm-card-simple {
  display: flex; gap: 8px; align-items: flex-start;
  font-size: 13px; color: var(--text2); line-height: 1.6;
  padding: 10px 12px; background: var(--bg0);
  border: 1px solid rgba(var(--red-rgb), 0.18); border-radius: 8px;
}
.fm-warn-icon { color: var(--amber); flex-shrink: 0; }

.fm-card {
  background: var(--bg1);
  border: 1px solid var(--border2);
  border-radius: 12px;
  overflow: hidden;
}

.fm-scenario {
  font-size: 12.5px; font-weight: 700; font-family: var(--font-head);
  color: var(--text); padding: 11px 14px;
  background: rgba(217,72,72,0.04);
  border-bottom: 1px solid var(--border2);
  letter-spacing: -0.2px;
}

.fm-chain {
  padding: 10px 14px;
  display: flex; flex-direction: column; gap: 0;
}

.fm-step {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 7px 0;
}

.fm-step-icon {
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; flex-shrink: 0;
}
.fm-icon-impact  { background: rgba(217,72,72,0.10); }
.fm-icon-fix     { background: rgba(var(--indigo-rgb),0.10); }
.fm-icon-recover { background: rgba(43,160,126,0.10); }

.fm-step-body { flex: 1; padding-top: 2px; }

.fm-step-label {
  display: block; font-size: 9px; font-weight: 700;
  font-family: var(--font-mono); letter-spacing: .12em;
  text-transform: uppercase; color: var(--text4); margin-bottom: 2px;
}

.fm-step-body { font-size: 12.5px; color: var(--text2); line-height: 1.55; }

.fm-connector-line {
  width: 1px; height: 10px; background: var(--border2);
  margin-left: 12px;
}
