:root {
  --blue-950: #10264b;
  --blue-900: #173b72;
  --blue-700: #2459a9;
  --blue-500: #3b79d5;
  --gold-700: #b97812;
  --gold-500: #e5a72d;
  --gold-300: #ffd978;
  --cream: #fff8e8;
  --paper: #fffdf7;
  --ink: #25324a;
  --muted: #667085;
  --green: #27864b;
  --red: #c83b4b;
  --shadow: 0 16px 45px rgba(20, 35, 58, .18);
  --soft-shadow: 0 8px 22px rgba(20, 35, 58, .13);
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: #eaf2fb;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 320px;
  min-height: 100%;
  margin: 0;
}

body {
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  overflow-x: hidden;
  overscroll-behavior-y: none;
  background: #dfeaf6;
  -webkit-text-size-adjust: 100%;
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  -webkit-touch-callout: none;
}

button,
.nickname-choice,
.avatar-choice,
.age-choice,
.answer-button,
.answer-listen {
  user-select: none;
  -webkit-user-select: none;
}

button:focus-visible,
input:focus-visible {
  outline: 4px solid #f7c948;
  outline-offset: 3px;
}

.noscript {
  padding: 20px;
  text-align: center;
  background: #fff3cd;
}

.screen {
  display: none;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  animation: screen-in .35s ease both;
}

.screen.is-active {
  display: flex;
}

.is-hidden {
  display: none !important;
}

@keyframes screen-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--gold-700);
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: .11em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  text-wrap: balance;
}

h1,
h2,
h3 {
  margin-top: 0;
  line-height: 1.08;
}

.topbar {
  position: fixed;
  z-index: 50;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  width: 100%;
  height: calc(66px + env(safe-area-inset-top, 0px));
  padding: calc(8px + env(safe-area-inset-top, 0px)) max(clamp(12px, 3vw, 34px), env(safe-area-inset-right, 0px)) 8px max(clamp(12px, 3vw, 34px), env(safe-area-inset-left, 0px));
  color: white;
  background: linear-gradient(180deg, rgba(16, 38, 75, .96), rgba(23, 59, 114, .92));
  border-bottom: 2px solid rgba(255, 217, 120, .65);
  box-shadow: 0 5px 20px rgba(16, 38, 75, .22);
  backdrop-filter: blur(12px);
}

.topbar__spacer {
  flex: 1;
}

.brand-mini {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-left: 10px;
  font-weight: 900;
}

.brand-mini__crest {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: var(--blue-900);
  background: var(--gold-300);
  border-radius: 50%;
}

.topbar-avatar {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
}

.topbar-avatar .character-display {
  width: 38px;
  height: 38px;
  border-width: 3px;
  border-radius: 13px;
  box-shadow: none;
}

.topbar-avatar .character-display__avatar {
  font-size: 1.65rem;
}

.topbar-avatar .character-display__accessory {
  font-size: .92rem;
}

.round-button {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 45px;
  height: 45px;
  padding: 0;
  color: white;
  font-size: 1.3rem;
  cursor: pointer;
  background: rgba(255, 255, 255, .14);
  border: 2px solid rgba(255, 255, 255, .3);
  border-radius: 50%;
  transition: transform .18s ease, background .18s ease;
}

.round-button:hover {
  z-index: 2;
  transform: translateY(-2px) scale(1.04);
  background: rgba(255, 255, 255, .24);
}

.round-button--paper {
  color: var(--blue-900);
  background: white;
  border-color: #d7e1ee;
  box-shadow: var(--soft-shadow);
}

.star-counter {
  display: flex;
  gap: 6px;
  align-items: center;
  min-width: 74px;
  margin-right: 8px;
  padding: 8px 13px;
  color: var(--blue-950);
  background: linear-gradient(#fff7cf, #ffd978);
  border: 2px solid #fff1b0;
  border-radius: 22px;
  box-shadow: inset 0 -2px 0 rgba(143, 89, 7, .15);
}

.star-counter strong {
  min-width: 26px;
  font-size: 1.05rem;
  text-align: center;
}

.primary-button,
.secondary-button,
.text-button,
.parent-button,
.danger-link {
  cursor: pointer;
}

.primary-button {
  position: relative;
  display: inline-flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 12px 24px;
  color: white;
  font-weight: 900;
  background: linear-gradient(180deg, #3c7ddd, #2459a9);
  border: 2px solid #173f7d;
  border-radius: 16px;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .24), 0 5px 0 #173d75, 0 10px 22px rgba(36, 89, 169, .25);
  transition: transform .14s ease, filter .14s ease;
}

.primary-button:hover {
  transform: translateY(-2px);
  filter: brightness(1.06);
}

.primary-button:active {
  transform: translateY(3px);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .18), 0 2px 0 #173d75;
}

.primary-button--large {
  width: min(100%, 380px);
  min-height: 62px;
  font-size: 1.05rem;
}

.secondary-button {
  min-height: 46px;
  padding: 10px 18px;
  color: var(--blue-900);
  font-weight: 900;
  background: white;
  border: 2px solid #cfdae9;
  border-radius: 14px;
  box-shadow: 0 3px 0 #c2cfdf;
}

.text-button,
.danger-link {
  padding: 10px;
  color: var(--blue-700);
  font-weight: 800;
  background: none;
  border: 0;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.danger-link {
  color: #a82938;
}

/* Accueil */
.welcome-screen {
  position: relative;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 42px 24px 80px;
  background: url("assets/royaume.webp") center center / cover no-repeat;
}

.welcome-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(9, 25, 48, .26), rgba(9, 25, 48, .05) 42%, rgba(9, 25, 48, .1)),
    linear-gradient(0deg, rgba(9, 25, 48, .45), transparent 44%);
}

.welcome-card {
  position: relative;
  z-index: 1;
  width: min(580px, 95vw);
  margin-top: -1vh;
  padding: clamp(24px, 4vw, 44px);
  text-align: center;
  background: rgba(255, 253, 247, .93);
  border: 4px solid rgba(255, 227, 147, .96);
  border-radius: 34px;
  box-shadow: 0 24px 70px rgba(8, 25, 51, .38), inset 0 0 0 3px rgba(183, 120, 18, .22);
  backdrop-filter: blur(9px);
}

.welcome-card::before,
.welcome-card::after {
  position: absolute;
  top: 22px;
  color: #cf921f;
  font-size: 1.4rem;
  content: "✦";
}

.welcome-card::before { left: 25px; }
.welcome-card::after { right: 25px; }

.welcome-card__emblem {
  display: grid;
  place-items: center;
  width: 66px;
  height: 66px;
  margin: -72px auto 20px;
  font-size: 2.2rem;
  background: linear-gradient(#fff0ad, #e5a72d);
  border: 4px solid white;
  border-radius: 50%;
  box-shadow: 0 6px 20px rgba(83, 50, 7, .28);
}

.welcome-card h1 {
  margin-bottom: 16px;
  color: var(--blue-950);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.2rem, 6vw, 4.2rem);
  text-shadow: 0 2px 0 white;
}

