:root {
  --bg: #f4f0e8;
  --paper: #fffdf8;
  --ink: #20201d;
  --muted: #69635a;
  --soft: #efe7d8;
  --line: #d9cfbd;
  --accent: #176b70;
  --accent-dark: #0f4c50;
  --accent-soft: #e3f1ef;
  --gold: #c48622;
  --good: #1e7446;
  --good-bg: #e8f6ee;
  --bad: #b33d34;
  --bad-bg: #fff0ed;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 8%, rgba(23, 107, 112, 0.12), transparent 30%),
    linear-gradient(135deg, #f7f2e9 0%, #eef4f1 52%, #f8f0e4 100%);
  font-family: Arial, "Helvetica Neue", sans-serif;
  line-height: 1.5;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px clamp(16px, 4vw, 46px);
}

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

h1 {
  margin: 0;
  font-size: clamp(28px, 5vw, 48px);
  line-height: 1.02;
}

.exam-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.toggle,
.time-select {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid rgba(217, 207, 189, 0.82);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 253, 248, 0.72);
  font-size: 14px;
}

select,
button,
input {
  font: inherit;
}

select {
  height: 34px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 7px;
  padding: 0 16px;
  color: #fff;
  background: var(--accent);
  font-weight: 800;
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

button:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(25, 77, 80, 0.16);
}

button.secondary {
  background: #2f4a53;
}

button.ghost {
  color: var(--ink);
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.78);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

main {
  width: min(940px, calc(100% - 28px));
  margin: 24px auto 44px;
}

.status-panel {
  display: flex;
  justify-content: center;
  width: 100%;
  margin: 6px 0 0;
  padding: 0;
}

.stat {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  min-height: 58px;
  padding: 10px clamp(16px, 4vw, 46px);
  border-block: 1px solid rgba(217, 207, 189, 0.86);
  background: rgba(255, 253, 248, 0.82);
  box-shadow: 0 10px 28px rgba(77, 60, 35, 0.05);
  text-align: center;
}

.label {
  display: inline-block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.stat strong {
  display: inline-block;
  margin-top: 0;
  font-size: clamp(20px, 4vw, 26px);
  line-height: 1.15;
}

.quiz-card {
  min-height: 420px;
  padding: clamp(22px, 5vw, 46px);
  border: 1px solid rgba(217, 207, 189, 0.9);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.94);
  box-shadow: 0 22px 55px rgba(76, 63, 40, 0.12);
}

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

.section-title {
  margin: 0;
  color: var(--accent-dark);
  font-size: 16px;
  font-weight: 800;
}

.subsection-title {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.question-pill {
  flex: 0 0 auto;
  min-width: 84px;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-weight: 900;
  text-align: center;
}

.prompt {
  margin: 0 0 28px;
  font-size: clamp(25px, 5vw, 40px);
  font-weight: 800;
  line-height: 1.2;
}

.answer-line {
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.prefix {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  min-height: 56px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--accent-dark);
  background: #f8f2e8;
  font-weight: 900;
}

.answer-input {
  width: 100%;
  min-height: 56px;
  padding: 12px 14px;
  border: 1px solid #cdbfaa;
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
  font-size: 18px;
}

.answer-input:focus {
  border-color: var(--gold);
  outline: 4px solid rgba(196, 134, 34, 0.18);
}

.feedback {
  min-height: 56px;
  margin-top: 14px;
  padding: 13px 14px;
  border-radius: 7px;
  color: var(--muted);
  background: var(--soft);
  font-size: 15px;
}

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

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

.answer-reveal {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-weight: 800;
}

.submit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 18px;
}

.primary-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.submit-row button {
  min-width: 128px;
  min-height: 48px;
}

.summary {
  margin: 16px 0 0;
  color: var(--accent-dark);
  font-weight: 900;
  text-align: center;
}

@media (max-width: 780px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding-bottom: 12px;
  }

  .exam-controls {
    justify-content: flex-start;
  }

  .status-panel {
    justify-content: center;
  }

  .quiz-card {
    min-height: 390px;
  }
}

@media (max-width: 560px) {
  main {
    width: min(100% - 18px, 940px);
    margin-bottom: 28px;
  }

  .topbar {
    gap: 14px;
  }

  .exam-controls,
  .primary-actions,
  .submit-row {
    width: 100%;
  }

  .toggle,
  .time-select {
    flex: 1 1 145px;
  }

  .exam-controls button {
    flex: 1 1 118px;
  }

  .stat {
    min-height: 56px;
    padding: 10px 16px;
  }

  .quiz-card {
    min-height: 430px;
    padding: 20px 16px;
  }

  .card-top {
    flex-direction: column-reverse;
    margin-bottom: 22px;
  }

  .question-pill {
    align-self: flex-start;
  }

  .answer-line {
    flex-direction: column;
  }

  .prefix {
    min-height: 42px;
    justify-content: center;
  }

  .submit-row {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .primary-actions {
    flex-direction: column;
  }

  .submit-row button {
    width: 100%;
  }
}
