/* Brolly Bobbins HUD (W5; from the Bonbons HUD, look R2-P3): DOM over the canvas. Everything is OPAQUE so it reads over any stage (bright day, dark cellar, night forge):
   cream tiles with a navy-brown outline and a bottom lip, on oak plates with a brass rim.
   Rules: every button has hover, focus and pressed states; hover eases and never swaps fill and text colour; text >= 12 px; taps >= 44 px. */
@font-face { font-family: 'Baloo 2'; font-weight: 700; font-display: swap; src: url('fonts/baloo2-700.woff2') format('woff2'); }
.nh, .nh * { box-sizing: border-box; }
.nh {
  --ink: #2a1d16; --ink2: #5b4636; --cream: #fff3dc; --paper: #fffaf0; --paper2: #f6e2b6; --lip: #dcc08a; --brass: #e2a93b; --gold: #f6cf6b; --brass-d: #b9801f;
  --oak: #6a4630; --oak2: #4a3022; --deep: #1a100a; --tom: #d85a3c; --teal: #3f9d8f; --sun: #f6cf6b;
  --disp: 'Baloo 2', 'Trebuchet MS', ui-rounded, system-ui, sans-serif; --body: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --top-h: 52px; --bot-h: 96px; --ease: cubic-bezier(.3, .7, .3, 1);
  position: fixed; inset: 0; z-index: 10; pointer-events: none; color: var(--ink);
  font: 600 14px/1.25 var(--body); -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}
@media (max-height: 520px) { .nh { --top-h: 46px; --bot-h: 66px; } }
.nh [hidden] { display: none !important; }
:where(.nh) button { font: inherit; color: inherit; border: 0; background: none; margin: 0; padding: 0; cursor: pointer; touch-action: manipulation; pointer-events: auto; }
.nh svg { display: block; flex: none; }

/* ---- card buttons (win / stuck cards of the stand-alone HUD) ---- */
.nh-btn { position: relative; min-height: 48px; min-width: 44px; padding: 6px 18px 9px; border-radius: 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 700 18px/1 var(--disp); color: var(--ink); background: var(--paper); border: 2.5px solid var(--ink);
  box-shadow: inset 0 -5px 0 var(--lip), 0 3px 0 rgba(26, 16, 10, .45);
  transition: transform .16s var(--ease), box-shadow .16s var(--ease), filter .16s var(--ease); }
