:root {
  color-scheme: light;
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  background: #f5f7fb;
  color: #172033;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
}

[hidden] {
  display: none !important;
}

button {
  border: 1px solid #c8d1df;
  border-radius: 8px;
  background: #fff;
  color: #172033;
  cursor: pointer;
  font: inherit;
  min-height: 40px;
  padding: 8px 14px;
}

input {
  border: 1px solid #c8d1df;
  border-radius: 8px;
  color: inherit;
  font: inherit;
  min-height: 42px;
  padding: 8px 12px;
  width: 100%;
}

button:hover:not(:disabled) {
  border-color: #3b73ff;
}

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

.app-shell {
  margin: 0 auto;
  max-width: 980px;
  padding: 28px 20px 36px;
}

.auth-gate {
  align-items: center;
  display: flex;
  min-height: 100vh;
  padding: 20px;
}

.page-anchor {
  height: 0;
  overflow: hidden;
}

.auth-panel {
  background: #fff;
  border: 1px solid #dfe5ee;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(27, 45, 78, 0.08);
  display: grid;
  gap: 12px;
  margin: 0 auto;
  max-width: 380px;
  padding: 24px;
  width: 100%;
}

.auth-panel h1 {
  margin-bottom: 0;
}

.auth-panel p {
  color: #60708a;
  line-height: 1.6;
}

.auth-panel label {
  color: #365380;
  font-size: 14px;
}

.auth-error {
  color: #b42318;
  min-height: 22px;
}

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

.topbar-controls {
  align-items: flex-end;
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  gap: 8px;
}

h1 {
  font-size: 30px;
  line-height: 1.2;
  margin: 0 0 8px;
}

p {
  margin: 0;
}

#bankSummary,
#storageHint {
  color: #60708a;
  font-size: 14px;
}

.mode-tabs {
  background: #e8edf5;
  border-radius: 8px;
  display: flex;
  gap: 4px;
  padding: 4px;
}

.mode-tabs button {
  background: transparent;
  border: 0;
}

.mode-tabs button.active {
  background: #fff;
  box-shadow: 0 1px 4px rgba(27, 45, 78, 0.14);
}

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

.stats-row div {
  background: #fff;
  border: 1px solid #dfe5ee;
  border-radius: 8px;
  padding: 12px;
}

.stats-row span {
  color: #60708a;
  display: block;
  font-size: 13px;
  margin-bottom: 4px;
}

.stats-row strong {
  font-size: 24px;
}

.coverage-panel {
  background: #fff;
  border: 1px solid #dfe5ee;
  border-radius: 8px;
  margin-bottom: 18px;
  padding: 14px;
}

.coverage-header,
.coverage-detail {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.coverage-header {
  margin-bottom: 10px;
}

.coverage-header span {
  color: #265ff5;
  font-weight: 700;
}

.coverage-track {
  background: #e8edf5;
  border-radius: 999px;
  height: 12px;
  overflow: hidden;
}

.coverage-bar {
  background: #265ff5;
  border-radius: inherit;
  height: 100%;
  transition: width 160ms ease;
  width: 0%;
}

.coverage-detail {
  color: #60708a;
  font-size: 13px;
  margin-top: 8px;
}

.quiz-card,
.empty-state {
  background: #fff;
  border: 1px solid #dfe5ee;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(27, 45, 78, 0.08);
  padding: 22px;
}

.question-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.question-meta span {
  background: #eef3ff;
  border-radius: 999px;
  color: #365380;
  font-size: 13px;
  padding: 4px 10px;
}

#questionText {
  font-size: 22px;
  font-weight: 650;
  line-height: 1.55;
  margin: 0 0 20px;
  overflow-wrap: anywhere;
}

.answer-area {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.answer-input {
  border: 1px solid #c8d1df;
  border-radius: 8px;
  font: inherit;
  min-height: 92px;
  padding: 12px;
  resize: vertical;
  width: 100%;
}

.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.answer-box,
.feedback {
  border-radius: 8px;
  line-height: 1.6;
  padding: 12px;
  white-space: pre-wrap;
}

.answer-box {
  background: #f8fafc;
  border: 1px solid #dfe5ee;
  height: 84px;
  overflow: auto;
}

.feedback {
  background: #fff7e6;
  border: 1px solid #f4d58d;
  height: 72px;
  margin-bottom: 14px;
  overflow: auto;
  overflow-wrap: anywhere;
}

.is-placeholder {
  visibility: hidden;
}

.feedback.correct {
  background: #edf8ef;
  border-color: #9ad5a5;
}

.feedback.wrong {
  background: #fff0f0;
  border-color: #eca3a3;
}

.actions,
.footer-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.auto-next-toggle {
  align-items: center;
  color: #365380;
  display: inline-flex;
  gap: 6px;
  min-height: 40px;
  padding: 0 4px;
}

.auto-next-toggle input {
  height: 16px;
  width: 16px;
}

.primary {
  background: #265ff5;
  border-color: #265ff5;
  color: #fff;
}

.footer-actions {
  margin-top: 16px;
}

.empty-state h2 {
  margin: 0 0 10px;
}

.empty-state p {
  color: #60708a;
  line-height: 1.7;
  margin-bottom: 16px;
}

@media (max-width: 720px) {
  .app-shell {
    padding: 18px 12px 28px;
  }

  .topbar {
    display: block;
  }

  .topbar-controls {
    align-items: stretch;
    margin-top: 14px;
  }

  .mode-tabs {
    width: 100%;
  }

  .mode-tabs button {
    flex: 1;
  }

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

  .coverage-detail {
    align-items: flex-start;
    flex-direction: column;
  }

  #questionText {
    font-size: 19px;
  }
}
