:root {
  color-scheme: light;
  --page: #f4f6f8;
  --paper: #ffffff;
  --paper-soft: #f8f9fb;
  --ink: #17202a;
  --muted: #66717f;
  --faint: #8c96a3;
  --line: #dce1e7;
  --line-strong: #bfc7d1;
  --accent: #2f6fed;
  --accent-hover: #245dcc;
  --accent-soft: #edf3ff;
  --accent-contrast: #ffffff;
  --success: #197a57;
  --success-soft: #eaf7f1;
  --danger: #c34444;
  --danger-soft: #fff0f0;
  --warning: #9a6700;
  --warning-soft: #fff7dd;
  --cover: #17202a;
  --cover-ink: #ffffff;
  --practice-page: #eef1f4;
  --overlay: rgba(23, 32, 42, 0.42);
  --shadow-soft: 0 6px 18px rgba(23, 32, 42, 0.06);
  --shadow-paper: 0 18px 42px rgba(23, 32, 42, 0.1);
  --ring: 0 0 0 3px rgba(47, 111, 237, 0.14);
  --radius: 6px;
  font-family: "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
}

:root[data-theme="tech"] {
  color-scheme: dark;
  --page: #101317;
  --paper: #171b20;
  --paper-soft: #1d2228;
  --ink: #f2f4f6;
  --muted: #a3abb5;
  --faint: #7f8994;
  --line: #303740;
  --line-strong: #46505c;
  --accent: #6b9fff;
  --accent-hover: #87b1ff;
  --accent-soft: #1d2b45;
  --accent-contrast: #08111f;
  --success: #55c89a;
  --success-soft: #162d25;
  --danger: #ff8585;
  --danger-soft: #351e21;
  --warning: #e3b95f;
  --warning-soft: #342b18;
  --cover: #0b0e12;
  --cover-ink: #ffffff;
  --practice-page: #0d1014;
  --overlay: rgba(0, 0, 0, 0.66);
  --shadow-soft: 0 8px 20px rgba(0, 0, 0, 0.2);
  --shadow-paper: 0 20px 48px rgba(0, 0, 0, 0.32);
  --ring: 0 0 0 3px rgba(107, 159, 255, 0.2);
}

:root[data-theme="black"] {
  color-scheme: dark;
  --page: #000000;
  --paper: #090909;
  --paper-soft: #111111;
  --ink: #f7f7f7;
  --muted: #a8a8a8;
  --faint: #777777;
  --line: #292929;
  --line-strong: #444444;
  --accent: #f2f2f2;
  --accent-hover: #ffffff;
  --accent-soft: #1b1b1b;
  --accent-contrast: #000000;
  --success: #d5f5e6;
  --success-soft: #13231b;
  --danger: #ff9b9b;
  --danger-soft: #291719;
  --warning: #f0ce71;
  --warning-soft: #292310;
  --cover: #111111;
  --cover-ink: #ffffff;
  --practice-page: #000000;
  --overlay: rgba(0, 0, 0, 0.82);
  --shadow-soft: none;
  --shadow-paper: 0 0 0 1px #292929;
  --ring: 0 0 0 3px rgba(255, 255, 255, 0.18);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--page);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--page);
  color: var(--ink);
  transition: background-color 140ms ease, color 140ms ease;
}

::selection {
  background: var(--accent-soft);
  color: var(--ink);
}

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

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

fieldset {
  min-width: 0;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

h1,
h2,
h3,
p {
  letter-spacing: 0;
}

@keyframes view-in {
  from {
    transform: translateY(4px);
  }

  to {
    transform: translateY(0);
  }
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.topbar-primary {
  display: grid;
  grid-template-columns: auto minmax(280px, 1fr) auto;
  align-items: center;
  gap: 28px;
  width: min(1240px, calc(100% - 32px));
  min-height: 68px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  padding: 4px 0;
  cursor: pointer;
}

.brand:focus-visible {
  border-radius: var(--radius);
  box-shadow: var(--ring);
  outline: none;
}

.brand-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 6px;
  background: #151b26;
  color: #ffffff;
  font-size: 1rem;
  font-weight: 850;
  box-shadow: 0 0 0 1px var(--line);
}

.brand-mark::after,
.auth-brand-mark::after {
  content: "";
  position: absolute;
  right: 7px;
  bottom: 5px;
  left: 7px;
  height: 3px;
  background: #2f6fed;
}

.brand-title {
  margin: 0;
  font-size: 1.04rem;
  font-weight: 800;
  line-height: 1;
}

.nav-actions {
  display: flex;
  align-items: stretch;
  justify-content: center;
  align-self: stretch;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-actions::-webkit-scrollbar {
  display: none;
}

.nav-button {
  position: relative;
  flex: 0 0 auto;
  min-width: 76px;
  padding: 0 15px;
  background: transparent;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
}

.nav-button::after {
  content: "";
  position: absolute;
  right: 15px;
  bottom: 0;
  left: 15px;
  height: 3px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 140ms ease;
}

.nav-button:hover,
.nav-button.active {
  color: var(--ink);
}

.nav-button.active::after {
  transform: scaleX(1);
}

.topbar-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  min-width: 0;
}

.setting-control {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.setting-control > span {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.small-select {
  width: auto;
  min-width: 88px;
  min-height: 36px;
  padding: 6px 27px 6px 9px;
  border-color: transparent;
  background-color: var(--paper-soft);
  font-size: 0.82rem;
  font-weight: 700;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding-left: 3px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.user-avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.74rem;
  font-weight: 800;
}

.user-label {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logout-button {
  color: var(--muted);
}

.logout-short {
  display: none;
}

.main {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
  padding: 42px 0 64px;
}

.practice-main {
  width: 100%;
  padding: 0;
}

.view-section {
  animation: view-in 120ms ease-out;
}

.section {
  margin-top: 28px;
}

.section:first-child {
  margin-top: 0;
}

.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.section-title {
  margin: 0;
  color: var(--ink);
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1.25;
}

.section-note {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow-soft);
}

.hero {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 174px);
  padding: 32px 0;
}

.auth-page {
  position: relative;
}

.auth-panel {
  width: min(430px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--accent);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow-paper);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 24px;
}

.auth-brand-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
  border-radius: 7px;
  background: #151b26;
  color: #ffffff;
  font-size: 1.5rem;
  font-weight: 850;
}

