:root {
  color-scheme: light;
  --bg: #f5f7f4;
  --panel: #ffffff;
  --text: #1f2933;
  --muted: #687586;
  --line: #d9e1df;
  --primary: #1e6f6a;
  --primary-dark: #15524f;
  --accent: #c4472d;
  --ok: #1d7f4e;
  --bad: #b42318;
  --warn-bg: #fff7ed;
  --ok-bg: #ecfdf3;
  --bad-bg: #fff1f0;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(135deg, rgba(30, 111, 106, 0.08), transparent 34%),
    linear-gradient(315deg, rgba(196, 71, 45, 0.08), transparent 30%),
    var(--bg);
  color: var(--text);
}

button,
select {
  font: inherit;
}

button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 16px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
}

button:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary-dark);
}

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

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

button.primary:hover:not(:disabled) {
  background: var(--primary-dark);
  color: #ffffff;
}

.app-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

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

.eyebrow {
  margin: 0 0 4px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 34px;
  line-height: 1.2;
}

.actions,
.bottom-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.controls,
.summary,
.quiz-card,
.question-list-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 18px 40px rgba(31, 41, 51, 0.08);
}

.controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 16px;
  margin-bottom: 16px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #ffffff;
  color: var(--text);
}

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

.summary div {
  display: grid;
  gap: 4px;
  min-height: 82px;
  align-content: center;
  padding: 14px;
  background: #ffffff;
}

.summary span {
  font-size: 28px;
  font-weight: 800;
}

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

.quiz-card {
  min-height: 380px;
  padding: 24px;
}

.question-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

#typeText {
  color: var(--accent);
}

#questionText {
  margin-bottom: 20px;
  font-size: 22px;
  line-height: 1.55;
}

.options {
  display: grid;
  gap: 12px;
}

.option {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #ffffff;
  color: var(--text);
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
}

.option input {
  width: 18px;
  height: 18px;
  margin-top: 3px;
  accent-color: var(--primary);
}

.option.selected {
  border-color: var(--primary);
  background: #eef9f7;
}

.option.correct {
  border-color: rgba(29, 127, 78, 0.45);
  background: var(--ok-bg);
}

.option.wrong {
  border-color: rgba(180, 35, 24, 0.45);
  background: var(--bad-bg);
}

.display-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: #edf2f1;
  color: var(--primary-dark);
  font-weight: 800;
}

.feedback {
  margin-top: 18px;
  border-radius: 8px;
  padding: 14px 16px;
  line-height: 1.6;
}

.feedback.ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.feedback.bad {
  background: var(--bad-bg);
  color: var(--bad);
}

.feedback.neutral {
  background: var(--warn-bg);
  color: #9a3412;
}

.bottom-actions {
  justify-content: center;
  margin: 16px 0;
}

.question-list-wrap {
  padding: 18px;
}

.list-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

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

#bankTitle {
  color: var(--muted);
  font-size: 14px;
  text-align: right;
}

.question-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
  gap: 8px;
}

.jump-button {
  min-width: 0;
  height: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: 8px;
  font-size: 14px;
}

.jump-button.current {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
}

.jump-button.correct {
  border-color: rgba(29, 127, 78, 0.55);
  background: var(--ok-bg);
}

.jump-button.wrong {
  border-color: rgba(180, 35, 24, 0.55);
  background: var(--bad-bg);
}

.empty-state {
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 20px, 1120px);
    padding: 18px 0;
  }

  .topbar,
  .list-header {
    display: grid;
  }

  .controls,
  .summary {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 28px;
  }

  #questionText {
    font-size: 19px;
  }

  .quiz-card {
    padding: 18px;
  }

  .actions button,
  .bottom-actions button {
    flex: 1;
  }
}
