/* LeetMath — LeetCode-like workspace. Light + dark tokens. */
:root {
  --bg: #f0f0f0;
  --pane: #ffffff;
  --layer: #f7f7f8;
  --hover: #f0f0f2;
  --fill: #ebebed;
  --border: #e5e5e7;
  --text: #262626;
  --muted: #8a8a8e;
  --soft: #5c5c60;
  --accent: #007aff;
  --brand: #ffa116;
  --easy: #1cbaba;
  --medium: #ffb800;
  --hard: #f63737;
  --ok: #2cbb5d;
  --warn: #e6a700;
  --bad: #ef4743;
  --green-btn: #2cbb5d;
  --code-bg: #f4f4f5;
  --shadow: 0 1px 3px rgba(0, 0, 0, .06);
  --pop-shadow: 0 8px 28px rgba(0, 0, 0, .14);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1a1a1a; --pane: #282828; --layer: #333333; --hover: #3e3e3e; --fill: #3e3e3e; --border: #3a3a3a;
    --text: #eff1f6; --muted: #9a9aa0; --soft: #c4c4c8; --accent: #3c91ff; --code-bg: #333333;
    --easy: #00b8a3; --medium: #ffc01e; --hard: #ff375f;
    --shadow: none; --pop-shadow: 0 8px 28px rgba(0, 0, 0, .5); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1a1a1a; --pane: #282828; --layer: #333333; --hover: #3e3e3e; --fill: #3e3e3e; --border: #3a3a3a;
  --text: #eff1f6; --muted: #9a9aa0; --soft: #c4c4c8; --accent: #3c91ff; --code-bg: #333333;
  --easy: #00b8a3; --medium: #ffc01e; --hard: #ff375f;
  --shadow: none; --pop-shadow: 0 8px 28px rgba(0, 0, 0, .5); color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.55 Inter, system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, kbd, pre, textarea.editor { font-family: "JetBrains Mono", ui-monospace, Menlo, monospace; }
code { background: var(--code-bg); padding: .1em .35em; border-radius: 4px; font-size: .88em; }
pre { background: var(--code-bg); padding: 10px 12px; border-radius: 6px; overflow-x: auto; }
pre code { background: none; padding: 0; }
kbd { border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; padding: 0 .35em; font-size: .8em; background: var(--layer); }
hr { border: 0; border-top: 1px solid var(--border); margin: 14px 0; }
h1, h2, h3, h4 { line-height: 1.3; margin: 0 0 8px; }
.muted { color: var(--muted); }
.soft { color: var(--soft); }
.small { font-size: 12px; }
.pad { padding: 20px; }
.error { color: var(--bad); }
.msg-ok { color: var(--ok); font-weight: 500; }
.msg-bad { color: var(--bad); font-weight: 500; }
.row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.grow { flex: 1; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; height: 48px; display: flex; align-items: center; gap: 12px;
  padding: 0 16px; background: var(--pane); border-bottom: 1px solid var(--border);
}
.bar-left, .bar-right { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.bar-right { justify-content: flex-end; }
.bar-center { display: flex; gap: 6px; }
.brand { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: 16px; color: var(--text); margin-right: 8px; white-space: nowrap; }
.brand img { width: 22px; height: 22px; }
.brand b { color: var(--accent); font-weight: 700; }
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: 2px; }
.nav a { color: var(--muted); padding: 5px 10px; border-radius: 6px; font-weight: 500; }
.nav a:hover { color: var(--text); text-decoration: none; }
.nav a.active { color: var(--text); }
body.ws-page .nav { display: none; }
.bar-prob { display: flex; align-items: center; gap: 2px; }
.ibtn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 30px; min-width: 30px; padding: 0 8px;
  border: 0; border-radius: 6px; background: transparent; color: var(--soft); font: inherit; font-size: 14px; cursor: pointer; white-space: nowrap;
}
.ibtn:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.ibtn.on { color: var(--accent); }
.ibtn:disabled { opacity: .4; cursor: default; background: none; }
.rating-chip { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--layer); white-space: nowrap; }
.t-amc { color: var(--muted); } .t-aime { color: var(--easy); } .t-jmo { color: var(--accent); }
.t-usamo { color: #a259ff; } .t-putnam { color: var(--hard); }
.timer { font-variant-numeric: tabular-nums; font-size: 13px; }

svg.i { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 14px; height: 14px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 14px;
  border-radius: 8px; border: 0; background: var(--fill); color: var(--text); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.btn:hover { filter: brightness(.96); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 13px; border-radius: 6px; }
.btn.xs { height: 24px; padding: 0 8px; font-size: 12px; border-radius: 5px; }
.btn.green { background: var(--green-btn); color: #fff; }
.btn.green-soft { background: color-mix(in srgb, var(--green-btn) 14%, transparent); color: var(--green-btn); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.ghost { background: transparent; color: var(--soft); }
.btn.ghost:hover { background: var(--hover); }
.btn.danger { color: var(--bad); }

/* ---------- inputs ---------- */
.input, select.input {
  font: inherit; font-size: 14px; color: var(--text); background: var(--layer); border: 1px solid transparent;
  border-radius: 8px; height: 34px; padding: 0 12px; min-width: 0;
}
textarea.input { height: auto; padding: 8px 12px; }
.input:focus, .editor:focus { outline: none; border-color: color-mix(in srgb, var(--accent) 60%, transparent); background: var(--pane); }

/* ---------- page container (non-workspace pages) ---------- */
.page { max-width: 1200px; margin: 0 auto; padding: 20px 16px 48px; }
.card { background: var(--pane); border-radius: 10px; padding: 16px 18px; margin: 12px 0; box-shadow: var(--shadow); }
.card h3 { font-size: 15px; }
.page-title { font-size: 22px; font-weight: 700; margin: 4px 0 12px; }
.lead { color: var(--soft); max-width: 760px; }

/* ---------- problem list ---------- */
.list-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 20px; align-items: start; }
.chip-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chip-row::-webkit-scrollbar { display: none; }
.cat {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px; border-radius: 999px; border: 0;
  background: var(--pane); color: var(--text); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap; box-shadow: var(--shadow);
}
.cat span { color: var(--muted); font-size: 12px; }
.cat.on { background: var(--text); color: var(--pane); }
.cat.on span { color: inherit; opacity: .7; }
.cat.soon { opacity: .5; cursor: default; }
.tag-row { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 12px 0 4px; max-height: 26px; overflow: hidden; }
.tag-row.open { max-height: none; }
.tagl { border: 0; background: none; padding: 2px 0; font: inherit; font-size: 13px; color: var(--soft); cursor: pointer; }
.tagl span { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 999px; background: var(--fill); color: var(--muted); font-size: 11px; }
.tagl:hover, .tagl.on { color: var(--accent); }
.tagl.on span { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.tag-wrap { display: flex; align-items: flex-start; gap: 8px; }
.tag-wrap .tag-row { flex: 1; }
.tag-more { margin-top: 10px; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 12px 0; }
.search { position: relative; flex: 1 1 220px; max-width: 320px; }
.search .input { width: 100%; padding-left: 32px; }
.search::before { content: "⌕"; position: absolute; left: 11px; top: 50%; transform: translateY(-52%); color: var(--muted); font-size: 16px; }
select.input { padding-right: 28px; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 15px) 15px, calc(100% - 10px) 15px; background-size: 5px 5px; background-repeat: no-repeat; cursor: pointer; }
.ptable { background: var(--pane); border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); }
.prow { display: grid; grid-template-columns: 36px minmax(0, 1fr) 170px 64px 72px; align-items: center; gap: 10px; min-height: 44px; padding: 7px 14px; color: var(--text); }
.prow:nth-child(even) { background: var(--layer); }
a.prow:hover { background: var(--hover); text-decoration: none; }
a.prow:hover .ptitle { color: var(--accent); }
.prow.head { min-height: 38px; color: var(--muted); font-size: 12px; background: var(--pane) !important; border-bottom: 1px solid var(--border); }
.ptitle { font-weight: 500; line-height: 1.35; overflow-wrap: anywhere; }
.ptitle .katex { font-size: 1em; }
.ptopic { color: var(--muted); font-size: 12px; line-height: 1.3; overflow-wrap: anywhere; }
.prating { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.empty { padding: 28px; text-align: center; }
.st { display: inline-grid; place-items: center; width: 18px; height: 18px; font-size: 13px; }
.st-solved { color: var(--ok); }
.st-attempted { color: var(--warn); }
.ptype { display: inline-block; margin-left: 6px; font-size: 10px; font-weight: 600; padding: 0 5px; border-radius: 4px; vertical-align: 2px; }
.ptype.answer { background: color-mix(in srgb, var(--easy) 15%, transparent); color: var(--easy); }
.ptype.proof { background: color-mix(in srgb, var(--accent) 13%, transparent); color: var(--accent); }
.diff { font-weight: 500; font-size: 13px; }
.diff-easy { color: var(--easy); } .diff-medium { color: var(--medium); } .diff-hard { color: var(--hard); }
.dpill { display: inline-flex; align-items: center; min-height: 24px; padding: 2px 10px; line-height: 1.3; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--fill); }
.side-card { background: var(--pane); border-radius: 10px; padding: 16px; box-shadow: var(--shadow); margin-bottom: 14px; }
.ring-wrap { display: flex; align-items: center; gap: 16px; }
.ring { position: relative; width: 96px; height: 96px; flex: none; }
.ring svg { width: 96px; height: 96px; transform: rotate(-90deg); }
.ring .ring-txt { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring .ring-txt b { font-size: 20px; }
.ring .ring-txt span { font-size: 11px; color: var(--muted); }
.dstat { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.dstat div { display: flex; justify-content: space-between; align-items: center; background: var(--layer); border-radius: 6px; padding: 3px 8px; font-size: 12px; }
.dstat b { color: var(--text); font-weight: 600; }

/* ---------- workspace ---------- */
body.ws-page { overflow: hidden; }
.ws { display: flex; height: calc(100vh - 48px); height: calc(100dvh - 48px); padding: 8px; gap: 0; }
.pane { background: var(--pane); border-radius: 8px; display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; border: 1px solid var(--border); }
.pane.left { width: var(--left-w, 48%); }
.right-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.right-col .pane.editor-pane { flex: 1; }
.right-col .pane.console { height: var(--console-h, 36%); }
.gutter-v { width: 8px; cursor: col-resize; display: grid; place-items: center; flex: none; }
.gutter-h { height: 8px; cursor: row-resize; display: grid; place-items: center; flex: none; }
.gutter-v::after { content: ""; width: 2px; height: 24px; border-radius: 2px; background: var(--border); }
.gutter-h::after { content: ""; height: 2px; width: 24px; border-radius: 2px; background: var(--border); }
.gutter-v:hover::after, .gutter-h:hover::after, .dragging::after { background: var(--accent); }
.pane-tabs { display: flex; align-items: center; gap: 2px; height: 38px; padding: 0 6px; background: var(--layer); border-bottom: 1px solid var(--border); flex: none; overflow-x: auto; scrollbar-width: none; }
.ptab { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border: 0; border-radius: 6px; background: none; font: inherit; font-size: 13px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.ptab:hover { background: var(--hover); color: var(--text); }
.ptab.on { color: var(--text); font-weight: 600; }
.ptab .ico { font-size: 13px; }
.ptab .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.tab-sep { width: 1px; height: 14px; background: var(--border); margin: 0 2px; }
.pane-tabs .spacer { flex: 1; }
.pane-body { flex: 1; overflow: auto; padding: 16px 20px 28px; min-height: 0; }
.p-title { font-size: 22px; font-weight: 600; margin: 0 0 10px; }
.p-badges { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 16px; }
.dpill.easy { color: var(--easy); } .dpill.medium { color: var(--medium); } .dpill.hard { color: var(--hard); }
.dpill.click { cursor: pointer; color: var(--soft); border: 0; font: inherit; font-size: 12px; }
.dpill.click:hover { color: var(--text); }
.solved-tag { margin-left: auto; color: var(--ok); font-size: 13px; display: inline-flex; gap: 4px; align-items: center; }
.statement { font-size: 15px; line-height: 1.7; }
.src-line { margin-top: 18px; font-size: 12px; color: var(--muted); }
.acc { border-top: 1px solid var(--border); }
.acc:last-of-type { border-bottom: 1px solid var(--border); }
.acc summary { list-style: none; display: flex; align-items: center; gap: 8px; height: 44px; cursor: pointer; font-size: 14px; color: var(--text); }
.acc summary::-webkit-details-marker { display: none; }
.acc summary::after { content: "⌄"; margin-left: auto; color: var(--muted); transition: transform .15s; }
.acc[open] summary::after { transform: rotate(180deg); }
.acc .acc-body { padding: 0 0 14px 24px; color: var(--soft); }
.acc summary svg.i { color: var(--muted); }
.acc-first { margin-top: 22px; }
.lock { text-align: center; padding: 40px 10px; color: var(--soft); }
.lock .big { font-size: 34px; }

.ed-tools { display: flex; align-items: center; gap: 2px; height: 38px; padding: 0 6px; background: var(--layer); border-bottom: 1px solid var(--border); flex: none; }
.ed-lang { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--soft); padding: 0 8px; white-space: nowrap; }
.ed-lang b { color: var(--easy); font-family: "JetBrains Mono", monospace; font-size: 12px; }
.pal { position: relative; display: inline-flex; }
.pal-main { min-width: 30px; height: 28px; padding: 0 5px; border: 0; border-radius: 6px 0 0 6px; background: none; color: var(--text); cursor: pointer; font-size: 12px; }
.pal-more { width: 12px; height: 28px; border: 0; border-radius: 0 6px 6px 0; background: none; color: var(--muted); cursor: pointer; font-size: 8px; padding: 0; }
.pal-main:hover, .pal-more:hover { background: var(--hover); }
.pal-menu { position: absolute; top: 32px; left: 0; z-index: 30; display: grid; grid-template-columns: repeat(3, 52px); gap: 3px; padding: 6px; background: var(--pane); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--pop-shadow); }
.pal-menu button { height: 34px; border: 0; border-radius: 5px; background: var(--layer); color: var(--text); cursor: pointer; font-size: 12px; overflow: hidden; }
.pal-menu button:hover { background: var(--hover); outline: 1px solid var(--accent); }
.pal-txt { font-family: "JetBrains Mono", monospace; font-size: 11px; color: var(--soft); }
.ed-tools .spacer { flex: 1; }
.editor { flex: 1; width: 100%; min-height: 0; resize: none; border: 0; padding: 14px 16px; font-size: 13.5px; line-height: 1.65; color: var(--text); background: var(--pane); tab-size: 2; }
.editor.small { min-height: 120px; border-radius: 8px; background: var(--layer); }
.console-body { flex: 1; overflow: auto; padding: 14px 18px; min-height: 0; }
.console-foot { display: flex; align-items: center; gap: 6px; height: 44px; padding: 0 10px; border-top: 1px solid var(--border); flex: none; }
.console.collapsed { height: 38px !important; }
.console.collapsed .console-body, .console.collapsed .console-foot { display: none; }
.preview-empty { color: var(--muted); }

/* results (LeetCode style) */
.res-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.res-title { font-size: 20px; font-weight: 600; margin: 0; }
.res-title.ok { color: var(--ok); } .res-title.warn { color: var(--warn); } .res-title.bad { color: var(--bad); }
.res-meta { color: var(--muted); font-size: 12px; }
.res-cards { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0; }
.res-card { background: var(--layer); border-radius: 8px; padding: 8px 14px; min-width: 110px; }
.res-card .k { font-size: 11px; color: var(--muted); }
.res-card .v { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.gap { margin: 10px 0; padding: 9px 12px; border-left: 3px solid var(--warn); background: color-mix(in srgb, var(--warn) 9%, transparent); border-radius: 0 6px 6px 0; }
.judging { display: flex; align-items: center; gap: 10px; color: var(--soft); font-size: 15px; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
table.ck { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 13px; }
table.ck th, table.ck td { padding: 7px 8px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
table.ck th { color: var(--muted); font-weight: 500; font-size: 12px; }
td.num { white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 600; }
ul.rubric { list-style: none; padding: 0; margin: 8px 0; }
ul.rubric li { padding: 6px 0; border-top: 1px dashed var(--border); display: flex; gap: 10px; align-items: baseline; }
ul.rubric .pts { min-width: 28px; text-align: center; font-weight: 700; font-size: 12px; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); border-radius: 5px; padding: 0 5px; }
ul.rubric li.ded .pts { color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); }
ul.rubric.self label { display: flex; gap: 10px; align-items: baseline; cursor: pointer; }
.answer-box { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.answer-input { width: 96px; height: 40px; font-size: 20px; text-align: center; font-family: "JetBrains Mono", monospace; letter-spacing: .15em; }
.subs { width: 100%; border-collapse: collapse; font-size: 13px; }
.subs th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px; padding: 8px; border-bottom: 1px solid var(--border); }
.subs td { padding: 10px 8px; border-bottom: 1px solid var(--border); }
.subs tr.click { cursor: pointer; }
.subs tr.click:hover td { background: var(--hover); }
.s-ok { color: var(--ok); font-weight: 600; } .s-warn { color: var(--warn); font-weight: 600; } .s-bad { color: var(--bad); font-weight: 600; }
.pop { position: absolute; z-index: 40; top: 34px; right: 0; width: 320px; background: var(--pane); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; box-shadow: var(--pop-shadow); font-size: 13px; }
.pop ul { margin: 0; padding-left: 18px; }
.rel { position: relative; }

/* markdown */
.md p { margin: .55em 0; }
.md ul, .md ol { padding-left: 22px; }
.md .katex-display { overflow-x: auto; overflow-y: hidden; padding: 2px 0; }
.md blockquote { margin: 0; padding: 4px 14px; border-left: 3px solid var(--border); color: var(--soft); }
.md table { border-collapse: collapse; margin: 10px 0; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }
.md h2 { font-size: 17px; margin-top: 1.3em; }
.md h4 { margin-top: 1.2em; }
.tex-error { color: var(--bad); }

/* learn + lecture */
.stage { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; white-space: nowrap; background: var(--layer); }
.stage-AIME { color: var(--easy); } .stage-JMO { color: var(--accent); } .stage-USAMO { color: #a259ff; } .stage-Putnam { color: var(--hard); } .stage-VMO { color: var(--medium); } .stage-Uni { color: #5856d6; } .stage-CP { color: var(--ok); } .stage-ML { color: #ff6b6b; } .stage-Intro { color: var(--soft); }
.stage-legend { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 14px; }
.area-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.area-card { margin: 0; }
.area-card h2 { font-size: 16px; margin-bottom: 2px; }
.topic-list { list-style: none; padding: 0; margin: 10px 0 0; }
.topic-list li { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-top: 1px solid var(--border); font-size: 13px; }
.topic-list li a { flex: 1; }
.topic-list .stages { display: inline-flex; gap: 3px; }
.topic-list .stage { font-size: 10px; padding: 0 5px; }
.lecture-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.lecture { padding: 24px 32px; font-size: 15px; line-height: 1.7; }
.lecture h1 { font-size: 24px; }
.lecture .stages { display: flex; gap: 6px; margin-bottom: 8px; }
.crumbs { color: var(--muted); font-size: 13px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.crumb-nav { margin-left: auto; display: flex; gap: 14px; }
.practice { position: sticky; top: 64px; margin: 12px 0; }
.plist { list-style: none; padding: 0; margin: 0; }
.plist li { padding: 7px 0; border-top: 1px solid var(--border); display: flex; gap: 8px; align-items: center; font-size: 13px; }
.plist li a { flex: 1; min-width: 0; }

/* explore → course → module */
.explore-group { margin: 26px 0 8px; }
.explore-group h2 { font-size: 18px; margin: 0 0 2px; }
.explore-group > p { margin: 0 0 12px; max-width: 760px; }
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.course-card { display: flex; flex-direction: column; background: var(--pane); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); color: var(--text); transition: transform .15s, box-shadow .15s; }
.course-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--pop-shadow); }
.cc-cover { position: relative; height: 128px; padding: 14px 16px; color: #fff; display: flex; flex-direction: column; justify-content: flex-end;
  background: linear-gradient(135deg, var(--cc), color-mix(in srgb, var(--cc) 55%, #000)); }
.cc-cover svg { position: absolute; right: 12px; top: 12px; width: 64px; height: 64px; opacity: .28; stroke: #fff; }
.cc-cover h3 { margin: 0; font-size: 18px; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.2); }
.cc-level { align-self: flex-start; font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: rgba(255,255,255,.22); color: #fff; margin-bottom: 6px; }
.cc-body { padding: 12px 16px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.cc-body p { margin: 0; color: var(--soft); font-size: 13px; flex: 1; }
.cc-meta { display: flex; gap: 12px; color: var(--muted); font-size: 12px; }
.continue { display: flex; flex-direction: column; gap: 2px; border-left: 4px solid var(--cc); max-width: 520px; color: var(--text); }
.continue:hover { text-decoration: none; background: var(--hover); }
.course-hero { display: grid; grid-template-columns: 88px minmax(0, 1fr) 220px; gap: 20px; align-items: center; margin: 12px 0 18px; padding: 22px 24px; border-radius: 14px; color: #fff;
  background: linear-gradient(135deg, var(--cc), color-mix(in srgb, var(--cc) 50%, #000)); }
.course-hero h1 { margin: 2px 0 6px; font-size: 26px; color: #fff; }
.course-hero p { margin: 0; color: rgba(255,255,255,.88); max-width: 680px; }
.course-hero .ch-syl { margin-top: 10px; display: flex; gap: 6px; align-items: center; }
.course-hero .ch-syl svg { width: 16px; height: 16px; flex: none; }
.ch-icon svg { width: 76px; height: 76px; stroke: #fff; opacity: .9; }
.ch-progress { background: rgba(0,0,0,.18); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.ch-progress .muted { color: rgba(255,255,255,.8); }
.ch-progress .bar { background: rgba(255,255,255,.25); }
.ch-progress .bar i { background: #fff !important; }
.ch-progress .btn { background: #fff; color: #222; margin-top: 4px; }
.ch-pct { font-size: 28px; font-weight: 700; }
.chapter h2 { font-size: 17px; display: flex; align-items: center; gap: 10px; margin: 0 0 2px; }
.chapter > p { margin: 0 0 8px 38px; }
.ch-num { width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 14px; background: color-mix(in srgb, var(--cc) 16%, transparent); color: var(--cc); flex: none; }
.mod-list { display: flex; flex-direction: column; }
.mod-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 6px; border-top: 1px solid var(--border); color: var(--text); border-radius: 6px; }
.mod-row:hover { background: var(--hover); text-decoration: none; }
.mod-main { display: flex; flex-direction: column; min-width: 0; }
.mod-main .muted { font-size: 13px; }
.mod-side { display: flex; gap: 12px; align-items: center; white-space: nowrap; }
.mod-check { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border); display: inline-grid; place-items: center; flex: none; }
.mod-check svg { width: 12px; height: 12px; stroke: #fff; stroke-width: 3; }
.done > .mod-check, .mod-row.done .mod-check { background: var(--ok); border-color: var(--ok); }
.lvl { font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--layer); }
.lvl-intro { color: var(--soft); } .lvl-easy { color: var(--easy); } .lvl-medium { color: var(--medium); } .lvl-hard { color: var(--hard); } .lvl-advanced { color: #a259ff; }
.module-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 16px; align-items: start; }
.mod-toc { position: sticky; top: 64px; max-height: calc(100vh - 80px); overflow-y: auto; padding: 12px 10px; font-size: 13px; }
.toc-course { display: block; font-weight: 700; color: var(--text); padding: 2px 8px 8px; }
.toc-ch { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 10px 8px 4px; }
.toc-mod { display: flex; gap: 8px; align-items: center; padding: 5px 8px; border-radius: 6px; color: var(--soft); }
.toc-mod .mod-check { width: 16px; height: 16px; border-width: 1.5px; }
.toc-mod .mod-check svg { width: 10px; height: 10px; }
.toc-mod:hover { background: var(--hover); text-decoration: none; }
.toc-mod.on { background: color-mix(in srgb, var(--cc) 14%, transparent); color: var(--text); font-weight: 600; }
.mod-main-col { min-width: 0; }
.mod-main-col .lecture { margin-top: 0; }
.mod-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; font-size: 13px; }
.mod-meta svg { width: 14px; height: 14px; vertical-align: -2px; }
.mod-summary { font-size: 16px; color: var(--soft); margin: 0 0 12px; }
.prereqs { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 12px; border-radius: 8px; background: var(--layer); font-size: 13px; margin: 8px 0 14px; }
.prereqs .chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; background: var(--pane); border: 1px solid var(--border); }
.prereqs .chip svg { width: 12px; height: 12px; stroke: var(--ok); stroke-width: 3; }
.resources h2 { margin-top: .6em; }
.resources table { width: 100%; display: table; font-size: 13.5px; }
.lecture .nowrap, .practice-table .nowrap { white-space: nowrap; }
.lecture details { border: 1px solid var(--border); border-radius: 8px; padding: 6px 12px; margin: 8px 0 12px; background: var(--layer); }
.lecture details[open] { padding-bottom: 10px; }
.lecture summary { cursor: pointer; font-weight: 600; color: var(--accent); font-size: 14px; }
.lecture .callout, .lecture blockquote { border-left: 3px solid var(--cc, var(--accent)); background: color-mix(in srgb, var(--cc, var(--accent)) 7%, transparent); padding: 8px 14px; border-radius: 0 8px 8px 0; color: var(--text); }
.practice-table table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.practice-table th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.practice-table td { padding: 8px; border-bottom: 1px solid var(--border); }
.practice-table h2 { font-size: 17px; }
.mod-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 8px 0 30px; }
.mod-foot svg { width: 14px; height: 14px; vertical-align: -2px; }
@media (max-width: 960px) {
  .module-layout { grid-template-columns: 1fr; }
  .mod-toc { position: static; max-height: 240px; }
  .course-hero { grid-template-columns: 1fr; }
  .ch-icon { display: none; }
}
@media (max-width: 640px) {
  /* The resources table becomes a list: title on its own line, then section, pages and the note. */
  .resources table, .resources tbody { display: block; }
  .resources thead { display: none; }
  .resources tr { display: flex; flex-wrap: wrap; gap: 2px 10px; padding: 9px 0; border-top: 1px solid var(--border); }
  .resources td { display: block; border: 0; padding: 0; }
  .resources td:first-child, .resources td[colspan] { flex: 1 1 100%; font-weight: 600; }
  .resources td:last-child:not(:first-child) { flex: 1 1 100%; }
  .resources td.nowrap { white-space: normal; }
}
@media (max-width: 560px) {
  .mod-row { grid-template-columns: 24px minmax(0, 1fr); }
  .mod-side { grid-column: 2; }
  .mod-foot .btn { padding: 0 10px; font-size: 13px; }
  .practice-table th:nth-child(3), .practice-table td:nth-child(3), .practice-table th:nth-child(4), .practice-table td:nth-child(4) { display: none; }
}

/* progress */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat { margin: 0; }
.stat-label { font-size: 12px; color: var(--muted); }
.stat-big { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-big .muted { font-size: 15px; font-weight: 500; }
.bar { height: 6px; background: var(--fill); border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.bar.easy i { background: var(--easy); } .bar.medium i { background: var(--medium); } .bar.hard i { background: var(--hard); }
.area-row { display: grid; grid-template-columns: 200px 1fr 110px; gap: 12px; align-items: center; padding: 5px 0; font-size: 13px; }
.spark { width: 100%; height: 120px; }
.next-prob { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* settings */
.form label { display: flex; flex-direction: column; gap: 4px; margin: 12px 0; font-weight: 500; }
.form .input { max-width: 520px; }

@media (max-width: 960px) {
  .list-layout { grid-template-columns: minmax(0, 1fr); }
  .list-side .side-card:not(:first-child) { display: none; }
  .list-side { order: -1; }
  .lecture-layout { grid-template-columns: 1fr; }
  .practice { position: static; }
}
@media (max-width: 860px) {
  body.ws-page { overflow: auto; }
  .ws { display: block; height: auto; padding: 6px; }
  .pane.left { width: auto; }
  .pane.left .pane-body { max-height: 60vh; }
  .gutter-v, .gutter-h { display: none; }
  .right-col { margin-top: 8px; }
  .right-col .pane.editor-pane { height: 46vh; }
  .right-col .pane.console { height: auto; min-height: 220px; margin-top: 8px; }
  .ed-tools { overflow-x: auto; }
  .prow { grid-template-columns: 26px minmax(0, 1fr) 60px; }
  .prow .ptopic, .prow .prating { display: none; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .area-row { grid-template-columns: 110px 1fr 80px; }
  .lecture { padding: 16px; }
  .bar-center .btn .lbl { display: none; }
  .rating-chip { display: none; }
}
@media (max-width: 560px) {
  .topbar { gap: 6px; padding: 0 8px; }
  .nav a { padding: 4px 5px; font-size: 13px; }
  .brand span { display: none; }
  #theme-toggle { display: none; }
  .bar-prob .ibtn .lbl { display: none; }
}

/* ===================== accounts, library layout, profile, discuss ===================== */
.page.wide { max-width: 1680px; }
.page.narrow { max-width: 900px; }
.lib-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr) 320px; gap: 22px; align-items: start; }
.lib-side { position: sticky; top: 64px; max-height: calc(100vh - 80px); overflow-y: auto; padding-right: 6px; }
.lib-nav { display: flex; flex-direction: column; gap: 2px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.lib-nav a { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px; color: var(--text); font-weight: 500; }
.lib-nav a:hover { background: var(--hover); text-decoration: none; }
.lib-nav a.on { background: var(--fill); }
.lib-lists-h { display: flex; justify-content: space-between; align-items: center; margin: 14px 4px 6px 12px; color: var(--muted); font-weight: 600; }
.lib-lists { list-style: none; margin: 0; padding: 0; }
.lib-lists a { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto 18px; gap: 8px; align-items: center; padding: 7px 10px; border-radius: 8px; color: var(--text); }
.lib-lists a:hover { background: var(--hover); text-decoration: none; }
.lib-lists a.on { background: var(--fill); }
.li-ic { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; background: var(--layer); font-size: 13px; }
.li-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-n { font-size: 12px; }
.lib-lists svg.i { color: var(--muted); }
.lib-note { padding: 8px 12px; }
.new-list-form { padding: 8px; margin: 0 4px 8px; background: var(--pane); border-radius: 8px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px; }
.new-list-form .input { height: 30px; font-size: 13px; }
.new-list-form select.input { width: 64px; }
.list-head { display: flex; align-items: center; gap: 14px; padding: 16px 18px; margin-bottom: 14px; background: var(--pane); border-radius: 12px; box-shadow: var(--shadow); flex-wrap: wrap; }
.list-head h1 { font-size: 20px; margin: 0; }
.lh-icon { width: 52px; height: 52px; border-radius: 12px; background: var(--layer); display: grid; place-items: center; font-size: 26px; }

.chips-scroll { position: relative; display: flex; align-items: center; }
.chips-scroll .chip-row { flex: 1; scroll-behavior: smooth; }
.chips-scroll.fade::after { content: ""; position: absolute; right: 34px; top: 0; bottom: 2px; width: 48px; background: linear-gradient(90deg, transparent, var(--bg)); pointer-events: none; }
.chip-more { flex: none; width: 32px; height: 32px; margin-left: 4px; border: 0; border-radius: 50%; background: transparent; color: var(--soft); font-size: 18px; cursor: pointer; }
.chip-more:hover { background: var(--hover); }
.cat svg.i { margin-right: 2px; }
.tag-row { max-height: 28px; }
.tag-more { white-space: nowrap; }
.round-btn { position: relative; width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--pane); color: var(--soft); display: grid; place-items: center; cursor: pointer; box-shadow: var(--shadow); }
.round-btn:hover { color: var(--text); background: var(--hover); }
.round-btn .dot { position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.menu { position: absolute; z-index: 50; background: var(--pane); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--pop-shadow); padding: 6px; min-width: 200px; }
.menu button, .menu a { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 6px; background: none; font: inherit; font-size: 14px; color: var(--text); cursor: pointer; text-align: left; }
.menu a { justify-content: flex-start; }
.menu button:hover, .menu a:hover { background: var(--hover); text-decoration: none; }
.menu button.on { background: var(--layer); font-weight: 600; }
.menu hr { margin: 6px 0; }
.pop-menu { top: 42px; left: 0; width: 240px; }
.filter-pop { width: 290px; padding: 12px; }
.fg { margin-bottom: 10px; }
.fg-opts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.fg-opts button { width: auto; padding: 4px 12px; border-radius: 999px; background: var(--layer); font-size: 13px; }
.fg-opts button.on { background: var(--text); color: var(--pane); }
.solved-mini { display: inline-flex; align-items: center; gap: 6px; color: var(--soft); font-size: 14px; }
.prow.head button { border: 0; background: none; font: inherit; font-size: 12px; color: var(--muted); padding: 0; text-align: left; cursor: pointer; }
.prow.head button:hover { color: var(--text); }
.prow.notags { grid-template-columns: 36px minmax(0, 1fr) 64px 72px; }
.prow.daily { background: color-mix(in srgb, var(--accent) 6%, var(--pane)) !important; }
.st-daily { color: var(--accent); }

.cal-card .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin: 10px 0; text-align: center; font-size: 13px; }
.cal-grid b { color: var(--muted); font-weight: 500; font-size: 12px; }
.cd { position: relative; display: grid; place-items: center; height: 30px; border-radius: 50%; color: var(--text); }
.cd:hover { background: var(--hover); text-decoration: none; }
.cd.done { color: var(--accent); }
.cd.done svg.i { width: 22px; height: 22px; }
.cd.today { background: var(--ok); color: #fff; font-weight: 700; }
.cd.past i { position: absolute; bottom: 2px; width: 4px; height: 4px; border-radius: 50%; background: var(--hard); opacity: .7; }
.cd.future { color: var(--muted); }
.daily-link { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 8px 10px; margin-bottom: 6px; border-radius: 8px; background: var(--layer); color: var(--text); font-size: 13px; }
.daily-link:hover { text-decoration: none; background: var(--hover); }
.txt { color: var(--text); }

.gauge { position: relative; flex: none; }
.gauge svg { width: 100%; height: 100%; }
.gauge-txt { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.gauge-txt b { font-size: 28px; font-weight: 700; }
.gauge-txt span { color: var(--muted); font-size: 14px; }
.gauge-sub { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--text); }
.gauge-sub svg.i { color: var(--ok); }
.gauge-att { position: absolute; left: 0; right: 0; bottom: 4%; text-align: center; font-size: 12px; color: var(--muted); }
.solved-card { display: flex; align-items: center; gap: 14px; }
.dstat.big div { padding: 8px 12px; font-size: 13px; }
.dstat.big div { flex-direction: column; align-items: center; gap: 2px; }
.side-rating { font-size: 26px; font-weight: 700; }
.side-next { display: block; margin: 6px 0 2px; font-weight: 500; }

/* navbar account area */
.bar-user { display: flex; align-items: center; gap: 6px; }
.streak { gap: 4px; color: var(--muted); }
.streak.on { color: var(--brand); }
.avatar { display: inline-grid; place-items: center; border-radius: 50%; color: #fff; font-weight: 700; object-fit: cover; flex: none; }
.avatar-btn { border: 0; background: none; padding: 0; cursor: pointer; border-radius: 50%; display: grid; }
#user-menu { right: 0; top: 40px; width: 250px; }
.menu-head { display: flex !important; gap: 12px; padding: 10px !important; margin-bottom: 4px; }

/* modal + auth */
.modal-wrap { position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, .45); display: grid; place-items: center; padding: 16px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { position: relative; width: 100%; max-width: 420px; max-height: calc(100vh - 32px); overflow-y: auto; background: var(--pane); border-radius: 14px; padding: 30px 32px 24px; box-shadow: var(--pop-shadow); }
.modal.wide { max-width: 560px; }
.modal-x { position: absolute; top: 10px; right: 10px; }
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 22px; font-size: 22px; font-weight: 700; }
.auth-brand img { width: 52px; height: 52px; }
.auth-brand b { color: var(--brand); }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-in { height: 44px; width: 100%; background: var(--pane); border: 1px solid var(--border); font-size: 15px; }
.pw { position: relative; }
.pw-eye { position: absolute; right: 6px; top: 7px; }
.auth-hint { margin: -6px 0 0 2px; font-size: 12px; color: var(--muted); }
.auth-hint.good { color: var(--ok); } .auth-hint.bad { color: var(--bad); }
.auth-err { margin: 0; color: var(--bad); font-size: 13px; }
.auth-btn { height: 44px; width: 100%; background: var(--text); color: var(--pane); font-size: 15px; }
.auth-btn:disabled { background: var(--fill); color: var(--muted); opacity: 1; }
.auth-terms { text-align: center; color: var(--muted); font-size: 13px; margin: 14px 0 8px; }
.auth-links { font-size: 14px; color: var(--muted); margin-top: 6px; }
.auth-links a { color: var(--soft); }
.auth-links.center { text-align: center; }
.auth-or { text-align: center; color: var(--muted); font-size: 13px; margin: 18px 0 10px; }
.auth-social { display: flex; justify-content: center; gap: 14px; }
.social { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border); background: var(--pane); display: grid; place-items: center; cursor: pointer; }
.social:hover { background: var(--hover); }
.edit-form label { font-weight: 500; }
.edit-form .input { width: 100%; max-width: none; }
.ep-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 200; transform: translate(-50%, 20px); opacity: 0; background: var(--text); color: var(--pane); padding: 10px 18px; border-radius: 10px; font-size: 14px; box-shadow: var(--pop-shadow); transition: all .25s; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.banner { padding: 10px 14px; margin-bottom: 14px; border-radius: 10px; background: color-mix(in srgb, var(--accent) 10%, var(--pane)); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.banner.small { font-size: 13px; padding: 8px 12px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; background: var(--fill); color: var(--soft); font-size: 12px; white-space: nowrap; }
.chip.link { color: var(--accent); }
a.chip:hover { text-decoration: none; filter: brightness(.96); }
.dpill.fav-on { color: #ffb800; }
.dpill.fav-on svg.i { fill: #ffb800; }
.list-pop { top: 30px; left: 0; width: 230px; }
.grader-pop { top: 36px; right: 0; width: 280px; max-height: 70vh; overflow-y: auto; }
.menu-label { padding: 6px 10px 2px; font-size: 12px; font-weight: 600; color: var(--soft); text-transform: uppercase; letter-spacing: .04em; }
.menu-sub { padding: 6px 10px 2px; font-size: 12px; color: var(--soft); }
.menu button[data-need] > span:first-child { opacity: .6; }
.form label.flash { animation: flash 1.6s ease-out 1; border-radius: 8px; }
@keyframes flash { 0%, 40% { background: color-mix(in srgb, var(--accent) 18%, transparent); box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 18%, transparent); } 100% { background: transparent; box-shadow: none; } }
.daily-pill { color: var(--accent); }

/* profile */
.profile-grid { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 18px; align-items: start; }
.pf-left { margin: 0; padding: 22px; }
.pf-left h3 { font-size: 15px; margin: 4px 0 10px; }
.pf-head { display: flex; gap: 16px; align-items: flex-start; }
.pf-head .avatar { border-radius: 12px; }
.pf-head h2 { font-size: 18px; margin: 0; }
.pf-rank { margin-top: 8px; color: var(--soft); }
.pf-bio { color: var(--soft); margin: 14px 0; }
.pf-actions { margin: 14px 0; flex-wrap: nowrap; }
.pf-info, .pf-stats { list-style: none; margin: 10px 0; padding: 0; display: flex; flex-direction: column; gap: 10px; color: var(--soft); }
.pf-info li, .pf-stats li { display: flex; align-items: center; gap: 10px; }
.pf-info .pf-tags span { display: flex; flex-wrap: wrap; gap: 6px; }
.pf-stats b { margin-left: auto; color: var(--text); }
.skill-group { margin-bottom: 12px; }
.skill-h { display: flex; align-items: center; gap: 8px; font-weight: 600; margin-bottom: 6px; }
.skill-h i { width: 6px; height: 6px; border-radius: 50%; }
.skill-tags { display: flex; flex-wrap: wrap; gap: 6px 4px; align-items: center; }
.skill-tags .muted { margin-right: 8px; }
.pf-main > .card, .pf-row > .card { margin: 0 0 16px; }
.pf-rating-top { display: flex; gap: 28px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 8px; }
.pf-big { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pf-mid { font-size: 16px; font-weight: 600; }
.pf-level { font-size: 18px; font-weight: 700; }
.rchart { width: 100%; height: auto; max-height: 170px; }
.pf-row { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; }
.pf-solved { display: flex; align-items: center; justify-content: space-around; gap: 16px; }
.pf-solved .dstat { max-width: 160px; }
.badge-row { display: flex; gap: 14px; margin: 10px 0; }
.badge-item { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; color: var(--soft); width: 88px; text-align: center; }
.badge-item .hex { width: 78px; height: 86px; }
.badge-item.locked polygon { fill: var(--fill); stroke: var(--border); }
.badge-item.locked text { fill: var(--muted); }
.hm-head { flex-wrap: wrap; margin-bottom: 14px; }
.hm-total { font-size: 20px; }
.sm-select { height: 30px; font-size: 13px; padding-left: 10px; margin-left: 8px; }
.hm-wrap { --c: 11px; --hm-gap: 2px; display: flex; width: 100%; gap: 3px; overflow: hidden; padding-bottom: 2px; }
.hm-month { position: relative; display: flex; flex-direction: column; align-items: flex-start; flex: none; padding-bottom: 18px; }
.hm-grid { display: grid; grid-template-rows: repeat(7, var(--c)); grid-auto-columns: var(--c); gap: var(--hm-gap); }
.hm { display: block; width: var(--c); height: var(--c); border-radius: 2px; background: var(--fill); }
.hm.l1 { background: #a6f0b9; } .hm.l2 { background: #5ed47f; } .hm.l3 { background: #28b04f; } .hm.l4 { background: #0e8a35; }
:root[data-theme="dark"] .hm.l1 { background: #0e4429; } :root[data-theme="dark"] .hm.l2 { background: #0f7a35; } :root[data-theme="dark"] .hm.l3 { background: #26a641; } :root[data-theme="dark"] .hm.l4 { background: #4ad66d; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hm.l1 { background: #0e4429; } :root:not([data-theme="light"]) .hm.l2 { background: #0f7a35; } :root:not([data-theme="light"]) .hm.l3 { background: #26a641; } :root:not([data-theme="light"]) .hm.l4 { background: #4ad66d; } }
.hm-label { position: absolute; left: 0; bottom: 0; font-size: 12px; line-height: 16px; color: var(--muted); white-space: nowrap; }
.seg-tabs { display: inline-flex; gap: 4px; padding: 3px; border-radius: 10px; background: var(--layer); }
.seg-tabs button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 6px 12px; border-radius: 8px; font: inherit; font-size: 14px; color: var(--soft); cursor: pointer; }
.seg-tabs button.on { background: var(--pane); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }
.seg-tabs.small button { font-size: 13px; padding: 4px 10px; }
.stripe-list { margin-top: 12px; }
.stripe-list a { display: flex; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: 8px; color: var(--text); }
.stripe-list a:nth-child(odd) { background: var(--layer); }
.stripe-list a:hover { text-decoration: none; background: var(--hover); }

/* practice history */
.history-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 22px; align-items: start; }
.hrow { display: grid; grid-template-columns: 140px minmax(0, 1fr) 150px 120px; gap: 12px; align-items: center; padding: 10px 16px; min-height: 56px; }
.hrow:nth-child(even) { background: var(--layer); }
.hrow.head { min-height: 40px; background: var(--pane) !important; border-bottom: 1px solid var(--border); font-size: 12px; color: var(--muted); }
.hrow.head button { border: 0; background: none; font: inherit; color: var(--muted); cursor: pointer; text-align: left; padding: 0; }
.hprob { display: flex; gap: 10px; align-items: center; color: var(--text); }
.hprob:hover { text-decoration: none; }
.hprob > span:last-child { display: flex; flex-direction: column; }
.hname { font-weight: 500; }
.hcount { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; font: inherit; color: var(--text); cursor: pointer; }
.hsubs { padding: 4px 16px 10px 168px; background: var(--layer); font-size: 13px; }
.hsubs div { display: grid; grid-template-columns: 200px 140px 1fr; gap: 10px; padding: 4px 0; }
.h-total { font-size: 15px; margin: 4px 0 10px; } .h-total b { font-size: 30px; color: var(--accent); margin-right: 4px; }
.h-chips { display: flex; gap: 8px; } .h-chips div { flex: 1; display: flex; justify-content: space-between; padding: 6px 10px; border-radius: 8px; background: var(--layer); font-size: 13px; }
.h-two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.h-two .side-card { margin-bottom: 14px; }
.h-num { font-size: 30px; font-weight: 700; } .h-num span { font-size: 16px; }
.h-num.purple { color: #a259ff; } .h-num.green { color: var(--ok); }
.bars { display: flex; align-items: flex-end; gap: 2px; height: 140px; margin: 14px 0 6px; border-bottom: 1px solid var(--border); }
.bar-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; }
.bar-col i { display: block; width: 100%; border-radius: 2px 2px 0 0; min-height: 2px; }
.h-legend { margin-top: 10px; font-size: 15px; display: flex; gap: 6px; align-items: baseline; }

/* discuss */
.discuss-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: start; }
.disc-top { flex-wrap: wrap; margin-bottom: 4px; }
.disc-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.disc-tabs a { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 8px; color: var(--soft); font-weight: 500; }
.disc-tabs a:hover { text-decoration: none; color: var(--text); }
.disc-tabs a.on { background: var(--fill); color: var(--text); }
.disc-sort { gap: 16px; margin: 8px 0 6px 6px; }
.disc-sort a { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; }
.disc-sort a.on { color: var(--text); font-weight: 500; }
.post-row { display: flex; gap: 14px; padding: 18px 0; border-bottom: 1px solid var(--border); }
.post-main { flex: 1; min-width: 0; }
.post-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.post-meta a { color: var(--soft); }
.post-meta.big { font-size: 14px; margin-bottom: 16px; }
.post-title { display: block; font-size: 17px; font-weight: 600; color: var(--text); margin: 4px 0; }
.post-title:hover { text-decoration: none; color: var(--accent); }
.post-ex { color: var(--soft); margin: 0 0 8px; overflow-wrap: anywhere; }
.post-stats { display: flex; gap: 16px; color: var(--muted); font-size: 13px; align-items: center; flex-wrap: wrap; }
.post-stats span { display: inline-flex; align-items: center; gap: 4px; }
.search.wide { max-width: none; margin-bottom: 14px; }
.trending h3 { display: flex; align-items: center; gap: 8px; font-size: 17px; }
.trending ol { list-style: none; padding: 0; margin: 0; }
.trending li { display: flex; gap: 12px; padding: 9px 0; }
.trending li a { color: var(--text); font-weight: 500; }
.tn { width: 18px; font-weight: 700; color: var(--muted); }
.tn.t1 { color: var(--hard); } .tn.t2 { color: #ff8a00; } .tn.t3 { color: var(--medium); }
.post-full { padding: 26px 30px; }
.post-h { font-size: 24px; margin-bottom: 10px; }
.post-body { font-size: 15px; line-height: 1.7; }
.post-actions { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.btn.vote.on { background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); }
.composer { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.composer textarea { width: 100%; resize: vertical; }
.comment { display: flex; gap: 10px; padding: 12px 0; border-top: 1px solid var(--border); }
.editor-card { display: flex; flex-direction: column; gap: 12px; }
.e-title { height: 46px; font-size: 18px; font-weight: 600; width: 100%; }
.e-meta { flex-wrap: wrap; }
.e-meta #e-prob { width: 280px; }
.e-split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.e-body { min-height: 420px; resize: vertical; font-family: "JetBrains Mono", monospace; font-size: 13px; line-height: 1.6; padding: 12px; }
.e-preview { min-height: 420px; border: 1px solid var(--border); border-radius: 8px; padding: 10px 16px; overflow: auto; }
.sol-row { display: flex; align-items: center; gap: 12px; padding: 12px 6px; border-bottom: 1px solid var(--border); color: var(--text); }
.sol-row:hover { text-decoration: none; background: var(--hover); }
.sol-title { font-weight: 500; }
.empty-state { text-align: center; padding: 40px 10px; color: var(--muted); }
.empty-state svg.i { width: 32px; height: 32px; }

@media (max-width: 1280px) {
  .lib-layout { grid-template-columns: 200px minmax(0, 1fr) 280px; }
}
@media (max-width: 1100px) {
  .lib-layout { grid-template-columns: minmax(0, 1fr) 280px; }
  .lib-side { display: none; }
}
@media (max-width: 960px) {
  .lib-layout, .profile-grid, .history-grid, .discuss-grid { grid-template-columns: minmax(0, 1fr); }
  .lib-layout .list-side { order: -1; }
  .lib-layout .list-side .side-card:not(.solved-card) { display: none; }
  .pf-row, .e-split { grid-template-columns: 1fr; }
  .hrow { grid-template-columns: 90px minmax(0, 1fr) 90px 60px; font-size: 13px; }
  .hsubs { padding-left: 16px; }
}
@media (max-width: 860px) {
  .prow.notags { grid-template-columns: 26px minmax(0, 1fr) 60px; }
  .bar-user .btn { padding: 0 8px; }
}
@media (max-width: 560px) {
  .bar-user .muted { display: none; }
  .modal { padding: 26px 20px 20px; }
  .ep-grid { grid-template-columns: 1fr; }
}
.p-title .katex, .ptitle .katex, .plist .katex, .daily-link .katex, .side-next .katex, .stripe-list .katex, .hname .katex, .chip .katex { font-size: 1.04em; }
.pf-main, .lib-main, .history-grid > div, .discuss-grid > div { min-width: 0; }
@media (max-width: 560px) {
  .pf-rating-top { gap: 16px; }
  .pf-solved { flex-direction: column; }
  .pf-solved .gauge { width: min(220px, 78%) !important; margin: 0 auto; }
  .pf-solved .dstat { width: min(220px, 100%); }
  .badge-row { flex-wrap: wrap; }
  .pf-left { padding: 4px 0 0; }
}
.pf-tabs > .row-between { flex-wrap: wrap; }
.seg-tabs { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.src-line { line-height: 1.6; }
.src-line a { display: inline-flex; align-items: center; gap: 3px; }
.src-line svg.i { width: 11px; height: 11px; }
.rchart-empty { padding: 28px 0 12px; font-size: 13px; }
.draft-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 12px; font-size: 13px; background: color-mix(in srgb, var(--accent) 9%, var(--pane)); border-bottom: 1px solid var(--border); flex: none; }
.draft-bar svg.i { vertical-align: -2px; }
#wc svg.i { color: var(--ok); vertical-align: -2px; }
.pf-rating { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 0; }
.pf-rating-left { padding-right: 22px; min-width: 0; }
.pf-rating-right { padding-left: 22px; border-left: 1px solid var(--border); display: flex; flex-direction: column; }
.dist { height: 52px; flex: none; display: flex; align-items: flex-end; justify-content: flex-end; gap: 5px; margin-top: auto; padding-top: 8px; }
.dist i { flex: none; width: 8px; height: 3px; background: var(--fill); border-radius: 2px 2px 0 0; }
.dist i.mine { background: var(--medium); }
.pf-heat { position: relative; }
.hm { cursor: pointer; }
.hm-tip {
  position: absolute; z-index: 5; padding: 8px 12px; border-radius: 8px; background: var(--pane); color: var(--text);
  font-size: 13px; font-weight: 500; white-space: nowrap; pointer-events: none;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .12), 0 0 0 1px rgba(0, 0, 0, .04);
}
@media (max-width: 960px) { .pf-rating { grid-template-columns: 1fr; } .pf-rating-right { border-left: 0; padding-left: 0; border-top: 1px solid var(--border); padding-top: 14px; margin-top: 14px; } .pf-rating-left { padding-right: 0; } }
.pf-follow { display: flex; align-items: center; gap: 12px; margin: 12px 0 4px; color: var(--muted); }
.pf-follow .sep { width: 1px; height: 14px; background: var(--border); }
.linkish { border: 0; background: none; padding: 0; font: inherit; color: var(--muted); cursor: pointer; }
.linkish b { color: var(--text); margin-right: 3px; }
.linkish:hover { color: var(--text); }
.people { display: flex; flex-direction: column; max-height: 60vh; overflow-y: auto; }
.people a { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 8px; color: var(--text); }
.people a:hover { background: var(--hover); text-decoration: none; }
.people a > span { display: flex; flex-direction: column; }
.pf-badges.open { grid-column: 1 / -1; }
.pf-row:has(.pf-badges.open) .pf-solved { display: none; }
.badge-row { display: flex; gap: 18px; justify-content: center; margin: 8px 0; }
.badge-panel { display: flex; gap: 18px; align-items: stretch; }
.bp-col { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.bp-sep { width: 1px; background: var(--border); }
.badge-strip { display: flex; gap: 18px; overflow-x: auto; padding: 6px 2px; }
.badge-strip.wrap { flex-wrap: wrap; overflow: visible; }
.badge-tile { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 96px; text-align: center; font-size: 13px; }
.badge-tile b { font-weight: 600; max-width: 110px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge-tile.small { min-width: 80px; font-size: 12px; }
.active-tag { display: inline-flex; align-items: center; gap: 4px; color: var(--ok); font-weight: 600; }
.active-tag svg.i { color: var(--ok); }
.all-badges { margin-top: 10px; }
.all-badges summary { cursor: pointer; }
.name-badge { display: inline-flex; vertical-align: -3px; }
.name-badge svg { width: 22px; height: 24px; }
@media (max-width: 560px) { .badge-panel { flex-direction: column; } .bp-sep { display: none; } }

/* --- profile density (closer to LeetCode) --- */
.pf-solved {
  justify-content: flex-start;
  align-items: center;
  gap: 0;
  padding: 6px 18px 6px 4px;
}
.pf-solved .gauge {
  width: min(252px, 58%) !important;
  height: auto !important;
  aspect-ratio: 1;
  margin-left: auto;
  margin-right: auto;
  container-type: inline-size;
}
.pf-solved .gauge svg { stroke-width: 4.6; }
.pf-solved .gauge-txt b { font-size: 50px; font-size: 21cqw; line-height: .95; letter-spacing: -.03em; }
.pf-solved .gauge-txt span { font-size: 22px; font-size: 9.5cqw; }
.pf-solved .gauge-sub { font-size: 16px; font-size: 7cqw; margin-top: 6px; gap: 5px; }
.pf-solved .gauge-sub svg.i { width: 1.05em; height: 1.05em; }
.pf-solved .gauge-att { font-size: 14px; font-size: 6.2cqw; bottom: 1.5%; }
.pf-solved .dstat { width: 142px; flex: none; gap: 8px; }
.pf-solved .dstat div { padding: 12px 10px; font-size: 14px; border-radius: 8px; }
.pf-solved .dstat b { font-size: 16px; }
.pf-left { background: none; box-shadow: none; border-radius: 0; margin: 0; padding: 2px 4px 0; }
.pf-head { gap: 14px; }
.pf-head .avatar { width: 104px !important; height: 104px !important; border-radius: 8px; font-size: 42px !important; }
.pf-head h2 { font-size: 22px; }
.pf-rank { font-size: 18px; color: var(--soft); margin-top: 10px; }
.profile-grid { grid-template-columns: 300px minmax(0, 1fr); gap: 22px; }
.pf-rating { padding: 16px 20px 14px; align-items: stretch; }
.pf-rating .pf-big { font-size: 32px; letter-spacing: -.03em; line-height: 1; }
.pf-rating .pf-mid { font-size: 17px; }
.pf-level-row { display: flex; align-items: center; gap: 7px; height: 32px; }
.tier-mark { width: 24px; height: 28px; flex: none; display: block; }
.pf-level { font-size: 20px; font-weight: 700; line-height: 1; }
.pf-top { font-size: 32px; font-weight: 700; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.pf-rating-right { justify-content: flex-start; }
.rchart { max-height: 140px; }
.badge-row { gap: 18px; justify-content: center; }
.pf-recent { color: var(--muted); font-size: 12px; margin-top: 8px; }
.pf-recent-name { color: var(--text); font-size: 18px; font-weight: 600; margin-top: 1px; }
@media (max-width: 960px) {
  .profile-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Top distribution, LeetCode style */
.dist { height: 120px; display: flex; align-items: flex-end; justify-content: stretch; gap: 5px; margin-top: auto; padding-top: 18px; }
.dist i { flex: 1 1 0; width: auto; min-width: 0; background: #f0f0f2; border-radius: 3px 3px 0 0; }
:root[data-theme="dark"] .dist i { background: #3a3a3a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .dist i { background: #3a3a3a; } }
.dist i.mine { background: var(--brand); }
.pf-top { font-weight: 500; font-size: 34px; }

/* Following / Followers panel */
.follow-panel { padding: 22px 22px 14px; min-height: 420px; }
.follow-panel .back { box-shadow: none; background: var(--layer); width: 34px; height: 34px; border-radius: 8px; }
.fp-tabs { display: flex; gap: 6px; margin: 16px 0 12px; }
.fp-tabs a { padding: 8px 16px; border-radius: 8px; color: var(--text); font-weight: 500; }
.fp-tabs a:hover { text-decoration: none; background: var(--hover); }
.fp-tabs a.on { background: var(--layer); font-weight: 600; }
.fp-row { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-radius: 10px; }
.fp-row:nth-child(odd) { background: var(--layer); }
.fp-who { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; color: var(--text); }
.fp-who:hover { text-decoration: none; }
.fp-who > span:not(.avatar) { display: flex; flex-direction: column; min-width: 0; }
.fp-who b { font-weight: 500; font-size: 16px; }
.fp-bio { color: var(--soft); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fp-btn { min-width: 120px; gap: 6px; }

/* Topbar: search, bell, LeetCode-style account menu */
.signed-in .guest-only { display: none; }
.bar-search { position: relative; display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: 8px; background: var(--layer); color: var(--muted); width: 190px; }
.bar-search:focus-within { background: var(--pane); box-shadow: 0 0 0 1px var(--border); }
.bar-search input { border: 0; background: none; outline: none; font: inherit; font-size: 14px; color: var(--text); width: 100%; min-width: 0; padding: 0; }
.bar-search input::-webkit-search-cancel-button { display: none; }
.search-pop { top: 38px; right: 0; width: 360px; max-height: 420px; overflow: auto; }
.search-pop a { gap: 10px; }
.search-pop a.sel { background: var(--hover); }
.sr-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-meta { font-size: 12px; color: var(--muted); flex: none; }
.sr-meta.d-easy { color: var(--easy); } .sr-meta.d-medium { color: var(--medium); } .sr-meta.d-hard { color: var(--hard); }
.bell { position: relative; }
.bell .dot { position: absolute; top: 5px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: #ff375f; }
.notif-menu { right: 0; top: 38px; width: 340px; max-height: 440px; overflow: auto; }
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px 8px; }
.notif-menu a.notif { flex-direction: column; align-items: flex-start; gap: 2px; font-size: 13px; line-height: 1.4; }
.notif-menu a.notif.unread { background: var(--layer); }
.user-menu { right: 0; width: 300px; padding: 10px; }
.user-menu .menu-head { gap: 14px; padding: 8px 8px 12px; }
.user-menu .menu-head b { font-size: 17px; }
.menu-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 8px; }
.menu .menu-tiles a { flex-direction: column; justify-content: center; gap: 6px; padding: 14px 4px; background: var(--layer); border-radius: 10px; font-size: 13px; color: var(--soft); }
.menu .menu-tiles a svg { width: 24px; height: 24px; color: var(--text); }
.user-menu > a, .user-menu > button { color: var(--soft); padding: 9px 10px; justify-content: flex-start; }
#appearance-val { margin-left: auto; }
@media (max-width: 760px) { .bar-search { width: 36px; padding: 0 9px; } .bar-search input { width: 0; } .bar-search:focus-within { width: 170px; } .bar-search:focus-within input { width: 100%; } .search-pop, .notif-menu { position: fixed; left: 8px; right: 8px; width: auto; top: 52px; } }

/* Solved + Badges row: shorter, like LeetCode */
.pf-solved { padding: 10px 18px 10px 8px; }
.pf-solved .gauge { width: min(168px, 48%) !important; }
.pf-solved .gauge svg { stroke-width: 3.6; }
.pf-solved .dstat { width: 120px; gap: 6px; }
.pf-solved .dstat div { padding: 5px 8px; font-size: 12px; border-radius: 7px; line-height: 1.35; }
.pf-solved .dstat b { font-size: 14px; }
.pf-badges { padding-top: 14px; padding-bottom: 14px; }
.pf-badges .badge-row svg { width: 58px; height: 64px; }
.pf-badges .pf-recent { margin-top: 2px; }
.pf-badges .pf-recent-name { font-size: 16px; }

/* Logo: radical sign over a QED square */
.brand .logo { width: 24px; height: 24px; color: var(--text); flex: none; }
.brand b { color: var(--brand); }
/* Topbar never overlaps: right side keeps its size, nav scrolls if it must */
.bar-right { flex: 0 0 auto; }
.bar-left .nav { min-width: 0; overflow-x: auto; scrollbar-width: none; }
.bar-left .nav::-webkit-scrollbar { display: none; }
@media (max-width: 860px) { .bar-user [data-auth="signup"], .bar-user > .muted { display: none; } }

/* Rule filter panel (LeetCode style) */
.filter-pop { width: 560px; max-width: calc(100vw - 24px); padding: 14px; }
.fp-box { background: var(--layer); border-radius: 10px; padding: 12px 14px 8px; max-height: 420px; overflow: auto; }
.fp-match { display: flex; align-items: center; gap: 10px; font-weight: 500; margin-bottom: 10px; }
.fp-match select { width: 90px; }
.fr { display: grid; grid-template-columns: 112px 92px minmax(0, 1fr) 28px; align-items: center; gap: 8px; padding: 5px 0; }
.fr-name { display: flex; align-items: center; gap: 8px; color: var(--soft); }
.fr.active .fr-name { color: var(--brand); }
.fr select.input, .fr input.input { height: 34px; padding: 0 10px; background-color: var(--pane); }
.fr-op:disabled { opacity: 1; color: var(--text); }
.fr-select { display: flex; align-items: center; gap: 6px; width: 100%; min-height: 34px; padding: 4px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--pane); color: var(--muted); cursor: pointer; font: inherit; text-align: left; }
.fr-select.open { border-color: var(--accent); }
.fr-chips { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; min-width: 0; }
.fr-chip { display: inline-flex; align-items: center; gap: 2px; padding: 1px 4px 1px 8px; border-radius: 6px; background: var(--layer); color: var(--text); font-size: 12px; }
.fr-chip i { display: inline-flex; cursor: pointer; color: var(--muted); }
.fr-chip i:hover { color: var(--text); }
.fr-list { position: absolute; z-index: 5; top: calc(100% + 4px); left: 0; right: 0; max-height: 220px; overflow: auto; background: var(--pane); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--pop-shadow); padding: 4px; }
.fr-list button { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 6px 8px; border: 0; background: none; border-radius: 6px; font: inherit; font-size: 13px; color: var(--text); cursor: pointer; text-align: left; }
.fr-list button:hover { background: var(--hover); }
.fr-list button.on { font-weight: 600; }
.fr-range { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 6px; }
.fr-del { color: var(--muted); font-weight: 700; }
.fp-add { margin-top: 4px; }
.fp-add-menu { position: static; display: flex; flex-wrap: wrap; gap: 4px; width: auto; min-width: 0; margin-top: 6px; padding: 4px; box-shadow: none; }
.fp-add-menu button { width: auto; }
.fp-reset { width: 100%; margin-top: 12px; justify-content: center; gap: 8px; height: 38px; }
@media (max-width: 560px) { .fr { grid-template-columns: 1fr 80px; } .fr .fr-val, .fr .fr-range { grid-column: 1 / 2; } .filter-pop { position: fixed; left: 12px; right: 12px; top: 120px; width: auto; } }
/* the panel lives inside .menu: beat the generic .menu button rules */
.filter-pop .fr-select { display: flex; justify-content: flex-start; width: 100%; padding: 4px 8px; border: 1px solid var(--border); background: var(--pane); color: var(--muted); }
.filter-pop .fr-select:hover { background: var(--pane); border-color: var(--muted); }
.filter-pop .fr-list button { justify-content: space-between; padding: 6px 8px; }
.filter-pop .fr select.input { border: 1px solid var(--border); }
.filter-pop .fr-del, .filter-pop .fp-add > .ibtn { width: 28px; padding: 0; justify-content: center; color: var(--muted); }
.filter-pop .fp-add-menu button { width: auto; padding: 5px 10px; background: var(--pane); border-radius: 8px; }
.filter-pop .fp-reset { justify-content: center; background: var(--layer); font-weight: 500; }
.filter-pop .fp-reset:hover { background: var(--hover); }

/* Shared submission page */
.shared-sub .card { margin-top: 10px; padding: 22px 24px; }
.shared-by { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.shared-by a { display: inline-flex; align-items: center; gap: 6px; color: var(--text); }

/* Photo → Markdown transcription */
.ocr-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 12px; font-size: 12.5px; background: var(--layer); border-bottom: 1px solid var(--border); }
.ocr-bar .spinner { width: 12px; height: 12px; }
textarea.editor.drop { outline: 2px dashed var(--accent); outline-offset: -6px; }

/* Transcribe playground */
.tr-page { max-width: 1280px; }
.tr-controls { display: flex; flex-direction: column; gap: 12px; padding: 16px 18px; margin: 12px 0; }
.tr-drop { display: flex; align-items: center; gap: 14px; padding: 18px 20px; border: 2px dashed var(--border); border-radius: 12px; color: var(--soft); cursor: pointer; }
.tr-drop svg { width: 28px; height: 28px; flex: none; }
.tr-drop.over, .tr-drop:focus-visible { border-color: var(--accent); background: var(--layer); outline: none; }
.tr-opts { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.tr-opts label { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.tr-opts select { height: 32px; padding: 0 8px; }
.tr-files { display: flex; flex-wrap: wrap; gap: 6px; }
.tr-files:empty { display: none; }
.tr-split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.tr-pane { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; min-height: 360px; }
.tr-editor { flex: 1; min-height: 300px; width: 100%; resize: vertical; }
.tr-preview { flex: 1; overflow: auto; }
@media (max-width: 900px) { .tr-split { grid-template-columns: 1fr; } }

/* Selects of any height: arrow centered, text never under it */
select.input { background-position: calc(100% - 15px) calc(50% - 1px), calc(100% - 10px) calc(50% - 1px); }
.tr-opts select.input, .fr select.input, .fp-match select.input { padding-right: 30px; }

/* Spinner must be a box even inside text; Transcribe controls */
.spinner { display: inline-block; flex: none; vertical-align: -3px; }
.tr-opts { align-items: flex-end; gap: 16px; }
.tr-opts label { flex-direction: column; align-items: flex-start; gap: 4px; font-size: 12px; font-weight: 500; color: var(--muted); }
.tr-opts select.input { min-width: 170px; height: 36px; font-size: 14px; color: var(--text); }
.tr-opts #tr-effort { min-width: 110px; }
.tr-controls .btn.primary { min-width: 150px; height: 36px; justify-content: center; font-weight: 600; }
.tr-controls .btn.primary:disabled { opacity: .55; cursor: default; }
.tr-controls .btn.primary .spinner { width: 13px; height: 13px; border-color: rgba(255,255,255,.4); border-top-color: #fff; margin-right: 2px; }

/* PDF export: only #print-root is printed, always on white */
#print-root { display: none; }
@media print {
  @page { margin: 18mm 16mm; }
  body.printing { background: #fff !important; color: #111 !important; font-size: 11.5pt; }
  body.printing > *:not(#print-root) { display: none !important; }
  body.printing #print-root { display: block !important; --text: #111; --muted: #555; --code-bg: #f3f3f4; --border: #ccc; color: #111; }
  #print-root h1 { font-size: 17pt; margin: 0 0 2pt; }
  #print-root .pr-sub { margin: 0 0 10pt; color: #555; font-size: 10pt; }
  #print-root header { border-bottom: 1px solid #ccc; margin-bottom: 12pt; padding-bottom: 6pt; }
  #print-root .md { line-height: 1.55; }
  #print-root .katex-display { break-inside: avoid; }
  #print-root pre, #print-root table, #print-root blockquote { break-inside: avoid; }
  #print-root a { color: #111; text-decoration: underline; }
}

@media print {
  #print-root { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  #print-root mark.unclear { color: #c00; background: #ffe3e3; font-weight: 700; padding: 0 2px; border-radius: 2px; }
  #print-root .unclear-math, #print-root .unclear-math * { color: #c00 !important; }
  #print-root .unclear-math { background: #ffe3e3; border-radius: 2px; }
  #print-root .pr-warn { margin: 6pt 0 0; color: #c00; font-size: 10pt; font-weight: 600; }
}
/* Initial avatars stay a centered circle wherever they are placed */
span.avatar { display: inline-grid !important; place-items: center; line-height: 1; text-align: center; }

/* Geometry figures */
.geo-fig { position: relative; margin: 14px 0; text-align: center; }
.geo-box { display: inline-block; width: 100%; }
.geo-svg { display: block; width: 100%; height: auto; margin: 0 auto; overflow: visible; touch-action: none; }
.geo-svg .g-line { fill: none; stroke: var(--text); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.geo-svg .g-mark { fill: none; stroke: var(--soft); stroke-width: 1.2; }
.geo-svg .g-dash { stroke-dasharray: 5 4; }
.geo-svg polygon.g-fill, .geo-svg circle.g-fill { fill: rgba(0, 122, 255, .08); }
.geo-svg .g-red { stroke: #d6334b; } .geo-svg .g-blue { stroke: #2f6fd6; } .geo-svg .g-green { stroke: #1a9d4b; } .geo-svg .g-orange { stroke: #e8890c; } .geo-svg .g-gray { stroke: #8a8a8e; }
.geo-svg .g-pt { fill: var(--text); }
.geo-svg .g-label { font: italic 16px "Latin Modern Roman", "STIX Two Text", Georgia, "Times New Roman", serif; fill: var(--text); user-select: none; }
.geo-svg .g-txt { font: 13px "Latin Modern Roman", "STIX Two Text", Georgia, "Times New Roman", serif; fill: var(--soft); user-select: none; }
.geo-svg .g-hit { fill: transparent; cursor: grab; }
.geo-svg .g-hit:hover { fill: rgba(0, 122, 255, .14); }
.geo-svg .g-hit:active { cursor: grabbing; }
.geo-reset { position: absolute; right: 0; top: -4px; border: 0; background: var(--layer); color: var(--soft); border-radius: 6px; padding: 2px 8px; font: inherit; font-size: 12px; cursor: pointer; }
.geo-reset:hover { color: var(--text); background: var(--hover); }
.geo-err { padding: 8px 12px; border-radius: 8px; background: rgba(255, 55, 95, .08); color: var(--bad); font-size: 13px; text-align: left; white-space: pre-wrap; }
@media print { #print-root .geo-reset, #print-root .g-hit { display: none !important; } #print-root .geo-fig { break-inside: avoid; } #print-root .geo-svg .g-line { stroke: #111; } #print-root .geo-svg .g-red { stroke: #c00; } #print-root .geo-svg .g-blue { stroke: #2f6fd6; } #print-root .geo-svg .g-green { stroke: #1a9d4b; } #print-root .geo-svg .g-orange { stroke: #e8890c; } #print-root .geo-svg .g-gray { stroke: #888; } }

/* Rating chart hover (header swaps to the hovered attempt) */
.rchart { cursor: crosshair; touch-action: none; }
.rc-arrow { vertical-align: -3px; color: var(--muted); } .rc-arrow.up { color: var(--ok); } .rc-arrow.down { color: var(--bad); }
.rc-ev { max-width: 260px; min-width: 0; }
.rc-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 15px; }
.pf-rating-top .s-ok { color: var(--ok); } .pf-rating-top .s-bad { color: var(--bad); }

/* Rating header never reflows on hover */
.pf-rating-top.rc-top { flex-wrap: nowrap; }
.pf-rating-top.rc-top > div { flex: none; }
.pf-rating-top.rc-top > .rc-ev { flex: 1 1 0; min-width: 0; max-width: none; }
.rc-title { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 16px; font-weight: 600; }

/* Filter panel: no inner scroll area, so the value lists can float over it */
.fp-box { max-height: none; overflow: visible; }
.fr-list { scrollbar-width: thin; z-index: 20; }
.fr-list::-webkit-scrollbar { width: 8px; } .fr-list::-webkit-scrollbar-thumb { background: var(--fill); border-radius: 8px; }

.rc-pt { fill: var(--brand); }
.rc-title { font-size: 17px; font-weight: 600; }

/* see markScrolling() in app.js */
.is-scrolling .rchart, .is-scrolling .hm-wrap { pointer-events: none; }

/* ---------- code practice (WebGPU kernels) ---------- */
.code-hero p { color: var(--soft); max-width: 70ch; }
.code-warn { padding: 10px 14px; border-radius: 8px; background: color-mix(in srgb, var(--medium) 14%, transparent); color: var(--text); }
.code-work { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 16px; max-width: 1680px; margin: 0 auto; padding: 16px; align-items: start; }
.code-left { background: var(--pane); border-radius: 10px; padding: 16px 20px 20px; box-shadow: var(--shadow); min-width: 0; }
.code-left h1 { font-size: 20px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 4px 0 12px; }
.code-right { position: sticky; top: 64px; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.code-bar { display: flex; align-items: center; gap: 8px; background: var(--pane); border-radius: 10px 10px 0 0; padding: 8px 12px; box-shadow: var(--shadow); }
.code-bar .spacer { flex: 1; }
.code-editor { display: flex; background: var(--pane); border-radius: 0 0 10px 10px; box-shadow: var(--shadow); margin-top: -10px; height: min(62vh, 640px); overflow: hidden; }
.code-editor .gutter { margin: 0; padding: 12px 8px 12px 12px; text-align: right; color: var(--muted); font: 13px/1.55 "JetBrains Mono", ui-monospace, monospace; overflow: hidden; user-select: none; min-width: 3ch; box-sizing: content-box; border-right: 1px solid var(--border); }
.code-editor textarea { flex: 1; min-width: 0; resize: none; border: 0; outline: none; padding: 12px; background: transparent; color: var(--text); font: 13px/1.55 "JetBrains Mono", ui-monospace, monospace; tab-size: 2; white-space: pre; overflow: auto; }
.code-out { background: var(--pane); border-radius: 10px; padding: 12px 14px; box-shadow: var(--shadow); max-height: 40vh; overflow: auto; }
.code-res { padding: 8px 10px; border-radius: 8px; }
.code-res.good { background: color-mix(in srgb, var(--green-btn) 14%, transparent); color: var(--text); }
.code-res.bad { background: color-mix(in srgb, var(--bad) 12%, transparent); color: var(--text); }
.code-res pre { margin: 6px 0 0; white-space: pre-wrap; font: 12.5px/1.5 "JetBrains Mono", ui-monospace, monospace; }
.code-tests { list-style: none; margin: 8px 0 0; padding: 0; }
.code-tests li { display: flex; flex-wrap: wrap; gap: 4px 10px; padding: 5px 2px; border-top: 1px solid var(--border); font-size: 13px; }
.code-tests .mark { width: 1.2em; font-weight: 700; }
.code-tests li.ok .mark { color: var(--green-btn); }
.code-tests li.bad .mark { color: var(--bad); }
.code-tests .perf { margin-left: auto; }
.code-tests .tdetail { flex-basis: 100%; padding-left: 1.6em; color: var(--soft); font: 12px/1.5 "JetBrains Mono", ui-monospace, monospace; }
.solved-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--green-btn); }
.code-nav { display: flex; justify-content: space-between; gap: 8px; margin-top: 18px; }
.code-practice { margin-top: 24px; }
.chip-row.wrap { flex-wrap: wrap; overflow: visible; }
.code-left pre { overflow-x: auto; }
@media (max-width: 960px) {
  .code-work { grid-template-columns: minmax(0, 1fr); }
  .code-right { position: static; }
  .code-editor { height: 56vh; }
}

.cuda-map { width: 100%; border-collapse: collapse; margin-top: 8px; }
.cuda-map th, .cuda-map td { text-align: left; padding: 6px 8px; border-top: 1px solid var(--border); vertical-align: top; }
.cuda-map code { font-size: 12px; }
.code-page summary { cursor: pointer; }

.path h2 { margin: 0 0 4px; }
.path .bar { margin: 8px 0 12px; }
.path-steps { list-style: none; margin: 0; padding: 0; counter-reset: ps; }
.path-steps li { counter-increment: ps; }
.path-steps a { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 2px 10px; padding: 8px 4px; border-top: 1px solid var(--border); color: var(--text); align-items: baseline; }
.path-steps a:hover { background: var(--hover); text-decoration: none; }
.path-steps .ps-dot { grid-row: 1 / 3; width: 22px; height: 22px; border-radius: 50%; background: var(--cc); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.path-steps .ps-dot::before { content: counter(ps); }

.lang-tabs { display: inline-flex; background: var(--fill); border-radius: 8px; padding: 2px; }
.lang-tab { border: 0; background: transparent; color: var(--soft); font: inherit; font-size: 13px; font-weight: 600; padding: 4px 12px; border-radius: 6px; cursor: pointer; }
.lang-tab.on { background: var(--pane); color: var(--text); box-shadow: var(--shadow); }
.code-note { margin: 0 0 6px; padding: 8px 12px; border-radius: 8px; background: var(--layer); }
.code-res pre { max-height: 40vh; overflow: auto; }
.mnb { white-space: nowrap; }