.auth-brand h1 {
  margin: 0;
  color: var(--ink);
  font-size: 1.85rem;
  font-weight: 850;
  line-height: 1.1;
}

.auth-brand p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.tabs {
  display: flex;
  gap: 24px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.tab {
  position: relative;
  min-height: 42px;
  padding: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 750;
}

.tab::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
}

.tab.active {
  color: var(--ink);
}

.tab.active::after {
  transform: scaleX(1);
}

.form {
  display: grid;
  gap: 15px;
}

.field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.label {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 750;
}

.input,
.select,
.textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
}

.input,
.select {
  min-height: 44px;
  padding: 9px 11px;
}

.select {
  padding-right: 30px;
}

.textarea {
  min-height: 110px;
  padding: 11px;
  line-height: 1.55;
  resize: vertical;
}

.input:hover,
.select:hover,
.textarea:hover {
  border-color: var(--faint);
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--accent);
  box-shadow: var(--ring);
}

.input[readonly] {
  border-color: var(--line);
  background: var(--paper-soft);
  color: var(--muted);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 9px 16px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 750;
  line-height: 1.15;
  text-align: center;
  transition: background-color 120ms ease, border-color 120ms ease, transform 80ms ease;
}

.button:hover {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
}

.button:active {
  transform: translateY(1px);
}

.button:focus-visible,
.text-button:focus-visible,
.nav-button:focus-visible,
.tab:focus-visible,
.icon-button:focus-visible,
.mark-review:focus-visible,
.stat-card:focus-visible {
  box-shadow: var(--ring);
  outline: none;
}

.button.secondary {
  border-color: var(--line-strong);
  background: var(--paper);
  color: var(--ink);
}

.button.secondary:hover {
  border-color: var(--ink);
  background: var(--paper-soft);
}

.button.danger {
  border-color: var(--danger);
  background: var(--danger);
  color: #ffffff;
}

.button.success {
  border-color: var(--success);
  background: var(--success);
  color: #ffffff;
}

:root[data-theme="black"] .button.danger,
:root[data-theme="black"] .button.success {
  color: #000000;
}

.button.small {
  min-height: 34px;
  padding: 6px 11px;
  font-size: 0.82rem;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
}

.text-button {
  padding: 0;
  border-bottom: 1px solid transparent;
  background: transparent;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 750;
}

.text-button:hover {
  border-bottom-color: currentColor;
}

.danger-text {
  color: var(--danger);
}

.message {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
  font-size: 0.84rem;
  line-height: 1.45;
}

.empty {
  padding: 42px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

.tag-row,
.question-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper-soft);
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.2;
}

.personal-tag {
  border-color: #82c8b0;
  background: var(--success-soft);
  color: var(--success);
}

.progress-tag {
  border-color: #9db8ee;
  background: var(--accent-soft);
  color: var(--accent);
}

.difficulty {
  border-radius: 4px;
}

.difficulty.Easy {
  border-color: #9ccdb9;
  background: var(--success-soft);
  color: var(--success);
}

.difficulty.Medium {
  border-color: #ead18d;
  background: var(--warning-soft);
  color: var(--warning);
}

.difficulty.Hard {
  border-color: #e5aaaa;
  background: var(--danger-soft);
  color: var(--danger);
}

.difficulty.Challenging {
  border-color: #b9a8df;
  background: #f4efff;
  color: #7048a8;
}

:root[data-theme="tech"] .difficulty.Challenging,
:root[data-theme="black"] .difficulty.Challenging {
  border-color: #745d9e;
  background: #241d32;
  color: #d1b9ff;
}

.student-home {
  display: grid;
  gap: 34px;
}

.dashboard-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 8px 0 22px;
  border-bottom: 1px solid var(--line);
}

.dashboard-header h1 {
  margin: 0;
  color: var(--ink);
  font-size: 2.25rem;
  font-weight: 820;
  line-height: 1.05;
}

.learning-overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.overview-item {
  display: grid;
  align-content: center;
  gap: 7px;
  min-height: 112px;
  padding: 18px 22px;
  border-right: 1px solid var(--line);
}

.overview-item:last-child {
  border-right: 0;
}

.overview-item > span,
.overview-item small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.overview-item strong {
  color: var(--ink);
  font-size: 1.65rem;
  line-height: 1.1;
}

.latest-result strong {
  font-size: 1.05rem;
}

.continue-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  background: var(--paper);
}

.continue-copy {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.continue-copy > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.continue-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.continue-copy span {
  color: var(--muted);
  font-size: 0.8rem;
}

.status-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border-radius: 50%;
  background: var(--accent);
}

