/* ============================================================
   LEARNING — Page-specific styles
   Overrides and additions for the learning/lesson view.
   ============================================================ */

/* Override global tokens for learning page */
.app {
  --sidebar-w: 300px;
  --toc-w: 230px;
  --topbar-h: 56px;
}

/* Override global link style for learning page */
a { color: var(--accent-2); text-decoration: none }
a:hover { text-decoration: underline }

html { scroll-padding-top: calc(var(--topbar-h) + 24px) }

::selection {
  background: color-mix(in srgb, var(--accent) 28%, transparent);
}
*::-webkit-scrollbar { width: 9px; height: 9px }
*::-webkit-scrollbar-thumb {
  background: var(--surface-3);
  border-radius: 9px;
}

/* SHELL */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: calc(100vh - var(--topbar-h));
}
.sidebar {
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  z-index: 60;
}

/* Brand override for learning sidebar */
.brand {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line-soft);
}
.brand__mark {
  border-radius: var(--radius-sm);
  background: var(--accent);
}
.brand__name { font-weight: 800; letter-spacing: -.02em }
.brand__name span { color: var(--accent) }

/* Progress card */
.pcard {
  margin: 14px;
  padding: 16px 14px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.pcard__top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.pcard__name {
  font-weight: 700;
  font-size: var(--step--1);
  line-height: 1.3;
  color: var(--text);
}
.pcard__sub {
  display: block;
  font-weight: 500;
  color: var(--accent);
  font-size: 0.75rem;
  margin-top: 2px;
}

/* Override pbar for learning */
.pbar {
  height: 6px;
  border-radius: 99px;
  background: rgba(0, 0, 0, 0.06);
  overflow: hidden;
}
.pbar i {
  background: linear-gradient(90deg, var(--accent) 0%, #a855f7 100%);
  border-radius: 99px;
  transition: width .35s ease;
}

.pcard__stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
  text-align: center;
}
.pcard__stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.pcard__stat-val {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.pcard__stat-val b {
  color: var(--text);
  font-weight: 800;
}
.pcard__stat-lbl {
  font-size: 0.68rem;
  color: var(--muted);
  line-height: 1.2;
  margin-top: 2px;
  white-space: nowrap;
}

.sidebar__search {
  padding: 0 14px 14px;
}
.search {
  position: relative;
}
.search input {
  width: 100%;
  padding: 9px 12px 9px 34px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: var(--step--1);
  color: var(--text);
  transition: all 0.2s ease;
}
.search input::placeholder {
  color: var(--muted);
}
.search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
  outline: none;
}
.search svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

/* Outline */
.outline { list-style: none; margin: 0; padding: 0 10px 24px; flex: 1 }
.outline__group { margin-bottom: 4px }
.outline__step-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  margin: 12px 0 6px;
  background: linear-gradient(135deg,
    var(--accent) 0%, var(--accent-2) 100%);
  border-radius: var(--radius-sm);
  color: #fff;
  font-weight: 700;
  font-size: var(--step--1);
  list-style: none;
}
.outline__step-header:first-child { margin-top: 0; }
.outline__step-header small {
  font-weight: 400;
  opacity: .85;
  font-size: .72rem;
}
.outline__toggle {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  text-align: left;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-weight: 700;
  font-size: var(--step--1);
  line-height: 1.4;
}
.outline__toggle:hover { background: var(--surface-2) }
.outline__toggle small {
  display: block;
  font-weight: 400;
  color: var(--muted);
  font-size: .72rem;
}
.outline__toggle .chev {
  margin-left: auto;
  flex: none;
  margin-top: 3px;
  transition: transform .2s;
  color: var(--muted);
}
.outline__group[data-open="false"] .chev { transform: rotate(-90deg) }
.outline__group[data-open="false"] .outline__items { display: none }
.outline__items {
  list-style: none;
  margin: 2px 0 8px;
  padding: 0 0 0 10px;
  border-left: 1px solid var(--line-soft);
}
.outline__link {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  width: 100%;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: var(--step--1);
  line-height: 1.5;
  text-align: left;
}
.outline__link:hover {
  background: var(--surface-2);
  color: var(--text);
}
.outline__link[aria-current="page"] {
  background: var(--accent-tint);
  color: var(--accent-2);
  font-weight: 700;
}
.outline__link .tick {
  width: 15px;
  height: 15px;
  flex: none;
  margin-top: 4px;
  border: 1.5px solid var(--line);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 9px;
  color: transparent;
}
.outline__link.is-done .tick {
  background: var(--ok);
  border-color: var(--ok);
  color: #fff;
}
.outline__dur {
  margin-left: auto;
  font-size: .7rem;
  color: var(--muted);
  font-family: var(--font-mono);
  padding-top: 2px;
}

