:root {
  color-scheme: light;
  --bg: #f3f6f7;
  --surface: #ffffff;
  --surface-muted: #edf3f2;
  --surface-strong: #dfe9e7;
  --text: #162426;
  --text-muted: #5b6d70;
  --border: #d4e0de;
  --primary: #0b6b5d;
  --primary-strong: #075347;
  --primary-soft: #dff2ed;
  --accent: #b94d28;
  --accent-soft: #fce9e1;
  --success: #1e7a54;
  --success-soft: #e2f4ea;
  --danger: #b42318;
  --danger-soft: #fde9e6;
  --warning: #9a6700;
  --warning-soft: #fff4d6;
  --info: #245e93;
  --info-soft: #e6f0fa;
  --shadow: 0 14px 34px rgba(23, 48, 50, 0.08);
  --shadow-soft: 0 6px 18px rgba(23, 48, 50, 0.06);
  --radius: 8px;
  --radius-small: 6px;
  --content-width: 1180px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101819;
  --surface: #172223;
  --surface-muted: #1d2a2b;
  --surface-strong: #263637;
  --text: #edf5f3;
  --text-muted: #a5b8b7;
  --border: #314242;
  --primary: #4bb8a4;
  --primary-strong: #79d3c2;
  --primary-soft: #173a35;
  --accent: #ed8a63;
  --accent-soft: #43271f;
  --success: #65c99d;
  --success-soft: #18382b;
  --danger: #ff8f85;
  --danger-soft: #432421;
  --warning: #e9ba52;
  --warning-soft: #3f3217;
  --info: #84b9e8;
  --info-soft: #1c3042;
  --shadow: 0 14px 34px rgba(0, 0, 0, 0.26);
  --shadow-soft: 0 6px 18px rgba(0, 0, 0, 0.2);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    "Microsoft YaHei",
    "PingFang SC",
    "Noto Sans CJK SC",
    "Segoe UI",
    sans-serif;
  font-size: 15px;
  line-height: 1.65;
}

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

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 33%, transparent);
  outline-offset: 2px;
}

.app-shell {
  min-height: 100vh;
  padding-right: env(safe-area-inset-right);
  padding-left: env(safe-area-inset-left);
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(100% - 32px, var(--content-width));
  margin: 0 auto;
  padding: 22px 0 16px;
}

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

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  place-items: center;
  border-radius: var(--radius);
  background: var(--primary);
  color: #ffffff;
  font-size: 22px;
  font-weight: 800;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 22px;
  line-height: 1.25;
}

h2 {
  margin-bottom: 10px;
  font-size: 24px;
  line-height: 1.3;
}

h3 {
  margin-bottom: 8px;
  font-size: 18px;
  line-height: 1.4;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.data-status {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 13px;
  white-space: nowrap;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warning);
}

.data-status.is-ready .status-dot {
  background: var(--success);
}

.data-status.is-error .status-dot {
  background: var(--danger);
}

.icon-button {
  display: inline-grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
}

.icon-button:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.icon-button svg,
.nav-item svg,
.button svg,
.ghost-button svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.9;
}

.main-nav {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  gap: 4px;
  width: 100%;
  padding: 0 max(16px, calc((100vw - var(--content-width)) / 2));
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(12px);
  overflow-x: auto;
}

