/* ============================================================
   English Kids — styles (responsive tablette / ordinateur)
   ============================================================ */
:root {
  --bg1: #fef6ff;
  --bg2: #eafaff;
  --ink: #2b2a4c;
  --ink-soft: #6c6a9e;
  --card: #ffffff;
  --shadow: 0 10px 30px rgba(80, 60, 160, 0.16);
  --shadow-sm: 0 4px 14px rgba(80, 60, 160, 0.14);
  --radius: 26px;
  --pink: #ff6b9d;
  --blue: #4dabf7;
  --green: #51cf66;
  --yellow: #ffd43b;
  --purple: #9775fa;
  --orange: #ffa94d;
  --good: #2fb344;
  --bad: #ff6b6b;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: "Baloo 2", "Comic Sans MS", "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: linear-gradient(160deg, var(--bg1), var(--bg2));
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  overflow-x: hidden;
}

#app {
  max-width: 960px;
  margin: 0 auto;
  padding: 16px clamp(12px, 4vw, 28px) 40px;
  min-height: 100vh;
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 4px;
  margin-bottom: 8px;
}
.topbar .spacer { flex: 1; }
.btn-back {
  background: var(--card);
  border: none;
  border-radius: 50%;
  width: 52px; height: 52px;
  font-size: 24px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform .12s;
}
.btn-back:active { transform: scale(.92); }
.pill {
  background: var(--card);
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 700;
  font-size: 18px;
  box-shadow: var(--shadow-sm);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.pill.stars { color: #e8a000; }

/* ---------- Headings ---------- */
h1 { font-size: clamp(28px, 6vw, 44px); margin: 4px 0 2px; }
h2 { font-size: clamp(22px, 5vw, 32px); margin: 0 0 14px; }
.subtitle { color: var(--ink-soft); font-size: 18px; margin: 0 0 22px; }
.center { text-align: center; }

/* ---------- Buttons ---------- */
.btn {
  border: none;
  border-radius: var(--radius);
  padding: 18px 26px;
  font-size: 22px;
  font-weight: 800;
  font-family: inherit;
  color: #fff;
  background: var(--blue);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform .12s, filter .12s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.btn:active { transform: translateY(2px) scale(.98); filter: brightness(.97); }
.btn.big { width: 100%; padding: 22px; font-size: 24px; }
.btn.pink { background: var(--pink); }
.btn.green { background: var(--green); }
.btn.purple { background: var(--purple); }
.btn.orange { background: var(--orange); }
.btn.ghost {
  background: var(--card);
  color: var(--ink);
}
.btn.small { padding: 12px 18px; font-size: 18px; }
.btn[disabled] { opacity: .45; cursor: default; transform: none; }

/* ---------- Grids ---------- */
.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, 1fr);
}
.grid.three { grid-template-columns: repeat(3, 1fr); }
@media (min-width: 620px) {
  .grid.themes { grid-template-columns: repeat(3, 1fr); }
}

/* Card tiles (themes, avatars, profiles) */
.tile {
  background: var(--card);
  border: 4px solid transparent;
  border-radius: var(--radius);
  padding: 18px 12px;
  text-align: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform .12s, border-color .12s;
}
.tile:active { transform: scale(.96); }
.tile.selected { border-color: var(--purple); }
.tile .emoji { font-size: clamp(40px, 11vw, 64px); line-height: 1.1; display: block; }
.tile .name { font-weight: 800; font-size: 19px; margin-top: 6px; }
.tile .meta { color: var(--ink-soft); font-size: 14px; }
.tile .lock { font-size: 14px; color: var(--ink-soft); }

/* Theme tile colored */
.tile.theme .emoji { font-size: clamp(38px, 10vw, 56px); }
.tile.theme .bar {
  height: 8px; border-radius: 999px; background: #eee; margin-top: 10px; overflow: hidden;
}
.tile.theme .bar > i { display: block; height: 100%; border-radius: 999px; background: var(--green); width: 0; }

/* ---------- Avatar bubble (the talking character) ---------- */
.stage {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  text-align: center;
  margin-bottom: 18px;
}
.avatar-big {
  font-size: clamp(70px, 22vw, 130px);
  display: inline-block;
  transition: transform .2s;
}
.avatar-big.talking { animation: bob .5s ease-in-out infinite; }
@keyframes bob {
  0%,100% { transform: translateY(0) rotate(0); }
  50%     { transform: translateY(-10px) rotate(-3deg); }
}
.bubble {
  display: inline-block;
  background: #f4f0ff;
  border-radius: 20px;
  padding: 12px 18px;
  font-size: 20px;
  font-weight: 700;
  margin-top: 8px;
  max-width: 90%;
}

/* ---------- Flashcard (listen / repeat) ---------- */
.card-word {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px;
  text-align: center;
  margin-bottom: 18px;
}
.card-word .pic { font-size: clamp(80px, 26vw, 150px); }
.card-word .en { font-size: clamp(34px, 9vw, 54px); font-weight: 900; margin: 6px 0 2px; }
.card-word .fr { font-size: 22px; color: var(--ink-soft); }
.card-word .sentence { font-size: 24px; font-weight: 700; color: var(--purple); margin-top: 8px; }

.controls { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.progress-dots { display: flex; gap: 7px; justify-content: center; margin: 14px 0; flex-wrap: wrap; }
.progress-dots i { width: 12px; height: 12px; border-radius: 50%; background: #d8d4f0; }
.progress-dots i.on { background: var(--purple); }
.progress-dots i.done { background: var(--green); }

/* ---------- Quiz ---------- */
.quiz-prompt {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  text-align: center;
  margin-bottom: 16px;
}
.quiz-prompt .pic { font-size: clamp(70px, 22vw, 120px); }
.quiz-prompt .q { font-size: 22px; font-weight: 800; }
.options { display: grid; gap: 14px; grid-template-columns: repeat(2, 1fr); }
.opt {
  background: var(--card);
  border: 4px solid transparent;
  border-radius: 20px;
  padding: 20px 10px;
  font-size: clamp(22px, 6vw, 30px);
  font-weight: 800;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform .1s;
}
.opt .opt-emoji { font-size: clamp(44px, 12vw, 64px); display: block; }
.opt:active { transform: scale(.96); }
.opt.correct { border-color: var(--good); background: #eafff0; }
.opt.wrong { border-color: var(--bad); background: #fff0f0; }
.opt[disabled] { cursor: default; }

/* ---------- Feedback / mic ---------- */
.feedback {
  text-align: center;
  font-size: 26px;
  font-weight: 900;
  min-height: 34px;
  margin: 10px 0;
}
.feedback.good { color: var(--good); }
.feedback.bad { color: var(--orange); }
.mic-btn {
  width: 110px; height: 110px;
  border-radius: 50%;
  border: none;
  font-size: 50px;
  background: var(--pink);
  color: #fff;
  box-shadow: var(--shadow);
  cursor: pointer;
}
.mic-btn.listening { animation: pulse 1s infinite; background: var(--bad); }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255,107,107,.5); }
  100% { box-shadow: 0 0 0 26px rgba(255,107,107,0); }
}

/* ---------- Forms / inputs ---------- */
label.field { display: block; margin: 14px 0 6px; font-weight: 700; font-size: 18px; }
input[type="text"], input[type="number"], select {
  width: 100%;
  font-family: inherit;
  font-size: 20px;
  padding: 14px 16px;
  border: 3px solid #e6e1f5;
  border-radius: 16px;
  background: #fff;
  color: var(--ink);
}
input:focus, select:focus { outline: none; border-color: var(--purple); }

/* PIN pad */
.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 320px; margin: 0 auto; }
.pinpad button {
  font-size: 28px; font-weight: 800; font-family: inherit;
  padding: 16px; border: none; border-radius: 18px;
  background: var(--card); box-shadow: var(--shadow-sm); cursor: pointer;
}
.pin-dots { text-align: center; font-size: 34px; letter-spacing: 12px; min-height: 40px; margin: 10px 0; }

/* ---------- Parent dashboard ---------- */
.panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px 20px;
  margin-bottom: 16px;
}
.panel h3 { margin: 0 0 10px; font-size: 20px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; }
.row + .row { border-top: 1px solid #f0edfa; }
.muted { color: var(--ink-soft); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  background: #f4f0ff; border-radius: 999px; padding: 6px 12px; font-size: 15px; font-weight: 700;
  cursor: pointer; border: 2px solid transparent;
}
.chip.on { background: #e6fbe9; border-color: var(--good); }
.bar-line { height: 14px; border-radius: 999px; background: #eee; overflow: hidden; }
.bar-line > i { display: block; height: 100%; background: var(--green); }

/* Toggle switch */
.switch { position: relative; width: 60px; height: 34px; }
.switch input { display: none; }
.switch .track { position: absolute; inset: 0; background: #d8d4f0; border-radius: 999px; transition: .2s; cursor: pointer; }
.switch .track::after {
  content: ""; position: absolute; top: 4px; left: 4px; width: 26px; height: 26px;
  background: #fff; border-radius: 50%; transition: .2s;
}
.switch input:checked + .track { background: var(--good); }
.switch input:checked + .track::after { transform: translateX(26px); }

/* ---------- Rewards ---------- */
.badge-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.badge {
  background: var(--card); border-radius: 20px; padding: 14px 8px; text-align: center;
  box-shadow: var(--shadow-sm); opacity: .35; filter: grayscale(1);
}
.badge.earned { opacity: 1; filter: none; }
.badge .b-emoji { font-size: 44px; }
.badge .b-label { font-weight: 800; font-size: 15px; margin-top: 4px; }
.badge .b-desc { font-size: 12px; color: var(--ink-soft); }

/* ---------- Memory ---------- */
.memory-grid { display: grid; gap: 10px; }
.mem-card {
  aspect-ratio: 1 / 1;
  border-radius: 18px;
  background: linear-gradient(160deg, var(--purple), #7048e8);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: clamp(30px, 9vw, 50px);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  user-select: none;
  transition: transform .12s;
}
.mem-card:active { transform: scale(.95); }
.mem-card.up { background: #fff; color: var(--ink); }
.mem-card.matched { background: #eafff0; border: 3px solid var(--good); cursor: default; }
.mem-card .w { font-size: clamp(15px, 4.4vw, 24px); font-weight: 800; padding: 4px; text-align: center; }

/* ---------- Lettres (mots à trous / lettres mélangées) ---------- */
.spell-slots { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 8px 0 4px; }
.slot {
  width: 44px; height: 54px; border-radius: 12px;
  background: #f4f0ff; border: 3px dashed #c9bdf0;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 900; text-transform: uppercase; color: var(--ink);
}
.slot.guide { color: #cdc2ee; }
.slot.filled { background: #fff; border-style: solid; border-color: var(--purple); }
.tiles { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 6px; }
.tile-letter {
  width: 50px; height: 56px; border-radius: 14px; border: none;
  background: #fff; box-shadow: var(--shadow-sm);
  font-size: 30px; font-weight: 900; text-transform: uppercase; color: var(--ink);
  font-family: inherit; cursor: pointer; transition: transform .1s;
}
.tile-letter:active { transform: scale(.92); }
.tile-letter.used { visibility: hidden; }

/* ---------- Phrases (remettre les mots dans l'ordre) ---------- */
.sentence-slots {
  display: flex; gap: 8px; justify-content: center; flex-wrap: wrap;
  margin: 10px 0; min-height: 50px;
}
.slot-word {
  min-width: 44px; height: 46px; padding: 0 12px; border-radius: 12px;
  background: #f4f0ff; border: 3px dashed #c9bdf0;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 800; color: var(--ink);
}
.slot-word.filled { background: #fff; border-style: solid; border-color: var(--purple); }
.slot-word.guide { color: #cdc2ee; }
.tile-word {
  padding: 10px 16px; height: 46px; border-radius: 12px; border: none;
  background: #fff; box-shadow: var(--shadow-sm);
  font-size: 20px; font-weight: 800; color: var(--ink);
  font-family: inherit; cursor: pointer; transition: transform .1s;
}
.tile-word:active { transform: scale(.94); }
.tile-word.used { visibility: hidden; }

/* ---------- Confetti / celebration ---------- */
.confetti-piece {
  position: fixed; top: -16px; width: 10px; height: 14px;
  z-index: 9999; border-radius: 2px; pointer-events: none;
  animation-name: confFall; animation-timing-function: linear; animation-fill-mode: forwards;
}
@keyframes confFall { to { transform: translateY(112vh) rotate(720deg); opacity: .7; } }
.celebrate { font-size: 64px; text-align: center; animation: pop .5s ease; }
@keyframes pop { 0% { transform: scale(0); } 70% { transform: scale(1.2); } 100% { transform: scale(1); } }

/* ---------- Utility ---------- */
.stack > * + * { margin-top: 14px; }
.gap-sm { gap: 8px; }
.hidden { display: none !important; }
.note {
  font-size: 14px; color: var(--ink-soft); background: #fff8e1;
  border-radius: 14px; padding: 10px 14px; margin-top: 12px;
}
footer.credit { text-align: center; color: var(--ink-soft); font-size: 13px; margin-top: 22px; }

@media (max-width: 380px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .btn { font-size: 19px; }
}
