@font-face { font-family: "Alte Haas Grotesk"; src: url("../fonts/AlteHaasGrotesk-Bold.woff2") format("woff2"); font-weight: 400 900; font-style: normal; font-display: swap; }
/* Code with Byte Elementary: shared styles for the kids courses */
:root {
  --ink: #1b1d24; --paper: #fffdf6; --sky: #bfe6ff; --grass: #7ccf5b;
  --move: #2f7fe8; --turn: #8a5cf6; --loop: #f59e0b; --logic: #e8457a; --act: #16a34a; --event: #0ea5a4; --sense: #0891b2;
  --gold: #ffc93c; --edge: #1b1d24; --drop: #1b1d24;
  --f-body: "Alte Haas Grotesk", "Nunito", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --f-pixel: "Silkscreen", "Courier New", monospace;
  --f-code: "JetBrains Mono", "Menlo", "Consolas", monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #dff3ff; color: var(--ink); font-family: var(--f-body); -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
.k-app { display: grid; grid-template-rows: auto 1fr; grid-template-columns: minmax(0, 1fr); height: 100vh; height: 100dvh; }
.k-top { min-width: 0; }

/* top bar */
.k-top { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: #1d3557; color: #fff; border-bottom: 4px solid var(--edge); min-height: 64px; }
.k-home { display: grid; place-items: center; width: 48px; height: 48px; border: 3px solid var(--edge); border-radius: 12px; background: var(--gold); color: var(--ink); box-shadow: 0 4px 0 var(--drop); text-decoration: none; font-size: 24px; flex: none; }
.k-title { display: flex; flex-direction: column; min-width: 0; }
.k-title b { font: 700 16px var(--f-pixel); letter-spacing: .04em; white-space: nowrap; }
.k-title span { font-size: 13px; opacity: .85; white-space: nowrap; }
.k-worlds { display: flex; gap: 8px; margin-left: 10px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; padding: 4px 2px 8px; }
.k-world { display: flex; align-items: center; gap: 4px; padding: 4px 6px; border-radius: 12px; background: rgba(255, 255, 255, .12); flex: none; }
.k-world .wn { font-size: 20px; margin: 0 2px; }
.k-dot { position: relative; width: 36px; height: 36px; border: 3px solid var(--edge); border-radius: 50%; background: #fff; color: var(--ink); font: 800 14px var(--f-body); box-shadow: 0 3px 0 var(--drop); padding: 0; }
.k-dot.lock { background: #9aa6b8; color: #44506a; cursor: not-allowed; box-shadow: 0 3px 0 #44506a; }
.k-dot.done { background: #b9f6ca; }
.k-dot.on { background: var(--gold); transform: scale(1.12); }
.k-dot i { position: absolute; left: 50%; bottom: -9px; transform: translateX(-50%); font-style: normal; font-size: 9px; letter-spacing: -1px; white-space: nowrap; color: var(--gold); text-shadow: 0 1px 0 #000; }
.k-tools { display: flex; gap: 8px; flex: none; }
.k-tool { display: grid; place-items: center; width: 48px; height: 48px; border: 3px solid var(--edge); border-radius: 12px; background: #fff; box-shadow: 0 4px 0 var(--drop); font-size: 22px; padding: 0; }
.k-tool[aria-pressed="false"] { background: #c9d1dd; opacity: .8; }
.k-tool:active, .k-home:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--drop); }

/* main area: palette | workspace | stage */
.k-main { display: grid; grid-template-columns: 252px minmax(0, 1fr) minmax(0, 1.15fr); min-height: 0; }
.k-pal { display: flex; flex-direction: column; gap: 10px; padding: 12px 10px 90px; background: #ffe58a; border-right: 4px solid var(--edge); overflow-y: auto; }
.k-pal h4 { margin: 2px 4px 0; font: 700 11px var(--f-pixel); letter-spacing: .08em; color: #7a5a00; }
.k-ws { position: relative; padding: 14px 14px 120px; background: #fffdf6 radial-gradient(#e7e1cf 1.4px, transparent 1.5px) 0 0 / 22px 22px; overflow: auto; border-right: 4px solid var(--edge); touch-action: none; }
.k-stagewrap { display: flex; flex-direction: column; min-height: 0; background: #b7e4ff; }

/* goal ribbon */
.k-goal { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: #fff; border-bottom: 4px solid var(--edge); }
.k-goal .gi { font-size: 30px; flex: none; animation: k-bob 1.6s ease-in-out infinite; }
.k-goal .gt { flex: 1; font-weight: 900; font-size: 20px; line-height: 1.2; }
.k-goal .gn { font: 700 11px var(--f-pixel); color: #5b6170; display: block; margin-bottom: 2px; letter-spacing: .06em; }
.k-say { width: 44px; height: 44px; border: 3px solid var(--edge); border-radius: 50%; background: #c7f0ff; font-size: 20px; box-shadow: 0 3px 0 var(--drop); flex: none; padding: 0; }

.k-stage { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; padding: 10px; overflow: hidden; }
.k-stage canvas { max-width: 100%; max-height: 100%; image-rendering: pixelated; border: 4px solid var(--edge); border-radius: 14px; box-shadow: 0 6px 0 rgba(0, 0, 0, .25); background: #7ccf5b; }
.k-bubble { position: absolute; left: 50%; top: 18px; transform: translateX(-50%); padding: 10px 16px; background: #fff; border: 3px solid var(--edge); border-radius: 16px; font-weight: 900; font-size: 20px; box-shadow: 0 4px 0 var(--drop); white-space: nowrap; pointer-events: none; animation: k-pop .25s ease-out both; }
.k-bubble[hidden] { display: none; }

/* controls */
.k-ctl { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 10px; background: #1d3557; border-top: 4px solid var(--edge); }
.k-play { display: grid; place-items: center; width: 76px; height: 76px; border: 4px solid var(--edge); border-radius: 50%; background: #22c55e; color: #fff; font-size: 34px; box-shadow: 0 6px 0 var(--drop); padding: 0; }
.k-play.stop { background: #ef4444; }
.k-play:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--drop); }
.k-small { display: grid; place-items: center; width: 56px; height: 56px; border: 3px solid var(--edge); border-radius: 50%; background: #fff; font-size: 24px; box-shadow: 0 4px 0 var(--drop); padding: 0; }
.k-small:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--drop); }
.k-small[aria-pressed="true"] { background: var(--gold); }

/* blocks */
.blk { position: relative; display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 6px 12px 6px 10px; border: 3px solid var(--edge); border-radius: 12px; color: #fff; font: 800 16px var(--f-code); box-shadow: 0 4px 0 rgba(0, 0, 0, .35); user-select: none; -webkit-user-select: none; cursor: grab; touch-action: none; white-space: nowrap; width: max-content; max-width: 100%; }
.blk .ic { font-size: 22px; line-height: 1; filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .3)); }
.blk .py { text-shadow: 0 1px 0 rgba(0, 0, 0, .35); }
.blk .arg { display: inline-grid; place-items: center; min-width: 34px; height: 34px; padding: 0 8px; margin: 0 1px; border: 2px solid var(--edge); border-radius: 17px; background: #fff; color: var(--ink); font: 900 18px var(--f-code); text-shadow: none; cursor: pointer; }
.blk .arg.pick { font-size: 20px; }
.blk.move { background: var(--move); } .blk.turn { background: var(--turn); } .blk.loop { background: var(--loop); } .blk.logic { background: var(--logic); }
.blk.act { background: var(--act); } .blk.event { background: var(--event); } .blk.sense { background: var(--sense); }
.blk.hat { border-radius: 22px 22px 12px 12px; cursor: default; }
.k-pal .blk { animation: k-in .3s ease-out both; font-size: 15px; padding-right: 10px; }
.k-pal .blk .arg { min-width: 30px; height: 30px; font-size: 16px; }
.k-pal .cblk { min-width: 0; }
.k-pal .blk.pulse { animation: k-pulse .7s ease-in-out 4; }
.blk.run { outline: 4px solid #fff; outline-offset: 2px; box-shadow: 0 0 0 7px var(--gold), 0 4px 0 rgba(0, 0, 0, .35); }
.blk.bad { animation: k-shake .4s; }

/* C-shaped blocks (loops, if/else) */
.cblk { position: relative; width: max-content; min-width: 220px; max-width: 100%; }
.cblk > .blk { border-bottom-left-radius: 0; border-bottom-right-radius: 12px; }
.cblk .mouth { position: relative; margin-left: 18px; padding: 6px 0 6px 10px; min-height: 58px; border-left: 14px solid var(--c); }
.cblk .elseb { min-height: 40px; margin-left: 0; width: max-content; border-radius: 0 12px 12px 0; border-top: 0; }
.cblk .foot { height: 18px; width: 130px; background: var(--c); border: 3px solid var(--edge); border-top: 0; border-radius: 0 0 12px 12px; box-shadow: 0 4px 0 rgba(0, 0, 0, .35); }
.cblk .mouth::before { content: ''; position: absolute; left: -17px; top: -3px; bottom: -3px; width: 3px; background: var(--edge); }
.cblk.loop { --c: var(--loop); } .cblk.logic { --c: var(--logic); } .cblk.event { --c: var(--event); }

/* script lists and drop slots */
.list { display: flex; flex-direction: column; gap: 6px; min-height: 8px; }
.drop { height: 0; border-radius: 6px; transition: height .12s; }
.dragging .drop { height: 10px; background: rgba(27, 29, 36, .08); }
.dragging .drop.near { height: 52px; background: rgba(34, 197, 94, .25); outline: 3px dashed #16a34a; }
.k-ghost { position: fixed; z-index: 1000; pointer-events: none; transform: rotate(-3deg) scale(1.05); opacity: .92; }
.k-trash { position: absolute; right: 16px; bottom: 16px; display: grid; place-items: center; width: 72px; height: 72px; border: 3px solid var(--edge); border-radius: 50%; background: #fff; font-size: 34px; box-shadow: 0 4px 0 var(--drop); transition: transform .15s; z-index: 5; }
.k-trash.hot { transform: scale(1.25) rotate(-8deg); background: #fecaca; }
.k-empty-hint { margin: 10px 4px; color: #8a8478; font-weight: 800; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.k-empty-hint .hand { font-size: 26px; animation: k-nudge 1.2s ease-in-out infinite; }

/* number picker */
.k-pop { position: fixed; z-index: 1100; display: grid; grid-template-columns: repeat(5, 48px); gap: 6px; padding: 10px; background: #fff; border: 3px solid var(--edge); border-radius: 14px; box-shadow: 0 6px 0 var(--drop); animation: k-pop .15s ease-out both; }
.k-pop button { height: 48px; border: 3px solid var(--edge); border-radius: 10px; background: #f1f5ff; font: 900 22px var(--f-code); }
.k-pop button.on { background: var(--gold); }

/* python view */
.k-code { position: absolute; left: 14px; right: 14px; bottom: 14px; max-height: 45%; overflow: auto; margin: 0; padding: 12px 14px; background: #0f172a; color: #e2e8f0; border: 3px solid var(--edge); border-radius: 12px; font: 600 15px/1.6 var(--f-code); box-shadow: 0 5px 0 var(--drop); z-index: 4; }
.k-code[hidden] { display: none; }
.k-code .ln { display: block; padding: 0 6px; border-radius: 4px; white-space: pre; }
.k-code .ln.on { background: #facc15; color: #111; }
.k-code .ln.on span { color: #111 !important; }
.k-code .kw { color: #f472b6; } .k-code .fn { color: #7dd3fc; } .k-code .num { color: #fbbf24; } .k-code .str { color: #86efac; } .k-code .cm { color: #94a3b8; }

/* win card */
.k-over { position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; background: rgba(15, 23, 42, .55); }
.k-over[hidden] { display: none; }
.k-card { width: min(420px, 92vw); padding: 22px 22px 18px; text-align: center; background: #fff; border: 4px solid var(--edge); border-radius: 22px; box-shadow: 0 8px 0 var(--drop); animation: k-pop .35s cubic-bezier(.2, 1.5, .4, 1) both; }
.k-card h2 { margin: 6px 0 4px; font: 700 26px var(--f-pixel); }
.k-card img { width: 96px; image-rendering: pixelated; animation: k-bob 1s ease-in-out infinite; }
.k-stars { display: flex; justify-content: center; gap: 8px; margin: 8px 0 14px; font-size: 46px; }
.k-stars span { filter: grayscale(1) opacity(.35); transform: scale(.6); transition: all .3s; }
.k-stars span.on { filter: none; transform: scale(1); animation: k-star .5s cubic-bezier(.2, 1.6, .4, 1) both; }
.k-card .row { display: flex; justify-content: center; gap: 14px; }
.k-card .row button { display: grid; place-items: center; width: 72px; height: 64px; border: 3px solid var(--edge); border-radius: 16px; background: #fff; font-size: 30px; box-shadow: 0 4px 0 var(--drop); }
.k-card .row button.go { width: 120px; background: #22c55e; color: #fff; }
.k-card p { margin: 0 0 10px; color: #5b6170; font-weight: 800; }
.k-confetti { position: fixed; inset: 0; pointer-events: none; z-index: 2100; }

@keyframes k-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes k-pop { from { transform: translateX(var(--tx, 0)) scale(.6); opacity: 0; } to { transform: translateX(var(--tx, 0)) scale(1); opacity: 1; } }
.k-bubble { --tx: -50%; }
@keyframes k-in { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: none; } }
@keyframes k-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.1); box-shadow: 0 0 0 6px var(--gold), 0 4px 0 rgba(0, 0, 0, .35); } }
@keyframes k-shake { 0%, 100% { transform: none; } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@keyframes k-nudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(-8px); } }
@keyframes k-star { from { transform: scale(0) rotate(-90deg); } to { transform: scale(1) rotate(0); } }

/* tablets and small Chromebooks: stage on top, blocks below */
@media (max-width: 980px) {
  .k-main { grid-template-columns: 214px minmax(0, 1fr); grid-template-rows: minmax(320px, 58vh) minmax(0, 1fr); }
  .k-pal .blk { font-size: 13px; gap: 6px; } .k-pal .blk .ic { font-size: 18px; }
  .k-goal { padding: 6px 10px; } .k-goal .gt { font-size: 17px; } .k-goal .gi { font-size: 24px; }
  .k-ctl { padding: 6px; gap: 10px; } .k-small { width: 48px; height: 48px; }
  .k-title { display: none; } .k-tool { width: 44px; height: 44px; font-size: 20px; }
  .k-top { flex-wrap: wrap; row-gap: 4px; } .k-worlds { order: 3; flex-basis: 100%; margin-left: 0; } .k-tools { margin-left: auto; }
  .k-stagewrap { grid-column: 1 / -1; grid-row: 1; border-bottom: 4px solid var(--edge); }
  .k-pal { grid-row: 2; } .k-ws { grid-row: 2; border-right: 0; }
  .k-play { width: 64px; height: 64px; font-size: 28px; }
  .k-title span { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.k-pad { display: flex; gap: 8px; margin-left: 12px; }
.k-pad[hidden] { display: none; }
.k-pad .k-small { background: #ffc93c; font-size: 22px; }
/* live chat box (Byte Chat) */
.k-chatin { display: flex; gap: 8px; margin-left: 12px; }
.k-chatin[hidden] { display: none; }
.k-chatin input { width: 210px; height: 52px; padding: 0 14px; border: 3px solid var(--edge); border-radius: 26px; font: 800 18px var(--f-body); background: #fff; box-shadow: 0 4px 0 var(--drop); }
.k-chatin input:focus { outline: 3px solid var(--gold); }
@media (max-width: 980px) { .k-ctl { flex-wrap: wrap; } .k-chatin { margin: 8px 0 0; width: 100%; justify-content: center; } .k-chatin input { flex: 1; max-width: 320px; } }
