:root {
  --ink: #242347;
  --purple: #5b50d6;
  --purple-dark: #4339b7;
  --yellow: #ffd646;
  --cream: #fffaf0;
  --green: #39b978;
  --red: #ef6b67;
  --muted: #777590;
  --line: #e8e4f2;
}

* { box-sizing: border-box; }

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  padding-top: env(safe-area-inset-top);
  padding-right: env(safe-area-inset-right);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 16%, rgba(255, 214, 70, .23) 0 90px, transparent 92px),
    radial-gradient(circle at 88% 30%, rgba(91, 80, 214, .12) 0 130px, transparent 132px),
    var(--cream);
  font-family: "Nunito", sans-serif;
}

html {
  background: var(--cream);
  overscroll-behavior-y: none;
}

body.game-active {
  background-image:
    linear-gradient(rgba(255, 250, 240, .68), rgba(255, 250, 240, .78)),
    var(--level-background);
  background-position: center;
  background-size: cover;
  background-attachment: fixed;
}

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

.site-header {
  position: relative;
  width: min(1120px, calc(100% - 36px));
  height: 88px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.voice-status {
  position: absolute;
  top: 72px;
  right: 0;
  z-index: 5;
  max-width: 310px;
  margin: 0;
  padding: 8px 12px;
  color: #8a4d16;
  background: #fff2cf;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 800;
  text-align: right;
}

.voice-status:empty { display: none; }

.brand {
  display: grid;
  grid-template-columns: 47px auto;
  color: var(--ink);
  font: 800 27px/1 "Baloo 2", sans-serif;
  text-decoration: none;
}

.brand-mark {
  grid-row: 1 / 3;
  width: 39px;
  height: 39px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--purple);
  border-radius: 13px 13px 13px 5px;
  transform: rotate(-5deg);
}

.brand small {
  margin-top: 3px;
  color: var(--muted);
  font: 700 10px/1 "Nunito", sans-serif;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.sound-button {
  padding: 10px 16px;
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--ink);
  background: white;
  border: 2px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  font-weight: 800;
}

main {
  width: min(1120px, calc(100% - 36px));
  min-height: calc(100vh - 150px);
  margin: auto;
}

.screen { display: none; }
.screen.active { display: flex; }

.start-screen {
  min-height: 660px;
  align-items: center;
  gap: 8%;
}

.hero-copy { flex: 1.05; }
.eyebrow {
  margin: 0 0 12px;
  color: var(--purple);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}

h1, h2 {
  margin: 0;
  font-family: "Baloo 2", sans-serif;
  line-height: .98;
}

h1 { font-size: clamp(46px, 6vw, 74px); }
h1 span { color: var(--purple); }

.intro {
  max-width: 555px;
  margin: 25px 0;
  color: var(--muted);
  font-size: 19px;
  line-height: 1.65;
}

.feature-row {
  display: flex;
  flex-wrap: wrap;
  gap: 11px;
  margin-bottom: 30px;
}

.feature-row span {
  padding: 9px 13px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 13px;
  font-weight: 800;
}

.primary-button {
  min-height: 56px;
  padding: 0 27px;
  color: white;
  background: var(--purple);
  border: 0;
  border-radius: 17px;
  box-shadow: 0 8px 0 var(--purple-dark);
  cursor: pointer;
  font: 800 18px "Nunito", sans-serif;
  transition: transform .15s, box-shadow .15s;
}

.primary-button:hover { transform: translateY(-2px); }
.primary-button:active { transform: translateY(5px); box-shadow: 0 3px 0 var(--purple-dark); }
.primary-button:disabled { opacity: .4; cursor: not-allowed; transform: none; }

.install-card {
  max-width: 410px;
  margin-top: 24px;
  padding: 13px 17px;
  display: flex;
  gap: 5px;
  flex-direction: column;
  color: #40366f;
  background: #ece9ff;
  border: 2px solid #d2cdf7;
  border-radius: 16px;
  font-size: 13px;
}

.install-card strong { font-size: 15px; }

