@font-face { font-family: 'Fredoka'; font-weight: 500; font-style: normal; font-display: swap; src: url('/fonts/fredoka-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Fredoka'; font-weight: 600; font-style: normal; font-display: swap; src: url('/fonts/fredoka-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Fredoka'; font-weight: 700; font-style: normal; font-display: swap; src: url('/fonts/fredoka-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Nunito'; font-weight: 500; font-style: normal; font-display: swap; src: url('/fonts/nunito-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Nunito'; font-weight: 700; font-style: normal; font-display: swap; src: url('/fonts/nunito-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Nunito'; font-weight: 800; font-style: normal; font-display: swap; src: url('/fonts/nunito-latin-800-normal.woff2') format('woff2'); }

:root {
  --cream: #FFF7EE;
  --paper: #FFFFFF;
  --choc: #5A3A28;
  --choc-soft: #8A6A55;
  --caramel: #D4972E;
  --caramel-dark: #A86F14;
  --pink: #F38BAE;
  --pink-soft: #FFE1EB;
  --lav: #A98BD8;
  --lav-soft: #EEE6FB;
  --mint: #7FD1B9;
  --mint-soft: #DDF5EE;
  --sky: #8EC7F2;
  --sky-soft: #E3F2FD;
  --lemon: #F7D460;
  --red: #E4574F;
  --shadow: 0 4px 0 rgba(90, 58, 40, .15), 0 10px 24px rgba(90, 58, 40, .10);
  --radius: 22px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Nunito', system-ui, sans-serif;
  color: var(--choc);
  background:
    radial-gradient(circle at 12% 18%, rgba(243,139,174,.18) 0 60px, transparent 61px),
    radial-gradient(circle at 88% 12%, rgba(127,209,185,.22) 0 46px, transparent 47px),
    radial-gradient(circle at 80% 85%, rgba(169,139,216,.18) 0 70px, transparent 71px),
    var(--cream);
  min-height: 100vh;
  font-size: 18px;
}
h1, h2, h3, .title { font-family: 'Fredoka', 'Nunito', sans-serif; margin: 0; letter-spacing: .3px; }
button { font-family: inherit; cursor: pointer; }
img { max-width: 100%; }
.hidden { display: none !important; }

/* ---------- buttons ---------- */
.btn {
  border: 0; border-radius: 999px; padding: 12px 24px;
  font-family: 'Fredoka', 'Nunito', sans-serif; font-size: 20px; font-weight: 600;
  background: var(--caramel); color: #fff;
  box-shadow: 0 5px 0 var(--caramel-dark);
  transition: transform .08s, box-shadow .08s;
}
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--caramel-dark); }
.btn.pink { background: var(--pink); box-shadow: 0 5px 0 #C9668A; }
.btn.mint { background: var(--mint); box-shadow: 0 5px 0 #4FA68D; }
.btn.lav  { background: var(--lav);  box-shadow: 0 5px 0 #7D5FB0; }
.btn.ghost { background: #fff; color: var(--choc); box-shadow: 0 4px 0 #E8D8C8; }
.btn.small { font-size: 16px; padding: 8px 16px; }
.btn:disabled { opacity: .5; cursor: default; }
.link { background: none; border: 0; color: var(--choc-soft); text-decoration: underline; font-size: 16px; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 12px 22px;
  background: #fff; box-shadow: 0 3px 0 #F0E1D2;
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; font-family: 'Fredoka', 'Nunito', sans-serif; font-weight: 700; font-size: 26px; color: var(--caramel-dark); text-decoration: none; }
.brand img { height: 44px; }
.topbar .spacer { flex: 1; }
.me { display: flex; align-items: center; gap: 10px; font-weight: 800; }
.me img { height: 42px; width: 42px; object-fit: contain; background: var(--pink-soft); border-radius: 50%; padding: 3px; }

/* ---------- cards ---------- */
.card { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 22px; }

/* ---------- speech bubble ---------- */
.bubble {
  position: relative; background: #fff; border: 3px solid var(--choc); border-radius: 26px;
  padding: 14px 20px; font-weight: 800; font-size: 20px; line-height: 1.35;
}
.bubble::after {
  content: ''; position: absolute; left: -18px; top: 26px;
  border: 10px solid transparent; border-right: 12px solid var(--choc);
}
.bubble::before {
  content: ''; position: absolute; left: -11px; top: 28px; z-index: 1;
  border: 8px solid transparent; border-right: 10px solid #fff;
}

/* ---------- login ---------- */
.login-hero { display: grid; grid-template-columns: 1fr 1.2fr; gap: 26px; align-items: center; }
.login-hero .caby-big { width: 100%; max-width: 420px; filter: drop-shadow(0 8px 0 rgba(90,58,40,.08)); }
.login-hero h1 { font-size: 52px; color: var(--caramel-dark); line-height: 1; }
.login-hero h1 span { color: var(--pink); }
.profiles { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 18px; }
.profile {
  width: 140px; border: 0; background: #fff; border-radius: 22px; padding: 12px;
  box-shadow: var(--shadow); font-family: 'Fredoka', 'Nunito', sans-serif; font-size: 20px; color: var(--choc);
  transition: transform .12s;
}
.profile:hover { transform: translateY(-4px) rotate(-1deg); }
.profile img { height: 96px; width: 100%; object-fit: contain; display: block; margin-bottom: 6px; }

.picpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 330px; }
.pic {
  aspect-ratio: 1; border: 3px solid #F0E1D2; background: #fff; border-radius: 20px; font-size: 44px;
  display: grid; place-items: center; transition: transform .1s;
}
.pic:hover { transform: scale(1.06); }
.pic.on { border-color: var(--pink); background: var(--pink-soft); }
.chosen { display: flex; gap: 10px; margin: 14px 0; }
.chosen div { width: 62px; height: 62px; border-radius: 16px; border: 3px dashed #E5CDB8; display: grid; place-items: center; font-size: 36px; background: #fff; }
.msg { min-height: 26px; font-weight: 800; color: var(--red); }
.msg.ok { color: #2E9C7A; }

/* ---------- classroom ---------- */
.classroom-head { display: grid; grid-template-columns: 300px 1fr; gap: 22px; align-items: center; }
.classroom-head .caby-desk { width: 100%; }
.grade-tabs { display: inline-flex; background: #fff; border-radius: 999px; padding: 6px; box-shadow: var(--shadow); margin: 6px 0 4px; }
.grade-tabs button {
  border: 0; background: transparent; border-radius: 999px; padding: 10px 26px;
  font-family: 'Fredoka', 'Nunito', sans-serif; font-size: 20px; font-weight: 600; color: var(--choc-soft);
}
.grade-tabs button.on { background: var(--pink); color: #fff; }
.topic { margin-top: 30px; }
.topic h2 { font-size: 28px; display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.topic h2 .dot { width: 18px; height: 18px; border-radius: 50%; display: inline-block; }
.games { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.game-card {
  text-align: left; border: 0; border-radius: var(--radius); padding: 18px; background: #fff;
  box-shadow: var(--shadow); color: var(--choc); position: relative; overflow: hidden;
  transition: transform .12s;
}
.game-card:hover { transform: translateY(-4px); }
.game-card .emoji { font-size: 46px; line-height: 1; }
.game-card h3 { font-size: 22px; margin: 8px 0 4px; }
.game-card p { margin: 0; font-size: 15px; color: var(--choc-soft); min-height: 40px; }
.game-card .stars { margin-top: 10px; font-size: 22px; letter-spacing: 2px; }
.game-card .band { position: absolute; top: 0; left: 0; right: 0; height: 8px; }
.star-off { filter: grayscale(1); opacity: .3; }

.shelf { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; min-height: 60px;
  background: linear-gradient(transparent 78%, #C98A4B 78%, #C98A4B 88%, #A86F3C 88%); padding: 8px 14px 18px; border-radius: 12px; }
.shelf .treat { font-size: 34px; position: relative; }
.shelf .treat small { position: absolute; right: -6px; bottom: -4px; background: var(--pink); color: #fff; font-size: 12px; border-radius: 999px; padding: 1px 6px; font-weight: 800; }
.shelf .empty { color: var(--choc-soft); font-size: 16px; align-self: center; }

.friends { display: flex; gap: 6px; align-items: flex-end; }
.friends img { height: 60px; }

/* ---------- game ---------- */
.game-wrap { max-width: 980px; margin: 0 auto; padding: 18px 22px 40px; }
.game-top { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.game-top h1 { font-size: 30px; }
.progress { flex: 1; height: 18px; background: #fff; border-radius: 999px; box-shadow: inset 0 2px 0 #EEDFD0; overflow: hidden; }
.progress div { height: 100%; width: 0; background: linear-gradient(90deg, var(--pink), var(--caramel)); border-radius: 999px; transition: width .4s; }
.qcount { font-family: 'Fredoka', 'Nunito', sans-serif; font-weight: 600; min-width: 64px; text-align: right; }

.stage { display: grid; grid-template-columns: 170px 1fr; gap: 20px; align-items: start; }
.coach img { width: 100%; }
.coach .bubble { margin-top: 10px; font-size: 17px; }
.coach .bubble::after { left: 40px; top: -20px; border: 10px solid transparent; border-bottom: 12px solid var(--choc); }
.coach .bubble::before { left: 42px; top: -14px; border: 8px solid transparent; border-bottom: 10px solid #fff; }

.question { padding: 26px; }
.prompt { font-family: 'Fredoka', 'Nunito', sans-serif; font-size: 28px; font-weight: 600; line-height: 1.3; margin-bottom: 16px; }
.visual { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 10px; margin: 10px 0 18px; min-height: 60px; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.choice {
  border: 3px solid #F0E1D2; background: #fff; border-radius: 18px; padding: 16px 10px;
  font-family: 'Fredoka', 'Nunito', sans-serif; font-size: 26px; font-weight: 600; color: var(--choc); transition: transform .1s;
}
.choice:hover { transform: translateY(-2px); border-color: var(--caramel); }
.choice.right { background: var(--mint-soft); border-color: var(--mint); }
.choice.wrong { background: #FDE2E0; border-color: var(--red); }

.answer-row { display: flex; align-items: center; gap: 12px; justify-content: center; flex-wrap: wrap; }
.answer-box {
  min-width: 170px; height: 70px; border-radius: 18px; border: 3px solid var(--caramel); background: #fff;
  font-family: 'Fredoka', 'Nunito', sans-serif; font-size: 40px; font-weight: 600; display: grid; place-items: center; padding: 0 16px;
}
.answer-box.right { border-color: var(--mint); background: var(--mint-soft); }
.answer-box.wrong { border-color: var(--red); background: #FDE2E0; }
.unit { font-family: 'Fredoka', 'Nunito', sans-serif; font-size: 30px; font-weight: 600; }
.keypad { display: grid; grid-template-columns: repeat(3, 76px); gap: 10px; justify-content: center; margin-top: 16px; }
.key {
  height: 64px; border: 0; border-radius: 16px; background: #fff; box-shadow: 0 4px 0 #E8D8C8;
  font-family: 'Fredoka', 'Nunito', sans-serif; font-size: 30px; font-weight: 600; color: var(--choc);
}
.key:active { transform: translateY(3px); box-shadow: 0 1px 0 #E8D8C8; }
.key.go { background: var(--mint); color: #fff; box-shadow: 0 4px 0 #4FA68D; }
.key.del { background: var(--pink-soft); }

.feedback { margin-top: 16px; text-align: center; font-weight: 800; font-size: 20px; min-height: 30px; }
.next-row { text-align: center; margin-top: 12px; }

/* fraction display */
.frac { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; line-height: 1; font-family: 'Fredoka', 'Nunito', sans-serif; font-weight: 600; }
.frac span:first-child { border-bottom: 3px solid currentColor; padding: 0 6px 3px; }
.frac span:last-child { padding-top: 3px; }

/* place value blocks */
.pv { display: flex; gap: 22px; align-items: flex-end; flex-wrap: wrap; justify-content: center; }
.pv-group { display: flex; flex-wrap: wrap; gap: 6px; max-width: 320px; align-items: flex-end; justify-content: center; }
.pv-label { text-align: center; font-size: 14px; color: var(--choc-soft); font-weight: 800; margin-top: 4px; }
.tray100 { width: 62px; height: 62px; background: #F6C9A0; border: 3px solid #C98A4B; border-radius: 8px;
  display: grid; grid-template-columns: repeat(10, 1fr); gap: 1px; padding: 3px; }
.tray100 i { background: var(--pink); border-radius: 50%; }
.box10 { width: 18px; height: 62px; background: #FFE0EC; border: 3px solid var(--pink); border-radius: 6px; display: grid; grid-template-rows: repeat(10, 1fr); padding: 2px; gap: 1px; }
.box10 i { background: var(--caramel); border-radius: 50%; }
.one { font-size: 28px; }

/* sequences */
.seq { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.seq div { min-width: 74px; height: 74px; border-radius: 50%; display: grid; place-items: center; font-family: 'Fredoka', 'Nunito', sans-serif; font-size: 26px; font-weight: 600;
  background: radial-gradient(circle, #fff 0 34%, var(--pink) 35% 62%, #E86F99 63%); color: var(--choc); padding: 0 6px; }
.seq div.gap { background: radial-gradient(circle, #fff 0 46%, var(--lemon) 47% 62%, var(--caramel) 63%); color: var(--caramel-dark); }

/* sharing plates */
.plates { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }
.plate { text-align: center; }
.plate img { height: 54px; }
.plate .dish { width: 82px; height: 30px; border-radius: 50%; background: #fff; border: 3px solid #E5CDB8; margin: -4px auto 0; }
.cookie-pile { font-size: 26px; max-width: 520px; text-align: center; line-height: 1.25; }

/* coins */
.money { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: center; max-width: 640px; }
.price-tag { display: inline-block; background: var(--lemon); border-radius: 10px; padding: 4px 12px; font-family: 'Fredoka', 'Nunito', sans-serif; font-weight: 700; transform: rotate(-3deg); }
.shop-item { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; margin: 0 12px; font-size: 54px; }

/* end screen */
.end { text-align: center; padding: 30px; }
.end .big-stars { font-size: 64px; letter-spacing: 6px; margin: 10px 0; }
.end .treat-baked { font-size: 90px; animation: pop .6s ease; }
@keyframes pop { 0% { transform: scale(.2) rotate(-20deg); } 70% { transform: scale(1.15) rotate(6deg); } 100% { transform: scale(1); } }
@keyframes wiggle { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-4deg); } 75% { transform: rotate(4deg); } }
.wiggle { animation: wiggle .5s ease; }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.shake { animation: shake .35s ease; }

/* parent */
.form-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-row label { font-weight: 800; }
input[type=text], input[type=password], select {
  font-family: inherit; font-size: 18px; padding: 10px 14px; border-radius: 14px; border: 3px solid #F0E1D2; background: #fff; color: var(--choc);
}
input:focus, select:focus { outline: none; border-color: var(--caramel); }
.avatar-pick { display: flex; gap: 10px; flex-wrap: wrap; }
.avatar-pick button { width: 76px; height: 76px; border-radius: 18px; border: 3px solid #F0E1D2; background: #fff; padding: 6px; }
.avatar-pick button.on { border-color: var(--pink); background: var(--pink-soft); }
.avatar-pick img { width: 100%; height: 100%; object-fit: contain; }
table { width: 100%; border-collapse: collapse; font-size: 16px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 2px solid #F5EADF; }
th { font-family: 'Fredoka', 'Nunito', sans-serif; font-weight: 600; color: var(--choc-soft); }
.bar { height: 12px; background: #F5EADF; border-radius: 999px; overflow: hidden; min-width: 80px; }
.bar div { height: 100%; background: var(--mint); }
.kid-head { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; flex-wrap: wrap; }
.kid-head img { height: 64px; }
.pill { display: inline-block; padding: 3px 12px; border-radius: 999px; background: var(--lav-soft); font-weight: 800; font-size: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }

@media (max-width: 760px) {
  body { font-size: 16px; }
  .login-hero, .classroom-head, .stage, .grid2 { grid-template-columns: 1fr; }
  .login-hero .caby-big { max-width: 240px; margin: 0 auto; display: block; }
  .login-hero h1 { font-size: 38px; }
  .stage .coach { display: grid; grid-template-columns: 90px 1fr; gap: 10px; align-items: center; }
  .coach .bubble { margin-top: 0; }
  .coach .bubble::after, .coach .bubble::before { display: none; }
  .prompt { font-size: 22px; }
  .classroom-head .caby-desk { max-width: 220px; margin: 0 auto; display: block; }
  .classroom-head .bubble, .classroom-head .card, .classroom-head > div > div { margin-left: 0 !important; }
  .topbar { padding: 10px 12px; gap: 8px; }
  .brand { font-size: 20px; } .brand img { height: 34px; }
  .me span { display: none; }
  .game-top { flex-wrap: wrap; gap: 8px 12px; }
  .game-top h1 { font-size: 24px; }
  .game-top .progress { flex-basis: 100%; order: 3; }
  .qcount { margin-left: auto; }
  .choices { grid-template-columns: 1fr 1fr; }
  .question { padding: 18px; }
  .keypad { grid-template-columns: repeat(3, 70px); }
}

/* ---------- admin ---------- */
input[type=email], input[type=search], textarea {
  font: inherit; font-size: 17px; padding: 10px 12px; border-radius: 12px; border: 3px solid #F0E1D2; background: #fff; color: var(--choc);
}
input[type=email]:focus, input[type=search]:focus, textarea:focus { outline: none; border-color: var(--caramel); }
textarea { resize: vertical; min-height: 64px; }
.admin-table td { vertical-align: top; }
.admin-table .actions { display: flex; flex-wrap: wrap; gap: 6px; }
.admin-table .actions .btn { font-size: 14px; padding: 6px 12px; box-shadow: 0 3px 0 #E8D8C8; }
.admin-table small { color: var(--choc-soft); }
.status { display: inline-block; padding: 2px 10px; border-radius: 999px; font-weight: 800; font-size: 13px; white-space: nowrap; }
.status.on { background: var(--mint-soft); color: #2E7D66; }
.status.off { background: #F3E6E6; color: #9B4B4B; }
.status.new { background: #FFF3CC; color: #8A6A10; }
.temp-pw { background: #FFF3CC; border: 3px dashed var(--caramel); border-radius: 16px; padding: 14px 16px; margin: 14px 0; }
.temp-pw code { font-size: 22px; font-weight: 800; letter-spacing: 1px; user-select: all; }
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar h2 { font-size: 26px; flex: 1; }