/* Topbar overrides for learning */
.topbar {
  height: var(--topbar-h);
  gap: 12px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
}
.topbar__crumbs {
  font-size: var(--step--1);
  color: var(--muted);
  display: flex;
  gap: 8px;
  min-width: 0;
}
.topbar__crumbs span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-btn {
  width: 34px;
  height: 34px;
}
.menu-btn { display: none }

.avatar { width: 30px; height: 30px }
.avatar--lg { width: 38px; height: 38px; font-size: .82rem }

.progressbar {
  position: absolute;
  left: 0;
  bottom: -1px;
  height: 2px;
  width: 0;
  background: var(--accent);
  transition: width .12s linear;
}

.main { min-width: 0; display: flex; flex-direction: column }
.content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--toc-w);
  gap: 40px;
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
  padding: 34px 28px 90px;
}
.article { min-width: 0 }

/* Table of Contents */
.toc {
  position: sticky;
  top: calc(var(--topbar-h) + 28px);
  align-self: start;
  height: max-content;
}
.toc__label {
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 10px;
}
.toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 1px solid var(--line);
}
.toc a {
  display: block;
  padding: 6px 12px;
  margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--muted);
  font-size: var(--step--1);
  line-height: 1.45;
}
.toc a:hover { color: var(--text); text-decoration: none }
.toc a.is-active {
  color: var(--accent-2);
  border-left-color: var(--accent);
  font-weight: 700;
}

/* ARTICLE */
.lesson-head { margin-bottom: 30px }
.eyebrow {
  display: inline-flex;
  gap: 8px;
  font-size: var(--step--1);
  font-weight: 700;
  color: var(--accent-2);
  letter-spacing: .06em;
  text-transform: uppercase;
}
.lesson-head h1 {
  font-size: clamp(2.1rem, 1.7rem + 2vw, 3rem);
  line-height: 1.12;
  letter-spacing: -.03em;
  margin: 12px 0 14px;
  font-weight: 800;
}
.lede {
  color: var(--text-2);
  font-size: var(--step-1);
  line-height: 1.62;
  margin: 0;
}
.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
  align-items: center;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text-2);
  font-size: var(--step--1);
}
.chip--star { color: var(--star); font-weight: 700 }

.article h2 {
  font-size: clamp(1.7rem, 1.5rem + 1vw, 2.2rem);
  line-height: 1.22;
  letter-spacing: -.02em;
  margin: 52px 0 14px;
  font-weight: 800;
  scroll-margin-top: 88px;
}
.article h3 {
  font-size: clamp(1.35rem, 1.25rem + .5vw, 1.6rem);
  line-height: 1.3;
  margin: 34px 0 10px;
  font-weight: 700;
  scroll-margin-top: 88px;
}
.article p { margin: 0 0 16px; color: var(--text-2) }
.article strong { color: var(--text); font-weight: 700 }
.article ul,
.article ol { margin: 0 0 18px; padding-left: 22px; color: var(--text-2) }
.article li { margin-bottom: 7px }
.article li::marker { color: var(--accent) }
.part-label {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--accent-2);
  letter-spacing: .14em;
  margin-bottom: 2px;
}
.kbd {
  font-family: var(--font-mono);
  font-size: .82em;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
}
:not(pre) > code {
  font-family: var(--font-mono);
  font-size: .86em;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  color: var(--accent-2);
}

/* BLOCKS */
.callout {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 14px;
  border-radius: var(--radius);
  padding: 16px 18px;
  margin: 22px 0;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
}
.callout__icon { color: var(--accent); margin-top: 3px; font-size: 1.1rem; line-height: 1 }
.callout__body > *:last-child { margin-bottom: 0 }
.callout__title { font-weight: 700; color: var(--text); margin: 0 0 4px }
.callout--tip { border-left-color: var(--ok) }
.callout--tip .callout__icon { color: var(--ok) }
.callout--warn { border-left-color: var(--warn) }
.callout--warn .callout__icon { color: var(--warn) }
.callout--danger { border-left-color: var(--danger) }
.callout--danger .callout__icon { color: var(--danger) }
.callout--info { border-left-color: var(--info) }
.callout--info .callout__icon { color: var(--info) }

