body {
    margin: 0;
    overflow: hidden;
    background-color: #87CEEB;
    font-family: sans-serif;
    user-select: none;
}

#damage-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    box-shadow: inset 0 0 0px 0px rgba(204, 0, 255, 0);
    transition: box-shadow 0.1s ease-out;
    z-index: 5;
}

#reticle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 10;
    display: none;
}

#reticle .circle {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    position: absolute;
    top: -20px;
    left: -20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#reticle .dot {
    width: 6px;
    height: 6px;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
}

#instructions {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 135;
    cursor: pointer;
}
/* Startup and match-loading masks must remain visible during their fade-outs.
   The higher-priority click-to-start overlay must not cover the progress UI. */
#loading-overlay:not([hidden]) ~ #instructions,
#lobby-loading-overlay:not([hidden]) ~ #instructions {display:none!important;}
/* Full-screen, genuine decoded-asset progress gate. */
#loading-overlay {position:fixed;inset:0;z-index:100;display:flex;justify-content:center;
    align-items:center;background:radial-gradient(circle at 30% 20%,#313459 0,#0b0e20 65%);
    color:#fff;opacity:1;transition:opacity .38s ease;}
#loading-overlay[hidden] {display:none;}
#loading-overlay.ready {opacity:0;pointer-events:none;}
.loading-panel {width:min(470px,84vw);padding:32px 28px;text-align:center;}
.loading-eyebrow {font-size:13px;font-weight:800;letter-spacing:.23em;color:#c2bbff;}
#loading-title {font-size:clamp(26px,5vw,40px);margin:10px 0 22px;}
#loading-status {min-height:3em;line-height:1.6;font-size:15px;color:#e1e4fa;overflow-wrap:anywhere;}
#loading-bar {height:18px;overflow:hidden;background:#353950;border-radius:18px;
    box-shadow:inset 0 1px 3px #101222;border:1px solid #535b78;}
#loading-fill {height:100%;width:0%;background:linear-gradient(90deg,#fae43c,#f8b326);
    transition:width .1s linear;border-radius:18px;}
#loading-percent {margin-top:12px;font-size:28px;font-weight:800;font-variant-numeric:tabular-nums;}
.loading-caption {font-size:12px;color:#aeb5d6;margin-top:18px;}
#loading-overlay.failed #loading-status {color:#ffb7b7;}
#loading-actions[hidden] {display:none;}
#loading-retry {padding:12px 24px;border:0;border-radius:7px;background:#f4cc36;
    color:#101320;font-weight:bold;font-size:16px;cursor:pointer;}
/* Ammo meter shows the same paint state used for squid/swim movement. */
#ink-meter {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: min(230px, 38vw);
    padding: 10px 12px;
    background: rgba(15, 15, 15, 0.75);
    border: 1px solid rgba(255,255,255,0.42);
    color: #fff;
    font-size: 13px;
    font-weight: bold;
    border-radius: 8px;
    z-index: 13;
    pointer-events: none;
}
#ink-meter[hidden] { display: none; }
#ink-meter-rail {
    height: 10px;
    margin-top: 7px;
    background: #3c414b;
    border-radius: 5px;
    overflow: hidden;
}
#ink-meter-fill {
    width: 100%; height: 100%;
    background: #e8e810;
    transition: width 0.07s linear;
}

/* Low-key FPS overlay, upper-left, does not capture any input. */
#fps-counter { position:fixed;top:8px;left:8px;z-index:31;
    padding:3px 7px;border:1px solid rgba(0,0,0,0.38);border-radius:3px;
    background:rgba(0,0,0,0.48);color:#57e66c;font:11px/1.4 ui-monospace,monospace;
    font-variant-numeric:tabular-nums;pointer-events:none;opacity:0.84; }

#fps-performance { margin-top: 2px; font-size: 10px; line-height: 1.45; color: #f5f5f5; }
#fps-performance[hidden] { display: none !important; }
#fps-performance small { display: block; font-size: 9px; color: #c9c9c9; opacity: .85; }
#fps-cpu, #fps-gpu { white-space: nowrap; }

/* This selector is inert unless DebugConsole.js actually creates the node.
   The script isn't even requested without the EXACT URL query debug=1. */
