/* PRACTICE — the problem bank front page (LeetCode-style table + study plans + sidebar)
   and the solve page (two columns, bottom action bar, step-by-step parts).
   Loaded after theme.css; uses only token variables. */

/* =============================================================== shared bits */
.dtext { font-family: var(--font-sans); font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; }
.dtext--easy { color: var(--easy); }
.dtext--medium { color: var(--medium); }
.dtext--hard { color: var(--hard); }
.side-card { display: block; background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-4); margin-bottom: var(--space-4); color: var(--text); }
a.side-card:hover { text-decoration: none; border-color: var(--accent); }
.side-card__h { font-family: var(--font-sans); font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-faint); margin: 0 0 var(--space-3); display: flex; align-items: center; gap: 8px; }
.side-card__count { margin-left: auto; font-family: var(--font-mono); font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--text-faint); }
.side-card__note { font-size: var(--fs-xs); color: var(--text-faint); margin: var(--space-3) 0 0; }

/* =============================================================== bank */
.pl { padding-top: var(--space-6); padding-bottom: var(--space-7); max-width: 1240px; }
.pl-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-5); }
.pl-head__title { font-size: var(--fs-3xl); margin: 0 0 var(--space-1); }
.pl-head__sub { margin: 0; color: var(--text-muted); font-family: var(--font-prose); font-style: italic; font-size: 1.05rem; }
.pl-search { max-width: 380px; }
.pl-search .search__input { padding-right: 38px; }
.pl-search__kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: 0.72rem; padding: 1px 6px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); color: var(--text-faint); background: var(--bg); }
.pl-h2 { font-size: var(--fs-xl); margin: 0; }

/* study plans: a horizontal shelf of cards */
.pl-plans { margin-bottom: var(--space-5); }
.pl-plans__head { display: flex; align-items: baseline; gap: var(--space-3); margin-bottom: var(--space-3); }
.pl-plans__sub { font-family: var(--font-prose); font-style: italic; color: var(--text-faint); }
.pl-plans__row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: var(--space-3); overflow-x: auto; padding: 2px 2px 10px; scroll-snap-type: x proximity; scrollbar-width: thin; }
.plan { scroll-snap-align: start; display: flex; flex-direction: column; gap: 6px; text-align: left; font: inherit; color: var(--text); background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 16px 12px; cursor: pointer; position: relative; transition: border-color .15s, transform .15s, box-shadow .15s; min-height: 132px; }
.plan::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); opacity: .85; }
.plan:hover { border-color: var(--border-strong); transform: translateY(-2px); box-shadow: var(--shadow); }
.plan.is-on { border-color: var(--accent); background: color-mix(in srgb, var(--bg-elev) 80%, var(--accent-soft)); box-shadow: inset 0 0 0 1px var(--accent); }
.plan__title { font-family: var(--font-display); font-size: 1.12rem; font-weight: 500; line-height: 1.25; }
.plan__blurb { font-size: var(--fs-xs); color: var(--text-muted); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.plan__foot { margin-top: auto; display: flex; align-items: center; gap: 10px; }
.plan__bar { flex: 1; height: 5px; border-radius: 3px; background: var(--bg-sunken); overflow: hidden; }
.plan__bar span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.plan__n { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-faint); }

.pl-grid { display: grid; gap: var(--space-5); align-items: start; }

.pl-main { min-width: 0; scroll-margin-top: calc(var(--nav-h) + 12px); }