.competition-heading {
  margin-bottom: 4px;
}

.competition-list,
.set-list {
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
}

.competition-row {
  --subject: var(--accent);
  position: relative;
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  min-height: 142px;
  padding: 20px 18px;
  border-bottom: 1px solid var(--line);
  background: transparent;
  transition: background-color 120ms ease;
}

.competition-row:last-child,
.set-row:last-child {
  border-bottom: 0;
}

.competition-row::before {
  content: "";
  position: absolute;
  top: 20px;
  bottom: 20px;
  left: 0;
  width: 3px;
  background: var(--subject);
}

.competition-row:hover,
.set-row:hover {
  background: var(--paper);
}

.competition-row.subject-0 {
  --subject: #2f6fed;
}

.competition-row.subject-1 {
  --subject: #d15c48;
}

.competition-row.subject-2 {
  --subject: #1f8a6b;
}

.competition-row.subject-3 {
  --subject: #9a6cc2;
}

.competition-index {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--subject);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--subject);
  font-size: 0.95rem;
  font-weight: 850;
}

.competition-copy,
.set-main {
  min-width: 0;
}

.competition-copy h3,
.set-main h3 {
  margin: 9px 0 0;
  color: var(--ink);
  font-size: 1.14rem;
  font-weight: 800;
}

.competition-copy p {
  max-width: 760px;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.set-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  min-height: 128px;
  padding: 20px 18px;
  border-bottom: 1px solid var(--line);
  transition: background-color 120ms ease;
}

.set-index {
  align-self: start;
  padding-top: 4px;
  color: var(--faint);
  font-size: 0.78rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.set-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.82rem;
}

.set-source-details {
  display: block;
  margin-top: 7px;
  color: var(--faint);
  font-size: 0.78rem;
}

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

.set-progress {
  width: min(420px, 100%);
  height: 4px;
  margin-top: 15px;
  overflow: hidden;
  background: var(--line);
}

.set-progress span {
  display: block;
  height: 100%;
  background: var(--accent);
}

.progress-0 { width: 0%; }
.progress-5 { width: 5%; }
.progress-10 { width: 10%; }
.progress-15 { width: 15%; }
.progress-20 { width: 20%; }
.progress-25 { width: 25%; }
.progress-30 { width: 30%; }
.progress-35 { width: 35%; }
.progress-40 { width: 40%; }
.progress-45 { width: 45%; }
.progress-50 { width: 50%; }
.progress-55 { width: 55%; }
.progress-60 { width: 60%; }
.progress-65 { width: 65%; }
.progress-70 { width: 70%; }
.progress-75 { width: 75%; }
.progress-80 { width: 80%; }
.progress-85 { width: 85%; }
.progress-90 { width: 90%; }
.progress-95 { width: 95%; }
.progress-100 { width: 100%; }

.setup-page {
  max-width: 1040px;
  margin-right: auto;
  margin-left: auto;
}

.practice-setup-sheet {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(380px, 1.2fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow-soft);
}

.setup-summary {
  position: relative;
  min-height: 410px;
  padding: 34px;
  background: var(--cover);
  color: var(--cover-ink);
}

.setup-summary::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 32px;
  left: 34px;
  height: 5px;
  background: #2f6fed;
}

.setup-summary .eyebrow {
  color: #9dbbff;
}

.setup-summary h3 {
  max-width: 360px;
  margin: 13px 0 11px;
  color: var(--cover-ink);
  font-family: Georgia, "Noto Serif SC", "Songti SC", serif;
  font-size: 1.65rem;
  line-height: 1.35;
}

.setup-summary .set-source-details,
.setup-summary .set-source-details a {
  color: #bcc7d4;
}

.setup-number {
  display: block;
  margin-bottom: 66px;
  color: #ffffff;
  font-size: 3.9rem;
  font-weight: 850;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.setup-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 34px;
}

.setup-facts div {
  display: grid;
  gap: 4px;
}

.setup-facts span {
  color: #aeb9c6;
  font-size: 0.76rem;
}

.setup-facts strong {
  font-size: 1.2rem;
}

.setup-form {
  align-content: center;
  padding: 36px;
}

.mode-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
}

.mode-choice {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 54px;
  padding: 11px 14px;
  background: var(--paper);
  color: var(--muted);
  cursor: pointer;
}

.mode-choice + .mode-choice {
  border-left: 1px solid var(--line-strong);
}

.mode-choice input {
  accent-color: var(--accent);
}

.mode-choice:has(input:checked) {
  background: var(--accent-soft);
  color: var(--ink);
  font-weight: 750;
}

.setup-field-grid,
.option-grid,
.language-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.setup-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 4px;
}

.setup-actions .message {
  flex: 1;
}

.question-list {
  display: grid;
  gap: 16px;
}

.question {
  padding: 24px;
}

.question h3 {
  margin: 12px 0;
  color: var(--ink);
  font-family: Georgia, "Noto Serif SC", "Songti SC", serif;
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.65;
  white-space: pre-line;
}

.question-image-gallery {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 16px;
  width: min(900px, 100%);
  margin: 18px 0 24px;
}

.question-image {
  max-width: min(100%, 720px);
  margin: 0;
}

.question-image img {
  display: block;
  max-width: 100%;
  max-height: 460px;
  object-fit: contain;
}

.question-image-preview {
  width: min(760px, 100%);
  margin: 18px 0;
}