#debug-console {
    position: fixed; bottom: 8px; left: 8px; z-index: 180;
    width: min(520px, calc(100vw - 16px)); height: min(285px, 43vh);
    min-width: 220px; min-height: 105px;
    box-sizing: border-box;
    background: rgba(0,0,0,.78); color: #57e66c;
    border: 1px solid rgba(87,230,108,.68); border-radius: 5px;
    box-shadow: 0 2px 13px rgba(0,0,0,.25);
    font: 12px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace;
    display: flex; flex-direction: column; overflow: hidden;
    opacity: .94;
}
.debug-console-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 5px 8px; gap: 10px;
    border-bottom: 1px solid rgba(87,230,108,.35);
    background: rgba(0,0,0,.25);
    flex: 0 0 auto;
    cursor: move; user-select: none; touch-action: none;
}
#debug-console.is-moving, #debug-console.is-resizing { user-select: none; }
#debug-console.is-maximized { border-radius: 0; }
#debug-console.is-collapsed #debug-console-lines { display: none; }
#debug-console.is-collapsed { min-height: 0; }
.debug-console-title { font-weight: 700; white-space: nowrap; }
.debug-console-title small { opacity: .6; font-size: 10px; }
.debug-console-actions { display: flex; gap: 5px; }
.debug-console-actions button {
    color: #57e66c; background: rgba(30,45,30,.56);
    border: 1px solid rgba(87,230,108,.45); border-radius: 3px;
    cursor: pointer; font: inherit; font-size: 10px; padding: 2px 7px;
}
#debug-console-lines {
    flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden;
    padding: 6px 8px; user-select: text;
    overflow-wrap: anywhere; white-space: pre-wrap;
    scrollbar-color: #478852 rgba(0,0,0,.2);
}
.debug-console-line { margin-bottom: 3px; }
.debug-console-line.level-warn { color: #f0d67b; }
.debug-console-line.level-error { color: #ff9393; }
.debug-console-line.level-debug { opacity: .74; }
/* Eight draggable borders/corners, like an ordinary desktop window.
   Hit targets exist only when debug=1 builds #debug-console. */
.debug-resize-handle { position: absolute; z-index: 2; touch-action: none; }
.debug-resize-handle[data-edge="n"]  { top: 0; left: 13px; right: 13px; height: 6px; cursor: n-resize; }
.debug-resize-handle[data-edge="s"]  { bottom: 0; left: 13px; right: 13px; height: 7px; cursor: s-resize; }
.debug-resize-handle[data-edge="e"]  { right: 0; top: 13px; bottom: 13px; width: 7px; cursor: e-resize; }
.debug-resize-handle[data-edge="w"]  { left: 0; top: 13px; bottom: 13px; width: 7px; cursor: w-resize; }
.debug-resize-handle[data-edge="nw"] { top: 0; left: 0; width: 13px; height: 13px; cursor: nwse-resize; }
.debug-resize-handle[data-edge="ne"] { top: 0; right: 0; width: 13px; height: 13px; cursor: nesw-resize; }
.debug-resize-handle[data-edge="sw"] { bottom: 0; left: 0; width: 13px; height: 13px; cursor: nesw-resize; }
.debug-resize-handle[data-edge="se"] { bottom: 0; right: 0; width: 13px; height: 13px; cursor: nwse-resize; }
#debug-console.is-maximized .debug-resize-handle,
#debug-console.is-collapsed .debug-resize-handle { display: none; }
@media (max-width: 500px) {
    #debug-console { font-size: 11px; }
}

/* v45: actual offline 4v4 match scoreboard (no debug flag needed). */
#battle-hud{position:fixed;top:12px;left:50%;transform:translateX(-50%);z-index:32;
 width:min(480px,calc(100vw - 28px));box-sizing:border-box;padding:9px 15px 11px;
 color:#fff;background:rgba(13,18,35,.84);border:1px solid rgba(255,255,255,.46);
 border-radius:10px;box-shadow:0 3px 18px rgba(0,0,0,.4);font:700 14px/1.5 sans-serif;
 pointer-events:none;text-align:center;}
#battle-hud[hidden],#battle-result[hidden]{display:none!important;}
.battle-headline,.battle-score{display:flex;justify-content:space-between;align-items:center;gap:14px;}
.battle-headline{font-size:12px;letter-spacing:.09em;color:#eef1fb;}
#battle-time{font:800 25px/1.1 ui-monospace,monospace;color:#fff;}
.battle-score{font-size:16px;margin:7px 0 3px;}
.battle-team-yellow{color:#f9e34f}.battle-team-purple{color:#e19bff}
#battle-roster{font-size:11px;color:#ced5e5;font-weight:500;overflow-wrap:anywhere;}
#battle-result{margin-top:9px;padding:12px 10px;border-radius:7px;background:rgba(0,0,0,.72);
 color:#fff4ac;font-size:17px;font-weight:800;line-height:1.6;white-space:normal;}

/* v49: training-room-only enemy shortcut. Do not put it inside the pause
   overlay: that overlay disappears as soon as gameplay starts. */
#shooting-enemy-ui {
    position:fixed;top:24px;right:22px;z-index:34;
    padding:12px 18px;min-width:116px;box-sizing:border-box;
    border:2px solid rgba(255,145,207,.83);border-radius:10px;
    background:rgba(85,18,69,.78);color:#fff;
    box-shadow:0 2px 13px rgba(0,0,0,.2);
    font:700 19px/1.4 sans-serif;text-align:center;
    pointer-events:none;user-select:none;
}
#shooting-enemy-ui[hidden],#shooting-q-help[hidden]{display:none!important;}
@media (max-width:520px){#shooting-enemy-ui{right:10px;top:16px;padding:8px 12px;font-size:15px;min-width:96px;}}

/* Independent lobby gate; intentionally reused on each return after a match. */
#lobby-loading-overlay{position:fixed;inset:0;z-index:105;display:flex;
 align-items:center;justify-content:center;pointer-events:auto;
 background:radial-gradient(circle at 30% 25%,#38435d 0,#0a1021 72%);
 color:#fff;opacity:1;transition:opacity .25s ease;}
#lobby-loading-overlay[hidden],#lobby-loading-retry[hidden]{display:none!important;}
#lobby-loading-overlay.ready{opacity:0;pointer-events:none;}
#lobby-loading-overlay.failed #lobby-loading-status{color:#ffbaba;}
#lobby-loading-title{font-size:clamp(25px,5vw,38px);margin:8px 0 20px;}
#lobby-loading-status{min-height:3em;line-height:1.6;font-size:15px;color:#e1e4fa;}
#lobby-loading-bar{height:18px;overflow:hidden;background:#353950;border-radius:18px;
 border:1px solid #535b78;}
#lobby-loading-fill{height:100%;width:0%;background:linear-gradient(90deg,#fae43c,#f8b326);
 border-radius:18px;transition:width .1s linear;}
#lobby-loading-percent{margin-top:12px;font-size:28px;font-weight:800;font-variant-numeric:tabular-nums;}
#lobby-loading-retry{padding:12px 26px;border:0;border-radius:7px;
 background:#f4cc36;color:#101320;font-weight:bold;font-size:16px;cursor:pointer;}

/* v62: while asynchronously loading, the actual OS cursor stays visible.
   Pointer-lock hides it again after a permitted gesture/automatic re-lock. */
body.battle-loading,body.battle-loading *{cursor:auto!important;}
#battle-resume[hidden]{display:none!important;}
#battle-resume{position:fixed;left:50%;bottom:8%;transform:translateX(-50%);
 z-index:131;display:flex;flex-direction:column;align-items:center;gap:7px;
 min-width:250px;max-width:calc(100vw - 32px);padding:16px 28px;
 background:rgba(9,16,29,.88);border:1px solid rgba(250,228,57,.75);
 border-radius:12px;box-shadow:0 6px 28px rgba(0,0,0,.45);
 color:#fff;font-size:15px;cursor:pointer;text-align:center;pointer-events:auto;}
#battle-resume strong{font-size:19px;color:#ffe44d;}
#lobby-loading-overlay,#lobby-loading-overlay *{cursor:auto;}

/* v64: hide the redundant small "読み込み中..." line. Errors re-open it. */
#loading-status[hidden],#lobby-loading-status[hidden]{display:none!important;}

/* v122: opaque splat message, centered at 78% viewport height (below midpoint of centre and bottom). */
#player-death-overlay[hidden]{display:none!important;}
#player-death-overlay{position:fixed;left:50%;top:78%;transform:translate(-50%,-50%);
 z-index:67;background:#111929;opacity:1;color:#fff;
 border:2px solid #f7e447;border-radius:12px;padding:18px 30px;
 min-width:280px;max-width:calc(100vw - 24px);box-sizing:border-box;
 box-shadow:0 5px 24px #0008;text-align:center;pointer-events:none;user-select:none;}
#player-death-killer{font:800 clamp(19px,3vw,26px)/1.5 sans-serif;color:#fff6c0;}
#player-death-countdown{font:600 15px/1.4 sans-serif;color:#e1e8ff;margin-top:7px;}

/* v100: Only CPU-vs-CPU spectating shows the right-bottom camera carousel. */
#spectator-selector[hidden]{display:none!important;}
#spectator-selector{position:fixed;right:22px;bottom:22px;z-index:46;
 display:flex;align-items:center;gap:9px;min-width:170px;justify-content:space-between;
 background:rgba(13,19,33,.85);border:1px solid rgba(255,255,255,.58);
 color:#fff;padding:7px 10px;border-radius:12px;
 font:700 16px/1.4 sans-serif;box-shadow:0 4px 16px #0006;pointer-events:auto;}
#spectator-selector button{cursor:pointer;pointer-events:auto;color:#fff;
 font:bold 24px/1 sans-serif;background:rgba(255,255,255,.15);border:0;
 border-radius:8px;width:40px;height:37px;}
#spectator-selector button:hover,#spectator-selector button:focus-visible{background:rgba(255,255,255,.35);}
#spectator-name{white-space:nowrap;text-align:center;min-width:74px;}
body.spectator-active,body.spectator-active *{cursor:default!important;}
body.spectator-active #spectator-selector button{cursor:pointer!important;}
@media(max-width:520px){#spectator-selector{right:12px;bottom:12px;padding:5px 8px;gap:5px;}}

/* v104: automatic lobby return behaves like active gameplay even when
   Pointer Lock is rejected by a proxy/browser's user-gesture security rule.
   Debug UI/other interactive widgets retain their own normal cursor. */
body.lobby-autoresume,body.lobby-autoresume>canvas{cursor:none!important;}
body.lobby-autoresume #debug-console,body.lobby-autoresume #debug-console *{cursor:auto;}

/* v111: native-inspired oversized translucent last-ten-second battle clock.
   Independent of HUD hit testing; animations freeze with Esc. */
#battle-final-countdown[hidden]{display:none!important;}
#battle-final-countdown{position:fixed;inset:0;z-index:30;pointer-events:none;
 display:grid;place-items:center;user-select:none;overflow:hidden;}
#battle-final-countdown-number{display:block;font:1000 clamp(100px,29vmin,310px)/1 sans-serif;
 font-variant-numeric:tabular-nums;color:rgba(255,255,255,.40);
 -webkit-text-stroke:clamp(2px,.65vmin,6px) rgba(11,15,34,.5);
 text-shadow:0 7px 3px rgba(0,0,0,.10);transform:scale(1);}
#battle-final-countdown-number.final-ten-pop{animation:final-ten-pop .9s ease-out both;}
@keyframes final-ten-pop{
  0%{transform:scale(1.24);opacity:.15;}
  25%{transform:scale(1.10);opacity:.95;}
  70%{transform:scale(1.01);opacity:.9;}
  100%{transform:scale(1);opacity:.80;}
}
body.game-paused #battle-final-countdown-number{animation-play-state:paused!important;}
@media(prefers-reduced-motion:reduce){#battle-final-countdown-number.final-ten-pop{animation:none;}}

/* v112: the 60-second cue uses battle.elapsed, not a setTimeout. */
#battle-one-minute[hidden]{display:none!important;}
#battle-one-minute{position:fixed;inset:0;z-index:31;pointer-events:none;
 display:flex;align-items:center;justify-content:center;user-select:none;}
#battle-one-minute span{display:block;padding:.08em .34em .17em;
 background:rgba(15,21,38,.72);border:4px solid rgba(246,245,225,.84);
 border-radius:12px;box-shadow:0 6px 18px rgba(0,0,0,.35);
 color:rgba(255,255,255,.94);font:900 clamp(42px,8.7vmin,110px)/1.12 sans-serif;
 transform:rotate(-3deg);text-shadow:0 5px 1px rgba(0,0,0,.30);}
