/* Consumable Bits for Kids — self-contained styles.
 * Every rule is scoped under .cbk so this file can't affect other pages. */

.cbk {
  --ink: #1d2340;
  --ink-soft: #4a5275;
  --bg: #fff8ec;
  --card: #ffffff;
  --line: #e7dcc8;
  --brand: #3a86ff;
  --good: #06a77d;
  --bad: #e63946;
  --sun: #ffb703;
  --radius: 22px;
  --shadow: 0 6px 0 rgba(29, 35, 64, 0.12);
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Nunito", ui-rounded, "SF Pro Rounded", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 18px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}
.cbk *, .cbk *::before, .cbk *::after { box-sizing: border-box; }
.cbk.explorer { font-size: 21px; }

.cbk button { font: inherit; color: inherit; cursor: pointer; }
.cbk button:focus-visible, .cbk a:focus-visible, .cbk input:focus-visible { outline: 4px solid var(--brand); outline-offset: 3px; }
.cbk h1, .cbk h2, .cbk h3 { line-height: 1.15; margin: 0 0 .4em; }
.cbk p { margin: 0 0 .8em; }
.cbk a { color: var(--brand); }

/* ---------- layout ---------- */
.cbk-top {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 16px; background: var(--card); border-bottom: 3px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.cbk-logo { font-weight: 900; font-size: 1.05em; text-decoration: none; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.cbk-logo small { font-weight: 700; color: var(--ink-soft); }
.cbk-top .grow { flex: 1; }
.cbk-pill { background: #fff3d6; border-radius: 999px; padding: 4px 12px; font-weight: 800; white-space: nowrap; }
.cbk-iconbtn { border: 0; background: #eef3ff; border-radius: 999px; min-width: 44px; height: 44px; padding: 0 12px; font-weight: 800; }
.cbk-teacherbar { background: #2b2d42; color: #fff; text-align: center; font-weight: 700; padding: 6px 12px; font-size: 15px; }
.cbk-teacherbar a { color: #ffd166; }
.cbk-trial { background: #ffd166; text-align: center; font-weight: 800; padding: 6px 12px; font-size: 15px; }

.cbk-main { max-width: 960px; margin: 0 auto; padding: 20px 16px 60px; }
.cbk-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 3px solid var(--line); padding: 22px; }
.cbk-center { text-align: center; }
.cbk-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; justify-content: center; }
.cbk-muted { color: var(--ink-soft); }
.cbk-hidden { display: none !important; }

/* ---------- buttons ---------- */
.cbk-btn {
  border: 0; border-radius: 18px; padding: 14px 26px; font-weight: 900; font-size: 1.05em;
  background: var(--brand); color: #fff; box-shadow: 0 5px 0 rgba(0,0,0,.2);
  transition: transform .08s, box-shadow .08s; min-height: 56px;
}
.cbk-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 rgba(0,0,0,.2); }
.cbk-btn[disabled] { opacity: .45; cursor: not-allowed; }
.cbk a.cbk-btn { color: #fff; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.cbk-btn.alt, .cbk a.cbk-btn.alt { background: #fff; color: var(--ink); border: 3px solid var(--line); }
.cbk-btn.good { background: var(--good); }
.cbk-btn.sun, .cbk a.cbk-btn.sun { background: var(--sun); color: var(--ink); }
.cbk-btn.small { padding: 8px 16px; min-height: 44px; font-size: .9em; }
.cbk-btn.big { font-size: 1.35em; padding: 18px 34px; }

/* ---------- home ---------- */
.cbk-hero { text-align: center; padding: 10px 0 18px; }
.cbk-hero h1 { font-size: clamp(2em, 6vw, 3em); font-weight: 900; }
.cbk-hero .chain { font-size: clamp(1.4em, 5vw, 2em); letter-spacing: .1em; margin: 8px 0 14px; }
.cbk-tracks { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; margin-top: 18px; }
.cbk-track {
  border: 4px solid var(--line); background: var(--card); border-radius: 26px; padding: 22px; text-align: center;
  box-shadow: var(--shadow); transition: transform .1s;
}
.cbk-track:hover { transform: translateY(-3px); }
.cbk-track[aria-pressed="true"] { border-color: var(--brand); background: #eef3ff; }
.cbk-track .big { font-size: 64px; display: block; }
.cbk-track b { font-size: 1.4em; display: block; }
.cbk-name { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 22px 0 6px; }
.cbk-name input {
  font: inherit; font-size: 1.2em; padding: 12px 18px; border-radius: 16px; border: 3px solid var(--line);
  text-align: center; width: min(320px, 100%);
}

/* ---------- map ---------- */
.cbk-map { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px; }
.cbk-stop {
  position: relative; border: 4px solid var(--line); border-radius: 26px; background: var(--card);
  padding: 18px; text-align: left; box-shadow: var(--shadow); display: flex; gap: 14px; align-items: center; min-height: 110px;
}
.cbk-stop .em { font-size: 48px; width: 72px; height: 72px; border-radius: 22px; display: grid; place-items: center; flex: none; }
.cbk-stop .num { font-weight: 900; color: var(--ink-soft); font-size: .8em; text-transform: uppercase; letter-spacing: .06em; }
.cbk-stop b { display: block; font-size: 1.2em; }
.cbk-stop .badge { position: absolute; top: -12px; right: -8px; font-size: 34px; }
.cbk-stop[disabled] { filter: grayscale(1); opacity: .55; }
.cbk-stop.next { border-color: var(--brand); animation: cbk-pulse 1.6s infinite; }
@keyframes cbk-pulse { 50% { box-shadow: 0 0 0 8px rgba(58,134,255,.25), var(--shadow); } }

/* ---------- station ---------- */
.cbk-stationhead { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.cbk-stationhead .em { font-size: 40px; }
.cbk-stationhead h2 { margin: 0; }
.cbk-dots { display: flex; gap: 6px; margin-left: auto; }
.cbk-dots i { width: 16px; height: 16px; border-radius: 50%; background: var(--line); display: block; }
.cbk-dots i.on { background: var(--brand); }
.cbk-dots i.done { background: var(--good); }

.cbk-stage { min-height: 380px; }
.cbk-say { display: inline-flex; align-items: center; gap: 6px; }
.cbk-prompt { font-size: 1.25em; font-weight: 900; text-align: center; margin: 0 0 14px; }
.cbk-feedback { min-height: 2.4em; text-align: center; font-weight: 800; font-size: 1.1em; margin: 12px 0; }
.cbk-feedback.good { color: var(--good); }
.cbk-feedback.bad { color: var(--bad); }
.cbk-nextbar { display: flex; justify-content: center; gap: 12px; margin-top: 18px; flex-wrap: wrap; }

/* slides */
.cbk-slide { text-align: center; padding: 10px 0; }
.cbk-slide .em { font-size: 96px; display: block; animation: cbk-pop .4s; }
.cbk-slide h3 { font-size: 1.6em; }
.cbk-slide p { font-size: 1.15em; max-width: 620px; margin: 0 auto 12px; }

/* choice buttons */
.cbk-choices { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); max-width: 720px; margin: 0 auto; }
.cbk-choice {
  border: 3px solid var(--line); background: var(--card); border-radius: 18px; padding: 16px; font-weight: 800; font-size: 1.1em;
  box-shadow: 0 4px 0 rgba(0,0,0,.08); min-height: 64px;
}
.cbk-choice.right { background: #d8f8ec; border-color: var(--good); }
.cbk-choice.wrong { background: #ffe1e3; border-color: var(--bad); }

/* circuit svg */
.cbk-circuit { width: 100%; max-width: 460px; display: block; margin: 0 auto; }
.cbk-circuit .wire { stroke: #4a5275; stroke-width: 8; stroke-linecap: round; fill: none; }
.cbk-circuit.lit .wire { stroke: #f4a100; stroke-dasharray: 2 18; animation: cbk-flow .6s linear infinite; }
.cbk-circuit .bulb { fill: #dfe3ee; stroke: #4a5275; stroke-width: 4; }
.cbk-circuit.lit .bulb { fill: #ffe066; filter: drop-shadow(0 0 18px #ffd60a); }
.cbk-circuit .glow { opacity: 0; }
.cbk-circuit.lit .glow { opacity: 1; }
.cbk-circuit .switch { cursor: pointer; }
.cbk-circuit text { font: 800 16px system-ui, sans-serif; fill: #4a5275; }
@keyframes cbk-flow { to { stroke-dashoffset: -20; } }

.cbk-toggles { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin: 12px 0; }
.cbk-toggle { border: 3px solid var(--line); background: #fff; border-radius: 16px; padding: 10px 18px; font-weight: 900; min-height: 56px; }
.cbk-toggle[aria-pressed="true"] { background: #d8f8ec; border-color: var(--good); }

/* sorter */
.cbk-item { font-size: 96px; text-align: center; animation: cbk-pop .35s; }
.cbk-item-name { text-align: center; font-weight: 900; font-size: 1.4em; margin-bottom: 14px; }
.cbk-bins { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; max-width: 620px; margin: 0 auto; }
.cbk-bin { border: 4px dashed var(--line); border-radius: 20px; padding: 10px; min-height: 80px; text-align: center; font-size: 26px; }
.cbk-bin h4 { font-size: 16px; margin: 0 0 6px; }

/* bulbs */
.cbk-bulbs { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin: 10px 0; }
.cbk-bulb {
  width: 76px; height: 96px; border-radius: 40px 40px 20px 20px; border: 4px solid #4a5275; background: #2b2d42;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding-bottom: 6px;
  color: #fff; font-weight: 900; font-size: 26px; transition: background .15s, box-shadow .15s;
}
.cbk-bulb.on { background: #ffe066; color: var(--ink); box-shadow: 0 0 26px #ffd60a; }
.cbk-bulb.target { cursor: default; }
.cbk-bulb.hidden-light { background: #fff; color: var(--ink); border-style: dashed; }
.cbk-label { text-align: center; font-weight: 800; color: var(--ink-soft); }

/* binary cards */
.cbk-cards { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.cbk-bcard {
  width: 104px; min-height: 150px; border-radius: 16px; border: 4px solid #4a5275; background: #2b2d42; color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 8px 6px;
  transition: transform .2s, background .2s;
}
.cbk-bcard.on { background: #fff; color: var(--ink); transform: rotateY(360deg); }
.cbk-bcard .dots { display: flex; flex-wrap: wrap; gap: 3px; justify-content: center; align-content: center; flex: 1; }
.cbk-bcard .dots i { width: 10px; height: 10px; border-radius: 50%; background: #ff4d6d; display: block; }
.cbk-bcard:not(.on) .dots { visibility: hidden; }
.cbk-bcard .val { font-weight: 900; font-size: 1.3em; }
.cbk-bcard .bit { font-weight: 900; font-size: 1.6em; }
.cbk-sum { text-align: center; font-size: 1.4em; font-weight: 900; margin: 12px 0; }
.cbk-target { display: inline-block; background: var(--sun); border-radius: 14px; padding: 2px 14px; }

/* be a bit */
.cbk-bigbit { font-size: 180px; font-weight: 900; text-align: center; line-height: 1; animation: cbk-pop .3s; }
.cbk-bigbit.one { color: var(--good); }
.cbk-bigbit.zero { color: var(--bad); }

/* pixel grid */
.cbk-pixwrap { display: flex; gap: 18px; justify-content: center; align-items: flex-start; flex-wrap: wrap; }
.cbk-pix { display: grid; gap: 3px; }
.cbk-pixrow { display: flex; gap: 3px; align-items: center; }
.cbk-px { width: 52px; height: 52px; border-radius: 8px; border: 2px solid #cfd4e2; background: #fff; padding: 0; }
.cbk-px.on { border-color: transparent; }
.cbk-px.oops { outline: 4px solid var(--bad); outline-offset: -4px; }
.cbk-code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-weight: 800; font-size: 1.2em; letter-spacing: .25em; min-width: 7em; }
.cbk-code .one { color: var(--good); }
.cbk-code .zero { color: #aab; }
.inventor .cbk-px { width: 38px; height: 38px; }

/* secret message */
.cbk-letters { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin: 14px 0; }
.cbk-letter { display: flex; flex-direction: column; align-items: center; gap: 6px; background: #f3f0ff; border-radius: 16px; padding: 10px; }
.cbk-letter .cbk-code { letter-spacing: .1em; min-width: 0; }
.cbk-letter input { width: 64px; height: 64px; font: inherit; font-size: 1.8em; font-weight: 900; text-align: center; text-transform: uppercase; border-radius: 14px; border: 3px solid var(--line); }
.cbk-letter input.right { border-color: var(--good); background: #d8f8ec; }
.cbk-letter input.wrong { border-color: var(--bad); background: #ffe1e3; }
.cbk-abc { display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); gap: 6px; font-size: 14px; max-width: 720px; margin: 10px auto 0; }
.cbk-abc span { background: #fff; border: 2px solid var(--line); border-radius: 10px; text-align: center; padding: 2px; }
.cbk-abc b { display: block; font-size: 18px; }

/* robot */
.cbk-robotwrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 720px) { .cbk-robotwrap { grid-template-columns: 1fr; } }
.cbk-grid { display: grid; gap: 4px; background: #c9e4ca; padding: 6px; border-radius: 18px; width: 100%; max-width: 420px; margin: 0 auto; aspect-ratio: 1; }
.cbk-cell { background: #e9f5db; border-radius: 10px; display: grid; place-items: center; font-size: clamp(20px, 5vw, 40px); position: relative; }
.cbk-cell.trail { background: #fff3b0; }
.cbk-cell.bump { background: #ffcad4; animation: cbk-shake .4s; }
.cbk-bot { transition: transform .2s; }
.cbk-program { min-height: 74px; border: 3px dashed var(--line); border-radius: 16px; padding: 8px; display: flex; flex-wrap: wrap; gap: 6px; align-content: flex-start; background: #fff; }
.cbk-program:empty::before { content: "Your code goes here…"; color: var(--ink-soft); padding: 10px; }
.cbk-block { border: 0; border-radius: 12px; background: #3a86ff; color: #fff; font-size: 26px; padding: 4px 10px; min-width: 52px; min-height: 52px; font-weight: 900; }
.cbk-block .times { font-size: 16px; vertical-align: middle; margin-left: 2px; }
.cbk-block.running { background: var(--sun); transform: scale(1.12); }
.cbk-arrows { display: grid; grid-template-columns: repeat(3, 72px); grid-template-rows: repeat(2, 72px); gap: 8px; justify-content: center; margin: 12px 0; }
.cbk-arrows button { border: 0; border-radius: 16px; background: #eef3ff; font-size: 34px; box-shadow: 0 4px 0 rgba(0,0,0,.12); }
.cbk-arrows .up { grid-column: 2; grid-row: 1; }
.cbk-arrows .left { grid-column: 1; grid-row: 2; }
.cbk-arrows .down { grid-column: 2; grid-row: 2; }
.cbk-arrows .right { grid-column: 3; grid-row: 2; }
.cbk-levelbar { display: flex; gap: 8px; justify-content: center; margin-bottom: 10px; flex-wrap: wrap; }
.cbk-levelbar span { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; background: var(--line); }
.cbk-levelbar span.on { background: var(--brand); color: #fff; }
.cbk-levelbar span.done { background: var(--good); color: #fff; }

/* ordering */
.cbk-tiles { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin: 12px 0; }
.cbk-tile { border: 3px solid var(--line); background: #fff; border-radius: 18px; padding: 12px; width: 150px; min-height: 130px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-weight: 800; box-shadow: 0 4px 0 rgba(0,0,0,.08); }
.cbk-tile .em { font-size: 48px; }
.cbk-tile.placed { background: #d8f8ec; border-color: var(--good); }
.cbk-tile.shake { animation: cbk-shake .4s; border-color: var(--bad); }
.cbk-slots { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; padding: 10px; border-radius: 18px; background: #f3f0ff; min-height: 150px; align-items: center; }
.cbk-slots .num { font-weight: 900; color: var(--ink-soft); }

/* number guess */
.cbk-range { height: 30px; background: #eee; border-radius: 15px; position: relative; overflow: hidden; margin: 14px 0 4px; }
.cbk-range i { position: absolute; top: 0; bottom: 0; background: linear-gradient(90deg, #8338ec, #3a86ff); transition: left .4s, width .4s; }
.cbk-range-labels { display: flex; justify-content: space-between; font-weight: 800; color: var(--ink-soft); font-size: .9em; }
.cbk-guess { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.cbk-guess input { width: 120px; font: inherit; font-size: 1.6em; font-weight: 900; text-align: center; border-radius: 14px; border: 3px solid var(--line); }
.cbk-log { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 10px; }
.cbk-log span { background: #eef3ff; border-radius: 10px; padding: 2px 10px; font-weight: 800; }

/* bubble sort */
.cbk-bubble { display: flex; align-items: flex-end; justify-content: center; gap: 4px; flex-wrap: wrap; margin: 16px 0; }
.cbk-bar { width: 58px; border-radius: 12px 12px 6px 6px; background: #8338ec; color: #fff; font-weight: 900; font-size: 1.4em; display: flex; align-items: flex-start; justify-content: center; padding-top: 6px; transition: height .3s; }
.cbk-swap { border: 0; background: #ffd166; border-radius: 12px; width: 40px; height: 44px; font-size: 20px; font-weight: 900; align-self: center; }

/* summary */
.cbk-journey { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; margin: 14px 0; }
.cbk-journey .step { background: #fff; border: 3px solid var(--line); border-radius: 18px; padding: 10px 14px; text-align: center; min-width: 120px; }
.cbk-journey .step .em { font-size: 40px; display: block; }
.cbk-journey .arrow { font-size: 26px; color: var(--ink-soft); }
.cbk-learnlist { max-width: 720px; margin: 0 auto; padding: 0; list-style: none; }
.cbk-learnlist li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 2px dashed var(--line); }
.cbk-learnlist .em { font-size: 30px; }
.cbk-cert { border: 10px double var(--sun); border-radius: 24px; padding: 26px; text-align: center; background: #fffdf5; margin: 20px auto; max-width: 720px; }
.cbk-cert h2 { font-size: 2em; }
.cbk-cert .who { font-size: 2.2em; font-weight: 900; color: var(--brand); border-bottom: 3px solid var(--line); display: inline-block; padding: 0 20px; min-width: 200px; }

/* confetti + animations */
.cbk-confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 50; }
.cbk-confetti i { position: absolute; top: -20px; width: 12px; height: 16px; border-radius: 3px; animation: cbk-fall 1.6s ease-in forwards; }
@keyframes cbk-fall { to { transform: translateY(110vh) rotate(720deg); opacity: .7; } }
@keyframes cbk-pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes cbk-shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.cbk-stars { font-size: 44px; text-align: center; letter-spacing: 6px; }

@media (prefers-reduced-motion: reduce) {
  .cbk *, .cbk *::before, .cbk *::after { animation: none !important; transition: none !important; }
}

/* ---------- teacher page ---------- */
.cbk.teacher { font-size: 17px; background: #f6f7fb; }
.cbk.teacher .cbk-main { max-width: 1100px; }
.cbk.teacher section { margin: 22px 0; }
.cbk.teacher h2 { font-size: 1.5em; border-bottom: 3px solid var(--line); padding-bottom: 6px; }
.cbk-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 14px; overflow: hidden; }
.cbk-table th, .cbk-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.cbk-table th { background: #eef0f7; }
.cbk-tablewrap { overflow-x: auto; }
.cbk-launch { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.cbk-launch .cbk-card { padding: 16px; }
.cbk-launch .cbk-row { justify-content: flex-start; }
.cbk-key { background: #fff; border-radius: 14px; padding: 14px 18px; border: 2px solid var(--line); margin: 10px 0; }
.cbk-key h3 { font-size: 1.1em; }
.cbk-key code { background: #f1f1f8; padding: 1px 6px; border-radius: 6px; }
.cbk-timer { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.cbk-timer .clock { font-size: 2.4em; font-weight: 900; font-variant-numeric: tabular-nums; }
.cbk-switch { display: inline-flex; gap: 10px; align-items: center; font-weight: 800; }
.cbk-switch input { width: 26px; height: 26px; }

@media print {
  .cbk-top, .cbk-teacherbar, .cbk-trial, .cbk-noprint, .cbk-nextbar { display: none !important; }
  .cbk { background: #fff; }
  .cbk-card { box-shadow: none; }
}

/* Button text colours: beat the generic `.cbk button { color: inherit }` rule. */
.cbk .cbk-btn { color: #fff; }
.cbk .cbk-btn.alt, .cbk .cbk-btn.sun { color: var(--ink); }
#login-form input { width: 100%; }
