/* WonderQuest Academy — KinPella port.
   Design language: KinPella tokens (Lexend via styles.css, brand purple
   #6c57d8, navy #17244b, gold #ffc94d) + motion.css tokens. The package's
   own navy/gold world art is carried over as the stage backdrop.
   Games law: when a skill is open, the play view fills the whole stage
   below the top bar — the game's coloured world edge to edge, no white
   page around a boxed panel. Back / Home / Menu stay in the top bar. */

body { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
[hidden] { display: none !important; }

/* ── Top bar ─────────────────────────────────────────────────────────── */
.ac-topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 10px;
  background: #101935; color: #fff;
  padding: 10px 14px;
  box-shadow: 0 4px 18px rgba(16,25,53,.25);
}
.ac-back {
  border: 0; background: #263554; color: #fff;
  width: 40px; height: 40px; border-radius: 12px;
  font-size: 24px; line-height: 1; display: grid; place-items: center;
}
.ac-brand { color: #fff; text-decoration: none; font-weight: 800; font-size: 17px; letter-spacing: -.02em; white-space: nowrap; }
.ac-brand span { color: #ffca71; font-size: 11px; letter-spacing: .14em; vertical-align: 2px; }
.ac-score {
  margin-left: auto; background: #263554; border: 1px solid #3e5268;
  color: #ffe9b0; border-radius: 999px; padding: 7px 12px;
  font-size: 12.5px; font-weight: 800; white-space: nowrap;
}
.ac-home, .ac-menubtn {
  border: 1px solid #3e5268; background: #1b2a52; color: #fff;
  border-radius: 999px; padding: 9px 14px; font-size: 13px; font-weight: 800;
  text-decoration: none; white-space: nowrap;
}

/* ── Menu sheet ──────────────────────────────────────────────────────── */
.ac-scrim { position: fixed; inset: 0; background: rgba(16,25,53,.5); z-index: 60; }
.ac-menu {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 61;
  width: min(320px, 88vw); background: #fff; color: #202d42;
  box-shadow: -18px 0 40px rgba(16,25,53,.3);
  padding: 18px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 4px;
}
.ac-menu-head { display: flex; justify-content: space-between; align-items: center; font-weight: 900; font-size: 17px; margin-bottom: 10px; }
.ac-menu-head button { border: 0; background: #f1f4f8; border-radius: 10px; width: 36px; height: 36px; font-size: 15px; }
.ac-menu a {
  padding: 12px 12px; border-radius: 12px; text-decoration: none;
  font-weight: 750; font-size: 15px; color: #24314c;
  transition: background-color var(--kp-dur-1) var(--kp-ease);
}
.ac-menu a:hover { background: #f2efff; }
.ac-menu a[aria-current="page"] { background: #ebe7ff; color: #5540b7; }

/* ── Layout ──────────────────────────────────────────────────────────── */
.ac-main { flex: 1 0 auto; display: flex; flex-direction: column; width: 100%; }
body.ac-playing .kp-foot { display: none; }

/* ── World hero ──────────────────────────────────────────────────────── */
.ac-world {
  background: #17244b url('/img/academy-world.webp') center 38% / cover no-repeat;
  color: #fff; position: relative;
}
.ac-world::before { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(16,25,53,.82) 0%, rgba(16,25,53,.45) 55%, rgba(16,25,53,.08) 100%); }
.ac-worldcopy { position: relative; max-width: 1180px; margin: 0 auto; padding: 44px 24px 40px; width: 100%; }
.ac-eyebrow { font-size: 11.5px; font-weight: 900; letter-spacing: .16em; color: #ffca71; margin: 0 0 8px; }
.ac-worldcopy h1 { font-size: clamp(34px, 5vw, 54px); margin: 0 0 6px; color: #fff; }
.ac-worldcopy p { margin: 0; color: #d9dff2; font-size: 15px; font-weight: 650; }
@media (max-width: 720px) {
  .ac-world { background-image: url('/img/academy-world-small.webp'); }
  .ac-worldcopy { padding: 30px 18px 26px; }
}

/* ── Library ─────────────────────────────────────────────────────────── */
.ac-library { max-width: 1180px; margin: 0 auto; padding: 26px 24px 60px; width: 100%; }
.ac-controls { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.ac-controls > div { display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 200px; }
.ac-controls label { font-size: 12px; font-weight: 800; color: #64738b; }
.ac-controls select, .ac-controls input {
  background: #fff; border: 1px solid #dce3ed; border-radius: 11px;
  padding: 12px 13px; color: #253454; font-size: 14.5px; font-weight: 700; width: 100%;
}
.ac-subjects { display: flex; gap: 10px; margin-bottom: 20px; }
.ac-subjects button {
  border: 1.5px solid #d9dfea; background: #fff; color: #43536d;
  border-radius: 999px; padding: 11px 20px; font-weight: 800; font-size: 14.5px;
  transition: background-color var(--kp-dur-2) var(--kp-ease), color var(--kp-dur-1) var(--kp-ease), border-color var(--kp-dur-2) var(--kp-ease);
}
.ac-subjects button[aria-pressed="true"] { background: #6c57d8; border-color: #6c57d8; color: #fff; box-shadow: 0 10px 20px -8px rgba(85,64,183,.5), inset 0 1px 0 rgba(255,255,255,.35); }
.ac-libraryhead { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.ac-libraryhead h2 { font-size: 26px; margin: 0; color: #172342; }
.ac-libraryhead span { font-size: 13px; font-weight: 800; color: #14604a; background: #e9fcf4; border: 1px solid #9fe3c6; border-radius: 999px; padding: 6px 12px; white-space: nowrap; }
.ac-skills { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.ac-skills button {
  text-align: left; background: #fff; border: 1px solid #e5eaf1; border-radius: 14px;
  padding: 14px 15px; font-size: 14px; font-weight: 750; color: #293953;
  box-shadow: 0 4px 14px rgba(23,41,77,.05);
  transition: transform .55s cubic-bezier(.34,1.4,.64,1), border-color var(--kp-dur-2) var(--kp-ease), background-color var(--kp-dur-2) var(--kp-ease);
}
.ac-skills button:active { transform: scale(.98); transition: transform .08s ease-in; }
.ac-skills button:hover { border-color: #ac9ced; transform: translateY(-1px); }
.ac-skills button.complete { background: #eefcf5; border-color: #9fe3c6; color: #14604a; }
.ac-skills button[aria-current="true"] { border-color: #6c57d8; box-shadow: 0 0 0 2px #6c57d8 inset; }
#empty { color: #5c6d86; font-size: 14.5px; padding: 18px 0; }

/* ── Play stage (full-stage game view) ───────────────────────────────── */
.ac-play {
  flex: 1 0 auto; display: flex; flex-direction: column;
  background: #17244b url('/img/academy-world.webp') center / cover no-repeat;
  position: relative;
}
.ac-play::before { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(16,25,53,.66), rgba(16,25,53,.82)); }
.ac-stage {
  position: relative; width: 100%; max-width: 860px; margin: 0 auto;
  padding: 26px 22px 40px; flex: 1; display: flex; flex-direction: column;
}
.ac-gamehead { display: flex; align-items: center; gap: 12px; color: #fff; margin-bottom: 14px; }
.ac-tolib {
  border: 1px solid rgba(255,255,255,.35); background: rgba(255,255,255,.12); color: #fff;
  border-radius: 999px; padding: 9px 15px; font-weight: 800; font-size: 13.5px; white-space: nowrap;
}
#skillname { font-weight: 900; font-size: 16px; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#progress { margin-left: auto; font-size: 12.5px; font-weight: 800; color: #ffca71; white-space: nowrap; }
.ac-track { height: 10px; border-radius: 999px; background: rgba(255,255,255,.18); overflow: hidden; margin-bottom: 26px; }
#fill { height: 100%; width: 0; background: linear-gradient(90deg, #ffc94d, #ff9d5c); border-radius: 999px; transition: width var(--kp-dur-5) var(--kp-ease); }
#question { color: #fff; font-size: clamp(25px, 4.2vw, 38px); line-height: 1.22; margin: 0 0 20px; outline: none; }
.ac-audio { display: flex; gap: 10px; margin-bottom: 24px; }
.ac-audio button {
  border: 0; border-radius: 999px; padding: 13px 20px;
  font-size: 14.5px; font-weight: 900;
  background: #ffc94d; color: #402d05; box-shadow: 0 10px 20px -8px rgba(217,169,47,.55), inset 0 1px 0 rgba(255,255,255,.5);
}
.ac-audio button#slow { background: #fff; color: #3c3486; box-shadow: 0 10px 20px -10px rgba(85,64,183,.35), inset 0 1px 0 rgba(255,255,255,.35); }
.ac-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 11px; }
.ac-options button {
  text-align: left; background: rgba(255,255,255,.97); border: 2px solid transparent;
  color: #293953; border-radius: 16px; padding: 16px; min-height: 64px;
  font-size: 16.5px; font-weight: 800;
  transition: transform .55s cubic-bezier(.34,1.4,.64,1), background-color var(--kp-dur-2) var(--kp-ease), border-color var(--kp-dur-2) var(--kp-ease);
}
.ac-options button:active:not(:disabled) { transform: scale(.97); transition: transform .08s ease-in; }
.ac-options button:hover:not(:disabled) { transform: translateY(-1px); border-color: #ac9ced; }
.ac-options button.good { background: #d9faee; border-color: #47b995; color: #135c4c; }
.ac-options button.bad { background: #ffedf0; border-color: #eb8499; color: #9b4557; opacity: .75; }
#feedback { color: #ffe9b0; font-size: 16px; font-weight: 800; min-height: 26px; margin: 18px 0 0; }
.ac-next {
  align-self: flex-start; margin-top: 14px;
  border: 0; border-radius: 16px; padding: 14px 22px;
  background: #6c57d8; color: #fff; font-size: 15px; font-weight: 900;
  box-shadow: 0 10px 20px -8px rgba(85,64,183,.5), inset 0 1px 0 rgba(255,255,255,.35);
}
/* ── KidsPro pass (2026-12-01): Apple spring presses for the play
   chrome the motion layer never listed — quick sink (~80ms ease-in),
   spring back on the house curve; the blanket reduced-motion
   stand-down in motion.css stills all of it. ─────────────────────── */
.ac-audio button, .ac-next, .ac-tolib, .ac-back, .ac-home, .ac-menubtn, .ac-menu-head button {
  transition: transform .55s cubic-bezier(.34,1.4,.64,1), box-shadow .2s ease, background-color .2s ease, border-color .2s ease;
}
.ac-audio button:active, .ac-next:active, .ac-tolib:active, .ac-back:active, .ac-home:active, .ac-menubtn:active, .ac-menu-head button:active {
  transform: scale(.95); transition: transform .08s ease-in;
}
.ac-subjects button:active { transform: scale(.96); transition: transform .08s ease-in; }
.ac-subjects button { transition: transform .55s cubic-bezier(.34,1.4,.64,1), background-color var(--kp-dur-2) var(--kp-ease), color var(--kp-dur-1) var(--kp-ease), border-color var(--kp-dur-2) var(--kp-ease), box-shadow .2s ease; }

@media (max-width: 720px) {
  .ac-play { background-image: url('/img/academy-world-small.webp'); }
  .ac-options { grid-template-columns: 1fr; }
  .ac-brand span { display: none; }
  .ac-score { display: none; }
  .ac-stage { padding: 20px 16px 32px; }
}