#battle-one-minute.one-minute-pop span{animation:one-minute-pop 2.25s ease-out both;}
@keyframes one-minute-pop{
  0%{transform:rotate(-3deg) scale(1.38);opacity:0}
  10%{transform:rotate(-3deg) scale(1.08);opacity:1}
  22%{transform:rotate(-3deg) scale(1);opacity:1}
  78%{transform:rotate(-3deg) scale(1);opacity:1}
  100%{transform:rotate(-3deg) scale(.93);opacity:0}
}
body.game-paused #battle-one-minute.one-minute-pop span{animation-play-state:paused!important;}
@media(prefers-reduced-motion:reduce){#battle-one-minute.one-minute-pop span{animation:none;}}

/* v112: final 3 figures are emphasized separately as in the RPX's
   Count03/Count02/Count01 animation grouping. */
#battle-final-countdown-number.final-three.final-ten-pop{animation:final-three-pop .92s ease-out both;}
@keyframes final-three-pop{
  0%{transform:rotate(-5deg) scale(1.5);opacity:.05}
  18%{transform:rotate(-3deg) scale(1.18);opacity:1}
  68%{transform:rotate(0deg) scale(1.03);opacity:.95}
  100%{transform:rotate(0deg) scale(1);opacity:.80}
}


/* v113: JP BFLYT/MSBT-informed treatment. Native GambitL.bffnt is a
 * Nintendo bitmap font; web browsers cannot consume FFNT as @font-face.
 * Keep Japanese text in an installed bold gothic fallback, not a mismatched
 * Roman decorative typeface. Unlike v112 there is no opaque rectangle. */
#battle-one-minute span{
  padding:.015em .14em .10em;border:0;border-radius:0;background:none;
  box-shadow:none;white-space:nowrap;
  font-family:"Arial Black","Noto Sans CJK JP","Noto Sans JP",sans-serif;
  font-weight:1000;letter-spacing:-.065em;
  color:rgba(248,250,250,.98);
  -webkit-text-stroke:clamp(1px,.43vmin,4px) rgba(23,25,31,.9);
  paint-order:stroke fill;
  filter:drop-shadow(0 8px 1px rgba(12,15,20,.45));
}
/* The original CountFinishNum_01..10 is an alpha-texture double-outline.
 * Emulate that white/gray nested outline rather than a filled solid digit. */