.question-image-preview img {
  display: block;
  max-width: 100%;
  max-height: 520px;
  border: 1px solid var(--line);
  border-radius: 4px;
  object-fit: contain;
}

.question-image-preview figcaption {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.76rem;
}

.bilingual-line {
  display: block;
}

.zh-line {
  margin-top: 10px;
  color: var(--muted);
}

.practice-app-shell {
  background: var(--practice-page);
}

.practice-room {
  min-height: 100vh;
  background: var(--practice-page);
}

.practice-room-actions {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 60px;
  padding: 8px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.fixed-timer {
  grid-column: 2;
  min-width: 104px;
  color: var(--ink);
  font-size: 1.08rem;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.practice-command-actions {
  grid-column: 3;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.practice-shell {
  width: min(1180px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 82px 24px 94px;
}

.single-question-card {
  width: 100%;
  min-height: calc(100vh - 172px);
  padding: 34px 44px 44px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--ink);
  border-radius: 3px;
  background: var(--paper);
  box-shadow: var(--shadow-paper);
}

.single-question-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 17px;
  border-bottom: 1px solid var(--line);
}

.question-pill {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border: 2px solid var(--accent);
  border-radius: 4px;
  color: var(--accent);
  font-size: 0.94rem;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.mark-review {
  min-height: 34px;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.mark-review:hover,
.mark-review.active {
  border-bottom-color: var(--danger);
  color: var(--danger);
}

.single-question-card .question-meta {
  margin-top: 20px;
  gap: 7px 16px;
}

.single-question-card .question-meta .tag {
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--faint);
}

.single-question-card .question-meta .tag + .tag::before {
  content: "/";
  margin-right: 16px;
  color: var(--line-strong);
}

.voided-question-notice {
  max-width: 980px;
  margin-top: 20px;
  padding: 11px 14px;
  border-left: 3px solid var(--warning);
  background: var(--paper-soft);
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 750;
}

.single-question-card .question-prompt {
  max-width: 980px;
  margin: 28px 0 30px;
  color: var(--ink);
  font-family: Georgia, "Noto Serif SC", "Songti SC", serif;
  font-size: 1.34rem;
  font-weight: 650;
  line-height: 1.75;
  white-space: pre-line;
}

.katex-display {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

.options {
  display: grid;
  gap: 11px;
  width: min(900px, 100%);
}

.option {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}

label.option {
  position: relative;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  gap: 13px;
  min-height: 58px;
  padding: 9px 14px;
  cursor: pointer;
  transition: border-color 100ms ease, background-color 100ms ease;
}

label.option:hover {
  border-color: var(--line-strong);
  background: var(--paper-soft);
}

label.option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.option-letter {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.option-copy {
  min-width: 0;
  color: var(--ink);
  line-height: 1.55;
}

.option-copy small {
  margin-left: 8px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.unanswered-option {
  border-style: dashed;
}

.option-image-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.option-image-list img {
  display: block;
  max-width: min(100%, 260px);
  max-height: 180px;
  object-fit: contain;
}

label.option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

label.option:has(input:checked) .option-letter {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-contrast);
}

label.option:has(input:focus-visible) {
  box-shadow: var(--ring);
}

.practice-footer {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  min-height: 72px;
  padding: 10px max(18px, calc((100vw - 1120px) / 2));
  border-top: 1px solid var(--line);
  background: var(--paper);
}

.practice-progress-button {
  justify-self: center;
}

.practice-footer .button.success {
  margin-left: 14px;
}

.review-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
  background: var(--overlay);
}

.review-panel {
  width: min(640px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow-paper);
}

.review-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
}

.review-panel-header h3 {
  margin: 0;
  font-size: 1.04rem;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
  color: var(--muted);
  font-weight: 800;
}

.icon-button:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.review-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 0.78rem;
}

.legend-dot {
  width: 14px;
  height: 14px;
  border: 1px solid var(--line-strong);
  background: var(--paper);
}

.legend-dot.current {
  border: 3px solid var(--accent);
}

.legend-dot.marked {
  border-color: var(--danger);
  background: var(--danger);
}

.review-number-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 44px);
  gap: 9px;
  min-height: 190px;
  padding: 28px 22px;
  align-content: start;
}

.review-number {
  position: relative;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line-strong);
  background: var(--paper);
  color: var(--ink);
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.review-number:hover {
  border-color: var(--accent);
}

.review-number.current {
  border: 3px solid var(--accent);
}

.review-number.answered:not(.current) {
  background: var(--accent-soft);
}

.review-number.marked::after {
  content: "";
  position: absolute;
  top: -1px;
  right: -1px;
  width: 9px;
  height: 9px;
  background: var(--danger);
}

.review-panel-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 22px;
  border-top: 1px solid var(--line);
}

.score-report-page {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 178px);
  padding: 18px 0;
}

.score-report {
  width: min(920px, 100%);
  overflow: hidden;
  box-shadow: var(--shadow-paper);
}

.score-report-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 32px;
  border-bottom: 1px solid var(--line);
}

.score-report-header h1 {
  margin: 0;
  color: var(--ink);
  font-size: 1.55rem;
  font-weight: 820;
  line-height: 1.3;
}

.score-report-header p:last-child,
.score-report-header time {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.score-report-header time {
  white-space: nowrap;
}

.score-result-band {
  padding: 28px 32px;
  border-left: 6px solid var(--accent);
  background: var(--paper-soft);
}

.score-result-band > span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 750;
  text-transform: uppercase;
}

