/* block coding kit: turtle, sensor robot, pre arrows */
.bk { display: grid; gap: 16px; grid-template-columns: 1fr; width: 100%; }
@media (min-width: 700px) { .bk { grid-template-columns: minmax(280px, 1fr) minmax(300px, 1fr); align-items: start; } .bk-left { position: sticky; top: 72px; } }
.bk-left { display: grid; gap: 10px; justify-items: center; min-width: 0; }
.bk-right { min-width: 0; }

/* turtle canvas */
.tk-canvas { width: 100%; display: flex; justify-content: center; }
.tk-canvas canvas { display: block; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); touch-action: pan-y; }
.vis.tpic { width: 100%; height: auto; max-height: 220px; }
.vis.tpic .tsg { stroke: var(--accent); }
.vis.tpic .ttg { stroke: var(--ink-3); stroke-opacity: .35; }
.vis.tpic .tdot { fill: var(--sun); }
.opt .vis.tpic { max-height: 130px; }
.vis.tcode { width: min(100%, 320px); height: auto; max-height: none; }
.step-vis > .vis.tcode { max-height: none; }
.tc-b { fill: var(--sky); } .tc-b.tc-turn { fill: var(--accent-2); } .tc-b.tc-pen { fill: var(--sun); } .tc-b.tc-loop { fill: var(--berry); } .tc-b.tc-proc { fill: var(--leaf); } .tc-b.tc-var { fill: var(--coral); } .tc-b.tc-cond { fill: #8A63B8; }
.tc-t { fill: #fff; font: 700 14px var(--round); } .tc-t.tc-pen, .tc-t.tc-var { fill: #22292B; }
.tc-else { fill: var(--ink-2); font: 700 14px var(--round); }

/* run controls */
.bk-ctrls { display: flex; align-items: center; gap: 10px; justify-content: center; flex-wrap: wrap; }
.bk-ib { width: 48px; height: 48px; border-radius: 14px; border: 0; background: var(--surface-2); color: var(--ink); display: inline-grid; place-items: center; flex: none; }
.bk-ib:disabled { opacity: .35; cursor: default; }
.bk-ib:active:not(:disabled) { transform: scale(.95); }
.bk-ib.primary { background: var(--accent); color: var(--accent-ink); width: 64px; }
.bk-status { font-size: 15px; font-weight: 700; color: var(--soft-red); min-width: 0; }
.bk-status:empty { display: none; }

/* editor */
.bk-ed { display: grid; gap: 10px; }
.bk-tools { display: flex; align-items: center; gap: 6px; }
.bk-sp { flex: 1; }
.bk-tools .bk-ib { width: 44px; height: 44px; background: transparent; color: var(--ink-2); }
.bk-budget { font: 750 18px var(--round); font-variant-numeric: tabular-nums; color: var(--ink-2); }
.bk-budget.over { color: var(--soft-red); }
.bk-pal { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px; border-radius: 16px; background: var(--surface-2); transition: background .15s; }
.bk-pal.over { background: var(--surface-3); outline: 2px dashed var(--ink-3); }
.pchip, .bname { touch-action: none; -webkit-user-select: none; user-select: none; }
.pchip { min-height: 44px; padding: 0 14px; border-radius: 12px; border: 0; font: 700 15px var(--round); color: #fff; box-shadow: 0 2px 0 rgba(0, 0, 0, .18); }
.pchip:active { transform: translateY(1px); box-shadow: none; }
.move { background: var(--sky); } .turn { background: var(--accent-2); } .pen { background: var(--sun); } .loop { background: var(--berry); } .proc { background: var(--leaf); } .var { background: var(--coral); } .cond { background: #8A63B8; }
.pchip.pen, .pchip.var, .blk.pen > .brow, .blk.var > .brow { color: #22292B; }

.bk-prog { padding: 4px 0 8px; }
.blist { display: flex; flex-direction: column; }
.blk { border-radius: 14px; color: #fff; }
.blk.loop, .blk.proc, .blk.cond { background: transparent; }
.brow { display: flex; align-items: center; gap: 6px; min-height: 52px; padding: 4px 6px 4px 12px; border-radius: 14px; flex-wrap: wrap; }
.blk.loop > .brow, .blk.proc > .brow, .blk.cond > .brow { background: inherit; }
.blk.loop > .brow { background: var(--berry); } .blk.proc > .brow { background: var(--leaf); } .blk.cond > .brow { background: #8A63B8; }
.blk.loop > .brow.belse, .blk.cond > .brow.belse { min-height: 34px; border-radius: 0 10px 10px 0; padding: 2px 12px; }
.bslot { margin-left: 0; padding: 4px 0 4px 14px; border-left: 8px solid; border-color: inherit; }
.blk.loop > .bslot { border-color: var(--berry); } .blk.proc > .bslot { border-color: var(--leaf); } .blk.cond > .bslot { border-color: #8A63B8; }
.bslot:last-child { border-bottom-left-radius: 10px; padding-bottom: 8px; }
.bname { flex: 1 1 auto; min-width: 72px; min-height: 44px; display: flex; align-items: center; font: 750 16px var(--round); cursor: grab; outline-offset: -2px; }
.bname.soft { opacity: .85; cursor: default; flex: none; min-height: 28px; font-size: 14px; }
.blk.sel > .brow { box-shadow: 0 0 0 3px var(--ink) inset; }
.blk.run > .brow { box-shadow: 0 0 0 3px var(--sun) inset; }
.blk.moving { opacity: .35; }
.stepper { display: inline-flex; align-items: center; gap: 2px; }
.stp, .cyc { min-width: 44px; height: 44px; border-radius: 12px; border: 0; background: rgba(255, 255, 255, .22); color: inherit; font: 800 22px/1 var(--round); display: inline-grid; place-items: center; padding: 0 8px; }
.blk.pen .stp, .blk.var .stp, .blk.pen .cyc, .blk.var .cyc { background: rgba(0, 0, 0, .09); }
.cyc { font-size: 15px; min-width: 52px; }
.stp:active, .cyc:active { transform: scale(.94); }
.val { min-width: 44px; text-align: center; font: 800 18px var(--round); font-variant-numeric: tabular-nums; }
.cyc.sw { min-width: 44px; padding: 0; }
.cyc.sw::after { content: ""; width: 22px; height: 22px; border-radius: 50%; border: 2px solid rgba(0, 0, 0, .25); background: currentColor; }
.cyc.sw-coral { color: var(--coral); } .cyc.sw-leaf { color: var(--leaf); } .cyc.sw-sky { color: var(--sky); } .cyc.sw-berry { color: var(--berry); } .cyc.sw-sun { color: var(--sun); }
.gap { height: 6px; border-radius: 3px; transition: height .12s; }
.gap.cur { background: var(--ink); height: 6px; margin: 2px 0; }
.endslot { height: 44px; border-radius: 12px; border: 2px dashed var(--line); background: transparent; width: 100%; margin-top: 2px; }
.endslot.cur { border-color: var(--ink-2); background: var(--surface-2); }
.bslot .endslot { height: 40px; border-color: rgba(127, 127, 127, .35); }
.bslot .endslot.cur { border-color: var(--ink-2); }
.bslot .blist:not(:has(.blk)) .endslot { margin-top: 0; }
.dragging .gap { height: 14px; }
.gap.over { background: var(--accent); height: 14px; }
.endslot.over { border-color: var(--accent); background: var(--accent-soft); }
.bk-ghost { position: fixed; left: 0; top: 0; z-index: 60; pointer-events: none; opacity: .94; box-shadow: 0 12px 30px rgba(0, 0, 0, .25); border-radius: 14px; min-width: 120px; }
.bk-ghost.loop, .bk-ghost.proc, .bk-ghost.cond { background: transparent; }
.bk-ghost .brow { min-height: 48px; }
.bk-ghost.loop .brow { background: var(--berry); } .bk-ghost.proc .brow { background: var(--leaf); } .bk-ghost.cond .brow { background: #8A63B8; }
.bk-ed.locked .bk-pal, .bk-ed.locked .bk-tools .bk-ib, .bk-ed.locked .stp, .bk-ed.locked .cyc { opacity: .45; pointer-events: none; }
.bk-ed.locked .endslot { visibility: hidden; height: 0; margin: 0; border: 0; }

/* sensor robot */
.rk-board { width: 100%; display: flex; justify-content: center; }
.vis.rmaze { width: min(100%, 380px); height: auto; }
.rm-f { fill: var(--surface); stroke: var(--line); stroke-width: 1.5; }
.rm-w { fill: var(--surface-3); }
.rm-path { fill: none; stroke: var(--sun); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 2 8; }
.rm-crash { fill: none; stroke: var(--soft-red); stroke-width: 3; stroke-dasharray: 3 4; }
.rb-body { fill: #4F8CC9; stroke: #2E5E8F; stroke-width: 2; } .rb-nose { fill: #F2B33D; } .rb-foot { fill: #2E5E8F; }
.rk-thumbs { display: flex; gap: 10px; justify-content: center; }
.rk-thumb { position: relative; width: 76px; padding: 4px; border-radius: 12px; background: var(--surface-2); }
.rk-thumb .vis.rmaze { width: 100%; }
.rk-thumb .dot { position: absolute; right: 4px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: transparent; }
.rk-thumb.good .dot { background: var(--good); } .rk-thumb.bad .dot { background: var(--soft-red); }
.rk-thumb.bad { outline: 2px solid var(--soft-red); outline-offset: -2px; }

/* pre arrows */
.pb { display: grid; gap: 16px; justify-items: center; width: 100%; }
.pb-board { width: 100%; display: flex; justify-content: center; }
.vis.pbot { width: min(100%, 420px); height: auto; max-height: 340px; }
.pb-cell { fill: #DCEBCB; stroke: #B9D3A0; stroke-width: 2; } .pb-cell.alt { fill: #D2E5BE; }
.pb-path { fill: none; stroke: #F2B33D; stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 3 12; }
.pb-bump { fill: none; stroke: #F2B33D; stroke-width: 5; stroke-dasharray: 5 6; }
.pb-prog { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; min-height: 84px; width: 100%; padding: 10px; border-radius: 22px; background: var(--surface-2); }
.pb-empty { width: 64px; height: 64px; border-radius: 18px; border: 3px dashed var(--line); }
.pb-tok, .pb-arrow { width: 72px; height: 72px; border-radius: 20px; border: 0; background: var(--sky); color: #fff; display: grid; place-items: center; box-shadow: 0 4px 0 #2E5E8F; }
.pb-tok .ic.big, .pb-arrow .ic.big { width: 44px; height: 44px; stroke-width: 2.6; }
.pb-tok.now { background: var(--sun); color: #22292B; box-shadow: 0 4px 0 #B07F1E; }
.pb-arrow { width: 80px; height: 80px; border-radius: 24px; }
.pb-arrow.ghost { background: var(--surface-2); color: var(--ink-2); box-shadow: 0 4px 0 var(--line); }
.pb-tok:active, .pb-arrow:active { transform: translateY(3px); box-shadow: none; }
.pb-pal { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.pb.locked .pb-pal, .pb.locked .pb-tok { pointer-events: none; }
.pb.locked .pb-pal { opacity: .5; }
.pb.fix .pb-pal { display: none; }
/* dark: the open path is the lighter square and walls sink into the background, as in light mode */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .rm-f { fill: #34413F; stroke: #4E5D5A; } :root:not([data-theme="light"]) .rm-w { fill: #111516; } }
:root[data-theme="dark"] .rm-f { fill: #34413F; stroke: #4E5D5A; } :root[data-theme="dark"] .rm-w { fill: #111516; }
