/* DesignClass StructuresPro · the BGE look
   Taken from the BGE course notes "An introduction to Structural Engineering": a blueprint-blue grid,
   grey sheets with thick navy borders, heavy rounded headings, amber and charcoal hazard stripes, and
   navy TASK banners. Loaded after app.css; everything here applies to <body class="bge">. */

/* ---------------------------------------------------------------- fonts (the notes' fonts; see licences/) */
@font-face { font-family: "Notes Display"; src: url("../assets/fonts/theboldfont.ttf") format("truetype"); font-display: swap; }
/* Gravity draws × as a dot (the notes show "force ⁎ distance"), so × is left out of its range and
   comes from Poppins instead: pupils see the real times sign they will meet at N5 */
@font-face { font-family: "Gravity"; src: url("../assets/fonts/gravity-book.otf") format("opentype"); font-weight: 400; font-display: swap; unicode-range: U+0000-00D6, U+00D8-FFFF; }
@font-face { font-family: "Gravity"; src: url("../assets/fonts/gravity-bold.otf") format("opentype"); font-weight: 700; font-display: swap; unicode-range: U+0000-00D6, U+00D8-FFFF; }

/* ---------------------------------------------------------------- tokens */
.bge {
  --bp: #2f5ba8;            /* blueprint blue */
  --bp-light: #3f73c4;
  --grid: rgba(255, 255, 255, .10);
  --grid-major: rgba(255, 255, 255, .18);
  --navy: #2b3a67;          /* headings, borders, task banners */
  --panel: #e7e9ee;         /* grey sheet */
  --panel-blue: #c7d4ea;    /* light blue info panel */
  --amber: #f2b632;         /* hazard stripes, cones, buttons */
  --amber-deep: #d9961a;
  --charcoal: #2c2f36;
  --red: #cf3a3a;           /* force arrows */
  --tension: #2f6fd6;       /* stretched: blue, stretch lines, arrows out */
  --compression: #e0701f;   /* squashed: orange, chevrons, arrows in */
  --good: #2e9d5b;
  --text: #24304f;
  --tap: 48px;              /* BGE buttons are bigger than the N5 tools' 44 px */
  --display: "Notes Display", "Poppins", "Arial Black", system-ui, sans-serif;
  --body: "Gravity", "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
  --header-h: 72px;
  font: 400 17px/1.45 var(--body);
  color: var(--text);
  background-color: var(--bp);
  background-image:
    linear-gradient(var(--grid-major) 1px, transparent 1px), linear-gradient(90deg, var(--grid-major) 1px, transparent 1px),
    linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px),
    radial-gradient(circle at 85% 30%, var(--bp-light), var(--bp) 60%);
  background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px, 100% 100%;
}
/* focus: a navy ring outside an amber one, so it shows on the grey sheets, on white and on amber
   buttons (SVG targets can't take box-shadow, so they draw their own ring further down) */
.bge :focus-visible { outline: 3px solid var(--navy); outline-offset: 3px; box-shadow: 0 0 0 3px var(--amber); }
.bge .btn:focus-visible { box-shadow: 0 4px 0 var(--navy), 0 0 0 3px var(--amber); }
.bge h1, .bge h2, .bge h3 { font-family: var(--display); text-transform: uppercase; font-weight: 800; letter-spacing: .02em; margin: 0; }