.score-result-band h2 {
  margin: 5px 0 7px;
  color: var(--ink);
  font-size: 3.2rem;
  font-weight: 850;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.score-report-line {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.award-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid #d7b866;
  border-radius: 4px;
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 0.78rem;
  font-weight: 800;
}

.award-spotlight {
  margin: 20px 32px 0;
}

.score-report-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 24px 32px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.score-report-grid div {
  display: grid;
  gap: 7px;
  min-height: 92px;
  padding: 18px;
  border-right: 1px solid var(--line);
}

.score-report-grid div:last-child {
  border-right: 0;
}

.score-report-grid span {
  color: var(--muted);
  font-size: 0.76rem;
}

.score-report-grid strong {
  align-self: end;
  overflow-wrap: anywhere;
  font-size: 0.96rem;
}

.score-meter {
  height: 6px;
  margin: 24px 32px 0;
  overflow: hidden;
  background: var(--line);
}

.score-meter span {
  display: block;
  height: 100%;
  background: var(--accent);
}

.score-cutoffs {
  margin: 24px 32px 0;
}

.score-cutoffs h3 {
  margin-bottom: 10px;
  font-size: 0.95rem;
}

.score-cutoff-list {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.score-cutoff-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 18px;
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
}

.score-cutoff-row:last-child {
  border-bottom: 0;
}

.score-cutoff-row.achieved {
  background: var(--success-soft);
}

.score-cutoff-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 0.88rem;
}

.score-cutoff-threshold {
  color: var(--muted);
  font-size: 0.76rem;
}

.score-cutoff-status {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  white-space: nowrap;
}

.score-cutoff-row.achieved .score-cutoff-status {
  color: var(--success);
}

.celebration-actions {
  justify-content: flex-end;
  padding: 24px 32px 30px;
}

.score-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 20px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  border-radius: var(--radius);
  background: var(--paper);
}

.score-number {
  color: var(--ink);
  font-size: 1.7rem;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.answer-review {
  display: grid;
  gap: 7px;
  margin: 15px 0;
  padding: 14px 16px;
  border-left: 4px solid var(--line-strong);
  background: var(--paper-soft);
}

.answer-review p {
  margin: 0;
  line-height: 1.5;
}

.answer-review.correct {
  border-left-color: var(--success);
  background: var(--success-soft);
}

.answer-review.incorrect {
  border-left-color: var(--danger);
  background: var(--danger-soft);
}

div.option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 50px;
  padding: 10px 14px;
}

.option.answer-key {
  border-color: var(--success);
  background: var(--success-soft);
}

.option.chosen-answer {
  box-shadow: inset 4px 0 0 var(--accent);
}

.solution-panel {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  background: var(--paper-soft);
}

.solution-panel p {
  margin: 7px 0 0;
  line-height: 1.65;
  white-space: pre-wrap;
}

.table-wrap {
  overflow-x: auto;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: transparent;
  font-size: 0.84rem;
}

th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  white-space: nowrap;
}

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

tbody tr:hover td {
  background: var(--paper);
}

.pagination-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.82rem;
}

.compact-field {
  width: min(280px, 100%);
}

.stats-grid {
  display: grid;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
}

.stat-card {
  display: grid;
  grid-template-columns: minmax(150px, 0.7fr) minmax(160px, 1fr) 64px 64px;
  align-items: center;
  gap: 18px;
  min-height: 70px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  border-left: 4px solid transparent;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.stat-card:last-child {
  border-bottom: 0;
}

.stat-card:hover {
  background: var(--paper);
}

.stat-card.active {
  border-left-color: var(--accent);
  background: var(--accent-soft);
}

.stat-label {
  font-weight: 750;
}

.stat-meter {
  display: block;
  height: 6px;
  overflow: hidden;
  background: var(--line);
}

.stat-meter i {
  display: block;
  height: 100%;
  background: var(--accent);
}

.stat-card strong {
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.stat-card small {
  color: var(--muted);
  text-align: right;
}

.notebook-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  padding: 16px 18px;
  border-left: 4px solid var(--accent);
  box-shadow: none;
}

.notebook-toolbar p {
  margin-top: 3px;
}

.notebook-generator {
  margin-bottom: 18px;
  border-top: 4px solid var(--accent);
}

.review-availability {
  margin: -2px 0 2px;
  padding: 10px 12px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.notebook-actions {
  margin-top: 17px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}

.select-review-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.82rem;
  cursor: pointer;
}

.select-review-item input {
  accent-color: var(--accent);
}

.note-form {
  margin-top: 14px;
  padding: 15px;
  border-left: 3px solid var(--line-strong);
  background: var(--paper-soft);
}

.note-textarea {
  min-height: 120px;
}

.disabled-question {
  opacity: 0.64;
}

.admin-tabs {
  margin-bottom: 20px;
}

.two-column {
  display: grid;
  grid-template-columns: minmax(280px, 0.72fr) minmax(460px, 1.28fr);
  align-items: start;
  gap: 20px;
}

.wide-form {
  grid-template-columns: minmax(320px, 0.58fr) minmax(600px, 1.42fr);
}

.two-column > .panel {
  padding: 20px;
  box-shadow: none;
}

.two-column > .panel > h3 {
  margin: 0 0 18px;
  font-size: 1.03rem;
}

.two-column > .panel:first-child {
  position: sticky;
  top: 86px;
  max-height: calc(100vh - 108px);
  overflow: auto;
}

.admin-panel-heading,
.admin-editor-bar,
.admin-section-heading,
.admin-question-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.admin-panel-heading {
  margin-bottom: 16px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--line);
}

