/* ==========================================================================
   LearnStream - dark-first study UI
   ========================================================================== */
:root {
  --bg:          #0b0d10;
  --surface:     #14171c;
  --surface-2:   #1a1e25;
  --surface-3:   #222732;
  --border:      #262b33;
  --border-soft: #1e232b;
  --text:        #e7eaf0;
  --text-dim:    #a2abbb;
  --muted:       #6f7887;
  --accent:      #6366f1;
  --accent-soft: #6366f126;
  --success:     #22c55e;
  --warn:        #f59e0b;
  --danger:      #ef4444;
  --lock:        #7c5cff;

  --r-sm: 8px;
  --r:    12px;
  --r-lg: 18px;
  --sidebar-w: 244px;
  --topbar-h: 60px;
  --shadow: 0 10px 34px -12px rgba(0,0,0,.72);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Inter, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.dim { color: var(--text-dim); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2b313b; border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #39414e; }

/* ---------- Login ---------- */
.login { position: fixed; inset: 0; display: grid; place-items: center;
  background: radial-gradient(1000px 600px at 50% -10%, #1a1f3a 0%, var(--bg) 60%); z-index: 100; }
.login-card { width: min(360px, 90vw); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 34px 28px; text-align: center; box-shadow: var(--shadow); }
.login-mark { width: 52px; height: 52px; margin: 0 auto 14px; border-radius: 15px;
  background: linear-gradient(140deg, var(--accent), #a855f7); display: grid; place-items: center;
  font-size: 20px; color: #fff; }
.login-card h1 { margin: 0 0 4px; font-size: 22px; letter-spacing: -.02em; }
.login-card p { margin: 0 0 20px; font-size: 13px; }
.login-card input { width: 100%; padding: 11px 14px; background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--r-sm); margin-bottom: 12px; outline: none; }
.login-card input:focus { border-color: var(--accent); }
.login-error { color: var(--danger); font-size: 13px; margin-top: 10px; min-height: 18px; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar { position: sticky; top: 0; height: 100vh; background: var(--surface);
  border-right: 1px solid var(--border-soft); display: flex; flex-direction: column;
  padding: 16px 12px; gap: 6px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 16px; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(140deg, var(--accent), #a855f7); font-size: 13px; color: #fff; }
.brand-text { font-weight: 650; letter-spacing: -.02em; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 9px 11px;
  border-radius: var(--r-sm); color: var(--text-dim); font-size: 14px; transition: .13s; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: #c7c9ff; font-weight: 550; }
.nav-item .ico { width: 18px; text-align: center; opacity: .85; font-size: 13px; }
.badge { margin-left: auto; background: var(--danger); color: #fff; font-size: 11px;
  font-weight: 700; padding: 1px 7px; border-radius: 999px; }
.badge:empty { display: none; }

.sidebar-section { margin-top: 18px; }
.sidebar-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em;
  color: var(--muted); padding: 0 11px 8px; font-weight: 650; }
.track-list { display: flex; flex-direction: column; gap: 1px; }
.track-link { display: flex; align-items: center; gap: 9px; padding: 7px 11px;
  border-radius: var(--r-sm); font-size: 13px; color: var(--text-dim); transition: .13s; }
.track-link:hover { background: var(--surface-2); color: var(--text); }
.track-dot { width: 8px; height: 8px; border-radius: 3px; flex-shrink: 0; }
.track-link .pct { margin-left: auto; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }

.sidebar-foot { margin-top: auto; padding-top: 14px; }
.streak-pill { display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: var(--r);
  font-size: 12.5px; }
.streak-flame { font-size: 15px; }
.streak-n { font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- Topbar ---------- */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px; padding: 0 22px;
  background: rgba(11,13,16,.86); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-soft); }
.menu-btn { display: none; }
.icon-btn { background: none; border: 0; cursor: pointer; color: var(--text-dim);
  padding: 6px 9px; border-radius: var(--r-sm); font-size: 17px; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.search-wrap { position: relative; flex: 1; max-width: 520px; }
.search-wrap input { width: 100%; padding: 9px 15px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 999px; outline: none; font-size: 13.5px; }
.search-wrap input:focus { border-color: var(--accent); background: var(--surface-2); }
.search-results { position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r);
  box-shadow: var(--shadow); max-height: 62vh; overflow-y: auto; padding: 6px; z-index: 40; }
.sr-item { display: flex; align-items: center; gap: 10px; padding: 9px 11px;
  border-radius: var(--r-sm); font-size: 13.5px; cursor: pointer; }
.sr-item:hover { background: var(--surface-3); }
.sr-kind { font-size: 10.5px; color: var(--muted); margin-left: auto; text-transform: uppercase; letter-spacing: .06em; }
.sr-empty { padding: 16px; text-align: center; color: var(--muted); font-size: 13px; }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.lib-chip { font-size: 11.5px; color: var(--text-dim); background: var(--surface);
  border: 1px solid var(--border); padding: 5px 11px; border-radius: 999px;
  font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- View ---------- */
.view { padding: 26px 30px 70px; max-width: 1500px; width: 100%; }
.page-head { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 25px; letter-spacing: -.025em; font-weight: 650; }
.page-head .sub { color: var(--muted); font-size: 13.5px; }
.section { margin-bottom: 34px; }
.section-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.section-head h2 { margin: 0; font-size: 15.5px; font-weight: 620; letter-spacing: -.01em; }
.section-head .more { margin-left: auto; font-size: 12.5px; color: var(--muted); }
.section-head .more:hover { color: var(--text); }

/* ---------- Cards / grids ---------- */
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); }
.rail { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(268px, 1fr);
  gap: 14px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x proximity; }
.rail > * { scroll-snap-align: start; }

.card { background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--r); overflow: hidden; cursor: pointer; transition: .16s;
  display: flex; flex-direction: column; }
.card:hover { background: var(--surface-2); border-color: var(--border);
  transform: translateY(-2px); box-shadow: var(--shadow); }
.card-thumb { position: relative; aspect-ratio: 16/9; background: var(--surface-3);
  display: grid; place-items: center; overflow: hidden; }
.card-thumb .glyph { font-size: 30px; opacity: .16; }
.card-thumb .daychip { position: absolute; top: 9px; left: 9px; background: rgba(0,0,0,.62);
  padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 620;
  font-variant-numeric: tabular-nums; backdrop-filter: blur(6px); }
.card-thumb .dur { position: absolute; bottom: 9px; right: 9px; background: rgba(0,0,0,.78);
  padding: 1px 6px; border-radius: 5px; font-size: 11px; font-variant-numeric: tabular-nums; }
.card-thumb .state { position: absolute; top: 9px; right: 9px; font-size: 11px;
  padding: 2px 7px; border-radius: 6px; font-weight: 600; backdrop-filter: blur(6px); }
.state.done { background: #22c55e2e; color: #6ee7a0; }
.state.locked { background: #0009; color: var(--muted); }
.card-bar { position: absolute; bottom: 0; left: 0; right: 0; height: 3px; background: #ffffff14; }
.card-bar i { display: block; height: 100%; background: var(--accent); }
.card-body { padding: 11px 13px 13px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card-title { font-size: 13.6px; font-weight: 560; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--muted); margin-top: auto; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px;
  border-radius: 999px; font-size: 11px; font-weight: 560; background: var(--surface-3); color: var(--text-dim); }
.chip .dot { width: 7px; height: 7px; border-radius: 2px; }

/* ---------- Stat tiles ---------- */
.tiles { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); }
.tile { background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--r); padding: 16px 17px; }
.tile .label { font-size: 11.5px; color: var(--muted); text-transform: uppercase;
  letter-spacing: .07em; font-weight: 600; }
.tile .value { font-size: 27px; font-weight: 680; letter-spacing: -.03em; margin-top: 5px;
  font-variant-numeric: tabular-nums; }
.tile .value small { font-size: 14px; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.tile .foot { font-size: 12px; color: var(--muted); margin-top: 4px; }

.pbar { height: 6px; background: var(--surface-3); border-radius: 999px; overflow: hidden; margin-top: 10px; }
.pbar i { display: block; height: 100%; border-radius: 999px; background: var(--accent); transition: width .35s; }

/* ---------- Watch page ---------- */
.watch { display: grid; grid-template-columns: minmax(0,1fr) 340px; gap: 24px; align-items: start; }
.player-wrap { background: #000; border-radius: var(--r); overflow: hidden;
  aspect-ratio: 16/9; position: relative; }
.player-wrap video { width: 100%; height: 100%; display: block; background: #000; }
.player-placeholder { position: absolute; inset: 0; display: grid; place-items: center;
  text-align: center; padding: 30px; background: var(--surface); }
.player-placeholder .big { font-size: 34px; opacity: .3; margin-bottom: 10px; }

.watch-head { margin: 16px 0 6px; }
.watch-head h1 { margin: 0 0 8px; font-size: 20px; letter-spacing: -.02em; line-height: 1.3; }
.watch-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.watch-actions { display: flex; gap: 8px; margin: 16px 0 22px; flex-wrap: wrap; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 15px; border-radius: var(--r-sm); border: 1px solid var(--border);
  background: var(--surface-2); cursor: pointer; font-size: 13px; font-weight: 550; transition: .14s; }
.btn:hover { background: var(--surface-3); border-color: #333a45; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #7376f5; border-color: #7376f5; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-success { background: var(--success); border-color: var(--success); color: #06240f; }
.btn-warn { background: var(--warn); border-color: var(--warn); color: #2a1c00; }
.btn-danger { background: #ef444422; border-color: #ef444455; color: #fca5a5; }

/* Problems under the video */
.problems { display: flex; flex-direction: column; gap: 9px; }
.prob { background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--r); overflow: hidden; }
.prob-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; cursor: pointer; }
.prob-row:hover { background: var(--surface-2); }
.prob-idx { width: 24px; height: 24px; border-radius: 7px; background: var(--surface-3);
  display: grid; place-items: center; font-size: 11.5px; color: var(--muted);
  font-variant-numeric: tabular-nums; flex-shrink: 0; }
.prob.solved .prob-idx { background: #22c55e2b; color: #6ee7a0; }
.prob.stuck  .prob-idx { background: #f59e0b2b; color: #fcd34d; }
.prob-name { font-size: 13.5px; font-weight: 520; flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prob-tags { display: flex; align-items: center; gap: 7px; flex-shrink: 0; }
.tag { font-size: 10.5px; padding: 2px 8px; border-radius: 999px; font-weight: 600;
  background: var(--surface-3); color: var(--muted); }
.tag.solved { background: #22c55e26; color: #6ee7a0; }
.tag.partial{ background: #38bdf826; color: #7dd3fc; }
.tag.stuck  { background: #f59e0b26; color: #fcd34d; }
.tag.locked { background: #7c5cff22; color: #b9a8ff; }
.tag.pending{ background: #64748b22; color: #94a3b8; }

.prob-panel { border-top: 1px solid var(--border-soft); padding: 16px 15px; background: var(--surface-2); }
.prob-frame { width: 100%; height: 380px; border: 1px solid var(--border);
  border-radius: var(--r-sm); background: #fff; }
.prob-tools { display: flex; align-items: center; gap: 9px; margin-top: 13px; flex-wrap: wrap; }
.timer { font-family: var(--mono); font-size: 15px; font-weight: 640; padding: 5px 12px;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-sm);
  font-variant-numeric: tabular-nums; }
.timer.running { border-color: var(--accent); color: #c7c9ff; }

.gate { display: flex; align-items: center; gap: 12px; padding: 14px;
  background: linear-gradient(100deg, #7c5cff14, transparent);
  border: 1px dashed #7c5cff44; border-radius: var(--r); margin-top: 13px; }
.gate-ico { font-size: 19px; }
.gate-text { flex: 1; font-size: 12.8px; color: var(--text-dim); }
.gate-text b { color: var(--text); display: block; margin-bottom: 2px; font-size: 13.2px; }

.outcome-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.conf-group { display: flex; gap: 4px; align-items: center; margin-left: auto; }
.conf-btn { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; font-size: 12px; font-weight: 640; }
.conf-btn.on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Sidebar rail on watch page */
.watch-side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: calc(var(--topbar-h) + 20px); }
.panel { background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--r); overflow: hidden; }
.panel-head { padding: 12px 14px; border-bottom: 1px solid var(--border-soft);
  display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 600; }
.panel-head .count { margin-left: auto; font-size: 11.5px; color: var(--muted); }
.panel-body { padding: 12px 14px; }
.panel-body.tight { padding: 6px; max-height: 340px; overflow-y: auto; }

.note { display: flex; gap: 10px; padding: 8px 9px; border-radius: var(--r-sm); font-size: 12.8px; }
.note:hover { background: var(--surface-2); }
.note-t { font-family: var(--mono); font-size: 11.5px; color: var(--accent);
  cursor: pointer; flex-shrink: 0; padding-top: 1px; }
.note-body { flex: 1; color: var(--text-dim); line-height: 1.45; word-break: break-word; }
.note-del { opacity: 0; color: var(--muted); cursor: pointer; font-size: 14px; }
.note:hover .note-del { opacity: 1; }
.note-input { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--border-soft); }
.note-input input { flex: 1; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 7px 11px; outline: none; font-size: 12.8px; }
.note-input input:focus { border-color: var(--accent); }

.res-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px;
  border-radius: var(--r-sm); font-size: 13px; cursor: pointer; }
.res-item:hover { background: var(--surface-2); }
.res-ico { width: 26px; height: 26px; border-radius: 7px; background: var(--surface-3);
  display: grid; place-items: center; font-size: 11px; flex-shrink: 0; }

/* ---------- Day rows (timeline) ---------- */
.day-row { display: flex; align-items: center; gap: 14px; padding: 11px 14px;
  border-radius: var(--r); cursor: pointer; border: 1px solid transparent; }
.day-row:hover { background: var(--surface); border-color: var(--border-soft); }
.day-no { font-family: var(--mono); font-size: 12px; color: var(--muted); width: 44px;
  font-variant-numeric: tabular-nums; flex-shrink: 0; }
.day-title { flex: 1; font-size: 13.8px; min-width: 0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.day-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.ring { width: 26px; height: 26px; flex-shrink: 0; }

/* ---------- Reviews ---------- */
.review-card { background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--r); padding: 18px; display: flex; flex-direction: column; gap: 13px; }
.review-top { display: flex; align-items: flex-start; gap: 12px; }
.review-title { font-size: 15px; font-weight: 580; line-height: 1.35; }
.grade-row { display: flex; gap: 7px; flex-wrap: wrap; }
.grade-btn { flex: 1; min-width: 78px; padding: 9px 6px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--surface-2); cursor: pointer;
  font-size: 12px; font-weight: 580; text-align: center; transition: .14s; }
.grade-btn:hover { transform: translateY(-1px); }
.g0 { border-color: #ef444455; color: #fca5a5; }
.g3 { border-color: #f59e0b55; color: #fcd34d; }
.g4 { border-color: #38bdf855; color: #7dd3fc; }
.g5 { border-color: #22c55e55; color: #86efac; }

/* ---------- Heatmap ---------- */
.heat { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 12px);
  gap: 3px; overflow-x: auto; padding: 4px 0 8px; }
.heat i { width: 12px; height: 12px; border-radius: 3px; background: var(--surface-3); display: block; }
.heat i[data-l="1"] { background: #1e3a5f; }
.heat i[data-l="2"] { background: #2f5f9e; }
.heat i[data-l="3"] { background: #4f8fe0; }
.heat i[data-l="4"] { background: #7cb4ff; }
.heat-legend { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); }
.heat-legend i { width: 11px; height: 11px; border-radius: 3px; display: block; }

/* ---------- Goals ---------- */
.goal { background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--r); padding: 15px 17px; }
.goal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.goal-title { font-size: 14.5px; font-weight: 580; }
.goal-stat { display: flex; gap: 20px; margin-top: 11px; font-size: 12.2px; color: var(--muted); flex-wrap: wrap; }
.goal-stat b { color: var(--text); font-variant-numeric: tabular-nums; }
.pace-ok  { color: #6ee7a0; }
.pace-bad { color: #fca5a5; }

/* ---------- Toasts ---------- */
.toast-stack { position: fixed; bottom: 22px; right: 22px; display: flex;
  flex-direction: column; gap: 9px; z-index: 200; }
.toast { background: var(--surface-2); border: 1px solid var(--border);
  border-left: 3px solid var(--accent); border-radius: var(--r-sm); padding: 11px 15px;
  font-size: 13px; box-shadow: var(--shadow); animation: slideIn .22s ease; max-width: 330px; }
.toast.ok   { border-left-color: var(--success); }
.toast.err  { border-left-color: var(--danger); }
@keyframes slideIn { from { opacity: 0; transform: translateX(14px); } }

.empty { text-align: center; padding: 54px 20px; color: var(--muted); }
.empty .big { font-size: 36px; opacity: .22; margin-bottom: 12px; }
.spinner { width: 26px; height: 26px; border: 2.5px solid var(--surface-3);
  border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; margin: 46px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) { .watch { grid-template-columns: 1fr; } .watch-side { position: static; } }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 60; width: var(--sidebar-w);
    transform: translateX(-100%); transition: transform .22s; }
  .sidebar.open { transform: none; box-shadow: var(--shadow); }
  .menu-btn { display: block; }
  .view { padding: 20px 16px 60px; }
  .topbar { padding: 0 14px; }
  .prob-frame { height: 300px; }
}

/* ==========================================================================
   Custom player
   ========================================================================== */
.lsp { position: relative; width: 100%; aspect-ratio: 16/9; background: #000;
  border-radius: var(--r); overflow: hidden; outline: none; user-select: none; }
.lsp:fullscreen { border-radius: 0; aspect-ratio: auto; height: 100vh; }
.lsp video { width: 100%; height: 100%; display: block; background: #000; cursor: pointer; }

.lsp-tap { position: absolute; top: 0; bottom: 56px; left: 0; width: 26%; z-index: 2; }
.lsp-tap.right { left: auto; right: 0; }

.lsp-center { position: absolute; inset: 0; display: grid; place-items: center;
  pointer-events: none; z-index: 3; }
.lsp-bigplay { pointer-events: auto; width: 70px; height: 70px; border-radius: 50%;
  border: 0; cursor: pointer; color: #fff; display: grid; place-items: center;
  background: rgba(0,0,0,.55); backdrop-filter: blur(8px);
  transition: transform .18s, opacity .18s; }
.lsp-bigplay:hover { transform: scale(1.07); background: rgba(0,0,0,.7); }
.lsp.playing .lsp-bigplay { opacity: 0; transform: scale(.7); pointer-events: none; }

.lsp-spinner { position: absolute; top: 50%; left: 50%; width: 42px; height: 42px;
  margin: -21px 0 0 -21px; border: 3px solid rgba(255,255,255,.18);
  border-top-color: #fff; border-radius: 50%; opacity: 0; z-index: 4;
  animation: spin .8s linear infinite; }
.lsp.buffering .lsp-spinner { opacity: 1; }
.lsp.buffering .lsp-bigplay { opacity: 0; }

.lsp-flash { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  background: rgba(0,0,0,.68); color: #fff; padding: 9px 18px; border-radius: 999px;
  font-size: 14px; font-weight: 650; opacity: 0; transition: opacity .18s; z-index: 5; }
.lsp-flash.on { opacity: 1; }

.lsp-ctl { position: absolute; left: 0; right: 0; bottom: 0; z-index: 6;
  padding: 30px 12px 8px;
  background: linear-gradient(transparent, rgba(0,0,0,.55) 42%, rgba(0,0,0,.88));
  opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s; }
.lsp.hot .lsp-ctl, .lsp:not(.playing) .lsp-ctl { opacity: 1; transform: none; }
.lsp:not(.hot).playing { cursor: none; }

.lsp-scrub { position: relative; padding: 7px 0; cursor: pointer; }
.lsp-track { position: relative; height: 4px; background: rgba(255,255,255,.26);
  border-radius: 3px; transition: height .13s; }
.lsp-scrub:hover .lsp-track { height: 6px; }
.lsp-buf { position: absolute; left: 0; top: 0; bottom: 0; width: 0;
  background: rgba(255,255,255,.34); border-radius: 3px; }
.lsp-played { position: absolute; left: 0; top: 0; bottom: 0; width: 0;
  background: var(--accent); border-radius: 3px; }
.lsp-knob { position: absolute; top: 50%; width: 13px; height: 13px; margin: -6.5px 0 0 -6.5px;
  background: #fff; border-radius: 50%; transform: scale(0); transition: transform .13s; }
.lsp-scrub:hover .lsp-knob { transform: scale(1); }

.lsp-markers { position: absolute; inset: 0; pointer-events: none; }
.lsp-markers i { position: absolute; top: -2px; width: 3px; height: calc(100% + 4px);
  background: var(--warn); border-radius: 2px; margin-left: -1.5px;
  box-shadow: 0 0 0 1px rgba(0,0,0,.45); }

.lsp-tip { position: absolute; bottom: 22px; transform: translateX(-50%);
  background: rgba(0,0,0,.9); color: #fff; padding: 4px 9px; border-radius: 6px;
  font-size: 11.5px; white-space: nowrap; opacity: 0; transition: opacity .13s;
  pointer-events: none; max-width: 300px; overflow: hidden; text-overflow: ellipsis; }
.lsp-scrub:hover .lsp-tip { opacity: 1; }
.lsp-tip.has-note { border-left: 3px solid var(--warn); }
.lsp-tip-n { display: block; color: #fcd34d; font-size: 11px; margin-top: 2px;
  max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.lsp-tip-n:empty { display: none; }

.lsp-row { display: flex; align-items: center; gap: 3px; padding: 2px 0 4px; }
.lsp-b { background: none; border: 0; color: #fff; cursor: pointer; padding: 7px;
  border-radius: 7px; display: grid; place-items: center; opacity: .92;
  font-size: 12.5px; font-weight: 620; min-width: 32px; transition: .13s; }
.lsp-b:hover { background: rgba(255,255,255,.16); opacity: 1; }
.lsp-gap { flex: 1; }
.lsp-time { color: #fff; font-size: 12.3px; margin-left: 7px;
  font-variant-numeric: tabular-nums; opacity: .92; }
.lsp-time b { font-weight: 620; }

.lsp-vol { display: flex; align-items: center; }
.lsp-volrange { width: 0; opacity: 0; transition: width .18s, opacity .18s;
  accent-color: #fff; height: 3px; cursor: pointer; }
.lsp-vol:hover .lsp-volrange, .lsp-volrange:focus { width: 74px; opacity: 1; margin: 0 8px 0 2px; }

.lsp-speedmenu { position: absolute; right: 12px; bottom: 58px; z-index: 8;
  background: rgba(18,20,26,.97); border: 1px solid #2c323d; border-radius: var(--r-sm);
  padding: 5px; display: flex; flex-direction: column; gap: 1px; box-shadow: var(--shadow); }
.lsp-speedmenu button { background: none; border: 0; color: #e7eaf0; cursor: pointer;
  padding: 6px 20px; border-radius: 5px; font-size: 12.5px; text-align: left; }
.lsp-speedmenu button:hover { background: #262b35; }

/* ==========================================================================
   Parsed problem statement
   ========================================================================== */
.prob-stmt { max-height: 460px; overflow-y: auto; padding-right: 6px; }
.pstmt { font-size: 13.6px; line-height: 1.65; color: var(--text-dim); }
.pstmt-h { margin: 18px 0 7px; font-size: 11px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--accent); }
.pstmt-h:first-child { margin-top: 0; }
.pstmt-body { background: var(--bg); border: 1px solid var(--border-soft);
  border-radius: var(--r-sm); padding: 12px 14px; }
.pstmt-body p { margin: 0 0 9px; }
.pstmt-body p:last-child { margin-bottom: 0; }
.pstmt-body strong, .pstmt-body b { color: var(--text); font-weight: 640; }
.pstmt-body ul, .pstmt-body ol { margin: 6px 0 10px; padding-left: 20px; }
.pstmt-body li { margin: 3px 0; }
.pstmt-body sup { font-size: .74em; vertical-align: super; }
.pstmt-body pre { background: var(--surface-3); border: 1px solid var(--border);
  border-radius: 7px; padding: 10px 12px; margin: 7px 0; overflow-x: auto;
  font-family: var(--mono); font-size: 12.4px; color: #cbd5e1; white-space: pre-wrap;
  word-break: break-word; }
.pstmt-body code { font-family: var(--mono); font-size: 12.4px;
  background: var(--surface-3); padding: 1px 5px; border-radius: 4px; color: #cbd5e1; }
.pstmt-body.mono, .pstmt-body.mono p { font-family: var(--mono); font-size: 12.6px; }
.pstmt-body.code { background: #0e1117; }
.pstmt-body table { border-collapse: collapse; width: 100%; margin: 8px 0; }
.pstmt-body td, .pstmt-body th { border: 1px solid var(--border); padding: 6px 9px;
  font-size: 12.6px; text-align: left; }

@media (max-width: 900px) {
  .prob-stmt { max-height: 340px; }
  .lsp-b { padding: 8px 6px; min-width: 30px; }
  .lsp-vol { display: none; }
}