/* topic tabs */
.pl-topics { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 10px; margin-bottom: var(--space-2); scrollbar-width: thin; -webkit-mask-image: linear-gradient(90deg, #000 92%, transparent); mask-image: linear-gradient(90deg, #000 92%, transparent); }
.topic { flex: none; display: inline-flex; align-items: center; gap: 7px; font: inherit; font-size: var(--fs-sm); font-weight: 500; color: var(--text-muted); background: transparent; border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 6px 14px; cursor: pointer; white-space: nowrap; transition: background .15s, color .15s, border-color .15s; }
.topic:hover { color: var(--text); border-color: var(--border-strong); background: var(--bg-elev); }
.topic.is-on { background: var(--text); border-color: var(--text); color: var(--bg); }
.topic__n { font-family: var(--font-mono); font-size: 0.72rem; opacity: .7; }

/* toolbar: pill selects + toggles */
.pl-tools { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); margin-bottom: var(--space-3); }
.pl-tools__filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pl-tools__right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.pl-sel { position: relative; display: inline-flex; }
.pl-sel[hidden] { display: none; }
.pl-sel select { appearance: none; -webkit-appearance: none; width: auto; min-width: 0; font: inherit; font-size: var(--fs-sm); font-weight: 500; color: var(--text); background: var(--bg-elev); border: 1px solid var(--border-strong); border-radius: var(--radius-pill); padding: 6px 30px 6px 14px; cursor: pointer; max-width: 190px; text-overflow: ellipsis; }
.pl-sel::after { content: ""; position: absolute; right: 13px; top: 50%; width: 6px; height: 6px; border-right: 1.5px solid var(--text-muted); border-bottom: 1.5px solid var(--text-muted); transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.pl-sel select:hover { border-color: var(--text-faint); }
.pl-sel select:focus-visible { outline: none; box-shadow: var(--focus); }
.pl-sel.is-set select { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.pl-sel.is-set::after { border-color: var(--accent); }
.pl-sel--plain select { border-color: transparent; background: transparent; color: var(--text-muted); }
.pl-sel--plain select:hover { border-color: var(--border); }
.pl-toggle { font: inherit; font-size: var(--fs-sm); font-weight: 500; color: var(--text-muted); background: transparent; border: 1px dashed var(--border-strong); border-radius: var(--radius-pill); padding: 6px 14px; cursor: pointer; }
.pl-toggle:hover { color: var(--text); border-style: solid; }
.pl-toggle.is-on { border: 1px solid var(--accent); color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.pl-toggle.is-on::before { content: "\2713\00a0"; }
.pl-pick { display: inline-flex; align-items: center; gap: 7px; font: inherit; font-size: var(--fs-sm); font-weight: 600; color: var(--accent); background: transparent; border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); border-radius: var(--radius-pill); padding: 6px 14px; cursor: pointer; }
.pl-pick svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.pl-pick svg circle { fill: currentColor; stroke: none; }
.pl-pick:hover { background: var(--accent); color: var(--accent-contrast); }
.active-filters { align-items: center; }
.active-filters__n { font-family: var(--font-prose); font-style: italic; color: var(--text-muted); margin-right: 4px; }

/* the table */
.pl-tablewrap { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-elev); overflow: hidden; }
.pl-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.pl-table thead th { background: var(--bg-elev); font-family: var(--font-sans); font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-faint); text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--border-strong); }
.pl-table td { padding: 0 12px; height: 46px; vertical-align: middle; font-size: var(--fs-sm); border: 0; }
.pl-table tbody tr.prow { display: table-row; padding: 0; border: 0; }
.pl-table tbody tr.prow:nth-child(even) { background: color-mix(in srgb, var(--bg-sunken) 55%, var(--bg-elev)); }
.pl-table tbody tr.prow:hover { background: var(--accent-soft); }
.pl-table .c-st { width: 44px; padding-right: 0; text-align: center; }
.pl-table .c-st .st { vertical-align: middle; }
.pl-table .c-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-table .prow__title { display: inline; font-family: var(--font-prose); font-size: 1.02rem; color: var(--text); white-space: nowrap; }
.pl-table .prow__title:hover { color: var(--accent); text-decoration: none; }
.pl-table .prow__id { font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-faint); margin-right: 8px; font-variant-numeric: tabular-nums; }
.pl-table .prow__kind { margin-left: 8px; }
.pl-table .c-topic { width: 170px; color: var(--text-muted); font-size: 0.86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-table .c-co { width: 210px; }
.pl-cos { display: flex; align-items: center; gap: 5px; overflow: hidden; white-space: nowrap; }
.pl-cos .chip { display: inline-block; flex: 0 1 auto; min-width: 0; font-size: 0.72rem; padding: 1px 7px; max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
.pl-more { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-faint); cursor: help; }
.pl-table .c-diff { width: 96px; }
.pl-table .c-acc { width: 64px; text-align: right; }
.pl-empty td { text-align: center; padding: var(--space-6) var(--space-4); height: auto; }
@media (max-width: 980px) { .pl-table .c-topic { display: none; } }
@media (max-width: 760px) {
  .pl-table .c-co, .pl-table .c-acc { display: none; }
  .pl-table .c-diff { width: 78px; }
  .pl-table td { height: 52px; }
  .pl-table .c-title { white-space: normal; }
  .pl-table .prow__title { white-space: normal; line-height: 1.35; }
  .pl-tools__right { margin-left: 0; }
}

/* pager */
.pl-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px; margin-top: var(--space-4); }
.pg { min-width: 36px; height: 36px; padding: 0 10px; border-radius: var(--radius); border: 1px solid transparent; background: transparent; font: inherit; font-size: var(--fs-sm); color: var(--text-muted); cursor: pointer; font-variant-numeric: tabular-nums; }
.pg:hover:not([disabled]):not(.pg--gap) { border-color: var(--border-strong); color: var(--text); }
.pg.is-on { background: var(--text); color: var(--bg); font-weight: 600; }
.pg[disabled] { opacity: .35; cursor: default; }
.pg--gap { cursor: default; display: inline-flex; align-items: center; justify-content: center; }
.pg--arrow { font-size: 1.2rem; line-height: 1; }
.pg__info { margin-left: var(--space-3); font-size: var(--fs-xs); color: var(--text-faint); }

