/* The Banverkstad look of ALL THREE workshops (TBGeodash, Bubbelskott, Atomobrik; docs/BANVERKSTAD_OMDESIGN.md): made for
   children who can't read yet – buttons are PICTURES, chunky and rounded ("godis"), the steps are bygg -> ▶ testa -> skicka.
   Colours come from css/style.css; css/banverkstad.css still gives the name field, the help list and the pieces' tile their
   base. A workshop's own rules (TBGeodash's portal legend, a grid's shape) are in its own bygg.css. */
.builder.bv-app { max-width: 82rem; padding: 0.5rem 0.75rem 0.4rem; --tile: 3.3rem; }

/* ---------- The top row ---------- */
.bv-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.bv-spacer { flex: 1 1 0; }
.bv-break { display: none; }

/* A button: a chunky key with a darker edge under it that you press down */
.bv-btn {
  position: relative; display: inline-grid; place-items: center; flex: none;
  width: 3.4rem; height: 3.4rem; padding: 0; font: inherit; color: var(--cyan); text-decoration: none; cursor: pointer;
  background: linear-gradient(#2c1d5c, #1b1040); border: 2px solid #5ef0ff77; border-radius: 0.95rem;
  box-shadow: 0 4px 0 #090418; -webkit-tap-highlight-color: transparent;
  transition: transform 0.08s, box-shadow 0.08s, border-color 0.12s;
}
.bv-btn:hover, .bv-btn:focus-visible { border-color: var(--cyan); }
.bv-btn:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
.bv-btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 #090418; }
.bv-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.bv-ico { display: inline-grid; width: 1.9rem; height: 1.9rem; }
.bv-ico svg, .bv-edge svg, .bv-hand svg, .bv-turn-badge svg, .bv-lock svg, .bv-slot-mark svg, .bv-card-new svg { display: block; width: 100%; height: 100%; fill: currentColor; }
.bv-ico-big { width: 2.6rem; height: 2.6rem; color: var(--yellow); }
.bv-danger { color: #ff7a7a; }
.bv-danger.is-asking { scale: 1.12; background: #b3202c; color: #fff; border-color: #ffb3b3; animation: bv-shake 0.35s infinite; }

/* How many levels you have, on the folder */
.bv-home { margin-right: 0.5rem; }                 /* (the folder next to it must not be hit by mistake) */
.bv-count {
  position: absolute; right: -0.35rem; top: -0.3rem; min-width: 1.35rem; height: 1.35rem; padding: 0 0.25rem; display: grid; place-items: center;
  font-size: 0.8rem; font-weight: 900; color: var(--bg); background: var(--yellow); border-radius: 0.7rem;
}

/* The level's name: a pencil and a field (kids type their own made-up name here) */
.bv-namechip {
  display: flex; align-items: center; gap: 0.4rem; flex: 1 1 9rem; max-width: 17rem; min-width: 0; height: 3.4rem; padding: 0 0.7rem;
  color: var(--yellow); background: #120a2c; border: 2px solid #ffe94d88; border-radius: 0.95rem; cursor: text;
}
.bv-namechip .bv-ico { width: 1.4rem; height: 1.4rem; flex: none; }
.bv-namechip input {
  flex: 1; min-width: 0; height: 100%; padding: 0; font: inherit; font-size: 1.1rem; font-weight: 800; font-style: italic; color: var(--yellow);
  background: transparent; border: 0; outline: 0;
}
.bv-namechip:focus-within { border-color: var(--yellow); box-shadow: 0 0 12px #ffe94d66; }

/* ▶ and Skicka: the two big steps. ▶ breathes while the level is built but not beaten; Skicka is locked until it is beaten, then it hops. */
.bv-play {
  width: 5rem; color: #2a1c00; border-color: #fff6a8; background: linear-gradient(#fff070, #ffd400);
  box-shadow: 0 4px 0 #a08a00, 0 0 14px #ffe94d66;
}
.bv-play .bv-ico { width: 2.3rem; height: 2.3rem; }
.bv-play:active:not(:disabled) { box-shadow: 0 1px 0 #a08a00; }
.bv-play.is-nudge { animation: bv-breathe 1.3s ease-in-out infinite; }
.bv-send { margin-left: 1rem; width: 4.2rem; color: #fff; border-color: #ffb3e0; background: linear-gradient(#ff6fc6, #e0198f); box-shadow: 0 4px 0 #7a0a50; }
.bv-send:active:not(:disabled) { box-shadow: 0 1px 0 #7a0a50; }
.bv-send[aria-disabled="true"] { opacity: 1; color: #8a7aa8; cursor: not-allowed; border-color: #5a4a7a; background: linear-gradient(#3a2a63, #2a1c4a); box-shadow: 0 4px 0 #090418; }
.bv-send .bv-lock { display: none; position: absolute; right: -0.2rem; bottom: -0.3rem; width: 1.5rem; height: 1.5rem; padding: 2px; color: #fff;
  background: #5a4a7a; border-radius: 50%; }
.bv-send[aria-disabled="true"] .bv-lock { display: block; }
.bv-send .bv-send-star { display: none; }
.bv-send.is-sent .bv-send-star { display: grid; }
.bv-send.is-sent .bv-send-plane { display: none; }
.bv-send.is-sent { color: var(--yellow); border-color: var(--yellow); background: linear-gradient(#2c1d5c, #1b1040); box-shadow: 0 4px 0 #090418, 0 0 12px #ffe94d77; }   /* a yellow star on dark: ▶ stays the one yellow button */
.bv-send.is-asking, .bv-send.is-asking.is-ready { scale: 1.2; animation: bv-shake 0.35s infinite; box-shadow: 0 4px 0 #7a0a50, 0 0 24px #ff3fb4; }
.bv-send.is-sent-pop { animation: bv-sentpop 1.1s ease-out; }
.is-shake { animation: bv-shake 0.18s 3; }
@keyframes bv-sentpop { 0% { transform: scale(0.6); } 40% { transform: scale(1.4) rotate(-12deg); box-shadow: 0 0 40px #ffe94d; } 100% { transform: scale(1); } }
.bv-send.is-ready { animation: bv-hop 1.1s ease-in-out infinite; box-shadow: 0 4px 0 #7a0a50, 0 0 16px #ff3fb499; }
@keyframes bv-breathe { 50% { transform: scale(1.1); box-shadow: 0 4px 0 #a08a00, 0 0 26px #ffe94dcc; } }
@keyframes bv-hop { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-7px); } }
@keyframes bv-shake { 25% { transform: translateX(-2px) rotate(-3deg); } 75% { transform: translateX(2px) rotate(3deg); } }
@keyframes bv-pop { 0% { transform: scale(0.85); } 60% { transform: scale(1.18); } 100% { transform: scale(1.08); } }

/* ---------- The stage: the piece box on the left, the grid and the overview strip beside it ---------- */
.bv-stage { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0.6rem; align-items: start; }
.bv-field { min-width: 0; }
.bv-grid-wrap { position: relative; overflow: hidden; border: 3px solid var(--cyan); border-radius: 0.8rem; background: #120a2c; }
.builder-grid { display: block; width: 100%; cursor: crosshair; touch-action: none; background: #120a2c; }
.builder-grid[data-tool="select"] { cursor: default; }
.builder-grid[data-tool="pan"] { cursor: grab; }
.builder-grid[data-tool="pan"]:active { cursor: grabbing; }

/* The piece box: tools first, then the pieces in coloured groups (cyan = blocks, magenta = spikes, yellow = boosts, violet = portals) */
.bv-rail {
  display: flex; flex-direction: column; gap: 0.5rem; padding: 0.4rem; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y;
  background: #170d38; border: 2px solid #5ef0ff33; border-radius: 0.9rem; scrollbar-width: thin;
}
.bv-group { display: grid; grid-template-columns: repeat(3, var(--tile)); gap: 0.5rem; padding: 0.3rem; background: color-mix(in srgb, var(--g) 12%, transparent);
  border-top: 4px solid var(--g); border-radius: 0.6rem; }
.bv-rail .bv-paint {
  width: var(--tile); height: var(--tile); padding: 0; justify-content: center; border-radius: 0.7rem; background: #0f0826; border-color: color-mix(in srgb, var(--g) 55%, transparent);
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;       /* (a finger on a piece can still scroll the box) */
}
.bv-rail .bv-paint canvas { width: 2.9rem; height: 2.9rem; }
.bv-rail .bv-paint[hidden] { display: none; }
.bv-rail .bv-paint[aria-pressed="true"] { border-color: var(--yellow); background: #2b2260; box-shadow: 0 0 14px #ffe94dcc; transform: scale(1.08); animation: bv-pop 0.22s; }

/* Pictures laid over the grid */
.bv-edge {
  position: absolute; top: 50%; z-index: 2; display: grid; place-items: center; width: 2.9rem; height: 5rem; margin-top: -2.5rem; padding: 0;
  color: #fff; background: #1b1040cc; border: 2px solid #5ef0ff99; cursor: pointer; touch-action: none; -webkit-tap-highlight-color: transparent;
}
.bv-edge .bv-ico { width: 1.9rem; height: 1.9rem; }
.bv-edge-left { left: 0.2rem; border-radius: 0.9rem; }
.bv-edge-right { right: 0.2rem; border-radius: 0.9rem; }
.bv-edge:active { background: #5ef0ff88; }
.bv-edge[hidden] { display: none; }

.bv-selbar {
  position: absolute; top: 0.5rem; left: 0.5rem; z-index: 3; display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; width: max-content; max-width: calc(100% - 1rem); padding: 0.45rem;   /* (bygg.js puts it over what is marked) */
  background: #1d1240f2; border: 2px solid #5ef0ffaa; border-radius: 1rem; box-shadow: 0 6px 18px #000a;
}
.bv-selbar.is-empty { display: none; }
.bv-selbar.is-busy { opacity: 0; pointer-events: none; }
/* A small screen: the row takes the tool box's place while something is marked (over the grid it would hide what is marked) */
.bv-selbar.is-docked { background: #1d1240; display: grid; grid-template-columns: repeat(3, auto); justify-content: center; align-content: center; gap: 0.5rem; box-sizing: border-box; max-width: none; }
.bv-selbar.is-docked #delete-selection { margin-right: 0; }                 /* while the blocks are being dragged */
#flip-upside-down .bv-ico { transform: rotate(90deg); }                    /* the sideways mirror turned a quarter: up and down */
.bv-selbar #delete-selection { margin-right: 0.9rem; }
/* A small phone: 3 + 3 evenly (no apart-trash), tighter, so it takes less of the level */
@media (max-width: 380px) {
  .bv-selbar { display: grid; grid-template-columns: repeat(3, auto); gap: 0.4rem; padding: 0.35rem; }
  .bv-selbar #delete-selection { margin-right: 0; }
}       /* the trash apart from the rest, never next to the tick */
.bv-toast {
  position: absolute; left: 50%; bottom: 0.7rem; z-index: 4; max-width: 92%; margin: 0; padding: 0.55rem 1rem; transform: translateX(-50%);
  font-weight: 800; text-align: center; color: var(--bg); background: var(--yellow); border-radius: 1rem; box-shadow: 0 4px 0 #a08a00; pointer-events: none;
  animation: bv-toast 3.6s both;
}
.bv-toast:empty { display: none; }
@keyframes bv-toast { 0% { opacity: 0; transform: translate(-50%, 10px); } 8%, 85% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }

/* The empty level shows how to build: a square that pulses and a hand that taps it */
.bv-hint { position: absolute; z-index: 1; width: var(--cell, 28px); height: var(--cell, 28px); pointer-events: none; }
.bv-hint[hidden] { display: none; }
.bv-spot { position: absolute; left: 0; top: 0; width: var(--cell, 28px); height: var(--cell, 28px); border: 3px dashed var(--yellow); border-radius: 0.3rem; animation: bv-spot 1.4s ease-in-out infinite; }
.bv-hand {
  display: block; aspect-ratio: 1; position: absolute; left: calc(var(--cell, 28px) * -0.33); top: calc(var(--cell, 28px) * 0.4); width: calc(var(--cell, 28px) * 1.9); color: #fff;
  filter: drop-shadow(0 3px 4px #0008); transform-origin: 44% 6%; animation: bv-tap 1.4s ease-in-out infinite;
}
@keyframes bv-spot { 0%, 100% { opacity: 0.5; transform: scale(0.9); } 50% { opacity: 1; transform: scale(1.1); background: #ffe94d40; } }
@keyframes bv-tap { 0%, 100% { transform: translate(14px, 18px) rotate(-8deg); } 35% { transform: translate(0, 0) rotate(0); } 50% { transform: translate(0, 4px) scale(0.92); } 65% { transform: translate(0, 0); } }

/* The whole level in a strip */
.bv-minimap { display: block; width: 100%; height: 2.75rem; margin-top: 0.4rem; background: #120a2c; border: 2px solid #5ef0ff55; border-radius: 0.7rem; cursor: ew-resize; touch-action: none; }
.bv-minimap:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }

/* ---------- The dialogs: Mina banor and Mer ---------- */
.bv-dialog {
  width: min(46rem, 94vw); max-height: 90dvh; padding: 0.9rem; color: var(--text); background: #1d1240; border: 3px solid var(--cyan); border-radius: 1.2rem;
  box-shadow: 0 0 40px #000c;
}
.bv-dialog::backdrop { background: #0a0418cc; }
.bv-dialog-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.7rem; }
.bv-tiles { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 0.8rem; }
.bv-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.2rem; width: 6.8rem; min-height: 5.4rem; padding: 0.4rem; font: inherit; font-size: 0.85rem; font-weight: 800;
  color: var(--cyan); background: linear-gradient(#2c1d5c, #1b1040); border: 2px solid #5ef0ff77; border-radius: 0.95rem; box-shadow: 0 4px 0 #090418; cursor: pointer;
}
.bv-tile[hidden] { display: none; }
.bv-tile:disabled { opacity: 0.4; cursor: not-allowed; }
.bv-tile:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 #090418; }
.bv-tile:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
.bv-tile.bv-danger { color: #ff7a7a; }
.bv-tile.bv-danger.is-asking { scale: 1.12; background: #b3202c; color: #fff; animation: bv-shake 0.35s infinite; }
.bv-more-row { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.6rem; color: var(--cyan); }
.bv-more-row select { flex: 1; max-width: 22rem; font: inherit; font-weight: 700; min-height: 2.75rem; padding: 0.3rem 0.5rem; color: var(--yellow); background: var(--bg-raised); border: 2px solid var(--cyan); }
.bv-more-note { margin: 0 0 0.2rem; color: var(--text-muted); }
.builder .bv-how-to { margin-block: 0.3rem 0; }

/* Mina banor: a card per level – a picture of the whole level, its name, how far it is */
.bv-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr)); gap: 0.8rem; }
.bv-slot { position: relative; }
.bv-slot-open {
  display: flex; flex-direction: column; gap: 0.3rem; width: 100%; padding: 0.35rem 0.35rem 0.45rem; font: inherit; font-weight: 800; color: var(--text); text-align: left; cursor: pointer;
  background: #120a2c; border: 3px solid #5ef0ff66; border-radius: 0.9rem; box-shadow: 0 4px 0 #090418;
}
.bv-slot-open canvas { display: block; width: 100%; height: auto; aspect-ratio: 12 / 5; background: #0b0620; border-radius: 0.5rem; }
.bv-slot-open:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
.bv-slot-open[aria-pressed="true"] { border-color: var(--yellow); box-shadow: 0 4px 0 #a08a00, 0 0 14px #ffe94d77; color: var(--yellow); }
.bv-slot-name { padding: 0 0.2rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* The state is a picture: a pencil (pågår), a flag (klarad), a star with a tick (inskickad) */
.bv-slot-mark { position: absolute; left: 0.2rem; top: 0.2rem; display: grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: 50%; background: #3a2a63; border: 2px solid #fff; }
.bv-slot-mark { color: #fff; }
.bv-slot-mark svg { width: 1.2rem; height: 1.2rem; }
.bv-slot.is-cleared .bv-slot-mark { background: #1aa5b8; }
.bv-slot.is-sent .bv-slot-mark { background: #e0b800; }
.bv-slot-actions { position: absolute; right: 0.2rem; top: 0.2rem; display: flex; gap: 0.6rem; }
/* (Bubbelskott's and Atomobrik's library: the open card's copy + trash sit UNDER it, so they never cover the picture) */
.bv-slot-row { display: flex; align-items: center; gap: 0.4rem; min-width: 0; }
.bv-slot-row .bv-slot-mark { position: static; flex: none; }
.bv-slot.is-open .bv-slot-actions { position: static; justify-content: flex-end; margin-top: 0.45rem; }
/* A phone: one column of low cards, the big + FIRST (five cards and a + last would push the + out of sight) */
@media (max-width: 480px) {
  .bv-cards { display: flex; flex-direction: column; gap: 0.6rem; }
  .bv-cards .bv-card-new { order: -1; min-height: 3.2rem; }
  .bv-slot-open canvas { height: 3.8rem; aspect-ratio: auto; object-fit: contain; }
}
.bv-slot-actions .bv-btn { width: 2.75rem; height: 2.75rem; border-radius: 0.8rem; }
.bv-slot-actions .bv-ico { width: 1.4rem; height: 1.4rem; }
.bv-card-new {
  display: grid; place-items: center; width: 100%; min-height: 6.5rem; padding: 0; color: var(--yellow); cursor: pointer; background: #170d38; border: 3px dashed var(--yellow); border-radius: 0.9rem;
}
.bv-card-new:disabled { opacity: 0.3; cursor: not-allowed; }
.bv-card-new:not(:disabled):hover, .bv-card-new:focus-visible { background: #2b2260; outline: none; box-shadow: 0 0 14px #ffe94d77; }

/* ---------- Held upright on a phone or a small tablet: the piece box goes UNDER the grid and shows every piece (rows that wrap) ---------- */
@media (max-width: 760px) and (orientation: portrait) {
  .bv-stage { grid-template-columns: minmax(0, 1fr); }
  .bv-rail { order: 2; flex-direction: row; flex-wrap: wrap; justify-content: center; overflow: visible; max-height: none !important; }
  .bv-group { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; }      /* (a group of eight colours wraps, it must not run off the screen) */
}
/* The piece box scrolls by finger (the pieces take no touch of their own); a yellow glow on its edge says there is more */
.bv-rail[data-more="end"] { box-shadow: inset 0 -24px 16px -12px rgba(255, 233, 77, 0.85); }
.bv-rail[data-more="right"] { box-shadow: inset -24px 0 16px -12px rgba(255, 233, 77, 0.85); }
.bv-rail-more { display: none; position: sticky; bottom: 0; align-self: center; flex: none; width: 2rem; height: 1.3rem; margin-top: -0.4rem; color: var(--yellow); animation: bv-bob 0.9s ease-in-out infinite; pointer-events: none; }
.bv-rail-more svg { display: block; width: 100%; height: 100%; fill: currentColor; filter: drop-shadow(0 0 4px #000); }
.bv-rail[data-more="end"] .bv-rail-more { display: block; }
@keyframes bv-bob { 50% { transform: translateY(4px); } }
/* A short phone held upright: the pieces are ONE row that scrolls sideways (the grid keeps its size; yellow glow at the edge) */
@media (max-width: 760px) and (orientation: portrait) and (max-height: 750px) {
  .bv-app:not(.is-tall-grid) .bv-rail { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; overflow-y: hidden; touch-action: pan-x; }
  .bv-app:not(.is-tall-grid) .bv-group { flex: none; flex-wrap: nowrap; }
  .bv-app:not(.is-tall-grid) .bv-rail[data-more="right"] .bv-rail-more { display: block; position: sticky; right: 0; bottom: auto; margin: 0 0 0 -1.7rem; transform: rotate(-90deg); animation: bv-bobx 0.9s ease-in-out infinite; }
}
@keyframes bv-bobx { 50% { transform: rotate(-90deg) translateY(5px); } }
@media (max-width: 560px) {
  .builder.bv-app { --tile: 3rem; padding-inline: 0.5rem; }
  .bv-btn { width: 2.75rem; height: 2.75rem; border-radius: 0.8rem; }
  .bv-play { width: 4rem; }
  .bv-send { width: 3.2rem; margin-left: 0.8rem; }
  .bv-ico { width: 1.6rem; height: 1.6rem; }
  .bv-bar { gap: 0.5rem; }
  .bv-namechip { flex: 1 1 8rem; max-width: none; height: 2.75rem; }
  .bv-break { display: block; flex-basis: 100%; height: 0; }
  .bv-spacer { display: none; }
  .bv-play { margin-left: auto; }
  .bv-edge { width: 2.75rem; height: 4rem; margin-top: -2rem; }
  .bv-play { height: 3.3rem; }
}
@media (max-width: 360px) { .bv-play { width: 3.4rem; } .bv-send { margin-left: 0.5rem; } }
@media (prefers-reduced-motion: reduce) {
  .bv-play.is-nudge, .bv-send.is-ready, .bv-spot, .bv-hand, .bv-danger.is-asking, .bv-tile.is-asking, .bv-toast { animation: none; }
  .bv-rail .bv-paint[aria-pressed="true"] { animation: none; }
}

/* Fullscreen: the builder fills the screen on the site's dark background and scrolls if it must */
.builder:fullscreen { max-width: none; padding: 0.5rem 1rem; overflow: auto; background: var(--bg); }

/* The turn button wears the piece it turns, with a turning arrow in its corner */
.bv-turn:disabled { visibility: hidden; }
.bv-turn canvas { width: 2.3rem; height: 2.3rem; }
.bv-turn-badge { position: absolute; right: -0.3rem; bottom: -0.35rem; width: 1.5rem; height: 1.5rem; padding: 2px; color: var(--bg); background: var(--cyan); border-radius: 50%;
}

/* A phone held sideways: the site's top bar goes, so the grid gets the height; the top row is lower */
@media (max-height: 500px) and (orientation: landscape) {
  .bv-app { padding-top: 0.3rem; }
  body:has(.bv-app) .site-header { display: none; }
  .bv-bar { margin-bottom: 0.35rem; }
  .bv-btn, .bv-namechip { height: 2.75rem; }
  .bv-btn { width: 2.75rem; }
  .bv-play { width: 4rem; }
  .bv-send { width: 3.4rem; }
  .bv-minimap { height: 2.2rem; margin-top: 0.25rem; }
}

/* The ? for grown-ups in the grid's top right corner, quiet */
.bv-help { position: absolute; top: 0.5rem; right: 0.5rem; z-index: 2; width: 2.75rem; height: 2.75rem; opacity: 0.8; }
.bv-help .bv-ico { width: 1.5rem; height: 1.5rem; }
.bv-dialog-head.is-end { justify-content: flex-end; }
.bv-facts { margin: 0 0 0.8rem; padding-left: 1.2rem; color: var(--text); }
.bv-facts li { margin-bottom: 0.4rem; }
.bv-legend { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 0.4rem 1rem; margin-bottom: 0.8rem; color: var(--text-muted); font-size: 0.9rem; }
.bv-legend span { display: flex; align-items: center; gap: 0.5rem; }
.bv-legend .bv-ico { width: 1.6rem; height: 1.6rem; flex: none; color: var(--cyan); }
.bv-selbar .bv-danger, .bv-dialog .bv-danger { color: #ff7a7a; }

/* "Vad heter din bana?" (js/level-title.js): asked when a level without a name of its own is sent in */
.bv-title-dialog { width: min(26rem, 94vw); }
.bv-title-ask { margin: 0 0 0.8rem; font-size: 1.35rem; font-weight: 800; font-style: italic; color: var(--yellow); }
.bv-title-row { display: flex; align-items: center; gap: 0.7rem; }
.bv-title-row .bv-namechip { flex: 1 1 auto; max-width: none; }
.bv-title-ok { color: #8a7aa8; }                                  /* (grey until the name is a real one) */
.bv-title-ok.is-ready { color: var(--bg); border-color: var(--yellow); background: linear-gradient(#fff27a, #ffd21f); box-shadow: 0 4px 0 #8a6a00; }

/* A shake: "not like that" / "this first" */
@keyframes bv-shake { 25% { transform: translateX(-4px) rotate(-4deg); } 75% { transform: translateX(4px) rotate(4deg); } }
.bv-send.is-sent .bv-lock { display: none; }

/* The hand on an empty level: a bright square that is pressed (and a hand that drags the first block along while Peka waits) */
.bv-spot { border-style: solid; background: #ffe94d33; box-shadow: 0 0 14px #ffe94dcc; }
.bv-hint.is-drag .bv-spot { animation: bv-lasso 2s ease-in-out infinite; }
.bv-hint.is-drag .bv-hand { left: calc(var(--cell, 28px) * 0.3); top: calc(var(--cell, 28px) * 0.55); width: max(calc(var(--cell, 28px) * 1.9), 2.6rem); animation: bv-lasso-hand 2s ease-in-out infinite; }
@keyframes bv-lasso { 0%, 15% { transform: translate(0, 0); opacity: 1; } 70%, 100% { transform: translate(var(--shift, calc(var(--cell, 28px) * 3)), 0); opacity: 1; } }
@keyframes bv-lasso-hand { 0%, 15% { transform: translate(0, 0); } 70%, 100% { transform: translate(var(--shift, calc(var(--cell, 28px) * 3)), 0); } }

/* A short screen (a phone held sideways): the help dialog shows the picture key FIRST and in a compact form */
@media (max-height: 500px) {
  .bv-dialog { max-height: 96dvh; }
  #help-dialog[open] { display: flex; flex-direction: column; }      /* (only while open: a plain display here would show it closed) */
  #help-dialog .bv-legend { order: -1; grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr)); font-size: 0.8rem; gap: 0.25rem 0.8rem; }
  #help-dialog .bv-dialog-head { order: -2; margin-bottom: 0.3rem; }
  #help-dialog .bv-facts { font-size: 0.85rem; }
}



/* A tall little grid (Bubbelskott, Atomobrik): the frame hugs the picture and sits in the middle of the room beside the tools */
.bv-app.is-tall-grid .bv-field { display: flex; justify-content: center; }
.bv-app.is-tall-grid .bv-grid-wrap { width: fit-content; max-width: 100%; }
.bv-app.is-tall-grid .builder-grid { width: auto; image-rendering: auto; }
.bv-app.is-tall-grid .builder-grid.is-pixels { image-rendering: pixelated; }
.bv-app.is-tall-grid .bv-stage { grid-template-columns: auto auto; justify-content: center; }
@media (max-width: 760px) and (orientation: portrait) { .bv-app.is-tall-grid .bv-stage { grid-template-columns: minmax(0, 1fr); } }
/* A switch in the "Mer" box (Symmetri): yellow while on */
.bv-tile[aria-pressed="true"] { color: var(--yellow); border-color: var(--yellow); box-shadow: 0 4px 0 #a08a00, 0 0 12px #ffe94d77; }
.bv-tile .bv-ico { width: 2rem; height: 2rem; }
.bv-tile.is-lift .bv-ico { transform: rotate(180deg); }
.bv-keys { margin: 0; padding-left: 1.2rem; color: var(--text-muted); font-size: 0.9rem; }

/* The hint on a grid of wide blocks / round bubbles: the square takes the block's own shape (--spot-w x --spot-h) */
.bv-hint.is-wide { width: var(--spot-w); height: var(--spot-h); }
.bv-hint.is-wide .bv-spot { width: var(--spot-w); height: var(--spot-h); }
.bv-hint.is-round .bv-spot { border-radius: 50%; }
.bv-more-row { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.6rem; color: var(--cyan); font-weight: 800; }

/* A phone held sideways: the colours in four columns, so every one shows (the tool box is as tall as the grid) */
@media (max-height: 520px) and (orientation: landscape) {
  .bv-app.is-tall-grid .bv-group { grid-template-columns: repeat(4, var(--tile)); }
  .bv-app.is-tall-grid { --tile: 2.9rem; }
  .bv-app.is-tall-grid .bv-rail .bv-paint canvas { width: 2.5rem; height: 2.5rem; }
}
.bv-more-note { margin: 0; font-size: 0.85rem; font-weight: 600; color: var(--text-muted); }
.bv-more-row.is-stacked { flex-wrap: wrap; }

/* A phone held upright, the tall little grids: the tool box under the grid is as LOW as it can be (the grid gets the room):
   small tiles (still 44 px), tight groups, the silver and gold next to the tools */
@media (max-width: 760px) and (orientation: portrait) {
  .bv-app.is-tall-grid { --tile: 2.75rem; }
  .bv-app.is-tall-grid .bv-rail { gap: 0.35rem; padding: 0.3rem; }
  .bv-app.is-tall-grid .bv-group { gap: 0.3rem; padding: 0.25rem; border-top-width: 3px; }
  .bv-app.is-tall-grid .bv-rail .bv-paint canvas { width: 2.3rem; height: 2.3rem; }
  .bv-app.is-tall-grid .bv-rail .bv-group:nth-of-type(3) { order: 1; }
  .bv-app.is-tall-grid .bv-rail .bv-group:nth-of-type(2) { order: 2; }
}

/* A 320 px phone: six colours (Bubbelskott) must fit ONE row, so the box under the grid is two rows and the grid keeps its size */
@media (max-width: 340px) and (orientation: portrait) {
  .bv-app.is-tall-grid .bv-group { gap: 0.15rem; padding: 0.2rem; }
  .bv-app.is-tall-grid .bv-rail { padding: 0.25rem; gap: 0.3rem; }
}

/* Mer on a low screen: smaller tiles, so the whole box shows without scrolling */
@media (max-height: 720px) {
  .bv-dialog { padding: 0.6rem; }
  .bv-tile { width: 5.6rem; min-height: 4.4rem; }
  .bv-tile .bv-ico { width: 1.7rem; height: 1.7rem; }
  .bv-dialog-head { margin-bottom: 0.4rem; }
  .bv-tiles { gap: 0.45rem; margin-bottom: 0.5rem; }
}