.admin-panel-heading h3,
.admin-editor-bar h3,
.admin-section-heading h4,
.admin-question-heading h4 {
  margin: 0;
}

.admin-panel-heading .eyebrow {
  margin-bottom: 3px;
}

.admin-list-controls {
  display: grid;
  gap: 10px;
  margin-bottom: 11px;
}

.admin-list-count {
  margin: 0 0 5px;
  color: var(--faint);
  font-size: 0.75rem;
  font-weight: 750;
}

.admin-list {
  display: grid;
}

.admin-item {
  display: grid;
  gap: 11px;
  margin: 0 -8px;
  padding: 14px 11px;
  border-bottom: 1px solid var(--line);
  border-left: 3px solid transparent;
}

.admin-item:first-child {
  padding-top: 14px;
}

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

.admin-item p {
  line-height: 1.45;
}

.admin-item.active {
  border-left-color: var(--accent);
  background: var(--accent-soft);
}

.admin-editor-panel {
  overflow: visible;
}

.admin-editor-bar {
  position: sticky;
  z-index: 8;
  top: 76px;
  margin: -20px -20px 18px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  box-shadow: 0 5px 14px rgba(23, 32, 42, 0.05);
}

.admin-editor-bar h3 {
  margin-top: 3px;
  font-size: 1.05rem;
}

.admin-save-status {
  display: block;
  color: var(--success);
  font-size: 0.74rem;
  font-weight: 750;
}

.admin-save-status::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  background: currentColor;
}

.admin-save-status.dirty {
  color: var(--warning);
}

.admin-message:empty {
  display: none;
}

.admin-message {
  margin: 0 0 14px;
}

.admin-users-panel {
  padding: 22px;
  box-shadow: none;
}

.admin-user-search {
  margin-bottom: 18px;
}

.admin-user-list {
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
}

.admin-user-row {
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) minmax(230px, 1.25fr) 92px 120px minmax(210px, 1fr) auto;
  align-items: end;
  gap: 14px;
  padding: 16px 10px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
}

.admin-user-row:last-of-type {
  border-bottom: 0;
}

.admin-user-identity,
.admin-user-meta {
  display: grid;
  gap: 6px;
  align-self: center;
}

.admin-user-identity strong {
  overflow-wrap: anywhere;
}

.admin-user-meta {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.4;
}

.status-label {
  width: max-content;
  max-width: 100%;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
}

.status-label.active {
  border-color: color-mix(in srgb, var(--success) 36%, var(--line));
  color: var(--success);
}

.status-label.disabled {
  border-color: color-mix(in srgb, var(--danger) 36%, var(--line));
  color: var(--danger);
}

.admin-user-actions {
  align-self: end;
  flex-wrap: nowrap;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 18px;
  min-height: 46px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 0.75rem;
}

.site-footer a {
  color: inherit;
}

.site-footer a:hover {
  color: var(--accent);
}

@media (max-width: 1280px) {
  .admin-user-row {
    grid-template-columns: minmax(170px, 0.8fr) minmax(250px, 1.2fr) repeat(2, minmax(120px, 0.55fr));
    align-items: end;
  }

  .admin-password-field {
    grid-column: 2 / 4;
  }

  .admin-user-actions {
    grid-column: 4;
  }
}

@media (max-width: 760px) {
  .admin-user-row {
    grid-template-columns: 1fr;
    align-items: stretch;
    padding: 18px 4px;
  }

  .admin-user-meta {
    grid-template-columns: 1fr;
  }

  .admin-password-field,
  .admin-user-actions {
    grid-column: auto;
  }

  .admin-user-actions {
    flex-wrap: wrap;
  }
}

.admin-disclosure {
  margin-bottom: 16px;
  border: 1px solid var(--line);
  background: var(--paper-soft);
}

.admin-disclosure > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 46px;
  padding: 11px 13px;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 750;
  cursor: pointer;
}

.admin-disclosure > summary small {
  max-width: 70%;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.4;
  text-align: right;
}

.admin-form-section {
  display: grid;
  gap: 14px;
  padding: 4px 0 22px;
  border-bottom: 1px solid var(--line);
}

.admin-section-heading {
  margin-bottom: 2px;
}

.admin-section-heading h4,
.admin-question-heading h4 {
  font-size: 0.95rem;
}

.admin-set-form {
  gap: 18px;
}

.tag-manager,
.award-editor {
  margin-bottom: 16px;
  padding: 15px;
  border: 1px solid var(--line);
  background: var(--paper-soft);
}

.tag-manager > strong {
  display: block;
  margin-bottom: 9px;
  font-size: 0.86rem;
}

.admin-disclosure .tag-manager,
.admin-disclosure .award-editor {
  margin: 0;
  border: 0;
  border-top: 1px solid var(--line);
  background: var(--paper);
}

.admin-form-disclosure {
  margin: 0;
}

.inline-form {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  margin-top: 11px;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.question-tag-picker {
  border: 1px solid var(--line);
  background: var(--paper-soft);
}

.question-tag-picker > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 46px;
  padding: 9px 11px;
  cursor: pointer;
}

.question-tag-picker > summary .label {
  margin: 0;
}

.question-tag-picker > summary .tag-row {
  justify-content: flex-end;
}

.question-tag-picker > .check-grid {
  padding: 12px;
  border-top: 1px solid var(--line);
  background: var(--paper);
}

