:root {
  color-scheme: light;
  --paper: #f3f0e9;
  --surface: #fffdf8;
  --ink: #1f2930;
  --muted: #606a70;
  --line: #cbc8c0;
  --accent: #d95f45;
  --accent-dark: #a83f2d;
  --accent-soft: #f5d8cf;
  --teal: #2f6961;
  --teal-soft: #d8e6e0;
  --shadow: 0 8px 24px rgba(42, 48, 48, 0.08);
  --radius: 10px;
  font-family: "Avenir Next", Avenir, "Segoe UI", Helvetica, Arial, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--paper); }

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--ink);
  background:
    linear-gradient(rgba(31, 41, 48, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 41, 48, 0.025) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
  -webkit-font-smoothing: antialiased;
}

button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 10;
  padding: 10px 14px;
  color: var(--surface);
  background: var(--ink);
  transform: translateY(-150%);
  border-radius: 8px;
}
.skip-link:focus { transform: translateY(0); }

.app-header {
  min-height: 70px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 15px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
  font-size: 18px;
  font-weight: 750;
  letter-spacing: -0.02em;
}

main { min-height: calc(100dvh - 70px); }

.screen {
  display: none;
  width: min(1060px, calc(100% - 48px));
  margin: 0 auto;
  padding: clamp(50px, 8vh, 92px) 0;
}
.screen.is-active { display: grid; }

.start-screen {
  min-height: calc(100dvh - 70px);
  grid-template-columns: minmax(0, 760px);
  align-items: center;
}