#battle-final-countdown-number{
  font-family:Impact,"Arial Black",sans-serif;
  font-size:clamp(128px,36vmin,420px);font-weight:900;
  color:rgba(255,255,255,.14);letter-spacing:-.075em;
  -webkit-text-stroke:clamp(3px,.75vmin,9px) rgba(246,247,247,.60);
  text-shadow:2px 2px 0 rgba(0,0,0,.38),-2px -2px 0 rgba(0,0,0,.16);
}
#battle-native-finish[hidden]{display:none!important;}
#battle-native-finish{position:fixed;inset:0;z-index:29;pointer-events:none;
  display:flex;align-items:center;justify-content:center;gap:1.0vmin;
  overflow:hidden;user-select:none;transform:rotate(-3deg);}
#battle-native-finish .native-finish-text{white-space:nowrap;
  font:1000 clamp(85px,19vmin,250px)/1 Impact,"Arial Black",sans-serif;
  letter-spacing:-.04em;color:rgba(246,249,247,.95);
  -webkit-text-stroke:clamp(3px,1vmin,11px) rgba(19,21,27,.95);
  paint-order:stroke fill;text-shadow:0 10px 2px rgba(0,0,0,.55);
  filter:drop-shadow(0px 0px 8px rgba(250,250,250,.2));}
