/* ===================================================================
   PYTHON QUEST: same "lab window" look as Packet Quest
   =================================================================== */
:root {
  --backdrop: #a3abbb;
  --panel: #1d222b;
  --canvas: #1b2028;
  --raise: #232933;
  --raise2: #2a313b;
  --line: #323a46;
  --line2: #3d4757;
  --text: #eef1f6;
  --soft: #c9d0db;
  --muted: #8b93a1;
  --blue: #2f8cff;
  --blue-t: #7db8ff;
  --purple: #9b5cff;
  --green: #2fd16b;
  --yellow: #f6bd2b;
  --red: #ff4766;
  --teal: #22c7b3;
  --orange: #ff8a3d;
  --r: 22px;
  --ui: 'Outfit', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--ui); color: var(--text); font-size: 15px; line-height: 1.5;
  background: radial-gradient(1200px 700px at 50% -10%, #b9c0cd, var(--backdrop) 60%, #959eb0);
  min-height: 100vh; -webkit-font-smoothing: antialiased;
}
a { color: var(--blue-t); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
code, pre, kbd, textarea { font-family: var(--mono); font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; }
code { font-size: .86em; background: var(--raise2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; color: #dfe6f0; white-space: nowrap; }
b, strong { color: #fff; font-weight: 600; }
.k { color: var(--blue-t); font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
kbd { font-size: 11.5px; background: var(--raise2); border: 1px solid var(--line2); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; color: var(--soft); }

/* ---------- desk: sidebar + window ---------- */
.desk {
  display: grid; grid-template-columns: 262px minmax(0, 1fr); gap: 18px;
  max-width: 1560px; margin: 0 auto; padding: 22px 22px 8px; height: calc(100vh - 30px); min-height: 600px;
}
.side, .win {
  background: var(--panel); border-radius: var(--r); border: 1px solid #2a303a;
  box-shadow: 0 24px 60px -18px rgba(25, 30, 45, .55), 0 2px 0 rgba(255, 255, 255, .04) inset;
}
.side { display: flex; flex-direction: column; overflow: hidden; }
.brand { display: flex; align-items: center; gap: 12px; padding: 18px 18px 16px; border-bottom: 1px solid var(--line); color: var(--text); font-weight: 600; font-size: 15.5px; line-height: 1.2; }
.brand:hover { text-decoration: none; }
.brand-ic { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 11px; background: linear-gradient(145deg, #2f8cff, #1d5fd0); box-shadow: 0 0 18px -2px rgba(47, 140, 255, .7); font-family: var(--mono); font-weight: 600; font-size: 15px; color: #fff; }
.brand small { display: block; color: var(--muted); font-weight: 500; font-size: 12px; margin-top: 3px; }
.clist { flex: 1; overflow-y: auto; padding: 6px 12px 12px; scrollbar-width: thin; scrollbar-color: #3a4250 transparent; }
.zh { display: flex; align-items: center; gap: 8px; font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); margin: 16px 6px 7px; font-weight: 600; }
.zh i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.zh span { margin-left: auto; letter-spacing: 0; text-transform: none; font-weight: 500; }
.ci {
  display: grid; grid-template-columns: 24px 1fr 14px; align-items: center; gap: 6px;
  padding: 7px 10px; margin-bottom: 6px; border-radius: 9px; border: 1px solid #2c333e; background: #20262f;
  color: #dfe4ec; font-size: 13.5px; line-height: 1.25;
}
.ci:hover { border-color: var(--line2); text-decoration: none; background: #232a34; }
.ci .n { color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.ci .dot { width: 13px; height: 13px; border-radius: 50%; border: 1.5px solid #5a6474; display: grid; place-items: center; }
.ci.on { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue) inset, 0 0 16px -2px rgba(47, 140, 255, .45); color: #fff; }
.ci.on .dot { border-color: var(--blue); background: radial-gradient(circle, var(--blue) 0 3.5px, transparent 4px); box-shadow: 0 0 8px var(--blue); }
.ci.done .dot { border-color: var(--green); background: var(--green); }
.ci.done .dot svg { width: 9px; height: 9px; fill: none; stroke: #0f1a12; stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; }
.side-foot { border-top: 1px solid var(--line); padding: 12px 14px 14px; }
.sprog { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.sprog-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.sprog .bar { height: 4px; border-radius: 4px; background: var(--raise2); margin-top: 6px; overflow: hidden; }
.sprog .bar i { display: block; height: 100%; background: var(--green); border-radius: 4px; }
.reset { background: none; border: 0; color: var(--muted); font-size: 12px; cursor: pointer; padding: 0; text-decoration: underline; text-underline-offset: 2px; }
.reset.armed { color: var(--red); }
.reflinks { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.reflinks a { font-size: 12.5px; color: var(--soft); background: var(--raise); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; text-align: center; }
.reflinks a:hover, .reflinks a.on { border-color: var(--blue); color: #fff; text-decoration: none; }
.reflinks a.wide { grid-column: span 2; }
.reflinks a.mock { border-color: rgba(255, 138, 61, .5); color: #ffd2b5; }
.reflinks a.is-on { color: var(--green); }

.win { display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.tbar { position: relative; display: flex; align-items: center; gap: 12px; height: 50px; padding: 0 18px; border-bottom: 1px solid var(--line); flex: none; }
.lights { display: flex; gap: 8px; }
.lights i { width: 12px; height: 12px; border-radius: 50%; background: #ff5f57; }
.lights i:nth-child(2) { background: #febc2e; }
.lights i:nth-child(3) { background: #28c840; }
.wtitle { position: absolute; left: 50%; transform: translateX(-50%); font-size: 13.5px; color: var(--soft); white-space: nowrap; max-width: 56%; overflow: hidden; text-overflow: ellipsis; }
.wtitle span { color: var(--muted); margin: 0 6px; }
.pystat { margin-left: auto; display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); }
.pystat i { width: 8px; height: 8px; border-radius: 50%; background: #5a6474; }
.pystat.loading i, .pystat.busy i { background: var(--yellow); box-shadow: 0 0 8px var(--yellow); animation: pulse 1s infinite; }
.pystat.ready i { background: var(--green); box-shadow: 0 0 8px var(--green); }
.pystat.error i { background: var(--red); }
@keyframes pulse { 50% { opacity: .35; } }
.menu-btn { display: none; align-items: center; gap: 6px; background: var(--raise); border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; font-size: 13px; cursor: pointer; }
.menu-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 4; stroke-linecap: round; }
#app { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: auto; }
.foot { text-align: center; font-size: 12px; color: #3d4554; padding: 0 16px 6px; }
.foot a { color: #24324a; font-weight: 600; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--raise); border: 1px solid var(--line2); color: var(--text);
  border-radius: 10px; padding: 10px 18px; font-size: 14.5px; font-weight: 600; cursor: pointer; text-decoration: none;
  transition: border-color .15s, background .15s, transform .1s;
}
.btn:hover { border-color: #56627a; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .35; cursor: default; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; box-shadow: 0 6px 20px -6px rgba(47, 140, 255, .8); }
.btn.primary:hover { background: #4a9bff; }
.btn.go { background: var(--green); border-color: var(--green); color: #0b1a10; box-shadow: 0 6px 20px -6px rgba(47, 209, 107, .7); }
.btn.go:hover { background: #4fe083; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--soft); }
.btn.ghost:hover { border-color: var(--line2); }
.btn.sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btnrow { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ---------- lesson: canvas (code + visual) + caption ---------- */
.canvas {
  position: relative; flex: 1; min-height: 260px; display: flex; flex-direction: column;
  background-color: var(--canvas);
  background-image: radial-gradient(rgba(255, 255, 255, .065) 1px, transparent 1.2px); background-size: 22px 22px;
}
.cv-tools { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 18px 0; }
.ctag { display: inline-flex; align-items: center; background: #fff; color: #11151b; font-weight: 600; font-size: 13.5px; padding: 6px 14px; border-radius: 999px; }
.ctag small { color: #6b7380; font-weight: 600; margin-right: 6px; }
.scene { flex: 1; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 22px; padding: 18px 26px 18px; align-items: center; min-height: 0; }
.scene.only-vis { grid-template-columns: 1fr; justify-items: center; }
.scene.only-code { grid-template-columns: minmax(0, 760px); justify-content: center; }
.scene .left { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.scene .right { min-width: 0; display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.scene.only-vis .right { align-items: center; }
.anim-in { animation: rise .35s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

/* code block */
pre.code { margin: 0; background: #151a21; border: 1px solid var(--line); border-radius: 14px; padding: 14px 0; font-size: 14.5px; line-height: 1.65; overflow-x: auto; box-shadow: 0 18px 40px -22px rgba(0, 0, 0, .8); }
pre.code.small { font-size: 13px; padding: 10px 0; }
pre.code .ln { display: block; padding: 0 18px 0 0; white-space: pre; border-left: 3px solid transparent; }
pre.code .ln b { display: inline-block; width: 38px; text-align: right; margin-right: 16px; color: #4c5564; font-weight: 400; user-select: none; }
pre.code .ln.hl { background: rgba(47, 140, 255, .13); border-left-color: var(--blue); }
pre.code .ln.hl b { color: var(--blue-t); }
pre.code .ln.dim { opacity: .5; }
.t-k { color: #c792ff; font-style: normal; }
.t-b { color: #5fd3ff; font-style: normal; }
.t-s { color: #a6e07a; font-style: normal; }
.t-f { color: #ffd479; font-style: normal; }
.t-n { color: #ffab70; font-style: normal; }
.t-c { color: #6a7486; font-style: italic; }
.t-d { color: #7db8ff; font-style: normal; font-weight: 600; }
.t-fn { color: #82aaff; font-style: normal; }
.t-o { color: #c9d0db; font-style: normal; }
.outbox { background: #0f1318; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.outbox .oh { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 6px 14px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.outbox pre { margin: 0; padding: 10px 14px; font-size: 13.5px; color: #e9eef5; white-space: pre-wrap; word-break: break-word; }
.try-btn { align-self: flex-start; }

/* visuals */
.v { max-width: 100%; }
.v-name { font-family: var(--mono); font-size: 13px; color: var(--blue-t); margin-bottom: 6px; }
.v-name .shape { color: var(--muted); margin-left: 6px; font-size: 12px; }
.cells { display: flex; flex-wrap: wrap; gap: 6px; }
.cell { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 46px; }
.cell .box { min-width: 46px; height: 46px; padding: 0 10px; display: grid; place-items: center; background: #20262f; border: 1.5px solid var(--line2); border-radius: 10px; font-family: var(--mono); font-size: 14px; color: #fff; white-space: nowrap; }
.cell .box.empty { color: var(--muted); font-size: 12px; border-style: dashed; }
.cell .idx { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.cell .idx.neg { color: #6f7889; }
.cell .mk { font-size: 11px; color: var(--yellow); font-weight: 600; }
.cell.on .box { background: rgba(47, 140, 255, .18); border-color: var(--blue); box-shadow: 0 0 16px -3px rgba(47, 140, 255, .8); }
.cell.on .idx { color: var(--blue-t); }
.v-str .cell, .v-str .cell .box { min-width: 36px; }
.v-str .cell .box { height: 40px; padding: 0 6px; }
.v table { border-collapse: separate; border-spacing: 0; font-family: var(--mono); font-size: 13.5px; background: #1a1f27; border: 1px solid var(--line2); border-radius: 12px; overflow: hidden; }
.v th { font-family: var(--ui); font-size: 11px; font-weight: 600; color: var(--muted); text-align: left; padding: 7px 14px; background: #20262f; border-bottom: 1px solid var(--line); }
.v td { padding: 7px 14px; border-bottom: 1px solid #262c36; color: #e8edf4; }
.v tr:last-child td { border-bottom: 0; }
.v tr.on td { background: rgba(47, 140, 255, .16); color: #fff; }
.v-grid table { border-spacing: 4px; padding: 4px; background: transparent; border: 0; }
.v-grid th { background: none; border: 0; padding: 0 6px; text-align: center; font-family: var(--mono); }
.v-grid td { min-width: 48px; height: 42px; text-align: center; background: #20262f; border: 1.5px solid var(--line2); border-radius: 8px; }
.v-grid td.on { background: rgba(47, 140, 255, .2); border-color: var(--blue); }
.v-grid td.res { background: rgba(47, 209, 107, .14); border-color: var(--green); color: #c9f7d9; }
.v-grid th.res { color: var(--green); }
.v-grid tr.resrow th { color: var(--green); }
.gwrap { display: inline-block; }
.axis-tag { font-size: 12.5px; color: var(--green); margin-top: 6px; }
.v-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.v-flow .fs { background: #20262f; border: 1px solid var(--line2); border-radius: 999px; padding: 6px 12px; font-size: 13px; font-family: var(--mono); }
.v-flow .fs.on { border-color: var(--green); background: rgba(47, 209, 107, .14); color: #d6f9e3; }
.v-flow .fa { color: var(--muted); }
.v-note { display: inline-block; max-width: 440px; border-radius: 14px; padding: 10px 14px; font-size: 14px; line-height: 1.45; border: 1px solid; }
.v-note.blue { background: rgba(47, 140, 255, .12); border-color: rgba(47, 140, 255, .45); }
.v-note.green { background: rgba(47, 209, 107, .1); border-color: rgba(47, 209, 107, .45); }
.v-note.yellow { background: rgba(246, 189, 43, .1); border-color: rgba(246, 189, 43, .5); }
.v-note.red { background: rgba(255, 71, 102, .1); border-color: rgba(255, 71, 102, .5); }
.v-out pre { margin: 0; background: #0f1318; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; font-size: 13px; }

.caption { flex: none; border-top: 1px solid var(--line); padding: 18px 32px 16px; }
.caption .ct { min-height: 58px; font-size: 16.5px; line-height: 1.6; max-width: 980px; }
.caption .ct p { margin: 0 0 6px; }
.caption .keybox { margin-top: 8px; display: inline-block; background: rgba(47, 209, 107, .1); border: 1px solid rgba(47, 209, 107, .4); border-radius: 12px; padding: 8px 14px; font-size: 14.5px; }
.caption .keybox b { color: var(--green); margin-right: 6px; }
.navrow { display: flex; align-items: center; gap: 16px; margin-top: 14px; }
.navrow .prog { flex: 1; height: 4px; background: var(--raise2); border-radius: 4px; overflow: hidden; }
.navrow .prog i { display: block; height: 100%; background: var(--blue); border-radius: 4px; transition: width .3s; }
.navrow .cnt { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 48px; text-align: right; }

/* ---------- editor ---------- */
.ed { position: relative; display: flex; background: #151a21; border: 1px solid var(--line2); border-radius: 14px; overflow: hidden; min-height: 220px; }
.ed:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(47, 140, 255, .18); }
.ed-gut { order: -1; flex: none; width: 46px; padding: 14px 10px 14px 0; overflow: hidden; text-align: right; font-family: var(--mono); font-size: 14px; line-height: 1.65; color: #4c5564; user-select: none; background: #12161c; border-right: 1px solid #222832; }
.ed-gut b { display: block; font-weight: 400; }
.ed-in { position: relative; flex: 1; min-width: 0; }
.ed-hl, .ed textarea {
  margin: 0; padding: 14px 16px; font-family: var(--mono); font-size: 14px; line-height: 1.65; tab-size: 4;
  white-space: pre; word-wrap: normal; overflow: auto; letter-spacing: 0;
}
.ed-hl { position: absolute; inset: 0; pointer-events: none; color: #e6ebf2; overflow: hidden; }
.ed textarea { position: relative; display: block; width: 100%; height: 100%; min-height: 220px; resize: none; border: 0; outline: 0; background: transparent; color: transparent; caret-color: #fff; }
.ed textarea::selection { background: rgba(47, 140, 255, .35); color: transparent; }

.ed-keys { display: flex; gap: 5px; overflow-x: auto; padding: 6px 0 2px; scrollbar-width: none; }
.ed-keys button { flex: none; min-width: 38px; height: 36px; border-radius: 8px; background: var(--raise2); border: 1px solid var(--line2); font-family: var(--mono); font-size: 15px; color: #fff; }
.ed-keys button:active { background: var(--blue); }

/* ---------- practice ---------- */
.practice { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.pr-head { display: flex; align-items: center; gap: 14px; padding: 14px 24px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.pr-head .lbl { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.pips { display: flex; gap: 6px; }
.pips i { width: 22px; height: 6px; border-radius: 4px; background: var(--raise2); }
.pips i.on { background: var(--blue); }
.pips i.ok { background: var(--green); }
.pips i.bad { background: var(--red); }
.pips i.skip { background: #5a6474; }
.pr-body { flex: 1; overflow: auto; padding: 22px 28px 26px; }
.pr-q { font-size: 16.5px; line-height: 1.55; max-width: 900px; }
.pr-q p { margin: 0 0 8px; }
.typetag { display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; margin-bottom: 10px; }
.typetag.quiz { background: rgba(155, 92, 255, .16); color: #d5bcff; }
.typetag.code { background: rgba(47, 140, 255, .16); color: var(--blue-t); }
.typetag.fix { background: rgba(255, 71, 102, .14); color: #ffb3c0; }
.opts { display: grid; gap: 10px; margin-top: 16px; max-width: 760px; }
.opt { text-align: left; display: flex; gap: 12px; align-items: flex-start; background: var(--raise); border: 1.5px solid var(--line2); border-radius: 12px; padding: 12px 16px; cursor: pointer; font-size: 15px; }
.opt:hover:not(:disabled) { border-color: #5b6880; }
.opt .ol { flex: none; width: 24px; height: 24px; border-radius: 7px; background: var(--raise2); display: grid; place-items: center; font-size: 12px; color: var(--muted); font-weight: 600; }
.opt pre { margin: 0; font-family: var(--mono); font-size: 14px; white-space: pre-wrap; }
.opt.right { border-color: var(--green); background: rgba(47, 209, 107, .1); }
.opt.wrong { border-color: var(--red); background: rgba(255, 71, 102, .08); }
.opt:disabled { cursor: default; }
.why { margin-top: 16px; max-width: 820px; border-radius: 12px; padding: 12px 16px; font-size: 15px; border: 1px solid; }
.why.ok { background: rgba(47, 209, 107, .08); border-color: rgba(47, 209, 107, .4); }
.why.no { background: rgba(255, 71, 102, .07); border-color: rgba(255, 71, 102, .4); }
.why .wt { font-weight: 700; margin-right: 6px; }
.why.ok .wt { color: var(--green); }
.why.no .wt { color: #ff8095; }
.workbench { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; margin-top: 16px; align-items: start; }
.workbench .ed { min-height: 300px; }
.workbench .ed textarea { min-height: 300px; }
.wb-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.wb-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; align-items: center; }
.wb-actions .tip { font-size: 12px; color: var(--muted); margin-left: auto; }
.results { background: #12161c; border: 1px solid var(--line); border-radius: 14px; padding: 6px 0; min-height: 120px; }
.results .ph { padding: 14px 16px; color: var(--muted); font-size: 14px; }
.o-sec { padding: 8px 16px; }
.o-h { font-size: 11.5px; letter-spacing: .07em; text-transform: uppercase; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.o-h.ok { color: var(--green); }
.o-h.err { color: #ff8095; }
.o-out, .o-err { margin: 0; font-size: 13px; white-space: pre-wrap; word-break: break-word; background: #0c0f13; border: 1px solid #222832; border-radius: 8px; padding: 8px 10px; max-height: 240px; overflow: auto; }
.o-err { color: #ffb3c0; }
.o-help { margin-top: 8px; font-size: 13.5px; color: var(--soft); background: rgba(246, 189, 43, .08); border: 1px solid rgba(246, 189, 43, .35); border-radius: 8px; padding: 8px 10px; }
.o-help b { color: var(--yellow); margin-right: 4px; }
.tests { display: grid; gap: 6px; }
.tr { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; }
.tr .tk { flex: none; width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.tr.pass .tk { background: rgba(47, 209, 107, .18); color: var(--green); }
.tr.fail .tk { background: rgba(255, 71, 102, .16); color: #ff8095; }
.tr code { white-space: pre-wrap; word-break: break-word; }
.tx { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.hintbox { background: rgba(246, 189, 43, .08); border: 1px solid rgba(246, 189, 43, .35); border-radius: 12px; padding: 10px 14px; font-size: 14px; }
.hintbox b { color: var(--yellow); }
.solbox h4 { margin: 0 0 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
.pr-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 24px; border-top: 1px solid var(--line); flex: none; }

/* results screen */
.donecard { max-width: 640px; margin: 40px auto; text-align: center; padding: 0 24px; }
.donecard h2 { font-size: 28px; margin: 10px 0 6px; }
.score { font-size: 54px; font-weight: 700; color: var(--green); line-height: 1; }
.donecard .btnrow { justify-content: center; margin-top: 22px; }

/* ---------- pages ---------- */
.page { padding: 28px 34px 40px; max-width: 1180px; width: 100%; }
.page h1 { font-size: 28px; margin: 0 0 6px; letter-spacing: -.01em; }
.page h2 { font-size: 19px; margin: 28px 0 10px; }
.page h3 { font-size: 16px; margin: 0 0 8px; }
.page p { max-width: 820px; }
.card { background: var(--raise); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.hero { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 18px; margin-top: 18px; }
.countdown { display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.countdown .big { font-size: 46px; font-weight: 700; line-height: 1; color: var(--yellow); }
.daygrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin-top: 12px; }
.daycard { display: block; background: var(--raise); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; color: var(--text); position: relative; overflow: hidden; }
.daycard:hover { border-color: var(--line2); text-decoration: none; background: #262d38; }
.daycard .dn { font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.daycard h3 { margin: 4px 0 4px; font-size: 16px; }
.daycard p { margin: 0 0 10px; font-size: 13px; color: var(--muted); }
.daycard .bar { height: 4px; background: var(--raise2); border-radius: 4px; overflow: hidden; }
.daycard .bar i { display: block; height: 100%; border-radius: 4px; }
.daycard .meta { font-size: 12px; color: var(--muted); margin-top: 6px; }
.daycard.today { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue) inset; }
.daycard .todaytag { position: absolute; top: 12px; right: 12px; font-size: 11px; font-weight: 700; color: var(--blue-t); }
.rules { margin: 0; padding-left: 18px; }
.rules li { margin-bottom: 6px; }
.sheet { columns: 2 380px; column-gap: 18px; }
.sheet .card { break-inside: avoid; margin-bottom: 14px; }
.sheet pre.code { font-size: 13px; }
.sheet .card p { margin: 0 0 8px; font-size: 14px; }
.keylist { margin: 0; padding-left: 18px; font-size: 14px; }
.keylist li { margin-bottom: 6px; }
.linkbox { background: #12161c; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 10px 0; overflow-wrap: anywhere; }
.linkbox code { background: none; border: 0; padding: 0; white-space: normal; }
.qr-box { width: 180px; background: #fff; border-radius: 12px; padding: 8px; }
.qr-box svg { display: block; width: 100%; height: auto; }
.sync-status { color: var(--green); }
.sync-status.err { color: var(--yellow); }

/* scratchpad */
.scratch { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 16px; margin-top: 14px; }
.scratch .ed, .scratch .ed textarea { min-height: 420px; }

/* mock test */
.mock-top { display: flex; align-items: center; gap: 14px; padding: 12px 22px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.timer { font-family: var(--mono); font-size: 20px; font-weight: 600; color: var(--yellow); }
.timer.low { color: var(--red); animation: pulse 1s infinite; }
.lvtabs { display: flex; gap: 6px; flex-wrap: wrap; }
.lvtabs button { background: var(--raise); border: 1px solid var(--line2); border-radius: 8px; padding: 5px 11px; font-size: 13px; cursor: pointer; color: var(--soft); }
.lvtabs button.on { border-color: var(--blue); color: #fff; }
.lvtabs button.done { border-color: var(--green); color: #c9f7d9; }
.lvtabs button:disabled { opacity: .4; cursor: default; }
.mock-body { flex: 1; display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.3fr); min-height: 0; }
.mock-spec { overflow: auto; padding: 18px 22px; border-right: 1px solid var(--line); font-size: 15px; }
.mock-spec h3 { margin-top: 0; }
.mock-work { display: flex; flex-direction: column; min-height: 0; padding: 14px 18px; gap: 10px; overflow: auto; }
.mock-work .ed { flex: 1; min-height: 340px; }
.mock-work .ed textarea { min-height: 340px; }
.hist { width: 100%; border-collapse: collapse; font-size: 14px; }
.hist td, .hist th { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.hist th { color: var(--muted); font-weight: 600; font-size: 12px; }

#toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px); background: #0f1318; border: 1px solid var(--line2); color: #fff; padding: 10px 18px; border-radius: 12px; font-size: 14px; opacity: 0; pointer-events: none; transition: .25s; z-index: 50; box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .7); }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.scrim { display: none; }

/* ---------- smaller screens ---------- */
@media (max-width: 1100px) {
  .scene { grid-template-columns: 1fr; align-items: start; }
  .workbench { grid-template-columns: 1fr; }
  .mock-body { grid-template-columns: 1fr; }
  .mock-spec { border-right: 0; border-bottom: 1px solid var(--line); max-height: 40vh; }
  .hero, .scratch { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .desk { grid-template-columns: 1fr; padding: 0; height: auto; min-height: 100vh; min-height: 100dvh; }
  .win { border-radius: 0; border: 0; min-height: 100vh; min-height: 100dvh; }
  .side { position: fixed; z-index: 40; top: 0; bottom: 0; left: 0; width: 290px; border-radius: 0 18px 18px 0; transform: translateX(-105%); transition: transform .25s; }
  .side.open { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; background: rgba(8, 10, 14, .55); z-index: 30; opacity: 0; pointer-events: none; transition: opacity .25s; }
  .scrim.show { opacity: 1; pointer-events: auto; }
  .menu-btn { display: inline-flex; }
  .lights { display: none; }
  .wtitle { position: static; transform: none; max-width: none; flex: 1; font-size: 13px; }
  .pystat span { display: none; }
  .foot { display: none; }
  #app { overflow: visible; }
  .scene { padding: 14px 14px; gap: 14px; }
  .caption { padding: 14px 16px 12px; position: sticky; bottom: 0; background: var(--panel); z-index: 5; }
  .caption .ct { font-size: 15.5px; min-height: 0; }
  pre.code { font-size: 13px; }
  pre.code .ln b { width: 28px; margin-right: 10px; }
  .pr-body { padding: 16px 14px 20px; }
  .pr-head, .pr-foot { padding: 10px 14px; }
  .pr-foot { position: sticky; bottom: 0; background: var(--panel); }
  .page { padding: 20px 16px 30px; }
  .ed-hl, .ed textarea { font-size: 13px; padding: 12px; }
  .ed-gut { font-size: 13px; width: 34px; padding: 12px 6px 12px 0; }
  .cell, .cell .box { min-width: 38px; }
  .cell .box { height: 40px; font-size: 13px; padding: 0 7px; }
  .mock-top { padding: 10px 14px; }
}