.code {
  margin: 22px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--code-bg);
  overflow: hidden;
}
.code__bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, .06);
  border-bottom: 1px solid rgba(255, 255, 255, .12);
}
.code__file {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: #B9BDC2;
}
.code__badge {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .28);
  color: #B9BDC2;
}
.code__badge--bad { color: #FF9C8F; border-color: #FF9C8F }
.code__badge--good { color: #7FD1A0; border-color: #7FD1A0 }
.code__copy {
  margin-left: auto;
  display: flex;
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, .4);
  border-radius: var(--radius-sm);
  padding: 3px 9px;
  font-size: var(--step--1);
  color: #E8E9EB;
  font-weight: 600;
}
.code__copy:hover { background: rgba(255, 255, 255, .12) }
.code pre { margin: 0; padding: 16px 18px; overflow-x: auto }
.code code {
  font-family: var(--font-mono);
  font-size: .85rem;
  line-height: 1.68;
  color: var(--code-text);
  white-space: pre;
}
.tok-key { color: #C792EA }
.tok-str { color: #7FD1A0 }
.tok-num { color: #F6C177 }
.tok-com { color: #8A8F94; font-style: italic }
.tok-fn { color: #82AAFF }

.table-wrap {
  overflow-x: auto;
  margin: 22px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
table { border-collapse: collapse; width: 100%; font-size: var(--step--1) }
thead th {
  text-align: left;
  padding: 11px 16px;
  background: var(--surface-2);
  font-weight: 700;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
tbody td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--text-2);
  vertical-align: top;
}
tbody tr:last-child td { border-bottom: 0 }
tbody tr:hover td { background: var(--surface-2) }
.good { color: var(--ok); font-weight: 700 }
.bad { color: var(--danger); font-weight: 700 }

/* Stage / Animation */
.stage {
  margin: 24px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.stage__bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-soft);
  font-size: var(--step--1);
  color: var(--muted);
  background: var(--surface-2);
}
.stage__bar b { color: var(--text) }
.stage__canvas {
  padding: 20px 16px;
  display: grid;
  place-items: center;
  min-height: 250px;
}
.stage__controls {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-top: 1px solid var(--line-soft);
  flex-wrap: wrap;
}
.node { fill: var(--surface); stroke: var(--line); stroke-width: 1.5 }
.node-label { fill: var(--text); font: 700 12px var(--font-mono); text-anchor: middle }
.node-sub { fill: var(--muted); font: 400 10px var(--font-ui); text-anchor: middle }
.edge { stroke: var(--line); stroke-width: 1.5; fill: none }
.axis-text { fill: var(--muted); font: 500 11px var(--font-ui) }

/* Button overrides for learning */
.btn { padding: 9px 16px }
.btn--ghost {
  background: var(--surface);
  border-color: var(--text);
  color: var(--text);
}
.btn--ghost:hover { background: var(--surface-2) }

.range { flex: 1; min-width: 120px; accent-color: var(--accent) }

/* Quiz */
.quiz {
  margin: 26px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.quiz__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}
.quiz__kicker {
  font-size: var(--step--1);
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent-2);
}
.quiz__count {
  margin-left: auto;
  font-size: var(--step--1);
  color: var(--muted);
  font-family: var(--font-mono);
}
.quiz__body { padding: 18px }
.quiz__q { font-weight: 700; margin: 0 0 14px }
.quiz__opts { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 8px }
.opt {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.opt:hover { border-color: var(--text); background: var(--surface-2) }
.opt input { margin: 5px 0 0; accent-color: var(--accent); flex: none }
.opt span { color: var(--text-2); font-size: var(--step--1); line-height: 1.55 }
.opt.is-correct { border-color: var(--ok); background: var(--ok-tint) }
.opt.is-correct span { color: var(--text) }
.opt.is-wrong {
  border-color: var(--danger);
  background: color-mix(in srgb, var(--danger) 8%, transparent);
}
.quiz__foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap }
.quiz__msg { font-size: var(--step--1); font-weight: 700 }
.quiz__msg.ok { color: var(--ok) }
.quiz__msg.no { color: var(--danger) }
.quiz__explain {
  margin-top: 14px;
  padding: 13px 15px;
  border-radius: var(--radius-sm);
  font-size: var(--step--1);
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  color: var(--text-2);
}
.quiz__explain[hidden] { display: none }
.quiz__peers { margin-top: 10px; font-size: .75rem; color: var(--muted) }

/* Playground */
.playground {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 24px 0;
}
.pg__pane { min-width: 0 }
.pg__pane + .pg__pane { border-left: 1px solid var(--line-soft) }
.pg__head {
  padding: 9px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line-soft);
  font-size: var(--step--1);
  font-weight: 700;
  color: var(--text-2);
}
.playground textarea {
  width: 100%;
  min-height: 200px;
  resize: vertical;
  border: 0;
  padding: 14px;
  background: var(--code-bg);
  color: var(--code-text);
  font-family: var(--font-mono);
  font-size: .84rem;
  line-height: 1.6;
}
.playground textarea:focus {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--accent);
}
.pg__out {
  padding: 14px;
  min-height: 200px;
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: .8rem;
  color: var(--text-2);
  white-space: pre-wrap;
}
.pg__foot {
  grid-column: 1/-1;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 11px 14px;
  border-top: 1px solid var(--line-soft);
  background: var(--surface-2);
  flex-wrap: wrap;
}

/* Checklist */
.checklist { list-style: none; padding: 0; margin: 20px 0; display: grid; gap: 8px }
.checklist li { border: 1px solid var(--line); border-radius: var(--radius-sm) }
.checklist label {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: 11px 14px;
  cursor: pointer;
  color: var(--text-2);
  font-size: var(--step--1);
}
.checklist input {
  margin: 4px 0 0;
  accent-color: var(--accent);
  flex: none;
  width: 16px;
  height: 16px;
}
.checklist li:has(input:checked) {
  border-color: var(--ok);
  background: var(--ok-tint);
}
.checklist li:has(input:checked) span {
  text-decoration: line-through;
  color: var(--muted);
}

/* FINISH + NAV */
.finish {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin: 44px 0 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.finish__text { flex: 1; min-width: 200px; font-size: var(--step--1); color: var(--text-2) }
.finish__text b { display: block; color: var(--text); font-size: var(--step-0) }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 20px }
.pager button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
}
.pager button:hover:not([disabled]) {
  border-color: var(--text);
  background: var(--surface-2);
}
.pager button[disabled] { opacity: .4; cursor: not-allowed }
.pager small { display: block; color: var(--muted); font-size: var(--step--1); margin-bottom: 3px }
.pager b { font-weight: 700 }
.pager button:last-child { text-align: right }

/* HUB (discussion / notes / reviews) */
.hub { margin-top: 56px; border-top: 1px solid var(--line); padding-top: 28px }
.hub__tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px }
.hub__tab {
  border-bottom: 2px solid transparent;
  padding: 10px 14px;
  font-weight: 700;
  font-size: var(--step--1);
  color: var(--muted);
}
.hub__tab:hover { color: var(--text); background: var(--surface-2) }
.hub__tab[aria-selected="true"] {
  color: var(--text);
  border-bottom-color: var(--accent);
}
.hub__tab .badge {
  margin-left: 6px;
  background: var(--surface-3);
  color: var(--text-2);
  border-radius: 999px;
  padding: 1px 7px;
  font-size: .7rem;
}
.hub__panel[hidden] { display: none }