@media (hover: hover) { .nh-btn:hover { transform: translateY(-2px); filter: brightness(1.05); } }
.nh-btn:active { transform: translateY(2px); box-shadow: inset 0 -2px 0 var(--lip), 0 1px 0 rgba(26, 16, 10, .45); transition-duration: .06s; }
.nh-btn:focus-visible, .nh-icon:focus-visible, .nh-boost:focus-visible { outline: 3px solid #16a5e0; outline-offset: 2px; }
.nh-btn.primary { background: linear-gradient(#fbdc86, #f0bb48); --lip: #c98f22; }
.nh-btn.sky { background: linear-gradient(#8fdace, #55b3a5); --lip: #2f7e72; }
.nh-btn.big { min-height: 58px; font-size: 22px; border-radius: 18px; padding: 8px 26px 12px; }
.nh-btn small { font: 700 13px/1 var(--body); opacity: .85; }
.nh-btn:disabled { background: #e4d6b8; color: #8a7a62; --lip: #c9b78f; cursor: default; transform: none; }

/* ---- top bar: level plaque, coin pill, two tile buttons ---- */
.nh-top { position: absolute; left: max(10px, env(safe-area-inset-left, 0px)); right: max(10px, env(safe-area-inset-right, 0px)); top: calc(env(safe-area-inset-top, 0px) + 8px); height: var(--top-h);
  display: flex; align-items: flex-start; gap: 8px; }
.nh-pill { height: 44px; padding: 0 16px 3px; border-radius: 14px; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  font: 700 20px/1 var(--disp); border: 2.5px solid var(--ink); }
.nh-level { color: var(--cream); letter-spacing: .01em; text-shadow: 0 2px 0 rgba(26, 16, 10, .6);
  background: repeating-linear-gradient(90deg, rgba(0, 0, 0, .08) 0 1px, transparent 1px 9px), linear-gradient(var(--oak), var(--oak2));
  box-shadow: inset 0 0 0 2px var(--brass), inset 0 -5px 0 rgba(26, 16, 10, .35), 0 3px 0 rgba(26, 16, 10, .5); }
.nh-coins { padding: 0 14px 3px 8px; color: var(--ink); background: var(--paper); box-shadow: inset 0 -4px 0 var(--lip), 0 3px 0 rgba(26, 16, 10, .5); }
.nh-coins b { font-weight: 700; min-width: 2ch; text-align: right; font-variant-numeric: tabular-nums; }
.nh-coins.bump { animation: nhBump .35s cubic-bezier(.2, .9, .3, 1.5); }
.nh-spacer { flex: 1; }
.nh-icon { width: 44px; height: 44px; padding: 0 0 3px; border-radius: 14px; background: var(--paper); border: 2.5px solid var(--ink); display: grid; place-items: center;
  box-shadow: inset 0 -4px 0 var(--lip), 0 3px 0 rgba(26, 16, 10, .5); transition: transform .16s var(--ease), filter .16s var(--ease), box-shadow .16s var(--ease); }
.nh-icon.off { background: #eadcc0; }
@media (hover: hover) { .nh-icon:hover { transform: translateY(-2px); filter: brightness(1.05); } }
.nh-icon:active { transform: translateY(2px); padding-bottom: 1px; box-shadow: inset 0 -2px 0 var(--lip), 0 1px 0 rgba(26, 16, 10, .5); transition-duration: .06s; }

/* ---- bottom booster tray: one oak plate, three cream cards ---- */
.nh-bar { position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--bot-h) + env(safe-area-inset-bottom, 0px)); padding: 0 max(10px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 12px) max(10px, env(safe-area-inset-left, 0px));
  display: flex; align-items: flex-end; justify-content: center; }
.nh-tray { pointer-events: auto; display: flex; gap: 8px; width: min(100%, 372px); padding: 8px 8px 9px; border-radius: 22px; border: 3px solid var(--ink);
  background: repeating-linear-gradient(90deg, rgba(0, 0, 0, .08) 0 1px, transparent 1px 11px), linear-gradient(var(--oak), var(--oak2));
  box-shadow: inset 0 0 0 2px var(--brass), inset 0 -6px 0 rgba(26, 16, 10, .3), 0 5px 0 var(--deep), 0 12px 18px rgba(0, 0, 0, .35); }
.nh-boost { position: relative; flex: 1 1 0; min-width: 0; height: 62px; padding: 0 2px 4px; border-radius: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  background: linear-gradient(var(--paper), #fbecc8); color: var(--ink); border: 2.5px solid var(--ink); box-shadow: inset 0 -5px 0 var(--lip), 0 3px 0 var(--deep);
  font: 700 13px/1 var(--disp); transition: transform .16s var(--ease), filter .16s var(--ease), box-shadow .16s var(--ease); }
@media (hover: hover) { .nh-boost:hover { transform: translateY(-2px); filter: brightness(1.05); } }
.nh-boost:active { transform: translateY(3px); padding-bottom: 1px; box-shadow: inset 0 -2px 0 var(--lip), 0 0 0 var(--deep); transition-duration: .06s; }
.nh-bic svg { width: 30px; height: 30px; }
.nh-bl { max-width: 100%; padding: 0 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nh-boost.locked { background: #d9ccb2; color: #6f6252; --lip: #bfae8d; }
.nh-boost.locked .nh-bic { opacity: .45; filter: grayscale(1); }
.nh-badge { position: absolute; top: -9px; right: -7px; min-width: 26px; height: 26px; padding: 0 6px 1px; border-radius: 13px; display: grid; place-items: center; font: 700 15px/1 var(--disp); font-style: normal;
  background: var(--gold); color: var(--ink); border: 2.5px solid var(--ink); box-shadow: inset 0 -3px 0 #d89e2c; }
.nh-badge.zero { background: var(--teal); color: #fff; box-shadow: inset 0 -3px 0 #2f7e72; font-size: 18px; }
.nh-badge.lock { background: var(--paper); box-shadow: inset 0 -3px 0 var(--lip); padding: 0 3px 1px; }
.nh-badge.pop { animation: nhBump .35s cubic-bezier(.2, .9, .3, 1.5); }
.nh-boost.ready { animation: nhReady 1.3s ease-in-out infinite; }
@media (max-height: 520px) {
  .nh-bar { padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 8px); }
  .nh-tray { width: min(100%, 520px); padding: 6px 6px 7px; border-radius: 18px; }
  .nh-boost { flex-direction: row; gap: 6px; height: 44px; padding: 0 8px 3px; } .nh-bic svg { width: 24px; height: 24px; } .nh-bl { font-size: 14px; }
}

/* ---- toast ---- */
.nh-toast { position: absolute; left: 50%; top: calc(env(safe-area-inset-top, 0px) + var(--top-h) + 128px); transform: translate(-50%, -10px); width: max-content; max-width: min(88vw, 420px); padding: 9px 18px 11px; border-radius: 16px; text-align: center;
  background: var(--paper); color: var(--ink); border: 2.5px solid var(--ink); font: 700 17px/1.2 var(--disp); box-shadow: inset 0 -4px 0 var(--lip), 0 4px 0 rgba(26, 16, 10, .45); opacity: 0; transition: opacity .25s ease, transform .3s cubic-bezier(.2, .9, .3, 1.4); pointer-events: none; }
.nh-toast.show { opacity: 1; transform: translate(-50%, 0); }
.nh-toast:empty { display: none; }
@media (max-height: 520px) { .nh-toast { top: calc(env(safe-area-inset-top, 0px) + var(--top-h) + 14px); } }

@keyframes nhBump { 0% { transform: scale(1); } 40% { transform: scale(1.18); } 100% { transform: scale(1); } }
@keyframes nhReady { 0%, 100% { box-shadow: inset 0 -5px 0 var(--lip), 0 3px 0 var(--deep), 0 0 0 0 rgba(246, 207, 107, 0); } 50% { box-shadow: inset 0 -5px 0 var(--lip), 0 3px 0 var(--deep), 0 0 0 5px rgba(246, 207, 107, .9); } }
@keyframes nhFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes nhPop { from { transform: scale(.7) translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes nhStar { 0% { transform: scale(0) rotate(-40deg); } 70% { transform: scale(1.25) rotate(8deg); } 100% { transform: scale(1) rotate(0); } }
@media (prefers-reduced-motion: reduce) { .nh *, .nh *::before { animation-duration: .01s !important; animation-delay: 0s !important; transition-duration: .01s !important; } .nh-stars svg { transform: scale(1); } }

/* ---- R2-P6 armed booster: lit, pressed-in button + a ring on every target it can take ---- */
.nh-boost.armed { background: linear-gradient(#8fdace, #55b3a5); box-shadow: inset 0 3px 0 #2f7e72, 0 0 0 3px #fff3dc, 0 0 0 6px #2f7e72; transform: translateY(2px); animation: none; }
.nh-boost.armed .nh-bic { animation: nhArm .7s ease-in-out infinite alternate; }
@keyframes nhArm { to { transform: translateY(-3px) rotate(-8deg); } }
.nh-rings { position: absolute; inset: 0; pointer-events: none; }
.nh-ring { position: absolute; width: 60px; height: 60px; margin: -30px 0 0 -30px; box-sizing: border-box; border-radius: 50%; border: 4px solid #f6cf6b; box-shadow: 0 0 0 2.5px #2a1d16, inset 0 0 0 2.5px #2a1d16, 0 0 18px 4px rgba(246, 207, 107, .55);
  animation: nhRing 1s ease-in-out infinite alternate; }
@keyframes nhRing { from { opacity: .55; transform: scale(.96); } to { opacity: 1; transform: scale(1.03); } }
@media (max-height: 520px) { .nh-ring { width: 48px; height: 48px; margin: -24px 0 0 -24px; } }
@media (prefers-reduced-motion: reduce) { .nh-ring, .nh-boost.armed .nh-bic { animation: none; } }


/* ---- W5: moves counter, goals row, booster slots with an info dot, tip bubble ---- */
.nh-row2 { position: absolute; left: 0; right: 0; top: calc(env(safe-area-inset-top, 0px) + 8px + var(--top-h) + 2px); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.nh-moves { display: flex; align-items: baseline; gap: 8px; padding: 2px 18px 6px; border-radius: 18px; border: 2.5px solid var(--ink); color: var(--cream);
  background: linear-gradient(var(--oak), var(--oak2)); box-shadow: inset 0 0 0 2px var(--brass), 0 3px 0 rgba(26, 16, 10, .5); }
.nh-moves b { font: 800 40px/1 var(--disp); min-width: 1.4ch; text-align: center; font-variant-numeric: tabular-nums; text-shadow: 0 3px 0 rgba(0, 0, 0, .4); }
.nh-moves span { font: 700 15px/1 var(--disp); letter-spacing: .06em; text-transform: uppercase; color: var(--sun); }
.nh-moves.low b { color: #ffd36a; } .nh-moves.crit b { color: #ff8a7a; } .nh-moves.crit { animation: nhPulse .6s ease-in-out infinite alternate; }
.nh-moves.pop { animation: nhBump .35s cubic-bezier(.2, .9, .3, 1.5); }
.nh-goals { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; max-width: 100%; padding: 0 10px; }
.nh-goal { position: relative; display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 3px 12px 6px 7px; border-radius: 15px; border: 2.5px solid var(--ink); background: var(--paper);
  box-shadow: inset 0 -4px 0 var(--lip), 0 3px 0 rgba(26, 16, 10, .5); }
.nh-gic svg, .nh-gic img { width: 30px; height: 30px; }
.nh-gn { font: 800 24px/1 var(--disp); min-width: 1.2ch; text-align: center; font-variant-numeric: tabular-nums; }
.nh-gtick { display: none; }
.nh-goal.done { background: #d8f0d4; --lip: #9ac98f; } .nh-goal.done .nh-gn { display: none; } .nh-goal.done .nh-gtick { display: block; }
.nh-goal.pop { animation: nhBump .35s cubic-bezier(.2, .9, .3, 1.5); }
.nh-goal { pointer-events: auto; cursor: pointer; transition: transform .12s ease, box-shadow .12s ease; }
.nh-goal:active { transform: translateY(2px); box-shadow: inset 0 -2px 0 var(--lip), 0 1px 0 rgba(26, 16, 10, .5); }
.nh-goal:focus-visible { outline: 3px solid #f7c64e; outline-offset: 2px; }
.nh-gq { position: absolute; top: -7px; right: -7px; width: 19px; height: 19px; border-radius: 50%; background: var(--ink); color: var(--paper); font: 800 13px/19px var(--disp); font-style: normal; text-align: center; box-shadow: 0 2px 0 rgba(26, 16, 10, .4); pointer-events: none; }
.nh-slot { position: relative; flex: 1 1 0; min-width: 0; display: flex; }
.nh-slot .nh-boost { flex: 1 1 auto; }
.nh-info { position: absolute; left: -6px; top: -8px; width: 44px; height: 44px; padding: 0; display: grid; place-items: start; background: none; z-index: 2; pointer-events: auto; }
.nh-info svg { width: 20px; height: 20px; margin: 4px 0 0 4px; filter: drop-shadow(0 1px 0 rgba(26, 16, 10, .5)); }
.nh-tip { position: absolute; transform: translateX(-50%); width: max-content; max-width: min(84vw, 300px); padding: 9px 14px 11px; border-radius: 14px; text-align: center; z-index: 5;
  background: var(--paper); border: 2.5px solid var(--ink); font: 700 15px/1.25 var(--disp); color: var(--ink); box-shadow: inset 0 -4px 0 var(--lip), 0 4px 0 rgba(26, 16, 10, .45); pointer-events: none; }
.nh-tip::after { content: ''; position: absolute; left: 50%; bottom: -9px; width: 14px; height: 14px; margin-left: -7px; transform: rotate(45deg); background: var(--paper); border: 0 solid var(--ink); border-width: 0 2.5px 2.5px 0; }
.nh-tray { gap: 10px; }
.nh-rings { position: absolute; inset: 0; pointer-events: none; }
@keyframes nhPulse { to { transform: scale(1.06); } }
.nh .ic-img { display: block; flex: none; object-fit: contain; pointer-events: none; }
.nh-boost[hidden], .nh-badge[hidden] { display: none; }
@media (max-width: 400px) { .nh-top { gap: 5px; } .nh-pill { padding: 0 10px 3px; font-size: 18px; } .nh-coins { padding: 0 10px 3px 6px; gap: 5px; } }
@media (max-height: 640px) and (orientation: portrait) { .nh-moves b { font-size: 32px; } .nh-gn { font-size: 20px; } .nh-goal { min-height: 40px; } }
@media (orientation: landscape) and (max-height: 520px) {
  .nh-row2 { left: auto; right: max(10px, env(safe-area-inset-right, 0px)); top: calc(env(safe-area-inset-top, 0px) + 60px); width: 150px; align-items: flex-end; }
  .nh-goals { justify-content: flex-end; }
}
@media (prefers-reduced-motion: reduce) { .nh-moves.crit { animation: none; } }