.check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.82rem;
  cursor: pointer;
}

.check-item:hover {
  border-color: var(--line-strong);
}

.check-item input {
  accent-color: var(--accent);
}

.award-lines {
  display: grid;
  gap: 10px;
  margin: 12px 0;
}

.award-line {
  padding: 13px;
  border: 1px solid var(--line);
  background: var(--paper);
}

.question-editor {
  display: grid;
  gap: 11px;
}

.question-workspace {
  padding-top: 2px;
}

.admin-question-heading {
  align-items: flex-start;
}

.question-jump-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  background: var(--paper-soft);
}

.question-jump {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--paper);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

.question-jump:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.question-jump.active {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-contrast);
}

.question-edit {
  overflow: hidden;
  scroll-margin-top: 150px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}

.question-edit > summary {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 58px;
  padding: 11px 13px 11px 34px;
  background: var(--paper-soft);
  cursor: pointer;
  list-style: none;
}

.question-edit > summary::-webkit-details-marker {
  display: none;
}

.question-edit > summary::before {
  content: "+";
  position: absolute;
  left: 14px;
  color: var(--muted);
  font-weight: 800;
}

.question-edit[open] > summary::before {
  content: "−";
}

.question-edit > summary > span:first-of-type {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.question-edit > summary small {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.question-edit[open] {
  padding-bottom: 17px;
}

.question-edit[open] > :not(summary) {
  margin-right: 16px;
  margin-left: 16px;
}

.question-edit[open] > :nth-child(2) {
  margin-top: 17px;
}

.editor-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.admin-bottom-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 2px;
}

.question-order-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.scored-options {
  display: grid;
  gap: 10px;
}

.scored-option-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 120px;
  gap: 10px;
  padding: 11px;
  border: 1px solid var(--line);
  background: var(--paper-soft);
}

.option-count-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.8rem;
}

.image-upload-row {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
}

.image-upload-row .field {
  flex: 1 1 280px;
}

.hidden {
  display: none !important;
}

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

.card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}

@media (max-width: 1100px) {
  .topbar-primary {
    gap: 18px;
  }

  .user-label {
    display: none;
  }

  .two-column,
  .wide-form {
    grid-template-columns: 1fr;
  }

  .two-column > .panel:first-child {
    position: static;
    max-height: none;
  }

  .admin-library-panel .admin-list {
    max-height: min(420px, 50vh);
    overflow: auto;
  }

  .admin-editor-bar {
    position: static;
  }

  .admin-editor-panel {
    scroll-margin-top: 78px;
  }
}

