/* ==========================================================
   RESOURCES — the class library (/student/resources) and the
   in-platform book reader (/student/book). Same design language
   as the student portal: Outfit body, Syne display, brand red,
   white cards with soft borders.
   ========================================================== */

:root {
  --rs-red: #d6001c;
  --rs-ink: #0d0f1a;
  --rs-muted: #6b7280;
  --rs-line: rgba(0, 0, 0, 0.08);
  --rs-paper: #fffdf9;
  --bk-font: 17.5px;
}

/* ---------- covers ---------- */
.bk-cover {
  position: relative;
  aspect-ratio: 2 / 3;
  width: 100%;
  border-radius: 6px 12px 12px 6px;
  overflow: hidden;
  background: linear-gradient(150deg, var(--c1, #d6001c), var(--c2, #7f0010));
  color: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.12), 0 10px 24px -8px rgba(13,15,26,.35);
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 14% 12% 12% 16%;
  text-align: left;
  transition: transform .2s ease, box-shadow .2s ease;
}
.bk-cover.has-image { padding: 0; background: #fff; }
.bk-cover.has-image img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.bk-cover-spine {
  position: absolute; inset: 0 auto 0 0; width: 9%;
  background: linear-gradient(90deg, rgba(0,0,0,.28), rgba(255,255,255,.12) 55%, rgba(0,0,0,.08));
}
.bk-cover-icon { position: absolute; top: 12%; right: 12%; font-size: 2.1em; opacity: .9; }
.bk-cover-badge {
  position: absolute; top: 9%; left: 16%;
  background: #fff; color: var(--rs-red); font-weight: 800; font-size: 10px; letter-spacing: .08em;
  padding: 3px 8px; border-radius: 99px;
}
.bk-cover-title { font-family: var(--font-display); font-weight: 800; line-height: 1.05; font-size: 1.2em; }
.bk-cover-author { margin-top: .5em; font-size: .62em; opacity: .85; font-weight: 600; }
.bk-cover-sm { font-size: 15px; }
.bk-cover-lg { font-size: 22px; }

/* ---------- library page ---------- */
.rs-skeleton { display: grid; gap: 18px; }
.rs-skeleton[hidden] { display: none; }
.rs-skel-feature { height: 220px; border-radius: 20px; }
.rs-skel-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.rs-skel-book { aspect-ratio: 2 / 3; border-radius: 12px; }

.rs-feature {
  display: grid; grid-template-columns: 1fr 190px; gap: 28px; align-items: center;
  padding: 28px 32px; border-radius: 22px; margin-bottom: 28px;
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(255,255,255,.16), transparent 55%),
    linear-gradient(135deg, var(--c1, #d6001c), var(--c2, #7f0010));
  color: #fff; overflow: hidden;
}
.rs-feature-tag { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; background: rgba(255,255,255,.18); padding: 5px 12px; border-radius: 99px; }
.rs-feature h2 { font-family: var(--font-display); font-weight: 800; font-size: clamp(26px, 4vw, 38px); margin: 14px 0 8px; line-height: 1.05; color: #fff; }
.rs-feature p { margin: 0 0 20px; opacity: .92; font-size: 16px; max-width: 46ch; }
.rs-feature-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.rs-feature-cover { border: 0; background: none; padding: 0; cursor: pointer; transform: rotate(4deg); }
.rs-feature-cover:hover .bk-cover { transform: translateY(-4px); }

.rs-btn {
  display: inline-flex; align-items: center; gap: 8px; border-radius: 99px; padding: 11px 20px;
  font-weight: 700; font-size: 15px; text-decoration: none; cursor: pointer; border: 2px solid transparent;
  font-family: var(--font-body);
}
.rs-btn.primary { background: #fff; color: var(--rs-red); }
.rs-btn.ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.6); }
.rs-sheet .rs-btn.primary { background: var(--rs-red); color: #fff; }
.rs-sheet .rs-btn.ghost { color: var(--rs-ink); border-color: var(--rs-line); }

.rs-section { margin-bottom: 30px; }
.rs-h { font-family: var(--font-display); font-size: 20px; font-weight: 800; margin: 0 0 14px; color: var(--rs-ink); }
.rs-shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 26px 22px; }
.rs-book {
  border: 0; background: none; padding: 0; cursor: pointer; text-align: left;
  display: flex; flex-direction: column; gap: 6px; font-family: var(--font-body);
}
.rs-book:hover .bk-cover, .rs-book:focus-visible .bk-cover { transform: translateY(-5px); box-shadow: 0 2px 4px rgba(0,0,0,.12), 0 18px 32px -10px rgba(13,15,26,.45); }
.rs-book-title { font-weight: 700; font-size: 15px; color: var(--rs-ink); margin-top: 6px; line-height: 1.25; }
.rs-book-sub { font-size: 13px; color: var(--rs-muted); }
.rs-progress { display: block; height: 5px; border-radius: 99px; background: #eceef2; overflow: hidden; }
.rs-progress > span { display: block; height: 100%; background: var(--rs-red); border-radius: 99px; }
.rs-empty { color: var(--rs-muted); }

.rs-continue { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.rs-cont {
  display: grid; grid-template-columns: 64px 1fr; gap: 14px; align-items: center; padding: 12px;
  background: #fff; border: 1px solid var(--rs-line); border-radius: 16px; text-decoration: none; color: var(--rs-ink);
}
.rs-cont .bk-cover { font-size: 8px; }
.rs-cont-body { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--rs-muted); }
.rs-cont-body strong { font-size: 15px; color: var(--rs-ink); }
.rs-cont-go { color: var(--rs-red); font-weight: 700; }

/* preview sheet (Apple Books style) */
.rs-preview {
  position: fixed; inset: 0; z-index: 1200; background: rgba(13,15,26,.45);
  display: flex; align-items: flex-end; justify-content: center; opacity: 0; transition: opacity .2s ease;
}
.rs-preview[hidden] { display: none; }
.rs-preview.open { opacity: 1; }
.rs-sheet {
  position: relative; width: min(920px, 100%); max-height: 92vh; overflow-y: auto;
  background: #fff; border-radius: 24px 24px 0 0; padding: 30px 30px 24px;
  transform: translateY(30px); transition: transform .22s ease;
}
.rs-preview.open .rs-sheet { transform: none; }
@media (min-width: 760px) { .rs-preview { align-items: center; } .rs-sheet { border-radius: 24px; max-height: 88vh; } }
.rs-sheet-close {
  position: absolute; top: 16px; right: 16px; width: 38px; height: 38px; border-radius: 50%;
  border: 0; background: #f1f2f4; cursor: pointer; font-size: 16px;
}
.rs-sheet-top { display: grid; grid-template-columns: 180px 1fr; gap: 26px; align-items: start; }
.rs-sheet-kind { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--rs-red); }
.rs-sheet-info h2 { font-family: var(--font-display); font-weight: 800; font-size: 28px; margin: 6px 0 4px; line-height: 1.1; }
.rs-sheet-author { color: var(--rs-muted); font-weight: 600; }
.rs-sheet-meta { display: flex; gap: 16px; flex-wrap: wrap; margin: 12px 0; color: var(--rs-muted); font-size: 14px; }
.rs-sheet-info p { color: #374151; line-height: 1.6; margin: 0 0 18px; }
.rs-sheet-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.rs-sample { margin-top: 26px; border-top: 1px solid var(--rs-line); padding-top: 18px; }
.rs-sample-label { font-weight: 700; color: var(--rs-muted); font-size: 13px; margin-bottom: 12px; }
.rs-sample-page {
  max-height: 420px; overflow: hidden; position: relative; border: 1px solid var(--rs-line); border-radius: 16px;
  background: var(--rs-paper); padding: 22px 24px;
}
.rs-sample-page::after { content: ''; position: absolute; inset: auto 0 0 0; height: 120px; background: linear-gradient(transparent, var(--rs-paper)); }
.rs-sample-page .bk-pg-image img { border-radius: 8px; }
.rs-sample-more { display: inline-flex; gap: 8px; align-items: center; margin-top: 14px; color: var(--rs-red); font-weight: 700; text-decoration: none; }

@media (max-width: 640px) {
  .rs-feature { grid-template-columns: 1fr; padding: 22px; }
  .rs-feature-cover { display: none; }
  .rs-shelf { grid-template-columns: repeat(2, 1fr); gap: 22px 16px; }
  .rs-sheet { padding: 24px 18px 20px; }
  .rs-sheet-top { grid-template-columns: 108px 1fr; gap: 16px; }
  .rs-sheet-top .bk-cover-lg { font-size: 13px; }
  .rs-sheet-info h2 { font-size: 22px; }
  .rs-skel-row { grid-template-columns: repeat(2, 1fr); }
}

/* ==========================================================
   READER
   ========================================================== */
body.bk-body { background: #f3f1ec; margin: 0; font-family: var(--font-body); color: var(--rs-ink); }
.bk-top {
  position: sticky; top: 0; z-index: 50; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px;
  padding: 10px 14px; background: rgba(255,253,249,.94); backdrop-filter: blur(10px); border-bottom: 1px solid var(--rs-line);
}
.bk-top-title { min-width: 0; text-align: center; display: flex; flex-direction: column; }
.bk-top-title strong { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bk-top-title span { font-size: 12px; color: var(--rs-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bk-top-tools { display: flex; gap: 4px; }
.bk-icon-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 38px; min-width: 38px; padding: 0 10px; justify-content: center;
  border-radius: 12px; border: 0; background: transparent; color: var(--rs-ink); font-weight: 700; font-size: 15px; cursor: pointer; text-decoration: none;
  font-family: var(--font-body);
}
.bk-icon-btn:hover { background: rgba(0,0,0,.05); }
.bk-progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; background: transparent; }
.bk-progress span { display: block; height: 100%; width: 0; background: var(--rs-red); transition: width .25s ease; }

.bk-stage { max-width: 780px; margin: 0 auto; padding: 22px 16px 110px; overflow-x: clip; }
.bk-pg {
  background: var(--rs-paper); border-radius: 18px; padding: 34px 40px 46px; position: relative;
  box-shadow: 0 1px 2px rgba(0,0,0,.05), 0 12px 34px -18px rgba(13,15,26,.25);
}
.bk-turn { animation: bkIn .28s ease both; }
.bk-turn.from-right { animation-name: bkFromRight; }
.bk-turn.from-left { animation-name: bkFromLeft; }
@keyframes bkIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes bkFromRight { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: none; } }
@keyframes bkFromLeft { from { opacity: 0; transform: translateX(-40px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .bk-turn { animation: none; } }

.bk-reading { font-size: var(--bk-font); line-height: 1.7; }
.bk-chapter { color: var(--rs-red); font-weight: 800; font-size: .74em; letter-spacing: .08em; text-transform: uppercase; }
.bk-title { font-family: var(--font-display); font-weight: 800; font-size: 1.75em; line-height: 1.12; margin: 6px 0 18px; color: var(--rs-ink); }
.bk-p { margin: 0 0 1em; color: #1f2937; }
.bk-h { font-family: var(--font-display); font-weight: 800; font-size: 1.1em; margin: 1.4em 0 .5em; }
.bk-p code, .bk-list code, .bk-callout code, .bk-ex-prompt code, .bk-caption code, .bk-stepper-note code {
  font-family: 'JetBrains Mono', Consolas, monospace; font-size: .86em; background: #f1ede4; padding: .1em .4em; border-radius: 6px; color: #9f1239;
}
.bk-list { margin: 0 0 1.1em; padding-left: 1.3em; }
.bk-list li { margin-bottom: .45em; }
.bk-folio { position: absolute; bottom: 16px; left: 0; right: 0; text-align: center; color: #b0a99b; font-size: 13px; font-weight: 600; }

.bk-callout { display: grid; grid-template-columns: 26px 1fr; gap: 10px; padding: 14px 16px; border-radius: 14px; margin: 0 0 1.1em; }
.bk-callout > i { margin-top: .3em; }
.bk-callout.key { background: #fef2f2; border: 1px solid #fecaca; }
.bk-callout.key > i { color: var(--rs-red); }
.bk-callout.tip { background: #eff6ff; border: 1px solid #bfdbfe; }
.bk-callout.tip > i { color: #2563eb; }
.bk-callout.warn { background: #fffbeb; border: 1px solid #fde68a; }
.bk-callout.warn > i { color: #d97706; }

.bk-figure { margin: 0 0 1.2em; background: #fff; border: 1px solid var(--rs-line); border-radius: 16px; padding: 14px; }
.bk-figure svg { width: 100%; height: auto; display: block; }
.bk-caption { font-size: .82em; color: var(--rs-muted); text-align: center; margin-top: 8px; }

.bk-example { margin: 0 0 1.3em; }
.bk-code { border-radius: 14px; overflow: hidden; background: #0d1117; }
.bk-code-bar { display: flex; justify-content: space-between; padding: 7px 14px; background: #161b22; color: #8b949e; font-size: 12px; font-weight: 700; letter-spacing: .04em; }
.bk-code pre { margin: 0; padding: 14px 16px; overflow-x: auto; }
.bk-code pre code, .bk-code pre code.hljs { font-family: 'JetBrains Mono', Consolas, monospace; font-size: .8em; line-height: 1.6; background: transparent; padding: 0; color: #e6edf3; white-space: pre; }
.bk-output { margin-top: 8px; border-radius: 12px; background: #f0fdf4; border: 1px solid #bbf7d0; padding: 10px 14px; }
.bk-output-error { background: #fef2f2; border-color: #fecaca; }
.bk-output-label { font-size: 12px; font-weight: 800; color: #15803d; letter-spacing: .03em; margin-bottom: 4px; }
.bk-output-error .bk-output-label { color: var(--rs-red); }
.bk-input-note { font-weight: 600; color: var(--rs-muted); }
.bk-output pre { margin: 0; font-family: 'JetBrains Mono', Consolas, monospace; font-size: .8em; line-height: 1.55; white-space: pre-wrap; color: #14532d; }
.bk-output-error pre { color: #7f1d1d; }
.bk-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.bk-try, .bk-reveal {
  display: inline-flex; align-items: center; gap: 8px; border-radius: 99px; padding: 8px 16px; font-weight: 700; font-size: 14px;
  cursor: pointer; font-family: var(--font-body); border: 2px solid var(--rs-red);
}
.bk-try { background: var(--rs-red); color: #fff; }
.bk-try:hover { background: #b00018; }
.bk-reveal { background: #fff; color: var(--rs-red); }
.bk-predict-tag { font-weight: 800; color: #7c3aed; font-size: .82em; margin-bottom: 8px; }
.bk-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0 0 1.2em; }

/* stepper */
.bk-stepper { margin: 0 0 1.3em; border: 2px solid #111827; border-radius: 18px; overflow: hidden; background: #fff; }
.bk-stepper-head { background: #111827; color: #fff; font-weight: 800; padding: 9px 16px; font-size: .85em; }
.bk-stepper-body { display: grid; grid-template-columns: 1.3fr 1fr; }
.bk-stepper-code { margin: 0; padding: 12px 0; list-style: none; counter-reset: ln; background: #0d1117; overflow-x: auto; }
.bk-stepper-code li { counter-increment: ln; padding: 2px 14px 2px 0; white-space: pre; position: relative; border-left: 4px solid transparent; }
.bk-stepper-code li::before { content: counter(ln); display: inline-block; width: 34px; text-align: right; margin-right: 14px; color: #6e7681; font-family: 'JetBrains Mono', monospace; font-size: .78em; }
.bk-stepper-code li code { font-family: 'JetBrains Mono', Consolas, monospace; font-size: .8em; color: #e6edf3; background: none; }
.bk-stepper-code li.current { background: rgba(214,0,28,.32); border-left-color: #ff4d64; }
.bk-stepper-side { padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.bk-stepper-label { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--rs-muted); }
.bk-stepper-vars { display: flex; flex-direction: column; gap: 5px; margin-bottom: 6px; }
.bk-var { display: flex; justify-content: space-between; gap: 10px; padding: 5px 9px; border-radius: 8px; background: #f8fafc; border: 1px solid #e5e7eb; font-size: .82em; }
.bk-var span { font-weight: 700; }
.bk-var code { font-family: 'JetBrains Mono', monospace; color: #1d4ed8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bk-var.changed { background: #fef9c3; border-color: #facc15; animation: bkPulse .5s ease; }
@keyframes bkPulse { from { transform: scale(1.04); } to { transform: none; } }
.bk-var-empty { color: var(--rs-muted); font-size: .82em; }
.bk-stepper-out { margin: 0; min-height: 48px; background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 8px; padding: 8px 10px; font-family: 'JetBrains Mono', monospace; font-size: .78em; white-space: pre-wrap; color: #14532d; }
.bk-stepper-note { padding: 10px 16px; border-top: 1px solid var(--rs-line); font-size: .86em; background: #fffbeb; }
.bk-stepper-note i { color: var(--rs-red); }
.bk-stepper-controls { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--rs-line); }
.bk-stepper-controls button { border: 2px solid #e5e7eb; background: #fff; border-radius: 99px; padding: 7px 14px; font-weight: 700; cursor: pointer; font-family: var(--font-body); font-size: 14px; }
.bk-stepper-controls button.primary { background: #111827; color: #fff; border-color: #111827; margin-left: auto; }
.bk-stepper-controls button:disabled { opacity: .4; cursor: default; }
.bk-stepper-count { font-size: 13px; color: var(--rs-muted); font-weight: 600; }
.bk-stepper .bk-actions { padding: 0 14px 12px; }

/* exercises */
.bk-exercise { border: 1px solid var(--rs-line); border-left: 6px solid #16a34a; border-radius: 16px; padding: 16px 18px; margin: 0 0 1.2em; background: #fff; }
.bk-exercise.level-2 { border-left-color: #f59e0b; }
.bk-exercise.level-3 { border-left-color: var(--rs-red); }
.bk-ex-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.bk-ex-level { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 3px 9px; border-radius: 99px; background: #dcfce7; color: #166534; }
.level-2 .bk-ex-level { background: #fef3c7; color: #92400e; }
.level-3 .bk-ex-level { background: #fee2e2; color: #991b1b; }
.bk-ex-prompt { color: #374151; }
.bk-ex-answer { margin-top: 12px; }

.bk-pg-image { padding: 10px; background: #fff; }
.bk-pg-image img { width: 100%; height: auto; display: block; border-radius: 10px; }
body.bk-images .bk-stage { max-width: 900px; }

.bk-missing { text-align: center; padding: 60px 20px; }

/* bottom bar */
.bk-bottom {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px)); background: rgba(255,253,249,.96); backdrop-filter: blur(10px); border-top: 1px solid var(--rs-line);
}
.bk-turn-btn {
  display: inline-flex; align-items: center; gap: 10px; border-radius: 99px; padding: 11px 20px; font-weight: 700; font-size: 15px; cursor: pointer;
  border: 2px solid var(--rs-line); background: #fff; color: var(--rs-ink); font-family: var(--font-body);
}
.bk-turn-btn.primary { background: var(--rs-red); border-color: var(--rs-red); color: #fff; }
.bk-turn-btn:disabled { opacity: .35; cursor: default; }
.bk-count { font-weight: 700; color: var(--rs-muted); font-size: 14px; }

/* contents drawer + scrim */
.bk-scrim { position: fixed; inset: 0; z-index: 60; background: rgba(13,15,26,.4); opacity: 0; pointer-events: none; transition: opacity .2s ease; }
.bk-scrim.open { opacity: 1; pointer-events: auto; }
.bk-toc {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 70; width: min(360px, 88vw); background: #fff; display: flex; flex-direction: column;
  transform: translateX(105%); transition: transform .22s ease, visibility 0s linear .22s; box-shadow: -20px 0 40px -20px rgba(0,0,0,.3);
  visibility: hidden;
}
.bk-toc.open { transform: none; visibility: visible; transition: transform .22s ease; }
.bk-toc-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--rs-line); font-family: var(--font-display); font-size: 18px; }
.bk-toc-list { overflow-y: auto; padding: 8px 8px 24px; }
.bk-toc-chapter { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--rs-red); padding: 14px 10px 4px; }
.bk-toc-item { width: 100%; display: flex; justify-content: space-between; gap: 10px; text-align: left; border: 0; background: none; padding: 9px 10px; border-radius: 10px; cursor: pointer; font-size: 15px; font-family: var(--font-body); color: var(--rs-ink); }
.bk-toc-item:hover { background: #f6f6f7; }
.bk-toc-item.active { background: #fef2f2; color: var(--rs-red); font-weight: 700; }
.bk-toc-no { color: var(--rs-muted); font-size: 13px; }

/* Try-it sandbox (bottom sheet) */
.bk-sandbox {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 80; background: #fff; border-radius: 22px 22px 0 0;
  max-height: 88vh; display: flex; flex-direction: column; transform: translateY(105%); transition: transform .25s ease;
  box-shadow: 0 -20px 50px -20px rgba(0,0,0,.4);
  visibility: hidden; transition: transform .25s ease, visibility 0s linear .25s;
}
.bk-sandbox.open { transform: none; visibility: visible; transition: transform .25s ease; }
@media (min-width: 900px) { .bk-sandbox { left: 50%; width: 860px; margin-left: -430px; } }
.bk-sandbox-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--rs-line); }
.bk-sandbox-head > div:first-child { display: flex; flex-direction: column; }
.bk-sandbox-head strong i { color: var(--rs-red); }
.bk-sandbox-head span { font-size: 13px; color: var(--rs-muted); }
.bk-sandbox-tools { display: flex; gap: 6px; align-items: center; }
.bk-back-read { display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 99px; background: var(--rs-red); color: #fff; padding: 10px 16px; font-weight: 700; cursor: pointer; font-family: var(--font-body); font-size: 14px; }
.bk-sandbox-host { overflow-y: auto; padding: 12px 14px calc(16px + env(safe-area-inset-bottom, 0px)); }
body.bk-sandbox-open { overflow: hidden; }

@media (max-width: 640px) {
  .bk-hide-sm { display: none; }
  .bk-stage { padding: 12px 8px 100px; }
  .bk-pg { padding: 22px 18px 40px; border-radius: 14px; }
  .bk-title { font-size: 1.45em; }
  .bk-compare { grid-template-columns: 1fr; }
  .bk-stepper-body { grid-template-columns: 1fr; }
  .bk-turn-btn { padding: 10px 14px; }
  .bk-turn-btn span { display: none; }
  .bk-turn-btn.primary span { display: inline; }
}

/* Try-it sandbox: a shorter editor so Run and the output stay in view; no answer-page hints */
.bk-sandbox-host .ae-body { height: min(34vh, 300px) !important; }
.bk-sandbox-host .ae-foot, .bk-sandbox-host .ae-tabs, .bk-sandbox-host .ae-grip { display: none; }
.rs-feature p, .rs-feature h2, .rs-feature-tag { color: #fff; }
@media (max-width: 640px) {
  .bk-figure { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .bk-figure svg { min-width: 540px; }
  .bk-figure .bk-caption { position: sticky; left: 0; max-width: calc(100vw - 80px); }
}

/* The reader page does not load dashboard.css, but the shared Try-it editor (student-work.css)
   is styled with its tokens — the red Run button is var(--brand). Same values as dashboard.css. */
body.bk-body {
  --brand: #E8192C; --brand-dark: #C5141F; --brand-bg: #FFF0F2; --brand-bdr: rgba(232,25,44,0.20);
  --bg: #F4F5F8; --card: #FFFFFF; --bdr: #E8E9EE; --bdr2: #D0D2DA;
  --t1: #0D1117; --t2: #4B5563; --t3: #9CA3AF;
  --green: #22C55E; --amber: #F59E0B;
  --f-body: 'Outfit', sans-serif; --f-display: 'Syne', sans-serif;
  --r-xs: 4px; --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 20px; --r-pill: 999px;
  --sh-sm: 0 1px 4px rgba(0,0,0,0.06); --sh-md: 0 4px 16px rgba(0,0,0,0.08); --sh-lg: 0 8px 32px rgba(0,0,0,0.12);
}