#battle-native-finish .finish-stripes{height:clamp(35px,9vmin,120px);
  flex:1 1 18%;max-width:27%;opacity:.68;
  background:repeating-linear-gradient(180deg,rgba(240,243,244,.92) 0 1px,
   transparent 1px 5px);clip-path:polygon(0% 0%,100% 14%,100% 100%,0% 92%);
  box-shadow:0 0 0 2px #fff;}
#battle-native-finish.native-finish-in .native-finish-text{animation:native-finish-in 2.2s ease-out both;}
#battle-native-finish.native-finish-in .finish-stripes{animation:native-finish-lines 2.2s ease-out both;}
@keyframes native-finish-in{
  0%{opacity:0;transform:scale(1.65) skewX(-8deg)}
  13%{opacity:1;transform:scale(1.04) skewX(-3deg)}
  20%{opacity:1;transform:scale(1) skewX(0deg)}
  75%{opacity:1;transform:scale(1)}
  100%{opacity:0;transform:scale(1.03)}
}
@keyframes native-finish-lines{
  0%{opacity:0;transform:translateX(-60%) scaleX(.6)}
  16%{opacity:.75;transform:translateX(0) scaleX(1)}
  75%{opacity:.75;transform:translateX(0)}
  100%{opacity:0;transform:translateX(10%)}
}
body.game-paused #battle-native-finish *{animation-play-state:paused!important;}
@media(prefers-reduced-motion:reduce){#battle-native-finish *{animation:none!important;}}


/* v114: genuine Splatoon (JP) GambitL glyphs, rasterized from the
   source BC4 texture. The original glyph pixel edges and outline are
   retained. No Nintendo font binaries are loaded or distributed. */
#battle-one-minute span.native-minute-word{
  box-sizing:border-box;display:block;
  width:min(83vw, min(75vmin, 740px));max-width:100%;height:auto;
  padding:0;margin:0;border:0;border-radius:0;background:transparent;
  box-shadow:none;white-space:normal;color:transparent;
  font-size:0;line-height:0;letter-spacing:normal;
  -webkit-text-stroke:0 transparent;
  filter:drop-shadow(0 5px 2px rgba(0,0,0,.35));
  transform-origin:center center;
}
#battle-one-minute .native-minute-word>img{
  display:block;width:100%;height:auto;object-fit:contain;
  image-rendering:auto;max-width:100%;user-select:none;
}
#battle-native-finish .native-finish-text{
  display:block;box-sizing:border-box;flex:0 1 auto;
  width:min(72vw,760px);min-width:0;height:auto;
  padding:0;margin:0;background:transparent;border:0;box-shadow:none;
  font-size:0;line-height:0;letter-spacing:normal;-webkit-text-stroke:0 transparent;
  color:transparent;text-shadow:none;
  filter:drop-shadow(0 8px 3px rgba(0,0,0,.44));
  transform-origin:center center;
}
#battle-native-finish .native-finish-text>img{
  display:block;width:100%;height:auto;max-width:100%;object-fit:contain;
  image-rendering:auto;user-select:none;
}
/* CSS animations continue targeting the parent spans; the image pixels do
   not alter the Finish/HUD z-order or the Esc paused animation state. */


/* v115: motion sampled directly from the v16 BFLAN tracks, not CSS
   animations. 1280x720 virtual ui2d coordinates -> responsive viewport. */
