/* Shared System Design lesson chrome (AlgoVision-compatible dark theme) */
.sd-page {
  --sd-accent: #06b6d4;
  --sd-accent2: #8b5cf6;
  --sd-bg: #0f0f1a;
  --sd-card: rgba(255, 255, 255, 0.04);
  --sd-border: rgba(255, 255, 255, 0.08);
  --sd-text: #e2e8f0;
  --sd-muted: #94a3b8;
  min-height: 100vh;
  background: var(--sd-bg);
  color: var(--sd-text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  padding: 1.5rem;
  box-sizing: border-box;
}
.sd-page * { box-sizing: border-box; }
.sd-page a { color: var(--sd-accent); }
.sd-top {
  max-width: 920px;
  margin: 0 auto 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.sd-back {
  color: #6366f1;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.88rem;
}
.sd-lc {
  color: var(--sd-muted);
  font-size: 0.85rem;
}
.sd-h1 {
  font-size: 1.55rem;
  font-weight: 800;
  margin: 0 0 0.35rem;
  background: linear-gradient(135deg, #06b6d4, #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.sd-sub {
  color: var(--sd-muted);
  font-size: 0.95rem;
  line-height: 1.5;
  max-width: 820px;
  margin: 0 auto 1rem;
}
.sd-layout {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.sd-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  font-size: 0.78rem;
  color: var(--sd-muted);
}
.sd-meta span {
  background: var(--sd-card);
  border: 1px solid var(--sd-border);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
}
.sd-diagram {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--sd-border);
  border-radius: 0.75rem;
  min-height: 160px;
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sd-diagram svg {
  max-width: 100%;
  height: auto;
}
.info-panel.sd-info {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
}
.sd-info .phase-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--sd-accent);
  margin-bottom: 0.5rem;
}
.sd-step-html {
  font-size: 0.92rem;
  line-height: 1.65;
  color: #cbd5e1;
}
.sd-step-html strong {
  color: #f59e0b;
}
.sd-step-html ul {
  margin: 0.5rem 0 0 1.1rem;
  padding: 0;
}
.sd-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: center;
  align-items: center;
  margin: 0.5rem 0;
}
.sd-controls button {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border: none;
  padding: 0.55rem 1.2rem;
  border-radius: 0.5rem;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.88rem;
}
.sd-controls button.green {
  background: linear-gradient(135deg, #10b981, #059669);
}
.sd-controls button.red {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
}
.sd-controls button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.sd-controls .sd-step-label {
  font-size: 0.85rem;
  color: var(--sd-muted);
  font-variant-numeric: tabular-nums;
}
.sd-nav-foot {
  display: flex;
  justify-content: space-between;
  max-width: 960px;
  margin: 1.5rem auto 0;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.sd-nav-foot a {
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
}
.sd-nav-foot a.muted {
  color: var(--sd-muted);
  font-weight: 500;
}

/* Step extras: quizzes, compare, callouts */
#sd-step-extras {
  max-width: 960px;
  margin: 0.75rem auto 0;
  width: 100%;
}
.sd-callout {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 0.65rem;
  padding: 0.85rem 1rem;
  font-size: 0.88rem;
  line-height: 1.55;
  color: #fde68a;
  margin-bottom: 0.75rem;
}
.sd-callout strong {
  color: #fcd34d;
}
.sd-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
@media (max-width: 640px) {
  .sd-compare {
    grid-template-columns: 1fr;
  }
}
.sd-compare-col {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--sd-border);
  border-radius: 0.5rem;
  padding: 0.75rem;
  font-size: 0.85rem;
  line-height: 1.5;
  color: #cbd5e1;
}
.sd-compare-h {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #a5b4fc;
  margin: 0 0 0.5rem;
}
.sd-quiz {
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 0.65rem;
  padding: 1rem;
  margin-bottom: 0.75rem;
}
.sd-quiz--failure {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.3);
}
.sd-quiz-q {
  font-size: 0.9rem;
  margin-bottom: 0.65rem;
  color: #e2e8f0;
  line-height: 1.5;
}
.sd-quiz-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.sd-quiz-opt {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
  padding: 0.45rem 0.85rem;
  border-radius: 0.4rem;
  cursor: pointer;
  font-size: 0.82rem;
}
.sd-quiz-opt:hover:not(:disabled) {
  border-color: rgba(6, 182, 212, 0.45);
}
.sd-quiz-opt--correct {
  border-color: #10b981 !important;
  background: rgba(16, 185, 129, 0.15) !important;
}
.sd-quiz-opt--wrong {
  border-color: #ef4444 !important;
  opacity: 0.85;
}
.sd-quiz-feedback {
  margin-top: 0.65rem;
  font-size: 0.85rem;
  color: #94a3b8;
  line-height: 1.45;
}
.sd-quiz-ok {
  color: #10b981;
  font-weight: 700;
}
.sd-quiz-bad {
  color: #f87171;
}
.sd-hotspots {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
  align-items: flex-start;
}
.sd-hotspot-pill {
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.35);
  color: #67e8f9;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  cursor: pointer;
}
.sd-hotspots-tip {
  width: 100%;
  font-size: 0.82rem;
  color: #cbd5e1;
  margin-top: 0.35rem;
  padding: 0.5rem 0.65rem;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 0.4rem;
  line-height: 1.45;
}

