:root {
  --surface: #fff;
  --surface-soft: #f3f7f5;
  --surface-selected: #e9f2ef;
  --button: #176d63;
  --button-hover: #125c53;
  --field-border: #b9cacc;
  --error: #a33333;
  --error-surface: #fff7f3;
  --error-border: #e6b1a1;
  --score-lightness: 27%;
  --code-bg: #122933;
  --code-ink: #e0f2ed;
  --code-gutter: #12252e;
  --code-border: #29434f;
  --code-line: #acbec8;
  --code-cursor: #fff;
  --code-selection: #2b4859;
  --code-active: #1c3a46;
  --code-keyword: #d6b5ff;
  --code-string: #bce8a8;
  --code-number: #ffc28c;
  --code-comment: #abc4bc;
  --code-meta: #8dd6f0;
  --code-operator: #f6cc79;
  --code-type: #79d9d0;
  --code-variable: #97c9ff;
  --code-error: #ffabab;
  --code-bracket: #3b6265;
}
:root[data-page-theme="dark"] {
  color-scheme: dark;
  --paper: #111b23;
  --surface: #1b2832;
  --surface-soft: #22323d;
  --surface-selected: #25433f;
  --ink: #e2edf2;
  --muted: #afc1cb;
  --accent: #8ad7c3;
  --line: #40535e;
  --field-border: #647d8b;
  --error: #ffb5ac;
  --error-surface: #392a2b;
  --error-border: #956862;
  --score-lightness: 72%;
}
:root[data-editor-theme="light"] {
  --code-bg: #fafbfc;
  --code-ink: #192a36;
  --code-gutter: #edf1f4;
  --code-border: #b9c7d1;
  --code-line: #4e606d;
  --code-cursor: #172b38;
  --code-selection: #c4d9f2;
  --code-active: #e8eff6;
  --code-keyword: #6437a5;
  --code-string: #286327;
  --code-number: #944313;
  --code-comment: #485b5e;
  --code-meta: #246381;
  --code-operator: #774f08;
  --code-type: #00665d;
  --code-variable: #245999;
  --code-error: #a31d2c;
  --code-bracket: #ccdfd9;
}
.theme-choice { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; white-space: nowrap; }
.theme-choice select { padding: 5px 8px; font-size: 12px; }
.editor-header { flex-wrap: wrap; }
.editor-header .editor-preferences { flex-wrap: wrap; justify-content: flex-end; }
.editor-layout-tools { display: flex; justify-content: flex-end; margin-bottom: 12px; }
.editor-expand { font-size: 12px; }
.task-columns.tabbed-columns.editor-expanded { grid-template-columns: minmax(0, 1fr); }
.editor-expanded > .task-details { display: none; }
.editor-expanded .editor-column { position: static; }
.task-columns.editor-expanded .editor-column > .panel { margin-top: 0; }
.code-editor, pre.submitted-code {
  background: var(--code-bg);
  color: var(--code-ink);
  border-color: var(--code-border);
  color-scheme: dark;
}
[data-editor-theme="light"] .code-editor,
[data-editor-theme="light"] pre.submitted-code { color-scheme: light; }
[data-page-theme="dark"] .brand { background: #d4e8e2; color: #152d3a; }
[data-page-theme="dark"] .brand:hover { background: #b8d6cb; }
[data-page-theme="dark"] .notice { background: var(--surface-selected); color: var(--ink); border-color: var(--line); }
[data-page-theme="dark"] .error,
[data-page-theme="dark"] .technical_error { background: var(--error-surface); color: var(--error); border-color: var(--error-border); }
[data-page-theme="dark"] .teacher-badge,
[data-page-theme="dark"] .attempt-row .teacher-badge { color: #c4d4ff; background: #2c3850; border-color: #7082a6; }
[data-page-theme="dark"] .history-badge { background: var(--surface-soft); color: var(--muted); }
[data-page-theme="dark"] .laboratory-section { background: #1b302f; border-color: var(--line); }
[data-page-theme="dark"] progress::-webkit-progress-bar { background: var(--surface-soft); }
[data-page-theme="dark"] input:focus,
[data-page-theme="dark"] textarea:focus,
[data-page-theme="dark"] select:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 767px) {
  .nav-wrap { flex-wrap: wrap; gap: 15px; }
  nav { gap: 12px 16px; }
  .editor-header .editor-preferences { justify-content: flex-start; }
}