/* bank sidebar */
.pl-side { min-width: 0; }
@media (min-width: 1080px) { .pl-side { position: sticky; top: calc(var(--nav-h) + 16px); } }
@media (max-width: 1079px) { .pl-side { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--space-3); } .pl-side .side-card { margin: 0; } }
.prog__body { display: flex; align-items: center; gap: var(--space-4); }
.prog__ring { position: relative; width: 96px; height: 96px; flex: none; }
.ring { width: 96px; height: 96px; transform: rotate(-90deg); }
.ring__bg { fill: none; stroke: var(--bg-sunken); stroke-width: 7; }
.ring__fg.is-zero { display: none; }
.ring__fg { fill: none; stroke: var(--accent); stroke-width: 7; stroke-linecap: round; transition: stroke-dasharray .6s ease; }
.prog__num { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.05; }
.prog__num strong { font-family: var(--font-display); font-size: 1.6rem; font-weight: 500; }
.prog__num span { font-size: 0.7rem; color: var(--text-faint); font-family: var(--font-mono); }
.prog__num em { font-style: normal; font-size: 0.7rem; color: var(--text-muted); }
.prog__rows { list-style: none; margin: 0; padding: 0; flex: 1; display: grid; gap: 8px; }
.prog__row { display: grid; grid-template-columns: 58px 1fr auto; align-items: center; gap: 8px; font-size: var(--fs-xs); font-weight: 600; }
.prog__row--easy { color: var(--easy); } .prog__row--medium { color: var(--medium); } .prog__row--hard { color: var(--hard); }
.prog__bar { height: 5px; border-radius: 3px; background: var(--bg-sunken); overflow: hidden; }
.prog__bar span { display: block; height: 100%; background: currentColor; border-radius: 3px; }
.prog__v { font-family: var(--font-mono); color: var(--text); font-weight: 500; }
.prog__v span { color: var(--text-faint); }
.pod { position: relative; overflow: hidden; background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%); border-color: transparent; color: var(--accent-contrast); }
a.pod:hover { border-color: transparent; box-shadow: var(--shadow); }
.pod::after { content: ""; position: absolute; right: -30px; top: -30px; width: 120px; height: 120px; border-radius: 50%; border: 18px solid rgba(255, 255, 255, 0.07); }
.pod__eyebrow { display: block; font-size: var(--fs-xs); letter-spacing: 0.14em; text-transform: uppercase; font-weight: 700; opacity: .8; margin-bottom: 6px; }
.pod__title { display: block; font-family: var(--font-display); font-size: 1.18rem; line-height: 1.25; margin-bottom: var(--space-3); }
.pod__meta { display: flex; align-items: center; gap: 10px; font-size: var(--fs-xs); opacity: .92; }
.pod .dtext { color: #fff; font-size: var(--fs-xs); background: rgba(255, 255, 255, 0.16); padding: 1px 8px; border-radius: var(--radius-pill); }
.pod__go { margin-left: auto; font-weight: 700; font-size: var(--fs-sm); }
.cos__pills { display: flex; flex-wrap: wrap; gap: 6px; }

/* =============================================================== solve page */
body.has-sbar { padding-bottom: 84px; }
body.has-sbar .footer { margin-bottom: 0; }
.sp { padding-top: var(--space-4); padding-bottom: var(--space-7); max-width: 1180px; }
.sp .dnav { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: var(--space-3); margin-bottom: var(--space-5); }
.sp .dnav__pos { font-family: var(--font-sans); font-size: var(--fs-sm); color: var(--text-faint); }
.sp .dnav__pos strong { color: var(--text); font-weight: 600; }
.dnav__right { margin-left: auto; justify-self: end; display: flex; gap: 6px; }
.sp .iconbtn { font-size: 1.3rem; line-height: 1; color: var(--text-muted); }
.sp .iconbtn:hover { border-color: var(--text-faint); color: var(--text); text-decoration: none; }
.iconbtn.is-off { opacity: .35; cursor: default; }
.sp-grid { display: grid; gap: var(--space-6); align-items: start; }
@media (min-width: 1000px) { .sp-grid { grid-template-columns: minmax(0, 1fr) 300px; } }
.sp-main { min-width: 0; }
.sp-head { margin-bottom: var(--space-4); }
.sp-head__id { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-faint); display: flex; align-items: center; gap: 10px; margin-bottom: var(--space-2); }
.sp-head__id .st-label { font-family: var(--font-sans); font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; padding: 1px 8px; border-radius: var(--radius-pill); }
.st-label--solved { background: var(--ok-soft); color: var(--ok); }
.st-label--attempted { background: var(--warn-soft); color: var(--warn); }
.sp-head__title { font-size: clamp(1.8rem, 3.6vw, 2.4rem); font-weight: 500; line-height: 1.12; margin-bottom: var(--space-3); }
.sp-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: var(--fs-sm); color: var(--text-muted); }
.sp-meta > * + *::before { content: ""; display: inline-block; width: 3px; height: 3px; border-radius: 50%; background: var(--text-faint); margin-right: 14px; vertical-align: middle; }
.sp-meta__cat { color: var(--accent); font-weight: 600; }
.sp .statement { margin-bottom: var(--space-5); }

