/* KawizzMe shared styles. Tokens come from the canvas's "Fonts & colors" style guide. */
@import url("https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,600;12..96,800&family=DM+Sans:opsz,wght@9..40,400;9..40,500;9..40,700&display=swap");

:root {
  /* Core */
  --accent: #3B2FC9;        /* Indigo: buttons, progress, selected answer */
  --accent-hover: #2A2194;
  --ink: #15142B;           /* primary text and icons */
  --bg: #F2F3F8;            /* Mist: app background */
  --surface: #FFFFFF;       /* cards and answer buttons */

  /* Neutrals */
  --muted: #55546E;         /* Slate: secondary text, labels */
  --dimmed: #6B6A82;        /* Dusk: dimmed answers after checking */
  --disabled-text: #5E5D75; /* Fog */
  --track: #DCDDE8;         /* Cloud: progress track, disabled button */
  --badge: #ECEDF3;         /* Haze: answer letter badge */

  /* Feedback, always paired with a tick or cross icon */
  --correct: #0E6B40;       /* Leaf */
  --correct-fill: #DDF3E6;  /* Mint */
  --correct-text: #0B3D26;  /* Pine */
  --wrong: #B03A0A;         /* Rust */
  --wrong-fill: #FDE6D8;    /* Peach */
  --wrong-text: #5C1F05;    /* Ember */

  /* Type */
  --font-display: "Bricolage Grotesque", "DM Sans", sans-serif;
  --font-text: "DM Sans", system-ui, sans-serif;

  /* Shape */
  --r-badge: 12px;
  --r-stat: 16px;
  --r-card: 18px;
  --shadow-rest: 0 1px 2px rgba(21, 20, 43, 0.08);
  --shadow-raised: 0 6px 18px rgba(21, 20, 43, 0.18);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--bg);
  /* No square tap flash on mobile; buttons show their own selected/hover states. */
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-text);
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; }

a { color: var(--accent); }
a:hover { color: var(--accent-hover); }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

/* One phone-sized column per screen */
.screen {
  max-width: 430px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 16px 20px 28px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.topbar {
  height: 44px;
  display: flex;
  align-items: center;
}

.wordmark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.01em;
}
.wordmark span { color: var(--accent); }

.title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 40px;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.lede {
  margin: 0;
  font-size: 17px;
  line-height: 1.45;
  color: var(--muted);
}

/* Primary call to action */
.btn {
  width: 100%;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: none;
  border-radius: var(--r-card);
  background: var(--accent);
  color: var(--surface);
  font-size: 17px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow-raised);
}
.btn:hover { color: var(--surface); background: var(--accent-hover); }
.btn:disabled {
  background: var(--track);
  color: var(--disabled-text);
  box-shadow: none;
  cursor: not-allowed;
}

/* Stat tiles */
.stats {
  display: flex;
  gap: 10px;
}
.stat {
  flex: 1;
  background: var(--surface);
  border-radius: var(--r-stat);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stat-value {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 24px;
}
.stat-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

/* Answer letter badge */
.badge {
  width: 38px;
  height: 38px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-badge);
  background: var(--badge);
  font-size: 15px;
  font-weight: 700;
}

/* Start screen */
.start-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 32px;
}
.start-copy {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Start screen illustration: tilted answer cards */
.hero {
  position: relative;
  height: 260px;
}
.hero-card {
  position: absolute;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 14px;
  border-radius: var(--r-card);
  background: var(--surface);
  box-shadow: var(--shadow-rest);
}
.hero-card .line {
  height: 10px;
  border-radius: 999px;
  background: var(--track);
}
.hero-card.is-picked {
  border: 2px solid var(--accent);
  box-shadow: 0 6px 18px rgba(21, 20, 43, 0.12);
}
.hero-card.is-picked .badge {
  background: var(--accent);
  color: var(--surface);
}
.hero-card:nth-child(1) { left: 24px;  top: 34px;  width: 220px; transform: rotate(-6deg); }
.hero-card:nth-child(2) { left: 110px; top: 112px; width: 230px; transform: rotate(4deg); }
.hero-card:nth-child(3) { left: 44px;  top: 190px; width: 200px; transform: rotate(-2deg); }
.hero-card:nth-child(1) .line { width: 110px; }
.hero-card:nth-child(2) .line { width: 120px; }
.hero-card:nth-child(3) .line { width: 90px; }
.hero-mark {
  position: absolute;
  right: 8px;
  top: 0;
  width: 76px;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 24px;
  background: var(--accent);
  color: var(--surface);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 48px;
  transform: rotate(8deg);
}

/* Narrow phones: keep the illustration inside the column */
@media (max-width: 360px) {
  .hero { transform: scale(0.85); transform-origin: left top; height: 221px; }
}

/* Visually hidden, still read by screen readers */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Topic screen */
.screen--topic { gap: 24px; }
.topbar--back { gap: 14px; }

.topic-copy {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.screen--topic .title { font-size: 34px; line-height: 1.1; }
.screen--topic .lede { font-size: 16px; }

.topics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.topic {
  min-height: 104px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 2px solid transparent;
  border-radius: var(--r-card);
  background: var(--surface);
  color: var(--ink);
  font-size: 17px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-rest);
  transition: border-color 120ms;
}
.topic:hover { border-color: var(--track); }
.topic.is-picked {
  border-color: var(--accent);
  box-shadow: 0 4px 14px rgba(21, 20, 43, 0.10);
}
.topic-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-badge);
  background: var(--badge);
}
.topic.is-picked .topic-icon { background: var(--accent); color: var(--surface); }