.welcome-card__text {
  max-width: 440px;
  margin: 0 auto 24px;
  color: #4f5e72;
  font-size: clamp(.98rem, 2vw, 1.15rem);
  line-height: 1.55;
}

.welcome-card .text-button {
  display: block;
  margin: 13px auto -8px;
}

.welcome-ribbon {
  position: absolute;
  z-index: 1;
  bottom: 16px;
  left: 50%;
  width: max-content;
  max-width: calc(100% - 28px);
  padding: 10px 22px;
  overflow: hidden;
  color: #fff7d3;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: rgba(16, 38, 75, .76);
  border: 1px solid rgba(255, 217, 120, .6);
  border-radius: 20px;
  transform: translateX(-50%);
  backdrop-filter: blur(8px);
}

/* Profil */
.profile-screen,
.save-select-screen,
.parent-screen,
.celebration-screen {
  position: relative;
  align-items: center;
  justify-content: center;
  padding: 88px 20px 30px;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 224, 141, .48), transparent 32%),
    linear-gradient(145deg, #dcecff, #fdf4d8);
}

.profile-screen::before,
.save-select-screen::before,
.parent-screen::before {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle, rgba(36, 89, 169, .08) 1.5px, transparent 1.5px);
  background-size: 25px 25px;
  content: "";
}

.paper-card {
  position: relative;
  width: min(650px, 100%);
  padding: clamp(24px, 5vw, 48px);
  text-align: center;
  background: var(--paper);
  border: 3px solid #eed491;
  border-radius: 28px;
  box-shadow: var(--shadow), inset 0 0 0 5px #fff8df;
}

.profile-card h2 {
  color: var(--blue-950);
  font-family: Georgia, serif;
  font-size: clamp(1.7rem, 4vw, 2.55rem);
}

.corner-back {
  position: absolute;
  top: 18px;
  left: 18px;
  width: 42px;
  height: 42px;
  color: var(--blue-900);
  font-weight: 900;
  cursor: pointer;
  background: #edf4fc;
  border: 2px solid #d3e0ee;
  border-radius: 50%;
}

.card-emblem {
  margin-bottom: 10px;
  font-size: 3.1rem;
}

.field-label {
  display: block;
  margin-bottom: 8px;
  color: #495870;
  font-size: .88rem;
  font-weight: 900;
}

.name-input {
  width: min(100%, 400px);
  height: 58px;
  padding: 8px 18px;
  color: var(--blue-950);
  font-size: 1.2rem;
  font-weight: 800;
  text-align: center;
  background: white;
  border: 3px solid #cbd9ea;
  border-radius: 16px;
}


.nickname-fieldset {
  margin: 18px 0 20px;
  padding: 0;
  border: 0;
}

.nickname-fieldset legend {
  margin-bottom: 10px;
  font-weight: 900;
  color: var(--blue-900);
}

.nickname-choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.nickname-choice {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  min-height: 64px;
  padding: 10px 12px;
  color: var(--blue-950);
  font-size: 1rem;
  cursor: pointer;
  background: white;
  border: 3px solid #cddbeb;
  border-radius: 16px;
  box-shadow: 0 4px 0 #bccbdd;
}

.nickname-choice.is-selected {
  background: #fff2bd;
  border-color: #e5a72d;
  box-shadow: 0 4px 0 #c98a1e;
  transform: translateY(-1px);
}

.nickname-choice[hidden] { display: none; }

.age-fieldset,
.avatar-fieldset {
  margin: 25px 0;
  padding: 0;
  border: 0;
}

.age-fieldset legend,
.avatar-fieldset legend {
  width: 100%;
  margin-bottom: 12px;
  color: #495870;
  font-size: .88rem;
  font-weight: 900;
}

.age-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px;
  width: min(100%, 430px);
  margin: 0 auto;
}

.age-choice {
  display: flex;
  min-height: 70px;
  padding: 11px;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  color: var(--blue-900);
  cursor: pointer;
  background: #f1f5fa;
  border: 3px solid transparent;
  border-radius: 17px;
}

.age-choice strong {
  font-size: 1.08rem;
}

.age-choice small {
  margin-top: 2px;
  color: var(--muted);
  font-size: .72rem;
}

.age-choice.is-selected {
  background: #fff3c5;
  border-color: var(--gold-500);
  box-shadow: 0 4px 0 #c58b1c;
}

.avatar-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.avatar-choice {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  font-size: 2rem;
  cursor: pointer;
  background: #f1f5fa;
  border: 3px solid transparent;
  border-radius: 20px;
  transition: transform .15s, border-color .15s, background .15s;
}

.avatar-choice:hover {
  transform: translateY(-3px);
}

.avatar-choice.is-selected {
  background: #fff3c5;
  border-color: var(--gold-500);
  box-shadow: 0 4px 0 #c58b1c;
}

.privacy-note {
  margin: 18px 0 -10px;
  color: var(--muted);
  font-size: .76rem;
}

/* Choix des sauvegardes */
.save-select-screen {
  position: relative;
  align-items: flex-start;
  justify-content: center;
  padding: 78px 20px 36px;
  overflow: auto;
}

.save-select-shell {
  position: relative;
  z-index: 1;
  width: min(980px, 100%);
  padding: clamp(23px, 4vw, 42px);
  background: rgba(255, 253, 247, .97);
  border: 3px solid #ead28f;
  border-radius: 29px;
  box-shadow: var(--shadow), inset 0 0 0 5px #fff8df;
}

.save-select-heading {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 27px;
}

.save-select-heading h2 {
  margin-bottom: 6px;
  color: var(--blue-950);
  font-family: Georgia, serif;
  font-size: clamp(1.85rem, 5vw, 3rem);
}

.save-select-heading p:last-child {
  margin: 0;
  color: var(--muted);
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 17px;
}

