:root {
  --ink: #183455;
  --muted: #61738d;
  --blue: #506fe5;
  --mint: #57e5ba;
  --yellow: #ffdc73;
  --pink: #ffa8c8;
  font-size: clamp(15px, 1.5vw, 18px);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  background: linear-gradient(145deg, #fffdf6 0%, #edfaff 52%, #f3efff 100%);
  font-family: "Trebuchet MS", "Avenir Next", "Segoe UI", sans-serif;
}
button, select { font: inherit; }
button { border: 0; cursor: pointer; }
button:focus-visible, select:focus-visible { outline: 4px solid var(--yellow); outline-offset: 3px; }
button:disabled { cursor: wait; opacity: .62; }
.hidden { display: none !important; }

.sky-shapes { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.sky-shapes span { position: absolute; border-radius: 50%; background: rgba(255,255,255,.72); animation: float 12s ease-in-out infinite; }
.sky-shapes span:nth-child(1) { width: 34vw; height: 34vw; left: -12vw; top: -10vw; }
.sky-shapes span:nth-child(2) { width: 22vw; height: 22vw; right: -7vw; top: 12%; animation-delay: -4s; }
.sky-shapes span:nth-child(3) { width: 30vw; height: 30vw; left: 38%; bottom: -20vw; animation-delay: -8s; }

.app-shell { min-height: 100vh; display: grid; place-items: center; padding: 4.4rem 1rem 1rem; }
main { width: min(590px, 100%); }
.screen { display: none; }
.screen.active { display: block; animation: appear .35s ease; }

.corner-btn {
  position: fixed;
  top: 12px;
  z-index: 20;
  min-width: 46px;
  min-height: 46px;
  padding: .55rem .85rem;
  border: 1px solid rgba(80, 111, 163, .14);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255,255,255,.82);
  box-shadow: 0 7px 18px rgba(54,82,125,.1);
  backdrop-filter: blur(9px);
  font-weight: 800;
}
#parent-btn { left: 12px; }
#audio-btn { right: 12px; font-family: system-ui, sans-serif; font-size: 1.2rem; }

.home-card {
  width: 100%;
  padding: clamp(1.5rem, 5vw, 2.5rem);
  text-align: center;
  border: 1px solid rgba(255,255,255,.95);
  border-radius: 2.3rem;
  background: rgba(255,255,255,.78);
  box-shadow: 0 25px 65px rgba(65,95,139,.14), inset 0 0 0 1px rgba(95,128,173,.09);
  backdrop-filter: blur(15px);
}
.home-dino {
  width: 108px;
  height: 108px;
  display: grid;
  place-items: center;
  margin: 0 auto 1rem;
  border-radius: 34px;
  background: linear-gradient(145deg, #d9ffa9, #72efc5);
  box-shadow: 0 14px 30px rgba(60,192,146,.22);
  font-family: system-ui, sans-serif;
  font-size: 4.2rem;
  animation: dino 2.5s ease-in-out infinite;
}
.eyebrow { margin: 0 0 .45rem; color: #6680b0; font-size: .78rem; letter-spacing: .14em; font-weight: 900; }
h1 { margin: 0; color: #344fa8; font-size: clamp(2.3rem, 8vw, 4rem); line-height: 1.02; letter-spacing: -.04em; }
.home-copy { margin: .8rem 0 1.2rem; color: var(--muted); font-size: 1.08rem; }
.voice-status { min-height: 1.2rem; margin: .7rem 0 0; color: #71809a; font-size: .78rem; }

.primary-btn {
  width: 100%;
  min-height: 62px;
  padding: .8rem 1rem;
  border-radius: 1.25rem;
  color: #123c57;
  background: linear-gradient(120deg, #61e8bd, #68dafa);
  box-shadow: 0 12px 25px rgba(49,188,191,.22);
  font-size: 1.12rem;
  font-weight: 900;
  transition: transform .15s ease, box-shadow .15s ease;
}
.primary-btn:not(:disabled):hover { transform: translateY(-2px); box-shadow: 0 15px 29px rgba(49,188,191,.28); }
.text-btn { width: 100%; padding: .85rem; color: #53699d; background: transparent; font-weight: 800; }

.progress-row { display: grid; justify-items: center; gap: .4rem; margin-bottom: .85rem; color: var(--muted); font-size: .8rem; font-weight: 900; }
.progress-dots { display: flex; gap: .4rem; }
.progress-dots span { width: 9px; height: 9px; border-radius: 99px; background: #cfdaea; transition: width .2s ease, background .2s ease; }
.progress-dots .done { background: #70d9b6; }
.progress-dots .current { width: 26px; background: var(--blue); }

.flashcard {
  position: relative;
  width: 100%;
  min-height: min(58vh, 470px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .8rem;
  overflow: hidden;
  padding: 2rem 1.25rem;
  border: 7px solid #fff;
  border-radius: 2.4rem;
  color: var(--ink);
  background: linear-gradient(150deg, #f8ffcf 0%, #dbfff2 58%, #e4f4ff 100%);
  box-shadow: 0 24px 55px rgba(67,103,145,.19), inset 0 0 0 2px rgba(72,131,139,.08);
  transition: transform .18s ease, background .28s ease;
}
.flashcard:hover { transform: translateY(-2px) rotate(-.25deg); }
.flashcard.sentence-side { background: linear-gradient(150deg, #fff3c8 0%, #ffe2ee 58%, #e9e0ff 100%); }
.flashcard.speaking { animation: voicePulse .75s ease-in-out infinite alternate; }
.flash-emoji { font-family: system-ui, sans-serif; font-size: clamp(6rem, 23vw, 10rem); line-height: 1; filter: drop-shadow(0 10px 10px rgba(51,73,96,.12)); }
.flash-word { color: #314fa8; font-size: clamp(2.5rem, 10vw, 5rem); line-height: 1; font-weight: 900; letter-spacing: -.04em; }
.flash-sentence { max-width: 470px; color: #344fa8; font-size: clamp(1.6rem, 6vw, 2.7rem); line-height: 1.17; font-weight: 900; }
.tap-hint { margin-top: .35rem; padding: .55rem .9rem; border-radius: 999px; color: #526b87; background: rgba(255,255,255,.7); font-size: .88rem; font-weight: 800; }
.card-spark { position: absolute; color: rgba(78,104,182,.23); font-family: system-ui, sans-serif; }
.spark-one { top: 8%; left: 9%; font-size: 2.3rem; transform: rotate(-10deg); }
.spark-two { right: 9%; bottom: 12%; font-size: 1.5rem; }
.feedback { min-height: 1.3rem; margin: .65rem 0 .15rem; text-align: center; color: var(--muted); font-weight: 800; }
.game-next { min-height: 58px; }

.finish-card { padding-block: 3rem; }
.finish-icon { font-family: system-ui, sans-serif; font-size: 7rem; animation: dino 2s ease-in-out infinite; }

.parent-panel {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 1rem;
  overflow-y: auto;
  background: rgba(65,82,110,.34);
  backdrop-filter: blur(7px);
}
.parent-card {
  width: min(470px, 100%);
  padding: 1.5rem;
  border: 1px solid rgba(255,255,255,.95);
  border-radius: 1.6rem;
  background: #fbfdff;
  box-shadow: 0 24px 60px rgba(43,65,99,.23);
}
.parent-card h2 { margin: 0; }
.muted, .control-note { color: var(--muted); }
.parent-card label { display: block; margin: .85rem 0 .35rem; font-weight: 800; }
.voice-row { display: grid; grid-template-columns: 1fr auto; gap: .55rem; }
select { min-width: 0; min-height: 48px; padding: .55rem .7rem; border: 1px solid #dce5ef; border-radius: .85rem; color: var(--ink); background: #fff; }
.preview-btn { padding: .55rem 1rem; border-radius: .85rem; color: #3450a5; background: #eaf1ff; font-weight: 900; }
.control-note { margin: .4rem 0; font-size: .8rem; }
.toggle-row { padding: .8rem; border-radius: .85rem; background: #eef5ff; }
.toggle-row input { width: 22px; height: 22px; vertical-align: middle; }
.ghost-btn { width: 100%; margin-top: .75rem; padding: .75rem; border-radius: .9rem; color: #64748b; background: transparent; border: 1px solid #dce5ef; }
.close-btn { min-height: 50px; margin-top: .65rem; }

.confetti { position: fixed; z-index: 50; top: -30px; color: #ff84b5; font-family: system-ui, sans-serif; font-size: 1.25rem; pointer-events: none; animation: fall 1.6s ease-in forwards; }

@media (max-width: 560px) {
  .app-shell { padding: 4.2rem .7rem .7rem; }
  .corner-btn { font-size: .82rem; }
  .flashcard { min-height: min(58vh, 430px); border-width: 5px; border-radius: 1.9rem; }
  .home-card { border-radius: 1.8rem; }
}

@keyframes appear { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes float { 50% { transform: translateY(-18px) scale(1.04); } }
@keyframes dino { 50% { transform: translateY(-7px) rotate(2deg); } }
@keyframes voicePulse { to { box-shadow: 0 24px 55px rgba(67,103,145,.19), 0 0 0 8px rgba(87,229,186,.25); } }
@keyframes fall { to { transform: translateY(var(--fall)) rotate(420deg); opacity: .1; } }

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