/* ==========================================================
   Hullabugaloo — hulla.css (SHELL lane)
   The stage, the setup screens (0–2, 4), the HUD buttons, the
   control bar in its three layouts (one row, two rows, side
   columns), the satchel, the power and angle gauges, the overlay
   layers (hand-off, pause, muster, grown-up check, ending) and the
   Battle Book. site.css variables only, so lamplight (dark) mode
   comes for free. Hold and long-press targets (.hb-hold) never
   select text or open the iOS callout.
   Sizes are A§4.4 K.UI: tap targets 56 px (96 where a P/K player
   taps), primary buttons 72 px, the bar 112 px (136 on a P/K turn).
   ========================================================== */

.hb-page { padding-top: 12px; padding-bottom: 12px; }
.hb-stage [hidden], #selftest[hidden] { display: none !important; }

/* ---------- the stage: the full-screen target ---------- */
.hb-stage {
  --hb-bar-h: 0px;                 /* the control bar's reserved height during a battle (set by hud.js) */
  position: relative;
  width: 100%;
  height: calc(100vh - 150px);
  height: calc(100dvh - 150px);
  min-height: 360px;
  max-height: 940px;
  overflow: hidden;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
  -webkit-tap-highlight-color: transparent;
  color: var(--ink);
}
/* a phone held sideways: the whole stage fits under the site's sticky header */
@media (max-height: 520px) {
  .hb-stage { height: calc(100vh - 76px); height: calc(100dvh - 76px); min-height: 250px; }
}
.hb-stage.is-fullscreen {
  height: 100%; max-height: none; min-height: 0;
  border: 0; border-radius: 0; box-shadow: none;
}
.hb-stage button, .hb-stage select, .hb-stage input, .hb-stage a { touch-action: manipulation; }
.hb-stage button { -webkit-user-select: none; user-select: none; }

#view {
  position: absolute; left: 0; top: 0;
  display: block; width: 100%; height: 100%;
  touch-action: none;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.hb-stage.hb-inbattle #view { height: calc(100% - var(--hb-bar-h)); }

.hb-hold {
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}
.hb-ico { width: 60%; height: 60%; max-width: 44px; max-height: 44px; display: block; pointer-events: none; }
.hb-ico * { vector-effect: non-scaling-stroke; }
.hb-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