/* the answer card */
.sp .solve { margin-bottom: var(--space-5); }
.sp .solve__card { background: var(--bg-elev); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); padding: var(--space-5); }
.sp .solve__label { font-family: var(--font-sans); font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-faint); margin-bottom: var(--space-3); }
.stepper { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; margin-bottom: var(--space-3); }
.stepper__seg { height: 6px; border-radius: 3px; background: var(--bg-sunken); transition: background .3s; }
.stepper__seg.is-cur { background: color-mix(in srgb, var(--accent) 35%, var(--bg-sunken)); }
.stepper__seg.is-ok { background: var(--ok); }
.stepper__seg.is-done { background: var(--text-faint); }
.stepper__seg.is-shown { background: var(--warn); }
.sp .part { border-top: 0; padding: 0; margin: 0; }
.sp .solve__card--multi .part { border-top: 1px solid var(--border); padding-top: var(--space-4); margin-top: var(--space-4); }
.sp .solve__card--multi .part:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }
.part.is-future { display: none; }
.part.is-active { animation: partIn .28s ease both; }
@keyframes partIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.part__head { display: flex; align-items: baseline; gap: 10px; margin-bottom: var(--space-2); }
.part__n { font-family: var(--font-sans); font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); }
.part__title { font-family: var(--font-display); font-size: 1.1rem; }
.part__done { margin-left: auto; display: inline-flex; }
.part__done .ico-check { width: 20px; height: 20px; fill: none; stroke: var(--ok); stroke-width: 2.4; }
.part__shown { font-size: var(--fs-xs); color: var(--warn); font-weight: 600; }
.part__prompt { margin-bottom: var(--space-3); }
.solve__card--multi .part.is-past { opacity: .82; }
.part.is-past .part__prompt { font-size: 0.98rem; }
.part__answered { font-size: var(--fs-sm); }
.solve__card:not(.solve__card--multi) .part__answered { display: none; }
.part__your { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px; border-radius: var(--radius-pill); background: var(--ok-soft); color: var(--ok); font-weight: 600; }
.part__your::before { content: "\2713"; }
.part__your--shown { background: var(--warn-soft); color: var(--warn); }
.part__your--shown::before { content: "Answer:"; font-weight: 500; }

.sp .answer { display: flex; gap: var(--space-2); }
.sp .answer__input { flex: 1; width: 100%; max-width: 520px; font-size: 1.15rem; padding: 14px 16px; border: 1.5px solid var(--border-strong); border-radius: var(--radius-lg); background: var(--bg); font-family: var(--font-mono); letter-spacing: 0.01em; transition: border-color .15s, box-shadow .15s, background .2s; }
.sp .answer__input:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); background: var(--bg-elev); }
.sp .answer__input.is-right { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); }
.sp .answer__input.is-wrong { border-color: var(--bad); background: var(--bad-soft); }
.answer__help { margin-top: var(--space-2); font-size: var(--fs-xs); color: var(--text-faint); }
.answer__help p { display: inline; margin: 0; }
.answer__kbd { white-space: nowrap; margin-left: 6px; }
.answer__kbd kbd { font-size: 0.7rem; padding: 1px 5px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; background: var(--bg); color: var(--text-muted); }
.shake { animation: shake .36s ease; }
@keyframes shake { 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }

.sp .options { display: grid; gap: 10px; }
.sp .option { display: flex; align-items: flex-start; gap: 12px; padding: 13px 16px; border: 1.5px solid var(--border); border-radius: var(--radius-lg); background: var(--bg); cursor: pointer; transition: border-color .15s, background .15s, transform .1s; box-shadow: none; }
.sp .option:hover { border-color: var(--border-strong); background: var(--bg-elev); }
.sp .option:active { transform: scale(.995); }
.sp .option input { position: absolute; opacity: 0; pointer-events: none; }
.sp .option__key { flex: none; width: 28px; height: 28px; border-radius: var(--radius); border: 1.5px solid var(--border-strong); display: inline-flex; align-items: center; justify-content: center; font-family: var(--font-sans); font-style: normal; font-size: 0.85rem; font-weight: 700; color: var(--text-muted); text-transform: none; background: var(--bg-elev); }
.sp .option__key::before, .sp .option__key::after { content: none; }
.sp .option__text { font-size: 1.04rem; padding-top: 2px; }
.sp .option:has(input:checked) { border-color: var(--text); background: var(--bg-elev); box-shadow: none; }
.sp .option:has(input:checked) .option__key { background: var(--text); border-color: var(--text); color: var(--bg); }
.sp .option:has(input:focus-visible) { box-shadow: var(--focus); }
.sp .option.is-right, .sp .option.is-right:has(input:checked) { border-color: var(--ok); background: var(--ok-soft); box-shadow: none; }
.sp .option.is-right .option__key, .sp .option.is-right:has(input:checked) .option__key { background: var(--ok); border-color: var(--ok); color: #fff; }
.sp .option.is-wrong, .sp .option.is-wrong:has(input:checked) { border-color: var(--bad); background: var(--bad-soft); box-shadow: none; animation: shake .36s ease; }
.sp .option.is-wrong .option__key, .sp .option.is-wrong:has(input:checked) .option__key { background: var(--bad); border-color: var(--bad); color: #fff; }
.sp .option:has(input:disabled) { cursor: default; }
.option-why { margin-top: var(--space-3); padding: 10px 14px; border-radius: var(--radius); font-size: 0.98rem; border-left: 3px solid; }
.option-why.is-ok { background: var(--ok-soft); border-color: var(--ok); }
.option-why.is-bad { background: var(--bad-soft); border-color: var(--bad); }
.review__ta { width: 100%; min-height: 130px; font-size: 1rem; line-height: 1.55; border-radius: var(--radius-lg); }

/* worked solution appears at the end */
.sp-sol { border: 1px solid var(--border-strong); border-radius: var(--radius-lg); background: var(--bg-elev); margin-bottom: var(--space-5); overflow: hidden; scroll-margin-top: calc(var(--nav-h) + 16px); }
.sp-sol.is-in { animation: solIn .45s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes solIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.sp-sol__tabs { display: flex; gap: 2px; padding: 6px 6px 0; background: var(--bg-sunken); border-bottom: 1px solid var(--border); }
.sp-sol__tab { font: inherit; font-size: var(--fs-sm); font-weight: 600; color: var(--text-muted); background: transparent; border: 0; border-radius: var(--radius) var(--radius) 0 0; padding: 9px 18px; cursor: pointer; }
.sp-sol__tab.is-on { background: var(--bg-elev); color: var(--accent); box-shadow: inset 0 2px 0 var(--accent); }
.sp-sol__pane { padding: var(--space-5); }
.sp-sol__pane > h2:first-child, .sp-sol__pane > h3:first-child { margin-top: 0; }
.sp-sol__pane h2 { font-size: 1.2rem; color: var(--accent); border-bottom: 1px solid var(--border); padding-bottom: 4px; }


/* solve sidebar */
.sp-side .reports { border: 1px solid var(--border); border-left: 1px solid var(--border); padding: var(--space-4); margin-bottom: var(--space-4); background: var(--bg-elev); border-radius: var(--radius-lg); }
.sp-side .reports__cos { gap: 5px; }
.sp-side .rco { font-size: 0.74rem; padding: 2px 9px; }
.sp-side .tags { margin: 0; }
.hintlad { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; counter-reset: none; }
.hintlad__item { border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px; background: var(--bg); }
.hintlad__n { font-size: var(--fs-sm); font-weight: 600; color: var(--text-muted); }
.hintlad__btn { font: inherit; font-size: var(--fs-xs); font-weight: 600; color: var(--accent); background: var(--bg-elev); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); border-radius: var(--radius-pill); padding: 3px 12px; cursor: pointer; }
.hintlad__btn:hover:not([disabled]) { background: var(--accent); color: #fff; }
.hintlad__btn[disabled] { opacity: .4; cursor: default; }
.hintlad__body { grid-column: 1 / -1; font-size: 0.95rem; line-height: 1.55; }
.hintlad__item.is-open { background: color-mix(in srgb, var(--bg-elev) 70%, var(--warn-soft)); border-color: color-mix(in srgb, var(--warn) 30%, var(--border)); animation: partIn .25s ease both; }
.notesbox summary { cursor: pointer; list-style: none; margin: 0; }
.notesbox summary::-webkit-details-marker { display: none; }
.notesbox summary::after { content: "+"; margin-left: 8px; font-size: 1rem; letter-spacing: 0; }
.notesbox[open] summary::after { content: "\2212"; }
.notesbox[open] summary { margin-bottom: var(--space-3); }
.notesbox .note { width: 100%; font-size: var(--fs-sm); }
.side-link { display: block; width: 100%; font: inherit; font-size: var(--fs-sm); color: var(--text-faint); background: none; border: 0; text-align: center; padding: 6px; cursor: pointer; text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
.side-link:hover { color: var(--accent); }

/* =============================================================== bottom action bar */
.sbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: color-mix(in srgb, var(--bg-elev) 94%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-top: 1px solid var(--border-strong); transition: background .25s, border-color .25s; }
.sbar__inner { max-width: 1180px; margin: 0 auto; padding: 12px var(--space-5); display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--space-4); min-height: 72px; }
.sbar__prev { color: var(--text-muted); font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; }
.sbar__prev:hover { color: var(--text); text-decoration: none; }
.sbar__msg { display: flex; align-items: center; gap: 12px; min-width: 0; }
.sbar__msg strong { display: block; font-family: var(--font-display); font-size: 1.25rem; font-weight: 600; line-height: 1.2; }
.sbar__sub { display: block; font-size: var(--fs-sm); color: var(--text-muted); line-height: 1.35; overflow: hidden; text-overflow: ellipsis; }
.sbar__ans { color: var(--text); font-family: var(--font-mono); font-size: 1rem; }
.sbar__tip { font-size: var(--fs-sm); color: var(--text-faint); }
.sbar__ico { flex: none; width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; animation: pop .35s cubic-bezier(.2, 1.4, .4, 1) both; }
.sbar__ico svg { width: 22px; height: 22px; fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.sbar__ico--ok { background: var(--ok); }
.sbar__ico--bad { background: var(--bad); }
.sbar__ico--shown { background: var(--warn); color: #fff; font-style: italic; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }
.sbar__actions { display: flex; align-items: center; gap: var(--space-2); }
.sbar__btn { min-width: 132px; padding: 12px 22px; font-size: 1rem; border-radius: var(--radius-lg); }
.sbar__btn.btn--primary { box-shadow: 0 3px 0 var(--accent-hover); transition: transform .08s, box-shadow .08s; }
.sbar__btn.btn--primary:active:not([disabled]) { transform: translateY(2px); box-shadow: 0 1px 0 var(--accent-hover); }
.sbar__btn.btn--ghost { min-width: 0; color: var(--text-muted); }
.sbar__btn.btn--secondary { min-width: 0; }
.sbar__btn[disabled] { border-style: solid !important; }
.sbar__skip { color: var(--text-muted); font-weight: 600; font-size: var(--fs-sm); padding: 8px 12px; }
.sbar__skip:hover { color: var(--text); text-decoration: none; }
.sbar.is-ok { background: var(--ok-soft); border-top-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.sbar.is-ok strong { color: var(--ok); }
.sbar.is-ok .btn--primary { background: var(--ok); border-color: var(--ok); box-shadow: 0 3px 0 color-mix(in srgb, var(--ok) 70%, #000); }
.sbar.is-bad { background: var(--bad-soft); border-top-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.sbar.is-bad strong { color: var(--bad); }
.sbar.is-shown { background: var(--warn-soft); border-top-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.sbar.is-done { background: color-mix(in srgb, var(--bg-elev) 80%, var(--ok-soft)); }
.sbar.is-done strong { color: var(--ok); }
.sbar .math-content p { display: inline; margin: 0; }
/* a small celebratory burst from the bar on a first-try solve */
.burst { position: fixed; z-index: 45; right: 16%; bottom: 42px; width: 0; height: 0; pointer-events: none; }
.burst i { position: absolute; width: 7px; height: 7px; border-radius: 2px; background: var(--accent); animation: burst .8s ease-out forwards; transform: rotate(var(--a)) translateY(0); }
.burst i:nth-child(3n) { background: var(--ok); } .burst i:nth-child(3n+1) { background: var(--warn); border-radius: 50%; }
@keyframes burst { to { transform: rotate(var(--a)) translateY(calc(-1 * var(--d))); opacity: 0; } }
@media (max-width: 640px) {
  .sbar__inner { grid-template-columns: 1fr auto; padding: 10px var(--space-4); gap: var(--space-3); }
  .sbar__prev { display: none; }
  .sbar__btn { min-width: 0; padding: 11px 16px; }
  .sbar__msg strong { font-size: 1.05rem; }
  .sbar__ico { width: 32px; height: 32px; }
  .sbar__skip { display: none; }
  .sp .dnav { grid-template-columns: 1fr auto; }
  .sp .dnav__pos { display: none; }
}
@media (prefers-reduced-motion: reduce) { .part.is-active, .sp-sol.is-in, .sbar__ico, .shake, .option.is-wrong, .burst { animation: none !important; } }
body.has-sbar .toast-host { bottom: 96px; }
.solve__card.is-finished .answer__kbd, .solve__card.is-finished .keys { display: none; }
.side-link[hidden] { display: none; }

/* ---- walkthrough parts: one open at a time, answered parts collapse to a clickable summary ---- */
.sp .part__head { all: unset; box-sizing: border-box; display: flex; align-items: baseline; gap: 10px; width: 100%; margin-bottom: var(--space-2); cursor: default; }
.sp .solve__card--multi .part.is-closed .part__head { cursor: pointer; padding: 10px 12px; margin: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); }
.sp .solve__card--multi .part.is-closed .part__head:hover { border-color: var(--border-strong); }
.sp .solve__card--multi .part.is-closed .part__content { display: none; }
.sp .solve__card--multi .part.is-closed { padding-top: var(--space-2); margin-top: var(--space-2); border-top: 0; opacity: 1; }
.part.is-future { display: none; }
.part.is-open { animation: partIn .28s ease both; }
.solve__card.is-finished .part.is-open { animation: none; }
.part__summary { margin-left: auto; font-size: var(--fs-sm); color: var(--text-muted); font-family: var(--font-mono); }
.part__mark { display: inline-flex; margin-left: auto; }
.part__summary:not(:empty) + .part__mark { margin-left: 8px; }
.pmark { width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; }
.pmark svg { width: 15px; height: 15px; fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; }
.pmark--ok { background: var(--ok); } .pmark--bad { background: var(--bad); }
.part__result { margin-top: var(--space-3); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.part__key { display: inline-flex; align-items: center; gap: 10px; padding: 6px 14px; border-radius: var(--radius-pill); background: var(--ok-soft); color: var(--ok); font-weight: 600; font-size: var(--fs-sm); }
.part__key .math-content { color: var(--text); font-family: var(--font-mono); font-weight: 500; }
.part__key .math-content p { display: inline; margin: 0; }
.part__skipped { font-size: var(--fs-xs); color: var(--text-faint); }
.stepper__seg.is-bad { background: var(--bad); }
.solve__card--multi.is-finished .part { opacity: 1; }
.sp .solve__card--multi .part.is-graded[data-kind="closed"] .part__body { display: block; }

/* ---- hints: inline, under the answer ---- */
.hintsbox { margin: 0 0 var(--space-5); border: 1px solid color-mix(in srgb, var(--warn) 28%, var(--border)); border-radius: var(--radius-lg); background: color-mix(in srgb, var(--bg-elev) 75%, var(--warn-soft)); padding: var(--space-4) var(--space-5); }
.hintsbox[hidden] { display: none; }
.hintsbox__head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: var(--space-2); }
.hintsbox__h { font-family: var(--font-sans); font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--warn); margin: 0; }
.hintsbox__n { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-faint); }
.sp .hintlad { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.sp .hintlad__item { display: grid; grid-template-columns: 64px 1fr; gap: 10px; align-items: baseline; border: 0; padding: 0; background: none; animation: partIn .25s ease both; }
.sp .hintlad__item[hidden] { display: none; }
.sp .hintlad__n { font-size: var(--fs-xs); font-weight: 700; color: var(--warn); text-transform: uppercase; letter-spacing: 0.08em; }
.sp .hintlad__body { font-size: 1rem; line-height: 1.6; grid-column: auto; }
.hintsbox__more { margin-top: var(--space-3); font: inherit; font-size: var(--fs-sm); font-weight: 600; color: var(--warn); background: none; border: 1px dashed color-mix(in srgb, var(--warn) 45%, transparent); border-radius: var(--radius-pill); padding: 4px 14px; cursor: pointer; }
.hintsbox__more[hidden] { display: none; }
.hintsbox__more:hover { border-style: solid; }

/* ---- after solving: level up, similar problems, up next ---- */
#sp-levelup { margin-bottom: var(--space-5); }
#sp-levelup[hidden] { display: none; }
.levelup { display: flex; align-items: center; gap: var(--space-3); padding: 14px 18px; border-radius: var(--radius-lg); border: 1.5px solid var(--accent); background: linear-gradient(90deg, var(--accent-soft), var(--bg-elev) 70%); color: var(--text); animation: solIn .45s cubic-bezier(.2, .8, .2, 1) both; }
.levelup:hover { text-decoration: none; box-shadow: var(--shadow); }
.levelup__ico { flex: none; width: 38px; height: 38px; border-radius: 50%; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 1.2rem; font-weight: 700; }
.levelup__txt { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.levelup__eb { font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
.levelup__title { font-family: var(--font-display); font-size: 1.15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.levelup__go { font-weight: 700; color: var(--accent); white-space: nowrap; }
.after { margin-bottom: var(--space-5); }
.after[hidden] { display: none; }
.after__h { font-family: var(--font-sans); font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-faint); margin: var(--space-4) 0 var(--space-2); }
.simlist { display: grid; gap: 8px; }
.sim, .upnext { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-elev); color: var(--text); transition: border-color .15s, transform .15s; }
.sim:hover, .upnext:hover { text-decoration: none; border-color: var(--accent); transform: translateX(2px); }
.sim__title, .upnext__title { font-family: var(--font-prose); font-size: 1.04rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sim__meta, .upnext__meta { display: flex; align-items: center; gap: 12px; flex: none; font-size: var(--fs-xs); color: var(--text-muted); }
.sim__meta .dtext, .upnext__meta .dtext { font-size: var(--fs-xs); }
.sim__done, .upnext__done { display: inline-flex; align-items: center; gap: 3px; color: var(--ok); font-weight: 600; }
.sim__done svg, .upnext__done svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2.4; }
.upnext { border-color: color-mix(in srgb, var(--accent) 30%, var(--border)); }
@media (max-width: 640px) { .sim, .upnext { flex-direction: column; align-items: flex-start; gap: 4px; } .sim__title, .upnext__title { white-space: normal; } }

/* ---- sound toggle ---- */
.iconbtn--sound .ico-sound { width: 18px; height: 18px; fill: none; stroke: var(--text-muted); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.iconbtn--sound[aria-pressed="false"] .ico-sound { stroke: var(--text-faint); }

/* ---- front page: company card scrolls within itself, with a search ---- */
.cos__q { width: 100%; margin-bottom: var(--space-3); padding: 7px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--bg); font: inherit; font-size: var(--fs-sm); color: var(--text); }
.cos__q:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
.cos__scroll { max-height: 250px; overflow-y: auto; padding: 2px 4px 2px 0; scrollbar-width: thin; -webkit-mask-image: linear-gradient(180deg, #000 88%, transparent); mask-image: linear-gradient(180deg, #000 88%, transparent); }
.cos__scroll.is-short { -webkit-mask-image: none; mask-image: none; }

/* ---- bank is one column: a summary row on top, companies as a horizontal strip ---- */
.pl-summary { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: var(--space-3); margin-bottom: var(--space-5); }
.pl-summary .side-card { margin: 0; }
.pl-summary .prog { display: flex; align-items: center; gap: var(--space-5); }
.pl-summary .prog .side-card__h { display: none; }
.pl-summary .prog__body { flex: 1; }
.pl-summary .prog .side-card__note { margin: 0; max-width: 170px; }
.pl-summary .prog__ring, .pl-summary .ring { width: 84px; height: 84px; }
.pl-summary .pod { display: flex; flex-direction: column; justify-content: center; }
.pl-summary .pod__title { margin-bottom: var(--space-2); }
@media (max-width: 760px) { .pl-summary { grid-template-columns: 1fr; } .pl-summary .prog { flex-direction: column; align-items: stretch; } .pl-summary .prog .side-card__note { max-width: none; } }
.pl-cosrow { display: flex; align-items: center; gap: 10px; margin: 0 0 var(--space-3); min-width: 0; }
.pl-cosrow:empty { display: none; }
.pl-cosrow__label { flex: none; font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-faint); }
.pl-cosrow__q { flex: none; width: 150px; padding: 5px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-pill); background: var(--bg-elev); font: inherit; font-size: var(--fs-sm); color: var(--text); }
.pl-cosrow__q:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
.pl-cosrow__list { flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: thin; padding-bottom: 6px; -webkit-mask-image: linear-gradient(90deg, #000 90%, transparent); mask-image: linear-gradient(90deg, #000 90%, transparent); }
.pl-cosrow__list .cos__pills { flex-wrap: nowrap; }
.pl-cosrow__list .cofacet { flex: none; }
@media (max-width: 640px) { .pl-cosrow { flex-wrap: wrap; } .pl-cosrow__list { flex-basis: 100%; } }

/* ---- coding page: two columns, ONE page scroll. The statement grows with its content;
   the editor column sticks under the nav at viewport height (--ide-h from coding-solve.js). ---- */
@media (min-width: 901px) {
  body.coding-ide { overflow: visible; }
  body.coding-ide .main { height: auto !important; overflow: visible; display: block; }
  body.coding-ide .cs-root { min-height: 0; }
  body.coding-ide .cs-split { grid-template-rows: auto; align-items: start; overflow: visible; }
  body.coding-ide .cs-pane { overflow: visible; }
  body.coding-ide .cs-pane--statement { height: auto; max-height: none; min-height: var(--ide-h, calc(100vh - 90px)); }
  body.coding-ide .cs-pane--statement .cs-tabs { position: sticky; top: calc(var(--nav-h) + 3px); z-index: 3; }
  body.coding-ide .cs-leftbody { overflow: visible; }
  body.coding-ide .cs-pane--editor { position: sticky; top: calc(var(--nav-h) + 11px); height: var(--ide-h, calc(100vh - 90px)); overflow: hidden; }
}