.hero-art {
  position: relative;
  flex: .95;
  min-height: 520px;
  display: grid;
  place-items: center;
  background: #dcd8ff;
  border-radius: 46% 54% 45% 55% / 55% 42% 58% 45%;
}

.hero-art img {
  width: min(90%, 470px);
  filter: drop-shadow(0 22px 15px rgba(68, 52, 143, .16));
  animation: bob 3.2s ease-in-out infinite;
}

.speech-bubble {
  position: absolute;
  top: 16%;
  right: -1%;
  padding: 13px 20px;
  background: white;
  border-radius: 22px 22px 22px 4px;
  box-shadow: 0 12px 25px rgba(44, 39, 90, .12);
  font: 800 19px "Baloo 2", sans-serif;
  transform: rotate(4deg);
}

.speech-bubble small { display: block; color: var(--muted); font: 700 11px "Nunito"; }
.float-shape { position: absolute; color: var(--yellow); font-size: 30px; }
.shape-one { left: 4%; top: 18%; }
.shape-two { right: 9%; bottom: 18%; color: var(--purple); }

.game-screen {
  max-width: 780px;
  margin: 20px auto 70px;
  flex-direction: column;
}

.level-screen {
  padding: 48px 0 80px;
  flex-direction: column;
}

.level-heading { margin-bottom: 30px; text-align: center; }
.level-heading h1 { font-size: clamp(44px, 6vw, 68px); }
.level-heading > p:last-child { color: var(--muted); font-size: 18px; }
.level-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
}

.level-card {
  min-height: 190px;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  background: white;
  background-position: center;
  background-size: cover;
  border: 3px solid var(--line);
  border-radius: 25px;
  cursor: pointer;
  text-align: center;
  transition: transform .15s, border-color .15s, box-shadow .15s;
}

.level-card .level-number,
.level-card strong,
.level-card small,
.level-card .level-best { text-shadow: 0 1px 3px white; }

.level-card:hover,
.level-card:focus-visible {
  transform: translateY(-5px);
  border-color: var(--purple);
  box-shadow: 0 14px 28px rgba(55, 44, 120, .12);
  outline: none;
}

.level-number {
  width: 39px;
  height: 39px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--purple);
  border-radius: 12px;
  font-weight: 900;
}

.level-icon { margin: 10px 0 4px; font-size: 36px; }
.level-card strong { font: 800 19px "Baloo 2", sans-serif; }
.level-card small { color: var(--muted); font-weight: 800; }
.level-best { min-height: 20px; margin-top: 8px; color: #9b7100; font-size: 13px; font-weight: 900; }
.level-label { margin: 0 0 2px; color: var(--purple); font-size: 13px; font-weight: 900; text-transform: uppercase; letter-spacing: .1em; }

.game-topbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 25px;
  align-items: center;
  margin-bottom: 20px;
}