/* ---------- shared bits: chips, tiles, sheets ---------- */
.hb-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.hb-chip {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 56px; min-width: 56px; padding: 6px 14px;
  font: 700 1.05rem/1.15 var(--ui);
  color: var(--ink); background: var(--paper);
  border: 2px solid var(--line); border-radius: 14px;
  cursor: pointer;
}
.hb-chip[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.hb-chip[disabled] { opacity: .45; cursor: not-allowed; }
.hb-chip.is-locked { border-style: dashed; }
.hb-chip small { font-weight: 400; font-size: .85rem; opacity: .85; }
.hb-chip .hb-ico { width: 24px; height: 24px; }

.hb-btn-ui { font-family: var(--ui); font-weight: 700; }
.hb-stage .btn.hb-primary, .hb-primary { min-height: 72px; font-size: 1.25rem; padding: 10px 26px; }
.hb-stage .btn { min-height: 56px; min-width: 56px; flex-shrink: 0; }   /* a button never squeezes below a tap target */
.hb-stage .btn[disabled] { opacity: .5; cursor: not-allowed; box-shadow: none; transform: none; }
.hb-note { margin: 6px 0 0; font-size: 1rem; color: var(--ink-soft); }
.hb-redchalk { color: var(--sanguine); font-family: var(--hand); font-size: 1.3rem; line-height: 1.2; }
.hb-hand { font-family: var(--hand); color: var(--ink-soft); }

.hb-roundel {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; border-radius: 50%;
  border: 2px solid var(--ink); background: var(--card);
  font: 700 1.4rem/1 var(--ui); color: var(--ink);
  overflow: hidden;
}
.hb-roundel canvas { width: 100%; height: 100%; display: block; }
/* a team crest is drawn at twice its size for sharpness: it shows at its own CSS size (--crest from screens.js), never
   at its backing-store size (the rival's crest spilled out of its 56 px button at 80 px; M1 review). Contextual rules
   below (team portraits, the hand-off emblem) come later or are more specific, so they still win. */
canvas[data-crest] { display: block; width: var(--crest, 40px); height: var(--crest, 40px); pointer-events: none; }

/* ---------- screens (title, who's playing, pick bugs, battle, book; cabinet and pages are QUESTIONS') ---------- */
.hb-screen {
  position: absolute; inset: 0; z-index: 10;
  overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  padding: 16px;
  background: var(--paper);
  background-image: var(--grain);
  color: var(--ink);
}

/* ---------- the title (Screen 0) ---------- */
.hb-title-inner {
  min-height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  max-width: 980px; margin: 0 auto;
  text-align: center;
}
.hb-front { display: flex; flex-direction: column; align-items: center; }
.hb-fig { margin: 0; color: var(--ink-soft); letter-spacing: .12em; }
.hb-frontis { width: min(260px, 70vw); height: auto; }
.hb-latin { margin: 0; font-size: 1.15rem; color: var(--ink-soft); }
.hb-title-main { width: min(100%, 460px); display: flex; flex-direction: column; align-items: center; }
.hb-title h1 {
  margin: 0; font-family: var(--display); font-weight: 400;
  font-size: clamp(2.4rem, 9vw, 4.2rem); line-height: 1.05; color: var(--ink);
}
.hb-sub { margin: 2px 0 6px; font-family: var(--caps); color: var(--sanguine); letter-spacing: .04em; }
.hb-verse { margin: 4px 0 10px; font-size: .98rem; color: var(--ink-soft); }
.hb-verse .caps { white-space: nowrap; }
.hb-gathering { margin: 0 0 8px; font-size: 1.3rem; color: var(--sanguine); }
.hb-title-buttons { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.hb-title-buttons .btn {
  width: 100%; min-height: 56px;
  font-family: var(--ui); font-weight: 700; font-size: 1.1rem;
}
.hb-title-buttons .btn.hb-big { min-height: 104px; font-size: 1.45rem; }
.hb-title-buttons .btn[disabled] { opacity: .55; cursor: progress; }
.hb-title-row { display: flex; flex-wrap: wrap; gap: 10px; }
.hb-title-row .btn { flex: 1 1 130px; width: auto; font-size: 1rem; }
.hb-title-msg { min-height: 1.4em; margin: 6px 0 0; }
.hb-seal {
  position: relative;
  margin-top: 14px;
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 56px; padding: 6px 16px;
  border: 1.5px dashed var(--line); border-radius: 999px;
  background: transparent; color: var(--ink-soft); cursor: pointer;
  font-size: .9rem;
  overflow: hidden;
}
.hb-owl { display: block; color: var(--ink); pointer-events: none; }
.hb-seal-owl { width: 30px; height: 30px; flex: none; }
.hb-seal[disabled] { opacity: .5; }
.hb-seal::after {               /* the hold fills in like ink soaking into blotting paper */
  content: ""; position: absolute; left: 0; bottom: 0; height: 4px;
  width: calc(var(--hold, 0) * 100%); background: var(--sanguine);
}

/* tablet landscape and wider: the frontispiece beside the buttons */
@media (min-width: 760px) and (min-aspect-ratio: 1/1) {
  .hb-title-inner { flex-direction: row; gap: 40px; }
  .hb-frontis { width: min(320px, 32vw); }
}
/* little height (a phone held sideways): tighter title, the frontispiece beside the buttons */
@media (max-height: 520px) {
  .hb-frontis { width: 150px; }
  .hb-title h1 { font-size: 2.2rem; }
  .hb-title-buttons .btn.hb-big { min-height: 72px; font-size: 1.2rem; }
  .hb-verse { display: none; }
}
@media (max-height: 520px) and (min-aspect-ratio: 1/1) {
  .hb-title-inner { flex-direction: row; gap: 20px; justify-content: center; }
  .hb-front { flex: 0 0 auto; }
  .hb-frontis { width: min(150px, 24vw); }
  .hb-latin, .hb-front .hb-fig { display: none; }
  .hb-title-main { width: min(100%, 400px); }
  .hb-sub { font-size: .95rem; }
}
/* a narrow phone held upright: a smaller frontispiece so the big button sits higher */
@media (max-width: 480px) {
  .hb-frontis { width: min(200px, 52vw); }
  .hb-latin { font-size: 1rem; }
}

/* ---------- the setup screens (1 Who's playing, 2 Pick your bugs, 4 The battle) ---------- */
.hb-setup { max-width: 980px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; min-height: 100%; }
.hb-setup-head { text-align: center; }
.hb-setup-head h2 { font-family: var(--display); font-weight: 400; font-size: clamp(1.9rem, 6vw, 2.6rem); margin: 0; }
.hb-step { margin: 0; color: var(--sanguine); letter-spacing: .1em; font-size: .95rem; }
.hb-cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
@media (min-width: 760px) and (min-aspect-ratio: 1/1) {
  .hb-cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
}
.hb-box {
  min-width: 0;
  background: var(--card); background-image: var(--grain);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
}
.hb-box h3 { margin: 0 0 10px; font-family: var(--caps); font-weight: 400; font-size: 1.15rem; letter-spacing: .05em; color: var(--ink); }
.hb-box h3 .hb-fig { display: inline; font-size: .9rem; margin-right: 6px; color: var(--sanguine); }
.hb-box + .hb-box { margin-top: 0; }
.hb-field { margin: 12px 0 0; }
.hb-field > .hb-lbl { display: block; margin: 0 0 6px; font: 700 1rem var(--ui); color: var(--ink-soft); }
.hb-setup-foot {
  margin-top: auto;
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center;
  padding-top: 6px;
}
.hb-setup-foot .btn { font-family: var(--ui); font-weight: 700; }
.hb-setup-foot .hb-go { flex: 1 1 220px; max-width: 420px; margin-left: auto; }

/* people rows */
.hb-people { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.hb-person {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px;
  padding: 8px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--paper);
}
.hb-pname { flex: 1 1 120px; min-width: 0; font: 700 1.2rem/1.2 var(--ui); overflow-wrap: anywhere; }
.hb-pname small { display: block; font: 400 .85rem/1.2 var(--ui); color: var(--ink-soft); }
.hb-person .hb-grades { flex: 1 1 100%; }
.hb-x {
  flex: none; width: 56px; height: 56px; min-width: 56px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--line); border-radius: 12px; background: transparent; color: var(--ink-soft);
  font: 700 1.5rem/1 var(--ui); cursor: pointer;
}
.hb-fold { flex: 1 1 100%; border-top: 1px dashed var(--line); padding-top: 8px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.hb-fold .hb-lbl { font: 700 .95rem var(--ui); color: var(--ink-soft); margin-right: 4px; }
.hb-tiles { display: flex; flex-wrap: wrap; gap: 8px; }
.hb-tile {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 64px; padding: 6px 14px 6px 8px;
  border: 2px solid var(--ink); border-radius: 14px; background: var(--paper); color: var(--ink);
  font: 700 1.1rem var(--ui); cursor: pointer;
}
.hb-tile .hb-roundel { width: 46px; height: 46px; font-size: 1.5rem; }
.hb-tile[disabled] { opacity: .45; cursor: not-allowed; }
.hb-adder { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.hb-text {
  flex: 1 1 160px; min-width: 0; min-height: 56px; padding: 8px 12px;
  font: 700 1.1rem var(--ui); color: var(--ink); background: var(--paper);
  border: 2px solid var(--line); border-radius: 12px;
}
.hb-text:focus { border-color: var(--ink); outline: none; }

/* team portraits and rivals */
.hb-teams { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.hb-team {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 112px; padding: 8px 6px;
  border: 2px solid var(--line); border-radius: 14px; background: var(--paper); color: var(--ink);
  font: 700 1rem/1.15 var(--ui); cursor: pointer; text-align: center;
}
.hb-team canvas { width: 56px; height: 56px; }
.hb-team[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 3px var(--team, var(--sanguine)); }
.hb-team[disabled] { opacity: .35; cursor: not-allowed; }
.hb-team small { font-weight: 400; color: var(--ink-soft); }
.hb-pk .hb-team { min-height: 128px; }
.hb-pk .hb-team canvas { width: 72px; height: 72px; }
.hb-rival { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 8px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--paper); }
.hb-rival + .hb-rival { margin-top: 8px; }
.hb-rival .hb-pname { flex: 1 1 140px; }
.hb-swatch { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--ink); background: var(--team, #888); vertical-align: -1px; }
.hb-names { display: flex; flex-direction: column; gap: 8px; }
.hb-namerow { display: flex; gap: 8px; align-items: center; }
.hb-namerow .hb-text { flex: 1 1 auto; }
.hb-iconbtn {
  flex: none; width: 56px; height: 56px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid var(--ink); border-radius: 12px; background: var(--paper); color: var(--ink); cursor: pointer;
}
.hb-iconbtn .hb-ico { width: 30px; height: 30px; }
.hb-iconbtn canvas { width: 40px; height: 40px; display: block; pointer-events: none; }

/* hats drawn on their chips, and the team's bug wearing the picked one (Pick your bugs: non-readers choose by look) */
.hb-chip canvas[data-hat] { display: block; width: 34px; height: 34px; margin: -4px 0 -4px -6px; flex: none; pointer-events: none; }
.hb-hatrow { display: flex; align-items: flex-start; gap: 10px; }
.hb-hatrow .hb-chips { flex: 1 1 auto; min-width: 0; }
.hb-preview {
  flex: none; width: 72px; height: 72px; border-radius: 50%; overflow: hidden;
  border: 2px solid var(--ink); background: var(--paper);
  box-shadow: inset 0 0 0 3px var(--team, var(--line));
}
.hb-preview canvas { display: block; width: 72px; height: 72px; }

/* battlefield plates */
.hb-maps { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.hb-map {
  display: flex; flex-direction: column; align-items: stretch; gap: 4px;
  min-height: 120px; padding: 6px;
  border: 2px solid var(--line); border-radius: 12px; background: var(--paper); color: var(--ink);
  font: 700 1rem/1.15 var(--ui); cursor: pointer; text-align: center;
}
.hb-map svg { width: 100%; height: 72px; display: block; }
.hb-map[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 3px var(--sanguine); }
.hb-map small { font: 400 .8rem var(--caps); color: var(--sanguine); letter-spacing: .06em; }
.hb-est { margin: 8px 0 0; font: 700 1.05rem var(--ui); color: var(--ink); }
.hb-est.is-bad { color: var(--sanguine); }

/* ---------- the HUD buttons (top right) ---------- */
.hb-hudtop {
  position: absolute; top: 8px; right: 8px; z-index: 5;
  display: flex; gap: 8px; flex-wrap: nowrap; justify-content: flex-end;
  pointer-events: none;
}
.hb-hudtop > * { pointer-events: auto; }
.hb-hb, .hb-hudtop .fs-btn {
  width: 56px; height: 56px; min-width: 56px; min-height: 56px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink);
  background: color-mix(in srgb, var(--card) 90%, transparent);
  border: 2px solid var(--ink); border-radius: 12px;
  cursor: pointer;
}
.hb-hudtop .fs-btn svg { width: 26px; height: 26px; }
.hb-hb .hb-ico { width: 28px; height: 28px; }
.hb-hb.hb-find[data-pk="1"] { width: 72px; height: 72px; }
.hb-hb.hb-find[data-pk="1"] .hb-ico { width: 36px; height: 36px; }
.hb-hb[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

/* ---------- the control bar ---------- */
.hb-ctlbar {
  --walk: 88px; --jump: 80px; --flip: 72px; --sat: 88px; --fire: 112px; --gap: 12px; --fuse: 56px;
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 5;
  height: var(--hb-bar-h, 112px);
  background: var(--card); background-image: var(--grain);
  border-top: 1.5px solid var(--line);
  color: var(--ink);
  font-family: var(--ui);
}
.hb-ctlbar[data-pk="1"] { --walk: 104px; --jump: 104px; --sat: 112px; --fire: 128px; --gap: 24px; }
.hb-ctlbar[data-layout="rows"] { --walk: 76px; --jump: 76px; --sat: 76px; --fire: 96px; --gap: 12px; }
.hb-ctlbar[data-layout="rows"][data-pk="1"] { --walk: 84px; --jump: 84px; --sat: 84px; --fire: 104px; --gap: 12px; }
.hb-ctlbar[data-layout="sides"] { --walk: 72px; --jump: 72px; --sat: 76px; --fire: 96px; --gap: 8px; }
.hb-ctlbar[data-layout="sides"][data-pk="1"] { --walk: 84px; --jump: 84px; --sat: 84px; --fire: 104px; --gap: 8px; }

.hb-bar-in {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: space-between; gap: var(--gap);
  padding: 8px max(12px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
}
.hb-g { display: flex; align-items: center; gap: var(--gap); }
.hb-g-fuse { gap: 8px; }
.hb-g-act { margin-left: auto; }

.hb-cb {
  position: relative;
  flex: none;
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  width: var(--walk); height: var(--walk);
  padding: 0;
  color: var(--ink); background: var(--paper);
  border: 2px solid var(--ink); border-radius: 16px;
  box-shadow: 2px 3px 0 var(--line);
  font: 700 1rem/1 var(--ui);
  cursor: pointer;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  touch-action: none;
}
.hb-cb .hb-cbl { font-size: .95rem; pointer-events: none; }
.hb-cb.is-down, .hb-cb:active { transform: translate(1px, 2px); box-shadow: 0 0 0 var(--line); background: var(--paper-deep); }
.hb-cb[disabled] { opacity: .4; cursor: not-allowed; box-shadow: none; }
.hb-jump { width: var(--jump); height: var(--jump); }
.hb-flip { width: var(--flip); height: var(--flip); }
.hb-satbtn { width: var(--sat); height: var(--sat); }
.hb-satbtn canvas { width: 70%; height: 52%; display: block; pointer-events: none; }
.hb-satbtn .hb-cbl { font-size: .8rem; max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding: 0 4px; }
.hb-ctlbar[data-layout="rows"] .hb-satbtn .hb-cbl, .hb-ctlbar[data-layout="sides"] .hb-satbtn .hb-cbl { font-size: .74rem; }   /* 64 px of text: "Blackberry" fits */
.hb-ammo {
  position: absolute; top: -8px; right: -8px;
  min-width: 30px; height: 26px; padding: 0 6px; border-radius: 13px;
  display: inline-flex; align-items: center; justify-content: center;
  font: 700 .9rem/1 var(--ui); background: var(--ink); color: var(--paper);
  pointer-events: none;
}
.hb-ammo:empty { display: none; }
.hb-fuse {
  width: var(--fuse); height: var(--fuse); border-radius: 14px;
  font: 700 1.25rem/1 var(--ui);
}
.hb-fuse small { font-size: .7rem; font-weight: 400; }
.hb-fuse[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.hb-fuse .hb-seeds { display: flex; gap: 2px; pointer-events: none; }
.hb-fuse .hb-seeds i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; display: block; }

/* FIRE: a round red wax seal; it sits proud of the bar. Its red is pinned in both themes: by lamplight --sanguine turns
   pale (#d97a5d), and the cream label on it fell to about 2.5 : 1 (M1 review); on #a4442b it is about 5.8 : 1. The ring
   and shadow mix with black, not --ink (which is cream by lamplight). The word is in --ui, like every word a child reads. */
.hb-firewrap { position: relative; flex: none; width: var(--fire); height: var(--fire); align-self: flex-end; }
.hb-fire {
  --hb-fire: #a4442b;
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  border: 3px solid color-mix(in srgb, var(--hb-fire) 70%, #000);
  background:
    radial-gradient(circle at 34% 26%, color-mix(in srgb, var(--hb-fire) 75%, #fff) 0 9%, transparent 30%),
    conic-gradient(from -90deg, color-mix(in srgb, var(--ochre) 85%, transparent) calc(var(--charge, 0) * 360deg), transparent 0),
    var(--hb-fire);
  box-shadow: 0 3px 0 #5e2414, inset 0 0 0 6px color-mix(in srgb, var(--hb-fire) 82%, #000);
  color: #fff8e6;
  font: 700 1.35rem/1 var(--ui); letter-spacing: .06em;
  cursor: pointer;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  touch-action: none;
  transition: transform .08s;
}
.hb-ctlbar[data-pk="1"] .hb-fire { font-size: 1.6rem; }
.hb-fire.is-down { transform: scale(.94); }
.hb-fire.is-charging { transform: scale(calc(1 + var(--charge, 0) * .08)); }
.hb-fire[disabled] { filter: grayscale(.85); opacity: .55; cursor: not-allowed; }
.hb-fire.is-rest { filter: grayscale(.5); opacity: .7; }
/* a Golden weapon ready (D§5.4 step 4): a 3 px ochre ring and a slow soft glow on the satchel button, and on FIRE once
   the Golden weapon is chosen. FIRE keeps its #a4442b face, so its contrast holds; the glow is outside it. Still under
   reduced motion or Gentle motion (below). A pulse (the Finale's hurry) wins over the glow. */
.hb-satbtn.is-golden {
  border-color: var(--ochre);
  box-shadow: 0 0 0 3px var(--ochre), 2px 3px 0 var(--line);
  animation: hb-goldglow 2.4s ease-in-out infinite;
}
.hb-fire.is-golden {
  box-shadow: 0 3px 0 #5e2414, inset 0 0 0 6px color-mix(in srgb, var(--hb-fire) 82%, #000), 0 0 0 3px var(--ochre);
  animation: hb-goldglow-fire 2.4s ease-in-out infinite;
}
@keyframes hb-goldglow {
  0%, 100% { box-shadow: 0 0 0 3px var(--ochre), 2px 3px 0 var(--line); }
  50% { box-shadow: 0 0 0 3px var(--ochre), 0 0 18px 6px color-mix(in srgb, var(--ochre) 55%, transparent); }
}
@keyframes hb-goldglow-fire {
  0%, 100% { box-shadow: 0 3px 0 #5e2414, inset 0 0 0 6px color-mix(in srgb, var(--hb-fire) 82%, #000), 0 0 0 3px var(--ochre); }
  50% { box-shadow: 0 3px 0 #5e2414, inset 0 0 0 6px color-mix(in srgb, var(--hb-fire) 82%, #000), 0 0 0 3px var(--ochre), 0 0 22px 8px color-mix(in srgb, var(--ochre) 55%, transparent); }
}
.hb-ctlbar[data-gentle="1"] .hb-satbtn.is-golden, .hb-ctlbar[data-gentle="1"] .hb-fire.is-golden { animation: none; }
.hb-fire.is-pulse { animation: hb-pulse 1.1s ease-in-out infinite; }
@keyframes hb-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); box-shadow: 0 0 0 10px color-mix(in srgb, var(--hb-fire, var(--sanguine)) 25%, transparent); } }
.hb-fire-t { pointer-events: none; }
.hb-ask {
  position: absolute; top: 4%; left: 4%;
  width: 30px; height: 30px; border-radius: 50%;
  display: none; align-items: center; justify-content: center;
  background: var(--ochre); color: var(--ink); border: 2px solid var(--ink);
  font: 700 1rem/1 var(--ui); pointer-events: none;
}
.hb-fire.is-ask .hb-ask { display: inline-flex; }
.hb-dare {
  position: absolute; top: -12px; right: -6px;
  width: 56px; height: 56px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; flex-direction: column;
  border: 2px dashed var(--sanguine); background: var(--card); color: var(--sanguine);
  font: 700 1rem/1 var(--ui); cursor: pointer; touch-action: manipulation;
}
.hb-dare[aria-pressed="true"] { background: var(--sanguine); color: var(--paper); border-style: solid; animation: hb-dare 1.4s ease-in-out infinite; }
.hb-dare small { font: 700 1rem/1 var(--ui); }
.hb-dare:not([aria-pressed="true"]) small { font-size: .84rem; letter-spacing: .02em; }   /* "DARE?" inside the 56 px ring */
.hb-dare.is-tier2 { box-shadow: 0 0 0 3px color-mix(in srgb, var(--ochre) 55%, transparent); }
.hb-dare.is-tier3 { box-shadow: 0 0 0 4px var(--ochre); }
@keyframes hb-dare { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg) scale(1.08); } }
/* M3 review: the chip beckons on a player's first two Dare turns of a battle (hud.js): an ochre ring, and a 0.6 s
   wiggle every 5 s (the first a second in). Under Gentle or reduced motion only the ring stays (below). */
.hb-dare.is-beckon { box-shadow: 0 0 0 3px color-mix(in srgb, var(--ochre) 60%, transparent); animation: hb-beckon 5s ease-in-out 1s infinite; }
@keyframes hb-beckon {
  0% { transform: rotate(0) scale(1); }
  2.4% { transform: rotate(-14deg) scale(1.12); }
  4.8% { transform: rotate(12deg) scale(1.12); }
  7.2% { transform: rotate(-8deg) scale(1.06); }
  9.6% { transform: rotate(5deg) scale(1.03); }
  12%, 100% { transform: rotate(0) scale(1); }
}
/* P/K (M3 review): the chip was a 56 px ring on FIRE's shoulder, so a four-year-old aiming at FIRE could set a Dare he
   never chose. Now it is a 96 px seal BESIDE FIRE (84 px on a phone's bar, like the other P/K buttons there), outside
   FIRE's box. The one-row bar keeps its room while it shows (.has-dare) and closes up where it is narrow (data-snug,
   hud.js snugFor: 24 px gaps from 792 px wide, 12 from 732, then an 84 px chip, then 8 px gaps from 700). The two-row
   bar puts it left of the satchel (below); in side columns it floats to the left of the column. */
.hb-ctlbar { --dare: 56px; }
.hb-ctlbar[data-pk="1"] { --dare: 96px; }
.hb-ctlbar[data-layout="rows"][data-pk="1"], .hb-ctlbar[data-layout="sides"][data-pk="1"] { --dare: 84px; }
.hb-ctlbar[data-layout="row"][data-pk="1"][data-snug="1"] { --gap: 12px; }
.hb-ctlbar[data-layout="row"][data-pk="1"][data-snug="2"] { --gap: 12px; --dare: 84px; }
.hb-ctlbar[data-layout="row"][data-pk="1"][data-snug="2"] .hb-bar-in { gap: 8px; }     /* the groups' least gap only */
.hb-ctlbar[data-layout="row"][data-pk="1"][data-snug="3"] { --gap: 8px; --dare: 84px; }
.hb-ctlbar[data-pk="1"] .hb-dare {
  top: calc(50% - var(--dare) / 2); right: calc(100% + var(--gap));
  width: var(--dare); height: var(--dare); border-width: 3px; gap: 4px;
  font-size: 1.9rem;
}
.hb-ctlbar[data-pk="1"] .hb-dare small, .hb-ctlbar[data-pk="1"] .hb-dare:not([aria-pressed="true"]) small { font-size: 1.05rem; letter-spacing: 0; }
.hb-ctlbar[data-layout="row"][data-pk="1"] .hb-firewrap.has-dare { margin-left: calc(var(--dare) + var(--gap)); }
/* the two-row P/K bar has no width to spare beside FIRE (a 360 px phone's stage is 328 wide), but its second row's left
   half is empty: the chip sits there, left of the satchel, so the satchel stands between it and FIRE */
.hb-ctlbar[data-layout="rows"][data-pk="1"] .hb-dare { right: calc(100% + var(--gap) + var(--sat) + var(--gap)); }
.hb-ctlbar[data-layout="sides"][data-pk="1"] .hb-dare { right: calc(100% + 18px); }
/* the 6+ chip pokes 12 px above the seal (more as it wiggles): the one-row bar's tray rises clear of it while it shows */
.hb-ctlbar[data-layout="row"][data-dare="1"]:not([data-pk="1"]) .hb-tray { bottom: calc(100% + 20px); }
/* the prize the Dare asks for: a red-chalk ribbon across the seal's lower rim (taps go through to FIRE). Its red is
   pinned like FIRE's: on by-lamplight --sanguine (#d97a5d) the cream fell to about 2.8 : 1 (M3 review); on #a4442b it
   is about 5.8 : 1. 15 px, so a second-grader reads "Triple Acorn" at tablet distance (the ▲ pips are the chip's); a
   long prize ("Super-Bouncy Pinecone") wraps to two lines, and FIRE's word rises above the ribbon (.is-dared). */
.hb-daretag {
  position: absolute; left: 50%; bottom: 4px; transform: translateX(-50%) rotate(-2deg); z-index: 1;
  width: max-content; max-width: calc(var(--fire) + 16px);          /* 8 px past each side: inside the bar's 12 px edge */ padding: 2px 8px; text-align: center; pointer-events: none;
  font: 700 .95rem/1.12 var(--ui); color: #fff8e6; background: #a4442b; border: 2px solid #5e2414;
  border-radius: 3px; box-shadow: 2px 2px 0 rgba(0, 0, 0, .3);
}
.hb-fire-t { transition: transform .15s; }
.hb-ctlbar[data-layout="row"] .hb-fire.is-dared .hb-fire-t { transform: translateY(-12px); }
/* the phone bars' 96 px seal: no lift (the word would rise into the chip), and no wrapping ("Super-Bouncy Pinecone" took
   three lines and hid FIRE): one line hung 6 px lower, into the bar's bottom margin, from the seal's right edge leftwards
   (over the satchel's word for a long prize; the satchel draws that prize meanwhile). The two-row bar's 6+ chip sits
   higher and further out, clear of FIRE's word. */
.hb-ctlbar[data-layout="rows"] .hb-daretag, .hb-ctlbar[data-layout="sides"] .hb-daretag {
  bottom: -6px; left: auto; right: -8px; transform: rotate(-2deg); max-width: none; white-space: nowrap;
}
.hb-ctlbar[data-layout="rows"]:not([data-pk="1"]) .hb-dare { top: -18px; right: -10px; }
/* M4 review: the Greengrocer's Scales' preview ("Your side 180 → 120", hud.js) on FIRE's lower rim, where the Dare's
   prize ribbon sits (the Scales has no Dare, so they never meet). Ink on paper, not red chalk, so it never reads as a
   Dare; taps go through to FIRE, and FIRE's word rises over it as over the ribbon. The phone bars hang it in one line. */
.hb-scalenote {
  position: absolute; left: 50%; bottom: 4px; transform: translateX(-50%) rotate(-2deg); z-index: 1;
  width: max-content; max-width: calc(var(--fire) + 16px); padding: 2px 8px; text-align: center; pointer-events: none;
  font: 700 .95rem/1.12 var(--ui); color: var(--ink); background: var(--paper); border: 2px solid var(--ink);
  border-radius: 3px; box-shadow: 2px 2px 0 var(--line);
}
.hb-ctlbar[data-layout="row"] .hb-fire.is-noted .hb-fire-t { transform: translateY(-12px); }
.hb-ctlbar[data-layout="rows"] .hb-scalenote, .hb-ctlbar[data-layout="sides"] .hb-scalenote {
  bottom: -6px; left: auto; right: -8px; transform: rotate(-2deg); max-width: none; white-space: nowrap;
}
/* the brass Spyglass glint */
/* the Spyglass glint: a brass badge on the satchel button's top edge (his aim shows its whole arc this shot) */
.hb-satbtn { position: relative; }
.hb-glint {
  position: absolute; left: 50%; top: -12px; transform: translateX(-50%); z-index: 1;
  display: inline-flex; align-items: center; gap: 3px; padding: 0 7px; white-space: nowrap; pointer-events: none;
  font: 700 .74rem/1.3 var(--ui); color: #4a2e0c; background: #e6c46a; border: 2px solid #7a5420; border-radius: 10px;
}
.hb-glint svg { width: 30px; height: 15px; }
.hb-ctlbar[data-gentle="1"] .hb-dare[aria-pressed="true"], .hb-ctlbar[data-gentle="1"] .hb-dare.is-beckon { animation: none; }
@media (prefers-reduced-motion: reduce) {
  .hb-ctlbar:not([data-gentle="0"]) .hb-dare[aria-pressed="true"], .hb-ctlbar:not([data-gentle="0"]) .hb-dare.is-beckon { animation: none; }
}
.hb-alldone {
  width: auto; min-width: 150px; height: var(--fire); padding: 0 22px;
  border-radius: 20px; font-size: 1.4rem; background: var(--sage); color: var(--paper); border-color: var(--ink);
}
.hb-alldone.is-pulse { animation: hb-pulse 1.1s ease-in-out infinite; }
.hb-alldone.is-glow { box-shadow: 0 0 0 8px color-mix(in srgb, var(--ochre) 45%, transparent); }
.hb-cpu-note {
  position: absolute; inset: 0; display: none; align-items: center; justify-content: center; gap: 12px;
  padding: 0 72px 0 12px; text-align: center;
  font: 700 1.15rem/1.2 var(--ui); color: var(--ink-soft);
}
/* (the show states win over every layout rule below) */
.hb-ctlbar[data-show="cpu"] .hb-cpu-note, .hb-ctlbar[data-show="wait"] .hb-cpu-note, .hb-ctlbar[data-show="helper"] .hb-cpu-note { display: flex !important; }
.hb-ctlbar[data-show="cpu"] .hb-bar-in, .hb-ctlbar[data-show="wait"] .hb-bar-in, .hb-ctlbar[data-show="helper"] .hb-bar-in,
.hb-ctlbar[data-show="cpu"] .hb-tray, .hb-ctlbar[data-show="wait"] .hb-tray, .hb-ctlbar[data-show="helper"] .hb-tray,
.hb-ctlbar[data-show="cpu"] .hb-gauge, .hb-ctlbar[data-show="wait"] .hb-gauge, .hb-ctlbar[data-show="helper"] .hb-gauge { display: none !important; }
.hb-ctlbar[data-show="helper"] .hb-cpu-note { color: var(--sanguine); font-size: 1.3rem; }
.hb-ctlbar[data-show="none"] { visibility: hidden; }
.hb-ctlbar[data-show="none"] * { visibility: hidden; }

/* the floating tray of turn tools: nudges, classic angle, Pick a Friend, chute, rope, walker way, bridge angle */
.hb-tray {                 /* right-aligned above the bar: the camera keeps the bug in the middle */
  position: absolute; right: 12px; bottom: calc(100% + 8px);
  display: flex; flex-wrap: nowrap; justify-content: flex-end; gap: 8px;
  max-width: calc(100% - 24px);
  pointer-events: none;
}
.hb-tray > * { pointer-events: auto; }
.hb-tray:empty { display: none; }
.hb-tb {
  min-width: 56px; height: 56px; padding: 0 12px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  color: var(--ink); background: color-mix(in srgb, var(--card) 92%, transparent);
  border: 2px solid var(--ink); border-radius: 14px; box-shadow: 1px 2px 0 var(--line);
  font: 700 1rem/1 var(--ui); cursor: pointer; white-space: nowrap;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: none;
}
.hb-tb .hb-ico { width: 26px; height: 26px; }
.hb-tb[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.hb-tb.is-down { background: var(--paper-deep); }
.hb-tb.hb-soft { border-style: dashed; color: var(--ink-soft); }

/* the power and angle gauges (ambient practice, never a question) */
.hb-gauge {
  position: absolute; left: 12px; bottom: calc(100% + 8px);
  display: flex; align-items: center; gap: 8px; padding: 4px 8px;
  background: color-mix(in srgb, var(--card) 88%, transparent);
  border: 1.5px solid var(--line); border-radius: 12px;
  pointer-events: none;
  color: var(--ink);
}
.hb-gauge svg { display: block; height: 44px; width: auto; }
.hb-gauge text { font: 700 11px var(--ui); fill: currentColor; }
.hb-gauge .hb-gnum { font: 700 1.05rem/1 var(--ui); min-width: 3.2ch; text-align: right; }

/* the two-row bar (narrow screens): [left][Jump][right] above [fuse][Satchel][FIRE] */
.hb-ctlbar[data-layout="rows"] .hb-bar-in {
  display: grid; grid-template-columns: auto 1fr auto; grid-template-rows: auto auto;
  align-content: space-between; align-items: center; gap: 8px var(--gap);
}
.hb-ctlbar[data-layout="rows"] .hb-g-move { grid-column: 1 / 4; grid-row: 1; justify-content: flex-start; }
.hb-ctlbar[data-layout="rows"] .hb-g-fuse { grid-column: 1; grid-row: 2; }
.hb-ctlbar[data-layout="rows"] .hb-g-act { grid-column: 3; grid-row: 2; }
.hb-ctlbar[data-layout="rows"] .hb-firewrap { align-self: center; }
/* on the silk (phones): left, Climb, Let-out, right share the first row, narrowing to fit (never below 56 px) */
.hb-ctlbar[data-layout="rows"][data-rope="1"] .hb-g-move { gap: 8px; }
.hb-ctlbar[data-layout="rows"][data-rope="1"] .hb-g-move .hb-cb { flex: 0 1 var(--walk); min-width: 56px; }

/* side columns (short screens): walk and jump on the left, satchel and FIRE on the right */
.hb-ctlbar[data-layout="sides"] {
  top: 0; height: auto; background: none; border: 0; pointer-events: none;
}
.hb-ctlbar[data-layout="sides"] .hb-bar-in { padding: 0; pointer-events: none; }
.hb-ctlbar[data-layout="sides"] .hb-g {
  position: absolute; bottom: max(8px, env(safe-area-inset-bottom)); pointer-events: auto;
  padding: 8px; border-radius: 16px;
  background: color-mix(in srgb, var(--card) 78%, transparent);
  border: 1.5px solid var(--line);
}
.hb-ctlbar[data-layout="sides"] .hb-g-move {
  left: max(8px, env(safe-area-inset-left));
  display: grid; grid-template-columns: var(--walk) var(--walk); gap: var(--gap);
}
.hb-ctlbar[data-layout="sides"] .hb-g-move .hb-jump { grid-column: 1 / 3; justify-self: center; order: -1; }
.hb-ctlbar[data-layout="sides"] .hb-g-move .hb-rope { order: -1; }          /* on the silk: Climb | Let out above the walk arrows */
.hb-ctlbar[data-layout="sides"] .hb-g-act {
  right: max(8px, env(safe-area-inset-right)); margin: 0;
  flex-direction: column; gap: var(--gap);
}
.hb-ctlbar[data-layout="sides"] .hb-g-act .hb-satbtn { order: -1; }
.hb-ctlbar[data-layout="sides"] .hb-g-fuse {
  right: calc(max(8px, env(safe-area-inset-right)) + var(--fire) + 28px);
  flex-direction: column;
}
.hb-ctlbar[data-layout="sides"] .hb-g-fuse:empty, .hb-ctlbar .hb-g-fuse:empty { display: none; }
.hb-ctlbar[data-layout="sides"] .hb-firewrap { align-self: center; }
.hb-ctlbar[data-layout="rows"] .hb-gauge { bottom: calc(100% + 72px); }
.hb-ctlbar[data-layout="sides"] .hb-tray { right: auto; left: 50%; transform: translateX(-50%); bottom: max(8px, env(safe-area-inset-bottom)); }
.hb-ctlbar[data-layout="sides"] .hb-gauge { left: 50%; transform: translateX(-50%); bottom: 72px; }
.hb-ctlbar[data-layout="sides"] .hb-cpu-note {
  inset: auto 8px 8px auto; padding: 10px 14px; border-radius: 14px;
  background: color-mix(in srgb, var(--card) 88%, transparent); border: 1.5px solid var(--line);
}
.hb-ctlbar[data-layout="sides"][data-show="cpu"] { pointer-events: none; }
.hb-ctlbar[data-layout="sides"] .hb-cpu-note .hb-hb { pointer-events: auto; }

/* ---------- the satchel: one tidy grid opened by one button ---------- */
.hb-satchel {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 7;
  max-height: 78%; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain;
  background: var(--card); background-image: var(--grain);
  border-top: 2px solid var(--ink);
  box-shadow: 0 -10px 30px -12px rgba(0, 0, 0, .45);
  padding: 10px 12px max(12px, env(safe-area-inset-bottom));
  color: var(--ink);
}
/* tablets: a side panel wide enough for five cards a row, so every M1 card is in view at 1180 × 820 (M1 review) */
.hb-satchel.is-side {
  left: auto; top: 0; width: min(600px, 56%); max-height: none;
  border-top: 0; border-left: 2px solid var(--ink);
}
.hb-sat-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 6px; }
.hb-sat-head h2 { margin: 0; font: 400 1.5rem var(--display); }
.hb-sat-pocket { margin: 10px 0 6px; font: 400 .95rem var(--caps); letter-spacing: .08em; color: var(--sanguine); }
/* one grid: each pocket's caption spans the row as a small label */
.hb-sat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.hb-satchel.is-side { padding-top: 8px; }
.hb-satchel.is-side .hb-sat-head { margin-bottom: 2px; }
.hb-satchel.is-side .hb-sat-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
.hb-satchel.is-side .hb-wcard { gap: 2px; padding: 6px 6px 4px; }
.hb-satchel[data-pk="1"] .hb-sat-grid { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); }
.hb-sat-grid .hb-sat-pocket { grid-column: 1 / -1; margin: 2px 0 -2px; font-size: .85rem; }
.hb-sat-grid .hb-sat-pocket:first-child { margin-top: 0; }
.hb-wpocket { display: none; }             /* the pocket's tab on its first card: short screens only (below) */
.hb-wcard {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 4px;
  min-width: 96px; min-height: 112px; padding: 8px 6px 6px;
  border: 2px solid var(--line); border-radius: 12px; background: var(--paper); color: var(--ink);
  font: 700 .9rem/1.15 var(--ui); text-align: center; cursor: pointer;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: manipulation;
}
.hb-satchel[data-pk="1"] .hb-wcard { min-width: 128px; min-height: 140px; font-size: 1.1rem; }
.hb-wcard canvas { width: 80px; height: 56px; display: block; pointer-events: none; }
.hb-satchel[data-pk="1"] .hb-wcard canvas { width: 104px; height: 72px; }
.hb-wcard .hb-wfig { font: 400 .72rem var(--caps); color: var(--ink-soft); letter-spacing: .05em; pointer-events: none; }
.hb-wcard .hb-wname {             /* two lines at most ("Fizzy Lemonade Bottle" made a 160 px card) */
  pointer-events: none; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.hb-wcard .hb-wammo { position: absolute; top: 4px; right: 6px; font: 700 .95rem var(--ui); pointer-events: none; }
.hb-wcard[aria-current="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 3px var(--sanguine); }
.hb-wcard.is-locked { opacity: .45; filter: grayscale(1); cursor: not-allowed; }
.hb-wcard.is-golden { border-color: var(--ochre); }
.hb-wcard .hb-wask, .hb-wcard .hb-wdare {          /* a 56 px tap area round a small seal */
  position: absolute; width: 56px; height: 56px;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.hb-wcard .hb-wask { top: -6px; left: -6px; }
.hb-wcard .hb-wdare { bottom: -6px; right: -6px; }
/* M3 final check: in the corner the ▲ seal covered the end of the name ("Acorn Canno…", "Pea-Shoo…" at 1180 × 820); it
   now sits centred under the name, in room the card keeps for it */
.hb-satchel .hb-wcard.has-dare { padding-bottom: 32px; }
.hb-wcard.has-dare .hb-wdare { right: auto; left: calc(50% - 28px); bottom: -14px; }
.hb-wcard .hb-wask i, .hb-wcard .hb-wdare i {
  font-style: normal; width: 32px; height: 32px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; pointer-events: none;
  font: 700 1rem var(--ui);
}
.hb-wcard .hb-wask i { background: var(--ochre); color: var(--ink); border: 2px solid var(--ink); }
.hb-wcard .hb-wdare i { border: 2px dashed var(--sanguine); background: var(--card); color: var(--sanguine); }
.hb-wcard .hb-wquiet { position: absolute; top: 4px; left: 8px; color: var(--sage); font-size: 1.1rem; pointer-events: none; }
.hb-wcard .hb-wnote { font: 400 .75rem/1.1 var(--ui); color: var(--ink-soft); pointer-events: none; }
.hb-sat-foot { margin: 10px 0 0; min-height: 2.6em; font: 400 1.05rem/1.3 var(--body); color: var(--ink-soft); font-style: italic; }
/* a tablet's side sheet whose full-row captions would push cards below the fold (hud.js adds .is-tabs): the captions
   become tabs on each pocket's first card, as on short screens, so 15 cards show at once at 1156 × 578 */
.hb-satchel.is-tabs .hb-sat-grid { padding-top: 9px; row-gap: 14px; }
.hb-satchel.is-tabs .hb-sat-grid .hb-sat-pocket { display: none; }
.hb-satchel.is-tabs .hb-sat-foot { min-height: 1.3em; margin-top: 6px; }
.hb-satchel.is-tabs .hb-wcard .hb-wpocket {
  display: block; position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  padding: 0 6px; border: 1.5px solid var(--line); border-radius: 6px; background: var(--card);
  font: 400 .72rem/15px var(--caps); letter-spacing: .06em; color: var(--sanguine); white-space: nowrap;
  pointer-events: none;
}

/* M3's 20 cards on a tablet's side sheet (hud.js, measured): wider, seven 96 px columns, then a slimmer card */
.hb-satchel.is-side.is-wide { width: min(780px, 72%); }
.hb-satchel.is-side.is-wide .hb-sat-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.hb-satchel.is-side.is-compact .hb-wcard .hb-wfig { display: none; }
.hb-satchel.is-side.is-compact .hb-sat-grid { row-gap: 12px; }
.hb-satchel.is-side.is-compact .hb-sat-head { margin: 0; }
/* M4's 24 cards (33 with every crate weapon), hud.js measured: up to nine columns, the locked Golden note on its tab,
   then the cards close up (never under 96 × 112) */
.hb-satchel.is-side.is-dense { width: min(960px, 86%); }
.hb-satchel.is-side.is-dense .hb-wcard.is-locked .hb-wnote { display: none; }
.hb-satchel.is-side.is-dense .hb-sat-foot { min-height: 0; margin-top: 4px; }
.hb-satchel.is-side.is-tiny .hb-sat-grid { gap: 10px 6px; padding-top: 8px; }
.hb-satchel.is-side.is-tiny .hb-wcard { padding: 4px 4px 3px; }
.hb-satchel.is-side.is-tiny .hb-wcard canvas { width: 64px; height: 45px; }
.hb-satchel.is-side.is-tiny .hb-wcard.has-dare { padding-bottom: 26px; }
.hb-satchel.is-side.is-tiny .hb-wcard.has-dare .hb-wdare { bottom: -16px; }
.hb-satchel.is-side.is-full { width: 100%; border-left: 0; }
/* M4 review: the P/K cards stay 128 × 140 with their big pictures (D§6.5) on every step of the side sheet. The 6+
   steps' 96 px columns made a Kindergartner's 23 cards overlap and cut off the last column; for P/K only the widening
   steps help, so the sheet widens until every card shows */
.hb-satchel.is-side[data-pk="1"] .hb-sat-grid,
.hb-satchel.is-side.is-wide[data-pk="1"] .hb-sat-grid { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); }
.hb-satchel.is-side.is-tiny[data-pk="1"] .hb-wcard canvas { width: 88px; height: 61px; }   /* a Dare card stays 140 tall */
/* P/K's last step (hud.js is-bare): the heading hides and the × floats top right beside the grid, as on a phone held
   sideways, and the sheet's margins close up, so a K child's 24 cards show at once at 1024 × 768 */
.hb-satchel.is-side.is-bare { padding-top: 6px; padding-bottom: 6px; }
.hb-satchel.is-side.is-bare .hb-sat-head { position: absolute; top: 6px; right: max(10px, env(safe-area-inset-right)); margin: 0; z-index: 1; }
.hb-satchel.is-side.is-bare .hb-sat-head h2 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.hb-satchel.is-side.is-bare .hb-sat-grid, .hb-satchel.is-side.is-bare .hb-sat-foot { margin-right: 64px; }
.hb-satchel.is-side.is-bare .hb-sat-foot { margin-top: 0; }

/* ---------- overlay layers ---------- */
.hb-overlay { position: absolute; inset: 0; z-index: 12; pointer-events: none; }
.hb-layer {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  pointer-events: auto;
  overflow-x: hidden; overflow-y: auto;
}
.hb-layer.is-dim { background: color-mix(in srgb, var(--paper-deep) 55%, rgba(20, 14, 8, .45)); }
.hb-layer.is-pass { pointer-events: none; }
.hb-layer.is-pass .hb-sheet, .hb-layer.is-pass button, .hb-layer.is-pass a, .hb-layer.is-pass .hb-endbtns { pointer-events: auto; }
.hb-sheet {
  width: min(100%, 520px); max-height: 100%; overflow: auto; margin: auto;
  padding: 20px 22px;
  background: var(--card); background-image: var(--grain);
  border: 1.5px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--ink);
  text-align: center;
}
.hb-sheet h2 { font-family: var(--display); font-weight: 400; margin: .2em 0 .5em; font-size: clamp(1.6rem, 6vw, 2.2rem); }
.hb-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 12px; }
.hb-row .btn { min-height: 56px; font-family: var(--ui); font-weight: 700; }

/* the Garden Helper's sheet: equal buttons three to a row (a drawing and a short word), the wind first */
.hb-helper { width: min(100%, 460px); }
.hb-helper h2 { margin: .1em 0 .3em; }
.hb-hlbl { margin: 10px 0 6px; font: 700 1rem/1.2 var(--ui); color: var(--ink-soft); text-align: left; }
.hb-hrow { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.hb-hrow.is-one { grid-template-columns: minmax(0, 280px); justify-content: center; }
.hb-hrow .btn {
  width: 100%; min-height: 72px; margin: 0; padding: 6px 4px;
  flex-direction: column; gap: 2px;
  font: 700 1rem/1.1 var(--ui); letter-spacing: 0; white-space: normal; overflow-wrap: anywhere;
}
.hb-hrow .btn .hb-ico { width: 32px; height: 32px; }
.hb-hrow .btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.hb-hrow .btn span { pointer-events: none; }

/* the hand-off card */
.hb-handoff .hb-emblem {
  width: 160px; height: 160px; margin: 0 auto 6px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 3px solid var(--ink); background: var(--paper); font-size: 88px; line-height: 1;
  overflow: hidden;
}
.hb-handoff .hb-emblem canvas { width: 120px; height: 120px; }
.hb-handoff h2 { font-family: var(--ui); font-weight: 700; }
.hb-handoff .hb-prompt { margin: 0 0 8px; font: italic 1.3rem var(--body); }
.hb-handoff .hb-today { margin: 0 0 4px; font: 700 1rem var(--ui); color: var(--ink-soft); }
.hb-handoff .hb-stumppick { margin: 0 0 6px; font: 400 1.2rem var(--caps); letter-spacing: .05em; color: var(--sanguine); }   /* Stump: "Cyrus picked History for you!" (M3) */
.hb-stage .btn.hb-ready { min-height: 72px; min-width: 200px; font-size: 1.35rem; font-family: var(--ui); font-weight: 700; }
.hb-stage .hb-handoff.is-pk .btn.hb-ready { min-height: 112px; min-width: 240px; font-size: 1.7rem; }
.hb-ready.is-guard { opacity: .7; }

/* the grown-up check */
.hb-grown .hb-seal-big {
  width: 128px; height: 128px; margin: 6px auto; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; flex-direction: column;
  border: 3px solid var(--sanguine); background: var(--paper);
  color: var(--sanguine); font: 2.6rem/1 var(--display); cursor: pointer;
  background-image: conic-gradient(color-mix(in srgb, var(--sanguine) 35%, transparent) calc(var(--hold, 0) * 360deg), transparent 0);
}
.hb-grown .hb-seal-big small { font: .8rem var(--caps); letter-spacing: .08em; margin-top: 4px; }
.hb-grown .hb-seal-big .hb-owl { width: 68px; height: 68px; }
.hb-sum { font: 700 2.2rem/1.2 var(--ui); margin: 6px 0; }
.hb-sum-in { display: inline-block; min-width: 3.2ch; min-height: 1.2em; padding: 0 4px; border-bottom: 2px solid var(--ink); text-align: left; vertical-align: bottom; }
.hb-keypad { display: grid; grid-template-columns: repeat(3, 72px); gap: 8px; justify-content: center; }
.hb-key {
  width: 72px; height: 64px; border: 2px solid var(--ink); border-radius: 12px; background: var(--paper); color: var(--ink);
  font: 700 1.5rem var(--ui); cursor: pointer;
}
.hb-key.hb-ok { background: var(--ink); color: var(--paper); font-size: 1.1rem; }

/* the muster */
.hb-muster { align-items: flex-start; justify-content: space-between; flex-direction: column; }
.hb-plate {
  align-self: center; margin-top: 64px;
  padding: 6px 16px; border-radius: 10px;
  background: color-mix(in srgb, var(--card) 80%, transparent);
  font: 1.2rem var(--caps); letter-spacing: .06em; color: var(--ink); text-align: center;
}
.hb-plate .hb-fig { display: block; font-size: .9rem; color: var(--sanguine); }
.hb-skip { align-self: flex-end; min-width: 120px; }

/* the name banner at each turn start, and short notes (both made by hud.js inside the stage) */
.hb-turnbanner {
  position: absolute; left: 50%; top: 76px; transform: translateX(-50%); z-index: 6;
  max-width: calc(100% - 32px); pointer-events: none; text-align: center;
}
.hb-turnbanner .hb-pill {
  display: inline-block; padding: 8px 18px; border-radius: 999px;
  background: color-mix(in srgb, var(--card) 92%, transparent); border: 3px solid var(--team, var(--ink));
  font: 700 1.25rem/1.2 var(--ui); color: var(--ink);
  box-shadow: var(--shadow);
}
.hb-turnbanner .hb-pill small { display: block; font-weight: 400; font-size: .95rem; color: var(--ink-soft); }
.hb-toast {
  position: absolute; left: 50%; bottom: calc(var(--hb-bar-h) + 84px); transform: translateX(-50%); z-index: 6;
  max-width: calc(100% - 32px); padding: 8px 16px; border-radius: 12px;
  background: color-mix(in srgb, var(--card) 94%, transparent); border: 1.5px solid var(--ink);
  font: 700 1.05rem/1.25 var(--ui); color: var(--ink); text-align: center;
  pointer-events: none; box-shadow: var(--shadow);
}

/* the pause sheet */
.hb-pause .hb-row .btn { flex: 1 1 180px; }
.hb-holdbtn { position: relative; overflow: hidden; }
.hb-holdbtn::after { content: ""; position: absolute; left: 0; bottom: 0; height: 5px; width: calc(var(--hold, 0) * 100%); background: var(--sanguine); }
.hb-debugline { margin: 10px 0 0; font: 12px/1.3 ui-monospace, Consolas, monospace; color: var(--ink-soft); }

/* the ending: the rosette on top, the dance in the middle, the buttons below */
.hb-ending { flex-direction: column; justify-content: space-between; align-items: center; padding-top: 70px; }
.hb-ending.is-tap { pointer-events: auto; }
.hb-rosette { display: flex; flex-direction: column; align-items: center; text-align: center; max-width: 100%; }
.hb-rosette svg { width: 120px; height: 120px; display: block; }
.hb-rosette .hb-champ {
  margin: -4px 0 0; padding: 6px 16px; border-radius: 10px;
  background: color-mix(in srgb, var(--card) 88%, transparent);
  font: 1.35rem/1.2 var(--display); color: var(--ink);
}
.hb-rosette .hb-champ b { display: block; font: 700 1.1rem/1.2 var(--ui); color: var(--sanguine); }
/* The button plate: Again! alone and centred at the winner step, with no plate behind it; the other four arrive with
   the "buttons" step and only then does the plate get its card (screens.js sets .is-all). Buttons not yet shown take
   no room at all (they were only transparent: an empty plate hid the winners' dance; M1 review). One row on a tablet,
   so the plate stays over the control bar's strip and off the battlefield. */
.hb-endbtns { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; width: min(100%, 1010px);
  padding: 10px; border-radius: 14px; }
.hb-endbtns.is-all { background: color-mix(in srgb, var(--card) 85%, transparent); }
.hb-endbtns .btn { font-family: var(--ui); font-weight: 700; }
.hb-stage .hb-endbtns .btn.hb-again { min-height: 72px; min-width: 200px; font-size: 1.4rem; flex: 1 1 200px; }
.hb-stage .hb-endbtns:not(.is-all) .btn.hb-again { flex: 0 0 auto; padding: 10px 40px; }
.hb-endbtns .btn.ghost { flex: 1 1 auto; padding: 10px 12px; font-size: 1.02rem; }
.hb-ending .hb-reveal { opacity: 0; transform: translateY(8px); transition: opacity .35s, transform .35s; }
.hb-ending .hb-reveal.is-on { opacity: 1; transform: none; }
.hb-ending .hb-endbtns .hb-reveal:not(.is-on) { display: none; }
.hb-ending .hb-endbtns .hb-reveal.is-on { animation: hb-rise .35s ease-out both; }
@keyframes hb-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* the bows and the Garden Gazette (D§12.1 steps 4 and 5): the sheet lands over the dance, a clipping lights as the
   narrator reads it, and it folds away for the tea party */
.hb-layer.is-pass .hb-gazette, .hb-layer.is-pass .hb-clip { pointer-events: auto; }
/* centred with auto margins, not a translate: hb-rise ends on transform: none, which used to undo a translate(-50%)
   and push the pill half off the right edge (M2 integration) */
.hb-bows {
  position: absolute; left: 0; right: 0; top: 40%; width: max-content; max-width: calc(100% - 24px); margin: 0 auto;
  padding: 8px 20px; box-sizing: border-box; text-align: center;
  background: color-mix(in srgb, var(--card) 90%, transparent); border: 1.5px solid var(--line); border-radius: 999px;
  font: 700 1.15rem/1.2 var(--ui); color: var(--ink); animation: hb-rise .35s ease-out both;
}
/* a phone (short, or narrow): the rosette steps aside for the bows and the tea party (screens.js adds .is-away), so the
   last picture is seen; the bows pill takes the rosette's place at the top (ART-M2's note) */
@media (max-height: 560px), (max-width: 480px) {
  .hb-bows { top: 10px; padding: 6px 16px; font-size: 1.02rem; }
  .hb-bows .hb-hand { font-size: 1.35rem; }
}
.hb-bows .hb-hand { font-size: 1.55rem; font-weight: 400; color: var(--sanguine); }
.hb-rosette { transition: opacity .3s, transform .3s; }
.hb-ending .hb-rosette.is-away { opacity: 0; transform: translateY(-12px) scale(.94); }
.hb-gazette {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -54%) rotate(-.6deg);
  width: min(92%, 700px); max-height: calc(100% - 150px); overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain;
  padding: 12px 16px 10px; background: var(--card); background-image: var(--grain); color: var(--ink);
  border: 1.5px solid var(--line); box-shadow: var(--shadow), 0 18px 40px -18px rgba(40, 25, 10, .55);
  animation: hb-gz-in .45s cubic-bezier(.3, 1.4, .6, 1) both; transition: transform .38s ease-in, opacity .38s ease-in;
}
.hb-gazette.is-folded { transform: translate(-50%, -30%) rotate(4deg) scale(.6); opacity: 0; }
@keyframes hb-gz-in { from { transform: translate(-50%, -40%) rotate(-6deg) scale(.7); opacity: 0; } }
.hb-gz-mast { text-align: center; border-bottom: 3px double var(--ink); padding-bottom: 4px; margin-bottom: 8px; }
.hb-gz-mast > span.caps { display: block; font-size: clamp(1.5rem, 5vw, 2.2rem); letter-spacing: .08em; line-height: 1.05; }
.hb-gz-mast > small.caps { display: block; margin-top: 2px; font-size: .82rem; letter-spacing: .1em; color: var(--ink-soft); }
.hb-gz-clips { list-style: none; margin: 0; padding: 3px; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 8px 14px; }
.hb-clip {
  display: flex; gap: 10px; align-items: flex-start; min-height: 56px; padding: 8px;
  border: 1px solid var(--line); border-left: 5px solid var(--team, var(--sanguine)); background: var(--paper); cursor: pointer;
  transition: box-shadow .2s, transform .2s;
}
.hb-clip.is-now { box-shadow: 0 0 0 3px color-mix(in srgb, var(--ochre) 55%, transparent); background: color-mix(in srgb, var(--ochre) 12%, var(--paper)); }
.hb-clip canvas[data-crest] { flex: none; }
.hb-clip-w { min-width: 0; }
.hb-clip-t { display: block; font: 700 1.1rem/1.2 var(--ui); color: var(--sanguine); }
.hb-clip-x { display: block; font: 400 1.02rem/1.3 var(--body); overflow-wrap: anywhere; }
.hb-gz-small { margin: 8px 0 0; text-align: center; font-size: 1rem; }
@media (max-height: 560px) { .hb-gazette { max-height: calc(100% - 96px); transform: translate(-50%, -60%) rotate(-.6deg); } }
/* M4: the newspaper-clipping look is ART's (render.js dressGazette: a newsprint tile and torn masks, inline). A mask cuts
   any outer glow, so the clipping being read glows from inside, and the gazette's rule over the masthead is ours */
.hb-gz-mast { border-top: 1px solid var(--ink); padding-top: 4px; }
.hb-clip.is-now { box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--ochre) 62%, transparent), 0 0 0 3px color-mix(in srgb, var(--ochre) 55%, transparent); }

/* the "Turn sideways" hint */
.hb-sideways { align-items: flex-start; padding-top: 84px; }
.hb-sideways .hb-sheet { width: min(100%, 360px); padding: 14px; }

/* ---------- the Battle Book ---------- */
.hb-book { max-width: 820px; margin: 0 auto; }
.hb-book ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.hb-book li { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.hb-book .hb-bdate { font: 400 .9rem var(--caps); color: var(--sanguine); letter-spacing: .06em; }
.hb-book .hb-bwho { font: 700 1.1rem var(--ui); }
.hb-book .hb-bline { font-size: 1.05rem; color: var(--ink-soft); }

/* ---------- below the stage ---------- */
.hb-links { margin: 12px 0 0; text-align: center; }
#selftest {
  margin: 12px 0 0; padding: 12px;
  max-height: 60vh; overflow: auto;
  white-space: pre-wrap; word-break: break-word;
  font: 12px/1.4 ui-monospace, Consolas, monospace;
  background: var(--card); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius);
}


/* ==========================================================
   Short and narrow screens. Last in the file, so they win over the
   rules above (a media query adds no specificity).
   ========================================================== */
/* a narrow phone: tighter sheets, a smaller hand-off emblem, so the big buttons stay in view */
@media (max-width: 480px) {
  .hb-layer { padding: 8px; }
  .hb-sheet { padding: 12px; }
  .hb-grown .hb-step { margin: 0; }
  .hb-grown .hb-sum { margin: 2px 0 8px; font-size: 1.9rem; }
  .hb-handoff .hb-emblem { width: 120px; height: 120px; font-size: 66px; }
  .hb-handoff .hb-emblem canvas { width: 92px; height: 92px; }
  .hb-handoff h2 { font-size: 1.6rem; }
  .hb-handoff .hb-row { flex-direction: column-reverse; align-items: stretch; }
}
/* the grown-up sum: the keypad beside the sum on short screens */
.hb-grown-sum .hb-gl { min-width: 0; }
@media (max-height: 560px) and (min-width: 520px) {
  .hb-grown-sum { width: min(100%, 600px); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; align-items: center; padding: 10px 14px; }
  .hb-grown-sum .hb-sum { font-size: 1.7rem; }
  .hb-grown-sum .hb-keypad { grid-template-columns: repeat(4, 72px); }
}
/* a short, narrow window (a phone with the browser's bars showing): the keypad in three rows of four, tighter margins,
   so OK stays inside the stage (integration, M1: T29.grownup at 492 × 548) */
@media (max-height: 560px) and (max-width: 519px) {
  .hb-layer { padding: 8px; }
  .hb-grown .hb-step { margin: 0; }
  .hb-grown-sum .hb-sum { margin: 2px 0 6px; font-size: 1.7rem; }
  .hb-grown-sum .hb-keypad { grid-template-columns: repeat(4, 72px); }
  .hb-grown-sum .hb-row { margin-top: 8px; }
}
/* a short screen held sideways: the hand-off emblem beside the words */
@media (max-height: 560px) and (min-width: 520px) {
  .hb-handoff { width: min(100%, 620px); display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 18px; align-items: center; text-align: left; }
  .hb-handoff .hb-emblem { grid-row: 1 / span 4; margin: 0; }
  .hb-handoff .hb-row { justify-content: flex-start; margin-top: 6px; }
  .hb-handoff h2 { margin: 0; }
}
/* the ending on a short screen: the rosette beside its words, the buttons in two short rows */
@media (max-height: 560px) {
  .hb-rosette { flex-direction: row; gap: 8px; }
  .hb-rosette svg { width: 56px; height: 56px; }
  .hb-rosette .hb-champ { margin: 0; font-size: 1.15rem; }
  .hb-endbtns { padding: 6px; gap: 6px; }
  .hb-endbtns .btn.ghost { flex: 0 1 auto; padding: 6px 12px; font-size: .95rem; }
  .hb-stage .hb-endbtns .btn.hb-again { flex: 1 1 160px; }
}
/* short screens: smaller emblems and rosettes so the big buttons stay in view */
@media (max-height: 560px) {
  .hb-handoff .hb-emblem { width: 96px; height: 96px; font-size: 54px; }
  .hb-handoff .hb-emblem canvas { width: 72px; height: 72px; }
  .hb-handoff h2 { margin: .1em 0 .2em; }
  .hb-handoff .hb-prompt { margin: 0 0 4px; font-size: 1.1rem; }
  .hb-sheet { padding: 12px 16px; }
  .hb-ending { padding-top: 8px; }
  .hb-grown .hb-seal-big { width: 104px; height: 104px; }
  .hb-grown .hb-seal-big .hb-owl { width: 56px; height: 56px; }
  .hb-helper h2 { font-size: 1.5rem; margin: 0 0 .1em; }
  .hb-hlbl { margin: 4px 0; }
  .hb-hrow .btn { min-height: 56px; flex-direction: row; gap: 6px; }
  .hb-hrow .btn .hb-ico { width: 26px; height: 26px; flex: none; }
}


/* a very short window (a phone held sideways with the browser's bars showing): tighter sheets so the hand-off's
   I'm ready! stays inside the 250 px stage (integration, M1: T29.handoff at 616 × 268) */
@media (max-height: 300px) {
  .hb-layer { padding: 6px; }
  .hb-sheet { padding: 8px 14px; }
  .hb-handoff h2 { font-size: 1.45rem; margin: 0; }
  .hb-handoff .hb-prompt { margin: 0; font-size: 1rem; }
  .hb-handoff .hb-today { margin: 0 0 2px; font-size: .9rem; }
  .hb-handoff .hb-row { margin-top: 4px; }
  .hb-handoff .hb-emblem { width: 84px; height: 84px; font-size: 46px; }
  .hb-handoff .hb-emblem canvas { width: 64px; height: 64px; }
}

/* the ending on a narrow phone: the four step-2 buttons two to a row, the plate at most about 40% of the stage */
@media (max-width: 480px) {
  .hb-endbtns { gap: 6px; padding: 6px; }
  .hb-endbtns.is-all { max-height: 44%; overflow-y: auto; overscroll-behavior: contain; }
  .hb-stage .hb-endbtns.is-all .btn.hb-again { flex: 1 1 100%; min-width: 0; }
  .hb-endbtns .btn.ghost { flex: 1 1 calc(50% - 6px); min-width: 0; padding: 6px 8px; font-size: .95rem; line-height: 1.15; }
  .hb-ending { padding-bottom: 6px; }
}

/* the title on a phone held upright: the two main buttons first and in view, the owl below them (M1 review: at a true
   360 × 640 "Same as last time" started at y 532, half under the stage's bottom edge) */
@media (max-width: 560px) {
  .hb-title-inner { justify-content: flex-start; }
  .hb-front { order: 2; }
  .hb-frontis { width: 140px; }
  .hb-title .hb-latin, .hb-title .hb-front .hb-fig { display: none; }
}

/* a phone held sideways: the satchel is a full-height side sheet. The heading hides (the × floats top right, beside
   the grid) and the pocket captions become tabs on each pocket's first card, so two rows of four cards show at once
   in the 284 px stage (it was a 220 px bottom sheet with no whole card in view; M1 review). */
@media (max-height: 520px) {
  .hb-satchel, .hb-satchel.is-side {
    left: auto; right: 0; top: 0; bottom: 0; width: min(560px, 92%); max-height: none;
    border-top: 0; border-left: 2px solid var(--ink);
    padding: 8px max(10px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) 10px;
  }
  .hb-sat-head { position: absolute; top: 8px; right: max(10px, env(safe-area-inset-right)); margin: 0; z-index: 1; }
  .hb-sat-head h2 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .hb-sat-grid, .hb-sat-foot { margin-right: 64px; }
  .hb-sat-grid { padding-top: 9px; row-gap: 14px; }
  .hb-satchel .hb-sat-grid, .hb-satchel.is-side .hb-sat-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
  .hb-satchel[data-pk="1"] .hb-sat-grid { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); }
  .hb-sat-grid .hb-sat-pocket { display: none; }
  .hb-wcard .hb-wpocket {
    display: block; position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
    padding: 0 6px; border: 1.5px solid var(--line); border-radius: 6px; background: var(--card);
    font: 400 .72rem/15px var(--caps); letter-spacing: .06em; color: var(--sanguine); white-space: nowrap;
    pointer-events: none;
  }
  .hb-wcard .hb-wfig { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .hb-fire.is-pulse, .hb-alldone.is-pulse { animation: none; }
  .hb-ctlbar:not([data-gentle="0"]) .hb-satbtn.is-golden, .hb-ctlbar:not([data-gentle="0"]) .hb-fire.is-golden { animation: none; }
  .hb-ending .hb-endbtns .hb-reveal.is-on { animation: none; }
  .hb-gazette, .hb-bows { animation: none; transition: none; }
}
