:root {
  --ink: #18213d;
  --muted: #68708a;
  --purple: #6848f5;
  --purple-dark: #5033dc;
  --purple-pale: #f0edff;
  --green: #29b778;
  --orange: #ff9a4a;
  --red: #f25468;
  --paper: #fffefb;
  --line: #e8e6ef;
  --shadow: 0 20px 0 rgba(104, 72, 245, 0.06), 0 28px 58px rgba(63, 47, 125, 0.14);
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 11%, rgba(255, 202, 76, 0.27) 0 5.5%, transparent 5.7%),
    radial-gradient(circle at 94% 16%, rgba(72, 215, 190, 0.22) 0 8%, transparent 8.2%),
    radial-gradient(circle at 85% 83%, rgba(255, 137, 167, 0.16) 0 6%, transparent 6.2%),
    linear-gradient(155deg, #f8f5ff 0%, #fffdf5 50%, #effbff 100%);
  font-family: "Nunito", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
button:focus-visible, a:focus-visible { outline: 4px solid rgba(104, 72, 245, 0.25); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.app-shell { width: min(1100px, calc(100% - 32px)); margin: 0 auto; }

.topbar {
  min-height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar__controls { display: flex; align-items: center; gap: 10px; }

.brand {
  width: 46px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--purple);
  background: rgba(104, 72, 245, 0.1);
  border-radius: 50%;
  font-size: 1.7rem;
  text-decoration: none;
  transition: 150ms ease;
}
.brand:hover { transform: rotate(-5deg); background: rgba(104, 72, 245, 0.17); }

.sound-button {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.08rem;
}

.language-switch {
  display: flex;
  gap: 3px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.language-option {
  min-width: 38px;
  padding: 6px 9px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 900;
  transition: 150ms ease;
}
.language-option:hover { color: var(--purple); }
.language-option.is-active { color: white; background: var(--purple); box-shadow: 0 3px 8px rgba(104, 72, 245, 0.24); }

.mode-nav {
  width: fit-content;
  margin: 0 auto;
  padding: 5px;
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 8px 22px rgba(54, 43, 105, 0.08);
}
.mode-nav[hidden] { display: none; }
.mode-nav__button { min-width: 95px; padding: 10px 18px; color: var(--muted); background: transparent; border: 0; border-radius: 999px; cursor: pointer; font-weight: 900; transition: 150ms ease; }
.mode-nav__button:hover { color: var(--purple); }
.mode-nav__button.is-active { color: white; background: var(--purple); box-shadow: 0 4px 10px rgba(104, 72, 245, 0.24); }

.screen { min-height: calc(100vh - 160px); }
.screen[hidden] { display: none; }

.start-screen {
  display: grid;
  grid-template-columns: 0.92fr 1.08fr;
  gap: clamp(40px, 7vw, 90px);
  align-items: center;
  padding: 42px 0 72px;
}

.eyebrow {
  margin: 0 0 16px;
  color: var(--purple);
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  font-size: 0.82rem;
}

h1, h2 { font-family: "Nunito", sans-serif; font-weight: 900; letter-spacing: -0.055em; }

h1 {
  max-width: 620px;
  margin: 0;
  font-size: clamp(3.2rem, 6.8vw, 6.15rem);
  line-height: 0.94;
}

h1 em { color: var(--purple); font-style: normal; position: relative; }
h1 em::after { content: ""; position: absolute; left: 3%; right: 0; bottom: -7px; height: 8px; background: #ffc94f; border-radius: 100%; transform: rotate(-2deg); opacity: 0.75; }

.intro { max-width: 520px; margin: 30px 0 0; color: var(--muted); font-size: 1.13rem; line-height: 1.7; }

.passport-card, .question-card, .result-card {
  position: relative;
  background: rgba(255, 255, 255, 0.92);
  border: 3px solid rgba(255, 255, 255, 0.94);
  border-radius: 34px;
  box-shadow: var(--shadow);
}

.passport-card { padding: 30px; transform: rotate(1deg); }
.passport-card::before { content: ""; position: absolute; inset: 9px; border: 2px dashed #ded7ff; border-radius: 25px; pointer-events: none; }
.passport-card > * { position: relative; }

.passport-card__top { padding: 0 3px 20px; color: var(--purple); font-weight: 900; font-size: 1.15rem; letter-spacing: -0.02em; }

.level-grid { display: grid; gap: 12px; }
.level-card {
  display: grid;
  grid-template-columns: 1fr 28px;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 17px 18px;
  text-align: left;
  color: var(--ink);
  background: white;
  border: 3px solid transparent;
  border-radius: 20px;
  cursor: pointer;
  transition: 160ms ease;
}
.level-card:nth-child(1) { background: #e9faef; }
.level-card:nth-child(2) { background: #fff3d9; }
.level-card:nth-child(3) { background: #f1edff; }
.level-card:nth-child(1):hover, .level-card:nth-child(1).is-selected { border-color: #62cb91; }
.level-card:nth-child(2):hover, .level-card:nth-child(2).is-selected { border-color: #f3b64d; }
.level-card:nth-child(3):hover, .level-card:nth-child(3).is-selected { border-color: #8b72f8; }
.level-card:hover { transform: translateY(-2px) rotate(-0.4deg); }
.level-card.is-selected { box-shadow: 0 7px 18px rgba(82, 67, 143, 0.12); }
.level-card__copy { display: grid; gap: 2px; }
.level-card__copy strong { font-size: 1.05rem; font-weight: 900; }
.level-card__copy small { color: var(--muted); font-size: 0.82rem; }
.level-card__check { width: 27px; height: 27px; display: grid; place-items: center; color: white; background: var(--purple); border: 3px solid white; border-radius: 50%; opacity: 0; transform: scale(0.7); transition: 160ms ease; box-shadow: 0 3px 7px rgba(65, 47, 143, 0.2); }
.level-card.is-selected .level-card__check { opacity: 1; transform: scale(1); }

.region-field { display: grid; gap: 8px; margin-top: 18px; color: var(--ink); font-size: 0.83rem; font-weight: 900; }
.region-field select, .library-tools input, .library-tools select {
  width: 100%;
  min-height: 50px;
  padding: 0 15px;
  color: var(--ink);
  background: white;
  border: 2px solid var(--line);
  border-radius: 15px;
  font: inherit;
  font-weight: 700;
}
.region-field select, .library-tools select {
  min-height: 52px;
  padding: 0 46px 0 16px;
  color-scheme: light;
  background-color: white;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--purple) 50%),
    linear-gradient(135deg, var(--purple) 50%, transparent 50%);
  background-position:
    calc(100% - 20px) 50%,
    calc(100% - 14px) 50%;
  background-repeat: no-repeat;
  background-size: 6px 6px, 6px 6px;
  box-shadow: 0 5px 14px rgba(54, 43, 105, 0.06);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1.2;
  -webkit-appearance: none;
  appearance: none;
}
.region-field select::-ms-expand, .library-tools select::-ms-expand { display: none; }
.region-field select:focus, .library-tools input:focus, .library-tools select:focus { outline: 4px solid rgba(104, 72, 245, 0.16); border-color: var(--purple); }

.primary-button, .secondary-button, .next-button {
  border: 0;
  border-radius: 16px;
  cursor: pointer;
  font-weight: 800;
  transition: 160ms ease;
}
.primary-button { width: 100%; margin-top: 22px; padding: 18px 20px; color: white; background: linear-gradient(135deg, #7658f7, #6240ec); box-shadow: 0 9px 0 var(--purple-dark), 0 14px 28px rgba(104, 72, 245, 0.22); font-size: 1.05rem; }
.primary-button:hover { transform: translateY(-2px); box-shadow: 0 11px 0 var(--purple-dark), 0 16px 30px rgba(104, 72, 245, 0.24); }
.primary-button:active { transform: translateY(6px); box-shadow: 0 3px 0 var(--purple-dark); }
.round-note { margin: 20px 0 2px; text-align: center; color: var(--muted); font-size: 0.78rem; }
.practice-button { width: 100%; margin-top: 13px; padding: 13px 16px; display: flex; justify-content: center; align-items: center; gap: 9px; color: var(--purple); background: transparent; border: 0; border-radius: 14px; cursor: pointer; font-weight: 900; }
.practice-button strong { min-width: 25px; height: 25px; display: grid; place-items: center; color: white; background: var(--red); border-radius: 50%; font-size: 0.75rem; }
.practice-button:disabled { color: var(--muted); cursor: not-allowed; opacity: 0.5; }

.learn-panel {
  max-width: 920px;
  margin: 0 auto 90px;
  padding: clamp(28px, 5vw, 48px);
  text-align: center;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: 28px;
}
.learn-panel[hidden] { display: none; }
.learn-panel h2 { max-width: 650px; margin: 0 auto 14px; font-size: clamp(1.8rem, 4vw, 2.6rem); }
.learn-panel > p:not(.eyebrow) { max-width: 720px; margin: 0 auto; color: var(--muted); line-height: 1.7; }
.learn-panel ul { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 28px 0 0; padding: 0; list-style: none; }
.learn-panel li { display: grid; justify-items: center; gap: 5px; padding: 18px 12px; background: white; border: 1px solid var(--line); border-radius: 16px; }
.learn-panel li span { color: var(--muted); font-size: 0.8rem; }
.learn-feature__icon { width: 42px; height: 42px; margin-bottom: 5px; display: grid; place-items: center; color: var(--purple); background: rgba(104, 72, 245, 0.1); border-radius: 50%; font-size: 1.25rem; }
.learn-panel li:nth-child(2) .learn-feature__icon { color: #c47512; background: rgba(255, 178, 70, 0.16); }
.learn-panel li:nth-child(3) .learn-feature__icon { color: #16875b; background: rgba(41, 183, 120, 0.13); }

.explore-screen, .passport-screen { padding: 54px 0 90px; }
.section-heading { max-width: 720px; margin: 0 auto 30px; text-align: center; }
.section-heading h2 { margin: 0; font-size: clamp(2.25rem, 5vw, 4rem); line-height: 1.02; }
.section-heading > p:last-child { margin: 14px auto 0; color: var(--muted); line-height: 1.65; }
.library-tools { max-width: 760px; margin: 0 auto 15px; display: grid; grid-template-columns: 1fr 220px; gap: 12px; }
.library-count { margin: 0 0 18px; color: var(--muted); text-align: center; font-size: 0.83rem; font-weight: 800; }
.flag-library { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.library-card { position: relative; min-width: 0; padding: 16px; background: rgba(255, 255, 255, 0.9); border: 2px solid white; border-radius: 20px; box-shadow: 0 9px 24px rgba(50, 42, 91, 0.08); }
.library-card.is-mastered { border-color: #7bd6a2; background: #f2fcf6; }
.library-card__flag { width: 100%; aspect-ratio: 4 / 3; display: block; overflow: hidden; background-size: contain; border-radius: 12px; }
.library-card__name-row { margin: 14px 0 3px; display: flex; align-items: flex-start; gap: 7px; }
.library-card h3 { min-width: 0; flex: 1; margin: 4px 0 0; overflow-wrap: anywhere; font-size: 1rem; line-height: 1.2; }
.pronounce-button {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--purple);
  background: rgba(104, 72, 245, 0.1);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.92rem;
  transition: 150ms ease;
}
.pronounce-button:hover { transform: translateY(-1px); background: rgba(104, 72, 245, 0.17); }
.pronounce-button.is-speaking { color: white; background: var(--purple); box-shadow: 0 5px 12px rgba(104, 72, 245, 0.24); }
.speech-button:disabled { opacity: 0.55; cursor: not-allowed; filter: grayscale(0.35); }
.library-card__region { color: var(--purple); font-size: 0.72rem; font-weight: 900; text-transform: uppercase; letter-spacing: 0.05em; }
.library-card__capital { margin: 8px 0 0; color: var(--muted); font-size: 0.78rem; line-height: 1.35; }
.library-card__fact { margin: 8px 0 0; color: var(--ink); font-size: 0.76rem; line-height: 1.45; }
.library-card__star { position: absolute; z-index: 3; top: 9px; right: 9px; width: 28px; height: 28px; display: grid; place-items: center; color: white; background: var(--green); border: 3px solid white; border-radius: 50%; box-shadow: 0 4px 9px rgba(23, 125, 79, 0.2); }
.show-more-button { display: block; margin: 28px auto 0; padding: 14px 24px; color: var(--purple); background: white; border: 2px solid #d9d2ff; border-radius: 999px; cursor: pointer; font-weight: 900; }
.show-more-button[hidden] { display: none; }

.passport-progress-card { max-width: 760px; margin: 0 auto 18px; padding: 24px; color: white; background: linear-gradient(135deg, #7455f6, #5f3ee8); border-radius: 24px; box-shadow: 0 16px 32px rgba(86, 59, 208, 0.2); }
.passport-progress__top { display: flex; justify-content: space-between; align-items: end; gap: 15px; }
.passport-progress__top div { display: flex; align-items: baseline; }
.passport-progress__top strong { font-size: 2.5rem; font-weight: 900; line-height: 1; }
.passport-progress__top div span { opacity: 0.74; font-weight: 800; }
.passport-progress__top > span { font-weight: 800; }
.passport-progress__track { height: 13px; margin-top: 18px; overflow: hidden; background: rgba(255, 255, 255, 0.24); border-radius: 999px; }
.passport-progress__track span { display: block; width: 0; height: 100%; background: #ffcf54; border-radius: inherit; transition: width 350ms ease; }
.stats-grid { max-width: 760px; margin: 0 auto 36px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.stat-card { padding: 18px 10px; display: grid; gap: 4px; text-align: center; background: white; border: 1px solid var(--line); border-radius: 17px; }
.stat-card strong { color: var(--purple); font-size: 1.55rem; font-weight: 900; }
.stat-card span { color: var(--muted); font-size: 0.75rem; font-weight: 700; }
.passport-section { max-width: 920px; margin: 0 auto 30px; padding: clamp(22px, 4vw, 32px); background: rgba(255, 255, 255, 0.78); border: 1px solid var(--line); border-radius: 24px; }
.passport-section h3 { margin: 0 0 18px; font-size: 1.25rem; }
.passport-section__heading { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.badge-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.badge-card { padding: 18px 10px; display: grid; gap: 6px; text-align: center; color: var(--muted); background: #f4f2f8; border: 2px dashed #ddd8e8; border-radius: 18px; filter: grayscale(1); opacity: 0.62; }
.badge-card.is-unlocked { color: var(--ink); background: #fff7d9; border: 2px solid #f4ce5b; filter: none; opacity: 1; }
.badge-card__icon { font-size: 2rem; }
.badge-card strong { font-size: 0.88rem; }
.badge-card span:last-child { font-size: 0.7rem; }
.small-practice-button { padding: 9px 14px; color: white; background: var(--purple); border: 0; border-radius: 999px; cursor: pointer; font-size: 0.78rem; font-weight: 900; }
.small-practice-button:disabled { background: #d7d3e2; cursor: not-allowed; }
.empty-passport { padding: 30px 15px; display: grid; justify-items: center; gap: 6px; color: var(--muted); text-align: center; }
.empty-passport > i { color: #f1b52c; font-size: 2.5rem; }
.empty-passport p { margin: 0; font-size: 0.85rem; }
.collected-flags { display: grid; grid-template-columns: repeat(8, 1fr); gap: 10px; }
.collected-flag { min-width: 0; padding: 8px; text-align: center; background: white; border: 1px solid var(--line); border-radius: 12px; }
.collected-flag .fi { width: 100%; aspect-ratio: 4 / 3; display: block; overflow: hidden; background-size: contain; border-radius: 12px; }
.collected-flag span:last-child { display: block; margin-top: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.65rem; font-weight: 800; }

.quiz-screen { padding: 28px 0 70px; }
.quiz-status { max-width: 820px; margin: 0 auto 22px; display: grid; grid-template-columns: 1fr auto auto; align-items: end; gap: 12px; }
.progress-labels { display: flex; justify-content: space-between; gap: 18px; margin-bottom: 8px; color: var(--muted); font-size: 0.8rem; font-weight: 800; }
.progress-track { height: 11px; overflow: hidden; background: #e8e4f4; border-radius: 999px; }
.progress-track span { display: block; width: 10%; height: 100%; background: linear-gradient(90deg, #7657f8, #a18aff); border-radius: inherit; transition: width 350ms ease; }
.score-chip, .streak-chip { min-width: 68px; padding: 11px 14px; text-align: center; background: white; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 7px 18px rgba(62, 52, 107, 0.07); }
.score-chip i { color: #f5b62c; }
.streak-chip i { color: var(--orange); }

.question-card { max-width: 820px; margin: 0 auto; padding: clamp(24px, 5vw, 48px); text-align: center; }
.flag-stage { position: relative; width: min(330px, 78vw); height: 205px; margin: 0 auto 26px; display: grid; place-items: center; }
.flag-display { position: relative; z-index: 2; width: 300px; max-width: 100%; height: 200px; background-size: contain; filter: drop-shadow(0 13px 15px rgba(22, 29, 55, 0.17)); animation: flagIn 420ms cubic-bezier(.2,.85,.32,1.2) both; }
.flag-shadow { position: absolute; bottom: -8px; width: 65%; height: 18px; border-radius: 50%; background: rgba(42, 40, 62, 0.12); filter: blur(8px); }
.question-kicker { margin: 0 0 7px; color: var(--purple); font-size: 0.78rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.question-card h2 { margin: 0 0 8px; font-size: clamp(1.75rem, 4vw, 2.45rem); }
.answer-audio-hint { margin: 0 0 22px; color: var(--muted); font-size: 0.84rem; font-weight: 700; }
.answers { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.answer-option { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) 58px; gap: 8px; }
.answer-button { width: 100%; min-height: 67px; padding: 14px 14px; color: var(--ink); background: white; border: 3px solid var(--line); border-radius: 999px; cursor: pointer; font-size: 1rem; font-weight: 900; transition: 150ms ease; }
.answer-button:nth-child(1) { background: #fff9dc; }
.answer-button:nth-child(2) { background: #eef9ff; }
.answer-button:nth-child(3) { background: #f5efff; }
.answer-button:nth-child(4) { background: #ecfbf3; }
.answer-button:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--purple); background: var(--purple-pale); }
.answer-button:disabled { cursor: default; }
.answer-button.is-correct { color: #087449; border-color: var(--green); background: #e5f9ef; animation: correctPop 300ms ease; }
.answer-button.is-wrong { color: #a52c3d; border-color: var(--red); background: #fff0f2; animation: shake 300ms ease; }
.answer-button .key { display: inline-grid; place-items: center; width: 23px; height: 23px; margin-right: 8px; color: var(--muted); background: #f1f0f5; border-radius: 7px; font-size: 0.72rem; }
.answer-speech-button {
  width: 58px;
  height: 58px;
  align-self: center;
  padding: 0;
  display: grid;
  place-items: center;
  color: var(--purple);
  background: rgba(104, 72, 245, 0.1);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.35rem;
  transition: 150ms ease;
}
.answer-speech-button:hover:not(:disabled) { transform: translateY(-2px); background: rgba(104, 72, 245, 0.17); }
.answer-speech-button.is-speaking { color: white; background: var(--purple); box-shadow: 0 7px 15px rgba(104, 72, 245, 0.24); }

.feedback { margin-top: 18px; padding: 15px; display: grid; grid-template-columns: 42px 1fr auto; align-items: center; gap: 12px; text-align: left; border-radius: 17px; background: #edf9f3; }
.feedback[hidden] { display: none; }
.feedback.is-wrong { background: #fff3f4; }
.feedback__icon { width: 42px; height: 42px; display: grid; place-items: center; color: white; background: var(--green); border-radius: 50%; font-weight: 900; }
.feedback.is-wrong .feedback__icon { background: var(--red); }
.feedback__copy { display: grid; gap: 3px; }
.feedback__copy span { color: var(--muted); font-size: 0.84rem; line-height: 1.35; }
.next-button { padding: 12px 15px; color: white; background: var(--ink); white-space: nowrap; }
.next-button:hover { transform: translateX(2px); }

.result-screen { display: grid; place-items: center; padding: 36px 0 70px; }
.result-card { width: min(570px, 100%); padding: clamp(30px, 6vw, 56px); text-align: center; }
.result-badge { width: 96px; height: 96px; margin: -8px auto 22px; display: grid; place-items: center; background: #fff1bc; border: 5px solid white; border-radius: 50%; box-shadow: 0 9px 25px rgba(190, 139, 24, 0.2); font-size: 3.2rem; transform: rotate(-5deg); }
.result-card h2 { margin: 0; font-size: clamp(2.35rem, 6vw, 3.6rem); }
.result-message { margin: 14px auto 24px; max-width: 400px; color: var(--muted); line-height: 1.6; }
.result-score { width: 150px; height: 150px; margin: 0 auto; display: grid; place-content: center; background: var(--purple-pale); border-radius: 50%; box-shadow: inset 0 0 0 9px white, 0 0 0 2px #d9d2ff; }
.result-score span { font-family: "Nunito", sans-serif; font-weight: 900; color: var(--purple); font-size: 2.4rem; }
.result-score small { color: var(--muted); }
.stars { margin: 20px 0 0; display: flex; justify-content: center; gap: 8px; color: #d8d4e4; font-size: 2rem; }
.stars .is-earned { color: #f5b62c; filter: drop-shadow(0 3px 4px rgba(207, 145, 13, 0.2)); }
.primary-button i, .next-button i { margin-left: 5px; vertical-align: -0.12em; }
.result-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 20px; }
.result-actions .primary-button { margin-top: 0; }
.result-passport-button { grid-column: 1 / -1; }
.secondary-button { padding: 16px; color: var(--purple); background: white; border: 2px solid #dcd5ff; }
.secondary-button:hover { background: var(--purple-pale); }

footer { min-height: 54px; display: flex; justify-content: center; align-items: center; gap: 7px; padding: 15px; color: var(--muted); font-size: 0.77rem; }
footer a { color: var(--purple); font-weight: 800; }
.noscript-message { max-width: 720px; margin: 20px auto; padding: 18px; color: #762b38; background: #fff0f2; border: 1px solid #ffc5ce; border-radius: 14px; text-align: center; }
.sky-decor { position: fixed; z-index: -1; color: #f6bd32; opacity: 0.7; }
.sky-decor--one { top: 16%; left: 4%; font-size: 1.4rem; }
.sky-decor--two { right: 7%; bottom: 17%; font-size: 2rem; color: #6fd4c4; }
.sky-decor--three { top: 34%; right: 3%; color: #f3b6cb; font-size: 0.7rem; }
.confetti { position: fixed; inset: 0; z-index: 10; pointer-events: none; overflow: hidden; }
.confetti-piece { position: absolute; top: -20px; width: 10px; height: 18px; border-radius: 3px; animation: fall 1.7s ease-in forwards; }

@keyframes flagIn { from { opacity: 0; transform: translateY(10px) scale(.92) rotate(-2deg); } to { opacity: 1; transform: none; } }
@keyframes correctPop { 50% { transform: scale(1.025); } }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
@keyframes fall { to { transform: translateY(105vh) rotate(540deg); opacity: .9; } }

@media (max-width: 780px) {
  .start-screen { grid-template-columns: 1fr; gap: 38px; padding-top: 28px; }
  .hero-copy { text-align: center; }
  .intro { margin-inline: auto; }
  h1 { font-size: clamp(3.15rem, 14vw, 5.4rem); }
  .passport-card { width: min(560px, 100%); margin: 0 auto; transform: none; }
  .quiz-status { grid-template-columns: 1fr auto auto; }
  .learn-panel ul { grid-template-columns: 1fr; }
  .flag-library { grid-template-columns: repeat(3, 1fr); }
  .collected-flags { grid-template-columns: repeat(6, 1fr); }
}

@media (max-width: 560px) {
  .app-shell { width: min(100% - 22px, 1100px); }
  .topbar { min-height: 72px; }
  .sound-button span:last-child { display: none; }
  .sound-button { width: 44px; height: 44px; justify-content: center; padding: 0; }
  .topbar__controls { gap: 6px; }
  .language-switch { padding: 3px; }
  .language-option { min-width: 40px; min-height: 40px; padding: 0 7px; }
  .screen { min-height: calc(100vh - 130px); }
  .mode-nav { width: 100%; }
  .mode-nav__button { min-width: 0; flex: 1; padding-inline: 10px; }
  .start-screen { padding-bottom: 48px; }
  .passport-card { padding: 21px; border-radius: 24px; }
  .answers { grid-template-columns: 1fr; }
  .question-card { border-radius: 24px; }
  .flag-stage { height: 160px; }
  .flag-display { width: 225px; height: 150px; }
  .feedback { grid-template-columns: 38px 1fr; }
  .feedback__icon { width: 38px; height: 38px; }
  .next-button { grid-column: 1 / -1; width: 100%; }
  .result-actions { grid-template-columns: 1fr; }
  .result-passport-button { grid-column: auto; }
  .progress-labels span:last-child { display: none; }
  .score-chip, .streak-chip { min-width: 58px; padding-inline: 9px; }
  .explore-screen, .passport-screen { padding-top: 40px; }
  .library-tools { grid-template-columns: 1fr; }
  .flag-library { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .library-card { padding: 12px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .badge-grid { grid-template-columns: repeat(2, 1fr); }
  .collected-flags { grid-template-columns: repeat(4, 1fr); }
  .passport-section__heading { align-items: flex-start; flex-direction: column; }
  .passport-progress__top { align-items: flex-start; flex-direction: column; gap: 4px; }
}

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