/* AlgoVision shared foundation — linked by every problem page.
   Page-specific overrides (h1 gradient, state panels, phase colors,
   variable highlights) remain in inline <style> blocks. */

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

body {
  background: #0f0f1a;
  color: #e2e8f0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  padding: 1.5rem;
}

/* ── Layout ─────────────────────────────────────────────────────── */
.page-layout { display: flex; gap: 1.5rem; max-width: 1500px; margin: 0 auto; }
.main-content { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; }
.subtitle { color: #94a3b8; font-size: 0.95rem; margin-bottom: 0.3rem; }
.problem span { color: #10b981; font-family: monospace; font-weight: 600; }

/* ── Buttons ────────────────────────────────────────────────────── */
button {
  background: linear-gradient(135deg, #6366f1, #8b5cf6); color: white; border: none;
  padding: 0.6rem 1.4rem; border-radius: 0.5rem; font-size: 0.9rem; font-weight: 600;
  cursor: pointer; transition: all 0.2s;
}
button:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(99,102,241,0.4); }
button:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }
button.green { background: linear-gradient(135deg, #10b981, #059669); }
button.green:hover { box-shadow: 0 4px 12px rgba(16,185,129,0.4); }
button.red { background: linear-gradient(135deg, #ef4444, #dc2626); }
button.red:hover { box-shadow: 0 4px 12px rgba(239,68,68,0.4); }
button.amber { background: linear-gradient(135deg, #f59e0b, #d97706); }
button.amber:hover { box-shadow: 0 4px 12px rgba(245,158,11,0.4); }

/* ── Speed control ──────────────────────────────────────────────── */
.speed-control { display: flex; align-items: center; gap: 0.5rem; color: #94a3b8; font-size: 0.85rem; }
.speed-control input { width: 100px; accent-color: #6366f1; }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 1000px) {
  .whiteboard-panel { display: none !important; }
  .typeit-panel { display: none !important; }
  .btn-wb-wrap { display: none !important; }
  .btn-ti-wrap { display: none !important; }
}

@media (max-width: 500px) {
  .code-panel { font-size: 0.7rem !important; }
  .code-panel .line { padding: 0.15rem 0.5rem !important; }
  .controls { gap: 0.4rem; }
  .controls button { padding: 0.5rem 0.7rem !important; font-size: 0.8rem !important; }
  h1 { font-size: 1.4rem !important; }
  .main-content { padding: 0.75rem !important; }
  .complexity-card { flex-direction: column; align-items: flex-start; padding: 0.5rem 0.8rem !important; }
  .legend { gap: 0.5rem !important; }
}

@media (min-width: 1100px) {
  .main-content {
    max-width: 700px;
    margin-left: 432px;
    position: relative;
    z-index: 1;
  }
  body .code-panel {
    position: fixed;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 400px;
    max-width: 400px;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    overflow-x: hidden;
    font-size: 0.78rem;
    z-index: 50;
    border-radius: 0.75rem;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(15,23,42,0.97);
    padding: 0.75rem 0;
  }
  body .code-panel::-webkit-scrollbar { width: 4px; }
  body .code-panel::-webkit-scrollbar-track { background: transparent; }
  body .code-panel::-webkit-scrollbar-thumb { background: rgba(148,163,184,0.3); border-radius: 2px; }
  body .code-panel::-webkit-scrollbar-thumb:hover { background: rgba(148,163,184,0.5); }
  body .code-panel { scrollbar-width: thin; scrollbar-color: rgba(148,163,184,0.3) transparent; }
}