.composer { display: grid; grid-template-columns: 38px 1fr; gap: 12px; margin-bottom: 22px }
.composer textarea {
  width: 100%;
  min-height: 82px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  resize: vertical;
  font-size: var(--step--1);
}
.composer textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
}
.composer__foot { display: flex; gap: 10px; align-items: center; margin-top: 10px; flex-wrap: wrap }
.composer__hint { font-size: .75rem; color: var(--muted); margin-left: auto }

.filters { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; align-items: center }
.pill { padding: 5px 12px; font-size: .78rem }
.filters select {
  margin-left: auto;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: .78rem;
}

.thread { list-style: none; padding: 0; margin: 0; display: grid; gap: 16px }
.cmt {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line-soft);
}
.cmt:last-child { border-bottom: 0 }
.cmt__head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 4px }
.cmt__name { font-weight: 700; font-size: var(--step--1) }
.cmt__tag {
  font-size: .68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 1px 7px;
  border-radius: var(--radius-sm);
  background: var(--accent-tint);
  color: var(--accent-2);
}
.cmt__tag--solved { background: var(--ok-tint); color: var(--ok) }
.cmt__time { font-size: .75rem; color: var(--muted) }
.cmt__body {
  font-size: var(--step--1);
  color: var(--text-2);
  margin: 0 0 8px;
  line-height: 1.65;
  white-space: pre-wrap;
}
.cmt__body code { font-size: .85em }
.cmt__acts { display: flex; gap: 6px; align-items: center; flex-wrap: wrap }
.act {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: var(--radius-sm);
  font-size: .75rem;
  font-weight: 600;
  color: var(--muted);
}
.act:hover { background: var(--surface-2); color: var(--text) }
.act[aria-pressed="true"] { color: var(--accent-2); background: var(--accent-tint) }
.replies {
  list-style: none;
  margin: 12px 0 0;
  padding: 0 0 0 14px;
  border-left: 2px solid var(--line-soft);
  display: grid;
  gap: 12px;
}
.reply-box { margin-top: 10px; display: none; gap: 8px }
.reply-box.is-on { display: flex }
.reply-box input {
  flex: 1;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: var(--step--1);
}