.save-card {
  position: relative;
  display: flex;
  min-height: 235px;
  padding: 22px 17px 18px;
  overflow: hidden;
  align-items: center;
  flex-direction: column;
  color: var(--blue-950);
  text-align: center;
  cursor: pointer;
  background: linear-gradient(155deg, #fff, #edf5fe);
  border: 3px solid #cbdced;
  border-radius: 24px;
  box-shadow: 0 6px 0 #aabfd6, var(--soft-shadow);
  transition: transform .16s, border-color .16s, background .16s;
}

.save-card:hover {
  z-index: 2;
  background: linear-gradient(155deg, #fffdf4, #fff0bd);
  border-color: var(--gold-500);
  transform: translateY(-4px);
}

.save-card.is-current {
  border-color: var(--gold-500);
  box-shadow: 0 6px 0 #bb7e17, var(--soft-shadow);
}

.save-card.is-current::after {
  position: absolute;
  top: 11px;
  right: 11px;
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: white;
  background: var(--green);
  border-radius: 50%;
  content: "✓";
}

.save-card__avatar {
  display: grid;
  width: 88px;
  height: 88px;
  margin-bottom: 12px;
  place-items: center;
}

.character-display {
  position: relative;
  display: grid;
  width: 76px;
  height: 76px;
  overflow: hidden;
  place-items: center;
  background: linear-gradient(145deg, #e9f3ff, #fff3ca);
  border: 5px solid #2f67ae;
  border-radius: 25px;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.5), 0 5px 12px rgba(25, 52, 88, .18);
}

.character-display__avatar {
  position: relative;
  z-index: 1;
  font-size: 3rem;
  filter: drop-shadow(0 4px 2px rgba(31, 42, 57, .16));
}

.character-display__accessory {
  position: absolute;
  z-index: 2;
  top: -2px;
  right: -2px;
  font-size: 1.65rem;
  filter: drop-shadow(0 2px 1px rgba(0,0,0,.2));
  transform: rotate(8deg);
}

.character-display--save {
  width: 88px;
  height: 88px;
}

.character-display--save .character-display__avatar {
  font-size: 3.45rem;
}

.frame-royal { border-color: #2f67ae; }
.frame-gold { border-color: #e0a51d; box-shadow: inset 0 0 0 2px #fff0a3, 0 0 0 3px #f4d36d, 0 5px 14px rgba(118,73,3,.22); }
.frame-rose { border-color: #dc668b; }
.frame-forest { border-color: #398153; }
.frame-sky { border-color: #70b7de; }
.frame-purple { border-color: #8357ad; }
.frame-fire { border-color: #c94b4d; }

.background-courtyard { background: linear-gradient(145deg, #dcecff, #fff1bd); }
.background-castle { background: linear-gradient(145deg, #a9c7e8, #e7dbc2); }
.background-meadow { background: linear-gradient(145deg, #bfe59e, #fff0a9); }
.background-forest { background: linear-gradient(145deg, #6fa870, #c5df9a); }
.background-night { background: radial-gradient(circle at 70% 25%, #fff6a2 0 7%, transparent 8%), linear-gradient(145deg, #172d65, #5c4b98); }
.background-chapel { background: linear-gradient(145deg, #e8d7b6, #91c2d4); }
.background-ocean { background: linear-gradient(145deg, #7bd2e4, #397fc3); }
.background-pink { background: linear-gradient(145deg, #ffd2da, #ffbd92); }
.background-purple { background: linear-gradient(145deg, #c59bdd, #735baa); }

[data-theme="background-castle"] .map-backdrop {
  background:
    linear-gradient(rgba(224, 236, 250, .72), rgba(255, 242, 209, .88)),
    url("assets/royaume.webp") 78% center / cover;
}

[data-theme="background-meadow"] .map-backdrop,
[data-theme="background-meadow"] .game-backdrop {
  background: radial-gradient(circle at 22% 18%, #fff6aa, transparent 24%), linear-gradient(145deg, #bfe7a3, #f8edb1);
}

[data-theme="background-forest"] .map-backdrop,
[data-theme="background-forest"] .game-backdrop {
  background: radial-gradient(circle at 70% 15%, #d9f4a5, transparent 22%), linear-gradient(145deg, #73a979, #d9e4a6);
}

[data-theme="background-night"] .map-backdrop,
[data-theme="background-night"] .game-backdrop {
  background:
    radial-gradient(circle at 75% 13%, #fff4a1 0 4%, transparent 5%),
    radial-gradient(circle, rgba(255,255,255,.72) 1.5px, transparent 1.8px),
    linear-gradient(145deg, #192e63, #745b9d);
  background-size: auto, 42px 42px, auto;
}

[data-theme="background-chapel"] .map-backdrop {
  background:
    linear-gradient(rgba(241, 239, 220, .67), rgba(222, 242, 244, .9)),
    url("assets/royaume.webp") left center / cover;
}

[data-theme="background-chapel"] .game-backdrop {
  background: radial-gradient(circle at 20% 20%, #fff3a8, transparent 24%), linear-gradient(145deg, #e8d9bc, #b9dbe5);
}

[data-theme="background-ocean"] .map-backdrop,
[data-theme="background-ocean"] .game-backdrop {
  background: radial-gradient(circle at 18% 12%, #fef4a8, transparent 20%), linear-gradient(165deg, #9ee2ef 0 45%, #4b9fd1 46% 70%, #f5dfa2 71%);
}

[data-theme="background-pink"] .map-backdrop,
[data-theme="background-pink"] .game-backdrop {
  background: radial-gradient(circle at 65% 15%, #fff4aa, transparent 22%), linear-gradient(145deg, #ffd6db, #ffc59d);
}

[data-theme="background-purple"] .map-backdrop,
[data-theme="background-purple"] .game-backdrop {
  background: radial-gradient(circle at 20% 15%, #ffdca5, transparent 25%), linear-gradient(145deg, #d3ade6, #7f68ad);
}

.save-card h3 {
  max-width: 100%;
  margin: 0 0 12px;
  overflow: hidden;
  font-family: Georgia, serif;
  font-size: 1.35rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.save-card__stats {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

.save-card__stats span {
  padding: 7px 10px;
  color: #4d5d73;
  font-size: .78rem;
  font-weight: 900;
  background: rgba(255, 255, 255, .8);
  border: 1px solid #d5e0eb;
  border-radius: 12px;
}

.new-profile-button {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  width: min(100%, 420px);
  min-height: 58px;
  margin: 25px auto 0;
  padding: 12px 22px;
  color: var(--blue-900);
  font-weight: 900;
  cursor: pointer;
  background: #eaf3fc;
  border: 3px dashed #739dcc;
  border-radius: 18px;
}

.new-profile-button span {
  font-size: 1.6rem;
}

.new-profile-button:hover {
  background: #dceeff;
}

.new-profile-button:disabled {
  cursor: not-allowed;
  filter: grayscale(.8);
  opacity: .5;
}

.profile-limit-note {
  margin: 13px 0 -8px;
  color: var(--muted);
  font-size: .75rem;
  text-align: center;
}

/* Carte */
.map-screen {
  position: relative;
  min-height: 100vh;
  padding: 96px clamp(15px, 4vw, 46px) 42px;
  background: linear-gradient(#e6f1fb, #f7f0d9);
}

.map-backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(244, 249, 255, .84), rgba(253, 248, 229, .94)),
    url("assets/royaume.webp") center / cover;
}

.map-content {
  position: relative;
  z-index: 1;
  width: min(1180px, 100%);
  margin: 0 auto;
}

.map-heading {
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}

.player-welcome {
  display: flex;
  gap: 15px;
  align-items: center;
}

.player-avatar {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 76px;
  height: 76px;
  font-size: 2.8rem;
  background: white;
  border: 4px solid #f0c85d;
  border-radius: 24px;
  box-shadow: var(--soft-shadow);
}

.player-avatar .character-display {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 19px;
  box-shadow: none;
}

.player-avatar .character-display__avatar {
  font-size: 3.1rem;
}

.player-avatar .character-display__accessory {
  top: 0;
  right: 0;
  font-size: 1.6rem;
}

.map-heading h2 {
  margin-bottom: 5px;
  color: var(--blue-950);
  font-family: Georgia, serif;
  font-size: clamp(1.65rem, 4vw, 2.6rem);
}

.map-heading p:last-child {
  margin: 0;
  color: #526076;
}

.parent-button {
  flex: 0 0 auto;
  padding: 11px 16px;
  color: var(--blue-900);
  font-size: .85rem;
  font-weight: 900;
  background: rgba(255, 255, 255, .8);
  border: 2px solid white;
  border-radius: 15px;
  box-shadow: var(--soft-shadow);
}

.map-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.shop-entry-button {
  color: #6f4705;
  background: linear-gradient(#fff4c5, #f3d36f);
  border-color: #fff2b0;
}

.daily-quest {
  display: flex;
  gap: 16px;
  align-items: center;
  width: 100%;
  margin-bottom: 22px;
  padding: 16px 20px;
  color: white;
  text-align: left;
  cursor: pointer;
  background: linear-gradient(110deg, var(--blue-900), #4253a3 60%, #6b4fa0);
  border: 3px solid #f1ce72;
  border-radius: 22px;
  box-shadow: 0 7px 0 #9e7016, var(--soft-shadow);
}

.daily-quest:hover {
  filter: brightness(1.06);
  transform: translateY(-2px);
}

.daily-quest__icon {
  display: grid;
  place-items: center;
  width: 55px;
  height: 55px;
  font-size: 2rem;
  background: rgba(255, 255, 255, .15);
  border-radius: 18px;
}

.daily-quest__copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 3px;
}

.daily-quest__copy strong {
  font-family: Georgia, serif;
  font-size: 1.25rem;
}

.daily-quest__copy small {
  color: #e5eafa;
}

.daily-quest__reward {
  padding: 8px 12px;
  font-weight: 900;
  background: rgba(255, 255, 255, .13);
  border-radius: 13px;
}

.world-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 17px;
}

.world-card {
  position: relative;
  display: flex;
  min-height: 170px;
  padding: 20px;
  overflow: hidden;
  color: white;
  text-align: left;
  cursor: pointer;
  background: var(--world-bg, #2459a9);
  border: 3px solid rgba(255, 255, 255, .75);
  border-radius: 24px;
  box-shadow: 0 7px 0 var(--world-shadow, #173f7d), var(--soft-shadow);
  isolation: isolate;
  transition: transform .18s ease, filter .18s ease;
}

.world-card:hover {
  transform: translateY(-4px);
  filter: saturate(1.08) brightness(1.04);
}

.world-card::before {
  position: absolute;
  z-index: -1;
  top: -50px;
  right: -45px;
  width: 170px;
  height: 170px;
  background: rgba(255, 255, 255, .13);
  border-radius: 50%;
  content: "";
}

.world-card::after {
  position: absolute;
  z-index: -1;
  right: 15px;
  bottom: -35px;
  width: 100px;
  height: 100px;
  background: rgba(0, 0, 0, .07);
  border-radius: 50%;
  content: "";
}

.world-card__content {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
}

.world-card__icon {
  margin-bottom: 12px;
  font-size: 2.55rem;
  filter: drop-shadow(0 3px 2px rgba(0, 0, 0, .14));
}

.world-card h3 {
  margin: 0 0 5px;
  font-family: Georgia, serif;
  font-size: 1.13rem;
}

.world-card p {
  margin: 0;
  color: rgba(255, 255, 255, .86);
  font-size: .82rem;
  line-height: 1.3;
}

.world-card__progress {
  position: absolute;
  right: 16px;
  bottom: 14px;
  left: 16px;
  height: 7px;
  overflow: hidden;
  background: rgba(0, 0, 0, .16);
  border-radius: 10px;
}

.world-card__progress span {
  display: block;
  width: var(--progress, 0%);
  height: 100%;
  background: #ffe58d;
  border-radius: inherit;
}

.treasure-strip {
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  margin-top: 24px;
  padding: 18px 22px;
  background: rgba(255, 253, 247, .88);
  border: 2px solid white;
  border-radius: 22px;
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(8px);
}

.treasure-strip h3 {
  margin: 0;
  color: var(--blue-950);
  font-family: Georgia, serif;
}

.badge-shelf {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.badge {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  font-size: 1.6rem;
  background: #fff4c8;
  border: 2px solid #e3bb50;
  border-radius: 14px;
}

.badge.is-locked {
  filter: grayscale(1);
  opacity: .3;
}

/* Activités */
.game-screen {
  position: relative;
  min-height: 100vh;
  padding: 94px 18px 34px;
  overflow: hidden;
  background: #eaf2fb;
}

.game-backdrop {
  position: fixed;
  inset: 0;
  opacity: .8;
  background:
    radial-gradient(circle at 15% 12%, rgba(255, 220, 120, .55), transparent 25%),
    linear-gradient(145deg, #dcecff, #fff5d7);
}

.game-backdrop::after {
  position: absolute;
  inset: 0;
  opacity: .45;
  background-image: radial-gradient(circle, rgba(23, 59, 114, .12) 1.5px, transparent 1.5px);
  background-size: 29px 29px;
  content: "";
}

.game-backdrop--memory {
  background: radial-gradient(circle at top, #e7d8ff, #f9f0d6);
}

.game-backdrop--drawing {
  background: radial-gradient(circle at top, #d9f0df, #fdf0d2);
}

.game-shell {
  position: relative;
  z-index: 1;
  width: min(980px, 100%);
  margin: 0 auto;
}

.lesson-header {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
}

.lesson-header h2 {
  margin: 0;
  color: var(--blue-950);
  font-family: Georgia, serif;
  font-size: clamp(1.35rem, 3vw, 2.1rem);
}

.lesson-header .eyebrow {
  margin-bottom: 3px;
}

.lesson-progress {
  margin-left: auto;
  padding: 9px 15px;
  color: var(--blue-900);
  font-weight: 900;
  background: white;
  border: 2px solid #dae4ef;
  border-radius: 16px;
  box-shadow: var(--soft-shadow);
}

.lesson-player {
  display: grid;
  margin-left: auto;
  place-items: center;
}

.lesson-player + .lesson-progress {
  margin-left: 0;
}

.lesson-player .character-display {
  width: 58px;
  height: 58px;
  border-width: 4px;
  border-radius: 19px;
}

.lesson-player .character-display__avatar {
  font-size: 2.25rem;
}

.lesson-player .character-display__accessory {
  font-size: 1.2rem;
}

.challenge-card {
  min-height: 540px;
  padding: clamp(18px, 4vw, 35px);
  background: rgba(255, 253, 247, .97);
  border: 3px solid white;
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.mentor-row {
  display: flex;
  gap: 13px;
  align-items: center;
  margin-bottom: 20px;
}

.mentor-avatar {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 68px;
  height: 68px;
  font-size: 2.3rem;
  background: #fff2c8;
  border: 3px solid #e9c35e;
  border-radius: 21px;
}

.speech-bubble {
  position: relative;
  display: flex;
  flex: 1;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  padding: 13px 17px;
  color: var(--blue-950);
  font-size: clamp(1rem, 2.4vw, 1.22rem);
  font-weight: 900;
  text-align: left;
  cursor: pointer;
  background: #edf5ff;
  border: 3px solid #cbdff5;
  border-radius: 19px;
}

.speech-bubble::before {
  position: absolute;
  top: 24px;
  left: -11px;
  width: 18px;
  height: 18px;
  background: #edf5ff;
  border-bottom: 3px solid #cbdff5;
  border-left: 3px solid #cbdff5;
  content: "";
  transform: rotate(45deg);
}

.listen-icon {
  flex: 0 0 auto;
  font-size: 1.2rem;
}

.question-visual {
  display: grid;
  min-height: 150px;
  margin: 5px 0 22px;
  place-items: center;
  color: var(--blue-950);
  font-size: clamp(2.8rem, 10vw, 6.8rem);
  font-weight: 900;
  line-height: 1.15;
  text-align: center;
}

.question-visual .word-card {
  display: inline-flex;
  gap: 14px;
  align-items: center;
  padding: 16px 22px;
  font-size: clamp(1.6rem, 6vw, 3.5rem);
  background: #fff6d9;
  border: 3px solid #edcb68;
  border-radius: 22px;
}

.visual-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.8rem, 7vw, 4.4rem);
}

.shape {
  display: inline-block;
  width: clamp(75px, 13vw, 130px);
  height: clamp(75px, 13vw, 130px);
  background: var(--shape-color, #3b79d5);
  border: 5px solid rgba(0, 0, 0, .13);
  filter: drop-shadow(0 7px 3px rgba(37, 50, 74, .14));
}

.shape.circle { border-radius: 50%; }
.shape.square { border-radius: 12px; }
.shape.rectangle { width: clamp(120px, 22vw, 220px); border-radius: 12px; }
.shape.oval { width: clamp(120px, 22vw, 210px); border-radius: 50%; }
.shape.diamond { border-radius: 10px; transform: rotate(45deg) scale(.82); }
.shape.triangle {
  width: 0;
  height: 0;
  background: transparent;
  border-right: clamp(48px, 8vw, 80px) solid transparent;
  border-bottom: clamp(88px, 14vw, 145px) solid var(--shape-color, #3b79d5);
  border-left: clamp(48px, 8vw, 80px) solid transparent;
  filter: drop-shadow(0 7px 3px rgba(37, 50, 74, .14));
}

.answer-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  max-width: 820px;
  margin: 0 auto;
}

.answer-option {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 9px;
  min-width: 0;
}

.answer-button {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 92px;
  padding: 12px;
  place-items: center;
  color: var(--blue-950);
  font-size: clamp(1.08rem, 3vw, 1.6rem);
  font-weight: 900;
  cursor: pointer;
  background: white;
  border: 3px solid #ccd8e7;
  border-radius: 19px;
  box-shadow: 0 5px 0 #bbc9db;
  transition: transform .14s, background .14s, border-color .14s;
}

.answer-listen {
  display: flex;
  gap: 7px;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 47px;
  padding: 8px 12px;
  color: #173b72;
  font-size: .86rem;
  font-weight: 900;
  cursor: pointer;
  background: #e8f3ff;
  border: 3px solid #92b9e4;
  border-radius: 14px;
  box-shadow: 0 4px 0 #6f9dce;
  transition: transform .14s, background .14s, box-shadow .14s;
}

.answer-listen:hover {
  background: #d9edff;
  transform: translateY(-2px);
}

.answer-listen:active,
.answer-option.is-speaking .answer-listen {
  color: white;
  background: #2459a9;
  border-color: #173b72;
  box-shadow: 0 2px 0 #173b72;
  transform: translateY(2px);
}

.answer-listen__icon {
  font-size: 1.25rem;
}

.answer-grid.is-text-heavy .answer-button {
  min-height: 112px;
  padding: 14px 11px;
  font-size: clamp(.92rem, 2vw, 1.18rem);
  line-height: 1.25;
}

.answer-button:hover:not(:disabled) {
  transform: translateY(-3px);
  background: #f5f9ff;
  border-color: #6d9bd4;
}

.answer-button:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #bbc9db;
}

.answer-button.is-correct {
  color: #175d32;
  background: #dff5e6;
  border-color: #53a56e;
  box-shadow: 0 5px 0 #3e8657;
  animation: correct-pop .42s ease;
}

.answer-button.is-wrong {
  color: #8f2531;
  background: #ffe5e8;
  border-color: #d96b76;
  box-shadow: 0 5px 0 #b64854;
  animation: shake .38s ease;
}

.answer-button .answer-emoji {
  display: block;
  margin-bottom: 3px;
  font-size: 2.1rem;
}

@keyframes correct-pop {
  50% { transform: scale(1.07); }
}

@keyframes shake {
  25% { transform: translateX(-7px); }
  50% { transform: translateX(7px); }
  75% { transform: translateX(-4px); }
}

.feedback {
  min-height: 35px;
  margin-top: 15px;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 900;
  text-align: center;
}

.feedback.is-good { color: var(--green); }
.feedback.is-try { color: var(--red); }

.session-dots {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 16px;
}

.session-dot {
  width: 15px;
  height: 15px;
  background: white;
  border: 2px solid #a9bad0;
  border-radius: 50%;
}

.session-dot.is-done {
  background: var(--gold-500);
  border-color: #b77813;
}

.session-dot.is-current {
  background: var(--blue-500);
  border-color: var(--blue-900);
  transform: scale(1.2);
}

/* Mémoire */
.memory-card-shell {
  min-height: 580px;
}

.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(80px, 145px));
  gap: 14px;
  justify-content: center;
  margin: 25px auto;
}

.memory-tile {
  position: relative;
  aspect-ratio: 1;
  padding: 0;
  cursor: pointer;
  background: transparent;
  border: 0;
  perspective: 800px;
}

.memory-tile__inner {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform .42s ease;
}

.memory-tile.is-flipped .memory-tile__inner,
.memory-tile.is-matched .memory-tile__inner {
  transform: rotateY(180deg);
}

.memory-tile__front,
.memory-tile__back {
  position: absolute;
  display: grid;
  inset: 0;
  place-items: center;
  border-radius: 20px;
  backface-visibility: hidden;
}

.memory-tile__front {
  color: #ffe49a;
  font-size: 2.1rem;
  background:
    radial-gradient(circle at 50% 42%, rgba(255,255,255,.15) 0 18%, transparent 19%),
    linear-gradient(145deg, #345da9, #183970);
  border: 4px solid #e5bd51;
  box-shadow: 0 6px 0 #9a6d16;
}

.memory-tile__back {
  font-size: clamp(2rem, 7vw, 4rem);
  background: #fff8de;
  border: 4px solid #d7b85d;
  box-shadow: 0 6px 0 #b28c2c;
  transform: rotateY(180deg);
}

.memory-tile.is-matched {
  pointer-events: none;
}

.memory-tile.is-matched .memory-tile__back {
  background: #ddf4e4;
  border-color: #57a873;
  box-shadow: 0 6px 0 #398455;
}

/* Dessin */
.drawing-card {
  min-height: 570px;
}

.canvas-wrap {
  position: relative;
  width: 100%;
  overflow: hidden;
  background:
    linear-gradient(rgba(57, 91, 136, .07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(57, 91, 136, .07) 1px, transparent 1px),
    white;
  background-size: 25px 25px;
  border: 4px solid #d5e0eb;
  border-radius: 20px;
  touch-action: none;
}

#drawingCanvas {
  display: block;
  width: 100%;
  height: min(45vh, 400px);
  cursor: crosshair;
  touch-action: none;
}

.drawing-tools {
  display: flex;
  gap: 15px;
  align-items: center;
  justify-content: space-between;
  margin-top: 17px;
}

.color-choices {
  display: flex;
  gap: 8px;
}

.color-choice {
  width: 40px;
  height: 40px;
  cursor: pointer;
  background: var(--swatch);
  border: 4px solid white;
  border-radius: 50%;
  box-shadow: 0 0 0 2px #c7d3df;
}

.color-choice.is-selected {
  box-shadow: 0 0 0 4px var(--gold-500);
  transform: scale(1.08);
}

/* Boutique */
.shop-screen {
  position: relative;
  min-height: 100vh;
  padding: 38px 20px;
  overflow: auto;
  background: #e8f1fb;
}

.shop-backdrop {
  position: fixed;
  inset: 0;
  opacity: .42;
  background:
    linear-gradient(rgba(232, 242, 252, .78), rgba(255, 247, 220, .9)),
    url("assets/royaume.webp") center / cover;
}

.shop-shell {
  position: relative;
  z-index: 1;
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: clamp(20px, 4vw, 38px);
  background: rgba(255, 253, 247, .97);
  border: 3px solid #e7c866;
  border-radius: 29px;
  box-shadow: var(--shadow), inset 0 0 0 5px #fff7d7;
}

.shop-heading {
  display: flex;
  gap: 16px;
  align-items: center;
}

.shop-player-preview {
  flex: 0 0 auto;
}

.shop-player-preview .character-display {
  width: 96px;
  height: 96px;
  border-width: 6px;
  border-radius: 29px;
}

.shop-player-preview .character-display__avatar {
  font-size: 3.8rem;
}

.shop-player-preview .character-display__accessory {
  font-size: 2rem;
}

.shop-heading__copy {
  flex: 1;
}

.shop-heading h2 {
  margin-bottom: 5px;
  color: var(--blue-950);
  font-family: Georgia, serif;
  font-size: clamp(1.7rem, 4vw, 2.8rem);
}

.shop-heading p:last-child {
  margin: 0;
  color: var(--muted);
}

.shop-wallet {
  display: flex;
  gap: 7px;
  align-items: center;
  padding: 11px 17px;
  color: #68440c;
  font-size: 1.18rem;
  background: linear-gradient(#fff5c6, #f1cf66);
  border: 3px solid #e0ad32;
  border-radius: 18px;
  box-shadow: 0 4px 0 #ad7512;
}

.shop-tabs {
  display: flex;
  gap: 9px;
  margin: 27px 0 20px;
  overflow-x: auto;
  padding: 2px 2px 7px;
}

.shop-tab {
  flex: 1 0 auto;
  min-height: 50px;
  padding: 9px 15px;
  color: var(--blue-900);
  font-weight: 900;
  cursor: pointer;
  background: #edf4fc;
  border: 2px solid #ccdaea;
  border-radius: 15px;
}

.shop-tab.is-selected {
  color: white;
  background: var(--blue-700);
  border-color: var(--blue-950);
  box-shadow: 0 4px 0 var(--blue-950);
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.shop-item {
  display: flex;
  min-height: 260px;
  padding: 15px;
  align-items: center;
  flex-direction: column;
  text-align: center;
  background: white;
  border: 3px solid #d9e2eb;
  border-radius: 21px;
  box-shadow: 0 5px 0 #becbd8;
}

.shop-item.is-equipped {
  background: #f0faed;
  border-color: #69a76b;
  box-shadow: 0 5px 0 #438349;
}

.shop-item__preview {
  display: grid;
  min-height: 106px;
  margin-bottom: 10px;
  place-items: center;
}

.shop-item__preview .character-display {
  width: 94px;
  height: 94px;
  border-radius: 28px;
}

.shop-item__preview .character-display__avatar {
  font-size: 3.7rem;
}

.shop-item__preview .character-display__accessory {
  font-size: 1.9rem;
}

.shop-item h3 {
  margin: 0 0 5px;
  color: var(--blue-950);
  font-size: 1rem;
}

.shop-item__status {
  min-height: 22px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: .76rem;
  font-weight: 900;
}

.shop-item__button {
  width: 100%;
  min-height: 43px;
  margin-top: auto;
  padding: 8px 10px;
  color: white;
  font-weight: 900;
  cursor: pointer;
  background: linear-gradient(#3c7ddd, #2459a9);
  border: 2px solid #173f7d;
  border-radius: 13px;
  box-shadow: 0 3px 0 #173f7d;
}

.shop-item__button.is-buy {
  color: #633f05;
  background: linear-gradient(#ffe795, #edbd3a);
  border-color: #b57a11;
  box-shadow: 0 3px 0 #9c6710;
}

.shop-item__button:disabled {
  cursor: default;
  filter: grayscale(.45);
  opacity: .65;
}

.shop-note {
  margin: 18px 0 -8px;
  color: var(--muted);
  font-size: .76rem;
  text-align: center;
}

/* Réussite */
.celebration-screen {
  overflow: hidden;
}

.celebration-rays {
  position: fixed;
  width: 110vmax;
  height: 110vmax;
  opacity: .42;
  background: repeating-conic-gradient(from 0deg, #ffd35b 0 12deg, transparent 12deg 24deg);
  border-radius: 50%;
  animation: spin-rays 35s linear infinite;
}

@keyframes spin-rays {
  to { transform: rotate(360deg); }
}

.celebration-card {
  z-index: 2;
}

.celebration-player {
  display: grid;
  margin: -82px auto 5px;
  place-items: center;
}

.celebration-player .character-display {
  width: 112px;
  height: 112px;
  border-width: 6px;
  border-radius: 34px;
}

.celebration-player .character-display__avatar {
  font-size: 4.5rem;
}

.celebration-player .character-display__accessory {
  font-size: 2.3rem;
}

.celebration-crown {
  margin-top: -8px;
  font-size: 5.2rem;
  filter: drop-shadow(0 8px 4px rgba(99, 61, 8, .2));
  animation: crown-bob 1.8s ease-in-out infinite;
}

@keyframes crown-bob {
  50% { transform: translateY(-7px) rotate(2deg); }
}

.celebration-card h2 {
  margin-bottom: 8px;
  color: var(--blue-950);
  font-family: Georgia, serif;
  font-size: clamp(2.3rem, 6vw, 3.6rem);
}

.celebration-card > p:not(.eyebrow) {
  color: #55647a;
  font-size: 1.08rem;
}

.reward-stars {
  margin: 18px 0;
  font-size: clamp(2.5rem, 9vw, 4.5rem);
  letter-spacing: .06em;
  filter: drop-shadow(0 5px 2px rgba(130, 80, 9, .17));
}

.reward-stars span:nth-child(2) {
  display: inline-block;
  transform: translateY(-12px) scale(1.12);
}

.session-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  max-width: 410px;
  margin: 0 auto 24px;
  overflow: hidden;
  background: #eef5fd;
  border: 2px solid #d5e2ef;
  border-radius: 17px;
}

.session-summary div {
  display: flex;
  flex-direction: column;
  padding: 13px;
}

.session-summary div + div {
  border-left: 2px solid #d5e2ef;
}

.session-summary strong {
  color: var(--blue-900);
  font-size: 1.7rem;
}

.session-summary small {
  color: var(--muted);
  font-size: .74rem;
}

.celebration-card .text-button {
  display: block;
  margin: 10px auto -10px;
}

.confetti {
  position: fixed;
  z-index: 1;
  inset: 0;
  pointer-events: none;
}

.confetti-piece {
  position: absolute;
  top: -20px;
  width: 12px;
  height: 22px;
  background: var(--confetti-color);
  border-radius: 3px;
  animation: confetti-fall var(--duration) linear var(--delay) infinite;
}

@keyframes confetti-fall {
  to { transform: translate3d(var(--drift), 110vh, 0) rotate(720deg); }
}

/* Parents */
.parent-screen {
  align-items: flex-start;
  overflow: auto;
}

.parent-panel {
  position: relative;
  z-index: 1;
  width: min(1050px, 100%);
  padding: clamp(22px, 4vw, 42px);
  background: rgba(255, 253, 247, .98);
  border: 3px solid #ead28f;
  border-radius: 27px;
  box-shadow: var(--shadow);
}

.parent-heading {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  justify-content: space-between;
}

.parent-heading h2 {
  margin-bottom: 6px;
  color: var(--blue-950);
  font-family: Georgia, serif;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
}

.parent-heading p:last-child {
  margin: 0;
  color: var(--muted);
}

.parent-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 25px 0;
}

.parent-stats article {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 10px;
  align-items: center;
  padding: 15px;
  background: #f0f6fc;
  border: 2px solid #d9e5f0;
  border-radius: 17px;
}

.parent-stats article > span {
  grid-row: 1 / 3;
  font-size: 1.8rem;
}

.parent-stats strong {
  color: var(--blue-900);
  font-size: 1.45rem;
}

.parent-stats small {
  color: var(--muted);
  font-size: .72rem;
}

.parent-columns {
  display: grid;
  grid-template-columns: 1.25fr .75fr;
  gap: 17px;
}

.parent-box {
  padding: 20px;
  background: white;
  border: 2px solid #e0e6ed;
  border-radius: 19px;
}

.parent-box h3 {
  margin-bottom: 18px;
  color: var(--blue-950);
}

.progress-list {
  display: grid;
  gap: 13px;
}

.progress-row {
  display: grid;
  grid-template-columns: 160px 1fr 44px;
  gap: 10px;
  align-items: center;
  font-size: .84rem;
}

.progress-row__label {
  overflow: hidden;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-bar {
  height: 10px;
  overflow: hidden;
  background: #e7edf4;
  border-radius: 8px;
}

.progress-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--blue-500), #66a37b);
  border-radius: inherit;
}

.progress-row__value {
  color: var(--muted);
  font-size: .75rem;
  font-weight: 800;
  text-align: right;
}

.tips-list {
  display: grid;
  gap: 10px;
  padding-left: 20px;
  color: #58667a;
  font-size: .87rem;
  line-height: 1.35;
}

.setting-row {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid #e1e6ec;
}

.setting-row div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.setting-row small {
  color: var(--muted);
  font-size: .73rem;
}

.toggle {
  position: relative;
  width: 52px;
  height: 29px;
  padding: 3px;
  cursor: pointer;
  background: #aab6c6;
  border: 0;
  border-radius: 18px;
}

.toggle span {
  display: block;
  width: 23px;
  height: 23px;
  background: white;
  border-radius: 50%;
  transition: transform .2s;
}

.toggle.is-on {
  background: var(--green);
}

.toggle.is-on span {
  transform: translateX(23px);
}

.parent-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  justify-content: space-between;
  margin-top: 21px;
}


.floating-companion {
  position: fixed;
  z-index: 90;
  right: max(14px, env(safe-area-inset-right, 0px));
  bottom: max(14px, env(safe-area-inset-bottom, 0px));
  display: grid;
  width: 104px;
  height: 104px;
  padding: 0;
  place-items: center;
  cursor: pointer;
  background: transparent;
  border: 0;
  filter: drop-shadow(0 10px 14px rgba(16, 38, 75, .24));
  animation: companion-float 2.6s ease-in-out infinite;
}

.floating-companion__avatar {
  display: grid;
  width: 88px;
  height: 88px;
  place-items: center;
}

.floating-companion .character-display {
  width: 84px;
  height: 84px;
  border-width: 4px;
  border-radius: 28px;
}

.floating-companion .character-display__avatar {
  font-size: 3.25rem;
}

.floating-companion .character-display__accessory {
  font-size: 1.55rem;
}

.floating-companion__bubble {
  position: absolute;
  top: -4px;
  left: -45px;
  padding: 6px 9px;
  color: var(--blue-950);
  font-size: .72rem;
  font-weight: 900;
  white-space: nowrap;
  background: white;
  border: 2px solid #d9e5f1;
  border-radius: 12px 12px 4px 12px;
}

.floating-companion.is-wiggling {
  animation: companion-wiggle .5s ease;
}

@keyframes companion-float {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-7px) rotate(1deg); }
}

@keyframes companion-wiggle {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-8deg) scale(1.04); }
  75% { transform: rotate(8deg) scale(1.04); }
}

body[data-screen="gameScreen"] .floating-companion,
body[data-screen="memoryScreen"] .floating-companion,
body[data-screen="drawingScreen"] .floating-companion {
  right: auto;
  left: max(12px, env(safe-area-inset-left, 0px));
}

.toast {
  position: fixed;
  z-index: 100;
  bottom: 20px;
  left: 50%;
  max-width: calc(100% - 30px);
  padding: 12px 20px;
  color: white;
  font-weight: 800;
  text-align: center;
  pointer-events: none;
  background: var(--blue-950);
  border: 2px solid rgba(255,255,255,.35);
  border-radius: 15px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translate(-50%, 20px);
  transition: opacity .25s, transform .25s;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 830px) {
  .world-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .parent-columns {
    grid-template-columns: 1fr;
  }

  .parent-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .profile-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .shop-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .challenge-card {
    min-height: 500px;
  }
}

@media (max-width: 570px) {
  .topbar {
    height: 60px;
    padding: 7px 10px;
  }

  .brand-mini {
    display: none;
  }

  .round-button {
    width: 42px;
    height: 42px;
  }

  .welcome-screen {
    align-items: flex-end;
    padding: 70px 14px 62px;
    background-position: 61% center;
  }

  .welcome-card {
    padding: 27px 18px 24px;
    border-radius: 25px;
  }

  .welcome-card__emblem {
    width: 56px;
    height: 56px;
    margin-top: -60px;
    font-size: 1.8rem;
  }

  .welcome-card h1 {
    font-size: 2.2rem;
  }

  .profile-screen,
  .save-select-screen,
  .parent-screen,
  .celebration-screen {
    padding: calc(79px + env(safe-area-inset-top, 0px)) 11px calc(100px + env(safe-area-inset-bottom, 0px));
  }

  .paper-card {
    padding: 25px 16px;
  }

  .avatar-choice {
    width: 57px;
    height: 57px;
  }

  .save-select-shell {
    padding: 22px 14px;
  }

  .save-select-heading {
    gap: 11px;
  }

  .profile-grid {
    grid-template-columns: 1fr;
  }

  .save-card {
    min-height: 200px;
  }

  .shop-screen {
    padding: 12px;
  }

  .shop-heading {
    flex-wrap: wrap;
  }

  .shop-heading__copy {
    order: 3;
    flex-basis: 100%;
  }

  .shop-player-preview .character-display {
    width: 74px;
    height: 74px;
  }

  .shop-player-preview .character-display__avatar {
    font-size: 2.9rem;
  }

  .shop-wallet {
    margin-left: auto;
  }

  .shop-grid {
    grid-template-columns: 1fr;
  }

  .map-screen,
  .game-screen {
    padding: calc(78px + env(safe-area-inset-top, 0px)) 11px calc(100px + env(safe-area-inset-bottom, 0px));
  }

  .map-heading {
    align-items: flex-start;
  }

  .player-avatar {
    width: 60px;
    height: 60px;
    font-size: 2.15rem;
    border-radius: 18px;
  }

  .map-heading p:last-child,
  .parent-button {
    font-size: .72rem;
  }

  .parent-button {
    padding: 8px 9px;
  }

  .daily-quest {
    padding: 13px;
  }

  .daily-quest__icon {
    width: 46px;
    height: 46px;
  }

  .daily-quest__reward {
    display: none;
  }

  .world-grid {
    grid-template-columns: 1fr;
  }

  .world-card {
    min-height: 138px;
  }

  .treasure-strip {
    align-items: flex-start;
    flex-direction: column;
  }

  .badge-shelf {
    justify-content: flex-start;
  }

  .lesson-header {
    gap: 10px;
  }

  .lesson-progress {
    padding: 8px 10px;
    font-size: .8rem;
  }

  .lesson-player .character-display {
    width: 46px;
    height: 46px;
  }

  .lesson-player .character-display__avatar {
    font-size: 1.8rem;
  }

  .challenge-card {
    min-height: 480px;
    padding: 15px;
    border-radius: 21px;
  }

  .mentor-avatar {
    width: 52px;
    height: 52px;
    font-size: 1.8rem;
    border-radius: 16px;
  }

  .speech-bubble {
    min-height: 58px;
    padding: 10px 12px;
  }

  .speech-bubble::before {
    top: 19px;
  }

  .question-visual {
    min-height: 128px;
  }

  .answer-grid {
    gap: 9px;
  }

  .answer-grid.is-text-heavy {
    grid-template-columns: 1fr;
  }

  .answer-button {
    min-height: 80px;
    padding: 8px 5px;
    border-radius: 15px;
  }

  .answer-listen {
    min-height: 45px;
    padding: 6px;
  }

  .answer-listen__text {
    display: none;
  }

  .memory-grid {
    grid-template-columns: repeat(3, minmax(68px, 108px));
    gap: 10px;
  }

  .drawing-tools {
    flex-wrap: wrap;
    justify-content: center;
  }

  .parent-stats {
    grid-template-columns: 1fr 1fr;
  }

  .parent-stats article {
    padding: 11px;
  }

  .progress-row {
    grid-template-columns: 105px 1fr 37px;
  }

  .parent-actions {
    align-items: stretch;
    flex-direction: column;
  }
  .nickname-choices {
    grid-template-columns: 1fr;
  }

  .nickname-choice {
    min-height: 66px;
    font-size: 1.03rem;
  }

  .avatar-choice,
  .age-choice {
    min-height: 64px;
  }

  .answer-button {
    min-height: 88px;
    font-size: clamp(1.05rem, 5vw, 1.35rem);
  }

  .answer-listen {
    min-height: 50px;
  }

  .floating-companion {
    width: 82px;
    height: 82px;
    right: max(7px, env(safe-area-inset-right, 0px));
    bottom: max(8px, env(safe-area-inset-bottom, 0px));
  }

  .floating-companion__avatar,
  .floating-companion .character-display {
    width: 70px;
    height: 70px;
  }

  .floating-companion .character-display__avatar {
    font-size: 2.65rem;
  }

  .floating-companion__bubble {
    display: none;
  }

  body[data-screen="gameScreen"] .floating-companion,
  body[data-screen="memoryScreen"] .floating-companion,
  body[data-screen="drawingScreen"] .floating-companion {
    right: auto;
    left: max(6px, env(safe-area-inset-left, 0px));
    bottom: max(7px, env(safe-area-inset-bottom, 0px));
  }

}

@media (max-height: 690px) and (min-width: 700px) {
  .welcome-card {
    transform: scale(.88);
  }

  .game-screen {
    padding-top: 76px;
  }

  .challenge-card {
    min-height: 455px;
  }

  .question-visual {
    min-height: 110px;
    font-size: 4.2rem;
  }
}

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


@media (hover: none) and (pointer: coarse) {
  .answer-button:hover:not(:disabled),
  .primary-button:hover,
  .round-button:hover {
    transform: none;
  }

  button {
    min-width: 44px;
  }
}

@supports (-webkit-touch-callout: none) {
  .screen {
    min-height: 100svh;
  }

  .map-screen,
  .game-screen {
    padding-bottom: calc(90px + env(safe-area-inset-bottom, 0px));
  }
}