#battle-one-minute,#battle-native-finish,#battle-final-countdown{pointer-events:none;}
#battle-one-minute #native-one-minute-stage{
  position:relative;display:block;
  width:min(86vw,52.777778vh);height:auto;aspect-ratio:472/161; /* 0.8x native glyph size at 720p */
  transform:translate3d(0,-13.194444vh,0); /* BFLYT N_All_00 Y=+95 */
  opacity:0;will-change:opacity;contain:layout style;
}
#battle-one-minute .native-minute-word,
#battle-one-minute .native-minute-echo{
  position:absolute;inset:0;display:block;width:100%;height:100%;
  margin:0;padding:0;border:0;background:transparent;filter:none;
  transform-origin:50% 50%;animation:none!important;
}
#battle-one-minute .native-minute-word img,
#battle-one-minute .native-minute-echo img{display:block;width:100%;height:100%;object-fit:contain;}
#battle-one-minute .native-minute-echo{opacity:0;filter:blur(1px) brightness(1.5);}
#battle-final-countdown-number{animation:none!important;transform-origin:50% 50%;
  /* BFLYT P_Number_00 is 500x400 at the exact screen centre. */
  display:block;width:min(69.444vh,80vw);height:auto;text-align:center;line-height:1;
  font-size:clamp(128px,52vh,520px);will-change:transform,opacity;
}
#battle-native-finish{transform:translate3d(0,-6.944444vh,0) rotate(-5deg); /* N_Text_00 Y=+50 and +5deg in Y-up native axes */
 display:grid;place-items:center;isolation:isolate;}
#battle-native-finish .native-finish-text{width:min(72vw,64.027778vh);height:auto; /* ~461px native glyph crop at 720p */
 z-index:2;transform-origin:50% 50%;animation:none!important;will-change:transform,opacity;}
#battle-native-finish .native-finish-streaks{position:absolute;inset:0;
 display:grid;place-items:center;pointer-events:none;z-index:1;}
#battle-native-finish .native-finish-streak{position:absolute;display:block;
 width:200vw;height:clamp(10px,4.5vh,48px);
 background:repeating-linear-gradient(0deg,rgba(249,249,249,.62) 0 1px,
   rgba(214,221,224,.26) 1px 5px,transparent 5px 9px);
 box-shadow:0 4px 8px rgba(0,0,0,.25);opacity:0;animation:none!important;
 transform-origin:center;will-change:transform,opacity;}
#battle-native-finish .native-finish-streak:nth-child(2){height:clamp(8px,3vh,35px);}
#battle-native-finish .native-finish-streak:nth-child(3){height:clamp(8px,3.7vh,40px);}
#battle-native-finish .native-finish-streak:nth-child(4){height:clamp(6px,2.5vh,25px);}


/* v116: Nintendo Wii U native CountFinishNum_01..10 texture pixels.
 * No system font substitution in the final ten seconds. Source BC5 channel-1
 * is the anti-aliased outline; its alpha is preserved in these RGBA sprites. */
#battle-final-countdown-number{
  position:relative;box-sizing:border-box;
  background-size:100% 100%;background-position:center;background-repeat:no-repeat;
  font-size:0!important;line-height:0!important;letter-spacing:0!important;
  color:transparent!important;-webkit-text-stroke:0 transparent!important;
  text-shadow:none!important;filter:drop-shadow(0 4px 1px rgba(0,0,0,.25));
  width:min(69.444444vh,80vw);max-width:100vw;
  aspect-ratio:480 / 380;height:auto;
  overflow:visible;will-change:transform,opacity;
}
/* The actual 640x128 FinishLineMove_00^t texture contains staggered horizontal
 * hairline streaks. Keep the independently animated BFLAN lane transforms. */
#battle-native-finish .native-finish-streak{
  height:clamp(12px,14vh,120px)!important;
  background-image:url('../assets/images/ui/finish_line_move_native.png?v=120');
  background-repeat:no-repeat;background-position:center;background-size:100% 100%;
  background-color:transparent;box-shadow:none;
}

/* Scramjet/HTTP 503 image failure fallback. The game never loses its timer. */
#battle-final-countdown-number.native-countdown-fallback{
 background-image:none!important;font-size:clamp(128px,36vmin,420px)!important;
 line-height:.9!important;color:rgba(255,255,255,.26)!important;
 -webkit-text-stroke:clamp(3px,.75vmin,9px) rgba(250,250,250,.67)!important;
 display:flex;align-items:center;justify-content:center;
}


/* v118: single-layer solid lime-green FINISH ribbon and original U+E1A0
   stopwatch glyph within the 1-minute announcement. The upper HUD
   is time-only, as in the original game. */
#battle-one-minute #native-one-minute-stage{
  width:min(91vw,64.5vh);aspect-ratio:580 / 161;
}
#battle-native-finish{z-index:29;}
#battle-native-finish .native-finish-streak{
  height:clamp(40px,17.77778vh,145px)!important;
  background-image:url('../assets/images/ui/finish_tape_green_v119.png?v=120')!important;
  background-size:auto 100%!important;
  background-repeat:repeat-x!important;
  background-position:center!important;
  background-color:transparent!important;
  background-blend-mode:normal!important;
  box-shadow:0 3px 8px rgba(0,0,0,.33);
  /* inherited original BFLAN translation/rotation are not replaced */
}
#battle-native-finish .native-finish-streak:nth-child(2){height:clamp(36px,16.0vh,138px)!important;}
#battle-native-finish .native-finish-streak:nth-child(3){height:clamp(42px,18.0vh,150px)!important;}
#battle-native-finish .native-finish-streak:nth-child(4){height:clamp(36px,15.5vh,132px)!important;}
/* Old central Finish word is intentionally absent. */
#battle-native-finish .native-finish-text{display:none!important;}