.nav-item {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 50px;
  padding: 0 14px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.nav-item:hover {
  color: var(--primary);
}

.nav-item.is-active {
  border-bottom-color: var(--primary);
  color: var(--primary);
}

.nav-count {
  display: inline-grid;
  min-width: 20px;
  height: 20px;
  margin-left: 2px;
  place-items: center;
  border-radius: 10px;
  background: var(--surface-strong);
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1;
}

.app-main {
  width: min(100% - 32px, var(--content-width));
  margin: 0 auto;
  padding: 26px 0 56px;
}

.loading-panel,
.empty-panel,
.error-panel {
  display: grid;
  min-height: 320px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: center;
}

.loading-panel {
  align-content: center;
  gap: 12px;
  color: var(--text-muted);
}

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

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

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

.page-header p {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--text-muted);
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.summary-item {
  min-height: 92px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.summary-label {
  display: block;
  margin-bottom: 4px;
  color: var(--text-muted);
  font-size: 13px;
}

.summary-value {
  font-size: 25px;
  font-weight: 800;
  line-height: 1.15;
}

.layout-two-column {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  gap: 18px;
  align-items: start;
}

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

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

.panel-header h2,
.panel-header h3,
.panel-header p {
  margin-bottom: 0;
}

.panel-header p {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 13px;
}

.panel-body {
  padding: 20px;
}

.panel-body + .panel-body {
  border-top: 1px solid var(--border);
}

.form-section + .form-section {
  margin-top: 24px;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.section-title-row h3 {
  margin-bottom: 0;
  font-size: 16px;
}

.field-hint {
  color: var(--text-muted);
  font-size: 13px;
}

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

.type-card {
  position: relative;
  display: block;
  min-height: 116px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
  cursor: pointer;
}

.type-card:hover {
  border-color: var(--primary);
}

.type-card:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: inset 0 0 0 1px var(--primary);
}

.type-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.type-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.type-card-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: var(--radius-small);
  background: var(--surface);
  color: var(--primary);
}

.type-card-icon svg {
  width: 20px;
  height: 20px;
}

.type-card strong {
  display: block;
  margin-bottom: 3px;
  font-size: 16px;
}

.type-card small {
  display: block;
  color: var(--text-muted);
  line-height: 1.5;
}

.type-check {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
}

.type-card:has(input:checked) .type-check {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
}

.type-check::after {
  content: "";
  display: none;
  width: 9px;
  height: 5px;
  border-bottom: 2px solid currentColor;
  border-left: 2px solid currentColor;
  transform: rotate(-45deg) translateY(-1px);
}

.type-card:has(input:checked) .type-check::after {
  display: block;
}

.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.segmented button,
.preset-button {
  min-height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-small);
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.segmented button:hover,
.preset-button:hover {
  color: var(--primary);
}

.segmented button.is-active,
.preset-button.is-active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: 0 1px 4px rgba(23, 48, 50, 0.1);
}

.number-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.preset-button {
  border: 1px solid var(--border);
  background: var(--surface);
}

.preset-button.is-active {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.inline-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field {
  display: grid;
  gap: 6px;
}

.field > label,
.field > span {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
}

.input,
.select {
  width: 100%;
  min-height: 42px;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--surface);
  color: var(--text);
}

.input[type="number"] {
  appearance: textfield;
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--surface-muted);
}

.checkbox-row input {
  width: 18px;
  height: 18px;
  margin: 3px 0 0;
  accent-color: var(--primary);
}

.checkbox-row strong {
  display: block;
  font-size: 14px;
}

.checkbox-row small {
  display: block;
  color: var(--text-muted);
  line-height: 1.5;
}

.quota-list {
  display: grid;
  gap: 10px;
}

.quota-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px;
  gap: 12px;
  align-items: center;
}

.quota-row label {
  font-weight: 700;
}

.quota-row small {
  display: block;
  color: var(--text-muted);
  font-weight: 400;
}

.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--info);
  border-radius: var(--radius-small);
  background: var(--info-soft);
  color: var(--info);
  font-size: 13px;
}

.notice svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  margin-top: 2px;
}

.notice.is-danger {
  border-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
}

.notice.is-warning {
  border-color: var(--warning);
  background: var(--warning-soft);
  color: var(--warning);
}

.notice.is-success {
  border-color: var(--success);
  background: var(--success-soft);
  color: var(--success);
}

.sticky-actions {
  position: sticky;
  bottom: 14px;
  z-index: 10;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.button,
.ghost-button,
.danger-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-small);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}

