:root {
  --bb-green: #adc276; --bb-green-dark: #8da45a; --bb-green-deep: #6f8544;
  --bb-dark: #111111; --bb-secondary: #5f6b57; --bb-sage: #bbd291; --bb-border: #c9d6aa;
  --bb-light-bg: #e2ecce; --bb-red: #d9534f; --bb-red-bg: #f7dcdb; --bb-amber: #e0a800;
  --bb-cream: #ffffff; --bb-green-light: #bbd291; --bb-yellow: #fdd14d;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { font-family: 'Nunito', system-ui, sans-serif; color: var(--bb-dark); background: var(--bb-cream); line-height: 1.55; }
a { color: var(--bb-green-deep); }

/* top bar: cream, the wordmark logo, the site's name beside it */
.bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 1.5rem; padding: .45rem 1.25rem; background: var(--bb-green); color: var(--bb-dark); }
.brand { font-family: 'Varela Round', sans-serif; font-size: 1.05rem; color: var(--bb-dark); text-decoration: none; display: flex; align-items: center; gap: .7rem; }
.brand .logo { height: 38px; width: auto; display: inline-block; }
.brand .site { padding: .15rem .65rem; border-radius: 999px; background: #000; color: #fff; font-size: .85rem; font-weight: 700; letter-spacing: .02em; }
.bar-links { display: flex; gap: 1.1rem; margin-left: auto; }
.bar-links a { color: var(--bb-dark); text-decoration: none; font-weight: 700; font-size: .9rem; }
.bar-links a:hover { color: #fff; }
.status { font-family: 'Roboto Mono', monospace; font-size: .75rem; color: #3d4a30; }

/* the one WebGL canvas: fixed over the page, drawn only inside visible cells */
/* the shared WebGL canvas is a scratch surface: each view is copied into the cell's own canvas, which scrolls with the page */
.gl { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; visibility: hidden; z-index: -1; }

/* index */
.index { max-width: 1000px; margin: 0 auto; padding: 2.5rem 1.25rem 4rem; }
.index h1 { font-family: 'Varela Round', sans-serif; font-weight: 400; font-size: 2rem; margin: 0 0 .5rem; }
.index .lead { color: var(--bb-secondary); max-width: 62ch; margin-bottom: 2rem; }
.module { margin-bottom: 2.5rem; }
.module-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.module-head .num { font-family: 'Roboto Mono', monospace; font-size: .75rem; color: var(--bb-secondary); letter-spacing: .05em; }
.module-head h2 { font-family: 'Varela Round', sans-serif; font-weight: 400; margin: .2rem 0 .3rem; font-size: 1.5rem; }
.module-head p { margin: 0; color: var(--bb-secondary); max-width: 62ch; }
.side-module { margin-bottom: .35rem; }
.side-module-title { display: flex; align-items: center; gap: .4rem; width: 100%; text-align: left; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--bb-secondary); margin: .35rem 0 .1rem; padding: .3rem 0; border: 0; background: none; border-radius: 4px; font-weight: 700; }
.side-module-title:hover { background: var(--bb-light-bg); }
.side-module-title .t { flex: 1; }
.side-module-title .count { font-family: 'Roboto Mono', monospace; font-size: .7rem; text-transform: none; letter-spacing: 0; }
.side-module-title .chev { width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 6px solid var(--bb-secondary); transform: rotate(-90deg); transition: transform .15s; }
.side-module.open .side-module-title .chev { transform: rotate(0); }
.side-module-body { display: none; padding-left: .9rem; }
.side-module.open .side-module-body { display: block; }
.drawer-toggle { display: none; }
.drawer-backdrop { display: none; }
.crumb { font-size: .8rem; color: var(--bb-secondary); letter-spacing: .03em; margin-top: .5rem; }
.lesson-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.25rem; }
.lesson-card { display: block; text-decoration: none; color: inherit; border: 1px solid var(--bb-border); border-radius: 12px; padding: 1.25rem 1.25rem 1rem; background: #fff; transition: box-shadow .15s; }
.lesson-card:hover { box-shadow: 0 .5rem 1.5rem rgba(0,0,0,.08); }
.lesson-card .num { font-family: 'Roboto Mono', monospace; font-size: .75rem; color: var(--bb-secondary); letter-spacing: .05em; }
.lesson-card h3 { font-family: 'Varela Round', sans-serif; font-weight: 400; margin: .25rem 0 .4rem; font-size: 1.2rem; }
.lesson-card p { margin: 0 0 .75rem; color: var(--bb-secondary); font-size: .95rem; }
.lesson-card .meta { display: flex; justify-content: space-between; align-items: center; font-size: .8rem; color: var(--bb-secondary); }
.progress-pill { border-radius: 999px; padding: .15rem .6rem; font-weight: 700; font-size: .75rem; background: var(--bb-light-bg); border: 1px solid var(--bb-border); }
.progress-pill.done { background: var(--bb-green); border-color: var(--bb-green); color: var(--bb-dark); }

/* lesson layout */
.lesson { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 2.5rem; max-width: 1180px; margin: 0 auto; padding: 1.5rem 1.25rem 5rem; }
.side { position: sticky; top: 3.4rem; align-self: start; max-height: calc(100vh - 3.4rem); overflow: auto; padding-top: .75rem; font-size: .9rem; }
.side h4 { margin: 1rem 0 .4rem; font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--bb-secondary); }
.side a { display: block; text-decoration: none; color: var(--bb-dark); padding: .25rem 0; }
.side a.current { color: var(--bb-green-deep); font-weight: 700; }
.side .outline a { color: var(--bb-secondary); padding-left: .5rem; border-left: 2px solid var(--bb-border); }
.side .outline a.active { color: var(--bb-dark); border-left-color: var(--bb-green-dark); }
.main { min-width: 0; max-width: 760px; }
.main h1 { font-family: 'Varela Round', sans-serif; font-weight: 400; font-size: 2.1rem; margin: .5rem 0 1rem; text-wrap: balance; }
.main h2 { font-family: 'Varela Round', sans-serif; font-weight: 400; font-size: 1.45rem; margin: 2.4rem 0 .6rem; padding-top: .5rem; }
.main p, .main li { max-width: 68ch; }
.main code { font-family: 'Roboto Mono', monospace; font-size: .88em; background: var(--bb-light-bg); border: 1px solid var(--bb-border); border-radius: 3px; padding: 0 .25em; }
.main pre { background: var(--bb-light-bg); border: 1px solid var(--bb-border); border-radius: 8px; padding: .8rem 1rem; overflow-x: auto; font-family: 'Roboto Mono', monospace; font-size: .85rem; line-height: 1.5; }
.main pre code { background: none; border: 0; padding: 0; font-size: inherit; }
.main ol li, .main ul li { margin: .3rem 0; }
.lesson-nav { display: flex; justify-content: space-between; gap: 1rem; margin-top: 3rem; padding-top: 1.25rem; border-top: 1px solid var(--bb-border); }
.lesson-nav a { text-decoration: none; font-weight: 700; }

/* cells */
.cell { margin: 1.25rem 0 1.75rem; border: 1px solid var(--bb-border); border-radius: 12px; overflow: hidden; background: #fff; box-shadow: 0 .35rem 1rem rgba(0,0,0,.05); }
.cell.task { border-color: var(--bb-green-dark); }
/* accessibility: a visible focus ring, a skip link, less motion when asked */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible { outline: 3px solid #1a5fb4; outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: .5rem; z-index: 100; padding: .5rem .9rem; background: #111; color: #fff; border-radius: 6px; font-weight: 700; }
.skip:focus { left: .5rem; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; scroll-behavior: auto !important; } }

/* the teacher's own tasks */
.class-tasks .module-head { background: #fff7d6; border-color: #e8d48a; }
.class-task .crumb { color: var(--bb-secondary); font-size: .9rem; }
.class-task-cell { margin-top: 1rem; }

/* locked modules */
.module.locked .module-head { opacity: .55; }
.side-module.locked .side-module-title { opacity: .5; cursor: default; }

/* the class: the bar pill, the join dialog, the banner */
.classbar { display: flex; align-items: center; gap: .4rem; }
.classbar button { font: inherit; font-weight: 700; font-size: .8rem; padding: .25rem .7rem; border-radius: 999px; border: 1px solid #000; background: #fff; color: var(--bb-dark); cursor: pointer; }
.classbar button.class-join { background: #000; color: #fff; }
.classbar button:hover { background: var(--bb-sage); color: var(--bb-dark); }
.class-pill { font-size: .8rem; font-weight: 700; padding: .2rem .65rem; border-radius: 999px; background: #fff; border: 1px solid rgba(0,0,0,.25); }
.join-dialog { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.35); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.join-box { background: #fff; border-radius: 12px; padding: 1.2rem 1.4rem; max-width: 380px; width: 100%; box-shadow: 0 .75rem 2rem rgba(0,0,0,.2); }
.join-box h3 { margin: 0 0 .4rem; font-family: 'Varela Round', sans-serif; font-weight: 400; }
.join-box p { margin: 0 0 .7rem; color: var(--bb-secondary); font-size: .9rem; }
.join-box input { display: block; width: 100%; font: inherit; padding: .45rem .6rem; border: 1px solid var(--bb-border); border-radius: 6px; margin: .35rem 0; }
.join-box .join-code { font-family: 'Roboto Mono', monospace; letter-spacing: .25em; text-transform: uppercase; font-weight: 700; }
.join-actions { display: flex; gap: .5rem; margin-top: .5rem; }
.join-actions button { font: inherit; font-weight: 700; padding: .4rem 1rem; border-radius: 6px; border: 1px solid var(--bb-green-dark); background: #fff; cursor: pointer; }
.join-actions button.primary { background: var(--bb-green); border-color: var(--bb-green); }
.join-msg { min-height: 1.2em; color: var(--bb-red); font-size: .85rem; }
.class-banner { margin: .6rem 0 1rem; display: flex; flex-direction: column; gap: .4rem; }
.class-msg, .class-hint { border-radius: 10px; padding: .55rem .9rem; font-size: .95rem; border: 1px solid var(--bb-border); background: var(--bb-light-bg); }
.class-hint { background: #fff7d6; border-color: #e8d48a; }
.class-assign { border-radius: 10px; padding: .55rem .9rem; font-size: .95rem; border: 1px solid var(--bb-border); background: #fff; }
.class-assign.done { background: var(--bb-light-bg); }
.class-assign.late { border-color: #e0b4b1; background: #fbeeed; }
.class-assign .assign-note { color: var(--bb-secondary); margin-top: .2rem; }
.class-assign .assign-links { display: flex; flex-wrap: wrap; gap: .3rem .8rem; margin-top: .35rem; font-size: .88rem; }
.progress-pill.assigned { background: #fff7d6; border-color: #e8d48a; margin-right: .4rem; }
.lesson-card.assigned { border-color: #e8d48a; }
.class-banner .tag { font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--bb-secondary); margin-right: .5rem; }

/* the consent bar for analytics cookies */
.consent { position: fixed; left: 50%; bottom: 1rem; transform: translateX(-50%); z-index: 50; display: flex; align-items: center; gap: .6rem; max-width: calc(100% - 2rem); padding: .55rem .9rem; border-radius: 999px; background: #111; color: #fff; font-size: .85rem; box-shadow: 0 .5rem 1.5rem rgba(0,0,0,.25); }
.consent button { font: inherit; font-weight: 700; font-size: .8rem; padding: .3rem .8rem; border-radius: 999px; border: 1px solid #fff; background: transparent; color: #fff; cursor: pointer; white-space: nowrap; }
.consent button.primary { background: var(--bb-green); border-color: var(--bb-green); color: #111; }
@media (max-width: 600px) { .consent { flex-wrap: wrap; border-radius: 12px; } }

/* the loading bar: a stripe that sweeps under the cell head while the simulator is working */
.cell-progress { height: 4px; background: var(--bb-light-bg); position: relative; overflow: hidden; display: none; }
.cell.running .cell-progress { display: block; }
.cell-progress::before { content: ""; position: absolute; top: 0; bottom: 0; left: -40%; width: 40%; border-radius: 2px; background: var(--bb-green-dark); animation: cell-sweep 1.1s ease-in-out infinite; }
@keyframes cell-sweep { from { left: -40%; } to { left: 100%; } }
@media (prefers-reduced-motion: reduce) { .cell-progress::before { animation: none; left: 0; width: 100%; opacity: .6; } }
/* the head: the title with the buttons on its right, the task's description on its own line under it */
.cell-head { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; column-gap: .6rem; row-gap: .15rem; padding: .45rem .75rem; background: var(--bb-sage); border-bottom: 1px solid var(--bb-border); font-size: .85rem; }
.cell-head .label { font-weight: 700; }
.cell-head .task-hint { color: #3d4a30; grid-column: 1 / -1; grid-row: 2; min-width: 0; }
.cell-head .spacer { display: none; }
.cell-body { display: grid; grid-template-columns: minmax(0, 1fr) 6px 300px; }
.cell .CodeMirror { height: auto; min-height: 120px; font-family: 'Roboto Mono', monospace; font-size: 13.5px; }
.cell .CodeMirror-scroll { min-height: 120px; max-height: 420px; }
.cell-view { position: relative; background: #faf8ef; border-left: 1px solid var(--bb-border); min-height: 220px; }
.cell-view canvas.view3d { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
/* the robot view is painted on the shared canvas, which sits above the page, so the readout lives in the
   top-left corner where the mat never reaches */
.cell-view .telemetry { position: absolute; z-index: 6; left: .5rem; top: .4rem; font-family: 'Roboto Mono', monospace; font-size: 11px; color: var(--bb-secondary); pointer-events: none; background: rgba(255,255,255,.7); padding: 1px 6px; border-radius: 6px; }
.cell-view .telemetry:empty { display: none; }
.cell-view .placeholder { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--bb-secondary); font-size: .85rem; }
.cell-head .expand { display: inline-flex; align-items: center; padding: .3rem .5rem; }
.cell--full .cell-head .expand { background: var(--bb-sage); }

/* full-screen cell: the whole cell element moves into a fixed overlay; the shared canvas is raised above it */
.overlay { position: absolute; left: 0; width: 100%; height: 100vh; background: #fff; display: flex; flex-direction: column; }
.overlay-body { flex: 1; min-height: 0; display: flex; }
.cell.cell--full { flex: 1; display: flex; flex-direction: column; margin: 0; border: 0; border-radius: 0; box-shadow: none; min-height: 0; }
.cell--full .cell-body { flex: 1; min-height: 0; grid-template-columns: minmax(0, 1fr) 6px minmax(0, 1fr); }
.cell--full .CodeMirror { height: 100%; font-size: 15px; }
.cell--full .CodeMirror-scroll { max-height: none; height: 100%; }
.cell--full .cell-view { min-height: 0; border-left: 1px solid var(--bb-border); border-top: 0; }
.cell--full .cell-view .telemetry { font-size: 14px; left: 1rem; top: .75rem; }
.cell--full .cell-lower { height: 22vh; min-height: 150px; }
body.expanded { overflow: hidden; }
body.expanded .bar, body.expanded .side, body.expanded .drawer-toggle { visibility: hidden; }
@media (max-width: 900px) { .cell--full .cell-body { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; } .splitter { display: none; } }
.cell-foot { display: flex; align-items: center; gap: .6rem; padding: .45rem .75rem; border-top: 1px solid var(--bb-border); flex-wrap: wrap; }
button { font: inherit; font-weight: 700; font-size: .85rem; padding: .35rem .9rem; border-radius: 6px; border: 1px solid var(--bb-green-dark); background: #fff; color: var(--bb-dark); cursor: pointer; }
button.primary { background: var(--bb-green); border-color: var(--bb-green); }
button:hover { background: var(--bb-sage); }
button:disabled { opacity: .5; cursor: default; }
.cell-foot .scrub { flex: 1; min-width: 80px; }
/* the console: always open with its own scrollbar, so running a program never resizes the robot view */
.cell-out { flex: 1; min-width: 0; min-height: 0; padding: .5rem .75rem; font-family: 'Roboto Mono', monospace; font-size: 12.5px; white-space: pre-wrap; background: #fff; overflow: auto; }
.cell-out:empty::before { content: "console: what your program prints appears here"; color: #9aa7ad; }
.cell-out .err { color: var(--bb-red); }
.cell-out .radio { color: #5a6b74; margin-top: .4rem; }
.verdict { font-weight: 700; padding: .25rem .6rem; border-radius: 6px; font-size: .85rem; }
.verdict.pass { background: var(--bb-green); }
.verdict.fail { background: var(--bb-red-bg); color: #7a1f1b; }
.best { font-size: .8rem; color: var(--bb-secondary); }

@media (max-width: 900px) {
  .lesson { grid-template-columns: 1fr; gap: .5rem; }
  .drawer-toggle { display: inline-block; align-self: start; margin: .25rem 0 .5rem; }
  .side { position: fixed; top: 0; left: 0; bottom: 0; width: min(320px, 85vw); max-height: none; background: #fff; z-index: 26; padding: 1rem 1.25rem 2rem; box-shadow: .5rem 0 2rem rgba(0,0,0,.15); transform: translateX(-105%); transition: transform .18s ease; overflow: auto; }
  .side.open { transform: none; }
  .drawer-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 25; }
  .drawer-backdrop.open { display: block; }
  .cell-body { grid-template-columns: 1fr; }
  .cell-view { border-left: 0; border-top: 1px solid var(--bb-border); min-height: 240px; }
}

/* games */
/* the whole game card is the link */
.module.game .module-head { display: flex; border: 1px solid var(--bb-green-dark); border-radius: 12px; padding: 1rem 1.25rem; background: var(--bb-green); align-items: center; color: var(--bb-dark); text-decoration: none; cursor: pointer; transition: box-shadow .15s, transform .15s; }
.module.game .module-head:hover, .module.game .module-head:focus-visible { box-shadow: 0 .35rem 1rem rgba(0, 0, 0, .12); transform: translateY(-1px); }
.module.game .md-button { text-decoration: none; font-weight: 700; padding: .45rem 1.1rem; border-radius: 6px; background: var(--bb-green); color: var(--bb-dark); border: 1px solid var(--bb-green); white-space: nowrap; }
.side-game { display: block; margin: .2rem 0 .6rem; font-weight: 700; }
.cell.arena .cell-body { grid-template-columns: minmax(0, 1fr) 6px minmax(0, 1fr); }
.cell.arena .cell-view { min-height: 320px; }
.leaderboard table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.leaderboard th, .leaderboard td { text-align: left; padding: .35rem .75rem; border-top: 1px solid var(--bb-border); }
.leaderboard thead th { font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--bb-secondary); border-top: 0; }
.leaderboard tr.me td { background: rgba(162, 197, 148, .25); font-weight: 700; }
.leaderboard .swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .45rem; vertical-align: middle; }
@media (max-width: 900px) { .cell.arena .cell-body { grid-template-columns: 1fr; } }

/* rooms */
.room { border-top: 1px solid var(--bb-border); padding: .6rem .75rem .75rem; background: var(--bb-light-bg); }
.room-head { display: flex; align-items: center; gap: .75rem; margin-bottom: .5rem; }
.room-head .label { font-weight: 700; }
.room-status { font-size: .85rem; color: var(--bb-secondary); }
.room-status.ok { color: var(--bb-green-deep); }
.room-status.err { color: var(--bb-red); }
.room-join { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.room-join input { font: inherit; padding: .35rem .6rem; border: 1px solid var(--bb-border); border-radius: 6px; width: 10rem; }
.room-join .or { color: var(--bb-secondary); font-size: .85rem; }
.room-code-big { font-family: 'Roboto Mono', monospace; font-size: 1.6rem; letter-spacing: .25em; font-weight: 700; margin: .25rem 0 .5rem; }
.room-people { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; margin-bottom: .6rem; }
.room-people .person { background: #fff; border: 1px solid var(--bb-border); border-radius: 999px; padding: .15rem .6rem; font-size: .85rem; }
.room-people .person.me { border-color: var(--bb-green-dark); background: var(--bb-green); }
.room-people .count { font-size: .8rem; color: var(--bb-secondary); }
.room-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.room-note { font-size: .8rem; color: var(--bb-secondary); margin-top: .4rem; }
.board-title { font-weight: 700; padding: .5rem .75rem 0; }
.room-join[hidden], .room-live[hidden] { display: none; }

/* in a room the practice buttons go away: the race is the room's */
.cell.arena.in-room .cell-foot .run, .cell.arena.in-room .cell-foot .bots-only { display: none; }

/* embed: one cell fills the page (used inside iframes on the main site) */
body.embed .bar { display: none; }
body.embed .app { padding: 0; max-width: none; }
body.embed .embed-wrap { height: 100vh; display: flex; flex-direction: column; }
body.embed .cell-head .expand { display: none; }


/* full-page cells (embed and full screen): the task title on its own line, the hint under it, Reload on the right */
.cell--full .cell-head { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; row-gap: .15rem; padding: .6rem 1rem; }
.cell--full .cell-head .label { font-size: 1rem; }
.cell--full .cell-head .task-hint, .cell--full .cell-head .spacer { grid-column: 1 / -1; grid-row: 2; }
.cell--full .cell-head .spacer { display: none; }
body.embed .cell--full .cell-head { grid-template-columns: minmax(0, 1fr) auto; }
body.embed .cell--full .cell-body { grid-template-columns: minmax(0, 3fr) 6px minmax(0, 2fr); }
body.embed .cell--full .CodeMirror { font-size: 14px; }


/* the drag handle between code and robot view */
.splitter { position: relative; cursor: col-resize; background: var(--bb-border); touch-action: none; }
.splitter::after { content: ""; position: absolute; top: 0; bottom: 0; left: -6px; right: -6px; }   /* a wider grab zone than the 6 px line */
.splitter:hover, .splitter.active { background: var(--bb-green-dark); }
body.splitting { user-select: none; cursor: col-resize; }
.hsplitter { position: relative; height: 6px; cursor: row-resize; background: var(--bb-border); touch-action: none; }
.hsplitter::after { content: ""; position: absolute; left: 0; right: 0; top: -5px; bottom: -5px; }
.hsplitter:hover, .hsplitter.active { background: var(--bb-green-dark); }
body.splitting-v { user-select: none; cursor: row-resize; }



/* the lower row: the console on the left, the sensor views (camera with detections, depth grid) on the right.
   The camera view is rendered on the shared canvas into its rectangle; the detections are drawn over it. */
.cell-lower { display: flex; align-items: stretch; height: 150px; border-top: 1px solid var(--bb-border); }
.insets { display: flex; gap: .4rem; padding: .4rem; flex: none; order: 2; background: #e2ecce; border-left: 1px solid var(--bb-border); }   /* on the right of the console */
.cam-inset { position: relative; height: 100%; aspect-ratio: 4 / 3; border: 1px solid var(--bb-border); border-radius: 4px; overflow: hidden; background: #c9d3c3; }
.cam-inset canvas.cam3d { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.cam-overlay { position: absolute; inset: 0; z-index: 7; pointer-events: none; }
.inset-label { position: absolute; z-index: 8; left: 4px; top: 2px; font: 600 10px 'Nunito', sans-serif; color: #fff; text-shadow: 0 0 3px rgba(0,0,0,.8); letter-spacing: .04em; text-transform: uppercase; pointer-events: none; }
.det { position: absolute; border: 2px solid #ffe14d; border-radius: 2px; box-sizing: border-box; }
.det span { position: absolute; left: 0; top: 100%; white-space: nowrap; font: 500 10px 'Roboto Mono', monospace; color: #fff; text-shadow: 0 0 3px rgba(0,0,0,.9); }
.det.blob { border-radius: 50%; border-color: #fff; }
.det.blob.red { border-color: #ff6b6b; } .det.blob.blue { border-color: #7aa7ff; } .det.blob.green { border-color: #7fe07f; } .det.blob.yellow { border-color: #ffe14d; }
.tof-inset { position: relative; height: 100%; aspect-ratio: 1; border: 1px solid var(--bb-border); border-radius: 4px; background: #444; overflow: hidden; }
.tof-cells { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr); gap: 1px; }
.tof-cells i { display: block; background: #555; }
@media (max-width: 900px) { .cell-lower { height: 120px; } }
.det.line { border-radius: 50%; border-color: #ff8c42; }

/* glossary: a term in the prose, and the one floating tooltip */
.gloss { border-bottom: 1px dashed var(--bb-green-deep); cursor: help; outline: none; }
.gloss:hover, .gloss:focus { background: rgba(162, 197, 148, .3); border-radius: 3px; }
#glosspop { position: fixed; z-index: 40; max-width: 360px; opacity: 0; visibility: hidden; transition: opacity .12s ease; pointer-events: none; background: #fff; color: var(--bb-dark); border: 1px solid var(--bb-green-dark); border-radius: 10px; padding: .7rem .85rem; font-size: .88rem; line-height: 1.5; box-shadow: 0 .6rem 1.6rem rgba(0,0,0,.14); }
#glosspop.show { opacity: 1; visibility: visible; pointer-events: auto; }
#glosspop .gp-term { font-weight: 800; color: var(--bb-green-deep); margin-bottom: .2rem; }
#glosspop .gp-def { margin-bottom: .4rem; }
#glosspop .gp-link { display: inline-block; font-size: .8rem; font-weight: 700; text-decoration: none; }

/* feedback cards at the end of each part of a page */
.feedback { margin: .6rem 0 1.6rem; font-size: .85rem; }
.feedback .fb-open { font-size: .78rem; font-weight: 600; padding: .25rem .7rem; border-color: var(--bb-border); color: var(--bb-secondary); background: var(--bb-light-bg); }
.feedback .fb-open:hover { background: var(--bb-sage); color: var(--bb-dark); }
.feedback .fb-form { border: 1px solid var(--bb-green-dark); border-radius: 10px; padding: .7rem .9rem; background: var(--bb-light-bg); display: flex; flex-direction: column; gap: .5rem; max-width: 560px; }
.feedback .fb-form[hidden] { display: none; }
.feedback .fb-row { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.feedback .fb-q { font-weight: 700; }
.feedback label { display: inline-flex; align-items: center; gap: .3rem; }
.feedback .fb-text { font: inherit; font-size: .85rem; padding: .4rem .6rem; border: 1px solid var(--bb-border); border-radius: 6px; resize: vertical; }
.feedback .fb-note { color: var(--bb-secondary); }
.feedback .fb-thanks { color: var(--bb-green-deep); font-weight: 600; }

/* squiggles and the completion popup */
.CodeMirror-lint-mark-error { background-image: none; border-bottom: 2px wavy var(--bb-red); text-decoration: underline wavy var(--bb-red); }
.CodeMirror-lint-markers { width: 10px; }
.CodeMirror-lint-tooltip { font-family: 'Nunito', sans-serif; font-size: .85rem; border: 1px solid var(--bb-border); border-radius: 8px; background: #fff; color: var(--bb-dark); box-shadow: 0 .35rem 1rem rgba(0,0,0,.12); }
.CodeMirror-hints { font-family: 'Roboto Mono', monospace; font-size: 12.5px; border: 1px solid var(--bb-border); border-radius: 8px; background: #fff; box-shadow: 0 .35rem 1rem rgba(0,0,0,.12); padding: .2rem 0; max-height: 16em; }
.CodeMirror-hint { padding: .15rem .6rem; display: flex; gap: .8rem; align-items: baseline; border-radius: 0; }
.CodeMirror-hint .h-sig { white-space: nowrap; }
.CodeMirror-hint .h-doc { font-family: 'Nunito', sans-serif; font-size: .78rem; color: var(--bb-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 34em; }
li.CodeMirror-hint-active { background: var(--bb-light-bg); color: var(--bb-dark); }
li.CodeMirror-hint-active .h-doc { color: var(--bb-dark); }

/* the fold arrows in the editor gutter */
.CodeMirror-foldgutter { width: 1em; }
.CodeMirror-foldgutter-open, .CodeMirror-foldgutter-folded { color: var(--bb-green-deep); cursor: pointer; }
.CodeMirror-foldmarker { color: var(--bb-green-deep); text-shadow: none; font-family: inherit; }

/* wrapped lines: the continuation of a long line (usually a comment) is dimmed a little */
.CodeMirror-wrap pre.CodeMirror-line { word-break: break-word; }