.start-copy h1, .results-copy h1, .review-header h1 {
  margin: 0 0 24px;
  font-size: clamp(58px, 9vw, 102px);
  line-height: .88;
  letter-spacing: -.065em;
}
.start-copy h1 span { color: var(--accent); }
.start-copy .intro { max-width: 720px; margin: 0 0 38px; color: #414d53; font-size: clamp(28px, 3.2vw, 38px); line-height: 1.38; letter-spacing: -.025em; }

.button {
  min-height: 50px;
  padding: 12px 21px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  border: 2px solid transparent;
  border-radius: 11px;
  cursor: pointer;
  font-weight: 800;
  transition: transform 160ms ease, background-color 160ms ease, border-color 160ms ease;
}
.button:hover { transform: translateY(-2px); }
.button:active { transform: translateY(1px); }
.button-primary { color: #fffaf3; background: var(--accent-dark); }
.button-primary:hover { background: #8f3425; }
.start-copy .button-primary { min-height: 58px; padding: 14px 25px; font-size: 18px; }
.button-dark { color: #fffaf3; background: var(--ink); }
.button-dark:hover { background: #111a20; }
.button-outline { color: var(--ink); background: transparent; border-color: var(--ink); }
.button-outline:hover { background: var(--surface); }

button:focus-visible, a:focus-visible { outline: 3px solid #0f766e; outline-offset: 3px; }

.game-screen { max-width: 900px; min-height: calc(100dvh - 70px); padding: 18px 0 22px; }
.game-screen.is-active { display: block; }
.game-topline { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.round-count { margin: 0; font-size: 20px; font-weight: 850; }
.text-button { padding: 10px 0; border: 0; color: var(--ink); background: transparent; cursor: pointer; font-size: 17px; text-decoration: underline; text-underline-offset: 4px; white-space: nowrap; }

.message-card {
  position: relative;
  overflow: hidden;
  padding: clamp(18px, 2.5vh, 24px) clamp(20px, 4vw, 34px);
  background: var(--surface);
  border: 1px solid #b9b8b1;
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.message-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 6px; background: var(--accent); }
.card-heading { padding-bottom: 12px; border-bottom: 1px solid #d8d6d0; }
.card-type { margin: 0; color: var(--accent-dark); font-size: 22px; line-height: 1.2; letter-spacing: -.02em; }
.scenario { max-width: 800px; margin: 0; padding-top: 16px; font-size: clamp(21px, 2.6vw, 28px); line-height: 1.3; letter-spacing: -.025em; }
.is-hidden { display: none !important; }

.answer-area { margin-top: 14px; }
.choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.choices[data-count="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.choice {
  min-height: 54px;
  padding: 10px 14px;
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid #989a96;
  border-radius: 7px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 750;
  text-align: left;
  transition: transform 140ms ease, border-color 140ms ease, background-color 140ms ease;
}
.choice:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--ink); }
.choice:disabled { cursor: default; opacity: .72; }
.choice.is-correct { border-color: var(--teal); background: var(--teal-soft); opacity: 1; }
.choice.is-wrong { border-color: var(--accent-dark); background: var(--accent-soft); opacity: 1; }

.feedback {
  margin-top: 12px;
  padding: 12px;
  display: grid;
  grid-template-columns: 38px 1fr auto;
  gap: 12px;
  align-items: center;
  background: #e6e3dc;
  border-radius: var(--radius);
}
.feedback.is-correct { background: var(--teal-soft); }
.feedback.is-wrong { background: var(--accent-soft); }
.feedback-mark { width: 36px; height: 36px; display: grid; place-items: center; border: 2px solid currentColor; border-radius: 50%; font-size: 21px; font-weight: 850; }
.feedback-copy h2 { margin: 0 0 3px; font-size: 18px; }
.feedback-copy p { margin: 0; color: #3f4b50; font-size: 16px; line-height: 1.35; }
.feedback .button { min-height: 44px; padding: 9px 16px; gap: 8px; }

.results-screen { min-height: calc(100dvh - 70px); grid-template-columns: minmax(0, 720px); align-items: center; }
.results-copy h1 { font-size: clamp(54px, 8vw, 88px); }
.results-copy h1 span { color: var(--accent-dark); }
.results-message { max-width: 640px; margin: 0 0 30px; font-size: 24px; line-height: 1.45; }
.results-actions { display: flex; flex-wrap: wrap; gap: 12px; }

.review-screen { max-width: 920px; padding-top: 50px; }
.review-screen.is-active { display: block; }
.review-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 36px; }
.review-header h1 { margin: 8px 0 10px; font-size: clamp(48px, 7vw, 76px); }
.review-header p:last-child { margin: 0; color: var(--muted); font-size: 18px; }
.review-list { display: grid; gap: 18px; }
.review-card { padding: clamp(22px, 4vw, 34px); background: var(--surface); border-left: 6px solid var(--accent); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(42,48,48,.08); }
.review-card header { display: flex; justify-content: space-between; gap: 15px; align-items: center; margin-bottom: 16px; }
.review-card h2 { margin: 0; font-size: 20px; color: var(--accent-dark); }
.review-card .review-answer { margin: 0; font-size: 17px; font-weight: 750; }
.review-card .review-scenario { margin: 0 0 16px; font-size: 21px; line-height: 1.45; }
.review-card .review-explanation { margin: 0; padding-top: 16px; border-top: 1px solid var(--line); color: #465359; font-size: 18px; line-height: 1.5; }

@media (max-width: 760px) {
  .app-header { padding-inline: 18px; }
  .screen { width: min(100% - 32px, 620px); padding: 36px 0 52px; }
  .start-screen, .results-screen { min-height: calc(100dvh - 70px); grid-template-columns: 1fr; }
  .start-copy h1 { font-size: clamp(58px, 19vw, 86px); }
  .game-screen { padding: 14px 0 18px; }
  .game-topline { margin-bottom: 10px; }
  .message-card { padding: 18px; }
  .card-heading { padding-bottom: 10px; }
  .card-type { font-size: 20px; }
  .scenario { padding-top: 14px; font-size: 20px; line-height: 1.28; }
  .answer-area { margin-top: 12px; }
  .choices, .choices[data-count="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .choice { min-height: 50px; padding: 8px 10px; font-size: 14px; }
  .feedback { margin-top: 10px; grid-template-columns: 36px 1fr; gap: 10px; align-items: start; }
  .feedback .button { grid-column: 1 / -1; width: 100%; }
  .review-header { align-items: flex-start; flex-direction: column; }
  .review-card header { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: no-preference) {
  .screen.is-active { animation: screen-in 260ms ease both; }
  .feedback:not(.is-hidden) { animation: feedback-in 220ms ease both; }
  @keyframes screen-in { from { opacity: 0; transform: translateY(8px); } }
  @keyframes feedback-in { from { opacity: 0; transform: translateY(5px); } }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --paper: #171d20;
    --surface: #222a2e;
    --ink: #eef0eb;
    --muted: #b6c0c0;
    --line: #4a5557;
    --accent: #ee8065;
    --accent-dark: #ff9b83;
    --accent-soft: #563129;
    --teal: #4e8c82;
    --teal-soft: #29433f;
    --shadow: 0 8px 24px rgba(0, 0, 0, .22);
  }
  body { background-color: var(--paper); }
  .button-primary { color: #231915; background: #ff9b83; }
  .button-primary:hover { background: #ffad98; }
  .button-dark { color: #182023; background: #eef0eb; }
  .button-dark:hover { background: #fffdf8; }
  .button-outline { color: var(--ink); border-color: var(--ink); }
  .start-copy .intro, .feedback-copy p, .review-card .review-explanation { color: #d2d9d7; }
  .message-card { border-color: #606a6c; }
  .choice { border-color: #7f8989; }
  .review-card .review-answer { color: #d8eee8; }
}