.topic-footer { margin-top: auto; }
/* The mockup's disabled "Let's go" has no arrow */
.topic-footer .btn:disabled svg { display: none; }

/* Question screen */
.screen--quiz { gap: 24px; }

.quiz-bar {
  display: flex;
  align-items: center;
  gap: 14px;
}
.icon-btn {
  width: 44px;
  height: 44px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  box-shadow: var(--shadow-rest);
}
.icon-btn:hover { color: var(--ink); background: var(--badge); }
.progress-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}
.progress-meta strong { font-weight: 700; color: var(--ink); }
.progress {
  height: 8px;
  border-radius: 999px;
  background: var(--track);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 240ms ease;
}

/* The theme label above the question is optional: hidden when a question has none */
.question-head {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 8px;
}
.question-theme {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}
.question {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 30px;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.answers {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.answer {
  width: 100%;
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px 12px 12px;
  border: 2px solid transparent;
  border-radius: var(--r-card);
  background: var(--surface);
  color: var(--ink);
  font-size: 17px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-rest);
  transition: background 120ms, border-color 120ms;
}
.answer-label { flex: 1; }
.answer-icon { flex: none; }
.answer:hover { border-color: var(--track); }
.answer.is-picked {
  border-color: var(--accent);
  box-shadow: 0 4px 14px rgba(21, 20, 43, 0.10);
}
.answer.is-picked .badge { background: var(--accent); color: var(--surface); }

/* After checking */
.answers.is-checked .answer { cursor: default; box-shadow: none; }
.answers.is-checked .answer:not(.is-correct):not(.is-wrong) {
  border-color: transparent;
  color: var(--dimmed);
}
.answers.is-checked .answer:not(.is-correct):not(.is-wrong) .badge { color: var(--dimmed); }
.answer.is-correct {
  background: var(--correct-fill);
  border-color: var(--correct);
  color: var(--correct-text);
}
.answer.is-correct .badge { background: var(--correct); color: var(--surface); }
.answer.is-wrong {
  background: var(--wrong-fill);
  border-color: var(--wrong);
  color: var(--wrong-text);
}
.answer.is-wrong .badge { background: var(--wrong); color: var(--surface); }

.quiz-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.feedback {
  margin: 0;
  padding: 14px 16px;
  border-radius: var(--r-stat);
  font-size: 15px;
  line-height: 1.4;
}
.feedback:empty { display: none; }
.feedback.is-right { background: var(--correct-fill); color: var(--correct-text); }
.feedback.is-wrong { background: var(--wrong-fill); color: var(--wrong-text); }

/* Results screen */
.results-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 28px;
  text-align: center;
}
.score-ring {
  position: relative;
  width: 220px;
  height: 220px;
}
.score-ring svg { display: block; }
.score-ring-track { stroke: var(--track); }
.score-ring-fill { stroke: var(--accent); }
.score-ring-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.score-value {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 64px;
  line-height: 1;
  letter-spacing: -0.02em;
}
.score-total {
  font-size: 15px;
  font-weight: 500;
  color: var(--muted);
}
.results-copy {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.results-copy .title { font-size: 36px; line-height: 1.1; }
.stats--results { width: 100%; text-align: left; }
.stat--icon {
  flex-direction: row;
  align-items: center;
  gap: 12px;
}
.stat--icon .stat-value { line-height: 1.1; }
.stat-text { display: flex; flex-direction: column; }
.stat-icon {
  width: 38px;
  height: 38px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-badge);
}
.stat-icon.is-correct { background: var(--correct-fill); color: var(--correct); }
.stat-icon.is-wrong { background: var(--wrong-fill); color: var(--wrong); }