/* Floating widgets dock */
#sd-widgets-dock {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 9000;
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: calc(100vw - 2rem);
}
.sd-widget-tab {
  background: rgba(15, 15, 26, 0.92);
  border: 1px solid rgba(6, 182, 212, 0.4);
  color: #67e8f9;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}
.sd-widget-tab:hover {
  background: rgba(6, 182, 212, 0.15);
}
#sd-widgets-panel {
  display: none;
  position: fixed;
  bottom: 3.5rem;
  right: 1rem;
  width: min(380px, calc(100vw - 2rem));
  max-height: min(70vh, 520px);
  overflow-y: auto;
  z-index: 9001;
  background: rgba(15, 15, 26, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0.75rem;
  padding: 1rem;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
}
.sd-widget-pane h4.sd-widget-h {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  color: #e2e8f0;
}
.sd-widget-hint {
  font-size: 0.75rem;
  color: #64748b;
  margin: 0 0 0.65rem;
  line-height: 1.4;
}
.sd-widget-pane label {
  display: block;
  font-size: 0.78rem;
  color: #94a3b8;
  margin-bottom: 0.45rem;
}
.sd-widget-inp {
  width: 100%;
  margin-top: 0.2rem;
  padding: 0.35rem 0.5rem;
  border-radius: 0.35rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.35);
  color: #e2e8f0;
  font-size: 0.85rem;
}
.sd-widget-out {
  margin-top: 0.65rem;
  font-size: 0.78rem;
  line-height: 1.55;
  color: #cbd5e1;
  font-family: ui-monospace, monospace;
}
.sd-widget-muted {
  margin-top: 0.35rem;
  color: #64748b;
  font-style: italic;
}
.sd-rubric-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: #cbd5e1;
  margin-bottom: 0.4rem;
  cursor: pointer;
}
.sd-rubric-row input {
  margin-top: 0.2rem;
}
.sd-sprint-display {
  font-size: 2rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #22d3ee;
  text-align: center;
  margin: 0.5rem 0;
}
.sd-sprint-btns {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.sd-widget-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #e2e8f0;
  padding: 0.4rem 0.75rem;
  border-radius: 0.4rem;
  font-size: 0.8rem;
  cursor: pointer;
}
.sd-widget-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.sd-widget-btn--primary {
  width: 100%;
  margin-top: 0.5rem;
  background: linear-gradient(135deg, #06b6d4, #6366f1);
  border: none;
  font-weight: 600;
}
#sdSprintNotes {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.5rem;
  border-radius: 0.4rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.35);
  color: #e2e8f0;
  font-size: 0.82rem;
  resize: vertical;
}

/* Ask AI suggestion chips (injected by algovision-ask.js) */
.av-ask-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.5rem 0 0.75rem;
}
.av-ask-suggestion-chip {
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.35);
  color: #67e8f9;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  font-size: 0.78rem;
  cursor: pointer;
}
.av-ask-suggestion-chip:hover {
  background: rgba(6, 182, 212, 0.2);
}

/* Interview script collapsible (design lessons) */
.sd-details {
  max-width: 960px;
  margin: 1rem auto 0;
  padding: 0.75rem 1rem;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--sd-border);
  border-radius: 0.65rem;
  color: #cbd5e1;
  font-size: 0.88rem;
  line-height: 1.55;
}
.sd-details summary {
  cursor: pointer;
  color: #22d3ee;
  font-weight: 600;
  list-style: none;
}
.sd-details summary::-webkit-details-marker {
  display: none;
}
.sd-details[open] summary {
  margin-bottom: 0.5rem;
}
.sd-details ol {
  margin: 0.25rem 0 0 1.2rem;
  padding: 0;
}
.sd-details li {
  margin-bottom: 0.35rem;
}
