:root {
  --bg: #f6f7f4;
  --panel: #ffffff;
  --ink: #202124;
  --muted: #66706b;
  --line: #d9ded8;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --warn: #b45309;
  --bad: #b91c1c;
  --good: #15803d;
  --code-bg: #111827;
  --code-fg: #e5e7eb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

button,
select,
textarea,
input {
  font: inherit;
}

button,
select {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}

input[type="text"],
input[type="date"],
input[type="number"],
input[type="password"] {
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}

.auth-page {
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  display: grid;
  width: min(420px, 100%);
  gap: 24px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.auth-form,
.user-form,
.settings-form {
  display: grid;
  gap: 12px;
}

.user-form {
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  align-items: end;
}

.admin-panel {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.video-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.video-controls input[type="number"] {
  width: 92px;
}

.video-badge {
  display: inline-flex;
  min-width: 68px;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 6px;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.video-none,
.video-pending {
  background: #64748b;
}

.video-queued,
.video-running {
  background: var(--warn);
}

.video-ready {
  background: var(--good);
}

.video-failed {
  background: var(--bad);
}

.settings-form {
  grid-template-columns: minmax(220px, 1.2fr) minmax(180px, 0.8fr) minmax(220px, 1.2fr) auto;
  align-items: end;
}

.history-frame {
  width: 100%;
  height: 720px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.inline-input {
  width: 100%;
  min-width: 110px;
}

.link-button {
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent-strong);
  font-weight: 700;
}

.user-badge {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.nav-user-badge {
  min-width: 240px;
}

.hidden-field {
  display: none;
}

button {
  min-height: 36px;
  padding: 0 12px;
  cursor: pointer;
}

button:hover {
  border-color: #aeb8b2;
}

button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.nav-page {
  display: grid;
  gap: 28px;
  width: min(980px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 42px 0;
}

.nav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.nav-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 16px;
}

.nav-card {
  display: grid;
  width: 100%;
  min-height: 132px;
  align-content: space-between;
  text-align: left;
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
}

.nav-card:hover {
  border-color: var(--accent);
}

.nav-card span {
  font-size: 22px;
  font-weight: 800;
}

.nav-card strong {
  color: var(--muted);
  font-size: 14px;
}

.nav-card.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.nav-card.primary strong {
  color: rgba(255, 255, 255, 0.82);
}

.bank-page {
  display: grid;
  gap: 18px;
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.bank-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.bank-groups {
  display: grid;
  gap: 16px;
}

.bank-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.bank-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.bank-group-header h2 {
  margin: 0;
  font-size: 18px;
}

.bank-group-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bank-group-title button {
  padding: 6px 10px;
  color: var(--accent-strong);
  font-size: 13px;
}

.ai-generate-dialog {
  width: min(420px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(20, 32, 24, 0.2);
}

.ai-generate-dialog::backdrop {
  background: rgba(20, 32, 24, 0.45);
}

.ai-generate-dialog form {
  display: grid;
  gap: 14px;
  padding: 22px;
}

.ai-generate-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.ai-generate-heading h2,
.ai-generate-heading p {
  margin: 0;
}

.ai-generate-heading p,
.ai-generate-status {
  color: var(--muted);
  font-size: 13px;
}

.dialog-close {
  padding: 2px 8px;
  border: 0;
  font-size: 22px;
  line-height: 1;
}

.ai-generate-dialog input {
  width: 100%;
}

.ai-generate-dialog .actions {
  justify-content: flex-end;
}

.bank-group-header span {
  color: var(--muted);
  font-size: 13px;
}

.bank-list {
  display: grid;
}

.bank-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
}

.bank-item:last-child {
  border-bottom: 0;
}

.bank-item:hover {
  background: #f8faf8;
}

.bank-item-main {
  display: grid;
  min-width: 0;
  gap: 4px;
  color: var(--ink);
  text-decoration: none;
}

.bank-item-main:hover strong {
  color: var(--accent-strong);
}

.bank-item span {
  color: var(--muted);
  font-size: 13px;
}

.bank-item .video-badge {
  color: #fff;
}

.bank-video-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.bank-video-actions .actions {
  min-width: 220px;
}

.video-page {
  display: grid;
  gap: 18px;
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.video-player-panel {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.video-player-panel video {
  width: 100%;
  max-height: calc(100vh - 170px);
  border-radius: 6px;
  background: #0b1220;
}

button.primary:hover {
  background: var(--accent-strong);
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(246, 247, 244, 0.78);
  backdrop-filter: blur(2px);
}

body.loading-active .loading-overlay {
  display: flex;
}

.loading-box {
  display: grid;
  min-width: 220px;
  gap: 12px;
  justify-items: center;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 42px rgba(17, 24, 39, 0.14);
  color: var(--ink);
  font-weight: 700;
}

.loading-spinner {
  width: 34px;
  height: 34px;
  border: 3px solid #d9ded8;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: loading-spin 0.8s linear infinite;
}

@keyframes loading-spin {
  to {
    transform: rotate(360deg);
  }
}

.app-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  border-right: 1px solid var(--line);
  background: #eef1ed;
  padding: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 6px;
  background: #1f2937;
  color: #f9fafb;
  font-weight: 800;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 20px;
}

h2 {
  font-size: 22px;
}

p {
  margin: 4px 0 0;
  color: var(--muted);
}

.control-group {
  display: grid;
  gap: 8px;
}

.control-group.inline {
  grid-template-columns: 1fr auto;
  align-items: center;
}

label,
.list-header,
.meta {
  color: var(--muted);
  font-size: 13px;
}

select {
  height: 38px;
  padding: 0 10px;
}

.problem-bank-card {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.problem-bank-card strong {
  font-size: 24px;
}

.problem-bank-card span {
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list {
  overflow: auto;
  display: grid;
  gap: 8px;
}

.problem-item {
  display: grid;
  gap: 4px;
  padding: 10px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.problem-item-row {
  display: flex;
  align-items: stretch;
  gap: 6px;
}

.problem-item-row .problem-item {
  flex: 1;
}

.problem-item.failed {
  border-color: var(--bad);
  box-shadow: inset 3px 0 0 var(--bad);
}

.problem-retry {
  align-self: center;
  padding: 6px 8px;
  color: var(--bad);
  border-color: #f0b6b6;
  background: #fff7f7;
  font-size: 12px;
}

.problem-item.active {
  border-color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.problem-item.pending {
  cursor: wait;
  opacity: 0.65;
}

.exam-generation-progress {
  margin-bottom: 10px;
  padding: 9px 10px;
  border: 1px solid #f0d49a;
  border-radius: 6px;
  background: #fff8e8;
  color: #805b12;
  font-size: 12px;
  line-height: 1.5;
}

.problem-item strong {
  font-size: 14px;
}

.problem-item span {
  color: var(--muted);
  font-size: 12px;
}

.problem-item small {
  overflow: hidden;
  color: #8b948f;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 7000;
  background: rgba(17, 24, 39, 0.38);
}

.drawer-backdrop[hidden] {
  display: none;
}

.problem-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 7001;
  display: flex;
  width: min(560px, calc(100vw - 16px));
  min-width: 0;
  transform: translateX(100%);
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  border-left: 1px solid var(--line);
  background: #fff;
  box-shadow: -24px 0 48px rgba(17, 24, 39, 0.18);
  transition: transform 0.2s ease;
}

.problem-drawer.open {
  transform: translateX(0);
}

.history-problem-content {
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
  line-height: 1.65;
}

.history-problem-content h3 {
  margin: 20px 0 8px;
  font-size: 16px;
}

.history-problem-content p {
  white-space: pre-wrap;
}

.history-problem-options {
  display: grid;
  gap: 8px;
  margin: 8px 0 16px;
  padding-left: 28px;
}

.history-problem-link {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--accent-strong);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.history-problem-link:hover {
  color: var(--accent);
}

.drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.icon-button {
  display: grid;
  width: 36px;
  min-width: 36px;
  padding: 0;
  place-items: center;
  font-size: 24px;
  line-height: 1;
}

.drawer-filters {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(130px, 0.6fr) minmax(120px, 0.5fr);
  gap: 8px;
}

.drawer-summary {
  color: var(--muted);
  font-size: 13px;
}

.drawer-list {
  min-height: 0;
  padding-right: 2px;
}

.drawer-list .problem-item {
  grid-template-columns: minmax(0, 1fr);
  min-height: 74px;
}

.drawer-empty {
  padding: 20px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  text-align: center;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(420px, 1.1fr);
  min-width: 0;
}

.history-page {
  display: grid;
  gap: 18px;
  padding: 24px;
}

.problem-pane,
.code-pane {
  min-width: 0;
  padding: 20px;
}

.problem-pane {
  border-right: 1px solid var(--line);
}

.pane-header,
.editor-header,
.result-grid,
.stats-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.metric {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  font-size: 26px;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 700;
  background: #f8faf8;
}

tr:last-child td {
  border-bottom: 0;
}

.status {
  min-width: 76px;
  padding: 7px 10px;
  border-radius: 6px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
}

.status-stack {
  display: grid;
  gap: 6px;
}

body.exam-mode #explanation-btn,
body.exam-mode .tab[data-tab="explanation"] {
  display: none;
}

.exam-dialog {
  width: min(720px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
}

.exam-dialog::backdrop {
  background: rgba(17, 24, 39, 0.45);
}

.exam-form {
  display: grid;
  gap: 18px;
  padding: 20px;
}

.exam-form-grid,
.checkbox-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.checkbox-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.dialog-error {
  min-height: 20px;
  color: var(--bad);
  font-size: 13px;
}

.dialog-status {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 20px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.dialog-status[hidden] {
  display: none;
}

.inline-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(42, 83, 52, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: loading-spin 0.8s linear infinite;
}

.exam-shell {
  display: grid;
  grid-template-columns: 240px minmax(360px, 0.95fr) minmax(420px, 1.05fr);
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 100vh;
}

.exam-topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.exam-timer {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.exam-timer div {
  display: grid;
  min-width: 96px;
  gap: 3px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8faf8;
}

.exam-timer span {
  color: var(--muted);
  font-size: 12px;
}

.exam-timer strong {
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.exam-timer.urgent div:last-child strong,
.exam-timer.expired div:last-child strong {
  color: var(--bad);
}

.exam-list,
.exam-problem,
.exam-code {
  min-width: 0;
  padding: 18px;
}

.exam-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-right: 1px solid var(--line);
  background: #eef1ed;
}

.exam-problem {
  border-right: 1px solid var(--line);
}

.exam-code .code-editor-wrap {
  height: calc(100vh - 245px);
}

.exam-code .CodeMirror {
  height: calc(100vh - 245px);
}

#exam-mcq {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}

#exam-mcq[hidden] {
  display: none !important;
}

#exam-code.objective-mode .CodeMirror,
#exam-code.objective-mode #exam-code-editor {
  display: none !important;
}

.mcq-option {
  display: block;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  background: var(--panel);
}

.mcq-option:has(input:checked) {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--panel));
}

.exam-score {
  display: grid;
  gap: 4px;
  margin-top: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.exam-score span {
  color: var(--muted);
  font-size: 13px;
}

.exam-score strong {
  font-size: 28px;
}

.problem-item.accepted {
  border-color: var(--good);
  box-shadow: inset 3px 0 0 var(--good);
}

.status.idle {
  background: #e5e7eb;
}

.status.good {
  color: #fff;
  background: var(--good);
}

.status.bad {
  color: #fff;
  background: var(--bad);
}

.status.warn {
  color: #fff;
  background: var(--warn);
}

.tabs {
  display: flex;
  gap: 6px;
  margin: 18px 0 12px;
  border-bottom: 1px solid var(--line);
}

.tab {
  border: 0;
  border-radius: 0;
  background: transparent;
}

.tab.active {
  box-shadow: inset 0 -3px 0 var(--accent);
  color: var(--accent-strong);
  font-weight: 700;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.prose {
  overflow: auto;
  max-height: calc(100vh - 170px);
  line-height: 1.65;
}

.prose h3 {
  margin: 20px 0 8px;
  font-size: 16px;
}

.sample {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

pre,
textarea {
  font-family: Consolas, "Cascadia Mono", monospace;
}

.code-editor-wrap {
  position: relative;
  width: 100%;
  height: calc(100vh - 255px);
  min-height: 420px;
  margin-top: 14px;
}

textarea,
.code-highlight {
  font-family: Consolas, "Cascadia Mono", monospace;
  font-size: 14px;
  line-height: 1.5;
  tab-size: 4;
}

textarea {
  width: 100%;
  height: 100%;
  padding: 14px;
  resize: vertical;
  border: 1px solid #0b1220;
  border-radius: 6px;
  outline: none;
  background: var(--code-bg);
  color: var(--code-fg);
}

.CodeMirror {
  height: calc(100vh - 255px);
  min-height: 420px;
  margin-top: 14px;
  border: 1px solid #0b1220;
  border-radius: 6px;
  background: var(--code-bg);
  color: var(--code-fg);
  font-family: Consolas, "Cascadia Mono", monospace;
  font-size: 14px;
  line-height: 1.5;
}

.CodeMirror-gutters {
  border-right: 1px solid #1f2937;
  background: #0b1220;
}

.CodeMirror-linenumber {
  color: #64748b;
}

.CodeMirror-cursor {
  border-left-color: var(--code-fg);
}

.CodeMirror-selected {
  background: rgba(20, 184, 166, 0.35) !important;
}

.cm-s-default .cm-keyword {
  color: #7dd3fc;
}

.cm-s-default .cm-def,
.cm-s-default .cm-type,
.cm-s-default .cm-variable-2 {
  color: #93c5fd;
}

.cm-s-default .cm-string,
.cm-s-default .cm-string-2 {
  color: #fca5a5;
}

.cm-s-default .cm-number {
  color: #fcd34d;
}

.cm-s-default .cm-comment {
  color: #86efac;
}

.cm-s-default .cm-meta {
  color: #c4b5fd;
}

.code-editor-wrap textarea {
  position: relative;
  z-index: 2;
  margin-top: 0;
  background: transparent;
  color: transparent;
  caret-color: var(--code-fg);
  white-space: pre;
}

.code-editor-wrap textarea::selection {
  background: rgba(20, 184, 166, 0.35);
}

.code-highlight {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: auto;
  margin: 0;
  padding: 14px;
  border: 1px solid #0b1220;
  border-radius: 6px;
  background: var(--code-bg);
  color: var(--code-fg);
  pointer-events: none;
  white-space: pre;
}

.code-highlight .tok-keyword {
  color: #7dd3fc;
}

.code-highlight .tok-type {
  color: #93c5fd;
}

.code-highlight .tok-string {
  color: #fca5a5;
}

.code-highlight .tok-number {
  color: #fcd34d;
}

.code-highlight .tok-comment {
  color: #86efac;
}

.code-highlight .tok-preproc {
  color: #c4b5fd;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.actions.column {
  min-width: 132px;
  flex-direction: column;
}

.result-grid {
  align-items: stretch;
  margin-top: 14px;
}

.result-grid > div:first-child {
  min-width: 0;
  flex: 1;
}

.output {
  overflow: auto;
  max-height: calc(100vh - 190px);
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfb;
  color: #1f2937;
  white-space: pre-wrap;
}

.output.compact {
  max-height: 170px;
}

#statement p,
#exam-statement p {
  white-space: pre-wrap;
}

.empty {
  color: #7a827d;
}

.exam-live-drawer {
  position: fixed;
  z-index: 30;
  top: 0;
  right: 0;
  display: flex;
  width: min(560px, 94vw);
  height: 100dvh;
  padding: 20px;
  flex-direction: column;
  gap: 14px;
  border-left: 1px solid var(--line);
  background: var(--panel);
  box-shadow: -16px 0 42px rgba(32, 33, 36, 0.16);
  transform: translateX(105%);
  transition: transform 180ms ease;
}

.exam-live-drawer.open {
  transform: translateX(0);
}

.exam-live-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.exam-live-header h2 {
  margin: 3px 0 0;
  font-size: 20px;
}

.exam-live-header button {
  min-width: 36px;
  padding: 3px 10px;
  font-size: 24px;
  line-height: 1;
}

.exam-live-status {
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  font-size: 13px;
}

.exam-live-chat {
  min-height: 0;
  flex: 1;
  margin: 0;
  overflow: auto;
  padding: 14px;
  border-radius: 8px;
  background: var(--code-bg);
  color: var(--code-fg);
  font-family: Consolas, "Cascadia Code", monospace;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
}

.quiz-page { max-width: 920px; }
.quiz-card { margin-top: 24px; padding: 30px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.quiz-card h2 { margin: 10px 0 18px; }
.quiz-card > p { white-space: pre-wrap; line-height: 1.8; }
.quiz-options { display: grid; gap: 12px; margin-top: 24px; }
.quiz-option { width: 100%; padding: 14px 16px; text-align: left; background: var(--panel); }
.quiz-option.correct { border-color: #2e9b68; background: #e8f7ee; color: #17633e; }
.quiz-option.wrong { border-color: #d65454; background: #fceced; color: #9b2d2d; }
.quiz-result { margin-top: 20px; padding: 14px; border-radius: 8px; line-height: 1.7; }
.quiz-result.good { background: #e8f7ee; color: #17633e; }
.quiz-result.bad { background: #fceced; color: #9b2d2d; }

@media (max-width: 980px) {
  .app-shell,
  .workspace,
  .exam-shell,
  .nav-grid,
  .stats-grid,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .exam-shell {
    grid-template-rows: auto auto auto auto;
  }

  .exam-topbar {
    grid-column: auto;
  }

  .bank-header,
  .nav-header {
    align-items: stretch;
    flex-direction: column;
  }

  .bank-item {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .bank-video-actions {
    justify-content: space-between;
  }

  .sidebar,
  .problem-pane,
  .exam-list,
  .exam-problem {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  textarea {
    height: 52vh;
  }

  .sample {
    grid-template-columns: 1fr;
  }

  .exam-form-grid,
  .checkbox-grid,
  .drawer-filters {
    grid-template-columns: 1fr;
  }

  .problem-drawer {
    width: min(520px, calc(100vw - 16px));
  }
}
