:root {
  --bg: #f7f4ee;
  --card: #ffffff;
  --ink: #202124;
  --muted: #667085;
  --primary: #7257ff;
  --primary-dark: #563bd7;
  --secondary: #ffb13b;
  --success: #147a44;
  --danger: #bd2b2b;
  --soft: #ece8ff;
  --line: #e7e2d8;
  --shadow: 0 16px 35px rgba(54, 44, 96, 0.13);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  color: var(--ink);
  min-height: 100vh;
  background:
    var(--wallpaper-mascots),
    var(--wallpaper-pattern),
    var(--wallpaper-base);
  background-attachment: fixed;
  transition: background .35s ease;
}

.code-fireworks-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 46%, rgba(255,255,255,.16), transparent 18rem),
    radial-gradient(circle at 18% 20%, rgba(255, 77, 109, .14), transparent 16rem),
    radial-gradient(circle at 84% 24%, rgba(255, 190, 11, .15), transparent 16rem),
    radial-gradient(circle at 72% 82%, rgba(6, 214, 160, .13), transparent 18rem),
    rgba(20, 18, 62, .08);
  animation: fireworks-screen-glow 8.2s ease-out both;
}
.firework-burst {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--size);
  height: var(--size);
  border-radius: 999px;
  transform: translate(-50%, -50%) scale(.18);
  opacity: 0;
  background:
    radial-gradient(circle, hsl(var(--hue) 100% 70%) 0 5px, transparent 6px),
    radial-gradient(circle at 50% 0%, hsl(calc(var(--hue) + 42deg) 100% 64%) 0 6px, transparent 7px),
    radial-gradient(circle at 50% 100%, hsl(calc(var(--hue) + 86deg) 100% 62%) 0 6px, transparent 7px),
    radial-gradient(circle at 0% 50%, hsl(calc(var(--hue) + 126deg) 100% 66%) 0 6px, transparent 7px),
    radial-gradient(circle at 100% 50%, hsl(calc(var(--hue) + 166deg) 100% 64%) 0 6px, transparent 7px),
    radial-gradient(circle at 18% 18%, #fff7ad 0 5px, transparent 6px),
    radial-gradient(circle at 82% 18%, #ffffff 0 4px, transparent 5px),
    radial-gradient(circle at 18% 82%, #ffffff 0 4px, transparent 5px),
    radial-gradient(circle at 82% 82%, #fff7ad 0 5px, transparent 6px);
  filter: drop-shadow(0 0 28px hsl(var(--hue) 100% 62%));
  animation: full-screen-firework 2.1s cubic-bezier(.12,.72,.16,1) var(--delay) both;
}
.firework-burst::before, .firework-burst::after {
  content: "";
  position: absolute;
  inset: 12%;
  border-radius: inherit;
  background: inherit;
}
.firework-burst::before {
  transform: rotate(28deg) scale(.82);
}
.firework-burst::after {
  transform: rotate(56deg) scale(.58);
  filter: blur(.3px) brightness(1.25);
}
@keyframes fireworks-screen-glow {
  0% { opacity: 0; }
  10% { opacity: 1; }
  78% { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes full-screen-firework {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.12) rotate(-12deg); }
  12% { opacity: 1; }
  58% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(2.15) rotate(28deg); }
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background: var(--wallpaper-sparkles);
  opacity: .78;
}

body.wallpaper-space {
  --wallpaper-base: linear-gradient(135deg, #231557 0%, #4b2fbf 42%, #14b8d8 100%);
  --wallpaper-pattern:
    radial-gradient(circle at 14% 18%, rgba(255,255,255,.95) 0 3px, transparent 4px),
    radial-gradient(circle at 82% 20%, rgba(255,233,130,.9) 0 5px, transparent 6px),
    radial-gradient(circle at 74% 78%, rgba(255,255,255,.8) 0 4px, transparent 5px),
    radial-gradient(circle at 28% 70%, rgba(255,128,170,.72), transparent 15rem);
  --wallpaper-mascots:
    radial-gradient(circle at 9% 82%, rgba(255,255,255,.9) 0 28px, transparent 29px),
    radial-gradient(circle at 91% 66%, rgba(255,177,59,.85) 0 34px, transparent 35px);
  --wallpaper-sparkles:
    radial-gradient(circle at 18% 32%, rgba(255,255,255,.45) 0 10px, transparent 11px),
    radial-gradient(circle at 88% 36%, rgba(255,255,255,.32) 0 16px, transparent 17px);
}

body.wallpaper-candy {
  --wallpaper-base: linear-gradient(135deg, #ff7ab6 0%, #ffd166 45%, #7bdff2 100%);
  --wallpaper-pattern:
    repeating-radial-gradient(circle at 20% 20%, rgba(255,255,255,.45) 0 0.45rem, transparent 0.5rem 1.25rem),
    radial-gradient(circle at 82% 16%, rgba(255,255,255,.76), transparent 10rem),
    radial-gradient(circle at 70% 82%, rgba(134,239,172,.5), transparent 16rem);
  --wallpaper-mascots:
    radial-gradient(circle at 8% 74%, rgba(255,255,255,.82) 0 32px, transparent 33px),
    radial-gradient(circle at 93% 78%, rgba(255,255,255,.75) 0 38px, transparent 39px);
  --wallpaper-sparkles:
    radial-gradient(circle at 36% 24%, rgba(255,255,255,.55) 0 14px, transparent 15px),
    radial-gradient(circle at 76% 40%, rgba(255,255,255,.42) 0 9px, transparent 10px);
}

body.wallpaper-ocean {
  --wallpaper-base: linear-gradient(135deg, #06b6d4 0%, #3b82f6 48%, #a7f3d0 100%);
  --wallpaper-pattern:
    radial-gradient(ellipse at 15% 88%, rgba(255,255,255,.34), transparent 15rem),
    radial-gradient(circle at 86% 24%, rgba(255,255,255,.82) 0 22px, transparent 23px),
    repeating-linear-gradient(135deg, rgba(255,255,255,.18) 0 14px, transparent 14px 34px);
  --wallpaper-mascots:
    radial-gradient(circle at 10% 68%, rgba(255,244,178,.88) 0 30px, transparent 31px),
    radial-gradient(circle at 88% 80%, rgba(221,252,231,.82) 0 42px, transparent 43px);
  --wallpaper-sparkles:
    radial-gradient(circle at 34% 34%, rgba(255,255,255,.38) 0 16px, transparent 17px),
    radial-gradient(circle at 68% 58%, rgba(255,255,255,.34) 0 12px, transparent 13px);
}

body.wallpaper-stage {
  --wallpaper-base: linear-gradient(135deg, #7c3aed 0%, #ec4899 48%, #f97316 100%);
  --wallpaper-pattern:
    radial-gradient(circle at 50% 0%, rgba(255,255,255,.42), transparent 18rem),
    repeating-linear-gradient(90deg, rgba(255,255,255,.12) 0 32px, transparent 32px 64px),
    radial-gradient(circle at 18% 75%, rgba(253,224,71,.45), transparent 14rem);
  --wallpaper-mascots:
    radial-gradient(circle at 9% 78%, rgba(255,255,255,.86) 0 34px, transparent 35px),
    radial-gradient(circle at 90% 72%, rgba(255,255,255,.72) 0 36px, transparent 37px);
  --wallpaper-sparkles:
    radial-gradient(circle at 24% 24%, rgba(255,255,255,.55) 0 10px, transparent 11px),
    radial-gradient(circle at 74% 28%, rgba(255,255,255,.5) 0 13px, transparent 14px);
}

body.wallpaper-classroom {
  --wallpaper-base: linear-gradient(135deg, #fef3c7 0%, #86efac 45%, #93c5fd 100%);
  --wallpaper-pattern:
    linear-gradient(90deg, rgba(255,255,255,.35) 1px, transparent 1px),
    linear-gradient(rgba(255,255,255,.35) 1px, transparent 1px),
    radial-gradient(circle at 82% 20%, rgba(251,113,133,.45), transparent 13rem),
    radial-gradient(circle at 18% 80%, rgba(59,130,246,.28), transparent 15rem);
  --wallpaper-mascots:
    radial-gradient(circle at 8% 70%, rgba(255,255,255,.82) 0 34px, transparent 35px),
    radial-gradient(circle at 90% 74%, rgba(255,255,255,.78) 0 40px, transparent 41px);
  --wallpaper-sparkles:
    linear-gradient(90deg, rgba(255,255,255,.18) 1px, transparent 1px),
    linear-gradient(rgba(255,255,255,.18) 1px, transparent 1px);
  background-size: auto, 42px 42px, 42px 42px, auto;
}

button, input, select { font: inherit; }

.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;
}

.hero {
  padding: 42px 24px 28px;
  background: linear-gradient(135deg, #7257ff, #9d8cff 48%, #ffb13b);
  color: white;
}

.hero__content { max-width: 1150px; margin: 0 auto; }
.access-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, auto);
  gap: 14px;
  align-items: stretch;
  margin-bottom: 26px;
}
.access-role-nav {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}
.access-role-button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 68px;
  padding: 10px 12px;
  border: 2px solid rgba(255, 255, 255, .56);
  border-radius: 14px;
  background: rgba(255, 255, 255, .16);
  color: #fff;
  text-align: left;
  cursor: pointer;
  backdrop-filter: blur(8px);
}
.access-role-button > span:first-child { flex: 0 0 auto; font-size: 1.45rem; }
.access-role-button strong, .access-role-button small { display: block; }
.access-role-button strong { font-size: .98rem; }
.access-role-button small { margin-top: 2px; color: rgba(255, 255, 255, .86); font-size: .78rem; font-weight: 750; }
.access-role-button:hover, .access-role-button:focus-visible {
  border-color: #fff;
  outline: none;
  background: rgba(255, 255, 255, .24);
}
.access-role-button.active {
  border-color: #ffe18b;
  background: #fff4cf;
  color: #3b2f86;
  box-shadow: 0 8px 18px rgba(35, 21, 87, .2);
}
.access-role-button.active small { color: #655b98; }
.access-status {
  display: grid;
  align-content: center;
  gap: 5px;
  min-width: 220px;
  padding: 11px 14px;
  border: 2px solid rgba(255, 255, 255, .62);
  border-radius: 14px;
  background: rgba(35, 21, 87, .3);
  color: #fff;
  text-align: right;
  backdrop-filter: blur(8px);
}
.access-status-kicker { font-size: .72rem; font-weight: 900; text-transform: uppercase; }
.access-status > strong { overflow-wrap: anywhere; }
.access-status-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}
.access-status-action {
  min-height: 34px;
  padding: 5px 9px;
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: 10px;
  background: rgba(255, 255, 255, .16);
  color: #fff;
  font-size: .78rem;
  font-weight: 850;
  cursor: pointer;
}
.access-status-action:hover, .access-status-action:focus-visible { background: rgba(255, 255, 255, .28); outline: none; }

.student-login-dialog {
  width: min(650px, calc(100% - 24px));
  max-height: calc(100vh - 28px);
  padding: 0;
  border: 0;
  border-radius: 22px;
  background: transparent;
  box-shadow: 0 24px 70px rgba(31, 20, 75, .34);
  overflow: auto;
}
.student-login-dialog::backdrop { background: rgba(31, 20, 75, .58); backdrop-filter: blur(4px); }
.student-login-dialog.fallback-open { position: fixed; inset: 14px; z-index: 10000; display: block; margin: auto; }
.student-login-shell { padding: 24px; background: #fff; color: var(--ink); }
.student-login-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
}
.student-login-head h2 { margin: 4px 0 0; color: #3b2f86; }
.student-login-kicker { color: #7257ff; font-size: .8rem; font-weight: 950; text-transform: uppercase; }
.student-login-close {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 2px solid #d8d0ff;
  border-radius: 12px;
  background: #f4f1ff;
  color: #3b2f86;
  font-size: 1.45rem;
  cursor: pointer;
}
.student-login-progress {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin: 20px 0;
}
.student-login-progress span {
  padding: 8px;
  border: 2px solid #e4dfff;
  border-radius: 10px;
  background: #faf9ff;
  color: #655b98;
  text-align: center;
  font-size: .82rem;
  font-weight: 900;
}
.student-login-progress span.active { border-color: #7257ff; background: #ece8ff; color: #3b2f86; }
.student-login-form { display: grid; gap: 9px; }
.student-login-form label, .student-login-prompt { color: #3b2f86; font-weight: 900; }
.student-login-form label > span { display: block; color: #655b98; font-size: .9em; }
.student-login-form input {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border: 2px solid rgba(32, 33, 36, .14);
  border-radius: 14px;
  background: #fff;
  outline: none;
}
.student-login-form input:focus { border-color: #7257ff; box-shadow: 0 0 0 3px rgba(114, 87, 255, .12); }
.student-login-class, .student-selected-profile {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 2px solid #bdefff;
  border-radius: 14px;
  background: #f2fcff;
}
.student-login-class span, .student-selected-profile span { color: var(--muted); font-size: .86rem; font-weight: 800; }
.student-login-prompt { margin: 16px 0 9px; }
.student-choice-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 280px;
  margin-bottom: 12px;
  overflow-y: auto;
}
.student-choice-button {
  min-height: 58px;
  padding: 9px 11px;
  border: 2px solid #e1dcf7;
  border-radius: 12px;
  background: #fff;
  color: #3b2f86;
  text-align: left;
  font-weight: 900;
  cursor: pointer;
}
.student-choice-button:hover, .student-choice-button:focus-visible { border-color: #7257ff; background: #f5f2ff; outline: none; }
.student-login-pin-row {
  display: grid;
  grid-template-columns: 92px 44px;
  align-items: center;
  gap: 8px;
  width: 144px;
}
.student-login-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 5px; }
.student-login-message { min-height: 24px; margin-bottom: 0; }
.eyebrow { margin: 0 0 10px; text-transform: uppercase; letter-spacing: .12em; font-weight: 800; opacity: .9; }
h1 { margin: 0; font-size: clamp(2rem, 5vw, 4rem); line-height: 1; }
.site-home-button {
  display: block;
  max-width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: inherit;
  cursor: pointer;
}
.site-home-button:focus-visible, .btn--home:focus-visible {
  outline: 3px solid currentColor;
  outline-offset: 4px;
}
.subtitle { font-size: 1.15rem; max-width: 760px; line-height: 1.5; }

.answer-row input, select, .family-input {
  border: 2px solid rgba(32, 33, 36, .12);
  border-radius: 18px;
  padding: 14px 16px;
  min-height: 52px;
  outline: none;
  background: white;
}
.answer-row input:focus, select:focus, .family-input:focus { border-color: var(--primary); }

.layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 24px;
  max-width: 1150px;
  margin: -16px auto 32px;
  padding: 0 24px;
}

.side-card, .game-card, .panel {
  background: rgba(255, 255, 255, .93);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.side-card {
  position: sticky;
  top: 16px;
  align-self: start;
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.98), rgba(255,255,255,.94)),
    linear-gradient(135deg, rgba(255,209,102,.34), rgba(123,223,242,.28));
}
.side-card h2 {
  margin: 0 0 14px;
  font-size: 1.45rem;
  color: #3b2f86;
}

.mode-card {
  display: grid;
  gap: 8px;
  margin: 0 0 16px;
  padding: 14px;
  border-radius: 20px;
  background: #fff6e8;
  border: 1px solid #ffe0a8;
}
.mode-card label { font-weight: 900; }
.wallpaper-card { background: #eef9ff; border-color: #bdefff; }
.mode-card select {
  width: 100%;
  font-weight: 800;
  border-radius: 16px;
  border-color: rgba(114, 87, 255, .24);
  box-shadow: 0 5px 12px rgba(54, 44, 96, .07);
}
.mode-card select.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  box-shadow: none;
}
.mode-buttons {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.mode-button {
  border: 2px solid #ffd36e;
  border-radius: 16px;
  min-height: 48px;
  padding: 10px 8px;
  background: #fff4cc;
  color: #3a2600;
  font-weight: 950;
  font-size: 1.06rem;
  cursor: pointer;
  box-shadow: 0 7px 14px rgba(54, 44, 96, .08);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease, background .16s ease;
}
.mode-button:nth-child(2n) { background: #e9fbff; border-color: #8ee8f6; color: #064e5f; }
.mode-button:nth-child(3n) { background: #ecfdf3; border-color: #94e7b6; color: #14532d; }
.mode-button:nth-child(4n) { background: #fff0f6; border-color: #ffacd0; color: #831843; }
.mode-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(54, 44, 96, .13);
}
.mode-button:focus-visible {
  outline: 3px solid rgba(114, 87, 255, .28);
  outline-offset: 2px;
}
.mode-button.active {
  background: #7257ff;
  border-color: #563bd7;
  color: #fff;
  box-shadow: 0 11px 22px rgba(114, 87, 255, .24);
}
.mode-button--all {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, #7257ff, #ffb13b);
  border-color: rgba(86, 59, 215, .5);
  color: #fff;
  font-size: 1.02rem;
}
.mode-button--all.active {
  border-color: #3b2f86;
  box-shadow: 0 12px 24px rgba(114, 87, 255, .28), inset 0 0 0 2px rgba(255,255,255,.62);
}
.settings-grid--compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tabs {
  display: grid;
  gap: 10px;
  padding: 8px;
  border-radius: 22px;
  background: rgba(255, 255, 255, .64);
  border: 1px solid rgba(114, 87, 255, .12);
}
.tab {
  --tab-accent: #7257ff;
  border: 2px solid #d8d0ff;
  padding: 15px 18px;
  min-height: 58px;
  border-radius: 18px;
  background: #f3f0ff;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
  font-weight: 900;
  font-size: 1.04rem;
  line-height: 1.25;
  box-shadow: 0 8px 16px rgba(54, 44, 96, .08);
  position: relative;
  overflow: hidden;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease, background .16s ease;
}
.tab::before {
  content: "";
  position: absolute;
  inset: 8px auto 8px 8px;
  width: 5px;
  border-radius: 999px;
  background: var(--tab-accent);
  opacity: .55;
}
.tab:hover {
  background: #ebe6ff;
  border-color: #c9befc;
  transform: translateY(-1px);
  box-shadow: 0 12px 20px rgba(54, 44, 96, .12);
}
.tab:focus-visible {
  outline: 3px solid rgba(114, 87, 255, .28);
  outline-offset: 3px;
}
.tab.active {
  background: linear-gradient(135deg, #7257ff, #8d7bff);
  color: #ffffff;
  border-color: #563bd7;
  box-shadow: 0 14px 26px rgba(114, 87, 255, .28);
}
.tab.active::before {
  background: #ffcf4a;
  opacity: 1;
}

.mini-status {
  margin-top: 18px;
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 20px;
  background: #fff6e8;
  font-size: 1.08rem;
}
.mini-status div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.timer-toggle {
  border: 0;
  border-radius: 16px;
  padding: 10px 12px;
  min-height: 44px;
  background: #fff;
  color: var(--primary-dark);
  font-weight: 900;
  cursor: pointer;
  border: 2px solid #d8d0ff;
}
.timer-toggle.is-running {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.content { min-width: 0; }
.panel { display: none; padding: 24px; }
.panel.active { display: block; }
.welcome-panel {
  min-height: 560px;
  padding: 38px;
  overflow: hidden;
  background:
    radial-gradient(circle at 96% 6%, rgba(255, 209, 102, .34), transparent 13rem),
    radial-gradient(circle at 5% 96%, rgba(123, 223, 242, .3), transparent 14rem),
    rgba(255, 255, 255, .97);
}
.welcome-heading {
  max-width: 720px;
  margin: 0 auto 30px;
  text-align: center;
}
.welcome-sparkles {
  display: block;
  margin-bottom: 8px;
  color: #f59e0b;
  font-size: 1.35rem;
  animation: welcome-sparkle 2.4s ease-in-out infinite;
}
.welcome-kicker {
  margin: 0 0 7px;
  color: #7257ff;
  font-weight: 900;
}
.welcome-heading h2 {
  margin: 0;
  color: #3b2f86;
  font-size: 2.75rem;
  line-height: 1.12;
}
.welcome-heading > p:last-child {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.55;
}
.welcome-guide {
  display: grid;
  gap: 14px;
  max-width: 760px;
  margin: 0 auto;
}
.welcome-guide-row {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding: 18px 20px;
  border-left: 7px solid var(--welcome-accent);
  border-radius: 8px;
  background: var(--welcome-bg);
}
.welcome-guide-row--guest { --welcome-accent: #f59e0b; --welcome-bg: #fff7df; }
.welcome-guide-row--student { --welcome-accent: #0ea5b7; --welcome-bg: #e9fbff; }
.welcome-guide-row--teacher { --welcome-accent: #7257ff; --welcome-bg: #f0edff; }
.welcome-guide-icon {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  font-size: 1.75rem;
  box-shadow: 0 7px 16px rgba(54, 44, 96, .12);
}
.welcome-guide-row h3 {
  margin: 0 0 5px;
  color: #30276b;
  font-size: 1.24rem;
}
.welcome-guide-row p {
  margin: 0;
  color: #4b5563;
  line-height: 1.5;
}
@keyframes welcome-sparkle {
  0%, 100% { transform: scale(1); opacity: .78; }
  50% { transform: scale(1.08); opacity: 1; }
}
.panel-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}
.panel-head h2 { margin: 0 0 6px; font-size: 1.65rem; }
.panel-head p { margin: 0; color: var(--muted); line-height: 1.5; }
.panel-head > :first-child { flex: 1 1 260px; min-width: 0; }
.panel-head-actions {
  display: flex;
  flex-wrap: wrap;
  flex-shrink: 0;
  justify-content: flex-end;
  gap: 10px;
  max-width: 100%;
}

.btn {
  border: 0;
  border-radius: 20px;
  padding: 15px 20px;
  min-height: 54px;
  background: var(--primary);
  color: white;
  font-weight: 900;
  font-size: 1.06rem;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(114, 87, 255, .26);
}
.btn:hover { background: var(--primary-dark); }
.btn--secondary { background: var(--secondary); color: #3a2600; box-shadow: 0 8px 18px rgba(255, 177, 59, .25); }
.btn--secondary:hover { background: #f0a025; }
.btn--ghost { background: rgba(255,255,255,.22); color: inherit; box-shadow: none; border: 1px solid rgba(255,255,255,.5); }
.panel .btn--ghost { color: var(--primary-dark); border-color: #d8d0ff; background: #fbfaff; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.settings-grid, .teacher-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.teacher-grid { grid-template-columns: 1fr 1.4fr; }
fieldset {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  background: #fffdfa;
}
legend { font-weight: 800; }
fieldset label, .game-card label { display: block; margin: 8px 0; }
.check-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }

.game-card { padding: 24px; margin-top: 16px; }
.progress-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-weight: 700;
}
.big-task {
  margin: 18px 0;
  padding: 28px;
  border-radius: 24px;
  background: linear-gradient(135deg, #f4f1ff, #fff6e8);
  text-align: center;
  font-size: clamp(2.4rem, 8vw, 5.4rem);
  font-weight: 900;
  letter-spacing: .02em;
}
.answer-row, .actions-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.answer-row input { flex: 1; min-width: 140px; font-size: 1.2rem; }
.actions-row { margin-top: 12px; }
.center { justify-content: center; }
.feedback {
  min-height: 36px;
  font-weight: 900;
  font-size: 1.08rem;
  line-height: 1.45;
  padding: 6px 2px;
}
.feedback.good { color: var(--success); }
.feedback.bad { color: var(--danger); }
.hint { color: var(--muted); line-height: 1.5; }
.training-celebration {
  display: none;
  margin: 18px 0 4px;
  padding: 26px 20px;
  border-radius: 28px;
  text-align: center;
  font-family: "Comic Sans MS", "Trebuchet MS", "Segoe UI", Arial, sans-serif;
  color: #3a2600;
  background: linear-gradient(135deg, #fff0c7, #dff8e9, #ece8ff, #ffd6e7);
  border: 4px solid rgba(255, 177, 59, .6);
  box-shadow: 0 18px 38px rgba(255, 177, 59, .28);
}
.training-celebration.show {
  display: block;
  animation: celebration-pop 1.2s ease-out both, celebration-glow 1.8s ease-in-out infinite alternate;
}
.big-task.is-hidden { display: none; }
.rainbow-title {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: .04em;
  font-size: clamp(3rem, 12vw, 7rem);
  line-height: .95;
  font-weight: 900;
  letter-spacing: 0;
  text-shadow: 0 5px 0 rgba(255,255,255,.85), 0 10px 20px rgba(114,87,255,.22);
}
.rainbow-title span {
  display: inline-block;
  animation: rainbow-bounce .9s ease-out both;
}
.rainbow-title span:nth-child(6n+1) { color: #ff4d6d; }
.rainbow-title span:nth-child(6n+2) { color: #ff9f1c; animation-delay: .04s; }
.rainbow-title span:nth-child(6n+3) { color: #2bb673; animation-delay: .08s; }
.rainbow-title span:nth-child(6n+4) { color: #1d9bf0; animation-delay: .12s; }
.rainbow-title span:nth-child(6n+5) { color: #7257ff; animation-delay: .16s; }
.rainbow-title span:nth-child(6n) { color: #d946ef; animation-delay: .2s; }
.rainbow-subtitle {
  margin-top: 8px;
  font-size: clamp(1.35rem, 4vw, 2.2rem);
  font-weight: 900;
}
.rainbow-score {
  display: inline-block;
  margin-top: 12px;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(255,255,255,.85);
  color: var(--primary-dark);
  font-size: clamp(1.2rem, 3.5vw, 1.8rem);
  font-weight: 900;
}
@keyframes rainbow-bounce {
  0% { transform: translateY(24px) scale(.55) rotate(-10deg); opacity: 0; }
  65% { transform: translateY(-8px) scale(1.1) rotate(4deg); opacity: 1; }
  100% { transform: translateY(0) scale(1) rotate(0); opacity: 1; }
}
@keyframes celebration-pop {
  0% { transform: scale(.6) rotate(-3deg); opacity: 0; }
  55% { transform: scale(1.08) rotate(1deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}
@keyframes celebration-glow {
  from { box-shadow: 0 16px 35px rgba(255, 177, 59, .24); }
  to { box-shadow: 0 20px 44px rgba(114, 87, 255, .3); }
}


.bingo-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(58px, 1fr));
  gap: 10px;
  max-width: 520px;
  margin: 18px auto;
}
.bingo-cell {
  border: 3px solid #ded8ff;
  background: #faf9ff;
  border-radius: 22px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  font-size: clamp(1.55rem, 5vw, 2.7rem);
  font-weight: 900;
  cursor: pointer;
}
.bingo-cell.marked {
  background: #fff0c7;
  border-color: var(--secondary);
  transform: scale(.98);
}
.bingo-cell.win {
  background: #dff8e9;
  border-color: #42b475;
}
.bingo-board.celebrate .bingo-cell.win {
  animation: bingo-win-cell .85s ease-in-out infinite alternate;
}
.bingo-celebration {
  display: none;
  position: relative;
  overflow: hidden;
  margin: 18px auto 8px;
  max-width: 620px;
  padding: 22px 18px;
  border-radius: 28px;
  text-align: center;
  background: linear-gradient(135deg, #fff0c7, #dff8e9, #e8f2ff, #ffd6e7);
  border: 4px solid rgba(255, 177, 59, .75);
  box-shadow: 0 18px 42px rgba(114, 87, 255, .24);
}
.bingo-celebration.show {
  display: block;
  animation: bingo-finish-pop .95s ease-out both, celebration-glow 1.3s ease-in-out infinite alternate;
}
.bingo-celebration.show::before, .bingo-celebration.show::after {
  content: "";
  position: absolute;
  inset: -18%;
  pointer-events: none;
  background:
    radial-gradient(circle at 16% 28%, #ff4d6d 0 7px, transparent 8px),
    radial-gradient(circle at 26% 72%, #ffbe0b 0 8px, transparent 9px),
    radial-gradient(circle at 48% 18%, #06d6a0 0 7px, transparent 8px),
    radial-gradient(circle at 64% 76%, #7257ff 0 8px, transparent 9px),
    radial-gradient(circle at 84% 34%, #1d9bf0 0 7px, transparent 8px);
  animation: bingo-confetti 1.8s ease-out infinite;
}
.bingo-celebration.show::after {
  transform: rotate(22deg) scale(.86);
  animation-delay: .35s;
}
.bingo-title-pop {
  position: relative;
  z-index: 1;
  font-size: clamp(3.4rem, 12vw, 7.4rem);
}
.bingo-celebration .rainbow-subtitle {
  position: relative;
  z-index: 1;
}
@keyframes bingo-win-cell {
  from { transform: scale(1); box-shadow: 0 0 0 rgba(66, 180, 117, 0); }
  to { transform: scale(1.08) rotate(2deg); box-shadow: 0 0 24px rgba(66, 180, 117, .55); }
}
@keyframes bingo-finish-pop {
  0% { opacity: 0; transform: translateY(18px) scale(.72) rotate(-2deg); }
  62% { opacity: 1; transform: translateY(-6px) scale(1.06) rotate(1deg); }
  100% { opacity: 1; transform: translateY(0) scale(1) rotate(0); }
}
@keyframes bingo-confetti {
  0% { opacity: 0; transform: translateY(-18px) scale(.7) rotate(-10deg); }
  28% { opacity: 1; }
  100% { opacity: 0; transform: translateY(44px) scale(1.35) rotate(18deg); }
}

.family-card {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 12% 10%, rgba(255, 190, 11, .28), transparent 9rem),
    radial-gradient(circle at 90% 16%, rgba(114, 87, 255, .2), transparent 10rem),
    radial-gradient(circle at 50% 100%, rgba(6, 214, 160, .16), transparent 12rem),
    rgba(255,255,255,.96);
}
.family-sky {
  position: absolute;
  inset: 10px 16px auto;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
  color: rgba(255, 159, 28, .72);
  font-size: 2rem;
}
.family-sky span { animation: family-star-twinkle 1.8s ease-in-out infinite alternate; }
.family-sky span:nth-child(2) { color: rgba(114, 87, 255, .62); animation-delay: .35s; }
.family-sky span:nth-child(3) { color: rgba(6, 214, 160, .72); animation-delay: .7s; }
.number-family {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 6px 0 22px;
  font-size: 2.1rem;
  font-weight: 900;
}
.number-family span {
  display: inline-grid;
  place-items: center;
  width: 88px;
  height: 88px;
  border-radius: 28px;
  color: #fff;
  background: linear-gradient(135deg, #7257ff, #1d9bf0);
  border: 4px solid rgba(255,255,255,.82);
  box-shadow: 0 14px 24px rgba(114, 87, 255, .24);
  transform: rotate(-2deg);
  animation: family-number-float 2.8s ease-in-out infinite;
  animation-delay: calc(var(--i, 0) * .18s);
}
.number-family span:nth-child(2) { background: linear-gradient(135deg, #ff9f1c, #ff4d6d); transform: rotate(2deg); }
.number-family span:nth-child(3) { background: linear-gradient(135deg, #18a66c, #7bdff2); transform: rotate(-1deg); }
.number-family.family-pop span { animation: family-number-pop .75s ease-out both, family-number-float 2.8s ease-in-out .75s infinite; }
.family-grid {
  display: grid;
  gap: 14px;
  font-size: 1.5rem;
}
.family-grid > div {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 12px;
  border-radius: 22px;
  background: rgba(255,255,255,.72);
  border: 2px dashed rgba(114, 87, 255, .25);
  box-shadow: 0 10px 24px rgba(54, 44, 96, .08);
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}
.family-grid > div:nth-child(2n) { background: rgba(255, 240, 199, .72); border-color: rgba(255, 159, 28, .28); }
.family-grid > div:nth-child(3n) { background: rgba(223, 248, 233, .72); border-color: rgba(24, 166, 108, .26); }
.family-input {
  width: 112px;
  min-width: 112px;
  text-align: center;
  font-weight: 900;
  font-size: 1.35rem;
  border-width: 3px;
  background: #fff;
  box-shadow: inset 0 -4px 0 rgba(114, 87, 255, .08);
}
.family-input:focus {
  background: #fffdf4;
  box-shadow: 0 0 0 4px rgba(255, 177, 59, .18), inset 0 -4px 0 rgba(255, 177, 59, .12);
}
.family-grid.family-shake > div { animation: family-row-shake .48s ease both; }
.family-grid.family-success > div { animation: family-row-success .9s ease-out both; }
.family-grid.family-success > div:nth-child(2) { animation-delay: .08s; }
.family-grid.family-success > div:nth-child(3) { animation-delay: .16s; }
.family-grid.family-success > div:nth-child(4) { animation-delay: .24s; }
.family-celebration {
  display: none;
  position: relative;
  overflow: hidden;
  margin: 18px auto 8px;
  max-width: 680px;
  padding: 22px 18px;
  border-radius: 28px;
  text-align: center;
  background: linear-gradient(135deg, #fff0c7, #ffd6e7, #dff8e9, #e8f2ff);
  border: 4px solid rgba(255, 177, 59, .72);
  box-shadow: 0 18px 42px rgba(255, 77, 109, .18);
}
.family-celebration.show { display: block; animation: family-celebration-pop 1s ease-out both, celebration-glow 1.5s ease-in-out infinite alternate; }
.family-celebration.show::before, .family-celebration.show::after {
  content: "";
  position: absolute;
  inset: -20%;
  pointer-events: none;
  background:
    radial-gradient(circle at 12% 30%, #ff4d6d 0 7px, transparent 8px),
    radial-gradient(circle at 28% 70%, #ffbe0b 0 8px, transparent 9px),
    radial-gradient(circle at 48% 20%, #06d6a0 0 7px, transparent 8px),
    radial-gradient(circle at 68% 74%, #7257ff 0 8px, transparent 9px),
    radial-gradient(circle at 86% 36%, #1d9bf0 0 7px, transparent 8px);
  animation: family-confetti 1.9s ease-out infinite;
}
.family-celebration.show::after { transform: rotate(24deg) scale(.84); animation-delay: .35s; }
.family-title-pop { position: relative; z-index: 1; font-size: clamp(2.6rem, 9vw, 5.8rem); }
.family-celebration .rainbow-subtitle { position: relative; z-index: 1; }
@keyframes family-star-twinkle {
  from { transform: translateY(0) scale(.85) rotate(-8deg); opacity: .55; }
  to { transform: translateY(8px) scale(1.15) rotate(8deg); opacity: 1; }
}
@keyframes family-number-float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -8px; } }
@keyframes family-number-pop {
  0% { transform: translateY(20px) scale(.5) rotate(-12deg); opacity: 0; }
  70% { transform: translateY(-8px) scale(1.12) rotate(5deg); opacity: 1; }
  100% { transform: translateY(0) scale(1) rotate(0); opacity: 1; }
}
@keyframes family-row-shake {
  0%, 100% { transform: translateX(0); }
  22% { transform: translateX(-8px) rotate(-1deg); }
  48% { transform: translateX(7px) rotate(1deg); }
  72% { transform: translateX(-4px); }
}
@keyframes family-row-success {
  0% { transform: scale(1); }
  45% { transform: scale(1.035) rotate(.5deg); background: rgba(223, 248, 233, .94); border-color: rgba(24, 166, 108, .55); }
  100% { transform: scale(1); }
}
@keyframes family-celebration-pop {
  0% { opacity: 0; transform: translateY(16px) scale(.75) rotate(-2deg); }
  62% { opacity: 1; transform: translateY(-6px) scale(1.05) rotate(1deg); }
  100% { opacity: 1; transform: translateY(0) scale(1) rotate(0); }
}
@keyframes family-confetti {
  0% { opacity: 0; transform: translateY(-20px) scale(.65) rotate(-10deg); }
  28% { opacity: 1; }
  100% { opacity: 0; transform: translateY(48px) scale(1.35) rotate(18deg); }
}
.robot-card {
  position: relative;
  overflow: hidden;
  text-align: center;
  background:
    radial-gradient(circle at 16% 12%, rgba(123, 223, 242, .26), transparent 10rem),
    radial-gradient(circle at 86% 18%, rgba(255, 190, 11, .28), transparent 10rem),
    radial-gradient(circle at 50% 100%, rgba(114, 87, 255, .18), transparent 12rem),
    rgba(255,255,255,.96);
}
.robot-lights {
  position: absolute;
  inset: 14px 18px auto;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}
.robot-lights span {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #ff4d6d;
  box-shadow: 0 0 18px rgba(255, 77, 109, .65);
  animation: robot-light-blink 1.2s ease-in-out infinite alternate;
}
.robot-lights span:nth-child(2) { background: #ffbe0b; box-shadow: 0 0 18px rgba(255, 190, 11, .7); animation-delay: .25s; }
.robot-lights span:nth-child(3) { background: #06d6a0; box-shadow: 0 0 18px rgba(6, 214, 160, .7); animation-delay: .5s; }
.robot-face {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: clamp(104px, 24vw, 150px);
  height: clamp(104px, 24vw, 150px);
  margin: 18px auto 12px;
  border-radius: 34px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.82), rgba(255,255,255,.18)),
    linear-gradient(135deg, #9bdcff, #fff0c7 48%, #9ff0c4);
  border: 5px solid rgba(255,255,255,.9);
  box-shadow: 0 18px 36px rgba(114, 87, 255, .22), inset 0 -8px 0 rgba(54, 44, 96, .08);
  animation: robot-bob 2.4s ease-in-out infinite;
}
.robot-antenna {
  position: absolute;
  top: -20px;
  left: 50%;
  width: 10px;
  height: 24px;
  border-radius: 999px;
  background: #7257ff;
  transform: translateX(-50%);
}
.robot-antenna::before {
  content: "";
  position: absolute;
  top: -12px;
  left: 50%;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #ffbe0b;
  box-shadow: 0 0 18px rgba(255, 190, 11, .8);
  transform: translateX(-50%);
}
.robot-eye {
  position: absolute;
  top: 43%;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #202124;
  box-shadow: inset 5px 5px 0 rgba(255,255,255,.28), 0 0 0 5px rgba(255,255,255,.55);
  transform-origin: center;
  transition: transform .18s ease, height .18s ease, top .18s ease, background .18s ease;
}
.robot-eye-left { left: 27%; }
.robot-eye-right { right: 27%; }
.robot-brow {
  position: absolute;
  top: 30%;
  width: 30px;
  height: 7px;
  border-radius: 999px;
  background: #2f3566;
  transition: transform .18s ease, top .18s ease;
}
.robot-brow-left { left: 24%; transform: rotate(-8deg); }
.robot-brow-right { right: 24%; transform: rotate(8deg); }
.robot-mouth {
  position: absolute;
  left: 50%;
  bottom: 22%;
  width: 56px;
  height: 30px;
  border-bottom: 8px solid #2f3566;
  border-radius: 0 0 999px 999px;
  transform: translateX(-50%);
  transition: width .18s ease, height .18s ease, bottom .18s ease, border .18s ease, background .18s ease;
}
.robot-cheek {
  position: absolute;
  top: 58%;
  width: 18px;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 77, 109, .38);
  opacity: 0;
  transition: opacity .18s ease, transform .18s ease;
}
.robot-cheek-left { left: 18%; }
.robot-cheek-right { right: 18%; }
.robot-tear {
  position: absolute;
  right: 23%;
  top: 52%;
  width: 12px;
  height: 18px;
  border-radius: 999px 999px 999px 3px;
  background: #1d9bf0;
  opacity: 0;
  transform: rotate(18deg) translateY(-4px);
  transition: opacity .18s ease, transform .18s ease;
}
.robot-card.robot-happy .robot-eye {
  top: 42%;
  height: 12px;
  border-radius: 999px 999px 0 0;
  background: transparent;
  box-shadow: 0 -6px 0 #202124;
  transform: scaleX(1.15);
}
.robot-card.robot-happy .robot-brow-left { top: 27%; transform: rotate(-18deg) translateY(-2px); }
.robot-card.robot-happy .robot-brow-right { top: 27%; transform: rotate(18deg) translateY(-2px); }
.robot-card.robot-happy .robot-mouth {
  bottom: 17%;
  width: 72px;
  height: 42px;
  border-bottom-width: 10px;
}
.robot-card.robot-happy .robot-cheek { opacity: 1; transform: scale(1.15); }
.robot-card.robot-error .robot-eye {
  top: 44%;
  height: 18px;
  transform: scaleY(.9);
  background: #3b426f;
}
.robot-card.robot-error .robot-brow-left { top: 32%; transform: rotate(20deg); }
.robot-card.robot-error .robot-brow-right { top: 32%; transform: rotate(-20deg); }
.robot-card.robot-error .robot-mouth {
  bottom: 16%;
  width: 54px;
  height: 30px;
  border-bottom: 0;
  border-top: 8px solid #2f3566;
  border-radius: 999px 999px 0 0;
}
.robot-card.robot-error .robot-tear { opacity: 1; transform: rotate(18deg) translateY(8px); }
.robot-card.robot-thinking .robot-mouth, .robot-card.robot-correcting .robot-mouth {
  bottom: 23%;
  width: 44px;
  height: 8px;
  border: 0;
  border-radius: 999px;
  background: #2f3566;
}
.robot-card.robot-correcting .robot-eye-left { transform: scale(1.15); }
.robot-card.robot-correcting .robot-eye-right { transform: scale(.75); }
.robot-card.robot-thinking .robot-face { animation: robot-thinking 1.35s ease-in-out infinite; }
.robot-card.robot-happy .robot-face { animation: robot-happy-dance .8s ease-in-out infinite alternate; }
.robot-card.robot-error .robot-face { animation: robot-error-shake .5s ease both; }
.robot-card.robot-correcting .robot-face { animation: robot-correcting .9s ease-in-out infinite alternate; }
.robot-speech {
  margin: 10px auto 16px;
  max-width: 680px;
  padding: 24px;
  border-radius: 28px;
  background: linear-gradient(135deg, #f4f1ff, #e8f2ff, #fff8dc);
  border: 3px solid rgba(114, 87, 255, .22);
  box-shadow: 0 14px 28px rgba(54, 44, 96, .12);
  font-size: clamp(1.7rem, 5vw, 3.2rem);
  font-weight: 900;
}
.robot-choices {
  margin-top: 18px;
}
.robot-choices button {
  position: relative;
  overflow: hidden;
  border-width: 3px;
  font-size: 1.7rem;
  min-height: 72px;
  background: #fff;
  box-shadow: 0 12px 22px rgba(114, 87, 255, .12);
}
.robot-choices button:nth-child(2n) { background: #fff0c7; }
.robot-choices button:nth-child(3n) { background: #dff8e9; }
.robot-choices button:nth-child(4n) { background: #e8f2ff; }
.robot-choice-correct { animation: robot-choice-correct .7s ease-out both; }
.robot-choice-wrong { animation: robot-choice-wrong .42s ease both; }
.robot-celebration {
  display: none;
  position: relative;
  overflow: hidden;
  margin: 18px auto 8px;
  max-width: 680px;
  padding: 22px 18px;
  border-radius: 28px;
  text-align: center;
  background: linear-gradient(135deg, #e8f2ff, #fff0c7, #dff8e9, #ffd6e7);
  border: 4px solid rgba(114, 87, 255, .34);
  box-shadow: 0 18px 42px rgba(29, 155, 240, .2);
}
.robot-celebration.show {
  display: block;
  animation: robot-celebration-pop 1s ease-out both, celebration-glow 1.4s ease-in-out infinite alternate;
}
.robot-celebration.show::before, .robot-celebration.show::after {
  content: "";
  position: absolute;
  inset: -20%;
  pointer-events: none;
  background:
    radial-gradient(circle at 14% 30%, #7bdff2 0 7px, transparent 8px),
    radial-gradient(circle at 28% 72%, #ffbe0b 0 8px, transparent 9px),
    radial-gradient(circle at 48% 20%, #06d6a0 0 7px, transparent 8px),
    radial-gradient(circle at 68% 74%, #7257ff 0 8px, transparent 9px),
    radial-gradient(circle at 86% 36%, #ff4d6d 0 7px, transparent 8px);
  animation: robot-confetti 1.8s ease-out infinite;
}
.robot-celebration.show::after { transform: rotate(24deg) scale(.85); animation-delay: .35s; }
.robot-title-pop { position: relative; z-index: 1; font-size: clamp(3rem, 10vw, 6.5rem); }
.robot-celebration .rainbow-subtitle { position: relative; z-index: 1; }
@keyframes robot-light-blink { from { transform: scale(.7); opacity: .55; } to { transform: scale(1.18); opacity: 1; } }
@keyframes robot-bob { 0%, 100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-8px) rotate(1deg); } }
@keyframes robot-thinking { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-6px) rotate(3deg); } }
@keyframes robot-happy-dance { from { transform: translateY(0) rotate(-5deg) scale(1); } to { transform: translateY(-10px) rotate(5deg) scale(1.05); } }
@keyframes robot-error-shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-9px) rotate(-4deg); } 55% { transform: translateX(8px) rotate(4deg); } 80% { transform: translateX(-4px); } }
@keyframes robot-correcting { from { transform: translateY(0) scale(1); filter: saturate(1); } to { transform: translateY(-6px) scale(1.04); filter: saturate(1.18); } }
@keyframes robot-choice-correct { 0% { transform: scale(1); } 55% { transform: scale(1.12) rotate(2deg); background: #dff8e9; } 100% { transform: scale(1); } }
@keyframes robot-choice-wrong { 0%, 100% { transform: translateX(0); } 30% { transform: translateX(-7px); } 62% { transform: translateX(6px); } }
@keyframes robot-celebration-pop { 0% { opacity: 0; transform: translateY(16px) scale(.72) rotate(-2deg); } 62% { opacity: 1; transform: translateY(-6px) scale(1.05) rotate(1deg); } 100% { opacity: 1; transform: translateY(0) scale(1) rotate(0); } }
@keyframes robot-confetti { 0% { opacity: 0; transform: translateY(-20px) scale(.65) rotate(-10deg); } 28% { opacity: 1; } 100% { opacity: 0; transform: translateY(48px) scale(1.35) rotate(18deg); } }
.treasure-card {
  position: relative;
  overflow: hidden;
  text-align: center;
  background:
    radial-gradient(circle at 14% 18%, rgba(255, 190, 11, .28), transparent 10rem),
    radial-gradient(circle at 84% 18%, rgba(123, 223, 242, .24), transparent 10rem),
    linear-gradient(180deg, rgba(232, 242, 255, .9), rgba(223, 248, 233, .78) 55%, rgba(255, 240, 199, .8));
}
.treasure-scene {
  position: relative;
  min-height: 132px;
  margin: 2px auto 12px;
  max-width: 760px;
  border-radius: 30px;
  background:
    radial-gradient(circle at 22% 28%, rgba(255,255,255,.9) 0 18px, transparent 20px),
    radial-gradient(circle at 78% 34%, rgba(255,255,255,.82) 0 16px, transparent 18px),
    linear-gradient(180deg, #7bdff2 0%, #dff8e9 58%, #fff0c7 59%);
  border: 4px solid rgba(255,255,255,.75);
  box-shadow: inset 0 -12px 0 rgba(255, 190, 11, .14), 0 18px 38px rgba(29, 155, 240, .16);
  overflow: hidden;
}
.treasure-cloud {
  position: absolute;
  top: 22px;
  width: 74px;
  height: 28px;
  border-radius: 999px;
  background: rgba(255,255,255,.86);
  animation: treasure-cloud-drift 5s ease-in-out infinite alternate;
}
.treasure-cloud::before, .treasure-cloud::after {
  content: "";
  position: absolute;
  bottom: 7px;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: inherit;
}
.treasure-cloud::before { left: 10px; }
.treasure-cloud::after { right: 10px; }
.treasure-cloud-one { left: 12%; }
.treasure-cloud-two { right: 10%; top: 36px; animation-delay: .8s; }
.treasure-island {
  position: absolute;
  left: 18%;
  bottom: 12px;
  font-size: clamp(3.2rem, 9vw, 5rem);
  animation: treasure-island-bob 2.8s ease-in-out infinite;
}
.treasure-chest {
  position: absolute;
  right: 18%;
  bottom: 16px;
  font-size: clamp(3.3rem, 9vw, 5.2rem);
  transform-origin: bottom center;
  animation: treasure-chest-wiggle 2.2s ease-in-out infinite;
}
.treasure-card.treasure-good .treasure-chest { animation: treasure-chest-unlock .7s ease-out both; }
.treasure-card.treasure-error .treasure-scene { animation: treasure-map-shake .45s ease both; }
.treasure-card.treasure-finished .treasure-chest { animation: treasure-chest-open 1.2s ease-out infinite alternate; }
.map-track {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  max-width: 720px;
  margin: 18px auto;
  position: relative;
}
.map-track::before {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  top: 50%;
  border-top: 6px dotted rgba(122, 74, 0, .28);
  transform: translateY(-50%);
}
.map-step {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  min-height: 62px;
  padding: 10px 6px;
  text-align: center;
  border-radius: 22px;
  background: #eee9df;
  color: #7a4a00;
  border: 3px solid rgba(255,255,255,.78);
  font-weight: 900;
  box-shadow: 0 10px 20px rgba(54, 44, 96, .12);
}
.map-step span { display: inline-block; font-size: 1.5rem; }
.map-step.done {
  background: linear-gradient(135deg, #dff8e9, #7bdff2);
  color: var(--success);
  animation: treasure-step-done .75s ease-out both;
}
.map-step.current {
  background: linear-gradient(135deg, #fff0c7, #ffbe0b);
  color: #7a4a00;
  animation: treasure-step-current 1s ease-in-out infinite alternate;
}
.treasure-task { animation: treasure-task-pop .42s ease-out both; }
.treasure-celebration {
  display: none;
  position: relative;
  overflow: hidden;
  margin: 18px auto 8px;
  max-width: 720px;
  padding: 22px 18px;
  border-radius: 28px;
  text-align: center;
  background: linear-gradient(135deg, #fff0c7, #dff8e9, #e8f2ff, #ffd6e7);
  border: 4px solid rgba(255, 190, 11, .75);
  box-shadow: 0 18px 42px rgba(255, 159, 28, .22);
}
.treasure-celebration.show {
  display: block;
  animation: treasure-celebration-pop 1s ease-out both, celebration-glow 1.4s ease-in-out infinite alternate;
}
.treasure-celebration.show::before, .treasure-celebration.show::after {
  content: "";
  position: absolute;
  inset: -18%;
  pointer-events: none;
  background:
    radial-gradient(circle at 12% 30%, #ffbe0b 0 8px, transparent 9px),
    radial-gradient(circle at 28% 72%, #ff4d6d 0 7px, transparent 8px),
    radial-gradient(circle at 48% 20%, #06d6a0 0 7px, transparent 8px),
    radial-gradient(circle at 68% 74%, #7257ff 0 8px, transparent 9px),
    radial-gradient(circle at 86% 36%, #1d9bf0 0 7px, transparent 8px);
  animation: treasure-confetti 1.8s ease-out infinite;
}
.treasure-celebration.show::after { transform: rotate(24deg) scale(.85); animation-delay: .35s; }
.treasure-title-pop { position: relative; z-index: 1; font-size: clamp(2.6rem, 9vw, 5.9rem); column-gap: .32em; row-gap: .05em; }
.treasure-title-word { display: inline-flex; flex-wrap: nowrap; }
.treasure-celebration .rainbow-subtitle { position: relative; z-index: 1; }
@keyframes treasure-cloud-drift { from { transform: translateX(-8px); } to { transform: translateX(18px); } }
@keyframes treasure-island-bob { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-7px) rotate(2deg); } }
@keyframes treasure-chest-wiggle { 0%, 100% { transform: rotate(-2deg); } 50% { transform: rotate(3deg) translateY(-4px); } }
@keyframes treasure-chest-unlock { 0% { transform: scale(1) rotate(0); } 38% { transform: scale(1.16) rotate(-8deg); } 72% { transform: scale(1.08) rotate(7deg); } 100% { transform: scale(1) rotate(0); } }
@keyframes treasure-chest-open { from { transform: translateY(0) scale(1); filter: brightness(1); } to { transform: translateY(-8px) scale(1.08); filter: brightness(1.25) saturate(1.25); } }
@keyframes treasure-map-shake { 0%, 100% { transform: translateX(0); } 28% { transform: translateX(-8px) rotate(-1deg); } 58% { transform: translateX(7px) rotate(1deg); } 82% { transform: translateX(-4px); } }
@keyframes treasure-step-done { 0% { transform: scale(.7) rotate(-10deg); opacity: .5; } 70% { transform: scale(1.12) rotate(4deg); opacity: 1; } 100% { transform: scale(1) rotate(0); } }
@keyframes treasure-step-current { from { transform: translateY(0) scale(1); box-shadow: 0 10px 20px rgba(255, 159, 28, .18); } to { transform: translateY(-7px) scale(1.05); box-shadow: 0 18px 28px rgba(255, 159, 28, .3); } }
@keyframes treasure-task-pop { 0% { transform: scale(.92); opacity: .5; } 100% { transform: scale(1); opacity: 1; } }
@keyframes treasure-celebration-pop { 0% { opacity: 0; transform: translateY(16px) scale(.72) rotate(-2deg); } 62% { opacity: 1; transform: translateY(-6px) scale(1.05) rotate(1deg); } 100% { opacity: 1; transform: translateY(0) scale(1) rotate(0); } }
@keyframes treasure-confetti { 0% { opacity: 0; transform: translateY(-20px) scale(.65) rotate(-10deg); } 28% { opacity: 1; } 100% { opacity: 0; transform: translateY(48px) scale(1.35) rotate(18deg); } }

.balloon-card { overflow: hidden; }
.balloon-field {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(108px, 1fr));
  gap: 22px 18px;
  max-width: 760px;
  margin: 22px auto 6px;
  padding: 10px 0 22px;
}
.balloon {
  position: relative;
  min-height: 164px;
  border: 0;
  border-radius: 52% 52% 46% 46%;
  background: linear-gradient(160deg, #8f7bff, #7257ff);
  color: white;
  display: grid;
  place-items: center;
  font-size: clamp(1.9rem, 6vw, 3rem);
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 16px 28px rgba(114, 87, 255, .28);
  transform-origin: bottom center;
  animation: balloon-float 3.4s ease-in-out infinite;
  transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
}
.balloon::before {
  content: "";
  position: absolute;
  inset: 16px auto auto 22px;
  width: 22px;
  height: 34px;
  border-radius: 999px;
  background: rgba(255,255,255,.28);
  transform: rotate(25deg);
}
.balloon::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -12px;
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 16px solid currentColor;
  color: inherit;
  transform: translateX(-50%);
  opacity: .9;
}
.balloon:hover { transform: translateY(-10px) rotate(-2deg) scale(1.04); box-shadow: 0 22px 36px rgba(114, 87, 255, .32); }
.balloon:disabled { cursor: not-allowed; opacity: .6; }
.balloon:nth-child(2n) { background: linear-gradient(160deg, #ffbf55, #ff9f1c); box-shadow: 0 16px 28px rgba(255, 177, 59, .28); animation-delay: -.5s; }
.balloon:nth-child(3n) { background: linear-gradient(160deg, #40c98b, #18a66c); box-shadow: 0 16px 28px rgba(20, 122, 68, .24); animation-delay: -1.1s; }
.balloon:nth-child(4n) { background: linear-gradient(160deg, #ff7a90, #e94868); box-shadow: 0 16px 28px rgba(233, 72, 104, .26); animation-delay: -1.7s; }
.balloon.pop { animation: balloon-pop .58s cubic-bezier(.16, 1, .3, 1) forwards; }
.balloon.pop::before { animation: shine-pop .42s ease-out forwards; }
@keyframes balloon-float {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-8px) rotate(1.5deg); }
}
@keyframes balloon-pop {
  0% { transform: translateY(-8px) scale(1); filter: saturate(1); opacity: 1; }
  35% { transform: translateY(-12px) scale(1.18); filter: saturate(1.4); opacity: 1; }
  55% { transform: translateY(-6px) scale(.86) rotate(8deg); opacity: .75; }
  100% { transform: translateY(-24px) scale(.08) rotate(18deg); opacity: 0; }
}
@keyframes shine-pop {
  100% { opacity: 0; transform: rotate(25deg) scale(2.2); }
}

.secret-message {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px 18px;
  padding: 22px;
  background:
    radial-gradient(circle at 15% 20%, rgba(255,255,255,.72), transparent 8rem),
    linear-gradient(135deg, #fff0c7, #dff8e9 42%, #ffd6e7 72%, #ece8ff);
  color: var(--ink);
  border-radius: 28px;
  font-size: clamp(1.6rem, 5vw, 2.9rem);
  font-weight: 900;
  letter-spacing: 0;
  border: 3px solid rgba(255, 177, 59, .42);
  box-shadow: inset 0 0 0 4px rgba(255,255,255,.45), 0 16px 32px rgba(114, 87, 255, .16);
  animation: secret-panel-sparkle 5s ease-in-out infinite alternate;
}
.secret-word {
  display: inline-flex;
  gap: 8px;
  flex-wrap: nowrap;
  white-space: nowrap;
  margin: 4px 2px;
}
.secret-letter {
  min-width: clamp(42px, 8vw, 70px);
  min-height: clamp(50px, 9vw, 78px);
  display: inline-grid;
  place-items: center;
  text-align: center;
  border: 0;
  border-radius: 18px;
  background: rgba(255,255,255,.82);
  color: var(--primary-dark);
  box-shadow: 0 8px 18px rgba(114, 87, 255, .14);
  transform: rotate(-1deg);
}
.secret-letter.revealed {
  color: white;
  background: linear-gradient(135deg, #7257ff, #ff7ab6);
  animation: secret-letter-pop .55s ease-out both;
}
.secret-letter:nth-child(3n).revealed { background: linear-gradient(135deg, #18a66c, #7bdff2); }
.secret-letter:nth-child(4n).revealed { background: linear-gradient(135deg, #ff9f1c, #ff4d6d); }
.secret-letter:nth-child(5n).revealed { background: linear-gradient(135deg, #1d9bf0, #7257ff); }
.secret-letter.space {
  background: transparent;
  box-shadow: none;
  min-width: 22px;
}
.code-card {
  background:
    radial-gradient(circle at 10% 8%, rgba(255, 177, 59, .16), transparent 12rem),
    radial-gradient(circle at 92% 12%, rgba(114, 87, 255, .14), transparent 12rem),
    rgba(255,255,255,.96);
}
.secret-message.celebrate {
  position: relative;
  overflow: hidden;
  animation: secret-panel-celebrate 1.9s ease-out both, secret-panel-sparkle .55s ease-in-out 5 alternate;
}
.secret-message.celebrate::before, .secret-message.celebrate::after {
  content: "";
  position: absolute;
  inset: -18%;
  pointer-events: none;
  z-index: 1;
  background:
    radial-gradient(circle at 14% 20%, #ff4d6d 0 7px, transparent 8px),
    radial-gradient(circle at 22% 72%, #ffbe0b 0 8px, transparent 9px),
    radial-gradient(circle at 35% 42%, #06d6a0 0 6px, transparent 7px),
    radial-gradient(circle at 48% 18%, #7bdff2 0 7px, transparent 8px),
    radial-gradient(circle at 58% 78%, #7257ff 0 7px, transparent 8px),
    radial-gradient(circle at 70% 38%, #d946ef 0 8px, transparent 9px),
    radial-gradient(circle at 84% 22%, #ff9f1c 0 7px, transparent 8px),
    radial-gradient(circle at 90% 68%, #2bb673 0 8px, transparent 9px),
    radial-gradient(circle at 42% 58%, rgba(255,255,255,.95) 0 4px, transparent 5px),
    radial-gradient(circle at 63% 14%, rgba(255,255,255,.95) 0 4px, transparent 5px);
  filter: drop-shadow(0 0 12px rgba(255, 213, 74, .85));
  animation: code-fireworks 2.8s ease-out both;
}
.secret-message.celebrate::after {
  inset: -28%;
  transform: rotate(22deg) scale(.72);
  background:
    radial-gradient(circle at 16% 62%, #7bdff2 0 6px, transparent 7px),
    radial-gradient(circle at 28% 28%, #d946ef 0 7px, transparent 8px),
    radial-gradient(circle at 40% 82%, #ff4d6d 0 8px, transparent 9px),
    radial-gradient(circle at 52% 34%, #ffbe0b 0 7px, transparent 8px),
    radial-gradient(circle at 66% 70%, #06d6a0 0 8px, transparent 9px),
    radial-gradient(circle at 78% 18%, #7257ff 0 7px, transparent 8px),
    radial-gradient(circle at 88% 52%, #ff9f1c 0 8px, transparent 9px);
  animation-delay: .25s;
}
.secret-message.celebrate .secret-word {
  position: relative;
  z-index: 2;
  animation: secret-word-party 1.1s ease-out both;
}
.secret-message.celebrate .secret-letter.revealed {
  animation: secret-letter-party .95s ease-out both;
}
@keyframes secret-panel-celebrate {
  0% { transform: scale(1); }
  28% { transform: scale(1.04) rotate(.7deg); }
  58% { transform: scale(1.02) rotate(-.45deg); }
  100% { transform: scale(1); }
}
@keyframes code-fireworks {
  0% { opacity: 0; transform: scale(.22) rotate(-8deg); filter: blur(0) drop-shadow(0 0 0 rgba(255, 213, 74, .2)); }
  18% { opacity: 1; }
  62% { opacity: .95; }
  100% { opacity: 0; transform: scale(3.7) rotate(24deg); filter: blur(1.5px) drop-shadow(0 0 32px rgba(255, 213, 74, 1)); }
}
@keyframes secret-panel-sparkle {
  from { filter: saturate(1) brightness(1); }
  to { filter: saturate(1.22) brightness(1.06); }
}
@keyframes secret-word-party {
  0% { transform: translateY(0) scale(1); }
  38% { transform: translateY(-8px) scale(1.04); }
  100% { transform: translateY(0) scale(1); }
}
@keyframes secret-letter-pop {
  0% { transform: translateY(16px) scale(.6) rotate(-8deg); opacity: .35; }
  65% { transform: translateY(-8px) scale(1.12) rotate(4deg); opacity: 1; }
  100% { transform: translateY(0) scale(1) rotate(0); opacity: 1; }
}
@keyframes secret-letter-party {
  0% { transform: translateY(0) scale(1) rotate(0); }
  30% { transform: translateY(-10px) scale(1.16) rotate(-5deg); }
  62% { transform: translateY(3px) scale(1.06) rotate(4deg); }
  100% { transform: translateY(0) scale(1) rotate(0); }
}
.task-list li { margin: 8px 0; font-size: 1.1rem; }
.local-log {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}
.log-summary {
  margin: 8px 0 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #eef2ff;
  color: #3b2f86;
  font-weight: 900;
  border: 1px solid #d8d0ff;
}
.log-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #fbfaff;
  border: 1px solid #ebe6ff;
}

#deviceResults .log-item { flex-wrap: wrap; }
#deviceResults .log-item > span { min-width: 0; overflow-wrap: anywhere; }

.teacher-online-shell {
  margin: 0 0 26px;
  border: 2px solid #d8d0ff;
  border-radius: 22px;
  overflow: hidden;
  background: rgba(255, 255, 255, .96);
}
.teacher-auth-panel {
  display: grid;
  grid-template-columns: minmax(0, .85fr) minmax(320px, 1.15fr);
  gap: 26px;
  padding: 26px;
  background:
    linear-gradient(135deg, rgba(114, 87, 255, .12), rgba(123, 223, 242, .15) 52%, rgba(255, 209, 102, .2));
}
.teacher-auth-copy {
  align-self: center;
  padding: 10px;
}
.teacher-auth-copy h3, .teacher-section-head h3, .class-summary h3, .online-journal-head h3 {
  margin: 4px 0 6px;
}
.teacher-auth-copy p, .teacher-profile-bar p, .class-summary p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}
.teacher-kicker {
  display: block;
  color: #563bd7;
  font-size: .82rem;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.teacher-auth-box {
  padding: 18px;
  border: 1px solid rgba(114, 87, 255, .18);
  border-radius: 18px;
  background: rgba(255, 255, 255, .9);
}
.teacher-auth-switch {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  margin-bottom: 16px;
  padding: 5px;
  border-radius: 14px;
  background: #ece8ff;
}
.teacher-auth-tab {
  min-height: 46px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: #3b2f86;
  font-weight: 950;
  cursor: pointer;
}
.teacher-auth-tab.active {
  background: #7257ff;
  color: #fff;
  box-shadow: 0 7px 15px rgba(86, 59, 215, .22);
}
.teacher-form, .teacher-inline-form {
  display: grid;
  gap: 9px;
}
.teacher-form label, .teacher-inline-form label {
  color: #3b2f86;
  font-weight: 900;
}
.teacher-form input, .teacher-inline-form input {
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  border: 2px solid rgba(32, 33, 36, .12);
  border-radius: 14px;
  background: #fff;
  outline: none;
}
.teacher-form input:focus, .teacher-inline-form input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(114, 87, 255, .12);
}
.teacher-form .btn { margin-top: 6px; }
.teacher-form-help { margin-top: -4px; color: #655b98; font-weight: 750; }
.teacher-auth-help-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 18px;
  margin-top: 2px;
}
.teacher-auth-link {
  min-height: 34px;
  padding: 3px 0;
  border: 0;
  background: transparent;
  color: #563bd7;
  font: inherit;
  font-weight: 900;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.teacher-auth-link:hover, .teacher-auth-link:focus-visible { color: #2f1d9d; }
.teacher-auth-link:disabled { color: #8f88b3; cursor: wait; }
.teacher-auth-help-text {
  margin-top: -4px;
  color: var(--muted);
  text-align: center;
  line-height: 1.4;
}
.teacher-password-update-copy h4 { margin: 0 0 4px; color: #3b2f86; font-size: 1.15rem; }
.teacher-password-update-copy p { margin: 0 0 8px; color: var(--muted); line-height: 1.45; }
.teacher-dashboard { background: #fff; }
.teacher-profile-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 22px 24px;
  border-bottom: 1px solid #e7e2f7;
  background: linear-gradient(90deg, #f5f2ff, #eefbff);
}
.teacher-profile-bar h3 { margin: 6px 0 2px; }
.teacher-role-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #dff8e9;
  color: #0f6a3b;
  font-size: .84rem;
  font-weight: 950;
}
.admin-overview {
  padding: 22px 24px;
  border-bottom: 1px solid #e7e2f7;
  background: #fff9e8;
}
.admin-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.admin-stat {
  display: grid;
  gap: 5px;
  min-height: 92px;
  padding: 14px;
  border: 1px solid #ffe0a8;
  border-radius: 16px;
  background: #fff;
}
.admin-stat:nth-child(2) { border-color: #bdefff; background: #f2fcff; }
.admin-stat:nth-child(3) { border-color: #bfe9cf; background: #f1fcf6; }
.admin-stat:nth-child(4) { border-color: #ffc6dc; background: #fff5f9; }
.admin-stat span { color: var(--muted); font-weight: 800; }
.admin-stat strong { font-size: 1.7rem; color: #3b2f86; }
.teacher-workspace {
  display: grid;
  grid-template-columns: minmax(250px, .75fr) minmax(0, 1.4fr);
  min-height: 460px;
}
.teacher-class-pane, .teacher-detail-pane { padding: 22px; }
.teacher-class-pane {
  border-right: 1px solid #e7e2f7;
  background: #fbfaff;
}
.teacher-section-head, .online-journal-head, .class-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}
.teacher-section-head--students { margin-top: 24px; }
.teacher-inline-form {
  margin: 16px 0 10px;
  padding: 16px;
  border: 1px solid #d8d0ff;
  border-radius: 16px;
  background: #fff;
}
.teacher-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}
.teacher-class-list {
  display: grid;
  gap: 9px;
  margin-top: 16px;
}
.teacher-class-button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 66px;
  padding: 11px 12px;
  border: 2px solid #e1dcf7;
  border-radius: 15px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.teacher-class-button span { min-width: 0; }
.teacher-class-button strong, .teacher-class-button small { display: block; overflow-wrap: anywhere; }
.teacher-class-button small { margin-top: 3px; color: var(--muted); }
.teacher-class-button em {
  flex: 0 0 auto;
  color: #563bd7;
  font-size: .8rem;
  font-style: normal;
  font-weight: 950;
}
.teacher-class-button:hover { border-color: #9d8cff; }
.teacher-class-button.active {
  border-color: #7257ff;
  background: #ece8ff;
  box-shadow: 0 8px 16px rgba(86, 59, 215, .12);
}
.teacher-empty-state {
  display: grid;
  place-content: center;
  gap: 7px;
  min-height: 260px;
  padding: 22px;
  color: var(--muted);
  text-align: center;
  border: 2px dashed #d8d0ff;
  border-radius: 18px;
  background: #fbfaff;
}
.teacher-empty-state strong { color: #3b2f86; font-size: 1.2rem; }
.teacher-empty-state--small { min-height: 130px; }
.class-summary {
  padding-bottom: 18px;
  border-bottom: 1px solid #e7e2f7;
}
.class-code-box {
  flex: 0 0 auto;
  min-width: 150px;
  padding: 12px 15px;
  border: 2px solid #ffd36e;
  border-radius: 16px;
  background: #fff6d9;
  text-align: center;
}
.class-code-box span, .class-code-box strong { display: block; }
.class-code-box span { color: #755000; font-size: .78rem; font-weight: 850; }
.class-code-box strong { margin-top: 4px; color: #3b2f86; font-size: 1.15rem; }
.class-summary-actions {
  display: grid;
  justify-items: stretch;
  gap: 8px;
  flex: 0 0 auto;
}
.teacher-danger-button, .teacher-delete-button {
  border: 2px solid #f3a7a7;
  background: #fff1f1;
  color: #9e2424;
  font-weight: 950;
}
.teacher-danger-button:hover, .teacher-delete-button:hover {
  border-color: #bd2b2b;
  background: #ffe1e1;
}
.teacher-delete-button {
  min-height: 38px;
  padding: 7px 11px;
  border-radius: 11px;
  cursor: pointer;
}
.teacher-action-column {
  width: 1%;
  white-space: nowrap;
  text-align: right !important;
}
.teacher-inline-form--student {
  grid-template-columns: minmax(80px, .55fr) minmax(180px, 1fr) 136px;
  align-items: start;
}
.teacher-field { display: grid; gap: 8px; align-content: start; }
.teacher-inline-form--student .teacher-field > label { min-height: 2.4em; }
.teacher-pin-caption {
  display: block;
  color: #655b98;
  font-size: .9em;
}
.teacher-pin-input {
  display: grid;
  grid-template-columns: 84px 44px;
  align-items: center;
  gap: 8px;
  width: 136px;
  max-width: 100%;
  justify-self: end;
}
.teacher-pin-input input {
  min-width: 0;
  padding-inline: 12px;
  font-size: 1.1rem;
  letter-spacing: 0;
}
.teacher-pin-reveal {
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border: 2px solid #d8d0ff;
  border-radius: 14px;
  background: #f4f1ff;
  color: #3b2f86;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
.teacher-pin-reveal:hover, .teacher-pin-reveal:focus-visible {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(114, 87, 255, .12);
}
.teacher-pin-reveal[aria-pressed="true"] {
  background: var(--primary);
  color: #fff;
  transform: scale(.96);
}
.teacher-inline-form--student .teacher-form-actions { grid-column: 1 / -1; }
.teacher-table-wrap {
  width: 100%;
  margin-top: 14px;
  overflow-x: auto;
  border: 1px solid #e7e2f7;
  border-radius: 16px;
}
.teacher-table {
  width: 100%;
  min-width: 420px;
  border-collapse: collapse;
  background: #fff;
}
.teacher-table--journal { min-width: 720px; }
.teacher-table th, .teacher-table td {
  padding: 12px 13px;
  border-bottom: 1px solid #eeeaf8;
  text-align: left;
  vertical-align: middle;
}
.teacher-table th {
  background: #f3f0ff;
  color: #3b2f86;
  font-size: .86rem;
}
.teacher-table tbody tr:last-child td { border-bottom: 0; }
.teacher-empty-row {
  margin: 0;
  padding: 18px;
  color: var(--muted);
  text-align: center;
}
.online-journal-head {
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid #e7e2f7;
}
.online-journal { margin-top: 6px; }
.teacher-tools-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 28px 0 20px;
  color: #3b2f86;
  font-weight: 950;
}
.teacher-tools-divider::before, .teacher-tools-divider::after {
  content: "";
  flex: 1;
  border-top: 2px solid #d8d0ff;
}
.footer {
  max-width: 1150px;
  margin: 0 auto 28px;
  padding: 0 24px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 860px) {
  .access-bar { grid-template-columns: 1fr; }
  .access-status { min-width: 0; text-align: left; }
  .access-status-actions { justify-content: flex-start; }
  .layout { grid-template-columns: 1fr; margin-top: 16px; }
  .side-card { position: static; }
  .tabs { grid-template-columns: repeat(2, 1fr); }
  .panel-head, .progress-line { flex-direction: column; }
  .panel-head > :first-child { flex-basis: auto; }
  .panel-head-actions { align-self: stretch; justify-content: flex-start; }
  .settings-grid, .teacher-grid { grid-template-columns: 1fr; }
  .choice-grid { grid-template-columns: repeat(2, 1fr); }
  .balloon-field { grid-template-columns: repeat(3, 1fr); }
  .teacher-auth-panel, .teacher-workspace { grid-template-columns: 1fr; }
  .teacher-class-pane { border-right: 0; border-bottom: 1px solid #e7e2f7; }
  .teacher-inline-form--student { grid-template-columns: 1fr; }
  .teacher-inline-form--student .teacher-form-actions { grid-column: auto; }
  .teacher-inline-form--student .teacher-field > label { min-height: 0; }
  .teacher-pin-input { justify-self: start; }
  .admin-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
  .hero { padding: 28px 16px; }
  .access-role-nav, .student-choice-list { grid-template-columns: 1fr; }
  .access-role-button { min-height: 58px; }
  .student-login-shell { padding: 18px; }
  .student-login-progress span { padding: 7px 3px; font-size: .74rem; }
  .layout { padding: 0 14px; }
  .panel { padding: 16px; border-radius: 20px; }
  .panel-head-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel-head-actions .btn { min-width: 0; padding: 12px 10px; font-size: 1rem; }
  .welcome-panel { min-height: 0; padding: 24px 16px; }
  .welcome-heading h2 { font-size: 2rem; }
  .welcome-guide-row { grid-template-columns: 48px minmax(0, 1fr); gap: 12px; padding: 15px 13px; }
  .welcome-guide-icon { width: 46px; height: 46px; font-size: 1.4rem; }
  .tabs { grid-template-columns: 1fr; }
  .bingo-board { gap: 6px; }
  .family-grid { font-size: 1.15rem; }
  .family-input { width: 86px; min-width: 86px; padding: 10px; font-size: 1.1rem; }
  .balloon-field { grid-template-columns: repeat(2, 1fr); }
  .balloon { min-height: 128px; }
  .teacher-auth-panel, .teacher-class-pane, .teacher-detail-pane { padding: 16px; }
  .teacher-auth-panel { grid-template-columns: minmax(0, 1fr); }
  .teacher-profile-bar, .teacher-section-head, .online-journal-head, .class-summary { align-items: stretch; flex-direction: column; }
  .teacher-profile-bar .btn, .teacher-section-head .btn, .online-journal-head .btn { width: 100%; }
  .admin-stat-grid { grid-template-columns: 1fr; }
  .class-code-box { width: 100%; }
  .class-summary-actions { width: 100%; }
}

body.wallpaper-space { --wallpaper-image: url("assets/wallpapers/space.png"); }
body.wallpaper-candy { --wallpaper-image: url("assets/wallpapers/candy.png"); }
body.wallpaper-ocean { --wallpaper-image: url("assets/wallpapers/ocean.png"); }
body.wallpaper-stage { --wallpaper-image: url("assets/wallpapers/stage.png"); }
body.wallpaper-classroom { --wallpaper-image: url("assets/wallpapers/classroom.png"); }
body.wallpaper-blockworld { --wallpaper-image: url("assets/wallpapers/blockworld.png"); }
body.wallpaper-space, body.wallpaper-candy, body.wallpaper-ocean, body.wallpaper-stage, body.wallpaper-classroom, body.wallpaper-blockworld {
  background:
    linear-gradient(rgba(255,255,255,.10), rgba(255,255,255,.28)),
    var(--wallpaper-image) center center / cover fixed no-repeat;
}
body.wallpaper-space::before, body.wallpaper-candy::before, body.wallpaper-ocean::before, body.wallpaper-stage::before, body.wallpaper-classroom::before, body.wallpaper-blockworld::before {
  z-index: 0;
  background:
    radial-gradient(circle at 50% 42%, rgba(255,255,255,.68), rgba(255,255,255,.2) 32rem, transparent 48rem),
    linear-gradient(rgba(255,255,255,.16), rgba(255,255,255,.16));
  opacity: .9;
}
.hero, .layout, .footer { position: relative; z-index: 1; }
.side-card, .game-card, .panel { background: rgba(255, 255, 255, .96); }
@media (max-width: 860px) {
  body.wallpaper-space, body.wallpaper-candy, body.wallpaper-ocean, body.wallpaper-stage, body.wallpaper-classroom, body.wallpaper-blockworld {
    background-attachment: scroll;
    background-position: center top;
  }
}