/* Two columns: the layouts of the "MockupsTablet" page (1194×834), on tablets and wider and,
   at phone sizes, on landscape phones. This block only arranges the grid; the sizes for each
   follow in the two blocks below it. */
@media (min-width: 900px) and (min-height: 600px),
       (orientation: landscape) and (min-width: 560px) and (max-height: 599px) {
  .screen {
    max-width: 1194px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    row-gap: 0;
  }

  .topbar { grid-column: 1 / -1; }
  .lede { max-width: 440px; }

  /* Topic: one column, as on the tablet mockup, with four cards a row */
  .screen--topic { display: flex; }
  .screen--topic .topbar { margin-bottom: 0; }
  .topics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .topic-footer { display: flex; justify-content: flex-end; }
  .topic-footer .btn { width: min(320px, 100%); }
  .stats { max-width: 440px; }

  /* Start and results: one column of copy, stats and button, centred beside the art */
  .screen--start,
  .screen--results { grid-template-rows: auto 1fr auto auto auto 1fr; }
  .start-body, .results-body { display: contents; }
  .screen--start .btn,
  .screen--results .btn { grid-row: 5; width: min(320px, 100%); }
  .screen--start .stats,
  .screen--results .stats { grid-row: 4; }

  .start-copy { grid-column: 1; grid-row: 3; }
  .screen--start .stats,
  .screen--start .btn { grid-column: 1; }

  /* Positions are the mockup's 510×480 art in percentages, so it shrinks with the column */
  .hero {
    grid-column: 2;
    grid-row: 2 / -1;
    align-self: center;
    justify-self: center;
    width: 100%;
    max-width: 510px;
    height: auto;
    aspect-ratio: 510 / 480;
  }
  .hero-card:nth-child(1) { left: 3.92%;  top: 14.58%; width: 66.67%; }
  .hero-card:nth-child(2) { left: 29.41%; top: 39.58%; width: 70.59%; }
  .hero-card:nth-child(3) { left: 9.8%;   top: 65%;    width: 60.78%; }
  .hero-mark { right: 1.96%; }

  .results-body { text-align: left; }
  .score-ring {
    grid-column: 1;
    grid-row: 2 / -1;
    align-self: center;
    justify-self: center;
  }
  .results-copy { grid-column: 2; grid-row: 3; }
  .screen--results .stats,
  .screen--results .btn { grid-column: 2; }

  /* Question: one header row, then question and feedback beside answers and button */
  .screen--quiz { grid-template-rows: auto auto minmax(24px, 1fr) auto; }
  .quiz-bar { grid-column: 1 / -1; }
  .progress-wrap, .progress-meta { display: contents; }
  .progress-meta > span { order: 1; white-space: nowrap; }
  .progress { order: 2; flex: 1; }
  .progress-meta strong { order: 3; white-space: nowrap; }

  .question-head { grid-column: 1; grid-row: 2; padding-top: 0; }
  .answers { grid-column: 2; grid-row: 2; }
  .quiz-footer { display: contents; }
  .feedback { grid-column: 1; grid-row: 4; align-self: end; }
  .screen--quiz .btn { grid-column: 2; grid-row: 4; align-self: end; }
}

