/* Find the Fit: the game's own layout (arcade-game.js). The game has its own dark theme, so light and dark mode do not matter.
   The root fills its container; the canvas (256 x 224 logical pixels) scales to the free space, centred, never overflowing. */
.nh{position:absolute;inset:0;display:flex;flex-direction:column;overflow:hidden;background:#0a0f2c;color:#e6edff;
  font:600 14px/1.4 ui-monospace,SFMono-Regular,Menlo,Consolas,"Liberation Mono",monospace;container:nh/inline-size;
  -webkit-tap-highlight-color:transparent;-webkit-user-select:none;user-select:none}
.nh:focus{outline:none}
.nh:focus-visible{outline:3px solid #4ff0e6;outline-offset:-3px}
.nh *{box-sizing:border-box}

/* The stage: a size container so the frame can fit both width and height. */
.nhScreen{flex:1 1 0;min-height:0;min-width:0;display:grid;place-items:center;overflow:hidden;container-type:size}
.nhFrame{position:relative;aspect-ratio:8/7;max-width:100%;height:100%;overflow:hidden;background:#05081c;container-type:size;
  box-shadow:0 0 0 1px #3a4a98}
@supports (width:1cqw){.nhFrame{width:min(100cqw,calc(100cqh * 8 / 7));height:auto}}
.nh .nhCanvas{display:block;width:100%;height:100%;image-rendering:crisp-edges;image-rendering:pixelated;touch-action:none}

.nhSr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0}
.nh .nhNote{margin:auto;padding:16px;max-width:34ch;text-align:center;color:#e6edff}

/* Overlays are real DOM above the canvas. Text sizes follow the frame width. */
.nhOverlay{position:absolute;inset:0;display:flex;overflow:auto;padding:2.5cqw;background:rgba(5,8,28,.58);font-size:clamp(11px,3.4cqw,17px)}
.nhOverlay[hidden]{display:none}
.nh .nhPanel{margin:auto;width:min(88cqw,26em);display:flex;flex-direction:column;align-items:stretch;gap:.6em;padding:1em 1.1em;
  text-align:center;background:rgba(10,15,44,.95);border:2px solid #4a5aa0;border-radius:10px;box-shadow:0 6px 24px rgba(0,0,0,.5)}
.nh .nhPanel h2{margin:0;font-size:1.7em;line-height:1.15;letter-spacing:.06em;color:#ffffff}
.nh .nhPanel h2.nhLogo{font-size:2.5em;letter-spacing:.08em;color:#ffd45a;text-shadow:.06em .06em 0 #e0408f,.12em .12em 0 #10163a}
.nh .nhPanel p{margin:0;color:#e6edff;font-weight:600}
.nh .nhPanel .nhTagline{font-size:1em;line-height:1.35;text-wrap:balance}
.nh .nhPanel .nhRating{font-size:.95em;line-height:1.35;color:#ffd45a;text-wrap:balance}
.nh .nhPanel .nhBest{font-size:.95em;color:#bff8f2}
.nh .nhPanel .nhFine{font-size:.82em;font-weight:500;color:#c9d5fb;line-height:1.35}
.nh .nhPanel .nhBadge{align-self:center;padding:.15em .8em;border-radius:99px;background:#ffd45a;color:#1a1330;font-size:1em;font-weight:800;letter-spacing:.05em}
.nh .nhPanel .nhBadge[hidden]{display:none}
.nhPanel.is-how .nhTagline,.nhPanel.is-how .nhFine{display:none}
.nhHow{margin:0;padding:.5em .7em .5em 1.6em;text-align:left;font-size:.85em;font-weight:500;line-height:1.4;color:#e6edff;background:#141c4a;border-radius:8px}
.nhHow[hidden]{display:none}
.nhHow li{margin:.15em 0}
.nhStats{margin:0;display:grid;grid-template-columns:1fr auto;gap:.2em 1em;text-align:left;padding:.5em .8em;background:#141c4a;border-radius:8px}
.nhStats dt{color:#c9d5fb;font-weight:500}
.nhStats dd{margin:0;font-weight:800;color:#ffffff;text-align:right;font-variant-numeric:tabular-nums}

.nhPair{display:flex;gap:.5em}
.nhPair .nhBtn{flex:1 1 0;min-width:0;padding-inline:.5em}

/* Buttons: strong contrast, visible focus ring on every one. */
.nh .nhBtn{font:inherit;font-weight:800;min-height:2.6em;padding:.45em 1em;border-radius:8px;border:2px solid #5b6fb8;cursor:pointer;color:#ffffff;
  background:#1e2d78;letter-spacing:.03em}
.nh .nhBtn:hover{background:#2b3f9a}
.nh .nhBtnPrimary{background:#ffd45a;border-color:#ffd45a;color:#1a1330}
.nh .nhBtnPrimary:hover{background:#ffe27d;border-color:#ffe27d}
.nh .nhBtn:focus-visible,.nh .nhTouch:focus-visible{outline:3px solid #4ff0e6;outline-offset:2px;box-shadow:0 0 0 5px #0a0f2c}
.nh .nhBtn:disabled{opacity:.55;cursor:default}
.nh .nhBtnSmall{min-height:28px;min-width:64px;padding:.1em .8em;font-size:13px}

/* Bar under the stage (hidden on touch devices, where the controls take its place). */
.nhBar{flex:none;display:flex;align-items:center;gap:10px;padding:4px 10px;background:#0c1233;border-top:1px solid #2b3878}
.nhHint{flex:1;min-width:0;font-size:12px;font-weight:500;color:#c9d5fb;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
@container nh (max-width:520px){.nhHint{display:none}.nhBar{justify-content:space-between}}

/* Touch controls: real buttons, at least 44 x 44, shown for coarse pointers or after the first touch. */
.nhControls{display:none}
.nh[data-touch="true"] .nhBar{display:none}
.nh[data-touch="true"] .nhControls{flex:none;display:flex;align-items:center;justify-content:space-between;gap:8px;padding:6px 10px 10px;
  background:#0c1233;border-top:1px solid #2b3878}
.nhTouchGroup{display:flex;gap:10px}
.nh .nhTouch{font:inherit;font-weight:800;min-width:56px;min-height:56px;padding:0 12px;border-radius:14px;border:2px solid #5b6fb8;background:#1e2d78;color:#ffffff;
  touch-action:none;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;cursor:pointer}
.nh .nhTouchDir{min-width:60px;font-size:22px}
.nh .nhTouchAct{min-width:68px;font-size:15px;letter-spacing:.03em}
.nh .nhTouchJump{background:#ffd45a;border-color:#ffd45a;color:#1a1330}
.nh .nhTouchPause{min-width:48px;min-height:48px;font-size:18px;border-radius:50%}
.nh .nhTouch.is-down{background:#4ff0e6;border-color:#4ff0e6;color:#0a0f2c}
.nhTouchGlyph{pointer-events:none}

/* Level intro card: a small pill near the top of the stage; decorative (the live region announces the level). */
.nhIntro{position:absolute;left:50%;top:22%;transform:translateX(-50%);max-width:92%;padding:.35em 1em;border-radius:99px;pointer-events:none;
  background:rgba(7,11,34,.82);border:2px solid #4ff0e6;color:#ffffff;font-size:clamp(12px,4.2cqw,20px);font-weight:800;letter-spacing:.06em;
  text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-shadow:.08em .08em 0 #10163a}
.nhIntro[hidden]{display:none}
@media (prefers-reduced-motion:no-preference){
  .nhIntro{animation:nhIntro 1.5s ease-in-out both}
  @keyframes nhIntro{0%{opacity:0;transform:translateX(-50%) translateY(-6px)}20%{opacity:1;transform:translateX(-50%)}75%{opacity:1}100%{opacity:0}}
}

@media (max-width:420px){
  .nh[data-touch="true"] .nhControls{padding:6px 6px 8px}
  .nh .nhTouchDir{min-width:52px}
  .nh .nhTouchAct{min-width:56px;padding:0 8px}
  .nhTouchGroup{gap:6px}
}
/* "Experiment" is a long word for a thumb button: on a narrow stage the row tightens so all five stay on screen. */
@container nh (max-width:380px){
  .nh[data-touch="true"] .nhControls{gap:6px;padding:6px 4px 8px}
  .nh .nhTouchDir{min-width:46px;padding:0 6px}
  .nh .nhTouchAct{min-width:48px;padding:0 4px;font-size:12px;letter-spacing:0}
  .nh .nhTouchPause{min-width:44px;min-height:44px;padding:0}
  .nhTouchGroup{gap:4px}
}
/* 320-wide phones leave a stage of about 270px: tighter still, so Jump stays whole (bug hunt 13). Nothing under 44px. */
@container nh (max-width:300px){
  .nh[data-touch="true"] .nhControls{gap:2px;padding-inline:1px}
  .nh .nhTouchDir{min-width:44px;padding:0}
  .nh .nhTouchAct{min-width:44px;padding:0 1px}
  .nhTouchGroup{gap:2px}
}
/* A short landscape screen: the touch controls lie over the stage instead of taking height under it, and Pause moves to
   the top corner, beside the game, so the thumb buttons keep the bottom corners (responsive audit R02, bug hunt 1). */
@media (max-height:500px) and (orientation:landscape){
  .nh[data-touch="true"] .nhControls{position:absolute;inset:0;z-index:3;align-items:flex-end;background:transparent;border:0;pointer-events:none}
  .nh[data-touch="true"] .nhControls button{pointer-events:auto}
  .nh[data-touch="true"] .nhTouchPause{position:absolute;top:8px;right:8px}
}
@media (prefers-reduced-motion:no-preference){
  .nhOverlay{animation:nhFade .18s ease-out}
  @keyframes nhFade{from{opacity:0}to{opacity:1}}
}
@media (prefers-reduced-motion:reduce){.nh,.nh *{animation:none!important;transition:none!important}}

/* Optional: when the game sits in the Arcade window's .arcadeHost, let it fill the stage instead of keeping the 8:7 box. */
.arcadeStage .arcadeHost{aspect-ratio:auto;width:100%;height:100%;max-height:none}