.note {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: start;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 10px;
}
.note__at {
  font-family: var(--font-mono);
  font-size: .75rem;
  font-weight: 700;
  color: var(--accent-2);
  background: var(--accent-tint);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}
.note__text { font-size: var(--step--1); color: var(--text-2); white-space: pre-wrap }
.note__meta { display: block; font-size: .72rem; color: var(--muted); margin-top: 4px }

.rev {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line-soft);
}
.rev__stars { color: var(--star); font-size: .8rem; letter-spacing: 1px }
.rating-summary {
  display: flex;
  gap: 24px;
  align-items: center;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.rating-summary__score {
  font-size: 2.6rem;
  font-weight: 800;
  line-height: 1;
  color: var(--star);
}
.bars { flex: 1; min-width: 220px; display: grid; gap: 5px }
.barrow { display: flex; align-items: center; gap: 9px; font-size: .75rem; color: var(--muted) }
.barrow .track { flex: 1; height: 7px; background: var(--surface-3); border-radius: 7px; overflow: hidden }
.barrow .track i { display: block; height: 100%; background: var(--star) }

.empty {
  padding: 30px;
  text-align: center;
  color: var(--muted);
  font-size: var(--step--1);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

/* MISC */
.toast {
  transform: translate(-50%, 140%);
  border-radius: var(--radius-sm);
  font-weight: 700;
  box-shadow: var(--shadow);
  transition: transform .28s cubic-bezier(.2, .9, .3, 1.2);
}
.toast.is-on { transform: translate(-50%, 0) }

.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
  z-index: 55;
}
.backdrop.is-on { opacity: 1; pointer-events: auto }

@media (max-width: 1180px) {
  .content { grid-template-columns: minmax(0, 1fr) }
  .toc { display: none }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(86vw, var(--sidebar-w));
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: var(--shadow);
  }
  .sidebar.is-open { transform: none }
  .menu-btn { display: grid }
  .content { padding: 24px 16px 80px }
  .playground { grid-template-columns: 1fr }
  .pg__pane + .pg__pane { border-left: 0; border-top: 1px solid var(--line-soft) }
  .pager { grid-template-columns: 1fr }
  .pager button:last-child { text-align: left }
  .outline__link { padding: 10px 12px; min-height: 44px }
  .outline__toggle { padding: 10px 12px; min-height: 44px }
  .search input { font-size: 16px; padding: 12px 14px 12px 36px }
  .icon-btn { width: 44px; height: 44px }
}
@media print {
  .sidebar, .toc, .topbar, .hub,
  .pager, .finish, .stage__controls { display: none }
  .app { grid-template-columns: 1fr }
}

/* AUTH LOCK GUARD */
.auth-lock-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(13, 14, 21, 0.85);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeInLock 0.3s ease-out forwards;
}
@keyframes fadeInLock {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}
.auth-lock-card {
  max-width: 500px;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 36px 28px;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}
.auth-lock-card .auth-lock-icon {
  font-size: 48px;
  margin-bottom: 16px;
}
.auth-lock-card h2 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 10px;
  color: var(--text);
}
.auth-lock-card p {
  font-size: 0.95rem;
  color: var(--text-2);
  line-height: 1.6;
  margin-bottom: 24px;
}
.auth-lock-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.auth-lock-actions .btn {
  width: 100%;
  justify-content: center;
}
.article.is-locked {
  filter: blur(10px);
  opacity: 0.25;
  pointer-events: none;
  user-select: none;
}