/* Tablet and wider: the sizes of the "MockupsTablet" page */
@media (min-width: 900px) and (min-height: 600px) {
  .screen { padding: 32px 56px 48px; }

  .topbar { height: 48px; margin-bottom: 24px; }
  .wordmark { font-size: 28px; }
  .title { font-size: 64px; line-height: 1.02; }
  .lede { font-size: 20px; }
  .btn { height: 60px; font-size: 18px; }
  .stats { gap: 12px; }
  .stat { padding: 16px 20px; border-radius: var(--r-card); }
  .stat-value { font-size: 28px; }
  .stat-label { font-size: 14px; }
  .badge { width: 46px; height: 46px; border-radius: 14px; font-size: 17px; }

  .screen--start,
  .screen--results { column-gap: 64px; }
  .screen--start .btn,
  .screen--results .btn { margin-top: 36px; }
  .screen--start .stats,
  .screen--results .stats { margin-top: 36px; }
  .start-copy { gap: 18px; }

  .hero-card { height: 88px; gap: 18px; padding: 0 20px; border-radius: 22px; }
  .hero-card .badge { width: 50px; height: 50px; border-radius: 15px; font-size: 19px; }
  .hero-card .line { height: 12px; }
  .hero-card.is-picked { box-shadow: 0 8px 24px rgba(21, 20, 43, 0.12); }
  .hero-card:nth-child(1) .line { width: 170px; }
  .hero-card:nth-child(2) .line { width: 190px; }
  .hero-card:nth-child(3) .line { width: 140px; }
  .hero-mark { width: 116px; height: 116px; border-radius: 34px; font-size: 72px; }

  .score-ring {
    width: min(380px, 100%);
    height: auto;
    aspect-ratio: 1;
  }
  /* The 220 viewBox scaled to 380px: a 16.2 stroke draws the mockup's 28px */
  .score-ring svg { width: 100%; height: 100%; }
  .score-ring circle { stroke-width: 16.2; }
  .score-ring-text { gap: 4px; }
  .score-value { font-size: 112px; letter-spacing: -0.03em; }
  .score-total { font-size: 20px; }
  .results-copy { gap: 14px; }
  .results-copy .title { font-size: 64px; line-height: 1.02; }
  .stat--icon { gap: 14px; }
  .stat-icon { width: 46px; height: 46px; border-radius: 14px; }
  .stat-icon svg { width: 22px; height: 22px; }

  .screen--topic { gap: 36px; }
  .topbar--back { gap: 18px; }
  .topic-copy { gap: 10px; }
  .screen--topic .title { font-size: 52px; line-height: 1.05; }
  .screen--topic .lede { font-size: 20px; }
  .topics { gap: 16px; }
  .topic {
    min-height: 148px;
    gap: 16px;
    padding: 20px 22px;
    border-radius: 22px;
    font-size: 20px;
  }
  .topic-icon { width: 52px; height: 52px; border-radius: 15px; }
  .topic-icon svg { width: 28px; height: 28px; }

  .screen--quiz { column-gap: 56px; }
  .quiz-bar { gap: 20px; margin-bottom: 40px; }
  .icon-btn { width: 48px; height: 48px; border-radius: 15px; }
  .icon-btn svg { width: 22px; height: 22px; }
  .progress-meta { font-size: 15px; }
  .progress { height: 10px; }

  .question-head { gap: 16px; }
  .question-theme { font-size: 15px; }
  .question {
    font-size: 46px;
    line-height: 1.1;
    letter-spacing: -0.015em;
  }
  .answers { gap: 14px; }
  .answer {
    min-height: 80px;
    gap: 18px;
    padding: 14px 22px 14px 16px;
    border-radius: 20px;
    font-size: 20px;
  }
  .answer-icon { width: 26px; height: 26px; }
  .feedback {
    padding: 18px 20px;
    border-radius: var(--r-card);
    font-size: 17px;
  }
}

/* Landscape phones: the tablet arrangement at phone sizes, tightened to fit a short screen.
   The canvas has no mock-up for them, so these sizes are the app's own. */
@media (orientation: landscape) and (min-width: 560px) and (max-height: 599px) {
  .screen { padding: 8px 24px 16px; column-gap: 32px; }

  .topbar { margin-bottom: 4px; }
  .title { font-size: 32px; }

  .start-copy { gap: 10px; }
  .screen--start .stats,
  .screen--results .stats { margin-top: 20px; }
  .screen--start .btn,
  .screen--results .btn { margin-top: 16px; }

  /* Keep the art within the height left under the top bar */
  .hero {
    max-width: min(360px, calc((100vh - 96px) * 510 / 480));
    max-width: min(360px, calc((100dvh - 96px) * 510 / 480));
  }

  .results-copy .title { font-size: 32px; }

  .screen--topic { gap: 12px; }
  .screen--topic .title { font-size: 28px; }
  .topics { gap: 10px; }
  .topic { min-height: 0; flex-direction: row; align-items: center; justify-content: flex-start; padding: 10px 12px; }

  .screen--quiz { grid-template-rows: auto auto minmax(12px, 1fr) auto; }
  .quiz-bar { margin-bottom: 12px; }
  .question-head { gap: 6px; }
  .question { font-size: 24px; line-height: 1.2; }
  .answers { gap: 8px; }
  .answer { min-height: 52px; padding: 6px 14px 6px 8px; }
  .feedback { padding: 10px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .progress-fill, .answer, .topic { transition: none; }
}

/* Only one screen is shown at a time; .screen's display:flex would otherwise beat [hidden] */
.screen[hidden] { display: none; }
.title:focus, .question:focus { outline: none; }