/* v119: extracted white pixels from native GambitL only; no thick gray-outline fill. */
#battle-native-finish .native-finish-streak{
  background-image:url('../assets/images/ui/finish_tape_green_v119.png?v=120')!important;
  background-size:auto 100%!important;
}
/* Ten real textures are resident as DOM images before gameplay. */
#battle-final-countdown-number{background-image:none!important;position:relative;isolation:isolate;}
#battle-final-countdown-number .native-digit-sprite{
  position:absolute;inset:0;width:100%;height:100%;object-fit:fill;
  opacity:0;pointer-events:none;user-select:none;
}
#battle-final-countdown-number .native-digit-sprite.active{opacity:1;}
#battle-final-countdown-fallback{display:none!important;position:absolute;inset:0;
  align-items:center;justify-content:center;font:900 clamp(128px,36vmin,420px)/.9 Impact,sans-serif;
  color:rgba(255,255,255,.32);-webkit-text-stroke:3px rgba(240,240,240,.6);}
#battle-final-countdown-number.native-countdown-fallback #battle-final-countdown-fallback{display:flex!important;}
#battle-final-countdown-number.native-countdown-fallback .native-digit-sprite.active{opacity:0;}
/* v119: 3-D roll is applied to the one-minute glyph, not the HUD or final counter. */
#battle-one-minute .native-minute-word{backface-visibility:visible;transform-style:preserve-3d;}

/* v120 TV-capture reconciliation. Source: original JP BFLYT/BFLAN tracks
 * plus user screenshots from the Wii U, 2026-11-22. Historical rules above
 * are superseded; native gameplay scenes and HUD remain untouched. */
#battle-one-minute #native-one-minute-stage{
  /* N_All_00 (+95 native Y) and the original 580x161 GambitL/clock glyph. */
  width:min(91vw,64.5vh)!important;aspect-ratio:580/161!important;
  transform:translate3d(0,-13.194444vh,0)!important;
}
#battle-one-minute .native-minute-word img,
#battle-one-minute .native-minute-echo img{
  width:100%;height:100%;object-fit:contain;
}
/* The source BFLAN N_All pane alpha is 255; the captured-text shader itself
 * is translucent. Screenshot at 0:59 confirms it is not an opaque word. */
#battle-final-countdown-number{
  filter:none!important; /* Original screenshot: no heavy dark shadow. */
}
/* Original P_Number_00 uses 500x400 layout, original 480x380 PNG pixels;
 * sprite alpha is scaled at runtime to the translucent GX2 capture layer. */
#battle-native-finish{
  /* Native N_Text_00 anchor: +50 (Y-up) and +5 degrees. */
  z-index:29!important;
  transform:translate3d(0,-6.944444vh,0) rotate(-5deg)!important;
  perspective:1100px;
}
#battle-native-finish .native-finish-streaks{overflow:visible;transform-style:preserve-3d;}
#battle-native-finish .native-finish-streak{
  width:240vw!important;height:17.777778vh!important;max-height:none!important;
  /* Single opaque original-v16-violet captured strip, never two Finish words. */
  background:url('../assets/images/ui/finish_tape_v120.png?v=120') repeat-x center center!important;
  background-size:auto 100%!important;
  box-shadow:0 2px 4px rgba(10,12,30,.23)!important;
  transform-origin:50% 50%;backface-visibility:visible;
  opacity:0;
}
#battle-native-finish .native-finish-streak:nth-child(2),
#battle-native-finish .native-finish-streak:nth-child(3),
#battle-native-finish .native-finish-streak:nth-child(4){height:17.777778vh!important;}
#battle-native-finish .native-finish-text{display:none!important;}

/* v121: single-plane compositing fixes the 'tapes passing through each other'
 * artifact visible in the user's v120 screenshot. The four strips retain
 * their BFLAN travel/exit tracks but no longer participate in CSS 3-D depth.
 * The 16:9 viewport positions and lane widths follow the supplied Wii U TV
 * reference. An opaque foreground band always occludes a rear one. */