/* ---------------------------------------------------------------- header: charcoal with a hazard stripe */
.bge .site-header { background: var(--charcoal); border: 0; padding-bottom: 8px; }
.bge .site-header::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 8px;
  background: repeating-linear-gradient(-45deg, var(--amber) 0 14px, var(--charcoal) 14px 28px);
}
.bge .site-header :focus-visible { outline: 4px solid var(--amber); outline-offset: 3px; box-shadow: none; }
.bge .brand-text { color: inherit; text-decoration: none; }
.bge .eyebrow { font: 700 .72rem/1.3 var(--body); letter-spacing: .14em; color: var(--amber); }
.bge .app-name { font-family: var(--display); font-size: 1.45rem; text-transform: uppercase; letter-spacing: .02em; }
.bge .app-name .accent { color: var(--amber); }
.bge .app-prefix { display: none; }
.bge .rank-chip {
  margin-left: auto; display: flex; align-items: center; gap: 10px; min-width: 0; cursor: pointer;
  background: rgba(255, 255, 255, .08); border: 2px solid rgba(255, 255, 255, .18); border-radius: 999px; padding: 3px 16px 3px 4px;
  color: #fff; font: inherit; text-align: left;
}
.bge .rank-chip:hover { background: rgba(255, 255, 255, .14); }
.bge .rank-rivet svg { width: 42px; height: 42px; display: block; }
.bge .rank-text { display: grid; grid-template-columns: auto auto; column-gap: 10px; align-items: baseline; }
.bge .rank-name { font-weight: 700; font-size: .95rem; }
.bge .rank-xp { font: 400 .8rem var(--body); color: #cfd6e4; }
.bge .meter { background: rgba(255, 255, 255, .2); height: 7px; }
.bge .meter span { background: var(--amber); }

/* ---------------------------------------------------------------- buttons: chunky, with a pressed edge */
.bge .btn {
  --h: var(--tap); height: auto; min-height: var(--tap); padding: 0 18px; border-radius: 12px;
  border: 3px solid var(--navy); background: #fff; color: var(--navy); font: 700 1rem/1.1 var(--body);
  box-shadow: 0 4px 0 var(--navy); transition: transform .08s, box-shadow .08s; white-space: nowrap;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
}
.bge .btn:hover { background: #f4f6fa; color: var(--navy); }
.bge a.btn { text-decoration: none; }
.bge .btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--navy); }
.bge .btn.amber, .bge .btn.primary { background: var(--amber); color: var(--charcoal); }
.bge .btn.go { background: var(--good); color: #fff; }
.bge .btn.small { min-height: 44px; padding: 0 12px; font-size: .9rem; }
.bge .btn.big { min-height: 60px; font: 800 1.35rem/1 var(--display); text-transform: uppercase; letter-spacing: .03em; padding: 0 26px; }
.bge .site-header .btn { border-color: #fff; background: transparent; color: #fff; box-shadow: 0 4px 0 rgba(0, 0, 0, .45); }
.bge .site-header .btn.primary { background: var(--amber); border-color: var(--amber); color: var(--charcoal); }
.bge .save-btn .dot { background: #ff8a3d; box-shadow: 0 0 0 3px rgba(255, 138, 61, .35); }

/* ---------------------------------------------------------------- screens */
.bge .hub { padding: 18px 20px 40px; }
.bge .screen { max-width: 1280px; margin: 0 auto; }
.bge .screen:not([hidden]) { animation: rise .3s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* a grey sheet with a navy border, like a notes page */
.sheet { background: var(--panel); border: 4px solid var(--navy); border-radius: 6px; box-shadow: 0 10px 30px rgba(10, 25, 60, .35); padding: 18px 22px; }
.sheet h2 { color: var(--navy); font-size: 1.9rem; text-shadow: 2px 2px 0 rgba(43, 58, 103, .18); }

/* TASK banner, like the notes */
.task { position: relative; margin: 26px 0 0; }
.task .tag {
  position: absolute; top: -24px; left: 0; font-family: var(--display); font-size: 1.6rem; color: var(--bp-light); text-transform: uppercase;
  text-shadow: -2px -2px 0 #fff, 2px -2px 0 #fff, -2px 2px 0 #fff, 2px 2px 0 #fff, 3px 3px 0 var(--navy);
}
.task .bar { background: var(--navy); color: #fff; border-radius: 4px; padding: 10px 70px 10px 14px; font-size: 1.12rem; line-height: 1.35; }
.task .mark { position: absolute; right: 10px; top: -18px; width: 48px; height: 66px; }

/* ---------------------------------------------------------------- site map */
.hello { display: grid; grid-template-columns: 1fr auto; gap: 20px; align-items: end; margin-bottom: 14px; }
.hello h1 { color: #fff; font-size: 3.3rem; line-height: .95; text-shadow: 4px 4px 0 var(--navy); }
.hello h1 em { font-style: normal; color: var(--amber); display: block; font-size: 1.6rem; font-family: "Segoe Script", "Bradley Hand", cursive; text-transform: none; text-shadow: none; letter-spacing: 0; font-weight: 400; }
.hello p { color: #e8eefc; margin: 8px 0 0; max-width: 640px; }
.guide { display: flex; align-items: flex-end; gap: 10px; }
.guide-rivet svg { width: 104px; height: 104px; display: block; }
.bubble {
  background: #fff; border: 3px solid var(--navy); border-radius: 18px; padding: 12px 16px; position: relative;
  max-width: 320px; font-size: 1rem; box-shadow: 0 6px 0 rgba(0, 0, 0, .15);
}
.bubble::after {
  content: ""; position: absolute; right: -14px; bottom: 22px; width: 22px; height: 22px;
  background: #fff; border: 3px solid var(--navy); border-left: 0; border-bottom: 0; transform: rotate(45deg);
}
.map-wrap { border: 4px solid var(--navy); border-radius: 10px; overflow: hidden; box-shadow: 0 12px 34px rgba(10, 25, 60, .4); background: #3566b6; }
.map-wrap svg { display: block; width: 100%; height: auto; }
.zone { cursor: pointer; }
.zone .sign { transition: transform .15s; }
.zone:hover .sign, .zone:focus-visible .sign { transform: translateY(-6px); }
.zone:focus { outline: none; }
.zone:focus-visible .board { stroke: var(--amber); stroke-width: 6; }
/* the Bridge Works sign is amber already, so its focus ring is white */
.zone[data-go="bridge"]:focus-visible .board { stroke: #fff; stroke-width: 8; }

.missions { list-style: none; margin: 18px 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.mission .foot { flex-wrap: wrap; row-gap: 6px; }
.mission {
  width: 100%; height: 100%; background: var(--panel); border: 4px solid var(--navy); border-radius: 10px; padding: 0 0 14px;
  text-align: left; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 6px 0 var(--navy); cursor: pointer;
  font: inherit; color: inherit; transition: transform .1s;
}
.mission:hover { transform: translateY(-3px); }
.mission .pic { display: grid; background: var(--panel-blue); height: 120px; display: grid; place-items: center; border-bottom: 4px solid var(--navy); position: relative; }
.mission .pic svg { height: 104px; width: auto; }
.mission .num { position: absolute; left: 10px; top: 10px; width: 38px; height: 38px; border-radius: 50%; background: var(--amber); border: 3px solid var(--navy); display: grid; place-items: center; font-family: var(--display); font-size: 1.25rem; color: var(--navy); }
.mission .m-title { display: block; color: var(--navy); font: 800 1.35rem/1.1 var(--display); text-transform: uppercase; letter-spacing: .02em; padding: 12px 14px 2px; }
.mission .m-text { display: block; margin: 0 14px; font-size: .96rem; line-height: 1.35; flex: 1; }
.mission .foot { display: flex; margin: 12px 14px 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stars { display: flex; gap: 2px; }
.stars svg { width: 24px; height: 24px; }
.mini-badges { display: flex; gap: 3px; }
.mini-badges svg { width: 28px; height: 28px; }
.step-bars { display: flex; gap: 6px; margin: 10px 14px 0; }
.step-bars i { flex: 1; height: 8px; border-radius: 4px; background: #c4c9d4; }
.step-bars i.done { background: var(--good); }
/* the step to do next has hazard stripes, so it differs from a done step by pattern as well as colour */
.step-bars i.now { background: repeating-linear-gradient(-45deg, var(--amber) 0 5px, var(--charcoal) 5px 8px); }
.missions .wide { grid-column: 1 / -1; }
.mission.wide { flex-direction: row; padding-bottom: 0; }
.mission.wide .pic { width: 220px; height: auto; min-height: 110px; flex: none; border-bottom: 0; border-right: 4px solid var(--navy); }
.mission.wide .wide-body { flex: 1; display: flex; flex-direction: column; padding-bottom: 12px; }
.mission .hint { font-size: .9rem; color: #5a6380; }

.band2 { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; margin-top: 18px; }
.band2 .sheet h2 { font-size: 1.6rem; }
.shelf { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; min-height: 64px; align-items: center; }
.shelf svg { width: 60px; height: 60px; }
.shelf .empty { color: #5a6380; font-size: .96rem; }
.shelf-line { margin: 10px 0 0; font-size: .96rem; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.keep-card { display: flex; flex-direction: column; gap: 10px; }
.keep-card p { margin: 4px 0 0; font-size: .96rem; }
.bge .dropzone {
  border: 3px dashed var(--navy); border-radius: 12px; background: #fff; color: var(--navy); padding: 12px; cursor: pointer;
  display: flex; flex-direction: column; gap: 2px; text-align: center; font: inherit; position: static;
}
.bge .dropzone::before, .bge .dropzone::after { display: none; }
.bge .dropzone:hover { border-color: var(--amber-deep); background: #fffaf0; }
.bge .dropzone strong { color: var(--navy); font-weight: 700; }
.bge .dropzone b { color: var(--navy); font-family: var(--body); }
.bge .keep-note { color: #5a6380; font-size: .9rem; }
.bge .keep-note span { color: var(--amber-deep); }
.bge .warn-line { color: var(--amber); }
.bge .hub-foot { color: #dfe8fb; font-size: .82rem; padding: 22px 0 0; }

/* ---------------------------------------------------------------- mission screen */
.game-head { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; color: #fff; flex-wrap: wrap; }
.game-head .btn.back { border-color: #fff; background: transparent; color: #fff; box-shadow: 0 4px 0 rgba(0, 0, 0, .35); }
/* on the blueprint blue a navy ring barely shows, so the back button's ring is amber outside navy */
.game-head .btn.back:focus-visible { outline-color: var(--amber); box-shadow: 0 4px 0 rgba(0, 0, 0, .35), 0 0 0 3px var(--navy); }
.game-head h1 { font-size: 2.5rem; text-shadow: 3px 3px 0 var(--navy); line-height: 1; }
.game-head h1 small { display: block; font: 400 .95rem/1.2 var(--body); text-transform: none; letter-spacing: .02em; color: #dfe8fb; text-shadow: none; margin-top: 4px; }
.road { margin-left: auto; display: flex; align-items: center; background: var(--charcoal); border-radius: 999px; padding: 6px; gap: 4px; }
.road span { display: flex; align-items: center; gap: 6px; padding: 6px 14px 6px 8px; border-radius: 999px; font-weight: 700; font-size: .92rem; color: #aab3c5; }
.road svg { width: 26px; height: 26px; }
.road span.done { color: #fff; position: relative; }
/* a tick on each done step, so done shows without colour, and on iPads where the step names are hidden */
.road span.done::after {
  content: "✓"; position: absolute; left: 22px; top: -3px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--good); border: 2px solid var(--charcoal); color: #fff; font: 800 10px/16px var(--body); text-align: center;
}
.road span.now { background: var(--amber); color: var(--charcoal); }

.game { display: grid; grid-template-columns: 1fr 320px; gap: 16px; align-items: start; }
.side { display: flex; flex-direction: column; gap: 14px; }
.side .sheet { padding: 14px 16px; }
.side h3 { color: var(--navy); font-size: 1.25rem; margin-bottom: 6px; }
.coach { display: flex; gap: 10px; align-items: flex-start; }
.coach svg { width: 64px; height: 64px; flex: none; }
.coach p { margin: 0; font-size: 1.02rem; }
.word-card { background: var(--panel-blue); border-radius: 10px; padding: 10px 12px; font-size: .96rem; }

.brief { display: grid; grid-template-columns: 200px 1fr; gap: 18px; margin-top: 16px; align-items: start; }
.brief-pic { background: var(--panel-blue); border: 3px solid var(--navy); border-radius: 10px; display: grid; place-items: center; padding: 10px; }
.brief-pic svg { width: 100%; height: auto; }
.brief-pic small { display: block; text-align: center; font-size: .86rem; margin-top: 6px; }
.steps4 { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.steps4 li { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; background: #fff; border: 3px solid var(--navy); border-radius: 12px; padding: 8px 12px; }
.steps4 li svg { width: 32px; height: 32px; }
.steps4 b { font-family: var(--display); text-transform: uppercase; color: var(--navy); font-size: 1.05rem; font-weight: 800; }
.steps4 p { margin: 2px 0 0; font-size: .94rem; line-height: 1.3; }
.steps4 .state { font-size: .82rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: #e4e7ee; color: #5a6380; white-space: nowrap; }
.steps4 .state.done { background: var(--good); color: #fff; }
.steps4 li.soon { border-style: dashed; }
.levels { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.levels li { background: #fff; border: 3px dashed #9aa3b5; border-radius: 12px; padding: 8px 12px; display: flex; flex-direction: column; gap: 4px; }
.levels b { color: var(--navy); }
.building { margin: 14px 0 0; padding: 10px 14px; border-radius: 10px; background: #fff6dc; border: 2px solid var(--amber-deep); font-size: .96rem; }
.patch-card { display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: center; }
.patch-card svg { width: 96px; height: 96px; }
.patch-card p { margin: 0; font-size: .94rem; }
.sticker-row { display: flex; flex-direction: column; gap: 8px; }
.sticker-row div { display: grid; grid-template-columns: 52px 1fr; gap: 8px; align-items: center; font-size: .9rem; line-height: 1.25; }
.sticker-row svg { width: 52px; height: 52px; }
.sticker-row b { display: block; color: var(--navy); }
.sticker-row .locked b, .sticker-row .locked span { color: #8a93a6; }

/* the briefing's step and level buttons, once a mission's game is built */
.steps4 .st-text span { display: block; font-size: .94rem; line-height: 1.3; margin-top: 2px; }
.steps4.playable li { display: block; background: none; border: 0; padding: 0; }
.step-btn, .level-btn {
  width: 100%; display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; text-align: left;
  background: #fff; border: 3px solid var(--navy); border-radius: 12px; padding: 8px 12px; font: inherit; color: inherit; cursor: pointer;
  box-shadow: 0 4px 0 var(--navy); transition: transform .08s;
}
.step-btn svg { width: 32px; height: 32px; }
.step-btn b { font-family: var(--display); text-transform: uppercase; color: var(--navy); font-size: 1.05rem; font-weight: 800; }
.step-btn:hover:not(:disabled), .level-btn:hover:not(:disabled) { transform: translateY(-2px); }
.step-btn:disabled, .level-btn:disabled { cursor: default; box-shadow: none; border-style: dashed; opacity: .7; }
.step-btn.extra { border-color: var(--amber-deep); background: #fffaf0; }
.steps4 .state.go { background: var(--amber); color: var(--charcoal); }
.levels li.playable { border: 0; padding: 0; background: none; }
.level-btn { grid-template-columns: 1fr auto; row-gap: 2px; }
.level-btn .stars { grid-column: 1; }
.level-btn .state { grid-row: 1 / span 2; grid-column: 2; font-weight: 700; font-size: .85rem; }

/* ---------------------------------------------------------------- mission games (Balance Builders first) */
.bb-stage svg.scene { display: block; width: 100%; height: auto; background: #f4f6fa; border: 3px solid var(--navy); border-radius: 8px; margin-top: 12px; touch-action: none; }
.bb-controls { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.row3 { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row3.predict .btn { flex: 1; flex-direction: column; gap: 0; min-height: 60px; white-space: normal; }
.row3.predict small { font-weight: 400; font-size: .8rem; }
.bge .btn.right { background: #e3f5ea; border-color: var(--good); box-shadow: 0 4px 0 var(--good); }
.bge .btn.wrong { background: #fde8e4; border-color: #b33a1d; border-style: dashed; box-shadow: 0 4px 0 #b33a1d; }
.bge .btn.chosen, .bge .btn.sel { background: #fff6dc; border-color: var(--amber-deep); box-shadow: 0 4px 0 var(--amber-deep); }
.bge .btn:disabled { opacity: .55; cursor: default; }
.qrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: #fff; border: 3px solid var(--navy); border-radius: 12px; padding: 8px 12px; }
.qrow > span:first-child { font-weight: 700; color: var(--navy); }
.pair { display: flex; gap: 8px; flex-wrap: wrap; }
.say.ok { color: var(--good); font-weight: 700; }
.say.no { color: #b33a1d; font-weight: 700; }
.streak { color: #fff; margin: 4px 4px 0; }

/* svg text on the see-saw, the spanner and the Moment Mat */
.mark-label { font: 400 14px var(--body); fill: var(--navy); }
.dim-label { font: 800 15px var(--display); fill: var(--navy); }
.dim-label.unknown { fill: var(--red); }
.load-label { font: 700 19px var(--body); fill: var(--navy); }
.load-label.small { font-size: 15px; }
.turn-label { font: 800 13px var(--display); }
.up-label { font: 700 15px var(--body); fill: #1d7a44; }
.tile-label { font: 700 14px var(--body); fill: var(--navy); }
.mark-hit { fill: transparent; cursor: pointer; }
.mark-hit:hover, .mark-hit:focus-visible { fill: rgba(242, 182, 50, .22); outline: none; }
.load-hit { fill: transparent; cursor: grab; }
.load-hit:focus-visible { fill: rgba(242, 182, 50, .3); outline: none; }
/* SVG targets draw a dashed navy ring when focused from the keyboard */
.mark-hit:focus-visible, .load-hit:focus-visible, .tap-zone:focus-visible rect, .tap-zone:focus-visible circle { stroke: var(--navy); stroke-width: 4; stroke-dasharray: 8 5; }
.load.selected { filter: drop-shadow(0 0 6px #f2b632); }
.equation { text-align: center; font-size: 1.3rem; margin: 10px 0 0; color: var(--navy); }

/* the load tray, and a load being dragged */
.tray { display: flex; gap: 8px; flex-wrap: wrap; min-height: 56px; align-items: center; }
.tray-load {
  display: flex; align-items: center; gap: 6px; min-height: var(--tap); padding: 4px 10px 4px 4px; cursor: grab; touch-action: none;
  background: #fff; border: 3px solid var(--navy); border-radius: 12px; font: inherit; color: var(--navy); box-shadow: 0 3px 0 var(--navy);
}
.tray-load svg { width: 46px; height: 40px; }
.tray-load span { display: flex; flex-direction: column; font-size: .82rem; line-height: 1.1; text-align: left; }
.tray-load b { font-size: 1rem; }
.tray-load.sel { background: #fff6dc; border-color: var(--amber-deep); transform: translateY(-3px); }
.tray-empty { color: #5a6380; font-size: .95rem; }
/* in the side panel the tray is a list, with each load's name */
.side .tray { flex-direction: column; align-items: stretch; gap: 6px; }
.side .tray-load span { font-size: .82rem; }
.side .tray-load svg { width: 40px; height: 35px; }
.drag-ghost { position: fixed; z-index: 70; pointer-events: none; transform: translate(-50%, -60%); display: flex; align-items: center; gap: 6px; padding: 4px 10px; background: #fff; border: 3px solid var(--amber-deep); border-radius: 12px; opacity: .9; }
.drag-ghost svg { width: 46px; height: 40px; }
.drag-ghost span { display: flex; flex-direction: column; font-size: .8rem; }

/* the keypad and unit picker (no iPad keyboard pops up) */
.keypad { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; }
.keypad .unit-key { border-color: var(--amber-deep); box-shadow: 0 3px 0 var(--amber-deep); }
.keypad .unit-key.sel { background: var(--amber); }
.keypad button, .units button {
  min-height: var(--tap); border-radius: 10px; border: 3px solid var(--navy); background: #fff; color: var(--navy);
  font: 700 1.2rem var(--body); cursor: pointer; box-shadow: 0 3px 0 var(--navy);
}
.keypad button:active, .units button:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--navy); }
.units { display: flex; gap: 8px; }
.units button { flex: 1; }
.units button.sel { background: var(--amber); }

/* the working pad, laid out like the worked example in the notes */
.working { background: var(--navy); color: #fff; border-radius: 6px; padding: 12px 14px; font-size: 1.05rem; line-height: 1.6; text-align: center; }
.working sub { font-size: .7em; }
.working .padrow { margin-top: 4px; }
.working .padrow.big { font-size: 1.25rem; margin-top: 8px; }
.working .gap { color: var(--amber); }
.working .blank { display: inline-block; min-width: 40px; border-bottom: 3px solid var(--amber); }
.slot {
  min-width: 70px; min-height: 40px; padding: 0 8px; border-radius: 8px; border: 3px solid #8fa1cc; background: #fff;
  color: var(--navy); font: 700 1.05rem var(--body); cursor: pointer;
}
.slot.active { border-color: var(--amber); box-shadow: 0 0 0 3px rgba(242, 182, 50, .5); }
.slot.good { border-color: var(--good); background: #e3f5ea; }
.unit-shown { display: inline-block; min-width: 3em; color: var(--amber); font-weight: 700; }
.answer-line { font-size: 1.5rem; text-align: center; margin: 30px 0; color: var(--navy); }
.answer-line .slot { font-size: 1.4rem; min-width: 110px; min-height: 52px; }
.answer-line .unit-shown { color: var(--navy); }
.chips { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.chips .ask { width: 100%; margin: 0; font-weight: 700; color: var(--navy); }
.src { font-size: .8em; opacity: .8; }

/* the moment meter, behind a roller door until the props come away */
.meter-wrap { position: relative; min-height: 150px; }
.meter2 { display: grid; grid-template-columns: 1fr auto 1fr; gap: 6px; align-items: end; font-size: .78rem; text-align: center; }
.meter2 .bar { display: flex; align-items: flex-end; justify-content: center; height: 90px; }
.meter2 i { display: block; width: 46px; border-radius: 6px 6px 0 0; }
.meter2 .acw i { background: radial-gradient(circle, rgba(255, 255, 255, .55) 2px, transparent 2.5px) 0 0 / 9px 9px, #1f8f8a; }
.meter2 .cw i { background: repeating-linear-gradient(-45deg, #3a3f4a 0 7px, #5a606d 7px 14px); }
.meter2 b { display: block; color: var(--navy); }
.meter2 ul { list-style: none; margin: 2px 0; padding: 0; line-height: 1.3; }
.meter2 .total { font-size: .95rem; }
.meter2 .cmp { font: 800 1.8rem var(--display); color: var(--navy); align-self: center; }
.meter-wrap .door {
  position: absolute; inset: 0; border-radius: 8px; display: grid; place-items: center; text-align: center; padding: 8px;
  background: repeating-linear-gradient(0deg, #8a93a6 0 10px, #9aa3b5 10px 12px); border: 3px solid var(--navy);
  transition: transform .6s ease-in; transform-origin: top;
}
.meter-wrap .door span { background: var(--navy); color: #fff; padding: 6px 10px; border-radius: 8px; font-size: .85rem; font-weight: 700; }
.meter-wrap.open .door { transform: scaleY(0); }

/* the Check */
.choices { display: grid; gap: 10px; margin-top: 16px; }
.choices .btn { justify-content: flex-start; white-space: normal; text-align: left; min-height: 56px; }
.choices.across { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-top: 0; }
.choices.across .btn { justify-content: center; text-align: center; line-height: 1.2; }
.unit-rows { display: grid; gap: 10px; margin-top: 16px; }
.tap-zone { cursor: pointer; }
.tap-zone:hover rect, .tap-zone:hover circle, .tap-zone:focus-visible rect, .tap-zone:focus-visible circle { fill: rgba(242, 182, 50, .3); }
.tap-zone:focus { outline: none; }
.score { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.score span { padding: 8px 14px; border-radius: 10px; font-weight: 700; border: 3px solid; }
.score .right { border-color: var(--good); color: var(--good); background: #e3f5ea; }
.score .wrong { border-color: #b33a1d; color: #b33a1d; background: #fde8e4; }
.big-stars { display: flex; justify-content: center; gap: 10px; margin: 24px 0; }
.big-stars svg { width: 90px; height: 90px; }

/* ---------------------------------------------------------------- mission 1: Structure Spotter */
.ic { display: block; }
.valley-wrap { position: relative; }
.hotspot { cursor: pointer; }
.hotspot .hot-bg { fill: transparent; }
.hotspot:hover .hot-bg, .hotspot:focus-visible .hot-bg { fill: rgba(242, 182, 50, .28); }
.hotspot:focus-visible .hot-bg { fill: rgba(242, 182, 50, .35); stroke: var(--navy); stroke-width: 4; stroke-dasharray: 10 6; }
.hotspot:focus { outline: none; }
.tag-new { fill: var(--amber); stroke: var(--navy); stroke-width: 2.5; }
.tag-got { fill: var(--navy); stroke: #fff; stroke-width: 2.5; }
.tag-text { font: 800 14px var(--body); fill: var(--navy); }
.tag-got + .tag-text { fill: #fff; }
.xr { pointer-events: none; }
.xr-label { font: 800 14px var(--display); fill: #4fe3ff; stroke: #0d2350; stroke-width: 3px; paint-order: stroke; letter-spacing: .03em; }
.note-card {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(520px, 90%); z-index: 2;
  background: #fff; border: 4px solid var(--navy); border-radius: 14px; padding: 16px 20px; box-shadow: 0 12px 30px rgba(10, 25, 60, .4);
}
.note-card h3 { color: var(--navy); font-size: 1.25rem; }
.note-card p { margin: 8px 0 12px; }
.row3.dial { flex-wrap: nowrap; }
.dial .btn { flex: 1 1 0; min-width: 0; min-height: 56px; white-space: normal; }
.dial .btn.era { flex-direction: column; gap: 0; line-height: 1.1; }
.dial + .btn { margin-top: 10px; }
.dial .btn.era small { font-weight: 400; font-size: .75rem; }
.bge .btn.tried { opacity: .7; text-decoration: line-through; }
.guide-card .gc-top { display: grid; grid-template-columns: 64px 1fr; gap: 10px; align-items: start; }
.guide-card .ic { width: 64px; height: 64px; }
.guide-card h3 { margin: 0; }
.guide-card p { margin: 4px 0 0; font-size: .92rem; line-height: 1.3; }
.guide-card .q { font-weight: 700; color: var(--navy); margin-top: 10px; }
.guide-card .done-line { color: var(--good); font-weight: 700; }
.guide-grid { display: grid; grid-template-columns: repeat(auto-fill, 44px); gap: 4px; margin: 6px 0; }
.gg { width: 44px; height: 44px; padding: 2px; border: 2px solid var(--navy); border-radius: 8px; background: #fff; cursor: pointer; }
.gg .ic { width: 100%; height: 100%; }
.small-line { font-size: .82rem; margin: 6px 0; color: #4a5372; }
.postcard { display: grid; grid-template-columns: 52px 1fr; gap: 8px; align-items: start; margin: 8px 0; font-size: .86rem; line-height: 1.3; }
.postcard .ic { width: 52px; height: 52px; }
.postcard p { margin: 2px 0 0; }
.crate-label { font: 700 18px var(--body); fill: var(--navy); }
.bob-label { font: 700 17px var(--body); fill: var(--navy); }
.stamp { font: 800 28px var(--display); letter-spacing: .04em; }
.stamp.ok { fill: var(--good); }
.stamp.no { fill: var(--red); }
.tiny { font: 700 10px var(--body); fill: var(--navy); }
.cracked { fill: #e7a29a; stroke: var(--red); }

/* sorting trays: tap an item, then tap its box */
.tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-top: 14px; min-height: 60px; }
.tiles.words { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tile {
  background: #fff; border: 3px solid var(--navy); border-radius: 12px; padding: 6px 4px 8px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px; font: 700 .9rem var(--body); color: var(--navy); box-shadow: 0 4px 0 var(--navy);
}
.tile .ic { width: 60px; height: 60px; }
.tile.text { justify-content: center; min-height: var(--tap); padding: 8px; text-align: center; }
.tile.sel { background: #fff6dc; border-color: var(--amber-deep); box-shadow: 0 4px 0 var(--amber-deep); transform: translateY(-4px); }
.bins { display: grid; gap: 12px; margin-top: 16px; }
.bins.n2 { grid-template-columns: repeat(2, 1fr); }
.bins.n3 { grid-template-columns: repeat(3, 1fr); }
.bins.n6 { grid-template-columns: repeat(6, 1fr); }
.bin {
  border: 4px dashed var(--navy); border-radius: 14px; background: #f7f8fb; min-height: 130px; cursor: pointer; font: inherit; color: inherit;
  display: flex; flex-direction: column; align-items: center; padding: 10px; gap: 4px; text-align: center;
}
.bin.ready { border-style: solid; border-color: var(--amber-deep); background: #fffaf0; }
.bin b { font: 800 1.4rem var(--display); color: var(--navy); text-transform: uppercase; }
.bin small { font-size: .82rem; line-height: 1.25; }
.bin .got { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; }
.bin .got .ic { width: 38px; height: 38px; background: #fff; border: 2px solid var(--good); border-radius: 8px; }
.bin .got i { font-style: normal; font-weight: 700; font-size: .8rem; color: var(--good); background: #e3f5ea; border-radius: 6px; padding: 2px 6px; }
.bin.pic { min-height: 120px; }
.bin.pic .bin-pic { width: 72px; height: 72px; }

/* X-Ray Mystery: frosted panes */
.mystery { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.pane {
  min-height: 112px; border-radius: 12px; border: 3px solid var(--navy); cursor: pointer; font: 700 .85rem var(--body); color: var(--navy);
  background: linear-gradient(135deg, #e9f1fb, #b9cbe6); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; position: relative;
}
.pane .frost { font: 800 2.4rem var(--display); color: #fff; text-shadow: 0 2px 0 var(--navy); }
.pane.clear { background: #fff; }
.pane .ic { width: 56px; height: 56px; }
.row3.forms .btn { flex: 1; min-height: 52px; font-size: 1.1rem; }
.mystery + .ask, #gControls > .ask { margin: 0 0 8px; font-weight: 700; color: var(--navy); }
.pane em { font-style: normal; font-size: .75rem; padding: 1px 8px; border-radius: 999px; }
.pane.good { border-color: var(--good); } .pane.good em { background: var(--good); color: #fff; }
.pane.bad { border-color: #b33a1d; } .pane.bad em { background: #b33a1d; color: #fff; }

/* Bridge Brief */
.bridge-pick { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.pick { border: 3px solid var(--navy); border-radius: 12px; background: #fff; cursor: pointer; padding: 4px; font: 700 .85rem var(--body); color: var(--navy); display: flex; flex-direction: column; align-items: center; }
.pick .ic { width: 64px; height: 64px; }
.pick.sel { background: #fff6dc; border-color: var(--amber-deep); box-shadow: 0 0 0 3px var(--amber); }

/* Storm Shelter design controls */
.design { display: grid; grid-template-columns: auto auto; justify-content: space-between; gap: 8px 12px; margin-bottom: 10px; }
.design > div { display: flex; align-items: center; gap: 8px; }
.design > div > b { flex: 0 0 auto; width: 52px; color: var(--navy); font-size: .88rem; line-height: 1.1; }
.design .seg { flex-wrap: nowrap; }
.design .seg .btn { padding: 0 10px; }
.design .foot { display: inline-flex; align-items: center; gap: 4px; font-size: .9rem; margin-right: 6px; }
.seg .btn.pm { width: 44px; padding: 0; font-size: 1.2rem; }
.mini-stars { display: flex; align-items: center; gap: 6px; }
.mini-stars svg { width: 26px; height: 26px; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.seg .btn { min-height: 44px; min-width: 44px; padding: 0 12px; font-size: .9rem; }
.seg .count { font-weight: 700; color: var(--navy); padding: 0 6px; }
.points { font-size: 1.1rem; margin: 4px 0; }
.points b { font: 800 2rem var(--display); color: var(--navy); }
.points.over b { color: var(--red); }

/* text only screen readers hear */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------------------------------------------------------- mission 2: Wobble Workshop */
.slot-hit { stroke: transparent; stroke-width: 30; stroke-linecap: butt; cursor: pointer; }
.pins, .load-arrow { pointer-events: none; }
.slot-dash { stroke: #2f5ba8; stroke-width: 5; stroke-dasharray: 10 8; stroke-linecap: round; opacity: .75; pointer-events: none; }
.slot-line.blocked .slot-dash { stroke: #b33a1d; opacity: .45; }
.slot-line:hover .slot-hit, .slot-line:focus-visible .slot-hit, .brace-hit:hover .slot-hit, .brace-hit:focus-visible .slot-hit { stroke: rgba(242, 182, 50, .45); }
/* keyboard focus: a strong amber band, and the slot's dashes turn solid navy */
.slot-line:focus-visible .slot-hit, .brace-hit:focus-visible .slot-hit { stroke: rgba(242, 182, 50, .85); }
.slot-line:focus-visible .slot-dash { stroke: var(--navy); stroke-width: 9; stroke-dasharray: none; opacity: 1; }
.slot-line:focus, .brace-hit:focus { outline: none; }
.brace-hit { cursor: pointer; }
.brace-hit:focus-visible line { filter: drop-shadow(0 0 4px #f2b632); }
.spot-label { font: 800 22px var(--display); fill: var(--navy); }
.pull-label { font: 800 20px var(--display); letter-spacing: .02em; }
.clear-label { font: 800 16px var(--display); fill: #b33a1d; letter-spacing: .03em; pointer-events: none; }
.gauge-read { font: 700 17px var(--body); fill: #fff; }
.parts { display: grid; gap: 8px; margin: 6px 0; }
.parts .btn { justify-content: flex-start; flex-direction: column; align-items: flex-start; gap: 0; line-height: 1.15; min-height: 52px; }
.parts .btn small { font-weight: 400; font-size: .78rem; }
.sec { display: block; width: 72px; height: 72px; }
.sec.big { width: 120px; height: 120px; }
.sec.bin-pic { width: 76px; height: 76px; }
.big-sec { display: flex; justify-content: center; margin: 6px 0; }
.tiles.names { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; margin-top: 8px; }
.tiles.names .tile { min-height: 44px; font-size: .82rem; padding: 4px; }
/* Task 14: the nine sections in the notes' own 3 × 3 order */
.bins.n3x3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.bins.n3x3 .bin { min-height: 0; padding: 4px 8px; border-width: 3px; flex-direction: row; justify-content: flex-start; gap: 8px; }
.bins.n3x3 .sec.bin-pic { width: 62px; height: 62px; flex: 0 0 auto; }
.bins.n3x3 .got { flex: 1; justify-content: flex-start; }
.bins.n3x3 .got i { font-size: .85rem; }
.frame-pics { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.frame-pic { border: 3px solid var(--navy); border-radius: 12px; background: #fff; padding: 4px; cursor: pointer; font: 700 .76rem var(--body); color: var(--navy); display: flex; flex-direction: column; align-items: center; gap: 2px; line-height: 1.15; }
.frame-pic svg { width: 100%; height: auto; }
.frame-pic.sel { background: #fff6dc; border-color: var(--amber-deep); box-shadow: 0 0 0 3px var(--amber); }
.frame-pic.good { border-color: var(--good); }
.frame-pic.bad { border-color: #b33a1d; }
.frame-pic em { font-style: normal; display: block; }
.frame-pic.good em { color: var(--good); }
.frame-pic.bad em { color: #b33a1d; }
.choices.with-pics, .choices.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.choices.four .btn { justify-content: center; text-align: center; }
.choices .btn.right:disabled, .choices .btn.wrong:disabled { opacity: 1; }
.choices.with-pics .btn { flex-direction: column; justify-content: center; text-align: center; gap: 2px; }
.beam-card .q { font-weight: 700; color: var(--navy); margin: 8px 0 4px; }
.beam-card .seg .btn { flex: 1; padding: 0 6px; font-size: .84rem; }
.beam-card .row3 { margin: 10px 0 4px; }
.beam-card .row3 .btn { flex: 1; }
#gControls > .ask { margin: 0 0 6px; font-weight: 700; color: var(--navy); }
.sec-picks { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 6px; margin-bottom: 8px; }
.sec-picks .pick { padding: 2px; min-height: 48px; }
.sec-picks .pick .sec { width: 100%; height: auto; max-width: 64px; }

/* ---------------------------------------------------------------- mission 3: Squash & Stretch */
.badge-text { font: 800 16px var(--body); fill: #fff; }
.tag-list .tag-row { display: grid; grid-template-columns: auto 1fr; gap: 4px 8px; align-items: center; padding: 6px 0; border-top: 2px dashed #d3d8e3; }
.tag-list .tag-row:first-of-type { border-top: 0; }
.tag-list .tag-row .tagpair { grid-column: 1 / -1; }
.tag-list .num { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--navy); color: #fff; font-weight: 800; font-size: .85rem; }
.tagpair { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.tagpair .btn { flex-direction: column; gap: 0; line-height: 1.1; min-height: 48px; padding: 4px 6px; font-size: .9rem; white-space: normal; }
.tagpair .btn small { font-weight: 400; font-size: .72rem; }
.tagpair .btn.tag-t.sel { background: #e3edfb; border-color: #2f6fd6; box-shadow: 0 4px 0 #2f6fd6; }
.tagpair .btn.tag-c.sel { background: #fdeee2; border-color: #e0701f; box-shadow: 0 4px 0 #e0701f; }
.tagpair .btn.right:disabled, .tagpair .btn.wrong:disabled { opacity: 1; }
.q-tags { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; margin-top: 8px; }
.q-tags .tag-row:nth-of-type(2) { border-top: 0; }
.choices.three, .choices.why { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.choices.why .btn { font-size: .86rem; min-height: 64px; padding: 6px 8px; }
.spring-opt { flex-direction: column; gap: 2px; min-height: 96px; }
.spring-opt svg { width: 100%; height: 56px; }
.spring-badge { width: 240px; height: 90px; }
.tool-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 10px; }
.tool-card { border: 3px solid var(--navy); border-radius: 14px; background: #fff; padding: 8px; cursor: pointer; font: inherit; color: var(--navy); display: flex; flex-direction: column; align-items: center; gap: 4px; box-shadow: 0 4px 0 var(--navy); }
.tool-card svg { width: 100%; max-width: 130px; height: auto; }
.tool-card .kind-word { font: 800 1.1rem var(--display); color: var(--amber-deep); min-height: 1.3em; }
.tool-card.playing { background: #fffaf0; }
.tool-card g { transform-box: fill-box; }
.tool-card.playing .anim-squeeze { animation: squeeze 1.2s ease-in-out infinite; transform-origin: center; }
.tool-card.playing .anim-hammer { animation: hammer .8s ease-in infinite; transform-origin: 50% 100%; }
.tool-card.playing .anim-twist { animation: twist 1s linear infinite; transform-origin: center; }
.tool-card.playing .anim-snip-a { animation: snipA .7s ease-in-out infinite alternate; transform-origin: 50% 75%; }
.tool-card.playing .anim-snip-b { animation: snipB .7s ease-in-out infinite alternate; transform-origin: 50% 75%; }
@keyframes squeeze { 50% { transform: scaleX(.93); } }
@keyframes hammer { 0% { transform: rotate(-35deg); } 70% { transform: rotate(4deg); } 100% { transform: rotate(-35deg); } }
@keyframes twist { to { transform: rotate(360deg); } }
@keyframes snipA { to { transform: rotate(-14deg); } }
@keyframes snipB { to { transform: rotate(14deg); } }
.tap-part { cursor: pointer; }
.tap-part:focus { outline: none; }
.tap-part:focus-visible { filter: drop-shadow(0 0 5px #f2b632); }
/* the filter doesn't show on every iPad, so the hit path also gets a dashed navy ring */
.tap-part:focus-visible path:first-child { stroke: var(--navy); stroke-opacity: .5; stroke-dasharray: 8 5; }
.tool-sort { display: grid; gap: 6px; margin-top: 6px; }
.tool-row { display: grid; grid-template-columns: 120px 1fr 150px; gap: 8px; align-items: center; }
.tool-row .pair .btn { min-height: 44px; padding: 0 10px; font-size: .85rem; }
.tool-row .fair { font-style: normal; font-size: .8rem; color: #4a5372; }
.mat-picks .btn { flex: 1; padding: 0 8px; }
@media (prefers-reduced-motion: reduce) { .tool-card.playing g { animation: none !important; } }

/* ---------------------------------------------------------------- mission 5: Bridge Works */
/* the board never grows so tall that Drive it! leaves the screen (smaller screens tighten this below) */
.bb-stage svg.scene.bolt-board { max-height: calc(100vh - 400px); min-height: 260px; touch-action: manipulation; }
/* while peeking, the slider row sits under the board, so the board gives up its height */
.bb-stage.peeking svg.scene.bolt-board { max-height: calc(100vh - 450px); min-height: 230px; }
.bolt-board:focus { outline: none; }
.bolt-board:focus-visible, .bolt-board.kb:focus { outline: 3px solid var(--amber); outline-offset: 2px; }
/* the keyboard cursor shows only while the board is being used from the keyboard */
.bolt-board .kb-cursor { display: none; pointer-events: none; }
.bolt-board.kb:focus .kb-cursor { display: inline; }
.hole-hit { fill: transparent; cursor: pointer; }
.hole-hit:hover { fill: rgba(242, 182, 50, .25); }
.grid-label { font: 700 15px var(--body); fill: #4a5372; }
.limit-mark { font: 800 22px var(--display); fill: var(--red); }
.peek-row { display: flex; align-items: center; gap: 10px; margin-top: 6px; font-weight: 700; color: var(--navy); }
.peek-row input { flex: 1; min-height: 44px; accent-color: var(--amber-deep); }
.bw-parts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin: 0 0 8px; }
.bw-parts .btn { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 0 6px; min-height: 48px; min-width: 0; padding: 4px 8px; font-size: .86rem; white-space: normal; line-height: 1.15; text-align: left; }
.bw-parts .btn small { flex-basis: 100%; font-size: .72rem; white-space: normal; }
.bw-parts .btn.wide { grid-column: 1 / -1; min-height: 44px; }
.bw-parts .btn.sel { background: #fff6dc; border-color: var(--amber-deep); box-shadow: 0 4px 0 var(--amber-deep); }
.swatch { display: inline-block; width: 22px; height: 8px; border-radius: 4px; border: 2px solid var(--navy); }
.sw-rope { background: repeating-linear-gradient(90deg, #8a5a2c 0 6px, transparent 6px 9px); border-color: #8a5a2c; height: 4px; }
.sw-wood { background: #c9a46a; }
.sw-steel { background: #8a93a6; }
.sw-girder { background: #2b3a67; height: 11px; }
.money-box { position: relative; }
.money-line { margin: 0 0 4px; color: var(--navy); }
.money-box .frames { display: flex; flex-wrap: wrap; gap: 4px; }
.tenframe { width: 112px; height: 34px; }
.over-band { margin: 6px 0 0; padding: 4px 10px; border-radius: 8px; font-weight: 800; color: #fff; text-shadow: 0 1px 0 #000;
  background: repeating-linear-gradient(45deg, var(--red) 0 12px, #2c2f36 12px 24px); }
.left-line { margin: 6px 0 0; font-weight: 700; color: var(--good); }
.chip-fly { position: absolute; right: 10px; top: 6px; background: var(--amber); color: var(--navy); font-weight: 800; font-size: .85rem; border-radius: 999px; padding: 2px 10px; animation: chipfly 1.2s ease-out forwards; pointer-events: none; }
@keyframes chipfly { from { transform: translateY(10px); opacity: 0; } 20% { opacity: 1; } to { transform: translateY(-24px); opacity: 0; } }
.side .tools { display: flex; flex-wrap: wrap; gap: 6px; }
.side .tools .btn { flex: 1 1 auto; min-height: 44px; padding: 0 10px; font-size: .88rem; }
.bar-rows { list-style: none; margin: 4px 0 0; padding: 0; font-size: .85rem; }
.bar-rows li { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 4px 0; border-bottom: 1px solid #d3d8e3; line-height: 1.25; }
.bar-rows li span { min-width: 0; }
.bar-rows small { color: #4a5372; }
.bridge-list .btn.small { min-height: 44px; padding: 0 10px; font-size: .82rem; flex: 0 0 auto; }
.add-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; font-size: .85rem; }
.add-row input, .add-row select { font: inherit; min-height: 44px; padding: 0 6px; border: 2px solid var(--navy); border-radius: 6px; }
.add-row input { width: 3.6em; }
.my-tests { margin: 4px 0 0; padding-left: 18px; font-size: .85rem; }
.fb-choose .ask { font-weight: 700; color: var(--navy); margin: 12px 0 6px; }
.fb-choose .ask:first-child { margin-top: 0; }
.fb-choose .chips { gap: 6px; }
.fb-choose .chips .btn { min-height: 44px; padding: 0 10px; font-size: .88rem; }
.fb-choose .chips small { font-weight: 400; font-size: .7rem; letter-spacing: -1px; }
.saved-list { display: grid; gap: 6px; }
.saved-list .btn { justify-content: flex-start; min-height: 44px; }
.fb-choose .btn.sel { background: #fff6dc; border-color: var(--amber-deep); box-shadow: 0 4px 0 var(--amber-deep); }
.money-picker { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 6px; }
.money-picker .btn { min-height: 44px; padding: 0 10px; font-size: .88rem; }
.pick-amount { font: 800 1.5rem var(--display); color: var(--navy); padding: 0 6px; }
.job-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 10px; }
.job-card { border: 3px solid var(--navy); border-radius: 14px; background: #fff; padding: 12px; cursor: pointer; font: inherit; color: var(--navy); display: flex; flex-direction: column; gap: 4px; align-items: flex-start; box-shadow: 0 4px 0 var(--navy); text-align: left; min-height: 96px; }
.job-card .spanners { font-size: 1.4rem; letter-spacing: 2px; }
.job-card .dim { opacity: .25; filter: grayscale(1); }
.fault-q { font-weight: 800; color: var(--navy); margin-right: 4px; }
@media (prefers-reduced-motion: reduce) { .chip-fly { display: none; } }
/* ---------------------------------------------------------------- badge board ("My site kit") */
.ranks { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 12px; background: var(--charcoal); border-radius: 12px; padding: 10px; list-style: none; }
.ranks li { display: flex; flex-direction: column; align-items: center; color: #aab3c5; font-size: .82rem; text-align: center; line-height: 1.15; padding: 4px; border-radius: 10px; }
.ranks svg { width: 54px; height: 54px; }
.ranks b { color: #fff; font-size: .88rem; }
.ranks li.now { background: rgba(242, 182, 50, .18); outline: 3px solid var(--amber); }
.ranks li.next { opacity: .55; }
.board { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.board-col { background: #fff; border: 3px solid var(--navy); border-radius: 12px; padding: 10px; }
.board-col h3 { color: var(--navy); font-size: 1rem; text-align: center; margin-bottom: 6px; }
.tierbox { display: flex; flex-direction: column; align-items: center; text-align: center; padding-bottom: 8px; }
.tierbox svg { width: 104px; height: 104px; }
.tierbox span { font-size: .84rem; line-height: 1.25; }
.badge-cell { display: grid; grid-template-columns: 52px 1fr; gap: 8px; align-items: center; padding: 6px 0; border-top: 2px dashed #d3d8e3; }
.badge-cell svg { width: 52px; height: 52px; }
.badge-cell b { display: block; color: var(--navy); font-size: .92rem; line-height: 1.15; }
.badge-cell span { font-size: .8rem; line-height: 1.25; display: block; }
.badge-cell.locked b, .badge-cell.locked span { color: #8a93a6; }
.boss { display: grid; grid-template-columns: 120px 1fr; gap: 18px; align-items: center; margin-top: 16px; background: var(--charcoal); color: #fff; border-radius: 12px; padding: 14px 20px; border: 4px solid var(--amber); }
.boss svg { width: 110px; height: 110px; }
.boss h3 { color: var(--amber); font-size: 1.6rem; }
.boss p { margin: 4px 0 0; }

/* ---------------------------------------------------------------- earned pop-up */
.earned { border: 5px solid var(--navy); border-radius: 18px; background: var(--panel); padding: 24px 34px; text-align: center; max-width: 440px; overflow: hidden; }
.earned::backdrop { background: rgba(15, 25, 50, .6); }
.earned[open] { animation: popin .5s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes popin { from { transform: scale(.3) rotate(-8deg); opacity: 0; } }
.earned-pic svg { width: 170px; height: 170px; }
.earned h2 { color: var(--navy); font-size: 2rem; }
.earned p { margin: 6px 0 16px; }
.confetti i { position: absolute; width: 10px; height: 16px; top: -10px; animation: fall 1.6s ease-in forwards; }
@keyframes fall { to { transform: translateY(380px) rotate(540deg); opacity: 0; } }

.reduce-motion .confetti, .reduce-motion .chip-fly { display: none; }

/* ---------------------------------------------------------------- read aloud: speaker buttons (only when the device has a voice) */
.speak {
  display: none; place-items: center; flex: none; width: 44px; height: 44px; padding: 0; cursor: pointer;
  border: 3px solid var(--navy); border-radius: 50%; background: #fff; color: var(--navy); box-shadow: 0 3px 0 var(--navy);
}
.speak:hover { background: #fff6dc; }
.speak:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--navy); }
.can-speak .speak { display: inline-grid; }
.speak svg, .side .coach .speak svg, .coach .speak svg { width: 24px; height: 24px; }
.can-speak .task .bar { padding-right: 116px; min-height: 52px; }
.task .speak { position: absolute; right: 64px; top: 50%; transform: translateY(-50%); border-color: #fff; box-shadow: none; }
.task .speak:focus-visible { outline-color: var(--amber); box-shadow: 0 0 0 3px #fff; }   /* the banner is navy */
.task .speak:active { transform: translateY(-50%); }
/* Rivet's speaker button sits under Rivet, so his words keep their width */
.can-speak .coach { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; row-gap: 6px; }
.can-speak .coach > p { grid-column: 2; grid-row: 1 / span 2; }
.can-speak .coach .speak { grid-column: 1; grid-row: 2; justify-self: center; }
.bubble .speak { float: right; margin: 0 0 4px 8px; width: 40px; height: 40px; }
.earned .speak { margin: -8px auto 14px; }

/* ---------------------------------------------------------------- settings */
.bge .site-header .btn.icon-only { padding: 0; width: var(--tap); }
.icon-only svg { width: 26px; height: 26px; }
.settings { max-width: 480px; }
.settings h2 { font-size: 1.8rem; margin-bottom: 10px; }
.switch { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; padding: 10px 0; border-top: 2px dashed #c9cfdb; cursor: pointer; }
.switch input { appearance: none; -webkit-appearance: none; width: 56px; height: 32px; margin: 4px 0 0; border-radius: 999px; border: 3px solid var(--navy); background: #fff; position: relative; cursor: pointer; }
.switch input::after { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--navy); transition: left .15s; }
.switch input:checked { background: var(--good); }
.switch input:checked::after { left: 27px; background: #fff; }
/* on and off are shown by the knob's place and a word, not only by colour */
.switch input::before { content: "Off"; position: absolute; right: -2px; top: 34px; font: 700 .7rem var(--body); color: #5a6380; }
.switch input:checked::before { content: "On"; color: var(--good); }
.switch input:disabled { opacity: .5; cursor: not-allowed; }
.switch b { display: block; color: var(--navy); font-size: 1.05rem; }
.switch small { display: block; font-size: .88rem; color: #4a5372; line-height: 1.3; }
.settings .keep-note { margin: 10px 0 14px; }
.print-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 10px !important; }
.print-row span { font-size: .9rem; color: #dfe4ee; }

/* ---------------------------------------------------------------- the Site Pass (printed on A4)
   Only "Print my Pass" prints the pass (body.printing-pass); any other print shows the page as it is.
   Every rule is inside .print-pass, so its class names can't clash with the rest of the app. */
.print-pass { display: none; }
@media print {
  @page { size: A4 portrait; margin: 10mm; }
  body.bge.printing-pass { background: #fff !important; }
  body.bge.printing-pass > *:not(.print-pass):not(#bge-art) { display: none !important; }
  .printing-pass .print-pass { display: block; color: #24304f; font: 400 11pt/1.35 var(--body); -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.print-pass .site-pass { position: relative; height: 276mm; display: flex; flex-direction: column; gap: 3mm; border: 1.6mm solid var(--navy); border-radius: 4mm; padding: 6mm 8mm; overflow: hidden; box-sizing: border-box; }
.print-pass h1, .print-pass h2, .print-pass h3 { font-family: var(--display); text-transform: uppercase; color: var(--navy); margin: 0; letter-spacing: .02em; }
.print-pass .pass-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 2.5mm solid transparent;
  border-image: repeating-linear-gradient(-45deg, var(--amber) 0 3mm, var(--charcoal) 3mm 6mm) 1; padding-bottom: 3mm; }
.print-pass .pass-head small { font-size: 9pt; color: #4a5372; }
.print-pass .pass-head h1 { font-size: 34pt; line-height: 1; }
.print-pass .pass-head svg { width: 30mm; height: 30mm; }
.print-pass .ribbon { position: absolute; top: 15mm; right: -24mm; transform: rotate(35deg); background: var(--red); color: #fff; font: 800 13pt var(--display); text-transform: uppercase; letter-spacing: .08em; padding: 2mm 30mm; }
.print-pass .in-progress .pass-head svg { margin-right: 18mm; }
.print-pass .owner { font-size: 14pt; margin: 2mm 0; display: flex; align-items: flex-end; gap: 3mm; }
.print-pass .owner .line { flex: 1; border-bottom: .5mm solid #24304f; height: 8mm; }
.print-pass .pass-who { display: grid; grid-template-columns: 30mm 1fr; gap: 5mm; align-items: center; background: #eef1f6; border-radius: 3mm; padding: 3mm 5mm; }
.print-pass .pass-who svg { width: 30mm; height: 30mm; }
.print-pass .pass-who h2 { font-size: 20pt; }
.print-pass .pass-who p { margin: 1mm 0 0; }
.print-pass h3 { font-size: 12pt; margin-top: 1mm; }
.print-pass .pass-patches, .print-pass .pass-stickers { list-style: none; margin: 0; padding: 0; display: grid; text-align: center; }
.print-pass .pass-patches { grid-template-columns: repeat(5, 1fr); gap: 3mm; }
.print-pass .pass-patches svg { width: 24mm; height: 24mm; }
.print-pass .pass-patches b { display: block; font-size: 8.5pt; line-height: 1.15; }
.print-pass .pass-patches span { font-size: 8.5pt; color: #4a5372; }
.print-pass .pass-stickers { grid-template-columns: repeat(15, minmax(0, 1fr)); gap: 1mm; }
.print-pass .pass-stickers svg { width: 100%; max-width: 11mm; height: auto; }
.print-pass .pass-stickers span { display: block; font-size: 5.5pt; line-height: 1.1; }
.print-pass .draw { flex: 1; min-height: 50mm; border: .8mm dashed var(--navy); border-radius: 3mm; padding: 3mm 4mm; }
.print-pass .draw span { font: 800 12pt var(--display); text-transform: uppercase; color: #8a93a6; }
.print-pass .pass-foot { display: flex; justify-content: space-between; font-size: 11pt; }
.print-pass .pass-foot .code { font: 700 13pt var(--mono, "JetBrains Mono", monospace); letter-spacing: .12em; }
.print-pass .teacher { margin: 0; font-size: 8pt; color: #4a5372; }

/* the toast and messages in the notes' colours */
.bge .toast { background: var(--charcoal); border: 2px solid var(--amber); font-family: var(--body); }
.bge .modal { border: 5px solid var(--navy); border-radius: 18px; background: var(--panel); font-family: var(--body); }
.bge .modal h2 { color: var(--navy); }
.bge .modal p { color: var(--text); }
.bge .too-small { background: var(--bp); color: #e8eefc; font-family: var(--body); }

/* ---------------------------------------------------------------- iPad landscape and small laptops */
@media (max-width: 1100px) {
  .bge { font-size: 16px; }
  .bge .site-header { gap: 12px; }
  .bge .brand-text { display: flex; }
  .bge .rank-xp { display: none; }
  .bge .site-header .btn { padding: 0 12px; }
  .bge .hub { padding: 14px 14px 30px; }
  .hello h1 { font-size: 2.7rem; }
  .missions { gap: 12px; }
  .game { grid-template-columns: 1fr 270px; gap: 12px; }
  .game-head h1 { font-size: 2rem; }
  .road span b { display: none; }
  .road span { padding: 6px; }
  .brief { grid-template-columns: 150px 1fr; }
  .board .badge-cell { grid-template-columns: 44px 1fr; }
  .board .badge-cell svg { width: 44px; height: 44px; }
  /* keep a whole game on one iPad screen: the picture shrinks, keeping its shape */
  .bb-stage svg.scene { max-height: calc(100vh - 515px); min-height: 180px; }
  /* the valley has only the time dial under it, so it can be taller */
  .bb-stage svg.scene.valley { max-height: calc(100vh - 400px); min-height: 240px; }
  /* frames the pupil braces: the controls are one row, so the frame can be bigger */
  .bb-stage svg.scene.tall { max-height: calc(100vh - 392px); min-height: 260px; }
  .bb-stage svg.scene.mid { max-height: calc(100vh - 440px); min-height: 220px; }
  /* the bolt board: its task banner can take two lines */
  .bb-stage svg.scene.bolt-board { max-height: calc(100vh - 400px); min-height: 250px; }
  .keypad button { min-height: 40px; }
  .pane { min-height: 92px; }
  .pane .ic { width: 46px; height: 46px; }
  .mystery { margin-top: 8px; gap: 8px; }
  /* compact tray (picture and weight only), pad and meter, so they fit beside the stage */
  .tray-load span { font-size: 0; }
  .tray-load span b { font-size: .95rem; }
  .tray-load svg { width: 36px; height: 32px; }
  .working { font-size: .95rem; line-height: 1.35; padding: 10px; }
  .working .padrow.big { font-size: 1.1rem; }
  .slot { min-height: 34px; min-width: 60px; }
  .meter-wrap { min-height: 96px; }
  .meter2 .bar { height: 50px; }
  .meter2 ul { display: none; }
  .side .coach svg { width: 48px; height: 48px; }
  .side .coach p { font-size: .94rem; }
  .sheet h2 { font-size: 1.6rem; }
}

/* laptops and Chromebooks (1366 × 768 and similar): the stage shrinks so the game's buttons stay on screen */
@media (min-width: 1101px) and (max-height: 820px) {
  .bb-stage svg.scene { max-height: calc(100vh - 500px); min-height: 200px; }
  .bb-stage svg.scene.tall { max-height: calc(100vh - 425px); min-height: 260px; }
  .bb-stage svg.scene.mid { max-height: calc(100vh - 480px); min-height: 220px; }
  .bb-stage svg.scene.valley { max-height: calc(100vh - 420px); min-height: 240px; }
  .bb-stage svg.scene.bolt-board { max-height: calc(100vh - 450px); min-height: 260px; }
  .bb-stage.peeking svg.scene.bolt-board { max-height: calc(100vh - 500px); min-height: 230px; }
}

/* touch screens: keypad keys and pad boxes stay at least 44 px, whatever the screen size */
@media (pointer: coarse) {
  .keypad button, .slot { min-height: 44px; }
  .slot-hit { stroke-width: 50; }
}