.question-count { margin: 0 0 7px; font-weight: 900; }
.progress-track { height: 12px; overflow: hidden; background: #e5e1ef; border-radius: 99px; }
#progress-fill { width: 5%; height: 100%; background: linear-gradient(90deg, var(--purple), #8d80f1); border-radius: inherit; transition: width .4s; }
.score-pill { padding: 11px 17px; background: white; border: 2px solid var(--line); border-radius: 17px; font-size: 20px; }

.question-card {
  padding: clamp(24px, 5vw, 46px);
  text-align: center;
  background: rgba(255, 255, 255, .96);
  border: 2px solid white;
  border-radius: 32px;
  box-shadow: 0 22px 50px rgba(46, 38, 99, .11);
}

.picture {
  width: 150px;
  height: 150px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  background: #f0eeff;
  border-radius: 44px;
  font-size: 86px;
  animation: pop .35s both;
}

.prompt-label { margin: 0 0 4px; color: var(--muted); font-weight: 800; }
.swedish-prompt {
  margin: 2px auto 0;
  padding: 4px 14px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 15px;
  cursor: pointer;
  font: 800 38px/1.15 "Baloo 2", sans-serif;
}

.swedish-prompt:hover,
.swedish-prompt:focus-visible { background: #f0eeff; outline: none; }
.listen-icon { font-size: 22px; }
.answers { display: grid; gap: 12px; margin: 26px 0 19px; }

.answer-button {
  min-height: 61px;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--ink);
  background: white;
  border: 3px solid var(--line);
  border-radius: 18px;
  cursor: pointer;
  font-size: 19px;
  font-weight: 900;
  text-align: left;
  transition: transform .12s, border-color .12s, background .12s;
}

.answer-button:hover { transform: translateX(3px); border-color: #bbb3ef; }
.answer-button.selected { border-color: var(--purple); background: #f0eeff; }
.answer-button.correct { color: #16774a; border-color: var(--green); background: #e5f8ee; }
.answer-button.wrong { color: #a84440; border-color: var(--red); background: #fff0ef; }
.answer-letter {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  background: #f2eff8;
  border-radius: 10px;
  font-size: 14px;
}

.feedback { min-height: 35px; font-size: 18px; font-weight: 900; }
.feedback.good { color: #168354; }
.feedback.try { color: #b44c47; }
.submit-button { width: 100%; }
.hidden { display: none !important; }

.result-screen {
  position: relative;
  min-height: 670px;
  padding: 35px 20px 70px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.result-screen h1 { font-size: clamp(48px, 7vw, 76px); color: var(--purple); }
.result-mascot { width: 190px; margin-bottom: -10px; filter: drop-shadow(0 15px 12px rgba(62, 46, 127, .16)); }
.result-message { margin: 14px 0 20px; color: var(--muted); font-size: 19px; }
.final-score { min-width: 260px; margin-bottom: 27px; padding: 20px 40px; background: white; border-radius: 27px; box-shadow: 0 16px 35px rgba(47, 40, 95, .12); }
.final-score strong, .final-score small { display: block; }
.final-score strong { margin: 6px 0; font: 800 48px "Baloo 2"; }
.final-score small { color: var(--muted); font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.score-stars { letter-spacing: 5px; }
.result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; }
.secondary-button {
  min-height: 56px;
  padding: 0 24px;
  color: var(--purple);
  background: white;
  border: 2px solid #cfc9ef;
  border-radius: 17px;
  cursor: pointer;
  font-weight: 900;
}

#fireworks { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 10; }
footer { padding: 10px 20px 24px; color: #9895a8; text-align: center; font-size: 12px; font-weight: 800; }

@keyframes bob { 50% { transform: translateY(-14px) rotate(2deg); } }
@keyframes pop { from { opacity: 0; transform: scale(.65) rotate(-6deg); } to { opacity: 1; transform: scale(1); } }

@media (max-width: 780px) {
  .start-screen { padding: 40px 0 70px; flex-direction: column; text-align: center; }
  .hero-copy { display: flex; flex-direction: column; align-items: center; }
  .hero-art { width: min(100%, 480px); min-height: 390px; }
  .speech-bubble { right: 2%; }
  .sound-label { display: none; }
  .sound-button { padding: 10px 12px; }
  .level-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 460px) {
  .site-header { height: 74px; }
  .brand { grid-template-columns: 39px auto; font-size: 23px; }
  .brand-mark { width: 33px; height: 33px; }
  main { width: min(100% - 22px, 1120px); }
  h1 { font-size: 43px; }
  .hero-art { min-height: 330px; }
  .speech-bubble { top: 8%; font-size: 16px; }
  .picture { width: 125px; height: 125px; font-size: 70px; border-radius: 36px; }
  .swedish-prompt { font-size: 31px; }
  .question-card { padding: 23px 16px; border-radius: 25px; }
  .level-grid { grid-template-columns: 1fr; }
  .level-card { min-height: 145px; }
  .primary-button,
  .secondary-button,
  .answer-button { min-height: 58px; }
}

@media (display-mode: standalone) {
  .install-card { display: none !important; }
  .site-header { height: 78px; }
}

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