@media (max-width: 900px) {
  .topbar-primary {
    grid-template-columns: minmax(180px, 1fr) auto;
    gap: 0 16px;
    padding-top: 8px;
  }

  .nav-actions {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
    min-height: 44px;
    border-top: 1px solid var(--line);
  }

  .topbar-tools {
    grid-column: 2;
    grid-row: 1;
  }

  .admin-editor-panel {
    scroll-margin-top: 122px;
  }

  .learning-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .overview-item:nth-child(2) {
    border-right: 0;
  }

  .overview-item:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .practice-setup-sheet {
    grid-template-columns: 1fr;
  }

  .setup-summary {
    min-height: 300px;
  }

  .setup-number {
    margin-bottom: 38px;
  }

  .score-report-grid {
    grid-template-columns: 1fr;
  }

  .score-report-grid div {
    min-height: 68px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .score-report-grid div:last-child {
    border-bottom: 0;
  }
}

@media (max-width: 720px) {
  .main {
    width: min(100% - 24px, 1160px);
    padding: 28px 0 46px;
  }

  .practice-main {
    width: 100%;
    padding: 0;
  }

  .dashboard-header {
    align-items: flex-start;
  }

  .dashboard-header h1 {
    font-size: 1.8rem;
  }

  .competition-row {
    grid-template-columns: 54px minmax(0, 1fr);
    gap: 14px;
  }

  .competition-row > .button {
    grid-column: 2;
    justify-self: start;
  }

  .set-row {
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 10px;
  }

  .set-actions {
    grid-column: 2;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .stat-card {
    grid-template-columns: minmax(110px, 0.7fr) minmax(100px, 1fr) 52px;
  }

  .stat-card small {
    display: none;
  }

  .practice-shell {
    padding-right: 12px;
    padding-left: 12px;
  }

  .single-question-card {
    padding: 28px 24px 36px;
  }

  .single-question-card .question-prompt {
    font-size: 1.18rem;
  }

  .practice-footer {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    min-height: 112px;
    padding: 8px 10px 10px;
  }

  .practice-footer .button {
    min-width: 0;
    min-height: 38px;
    padding: 7px 8px;
    font-size: 0.78rem;
  }

  .practice-footer .button.success {
    grid-column: 1 / -1;
    margin-left: 0;
  }

  .practice-progress-button {
    justify-self: stretch;
  }

  .practice-shell {
    padding-bottom: 132px;
  }

  .table-wrap {
    overflow: visible;
    border: 0;
  }

  .table-wrap table,
  .table-wrap tbody,
  .table-wrap tr,
  .table-wrap td {
    display: block;
    width: 100%;
  }

  .table-wrap thead {
    display: none;
  }

  .table-wrap tbody {
    display: grid;
    gap: 12px;
  }

  .table-wrap tr {
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius);
    background: var(--paper);
  }

  .table-wrap td {
    display: grid;
    grid-template-columns: minmax(92px, 0.36fr) minmax(0, 1fr);
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
  }

  .table-wrap td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.73rem;
    font-weight: 750;
  }

  .table-wrap td:last-child {
    border-bottom: 0;
  }

  .table-wrap td:last-child .button {
    justify-self: start;
  }

  .language-grid,
  .option-grid,
  .scored-option-row,
  .check-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .topbar-primary {
    width: calc(100% - 20px);
    grid-template-columns: auto 1fr;
    gap: 0 8px;
  }

  .brand {
    gap: 8px;
  }

  .brand-mark {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
  }

  .brand-title {
    font-size: 0.94rem;
  }

  .topbar-tools {
    gap: 4px;
  }

  .small-select {
    min-width: 72px;
    max-width: 84px;
    min-height: 34px;
    padding-right: 21px;
    font-size: 0.75rem;
  }

  .user-chip {
    display: none;
  }

  .logout-button {
    min-height: 34px;
    padding: 6px 8px;
    font-size: 0.75rem;
    white-space: nowrap;
  }

  .logout-full {
    display: none;
  }

  .logout-short {
    display: inline;
  }

  .nav-button {
    min-width: 70px;
    padding: 0 10px;
    font-size: 0.8rem;
  }

  .hero {
    min-height: calc(100vh - 148px);
    padding: 18px 0;
  }

  .auth-panel {
    padding: 22px;
  }

  .auth-brand {
    gap: 12px;
  }

  .auth-brand-mark {
    width: 46px;
    height: 46px;
    flex-basis: 46px;
  }

  .auth-brand h1 {
    font-size: 1.55rem;
  }

  .section-header,
  .dashboard-header,
  .continue-strip,
  .notebook-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-editor-bar,
  .admin-panel-heading,
  .admin-question-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-editor-bar .button-row,
  .admin-bottom-actions {
    justify-content: flex-start;
  }

  .dashboard-header .button,
  .continue-strip .button {
    align-self: flex-start;
  }

  .learning-overview {
    grid-template-columns: 1fr 1fr;
  }

  .overview-item {
    min-height: 96px;
    padding: 14px;
  }

  .overview-item strong {
    font-size: 1.35rem;
  }

  .latest-result strong {
    font-size: 0.9rem;
  }

  .competition-row {
    min-height: 0;
    padding: 18px 10px;
  }

  .competition-row::before {
    top: 18px;
    bottom: 18px;
  }

  .competition-index {
    width: 44px;
    height: 44px;
  }

  .competition-copy h3,
  .set-main h3 {
    font-size: 1rem;
  }

  .competition-copy p {
    font-size: 0.82rem;
  }

  .setup-summary,
  .setup-form {
    padding: 24px;
  }

  .setup-summary::after {
    right: 0;
    bottom: 24px;
    left: 24px;
  }

  .setup-number {
    font-size: 3rem;
  }

  .mode-options,
  .setup-field-grid {
    grid-template-columns: 1fr;
  }

  .mode-choice + .mode-choice {
    border-top: 1px solid var(--line-strong);
    border-left: 0;
  }

  .practice-room-actions {
    min-height: 58px;
    padding: 7px 8px;
  }

  .fixed-timer {
    min-width: 78px;
    font-size: 0.94rem;
  }

  .practice-command-actions {
    gap: 5px;
  }

  .practice-command-actions .button {
    min-height: 34px;
    padding: 6px 8px;
    font-size: 0.73rem;
  }

  .practice-shell {
    padding-top: 70px;
  }

  .single-question-card {
    min-height: calc(100vh - 202px);
    padding: 22px 16px 30px;
  }

  .single-question-top {
    padding-bottom: 13px;
  }

  .question-pill {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
  }

  .mark-review {
    font-size: 0.76rem;
  }

  .single-question-card .question-meta {
    gap: 6px 11px;
  }

  .single-question-card .question-meta .tag + .tag::before {
    margin-right: 11px;
  }

  .single-question-card .question-prompt {
    margin: 22px 0;
    font-size: 1.06rem;
    line-height: 1.75;
  }

  label.option {
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 10px;
    min-height: 54px;
    padding: 8px 10px;
  }

  .option-letter {
    width: 30px;
    height: 30px;
  }

  .review-overlay {
    align-items: end;
    padding: 0;
  }

  .review-panel {
    width: 100%;
    max-height: 88vh;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 6px 6px 0 0;
  }

  .review-number-grid {
    grid-template-columns: repeat(auto-fill, 40px);
    min-height: 150px;
  }

  .review-number {
    width: 40px;
    height: 40px;
  }

  .score-report-header {
    flex-direction: column;
    padding: 22px;
  }

  .score-result-band {
    padding: 22px;
  }

  .score-result-band h2 {
    font-size: 2.35rem;
  }

  .award-spotlight,
  .score-report-grid,
  .score-meter,
  .score-cutoffs {
    margin-right: 22px;
    margin-left: 22px;
  }

  .celebration-actions {
    justify-content: stretch;
    padding: 20px 22px 24px;
  }

  .celebration-actions .button {
    width: 100%;
  }

  .stat-card {
    grid-template-columns: minmax(90px, 1fr) 52px;
    gap: 11px;
  }

  .stat-meter,
  .stat-card small {
    display: none;
  }

  .question {
    padding: 18px;
  }

  .review-panel-actions {
    flex-direction: column-reverse;
  }

  .review-panel-actions .button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    transition-duration: 1ms !important;
  }
}
