/* Python Practice — dark workspace */
:root {
  color-scheme: dark;
  --page: #101513;
  --header: #141917;
  --sidebar: #131917;
  --panel: #1a201d;
  --editor: #101714;
  --editor-gutter: #131a17;
  --console: #151b18;
  --surface: #1e2621;
  --surface-hover: #263029;
  --line: #303932;
  --line-soft: #27302a;
  --ink: #e7eae5;
  --ink-secondary: #bbc6bc;
  --muted: #8f9d91;
  --faint: #6f8073;
  --accent: #9ebaa4;
  --accent-strong: #b4d4bc;
  --accent-surface: #2c4033;
  --red: #e4a299;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, ui-sans-serif, sans-serif;
  --ease: cubic-bezier(.2, .75, .25, 1);
}

* { box-sizing: border-box; }
html { height: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--page); color: var(--ink); font: 14px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .35; cursor: not-allowed; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
pre { margin: 0; font-family: var(--mono); }
[hidden] { display: none !important; }
::selection { background: #486953; color: #fff; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #455247; border: 2px solid transparent; background-clip: padding-box; border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

/* Primary navigation */
.topbar {
  position: sticky; top: 0; z-index: 30; height: 64px;
  display: grid; grid-template-columns: 258px minmax(0, 1fr) auto;
  align-items: stretch; background: var(--header); border-bottom: 1px solid var(--line);
}
.brand-wrap { display: flex; align-items: center; gap: 12px; padding: 0 21px; border-right: 1px solid var(--line); }
.mark {
  width: 31px; height: 31px; display: grid; place-items: center;
  font: 600 12px var(--mono); letter-spacing: -.05em; color: var(--accent);
  border: 1px solid #506255; border-radius: 4px;
}
.wordmark { display: flex; flex-direction: column; gap: 0; }
.wordmark strong { font-size: 12px; font-weight: 650; letter-spacing: -.01em; color: var(--ink); }
.wordmark small { color: var(--faint); font: 10px/1.5 var(--mono); }
.main-nav { display: flex; align-self: stretch; gap: 29px; margin-left: 34px; }
.nav-link {
  position: relative; background: none; border: 0; padding: 0 2px;
  color: var(--muted); font-size: 12px; font-weight: 520;
  transition: color .18s var(--ease);
}
.nav-link:hover, .nav-link.active { color: var(--ink); }
.nav-link.active::after { content: ""; height: 2px; position: absolute; bottom: -1px; left: 0; right: 0; background: var(--accent); }
.top-right { display: flex; align-items: center; gap: 26px; padding: 0 25px; }
.top-progress { font: 11px var(--mono); color: var(--ink-secondary); white-space: nowrap; }
.top-indicator { font: 10px var(--mono); color: var(--faint); white-space: nowrap; }
.mobile-menu { display: none; }

/* Index rail */
.shell { display: grid; grid-template-columns: 258px minmax(0, 1fr); align-items: start; min-height: calc(100vh - 64px); }
.sidebar {
  position: sticky; top: 64px; height: calc(100vh - 64px);
  overflow-y: auto; overflow-x: hidden; background: var(--sidebar); border-right: 1px solid var(--line);
  padding: 28px 13px 18px; display: flex; flex-direction: column;
}
.sidebar-header { padding: 4px 14px 25px; }
.section-eyebrow { color: var(--faint); font: 10px var(--mono); letter-spacing: .075em; }
.sidebar-header h2 { font-size: 23px; font-weight: 580; line-height: 1.15; margin: 17px 0 7px; letter-spacing: -.65px; }
.sidebar-header h2 span { color: var(--muted); }
.sidebar-header p { color: var(--muted); font-size: 11px; margin: 0; line-height: 1.6; }
.progress-card {
  margin: 0 7px 18px; padding: 16px 6px 14px;
  background: transparent; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft);
}
.progress-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.progress-top span { font: 10px var(--mono); color: var(--muted); letter-spacing: .04em; }
.progress-top strong { color: var(--ink); font: 500 17px var(--mono); }
.progress-top small { font: 11px var(--mono); color: var(--faint); }
.progress-track { height: 2px; background: #354137; overflow: hidden; margin: 14px 0 10px; }
.progress-bar { height: 100%; width: 0; background: var(--accent); transition: width .5s var(--ease); }
.progress-card p { font-size: 10px; color: var(--faint); margin: 0; }
.search-field {
  height: 37px; display: flex; align-items: center; gap: 10px; margin: 0 7px 17px; padding: 0 10px;
  background: #19211c; border: 1px solid var(--line); border-radius: 4px; color: var(--faint);
  transition: border-color .18s var(--ease);
}
.search-field:focus-within, .reference-search:focus-within { border-color: #789782; }
.search-field svg, .reference-search svg { width: 14px; height: 14px; flex: none; }
.search-field input { width: 100%; min-width: 0; flex: 1; border: 0; outline: none; background: transparent; color: var(--ink); font-size: 11px; }
.search-field input::placeholder, .reference-search input::placeholder { color: var(--faint); }
.search-field kbd { border: 1px solid #3b493e; border-radius: 3px; padding: 1px 5px; font: 10px var(--mono); color: var(--faint); }
.problem-list { flex: 1; padding-bottom: 18px; }
.level-heading { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 16px 12px 9px; }
.level-heading strong { font: 600 10px var(--mono); color: var(--muted); letter-spacing: .045em; }
.level-heading span { font: 9px var(--mono); color: var(--faint); }
.problem-item {
  display: flex; align-items: center; gap: 9px; min-height: 37px; padding: 0 10px 0 11px;
  width: 100%; text-align: left; background: transparent; border: 0; border-left: 2px solid transparent;
  border-radius: 2px; color: #a0aea3; transition: background .17s var(--ease), color .17s var(--ease), border-color .17s var(--ease);
}
.problem-item:hover { background: #202b24; color: var(--ink); }
.problem-item.active { background: #29372e; border-left-color: var(--accent); color: #e0eae1; }
.problem-item .index { width: 21px; flex: none; font: 10px var(--mono); color: var(--faint); }
.problem-item.active .index { color: var(--accent-strong); }
.problem-item .item-name { flex: 1; min-width: 0; font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-state { flex: none; width: 14px; height: 14px; border: 1px solid #425246; border-radius: 50%; display: grid; place-items: center; font-size: 9px; color: transparent; }
.item-state.solved { color: #152018; background: var(--accent); border-color: var(--accent); }
.no-results { padding: 15px; color: var(--muted); font-size: 12px; }
.sidebar-bottom { display: flex; justify-content: space-between; align-items: center; gap: 5px; border-top: 1px solid var(--line-soft); padding: 17px 5px 2px; font-size: 10px; color: var(--faint); white-space: nowrap; }
.text-action { color: var(--muted); padding: 0; border: 0; background: transparent; font-size: 10px; text-decoration: underline; text-decoration-color: #506153; text-underline-offset: 3px; }
.text-action:hover { color: var(--ink); }

/* Reading pane */
.content { min-width: 0; max-width: 100%; }
.practice-view { display: grid; grid-template-columns: minmax(0, 46%) minmax(0, 54%); align-items: start; min-height: calc(100vh - 64px); }
.problem-panel { min-width: 0; background: var(--panel); border-right: 1px solid var(--line); }
.problem-top { padding: 51px clamp(30px, 3.35vw, 58px) 35px; border-bottom: 1px solid var(--line); }
.problem-overline { display: flex; align-items: center; gap: 10px; font: 10px var(--mono); letter-spacing: .055em; color: var(--muted); }
.problem-overline .sep { color: var(--faint); }
.problem-headline { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin-top: 18px; }
.problem-headline h1 { margin: 0; max-width: 460px; color: var(--ink); font-size: clamp(28px, 2.55vw, 37px); font-weight: 590; line-height: 1.17; letter-spacing: -1.15px; }
.problem-score { flex: none; margin-top: 6px; font: 10px var(--mono); color: var(--faint); padding: 4px 0; white-space: nowrap; }
.tag-list { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 20px; }
.topic-tag { color: var(--accent); font: 10px var(--mono); }
.topic-tag:not(:last-child)::after { content: "/"; padding-left: 8px; color: #617366; }
.problem-description { max-width: 540px; margin: 24px 0 0; color: var(--ink-secondary); font-size: 13px; line-height: 1.8; }
.problem-body { padding: 33px clamp(30px, 3.35vw, 58px) 38px; }
.content-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 17px; }
.content-heading h3 { margin: 0; font-size: 13px; font-weight: 650; letter-spacing: -.06px; }
.content-heading span { font: 9px var(--mono); color: var(--faint); letter-spacing: .05em; }
.requirements { padding: 0; margin: 0; list-style: none; counter-reset: rule; }
.requirements li { position: relative; padding: 0 0 14px 31px; counter-increment: rule; color: var(--ink-secondary); font-size: 12.5px; line-height: 1.74; }
.requirements li::before { content: counter(rule, decimal-leading-zero); position: absolute; top: 2px; left: 0; font: 10px var(--mono); color: var(--faint); }
.public-heading { margin-top: 29px; }
.sample-block { overflow: hidden; background: #151c18; border: 1px solid #364339; border-radius: 4px; }
.sample-top { display: flex; align-items: center; justify-content: space-between; height: 33px; padding: 0 14px; border-bottom: 1px solid #354038; font: 9px var(--mono); color: var(--faint); }
.code-copy { background: none; border: 0; padding: 2px; font-size: 10px; color: var(--accent); }
.code-copy:hover { color: #e5f3e6; }
.sample-block pre { overflow-x: auto; padding: 16px 14px 18px; font: 11px/1.8 var(--mono); color: #b7d2bb; white-space: pre; tab-size: 4; }
.hidden-note { margin-top: 25px; padding-top: 18px; border-top: 1px solid var(--line); }
.hidden-note strong { font-size: 11px; font-weight: 600; }
.hidden-note p { margin: 6px 0 0; color: var(--muted); font-size: 11px; line-height: 1.75; }
.problem-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-top: 1px solid var(--line); padding: 19px clamp(30px, 3.35vw, 58px); }
.footer-link { display: flex; align-items: center; gap: 10px; border: 0; padding: 5px 0; background: transparent; color: var(--muted); font-size: 11px; font-weight: 600; }
.footer-link:hover:not(:disabled) { color: var(--accent-strong); }
.footer-link span { font-size: 16px; font-weight: 400; }
.footer-dots { display: none; }

/* Editor and evaluation */
.editor-panel {
  position: sticky; top: 64px; min-width: 0; height: calc(100vh - 64px); min-height: 605px;
  display: flex; flex-direction: column; background: var(--editor);
}
.editor-topbar { flex: none; height: 51px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 19px; background: var(--console); border-bottom: 1px solid var(--line); }
.file-tab { display: flex; align-items: center; gap: 10px; font: 600 11px var(--mono); }
.python-glyph { display: grid; place-items: center; width: 24px; height: 22px; border: 1px solid #4c6553; border-radius: 3px; color: var(--accent); font: 600 9px var(--mono); }
.unsaved-dot { height: 5px; width: 5px; border-radius: 50%; opacity: 0; background: #c6ab81; transition: opacity .2s var(--ease); }
.unsaved-dot.visible { opacity: 1; }
.editor-tools { display: flex; align-items: center; gap: 17px; }
.saved-label { color: var(--faint); font-size: 10px; }
.plain-tool { padding: 6px 0; border: 0; background: none; color: var(--muted); font-size: 10.5px; transition: color .18s var(--ease); }
.plain-tool:hover { color: var(--ink); }
.code-editor { display: flex; flex: 1 1 51%; min-height: 290px; overflow: hidden; background: var(--editor); border-bottom: 1px solid var(--line); }
.line-numbers { flex: none; width: 53px; padding: 23px 11px 24px 11px; overflow: hidden; pointer-events: none; user-select: none; white-space: pre; text-align: right; background: var(--editor-gutter); color: #607769; font: 12px/23px var(--mono); }
.code-editor textarea {
  display: block; flex: 1; width: 100%; height: 100%; min-width: 0; padding: 23px 20px 24px 10px;
  margin: 0; border: 0; outline: 0 !important; resize: none; background: transparent;
  color: #c8decd; caret-color: var(--accent-strong); font: 12px/23px var(--mono);
  letter-spacing: .008em; white-space: pre; overflow: auto; overflow-wrap: normal; tab-size: 4; overscroll-behavior: contain;
}
.code-editor textarea::selection { color: #fff; background: #395a45; }
.editor-actions { display: flex; flex: none; align-items: center; justify-content: space-between; gap: 15px; min-height: 68px; padding: 10px 20px; background: var(--console); border-bottom: 1px solid var(--line); }
.editor-shortcut { color: var(--faint); font: 10px var(--mono); white-space: nowrap; }
.editor-shortcut span { color: var(--muted); font: 10px var(--sans); }
.button-actions { display: flex; gap: 9px; }
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 10px 15px;
  border-radius: 4px; font-size: 11px; font-weight: 600; white-space: nowrap;
  transition: background .17s var(--ease), border-color .17s var(--ease), color .17s var(--ease), transform .22s var(--ease);
}
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:active:not(:disabled) { transform: translateY(0); }
.button svg { width: 14px; height: 14px; }
.button-run { color: #cbdbce; border: 1px solid #4b5b4f; background: #222b25; }
.button-run:hover:not(:disabled) { background: #2b392e; border-color: #6f8c74; }
.button-submit { color: #142018; background: #a6c2ab; border: 1px solid #a6c2ab; }
.button-submit:hover:not(:disabled) { background: #bfd7c2; border-color: #bfd7c2; }
.results-panel { display: flex; flex-direction: column; flex: 1 1 39%; min-height: 210px; min-width: 0; background: var(--console); overflow: hidden; }
.results-bar { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 21px; border-bottom: 1px solid var(--line-soft); }
.results-title { display: flex; align-items: center; gap: 10px; }
.results-title strong { font-size: 11.5px; font-weight: 630; }
.results-icon { color: var(--faint); font-size: 19px; }
.results-phase { margin-left: 7px; color: var(--faint); font: 10px var(--mono); }
.runtime { color: var(--faint); font: 10px var(--mono); }
.results-content { flex: 1; overflow: auto; padding: 17px 21px 27px; }
.empty-results { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 168px; text-align: center; }
.empty-symbol { color: #647d69; font: 20px var(--mono); margin-bottom: 11px; }
.empty-results h3 { margin: 0; color: var(--ink-secondary); font-size: 12px; font-weight: 580; }
.empty-results p { max-width: 300px; margin: 7px 0 0; color: var(--faint); font-size: 11px; line-height: 1.65; }
.result-summary { padding: 15px 16px; margin-bottom: 14px; background: #202d24; border: 1px solid #405744; border-left: 2px solid #95bb9d; border-radius: 3px; animation: enter .28s var(--ease) both; }
.result-summary.fail { background: #2a2422; border-color: #57403b; border-left-color: var(--red); }
.summary-main { display: flex; align-items: center; gap: 9px; }
.status-mark { width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; font-size: 12px; color: #b5d5b8; }
.fail .status-mark { color: var(--red); }
.summary-main strong { font-size: 12px; font-weight: 650; }
.summary-main span { margin-left: auto; font: 11px var(--mono); color: var(--muted); }
.result-summary p { margin: 8px 0 0; color: var(--muted); font-size: 10.5px; line-height: 1.6; }
.test-row { display: flex; align-items: flex-start; gap: 10px; padding: 11px 2px; border-bottom: 1px solid var(--line-soft); animation: enter .2s var(--ease) both; }
.test-status { display: grid; place-items: center; width: 15px; height: 16px; flex: none; font-size: 12px; color: var(--accent); }
.test-status.fail { color: var(--red); }
.test-text { flex: 1; min-width: 0; }
.test-text strong { font-size: 11px; font-weight: 570; }
.test-text p { margin: 6px 0 0; color: var(--red); font: 10.5px/1.55 var(--mono); overflow-wrap: anywhere; }
.test-time { color: var(--faint); font: 10px var(--mono); }
.hidden-result { margin-top: 14px; padding: 14px 2px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); }
.hidden-result strong { font-size: 11px; font-weight: 600; }
.hidden-result small { display: block; color: var(--faint); font-size: 10px; margin-top: 3px; }
.hidden-count { color: var(--accent); white-space: nowrap; font: 10px var(--mono); }
.output-box { margin-top: 14px; padding: 12px 14px; border: 1px solid var(--line); background: #101612; border-radius: 3px; }
.output-box strong { font: 10px var(--mono); color: var(--faint); }
.output-box pre { margin-top: 8px; white-space: pre-wrap; overflow-wrap: anywhere; font: 11px/1.55 var(--mono); color: #bdd3be; }
.error-block { background: #231e1c; border: 1px solid #503e39; border-radius: 3px; padding: 14px 16px; color: var(--red); font: 11px/1.65 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.loading-arc { display: inline-block; width: 15px; height: 15px; margin-right: 8px; vertical-align: middle; border: 2px solid #4e6352; border-top-color: var(--accent); border-radius: 50%; animation: spin .75s linear infinite; }

/* Searchable reference */
.reference-view { min-height: calc(100vh - 64px); background: var(--panel); padding: 0 46px 80px; }
.reference-container { max-width: 960px; margin: 0 auto; }
.reference-intro { padding: 71px 0 44px; border-bottom: 1px solid var(--line); }
.reference-intro h1 { margin: 18px 0 12px; font-size: clamp(37px, 4vw, 53px); font-weight: 580; line-height: 1.1; letter-spacing: -1.7px; }
.reference-intro p { max-width: 520px; color: var(--ink-secondary); font-size: 12px; line-height: 1.75; }
.reference-search { display: flex; align-items: center; gap: 12px; max-width: 480px; height: 43px; padding: 0 14px; margin-top: 29px; border: 1px solid #405146; border-radius: 4px; color: var(--muted); background: #171e19; transition: border-color .2s var(--ease); }
.reference-search input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 12px; }
.reference-section { padding: 39px 0 16px; border-bottom: 1px solid var(--line); animation: enter .27s var(--ease) both; }
.reference-section-header { display: flex; align-items: baseline; gap: 18px; margin-bottom: 18px; }
.reference-section-header .number { color: var(--faint); font: 11px var(--mono); }
.reference-section-header h2 { margin: 0; font-size: 22px; font-weight: 580; letter-spacing: -.5px; }
.reference-items { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 30px; margin-bottom: 21px; }
.reference-item { min-width: 0; padding: 17px 0 21px; border-top: 1px solid var(--line-soft); }
.reference-item header { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.reference-item header strong { font-size: 12px; font-weight: 600; }
.reference-item header span { color: var(--faint); font: 9px var(--mono); }
.reference-item p { margin: 7px 0 14px; font-size: 11px; color: var(--muted); line-height: 1.7; }
.reference-item pre { overflow-x: auto; padding: 15px 16px; background: #111814; border-left: 2px solid #455d4a; color: #b7d3bc; font: 11px/1.8 var(--mono); white-space: pre; }
.reference-end { padding: 30px 0 0; color: var(--faint); font: 10px var(--mono); letter-spacing: .04em; }
.toast { position: fixed; z-index: 70; bottom: 23px; right: 23px; padding: 13px 17px; border: 1px solid #607861; border-radius: 4px; background: #283a2d; color: #e6f0e6; font-size: 11.5px; opacity: 0; pointer-events: none; transform: translateY(8px); transition: opacity .23s var(--ease), transform .23s var(--ease); box-shadow: 0 12px 32px #080e0b70; }
.toast.show { opacity: 1; transform: translateY(0); }
.sidebar-overlay { display: none; }

@keyframes enter { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1270px) {
  .topbar { grid-template-columns: 240px minmax(0, 1fr) auto; }
  .shell { grid-template-columns: 240px minmax(0, 1fr); }
  .brand-wrap { padding-inline: 16px; }
  .sidebar { padding-inline: 9px; }
  .practice-view { grid-template-columns: minmax(0, 45%) minmax(0, 55%); }
  .problem-top, .problem-body { padding-inline: 27px; }
  .problem-footer { padding-inline: 27px; }
  .problem-headline h1 { font-size: 30px; }
  .top-indicator { display: none; }
  .top-right { padding-right: 20px; }
  .editor-shortcut { display: none; }
  .editor-actions { justify-content: flex-end; }
}
@media (max-width: 980px) {
  .topbar { grid-template-columns: auto minmax(0, 1fr) auto; }
  .shell { display: block; }
  .sidebar { position: fixed; z-index: 45; top: 64px; bottom: 0; left: 0; width: 258px; height: auto; transform: translateX(-106%); transition: transform .32s var(--ease); box-shadow: 16px 0 40px #04080780; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.show { display: block; position: fixed; z-index: 40; inset: 64px 0 0; background: #070b09bb; }
  .mobile-menu { display: grid; }
  .icon-button { display: grid; place-items: center; padding: 3px; border: 0; background: transparent; color: var(--ink); }
  .brand-wrap { border-right: 0; }
  .main-nav { margin-left: 10px; }
  .practice-view { grid-template-columns: minmax(0, 45%) minmax(0, 55%); }
  .problem-top, .problem-body { padding-inline: 22px; }
  .problem-footer { padding-inline: 22px; }
}
@media (max-width: 740px) {
  .topbar { height: 60px; }
  .sidebar { top: 60px; }
  .sidebar-overlay.show { inset: 60px 0 0; }
  .brand-wrap { padding: 0 14px; gap: 9px; }
  .wordmark small { display: none; }
  .main-nav { gap: 17px; margin-left: 8px; }
  .nav-link { font-size: 11px; }
  .top-right { padding-inline: 11px; }
  .top-progress { font-size: 10px; }
  .practice-view { display: block; }
  .problem-panel { border-right: 0; }
  .problem-top { padding: 35px 24px 28px; }
  .problem-body { padding: 28px 24px 37px; }
  .problem-headline h1 { font-size: 32px; }
  .problem-footer { padding: 17px 24px; }
  .editor-panel { position: static; height: auto; min-height: 0; border-top: 1px solid var(--line); }
  .editor-topbar { padding: 0 16px; }
  .code-editor { flex: none; height: 390px; min-height: 390px; }
  .editor-actions { padding: 12px 15px; }
  .results-panel { min-height: 250px; overflow: visible; }
  .results-content { overflow: visible; }
  .reference-view { padding: 0 23px 60px; }
  .reference-intro { padding-top: 45px; }
  .reference-items { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .mark { display: none; }
  .wordmark strong { font-size: 11px; }
  .main-nav { gap: 12px; margin-left: 1px; }
  .top-right { padding-inline: 9px; }
  .top-progress { font-size: 9px; }
  .problem-headline h1 { font-size: 29px; }
  .problem-score { font-size: 9px; }
  .editor-tools { gap: 10px; }
  .saved-label { display: none; }
  .button { padding: 10px 11px; font-size: 10.5px; }
  .button-actions { gap: 7px; }
  .reference-intro h1 { font-size: 38px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* Updated problem specification: required signature and reproducible output. */
.contract-block {
  margin: -2px 0 28px; padding: 14px 16px;
  background: #141c17; border-left: 2px solid #738c79;
  color: #d0dfd2; font: 11px/1.75 var(--mono);
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.expected-output {
  margin-top: 9px; background: #111813; border: 1px solid #354239; border-radius: 3px;
}
.expected-output > div {
  border-bottom: 1px solid #303d34; padding: 9px 13px; color: #96ac9a;
  font: 9px var(--mono); letter-spacing: .055em;
}
.expected-output pre { padding: 13px 14px 16px; white-space: pre-wrap; overflow-wrap: anywhere; color: #d4dfd4; font: 11px/1.7 var(--mono); }
.hidden-note { margin-top: 21px; }

/* Native textarea editing with an aligned, inert syntax layer underneath. */
.editor-code-layer { position: relative; flex: 1; min-width: 0; min-height: 0; overflow: hidden; }
.syntax-highlight, .code-editor .editor-code-layer textarea {
  position: absolute; inset: 0; display: block; width: 100%; height: 100%;
  margin: 0; padding: 23px 20px 24px 10px;
  border: 0; border-radius: 0; font: 12px/23px var(--mono); letter-spacing: .008em;
  white-space: pre; overflow-wrap: normal; word-break: normal; tab-size: 4;
}
.syntax-highlight { overflow: hidden; pointer-events: none; z-index: 1; color: #c8d8cb; background: transparent; }
.code-editor .editor-code-layer textarea {
  overflow: auto; z-index: 2; resize: none; outline: none; background: transparent;
  color: transparent; -webkit-text-fill-color: transparent; caret-color: #e1ebdc;
  overscroll-behavior: contain;
}
.code-editor .editor-code-layer textarea::selection { background: #52705d92; -webkit-text-fill-color: transparent; }
.tok-keyword { color: #a3c6b4; }
.tok-class-def { color: #d8d5a9; }
.tok-function-def { color: #a8c4d0; }
.tok-string { color: #cdb7a0; }
.tok-comment { color: #708377; font-style: italic; }
.tok-number { color: #ccbf94; }
.tok-constant { color: #bcceaa; }
.tok-builtin { color: #9bbdc5; }
.tok-decorator { color: #d5c2a0; }
.tok-self { color: #b0bba7; }
.tok-call { color: #d0dacc; }
.tok-attribute { color: #c0d2c7; }
.scratch-panel { flex: 0 0 auto; min-width: 0; background: #17201a; border-bottom: 1px solid var(--line); }
.scratch-panel > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 19px; cursor: pointer; user-select: none; color: #d2dfd4;
  font: 11px var(--sans); list-style: none;
}
.scratch-panel > summary::-webkit-details-marker { display: none; }
.scratch-panel > summary::before { content:'▸'; color: var(--faint); margin-right: 1px; font-size: 10px; transition: transform .2s var(--ease); }
.scratch-panel[open] > summary::before { transform: rotate(90deg); }
.scratch-panel > summary span { flex: 1; font-size: 10px; color: var(--faint); text-align: right; }
.scratch-panel textarea { display: block; width: 100%; height: 102px; padding: 12px 17px; resize: vertical; border: 0; border-top: 1px solid #2e3a31; outline: none; background: #101714; color: #c0d6c6; font: 11px/1.6 var(--mono); tab-size: 4; }
.scratch-tools { padding: 0 17px 8px; text-align: right; }
.scratch-tools .plain-tool { color: var(--accent); }
.button-dry { color: #bfdbca; border: 1px solid #3c5444; background: #19291f; }
.button-dry:hover:not(:disabled) { background: #283d2d; border-color: #66886f; }

/* Timed exam: uses the same problem/editor workspace. */
.is-exam .shell { display: block; }
.is-exam .sidebar { display: none; }
.is-exam .editor-panel { top: 160px; height: calc(100vh - 160px); min-height: 550px; }
.is-exam #runButton, .is-exam #submitButton { display: none; }
.is-exam .practice-view { grid-template-columns: minmax(0, 46%) minmax(0, 54%); }
.exam-bar {
  position: sticky; top: 64px; z-index: 25; border-bottom: 1px solid #43574a;
  padding: 12px clamp(22px, 3vw, 45px) 10px;
  background: #17231b; box-shadow: 0 12px 25px #07100930;
}
.exam-bar-top { display: flex; justify-content: space-between; align-items: center; gap: 15px; }
.exam-bar-top > div:first-child { display: flex; flex-direction: column; gap: 2px; }
.exam-bar-top strong { font-size: 12px; font-weight: 620; }
.exam-small { font: 9px var(--mono); color: var(--accent); letter-spacing: .06em; }
.exam-timer { color: var(--accent-strong); font: 600 22px var(--mono); letter-spacing: -.03em; margin-left: auto; }
.exam-timer.urgent { color: var(--red); }
.exam-question-nav { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.exam-question { position: relative; display: grid; place-items: center; width: 31px; height: 27px; border: 1px solid #3b4b3f; border-radius: 2px; background: #1a2920; color: #adbaaf; font: 11px var(--mono); }
.exam-question:hover { border-color: #789482; }
.exam-question.active { background: #a2c2a8; color: #132218; border-color: #a2c2a8; }
.exam-question.answered::after { content:''; position: absolute; bottom: 2px; width: 3px; height: 3px; background: #90bca0; border-radius: 50%; }
.exam-question span { display: none; }

.mock-view { min-height: calc(100vh - 64px); padding: 72px 30px 80px; background: var(--panel); }
.mock-container { max-width: 850px; margin: auto; }
.mock-heading { border-bottom: 1px solid var(--line); padding-bottom: 36px; }
.mock-heading h1 { font-size: clamp(33px,4vw,49px); font-weight: 590; letter-spacing: -1.4px; line-height: 1.12; margin: 17px 0 12px; }
.mock-heading p { color: var(--ink-secondary); font-size: 12px; margin: 0; }
.mock-setup { padding: 33px 0; border-bottom: 1px solid var(--line); }
.mock-setup h2, .mock-history h2 { margin: 0 0 23px; font-size: 17px; font-weight: 600; }
.mock-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.mock-fields label { display: flex; flex-direction: column; gap: 9px; font: 11px var(--sans); color: #b6c6ba; }
.mock-fields select { width: 100%; background: #121a15; border: 1px solid #3a4a3f; color: var(--ink); border-radius: 3px; padding: 11px; outline: none; font: 12px var(--sans); }
.mock-fields select:focus-visible { outline: 1px solid var(--accent); }
.mock-setup-footer { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-top: 27px; }
.mock-setup-footer span { color: var(--faint); font-size: 11px; }
.active-exam-notice { padding: 16px 18px; background: #233529; border: 1px solid #49634f; margin-top: 20px; display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.active-exam-notice div { display: flex; flex-direction: column; gap: 3px; }
.active-exam-notice strong { font-size: 12px; }
.active-exam-notice span { font-size: 11px; color: var(--muted); }
.mock-history { margin-top: 38px; }
.mock-history-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.muted-note { color: var(--faint); font-size: 12px; }
.exam-record { border-top: 1px solid var(--line); padding: 16px 0; }
.exam-record.latest { border-top-color: #729077; }
.record-head { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.record-head > div { display: flex; flex-direction: column; gap: 3px; }
.record-head span { font: 10px var(--mono); color: var(--faint); }
.record-head strong { font: 600 17px var(--mono); }
.record-head small { font-size: 10px; color: var(--muted); }
.record-detail { margin-top: 15px; border-top: 1px solid var(--line-soft); }
.exam-report-row { display: grid; grid-template-columns: 32px minmax(120px,1fr) 100px 115px; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line-soft); font-size: 11px; }
.exam-report-row > span:first-child { font: 10px var(--mono); color: var(--faint); }
.exam-report-row strong { font-weight: 540; }
.exam-report-row span.good { color: var(--accent-strong); }
.exam-report-row span.bad { color: var(--red); }
.exam-report-row small { color: var(--muted); font: 10px var(--mono); text-align: right; }

@media (max-width: 1270px) {
  .button-actions { gap: 6px; }
  .editor-actions { padding-inline: 12px; }
  .button { padding: 10px 11px; }
}
@media (max-width: 980px) {
  .is-exam .practice-view { grid-template-columns: minmax(0,45%) minmax(0,55%); }
}
@media (max-width: 740px) {
  .is-exam .practice-view { display: block; }
  .is-exam .editor-panel { position: static; height: auto; min-height: 0; }
  .exam-bar { top: 60px; }
  .exam-bar-top .button { padding: 9px 10px; }
  .exam-timer { font-size: 19px; }
  .mock-view { padding: 36px 23px 70px; }
  .mock-fields { grid-template-columns: 1fr; }
  .mock-setup-footer { align-items: flex-start; flex-direction: column; }
  .exam-report-row { grid-template-columns: 22px minmax(0,1fr) 80px; }
  .exam-report-row small { grid-column: 2 / 4; text-align: left; }
}
@media (max-width: 530px) {
  .main-nav { gap: 11px; }
  .nav-link { font-size: 10px; }
  .top-right { padding-inline: 8px; }
  .top-progress { font-size: 9px; }
  .button-actions { flex-wrap: wrap; justify-content: flex-end; }
  .button { padding: 9px; }
  .editor-actions { min-height: 60px; }
  .scratch-panel > summary span { font-size: 9px; }
}
@media (max-width: 530px) {
  .topbar { grid-template-columns: auto minmax(0,1fr); }
  .top-right { display: none; }
  .main-nav { justify-content: flex-end; margin-left: 0; gap: 13px; padding-right: 13px; }
  .nav-link { white-space: nowrap; font-size: 10px; }
  .brand-wrap { padding-inline: 11px; }
}

/* Inline diagnostics: keeps the offline textarea editor and its native undo. */
.diagnostic-overlay {
  position: absolute; inset: 0; display: block; width: 100%; height: 100%;
  margin: 0; padding: 23px 20px 24px 10px; border: 0;
  font: 12px/23px var(--mono); letter-spacing: .008em;
  white-space: pre; overflow-wrap: normal; word-break: normal; tab-size: 4;
  overflow: hidden; pointer-events: none; z-index: 2; color: transparent;
}
.code-editor .editor-code-layer textarea { z-index: 3; }
.diag-squiggle { color: transparent; text-decoration-line: underline; text-decoration-style: wavy; text-underline-offset: 4px; text-decoration-thickness: 1.4px; }
.diag-error { text-decoration-color: #e59b94; }
.diag-warning { text-decoration-color: #d9b879; }
.gutter-error { color: #e59b94; }
.gutter-warning { color: #d9b879; }
.diagnostics-status { flex: none; max-width: 160px; padding: 4px 7px; border: 1px solid transparent; background: transparent; border-radius: 3px; color: #91ab98; font: 10px var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.diagnostics-status:hover { border-color: #435448; }
.diagnostics-status.has-errors { color: #e2a49c; }
.diagnostics-status.has-warnings { color: #d5bc88; }
.results-title { gap: 4px; min-width: 0; }
.results-title .results-phase { margin-left: 12px; }
.results-tab { border: 0; border-radius: 0; background: transparent; padding: 5px 9px; color: var(--faint); font-size: 11px; font-weight: 590; white-space: nowrap; }
.results-tab:hover { color: var(--ink-secondary); }
.results-tab.selected { color: var(--ink); box-shadow: inset 0 -1px var(--accent); }
.results-tab span { margin-left: 4px; color: var(--faint); font: 10px var(--mono); }
.results-tab.has-errors span { color: #e2a49c; }
.problems-content { padding-top: 5px; }
.diagnostic-row { width: 100%; display: flex; align-items: baseline; gap: 11px; text-align: left; background: transparent; border: 0; border-bottom: 1px solid var(--line-soft); padding: 12px 3px; color: var(--ink-secondary); }
.diagnostic-row:hover { background: #222a2436; }
.diagnostic-symbol { width: 15px; font: 600 13px var(--mono); flex: none; }
.diagnostic-symbol.error { color: #e2a49c; }
.diagnostic-symbol.warning { color: #d5bc88; }
.diagnostic-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.diagnostic-text strong { font-size: 11px; font-weight: 500; line-height: 1.5; overflow-wrap: anywhere; }
.diagnostic-text small { color: var(--faint); font: 10px var(--mono); }
.diagnostic-severity { color: var(--faint); font: 9px var(--mono); text-transform: uppercase; }
.problems-empty { padding: 30px 5px; text-align: center; color: var(--muted); font-size: 11px; }
.diagnostics-footnote { color: var(--faint); font-size: 10px; margin: 14px 0 3px; }
@media (max-width: 1180px) { .diagnostics-status { max-width: 125px; } }
@media (max-width: 530px) {
  .editor-tools { gap: 8px; }
  .diagnostics-status { max-width: 105px; font-size: 9px; }
  .results-bar { padding-inline: 10px; }
  .results-title .results-phase { display: none; }
  .results-tab { padding: 5px 7px; }
}

/* Editor interaction: quiet, utilitarian affordances rather than decorative chrome. */
.current-line-highlight {
  position:absolute;left:0;right:0;height:23px;pointer-events:none;z-index:0;
  background:rgba(140,178,147,.042);
}
.indent-guides {
  position:absolute;inset:0;width:100%;height:100%;margin:0;
  padding:23px 20px 24px 10px;overflow:hidden;pointer-events:none;z-index:1;
  background:transparent;color:transparent;white-space:pre;
  font:12px/23px var(--mono);letter-spacing:.008em;tab-size:4;
}
.indent-guide-chunk { position:relative;color:transparent; }
.indent-guide-chunk::before {
  content:'';position:absolute;left:0;top:-3px;bottom:-3px;
  border-left:1px solid #3b4f40;opacity:.78;
}
.gutter-active { color:#b6c7b8; }
.editor-status {
  display:flex;align-items:center;gap:18px;min-height:26px;flex:none;
  border-bottom:1px solid var(--line);padding:3px 15px;
  font:10px var(--mono);color:#8fa293;background:#171f1a;
}
.editor-key-hint { margin-left:auto;color:#6d8272; }
.code-completions {
  position:absolute;z-index:8;max-height:268px;width:246px;overflow:auto;
  border:1px solid #526755;background:#19251d;box-shadow:0 12px 30px #060b0788;
  border-radius:4px;padding:4px;
}
.code-completions[hidden] {display:none;}
.completion-option {
  display:flex;align-items:center;gap:9px;width:100%;height:31px;border:0;
  border-radius:3px;background:none;color:#c8d9cb;text-align:left;
  padding:0 7px;font:11px var(--mono);white-space:nowrap;
}
.completion-option:hover,.completion-option.active {background:#2e4434;}
.completion-symbol {
  flex:none;display:grid;place-items:center;width:17px;height:17px;
  border-radius:3px;background:#34493a;color:#b9d4be;font:700 10px var(--mono);
}
.completion-symbol.function {color:#a8c4d0;}
.completion-symbol.class {color:#d8d5a9;}
.completion-symbol.keyword {color:#a3c6b4;}
.completion-name {flex:1;overflow:hidden;text-overflow:ellipsis;}
.completion-kind {color:#78907f;font:9px var(--mono);}

/* Public test input and expected result are visible before execution. */
.public-cases-preview {border-top:1px solid var(--line-soft);margin:0 0 24px;}
.public-case-preview {border-bottom:1px solid var(--line-soft);}
.public-case-preview > summary {
  display:flex;align-items:center;gap:11px;cursor:pointer;padding:13px 2px;
  color:#becfc0;list-style:none;font-size:11px;
}
.public-case-preview > summary::-webkit-details-marker {display:none;}
.public-case-preview > summary::after {content:'+';color:#91a996;margin-left:0;font:15px var(--mono);}
.public-case-preview[open] > summary::after {content:'−';}
.public-case-preview > summary span {color:#6e8776;font:10px var(--mono);}
.public-case-preview > summary strong {flex:1;font-weight:550;}
.public-case-preview > summary small {font:9px var(--mono);color:#78947d;letter-spacing:.04em;}
.public-case-content {padding:2px 0 15px 21px;}
.case-label {font:9px var(--mono);letter-spacing:.065em;color:#82a08a;margin:12px 0 7px;}
.public-case-content pre,.test-case-columns pre {
  margin:0;padding:11px 12px;background:#121a15;color:#b4c6b9;border:1px solid #314137;
  font:11px/1.7 var(--mono);overflow:auto;white-space:pre-wrap;overflow-wrap:anywhere;
}

/* Ordered test runner with actual vs expected comparison details. */
.test-group-label {font:9px var(--mono);letter-spacing:.08em;color:#809885;padding:15px 20px 9px;}
.test-case-result {border-top:1px solid var(--line-soft);}
.test-case-result > summary {
  display:flex;align-items:center;gap:10px;padding:13px 20px;cursor:pointer;
  list-style:none;color:#c8d6c9;font-size:11px;
}
.test-case-result > summary::-webkit-details-marker {display:none;}
.test-case-result > summary:hover {background:#243027;}
.test-case-result > summary::after {content:'⌄';color:#7d9984;font:15px var(--mono);margin-left:2px;}
.test-case-result[open] > summary::after {content:'⌃';}
.test-case-result > summary strong {flex:1;font-weight:540;min-width:0;}
.test-order {color:#667c6c;font:10px var(--mono);}
.test-status {display:grid;place-items:center;width:19px;height:19px;border:1px solid #405e49;border-radius:50%;color:#94b89e;line-height:1;flex:none;}
.test-status.failed {color:#e9a89e;border-color:#9e5951;}
.test-status.not_run {color:#6a8370;border-color:#455349;}
.test-state-label {text-transform:uppercase;color:#789784;font:9px var(--mono);}
.test-case-result.failed .test-state-label {color:#de9f96;}
.test-case-result.not_run .test-state-label {color:#708171;}
.test-case-body {padding:0 20px 17px 49px;}
.test-case-columns {display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:12px;}
.test-case-columns section {min-width:0;}
.test-case-columns pre {max-height:190px;font-size:10px;line-height:1.65;}
.test-case-result .muted-note {font-size:10px;margin:10px 0;}
.test-error {font:11px/1.6 var(--mono);color:#e8a9a2;margin:6px 0;overflow-wrap:anywhere;}
.test-error-location {font:10px var(--mono);color:#a5bba9;margin:5px 0 11px;}
.observed-heading {font:9px var(--mono);letter-spacing:.07em;color:#87a48e;margin:15px 0 5px;}
.observed-row {border-top:1px solid #344238;padding:9px 0;}
.observed-row.mismatch {border-left:2px solid #bd7870;padding-left:9px;background:#34241f35;}
.observed-expression {color:#9ab3a2;font:10px/1.55 var(--mono);overflow-wrap:anywhere;margin-bottom:6px;}
.observed-pair {display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:12px;}
.observed-pair > div {min-width:0;}
.observed-pair span {display:block;font:9px var(--mono);color:#718d79;margin-bottom:5px;}
.observed-pair code {display:block;color:#cbdccc;font:11px/1.6 var(--mono);white-space:pre-wrap;overflow-wrap:anywhere;}
.observed-row.mismatch .observed-pair > div:last-child code {color:#e9a99f;}
.hidden-result {gap:10px;align-items:center;}
.hidden-count {text-align:right;max-width:55%;font:10px/1.6 var(--mono);}
@media(max-width:600px){
  .test-case-columns,.observed-pair {grid-template-columns:minmax(0,1fr);}
  .test-case-body {padding:0 12px 14px 22px;}
  .test-case-result > summary {padding-inline:12px;gap:7px;}
  .editor-key-hint {display:none;}
  .editor-status {gap:11px;font-size:9px;}
}


/* v7 — editorial Thai workspace, compact left rail and focus mode */
:root{--sans:"Noto Sans Thai","Leelawadee UI",Tahoma,"Segoe UI",sans-serif;--accent:#9eb9a4;--ink:#e9eee9;--panel:#1a211e}
body{font-size:13px;letter-spacing:0}
button{font-family:inherit}
.sidebar-collapse{display:grid;place-items:center;flex:none;width:31px;height:31px;color:#a9b7ac;background:none;border:1px solid transparent;border-radius:4px;padding:6px;transition:background .18s var(--ease),color .18s var(--ease)}
.sidebar-collapse:hover{background:#27332b;color:var(--ink)}
.sidebar-collapse svg{width:19px;height:19px}
.brand-wrap{gap:9px;padding-inline:15px}
.wordmark small{font-family:var(--sans);letter-spacing:0;font-size:10px}
.main-nav{gap:30px;margin-left:30px}
.nav-link{font-size:12px;font-weight:560}
.problem-description{font-size:13.2px;line-height:1.9;max-width:600px}
.problem-body{padding-top:28px}
.problem-headline h1{font-size:clamp(25px,2.4vw,34px);font-weight:620;line-height:1.38;letter-spacing:-.04em}
.problem-jump{display:flex;gap:16px;margin-top:19px;padding:12px 0 0;border-top:1px solid #303a32}
.problem-jump button{border:0;background:transparent;padding:0;color:#8ca394;font-size:11px}
.problem-jump button:hover{color:var(--accent-strong)}
.io-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-bottom:29px}
.io-entry{min-width:0;padding:16px;background:#161d19;border:1px solid #344037;border-radius:4px}
.io-entry strong{display:block;font-size:11px;font-weight:620;color:#b4c7b8;margin-bottom:8px}
.io-entry p{margin:0;font:11.3px/1.9 var(--sans);color:#ccd5cc;overflow-wrap:anywhere}
.requirements li{font-size:12.7px;line-height:1.85;padding-bottom:15px}
.contract-block{font-size:11px;line-height:1.8}
.editor-panel{min-width:0}
.editor-tools{gap:12px}
.focus-toggle{color:var(--accent)}
#shortcutDialog{border:1px solid #405245;border-radius:8px;background:#1b241e;color:#e8eee9;padding:23px 26px;width:min(500px,calc(100vw - 32px));box-shadow:0 28px 85px #0008}
#shortcutDialog::backdrop{background:#070b09ba;backdrop-filter:blur(3px)}
.dialog-head{display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid #334237;padding-bottom:13px;margin-bottom:16px}
.dialog-head h2{margin:0;font-size:18px;font-weight:600}
.shortcut-grid{display:grid;grid-template-columns:1fr auto;gap:13px;align-items:center;color:#bdc8bf;font-size:12px}
.shortcut-grid kbd{font:11px/1 var(--mono);padding:6px 8px;background:#101712;border:1px solid #3e5142;border-radius:4px}
.sidebar-rail{display:none}
@media(min-width:981px){
  .topbar,.shell{transition:grid-template-columns .26s var(--ease)}
  body.sidebar-collapsed .topbar{grid-template-columns:60px minmax(0,1fr) auto}
  body.sidebar-collapsed .shell{grid-template-columns:60px minmax(0,1fr)}
  body.sidebar-collapsed .brand-wrap{justify-content:center;padding:0}
  body.sidebar-collapsed .brand-wrap .wordmark,body.sidebar-collapsed .brand-wrap .mark,body.sidebar-collapsed .brand-wrap .mobile-menu{display:none}
  body.sidebar-collapsed .sidebar{padding:21px 6px;align-items:center}
  body.sidebar-collapsed .sidebar-header,body.sidebar-collapsed .progress-card,body.sidebar-collapsed .problem-list,body.sidebar-collapsed .sidebar-bottom{display:none}
  body.sidebar-collapsed .sidebar-rail{display:flex;flex-direction:column;align-items:center;gap:9px;width:100%}
  .rail-level{width:39px;height:35px;display:grid;place-items:center;color:#a3b0a5;background:transparent;border:1px solid transparent;border-radius:4px;font:11px var(--mono)}
  .rail-level:hover{background:#28352c;color:#c5e1c9;border-color:#38493c}
  body.editor-focused .practice-view{grid-template-columns:minmax(0,1fr)}
  body.editor-focused .problem-panel{display:none}
  body.editor-focused .code-editor{min-height:52vh}
  body.editor-focused .editor-panel{max-width:none}
}
@media(max-width:980px){
  .sidebar-collapse{display:none}
}
@media(max-width:740px){
  .io-grid{grid-template-columns:1fr}
  .problem-jump{gap:11px}
  .problem-jump button{font-size:10.5px}
  .editor-tools{gap:9px}
}
@media(max-width:530px){
  #focusEditor{display:none}
  .problem-body{padding-inline:20px}
  .problem-top{padding-inline:20px}
  .editor-tools #shortcutsHelp{display:none}
}
@media(prefers-reduced-motion:reduce){
  .topbar,.shell{transition:none}
}

.share-notice{display:flex;align-items:center;gap:15px;padding:11px 24px;background:#243429;border-bottom:1px solid #425845;color:#c0d4c3;font-size:11px;line-height:1.65}
.share-notice strong{color:#d8eadb;white-space:nowrap;font-weight:650}
@media(max-width:740px){.share-notice{flex-direction:column;align-items:flex-start;gap:3px;padding-inline:18px}}

.mobile-jump{display:none}
@media(max-width:740px){
  .mobile-jump{display:inline-flex;align-items:center;justify-content:center;border:1px solid #445648;background:#233228;color:#c2d8c6;font-size:11.5px;border-radius:4px;padding:9px 13px;margin-top:16px}
  .back-to-problem{margin:0 9px 0 0;padding:5px 7px;font-size:10px}
  .problem-jump{margin-top:14px}
  .requirements li{font-size:13.2px;line-height:1.85}
  .problem-description{font-size:13.3px}
}
/* Semantic tokens: restrained coding palette, distinct roles without neon. */
.tok-class-def, .tok-class-ref{color:#d6c6a0}
.tok-function-def,.tok-function-call,.tok-function-ref{color:#96c3d0}
.tok-method-def,.tok-method-call{color:#99cdb6}
.tok-parameter,.tok-parameter-ref{color:#d9b49a}
.tok-variable{color:#c8d1c7}
.tok-module{color:#b6b4d4}
.tok-attribute{color:#b7c8b8}
.tok-operator{color:#aebcb1}
.tok-keyword{color:#a6b8d0}
.tok-builtin{color:#bbc7a3}
.tok-decorator{color:#c9b5d2}
.tok-string{color:#cdb59b}
.tok-number{color:#d3bc8e}
.tok-comment{color:#70867a}
.tok-self{color:#c2d0bd}
.editor-legend{display:flex;align-items:center;gap:12px;padding:7px 16px 7px 9px;color:#8e9e92;font:10px var(--mono);border-bottom:1px solid var(--line-soft);flex-wrap:wrap}
.editor-legend span{display:inline-flex;gap:5px;align-items:center}
.editor-legend i{display:inline-block;width:6px;height:6px;border-radius:1px;background:var(--legend)}
.stdin-label{display:flex;justify-content:space-between;gap:12px;align-items:center;font:10px var(--mono);letter-spacing:.02em;color:#b0c1b2;padding:15px 16px 8px}
.stdin-label small{font:11px/1.6 var(--font);letter-spacing:0;color:var(--muted)}
.stdin-input{display:block!important;width:calc(100% - 32px)!important;min-height:86px!important;max-height:200px!important;margin:0 16px 17px!important;padding:12px!important;border:1px solid var(--line)!important;border-radius:4px!important;background:#111a15!important;color:var(--ink)!important;font:12px/1.6 var(--mono)!important;resize:vertical!important}
.stdin-input:focus{outline:1px solid #7b9982;outline-offset:0}
@media(max-width:650px){.editor-legend{gap:7px 11px}.stdin-label{align-items:start;flex-direction:column}}
.list-mode-switch{display:flex;gap:3px;margin:5px 7px 10px;padding:3px;border:1px solid #29382e;border-radius:5px;background:#101713}
.list-mode-switch button{flex:1;min-width:0;border:0;background:transparent;color:#8fa496;font:10px/1.5 var(--font);padding:7px 2px;border-radius:3px;cursor:pointer;transition:background .18s var(--ease),color .18s var(--ease)}
.list-mode-switch button.active{background:#293a2f;color:#d2e4d5}
.list-mode-switch button:hover:not(.active){color:#c0d5c5}
.level-heading{align-items:flex-start!important}
.level-heading strong{font-size:9px;line-height:1.6;white-space:normal}
.level-heading span{white-space:nowrap}
body.sidebar-collapsed .list-mode-switch{display:none}
