:root {
  color-scheme: light;
  --bg: #f4f1ec;
  --panel: #ffffff;
  --ink: #1d1a16;
  --muted: #5c554d;
  --accent: #2f6f4e;
  --accent-2: #f2b84b;
  --danger: #b1492e;
  --border: #e2d9cf;
  --shadow: 0 18px 40px rgba(29, 26, 22, 0.12);
  --radius: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Trebuchet MS", "Gill Sans", "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 20% 20%, #fff7e6 0%, transparent 55%),
    radial-gradient(circle at 80% 0%, #e6f3ee 0%, transparent 50%),
    var(--bg);
  min-height: 100vh;
}

.page-header {
  padding: 56px 20px 24px;
}

.header-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 24px 28px;
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.kicker {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 700;
}

h1 {
  margin: 12px 0 10px;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
}

.lead {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.page-main {
  max-width: 980px;
  margin: 0 auto 60px;
  padding: 0 20px;
  display: grid;
  gap: 24px;
}

.notice-card {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 24px 28px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.notice-card h2 {
  margin-top: 0;
}

.notice-list {
  margin: 12px 0 0;
  padding-left: 20px;
  color: var(--muted);
}

.setup {
  display: grid;
  gap: 16px;
}

.setup-card {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 20px 24px;
  border: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  box-shadow: var(--shadow);
}

.field {
  display: grid;
  gap: 8px;
  min-width: 240px;
  font-weight: 600;
}

select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
}

textarea {
  resize: vertical;
  min-height: 140px;
}

.setup-info {
  color: var(--muted);
  padding-left: 4px;
}

.btn-primary,
.btn-secondary {
  border: none;
  border-radius: 999px;
  padding: 12px 20px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 18px rgba(47, 111, 78, 0.28);
}

.btn-secondary {
  background: #f1ebe3;
  color: var(--ink);
}

.btn-primary:hover,
.btn-secondary:hover {
  transform: translateY(-1px);
}

.btn-primary:disabled,
.btn-secondary:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

.quiz {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 24px 28px 30px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.quiz-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.quiz-title {
  font-weight: 800;
  font-size: 1.1rem;
}

.quiz-meta,
.quiz-score {
  color: var(--muted);
  font-weight: 600;
}

.progress {
  margin: 16px 0 22px;
}

progress {
  width: 100%;
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  appearance: none;
}

progress::-webkit-progress-bar {
  background: #f1e6d9;
  border-radius: 999px;
}

progress::-webkit-progress-value {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 999px;
}

progress::-moz-progress-bar {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 999px;
}

.question-card {
  background: #fcfaf7;
  border-radius: var(--radius);
  padding: 22px;
  border: 1px solid var(--border);
}

.question-count {
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.7rem;
}

.question-text {
  margin: 8px 0 18px;
}

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

.option-btn {
  text-align: left;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  font-size: 1rem;
  transition: border 0.15s ease, box-shadow 0.15s ease;
}

.option-btn:hover {
  border-color: var(--accent);
  box-shadow: 0 6px 16px rgba(47, 111, 78, 0.12);
}

.option-btn.correct {
  border-color: var(--accent);
  background: #e7f3ec;
}

.option-btn.wrong {
  border-color: var(--danger);
  background: #fde9e3;
}

.open-answer {
  display: none;
  gap: 10px;
}

.open-answer.active {
  display: grid;
}

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

.feedback {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: #f3f0eb;
  color: var(--muted);
  min-height: 48px;
}

.feedback.good {
  background: #e7f3ec;
  color: #1f5a3f;
  border: 1px solid #cde2d4;
}

.feedback.bad {
  background: #fde9e3;
  color: #8b3a28;
  border: 1px solid #f2c7ba;
}

.next-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
}

.result {
  display: grid;
  place-items: center;
}

.result-card {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 30px 32px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  max-width: 720px;
}

.result-score {
  font-size: 1.8rem;
  font-weight: 800;
  margin: 12px 0 8px;
}

.result-feedback {
  color: var(--muted);
  line-height: 1.6;
}

.result-actions {
  margin-top: 20px;
}

.hidden {
  display: none !important;
}

[hidden] {
  display: none !important;
}

@media (max-width: 720px) {
  .header-inner,
  .quiz,
  .notice-card,
  .setup-card,
  .result-card {
    padding: 20px;
  }

  .quiz-head {
    align-items: flex-start;
  }
}