#battle-native-finish{
  transform:none!important;
  perspective:none!important;
  isolation:isolate!important;
  overflow:hidden!important;
}
#battle-native-finish .native-finish-streaks{
  inset:0!important;
  transform-style:flat!important;
  isolation:isolate!important;
  overflow:hidden!important;
}
#battle-native-finish .native-finish-streak{
  position:absolute!important;
  top:50%!important;left:50%!important;
  width:230vw!important;
  margin-left:-115vw!important;
  height:var(--ribbon-height,10.6vh)!important;
  margin-top:var(--ribbon-half-height,-5.3vh)!important;
  max-height:none!important;
  transform-origin:center center!important;
  transform-style:flat!important;
  backface-visibility:hidden!important;
  background-image:url('../assets/images/ui/finish_tape_v120.png?v=121')!important;
  background-size:auto 100%!important;
  background-color:transparent!important;
  background-blend-mode:normal!important;
  box-shadow:none!important;
  filter:none!important;
  will-change:transform,opacity!important;
}
/* Override older per-lane 128px/3D settings; the native image is opaque. */
#battle-native-finish .native-finish-streak:nth-child(n){
  height:var(--ribbon-height,10.6vh)!important;
}

/* v131: deliberately absent in ordinary mode; only ?debug=1 creates the DOM. */
#debug-cheat-menu{position:fixed;right:20px;bottom:18px;width:min(365px,calc(100vw - 32px));
 max-height:min(76vh,530px);z-index:2147483646;box-sizing:border-box;overflow:hidden;
 display:flex;flex-direction:column;padding:14px 13px 11px;color:#f9fbfd;background:rgba(13,19,31,.96);
 border:2px solid #b9e84b;border-radius:13px;box-shadow:0 13px 34px #000b,0 0 0 1px #fff2 inset;
 font-family:system-ui,'Noto Sans JP',sans-serif;font-size:13px;pointer-events:none;user-select:none;}
#debug-cheat-menu[hidden]{display:none!important;}
#debug-cheat-menu .cheat-heading{display:flex;justify-content:space-between;align-items:center;letter-spacing:.09em;
 border-bottom:1px solid #ffffff36;padding-bottom:8px;}
#debug-cheat-menu .cheat-heading strong{font-size:17px;color:#dbff74;}
#debug-cheat-menu .cheat-heading span{font-size:11px;color:#b8c2cc;letter-spacing:0;}
#debug-cheat-menu .cheat-path{font-size:11px;color:#b9c5d7;padding:10px 2px 8px;min-height:18px;}
#debug-cheat-menu .cheat-options{overflow:auto;min-height:0;max-height:340px;scrollbar-width:thin;}
#debug-cheat-menu .cheat-option{display:flex;gap:7px;align-items:center;padding:9px 7px;border-radius:6px;
 font-weight:600;border:1px solid transparent;line-height:1.35;}
#debug-cheat-menu .cheat-option.selected{background:#a5d83b;color:#101821;border-color:#e4fca9;}
#debug-cheat-menu .cheat-option.disabled{opacity:.45;}
#debug-cheat-menu .cheat-arrow{width:14px;flex-shrink:0;}
#debug-cheat-menu .cheat-feedback{min-height:18px;margin-top:9px;color:#f9e9a4;font-size:11px;}
#debug-cheat-menu .cheat-help{border-top:1px solid #ffffff29;padding-top:8px;color:#a9b7c9;font-size:10px;}
#debug-cheat-menu .cheat-empty{padding:16px 8px;color:#afbbcb;}
@media(max-width:500px){#debug-cheat-menu{right:8px;bottom:8px;padding:11px;max-height:70vh;}}

/* ONLINE LAB: debug=1 only; modal, keyboard and mouse friendly. */
body.online-lab-open,body.online-lab-open *{cursor:auto!important;}
#online-lab{position:fixed;inset:0;z-index:300;display:grid;place-items:center;background:#080c17d9;color:#edf5ff;padding:12px;box-sizing:border-box;user-select:text;}
#online-lab .ol-panel{box-sizing:border-box;width:min(760px,100%);max-height:95vh;overflow:auto;background:#172333;border:1px solid #587489;border-radius:14px;padding:18px;box-shadow:0 12px 50px #0008;font:14px/1.5 system-ui,sans-serif;}
#online-lab header{display:flex;align-items:center;justify-content:space-between;gap:12px;color:#d4fa78;font-size:19px;}
#online-lab .ol-settings,#online-lab .ol-actions{display:flex;gap:8px;flex-wrap:wrap;margin:12px 0;}
#online-lab label{display:flex;align-items:center;gap:5px;}
#online-lab button,#online-lab select{font:inherit;color:#edf5ff;background:#293c50;border:1px solid #617b91;border-radius:6px;padding:8px 10px;}
#online-lab button{cursor:pointer!important;}
#online-lab button:hover,#online-lab button:focus-visible,#online-lab select:focus-visible{outline:2px solid #d4fa78;background:#3a4c34;}
#online-lab #ol-status{color:#d4fa78;min-height:22px;}
#online-lab pre{white-space:pre-wrap;overflow-wrap:anywhere;background:#0d1522;border-radius:6px;padding:12px;font:12px/1.6 monospace;min-height:100px;}
#online-lab .ol-note{font-size:12px;color:#b4c5d7;}