.button {
  background: var(--primary);
  color: #ffffff;
  box-shadow: var(--shadow-soft);
}

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

.button:disabled {
  background: var(--surface-strong);
  color: var(--text-muted);
  box-shadow: none;
  cursor: not-allowed;
}

.ghost-button {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
}

.ghost-button:hover {
  border-color: var(--primary);
  color: var(--primary);
}

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

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

.quiz-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 292px;
  gap: 18px;
  align-items: start;
}

.quiz-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.quiz-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--text-muted);
  font-size: 13px;
}

.quiz-meta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.quiz-meta svg {
  width: 16px;
  height: 16px;
}

.progress-track {
  height: 8px;
  margin-bottom: 18px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--surface-strong);
}

.progress-bar {
  height: 100%;
  width: 0;
  background: var(--primary);
  transition: width 0.18s ease;
}

.question-card {
  padding: 24px;
}

.question-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.question-index {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 0 9px;
  border-radius: 4px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
}

.question-stem {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.75;
  white-space: pre-wrap;
}

.question-source {
  margin-top: 12px;
  color: var(--text-muted);
  font-size: 12px;
}

.options-list {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.option-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 56px;
  padding: 14px 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
}

.option-item:hover {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary-soft) 38%, var(--surface));
}

.option-item:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: inset 0 0 0 1px var(--primary);
}

.option-item:has(input:disabled) {
  cursor: default;
}

.option-item input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.option-key {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 800;
}

.option-item:has(input:checked) .option-key {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
}

.option-content {
  padding-top: 2px;
}

.answer-feedback {
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
}

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

.answer-feedback.is-wrong {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.answer-feedback p:last-child {
  margin-bottom: 0;
}

.question-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.action-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.nav-panel {
  position: sticky;
  top: 68px;
}

.nav-groups {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
  max-height: 330px;
  overflow-y: auto;
  padding-right: 4px;
}

.question-nav-button {
  position: relative;
  display: grid;
  min-width: 0;
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.question-nav-button:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.question-nav-button.is-answered {
  border-color: var(--success);
  background: var(--success-soft);
  color: var(--success);
}

.question-nav-button.is-current {
  outline: 3px solid color-mix(in srgb, var(--primary) 30%, transparent);
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
}

.question-nav-button.is-flagged::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 4px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.legend-list {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  color: var(--text-muted);
  font-size: 12px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-swatch {
  width: 16px;
  height: 16px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
}

.legend-swatch.answered {
  border-color: var(--success);
  background: var(--success-soft);
}

.legend-swatch.current {
  border-color: var(--primary);
  background: var(--primary);
}

.legend-swatch.flagged {
  position: relative;
}

.legend-swatch.flagged::after {
  content: "";
  position: absolute;
  top: 2px;
  right: 2px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.result-hero {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 22px;
  align-items: center;
  margin-bottom: 18px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.score-ring {
  display: grid;
  width: 164px;
  height: 164px;
  place-items: center;
  margin: 0 auto;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, var(--surface) 62%, transparent 63%),
    conic-gradient(var(--primary) var(--score-angle, 0deg), var(--surface-strong) 0);
}

.score-ring-inner {
  text-align: center;
}

.score-ring strong {
  display: block;
  font-size: 38px;
  line-height: 1;
}

.score-ring span {
  color: var(--text-muted);
  font-size: 12px;
}

.result-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.result-card {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--surface-muted);
}

.result-card span {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
}

.result-card strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
}

.table-wrap {
  overflow-x: auto;
}

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

.data-table th,
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.data-table th {
  background: var(--surface-muted);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

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

.data-table .numeric {
  text-align: center;
  white-space: nowrap;
}

.status-badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status-badge.correct,
.status-badge.answered,
.status-badge.ok {
  background: var(--success-soft);
  color: var(--success);
}

.status-badge.wrong,
.status-badge.error {
  background: var(--danger-soft);
  color: var(--danger);
}

.status-badge.unanswered,
.status-badge.review {
  background: var(--warning-soft);
  color: var(--warning);
}

.status-badge.excluded,
.status-badge.muted {
  background: var(--surface-strong);
  color: var(--text-muted);
}

.wrong-list {
  display: grid;
  gap: 12px;
}

.wrong-item {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.wrong-item h3 {
  font-size: 16px;
}

.answer-line {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 10px 0;
  color: var(--text-muted);
  font-size: 13px;
}

.answer-line strong {
  color: var(--text);
}

.analysis-box {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--surface-muted);
}

.analysis-box p:last-child {
  margin-bottom: 0;
}

.filter-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.6fr) repeat(2, minmax(130px, 0.7fr));
  gap: 10px;
  margin-bottom: 14px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
}

.pagination span {
  min-width: 80px;
  color: var(--text-muted);
  text-align: center;
  font-size: 13px;
}

.bank-question {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

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

.bank-question header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.bank-question h3 {
  flex: 1;
  font-size: 15px;
  font-weight: 700;
}

.bank-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px 14px;
  margin: 10px 0;
  color: var(--text-muted);
  font-size: 13px;
}

.bank-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--text-muted);
  font-size: 12px;
}

