/* KidZone platform UI: layout, forms, tables, dashboards (loaded after style.css) */
.page { max-width: 1120px; margin: 0 auto; padding: 24px 16px 56px; }
.page-narrow { max-width: 560px; }
.page-mid { max-width: 820px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.page-head h1 { font-size: clamp(28px, 4.5vw, 40px); margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--ink-soft); }
.crumb { display: inline-block; margin-bottom: 6px; font-weight: 800; font-size: 14px; color: var(--ink-soft); text-decoration: none; }
.crumb:hover { color: var(--ink); }
.section { margin-top: 28px; }
.section > h2, .box > h2 { font-size: 24px; margin-bottom: 12px; }
.box { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.box + .box { margin-top: 18px; }
.box h3 { font-size: 19px; }
.cols { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
.cols-3 { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); align-items: start; }
.main-side { display: grid; gap: 18px; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); align-items: start; }
@media (max-width: 860px) { .main-side { grid-template-columns: minmax(0, 1fr); } }
.main-side > *, .cols > *, .cols-3 > *, .stat-row > * { min-width: 0; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.row-between { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.small { font-size: 14px; }
.tiny { font-size: 12px; }
.bold { font-weight: 800; }
.nowrap { white-space: nowrap; }
.mt0 { margin-top: 0; }
.empty-note { color: var(--ink-soft); font-weight: 700; text-align: center; padding: 18px 8px; }

/* nav */
.site-nav { overflow-x: auto; scrollbar-width: none; }
.site-nav::-webkit-scrollbar { display: none; }
.site-nav a { white-space: nowrap; }
.site-nav a.is-on { background: var(--ink); color: #fff; }
.user-chip { display: flex; align-items: center; gap: 8px; font-weight: 800; white-space: nowrap; }
.user-chip .avatar-sm { font-size: 22px; }
.coin-pill { display: inline-flex; align-items: center; gap: 4px; background: #FFF4C2; border: 2px solid var(--gold); border-radius: 999px; padding: 2px 10px; font-weight: 800; font-size: 14px; }
.logout-form { margin: 0; }
.link-btn { background: none; border: 0; padding: 6px 8px; font-weight: 800; cursor: pointer; color: var(--ink-soft); text-decoration: underline; }
@media (max-width: 760px) {
  .site-header { flex-wrap: wrap; }
  .site-nav { order: 3; width: 100%; }
  .user-chip .who { display: none; }
}

/* flash + alerts */
.flash { max-width: 1120px; margin: 16px auto 0; padding: 0 16px; }
.alert { border-radius: 14px; padding: 12px 16px; font-weight: 700; border: 2px solid; }
.alert-success { background: #E7F8EC; border-color: #9BD8AE; color: #0D5A27; }
.alert-error { background: #FFEDEA; border-color: #FFB4A8; color: #8A2318; }
.alert-info { background: #E6F5FD; border-color: #9ED6F2; color: #0D4A6B; }

/* forms */
.form { display: grid; gap: 14px; }
.form .field { font-size: 15px; }
.field input[type=text], .field input[type=email], .field input[type=password], .field input[type=number], .field input[type=date],
.field input[type=search], .field select, .field textarea, .input {
  font: inherit; font-weight: 600; width: 100%;
  padding: 11px 14px; border-radius: 12px; border: 2px solid var(--line); background: #fff; color: var(--ink);
}
.field textarea { min-height: 110px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { outline: none; border-color: var(--sky); }
.field .hint { font-weight: 600; color: var(--ink-soft); font-size: 13px; }
.form-row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.check-row { display: flex; flex-wrap: wrap; gap: 8px; }
.check-pill { display: inline-flex; align-items: center; gap: 6px; border: 2px solid var(--line); border-radius: 999px; padding: 6px 12px; font-weight: 800; cursor: pointer; background: #fff; }
.check-pill:has(input:checked) { border-color: var(--green); background: #EFFAF2; }
.check-pill input { accent-color: var(--green); }
.btn-danger { background: #fff; color: #B42318; box-shadow: 0 4px 0 #F3C2BC; }
.btn-block { width: 100%; }
.inline-form { display: inline; margin: 0; }

/* auth */
.auth-card { max-width: 480px; margin: 32px auto; }
.tabs { display: flex; gap: 6px; background: #F4EBD3; padding: 6px; border-radius: 999px; margin-bottom: 18px; overflow-x: auto; }
.tabs a, .tabs button { flex: 1; text-align: center; white-space: nowrap; border: 0; background: none; cursor: pointer; padding: 9px 14px; border-radius: 999px; font-weight: 800; text-decoration: none; }
.tabs .is-on { background: #fff; box-shadow: 0 2px 0 rgba(0, 0, 0, .08); }
.choice-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.choice { display: block; text-decoration: none; background: #fff; border: 3px solid var(--line); border-radius: 20px; padding: 22px; transition: transform .15s; }
.choice:hover { transform: translateY(-3px); border-color: var(--green); }
.choice .big-icon { font-size: 48px; }
.choice strong { display: block; font-family: var(--font-head); font-size: 22px; }
.choice span { color: var(--ink-soft); }
.avatar-pick { display: flex; gap: 10px; flex-wrap: wrap; }
.avatar-pick label { cursor: pointer; position: relative; }
.avatar-pick input { position: absolute; opacity: 0; pointer-events: none; }
.avatar-pick span { display: grid; place-items: center; width: 60px; height: 60px; font-size: 34px; border-radius: 50%; border: 3px solid var(--line); background: #fff; }
.avatar-pick input:checked + span { border-color: var(--green); background: #EFFAF2; transform: scale(1.08); }
.avatar-pick input:focus-visible + span { outline: 3px solid var(--sky); outline-offset: 2px; }
.pupil-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.pupil-tile { display: grid; justify-items: center; gap: 6px; padding: 16px 8px; background: #fff; border: 3px solid var(--line); border-radius: 18px; cursor: pointer; font-weight: 800; text-align: center; }
.pupil-tile .avatar-lg { font-size: 44px; line-height: 1; }
.pupil-tile.is-on { border-color: var(--green); background: #EFFAF2; }
.pin-pad { display: grid; grid-template-columns: repeat(3, 72px); gap: 10px; justify-content: center; margin: 16px 0; }
.pin-pad button { height: 64px; border-radius: 18px; border: 2px solid var(--line); background: #fff; font-family: var(--font-head); font-size: 28px; font-weight: 800; cursor: pointer; box-shadow: 0 3px 0 rgba(0, 0, 0, .08); }
.pin-pad button:active { transform: translateY(2px); }
.pin-dots { display: flex; justify-content: center; gap: 12px; margin-top: 8px; }
.pin-dots span { width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--ink-soft); }
.pin-dots span.on { background: var(--green); border-color: var(--green); }
.code-input { font-family: var(--font-head) !important; font-size: 30px !important; letter-spacing: 6px; text-align: center; text-transform: uppercase; }

/* tables */
.table-wrap { overflow-x: auto; border-radius: 14px; border: 2px solid var(--line); background: #fff; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #F1EAD7; vertical-align: middle; }
.table th { background: #FBF6E9; font-size: 13px; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-soft); white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table td.num, .table th.num { text-align: right; }
.table a { font-weight: 800; }
.table .center { text-align: center; }
.cell-done { background: #E7F8EC; font-weight: 800; }
.cell-low { background: #FFEDEA; font-weight: 800; }
.cell-open { color: var(--ink-soft); }

/* status pills */
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; background: #F1EAD7; white-space: nowrap; }
.pill-green { background: #D9F4E1; color: #0D5A27; }
.pill-gold { background: #FFF1B8; color: #6B5300; }
.pill-red { background: #FFDCD6; color: #8A2318; }
.pill-blue { background: #D7EFFC; color: #0D4A6B; }

/* stats */
.stat-row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stat { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.stat .n { font-family: var(--font-head); font-size: 34px; font-weight: 800; line-height: 1.1; }
.stat .l { color: var(--ink-soft); font-weight: 800; font-size: 14px; }
.bar { height: 14px; background: #F1EAD7; border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: inherit; background: var(--accent, var(--green)); }
.bar-row { display: grid; grid-template-columns: 140px 1fr 48px; gap: 10px; align-items: center; font-weight: 800; font-size: 15px; }
.bar-row + .bar-row { margin-top: 10px; }
.bar-row .pct { text-align: right; }
@media (max-width: 480px) { .bar-row { grid-template-columns: 100px 1fr 40px; font-size: 13px; } }
.spark { display: flex; align-items: flex-end; gap: 4px; height: 70px; }
.spark span { flex: 1; background: var(--sky); border-radius: 4px 4px 0 0; min-height: 3px; }
.spark span.zero { background: #F1EAD7; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .icon { font-size: 26px; width: 36px; text-align: center; flex: none; }
.list a { text-decoration: none; }
.list a:hover { text-decoration: underline; }

/* pupil home */
.hello { border-radius: 24px; padding: 22px; display: flex; flex-wrap: wrap; gap: 18px; align-items: center; color: var(--ink); box-shadow: var(--shadow); }
.hello .me-avatar { width: 96px; height: 96px; border-radius: 50%; background: rgba(255, 255, 255, .75); display: grid; place-items: center; font-size: 60px; flex: none; }
.hello h1 { font-size: clamp(28px, 5vw, 40px); margin: 0; }
.hello .level-box { flex: 1; min-width: 220px; background: rgba(255, 255, 255, .85); border-radius: 18px; padding: 12px 16px; }
.hello .level-box .bar { margin: 6px 0; }
.me-stats { display: flex; gap: 10px; flex-wrap: wrap; }
.me-stats span { background: rgba(255, 255, 255, .88); border-radius: 999px; padding: 6px 14px; font-weight: 800; }
.task-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 16px; background: #fff; border: 3px solid var(--line); text-decoration: none; }
.task-card:hover { border-color: var(--green); }
.task-card + .task-card { margin-top: 10px; }
.task-card .icon { font-size: 34px; }
.task-card .due { margin-left: auto; text-align: right; font-size: 13px; font-weight: 800; color: var(--ink-soft); }
.task-card .due.late { color: #B42318; }
.shout { background: linear-gradient(135deg, #FFF6D6, #FFE9A8); border-radius: 18px; padding: 14px 16px; font-weight: 700; }
.shout + .shout { margin-top: 10px; }
.board li .rank { width: 28px; font-family: var(--font-head); font-weight: 800; font-size: 20px; text-align: center; }
.board li.me { background: #EFFAF2; border-radius: 12px; padding-left: 8px; }

/* badges + shop */
.badge-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.badge { text-align: center; background: #fff; border-radius: 18px; padding: 16px 10px; border: 3px solid var(--line); }
.badge .b-icon { font-size: 44px; line-height: 1; display: block; margin-bottom: 6px; }
.badge strong { display: block; font-family: var(--font-head); font-size: 18px; }
.badge span { display: block; font-size: 13px; color: var(--ink-soft); font-weight: 700; }
.badge.locked { opacity: .5; filter: grayscale(1); }
.badge.got { border-color: var(--gold); background: #FFFBEA; }
.shop-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.shop-item { text-align: center; background: #fff; border-radius: 18px; padding: 14px 10px; border: 3px solid var(--line); display: grid; gap: 6px; justify-items: center; }
.shop-item .s-icon { font-size: 46px; line-height: 1; }
.shop-item .swatch { width: 64px; height: 46px; border-radius: 12px; border: 3px solid #fff; box-shadow: 0 0 0 2px var(--line); }
.shop-item.equipped { border-color: var(--green); background: #EFFAF2; }
.shop-item form { margin: 0; }

/* teacher */
.class-card { display: block; text-decoration: none; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; border-top: 8px solid var(--green); transition: transform .15s; }
.class-card:hover { transform: translateY(-2px); }
.class-card h3 { margin: 0 0 4px; font-size: 22px; }
.code-tag { font-family: var(--font-head); font-weight: 800; letter-spacing: 3px; background: var(--gold); padding: 2px 10px; border-radius: 8px; white-space: nowrap; }
.ctabs { display: flex; gap: 4px; border-bottom: 3px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.ctabs a { padding: 10px 16px; font-weight: 800; text-decoration: none; border-radius: 12px 12px 0 0; white-space: nowrap; color: var(--ink-soft); }
.ctabs a.is-on { background: #fff; color: var(--ink); box-shadow: 0 -3px 0 var(--green) inset; }
.login-cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.login-card { border: 2px dashed #999; border-radius: 14px; padding: 14px; background: #fff; break-inside: avoid; }
.login-card .lc-head { display: flex; align-items: center; gap: 10px; }
.login-card .lc-head span { font-size: 34px; }
.login-card dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 10px 0 0; font-size: 15px; }
.login-card dt { color: #666; font-weight: 700; }
.login-card dd { margin: 0; font-weight: 800; font-family: ui-monospace, 'Courier New', monospace; }
@media print {
  .site-header, .flag-strip, .site-footer, .no-print, .flash { display: none !important; }
  body { background: #fff; }
  .page { padding: 0; max-width: none; }
  .login-cards { grid-template-columns: repeat(3, 1fr); }
}

/* activity builder */
.builder-item { border: 2px solid var(--line); border-radius: 16px; padding: 14px; background: #FFFCF3; }
.builder-item + .builder-item { margin-top: 12px; }
.builder-item .row-between { margin-bottom: 8px; }
.opt-line { display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: center; }
.opt-line + .opt-line { margin-top: 6px; }
.opt-line input[type=radio] { width: 20px; height: 20px; accent-color: var(--green); }

/* player */
.play-bar { max-width: 820px; margin: 16px auto 0; padding: 0 16px; }
.reward-box { margin-top: 18px; padding: 16px; border-radius: 18px; background: linear-gradient(135deg, #FFF6D6, #FFE9A8); text-align: center; }
.reward-box .gains { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin: 8px 0; }
.reward-box .gains span { background: #fff; border-radius: 999px; padding: 6px 14px; font-weight: 800; }
.reward-box .new-badge { display: inline-flex; align-items: center; gap: 8px; background: #fff; border-radius: 14px; padding: 8px 12px; margin: 4px; font-weight: 800; }
.reward-box .new-badge span { font-size: 28px; }

/* spelling + online worksheets */
.spell-input { font-family: var(--font-head) !important; font-size: 32px !important; text-align: center; letter-spacing: 3px; max-width: 420px; margin: 0 auto; display: block; }
.answer-input { width: 110px; font: inherit; font-family: ui-monospace, 'Courier New', monospace; font-size: 18px; padding: 4px 6px; border: 2px solid var(--line); border-radius: 8px; text-align: right; margin-top: 4px; }
.answer-input.ok { border-color: var(--green); background: #E7F8EC; }
.answer-input.no { border-color: var(--coral); background: #FFEDEA; }
.prob .fix { display: block; font-size: 13px; color: #B42318; font-weight: 800; font-family: var(--font-body); }

/* landing */
.feature-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.feature { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.feature .big-icon { font-size: 44px; }
.feature h3 { font-size: 22px; }
.feature ul { margin: 8px 0 0; padding-left: 20px; color: var(--ink-soft); font-weight: 600; }
.cta-band { background: var(--ink); color: #fff; border-radius: 24px; padding: 28px; display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; }
.cta-band h2 { margin: 0; color: var(--gold); }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
body { min-height: 100vh; display: flex; flex-direction: column; }
body > main { flex: 1 0 auto; width: 100%; }
