:root {
  color-scheme: light;
  --ink: #172d29;
  --muted: #71817d;
  --cream: #f5f0e6;
  --paper: #fffdf8;
  --green: #0f6957;
  --green-dark: #102a25;
  --mint: #d5eadf;
  --gold: #d79b45;
  --wrong: #b84e46;
  --shadow: 0 18px 45px rgba(17, 42, 37, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: #d8e4dd;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button { font: inherit; }

.app-shell {
  width: min(100%, 520px);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: var(--cream);
  box-shadow: var(--shadow);
}

.screen { min-height: 100vh; min-height: 100dvh; }
.hidden { display: none !important; }

.hero {
  position: relative;
  min-height: 355px;
  padding: calc(46px + env(safe-area-inset-top)) 28px 38px;
  overflow: hidden;
  color: #f8f4e9;
  background:
    radial-gradient(circle at 90% 12%, rgba(117, 186, 153, .28), transparent 25%),
    linear-gradient(145deg, #173b33, #0d5548);
  border-radius: 0 0 38px 38px;
}

.brand-mark {
  position: absolute;
  top: calc(20px + env(safe-area-inset-top));
  right: 24px;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 50%;
  font: 600 20px Georgia, serif;
}

.eyebrow {
  margin-bottom: 16px;
  color: #9bc6b5;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}

h1 {
  max-width: 330px;
  margin: 0;
  font: 500 clamp(47px, 14vw, 68px)/.9 Georgia, "Times New Roman", serif;
  letter-spacing: -.045em;
}

h1 span { color: #e6b76e; font-style: italic; }
.hero p { max-width: 295px; margin: 24px 0 0; color: #c8dcd4; line-height: 1.55; }

.crystal { position: absolute; opacity: .18; transform: rotate(25deg); }
.crystal::before, .crystal::after { content: ""; position: absolute; inset: 0; border: 1px solid #d5eadf; transform: rotate(60deg); }
.crystal-one { right: 45px; bottom: 45px; width: 65px; height: 90px; border: 1px solid #d5eadf; }
.crystal-two { right: -20px; bottom: -20px; width: 110px; height: 150px; border: 1px solid #d5eadf; }

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin: 28px 20px 22px;
  background: #dcd8cf;
  border-radius: 20px;
  overflow: hidden;
}

.stats div { padding: 17px 8px; background: var(--paper); text-align: center; }
.stats strong { display: block; font: 600 25px Georgia, serif; }
.stats span { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }

.actions { display: grid; gap: 12px; padding: 0 20px; }
button { border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.primary-button, .secondary-button, .next-button {
  display: flex;
  min-height: 60px;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-radius: 18px;
  font-weight: 750;
}
.primary-button { color: white; background: var(--green); box-shadow: 0 10px 25px rgba(15, 105, 87, .22); }
.primary-button b { font-size: 25px; font-weight: 400; }
.secondary-button { color: var(--ink); background: var(--paper); border: 1px solid #e2ddd3; }
.secondary-button i { margin-right: 9px; color: var(--gold); font-style: normal; }
.secondary-button b { min-width: 28px; padding: 5px 8px; border-radius: 99px; background: #eee8dc; font-size: 12px; }
.secondary-button:disabled { opacity: .45; cursor: default; }
.hint { margin: 18px 20px; color: var(--muted); font-size: 12px; text-align: center; }

.quiz-screen { padding: calc(18px + env(safe-area-inset-top)) 20px calc(20px + env(safe-area-inset-bottom)); }
.quiz-header { display: flex; align-items: center; gap: 14px; }
.icon-button { flex: 0 0 42px; width: 42px; height: 42px; border-radius: 50%; color: var(--ink); background: #e7e1d7; font-size: 25px; }
.progress-wrap { flex: 1; }
.progress-meta { display: flex; justify-content: space-between; margin-bottom: 8px; color: var(--muted); font-size: 11px; font-weight: 700; }
.progress-track { height: 5px; overflow: hidden; border-radius: 99px; background: #dfd9cf; }
.progress-track div { width: 10%; height: 100%; border-radius: inherit; background: var(--green); transition: width .25s ease; }

.question-card { padding: 52px 2px 20px; }
.question-number { margin-bottom: 18px; color: var(--gold); font: italic 600 18px Georgia, serif; }
.question-card h2 { min-height: 116px; margin: 0 0 28px; font: 500 clamp(28px, 7.7vw, 38px)/1.12 Georgia, serif; letter-spacing: -.025em; }
.answers { display: grid; gap: 11px; }
.answer {
  position: relative;
  display: flex;
  min-height: 66px;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 12px 46px 12px 13px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid #ded8ce;
  border-radius: 17px;
  text-align: left;
  transition: transform .12s ease, border-color .15s ease, background .15s ease;
}
.answer:active { transform: scale(.985); }
.answer-letter { display: grid; flex: 0 0 38px; width: 38px; height: 38px; place-items: center; border-radius: 11px; color: var(--green); background: var(--mint); font-weight: 800; }
.answer-text { line-height: 1.3; }
.answer.correct { border-color: #87b9a5; background: #e7f3ed; }
.answer.wrong { border-color: #d89b96; background: #f8e9e7; }
.answer.correct::after, .answer.wrong::after { position: absolute; right: 17px; font-weight: 900; }
.answer.correct::after { content: "✓"; color: var(--green); }
.answer.wrong::after { content: "×"; color: var(--wrong); }
.answer:disabled { cursor: default; }
.reveal-button {
  min-height: 116px;
  padding: 20px;
  color: var(--green);
  background: var(--paper);
  border: 1px dashed #9ebcb0;
  border-radius: 18px;
  font-weight: 800;
}
.reveal-button span { display: block; margin-bottom: 10px; color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.reveal-button strong { color: var(--ink); font: 500 28px/1.15 Georgia, serif; }
.self-grading { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.self-grading button { min-height: 52px; border-radius: 15px; color: var(--ink); background: #e4ded4; font-weight: 750; }
.self-grading button:last-child { color: white; background: var(--green); }
.self-grading button:disabled { opacity: .65; cursor: default; }
.next-button { width: 100%; margin-top: 12px; color: white; background: var(--green-dark); }

.result-screen { padding: calc(70px + env(safe-area-inset-top)) 25px calc(30px + env(safe-area-inset-bottom)); text-align: center; }
.result-gem { display: grid; width: 95px; height: 95px; margin: 0 auto 34px; place-items: center; color: #f7e2ae; background: var(--green); border-radius: 28px 48px 30px 50px; font-size: 46px; transform: rotate(8deg); }
.result-screen .eyebrow { color: var(--green); }
.result-screen h2 { margin: 0; font: 500 43px/1 Georgia, serif; }
.result-score { margin: 35px 0 12px; color: var(--green); }
.result-score strong { font: 600 82px/.9 Georgia, serif; }
.result-score span { color: var(--muted); font: 500 25px Georgia, serif; }
.result-screen p { min-height: 48px; margin: 0 auto 35px; color: var(--muted); line-height: 1.5; }
.result-screen .primary-button { width: 100%; }
.text-button { margin-top: 14px; padding: 14px; color: var(--green); background: transparent; font-weight: 750; }

@media (min-width: 600px) {
  body { padding: 24px 0; }
  .app-shell, .screen { min-height: calc(100vh - 48px); }
  .app-shell { border-radius: 30px; }
}

@media (max-height: 700px) {
  .hero { min-height: 300px; padding-top: calc(35px + env(safe-area-inset-top)); }
  .question-card { padding-top: 32px; }
  .question-card h2 { min-height: 85px; margin-bottom: 18px; }
  .answer { min-height: 57px; }
}