.empty-state {
  padding: 38px 20px;
  color: var(--text-muted);
  text-align: center;
}

.empty-state svg {
  width: 36px;
  height: 36px;
  margin-bottom: 8px;
  color: var(--text-muted);
}

.toast-region {
  position: fixed;
  z-index: 100;
  right: 18px;
  bottom: max(18px, env(safe-area-inset-bottom));
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 36px));
}

@supports (padding-top: env(safe-area-inset-top)) {
  .app-header {
    padding-top: max(22px, env(safe-area-inset-top));
  }
}

.toast {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--info);
  border-radius: var(--radius-small);
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 13px;
}

.toast.success {
  border-left-color: var(--success);
}

.toast.error {
  border-left-color: var(--danger);
}

.toast.warning {
  border-left-color: var(--warning);
}

.modal-backdrop {
  position: fixed;
  z-index: 200;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(10, 22, 23, 0.52);
}

.modal {
  width: min(100%, 520px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.24);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  margin-bottom: 0;
  font-size: 19px;
}

.modal-body {
  padding: 20px;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 20px 20px;
}

.hidden {
  display: none !important;
}

@media (max-width: 980px) {
  .layout-two-column,
  .quiz-shell {
    grid-template-columns: 1fr;
  }

  .nav-panel {
    position: static;
    order: -1;
  }

  .nav-groups {
    max-height: none;
  }

  .result-hero {
    grid-template-columns: 180px minmax(0, 1fr);
  }

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

@media (max-width: 720px) {
  .app-header {
    align-items: flex-start;
    padding-top: 16px;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
    flex-basis: 40px;
    font-size: 20px;
  }

  h1 {
    font-size: 17px;
  }

  .data-status {
    display: none;
  }

  .main-nav {
    padding: 0 8px;
  }

  .nav-item {
    min-height: 46px;
    padding: 0 10px;
    font-size: 13px;
  }

  .nav-item svg {
    display: none;
  }

  .app-main {
    width: min(100% - 22px, var(--content-width));
    padding-top: 18px;
  }

  .page-header {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .type-grid,
  .inline-fields,
  .filter-row,
  .bank-options {
    grid-template-columns: 1fr;
  }

  .panel-header,
  .panel-body,
  .question-card,
  .result-hero {
    padding: 16px;
  }

  .sticky-actions {
    bottom: 8px;
  }

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

  .quiz-topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .question-stem {
    font-size: 16px;
  }

  .question-actions,
  .action-group {
    width: 100%;
  }

  .question-actions .ghost-button,
  .question-actions .button {
    flex: 1 1 auto;
  }

  .nav-groups {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .result-hero {
    grid-template-columns: 1fr;
  }

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

  .data-table th,
  .data-table td {
    padding: 10px;
  }
}

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