*{margin:0;padding:0;box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{width:100%;height:100%;overflow:hidden;background:#0a0a12;font-family:"Courier New",monospace;color:#e0e0e0;touch-action:manipulation;user-select:text;-webkit-user-select:text}
#game-wrap{position:fixed;inset:0;display:flex;align-items:center;justify-content:center}
/* CRT vibe */
#game-wrap::before{content:"";position:absolute;inset:0;pointer-events:none;z-index:58;background:radial-gradient(ellipse at center,#0000 65%,#0005 100%)}
#game-wrap::after{content:"";position:absolute;inset:0;pointer-events:none;z-index:59;background:repeating-linear-gradient(0deg,#0000 0 2px,#00000022 2px 4px)}
#hud-day,#hud-title,#hud-clock,#hud-right,#dlg-name,#panel-title,#eod h2,#eod h3,#chaos-banner,#quest-tracker,.bar-label,.t-line1,.t-line2,.t-line3,#title-hint,#title-flavor{font-family:"Press Start 2P","Courier New",monospace}
#hud-day{font-size:12px}
#hud-title{font-size:8px}
#hud-clock{font-size:9px}
#quest-tracker{font-size:8px}
#chaos-banner{font-size:9px}
#title-hint{animation:blink 1.2s steps(2) infinite}
@keyframes blink{50%{opacity:.25}}
canvas{image-rendering:pixelated;display:block}
.hidden{display:none!important}
button:focus-visible{outline:3px solid #f8e49b;outline-offset:3px}
@media(max-width:640px){#v55-nmbtns.on{position:fixed!important;right:max(8px,calc(env(safe-area-inset-right) + 8px))!important;bottom:max(190px,calc(env(safe-area-inset-bottom) + 190px))!important}}

/* HUD */
#hud{position:absolute;top:0;left:0;right:0;pointer-events:none;z-index:10}
#hud-top{display:flex;justify-content:space-between;align-items:flex-start;padding:8px 10px;background:linear-gradient(#000c,#0000);gap:8px}
#hud-day{color:#ffd24a;font-weight:bold;font-size:14px}
#hud-title{font-size:10px;color:#7fd4ff}
#hud-clock{font-size:11px;color:#9f9}
#hud-bars{flex:1;max-width:220px;display:flex;flex-direction:column;gap:3px}
.bar{display:flex;align-items:center;gap:5px}
.bar-label{font-size:8px;width:42px;color:#aaa}
.bar-track{flex:1;height:9px;background:#222;border:1px solid #555;border-radius:3px;overflow:hidden}
.bar-track.big{height:14px;border-color:#888}
.bar-fill{height:100%;width:50%;transition:width .3s}
.bar-fill.xp{background:#4af}
.bar-fill.stress{background:linear-gradient(90deg,#fa4,#f44)}
.bar-fill.hp{background:#4f4}
#hud-right{text-align:right;font-size:12px;display:flex;flex-direction:column;align-items:flex-end;gap:2px}
#hud-budget{color:#8f8}
.hud-btn{pointer-events:auto;background:#222a;border:1px solid #666;color:#fff;border-radius:6px;font-size:16px;padding:4px 10px;font-family:inherit}
#chaos-banner{text-align:center;background:#402;color:#fd8;font-size:11px;padding:3px;margin:0 20px;border:1px solid #a64;border-radius:4px}
#quest-tracker{margin:6px 10px;font-size:10px;color:#ccc;text-shadow:1px 1px #000;line-height:1.5}
#quest-tracker .done{color:#6f6;text-decoration:line-through}

/* Toast */
#toast{position:absolute;top:22%;left:50%;transform:translateX(-50%);background:#111e;border:2px solid #ffd24a;color:#ffd24a;padding:10px 18px;border-radius:8px;font-size:14px;text-align:center;z-index:40;max-width:85%;animation:tpop .3s}
@keyframes tpop{from{transform:translateX(-50%) scale(.7);opacity:0}}

/* Dialogue */
#dialogue{position:absolute;left:8px;right:8px;bottom:8px;background:#0d0d1af2;border:2px solid #4af;border-radius:8px;padding:10px;z-index:30}
#dlg-name{color:#ffd24a;font-weight:bold;font-size:13px;margin-bottom:4px}
#dlg-text{font-size:13px;line-height:1.5;min-height:40px;color:#eee}
#dlg-options{display:flex;flex-direction:column;gap:5px;margin-top:8px}
#dlg-options button{background:#16202e;border:1px solid #4af;color:#bfe3ff;padding:8px;border-radius:6px;font-family:inherit;font-size:12px;text-align:left}
#dlg-options button:active{background:#245}

/* Battle */
#battle{position:absolute;inset:0;background:radial-gradient(circle,#1a0f2e,#05030a);z-index:25;display:flex;flex-direction:column}
#battle-scene{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;padding:16px}
#enemy-sprite{font-size:72px;animation:bob 1.2s infinite ease-in-out;filter:drop-shadow(0 0 12px #a0f)}
@keyframes bob{50%{transform:translateY(-10px)}}
#enemy-name{color:#f8a;font-weight:bold;font-size:16px;text-shadow:0 0 8px #f0a}
#battle-enemy .bar-track{width:200px;margin-top:6px}
#battle-log{width:100%;max-width:420px;height:88px;overflow-y:auto;background:#0008;border:1px solid #444;border-radius:6px;padding:6px 8px;font-size:11px;line-height:1.5;color:#cdd}
#battle-log .dmg{color:#ff8}
#battle-log .heal{color:#8f8}
#battle-log .sys{color:#8cf}
#battle-player{width:200px;text-align:center;font-size:11px;color:#8f8}
#battle-actions{display:grid;grid-template-columns:repeat(auto-fit,minmax(110px,1fr));gap:6px;padding:10px;background:#000a}
#battle-actions button{background:#141428;border:1px solid #66f;color:#ccf;padding:11px 6px;border-radius:8px;font-family:inherit;font-size:12px}
#battle-actions button:active{background:#223}
#battle-actions button:disabled{opacity:.35}
#battle-actions .cost{color:#fa4;font-size:9px;display:block}

/* Panel */
#panel{position:absolute;inset:4%;background:#0c0c18f5;border:2px solid #888;border-radius:10px;z-index:35;display:flex;flex-direction:column}
#panel-head{display:flex;justify-content:space-between;align-items:center;padding:10px 14px;border-bottom:1px solid #444}
#panel-title{color:#ffd24a;font-weight:bold;font-size:15px}
#panel-close{background:none;border:1px solid #666;color:#fff;border-radius:6px;padding:3px 9px;font-family:inherit}
#panel-tabs{display:flex;gap:4px;padding:8px 10px 0;flex-wrap:wrap}
#panel-tabs button{background:#181828;border:1px solid #555;color:#aaa;padding:5px 10px;border-radius:6px 6px 0 0;font-family:inherit;font-size:11px}
#panel-tabs button.active{color:#ffd24a;border-color:#ffd24a;background:#221}
#panel-body{flex:1;overflow-y:auto;padding:10px 14px;font-size:12px;line-height:1.6}
.stat-row{display:flex;justify-content:space-between;padding:3px 0;border-bottom:1px dotted #333}
.loot-item{padding:7px;border:1px solid #444;border-radius:6px;margin-bottom:6px;background:#12121e}
.loot-item .rarity-common{color:#bbb}.loot-item .rarity-rare{color:#4af}.loot-item .rarity-epic{color:#c6f}.loot-item .rarity-legendary{color:#fa4}
.rep-row{display:flex;justify-content:space-between;padding:4px 0}
.stars{color:#ffd24a;letter-spacing:2px}
.cert-node{border:1px solid #456;border-radius:8px;padding:8px;margin-bottom:8px;background:#101824}
.cert-node.locked{opacity:.45}
.cert-node.owned{border-color:#4f4;background:#121}
.cert-node button{float:right;background:#153;border:1px solid #4f4;color:#8f8;border-radius:5px;padding:3px 10px;font-family:inherit}
.journal-entry{border-left:3px solid #4af;padding:6px 8px;margin-bottom:8px;background:#10121c}

/* End of day */
#eod{position:absolute;inset:0;background:#05050cf2;z-index:45;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px;padding:20px;text-align:center}
#eod h2{color:#ffd24a;letter-spacing:4px;text-shadow:0 0 12px #fa0}
#eod h3{color:#8cf;font-size:13px}
#eod-summary{font-size:12px;line-height:1.8;color:#ccc;background:#1118;border:1px solid #444;border-radius:8px;padding:10px 18px}
#eod-rewards{display:flex;gap:10px;flex-wrap:wrap;justify-content:center}
#eod-rewards button{width:120px;min-height:110px;background:#141428;border:2px solid #66f;border-radius:10px;color:#ddf;font-family:inherit;font-size:11px;padding:10px;line-height:1.5}
#eod-rewards button:active{background:#223}
#eod-rewards .rw-icon{font-size:28px;display:block;margin-bottom:6px}

/* Title */
#title-screen{position:absolute;inset:0;background:linear-gradient(#050510,#101024 60%,#1a0f2e);z-index:50;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:18px;padding:20px;text-align:center}
.t-line1{font-size:clamp(34px,10vw,64px);font-weight:bold;color:#4af;text-shadow:3px 3px #036,0 0 24px #4af;letter-spacing:6px}
.t-line2{font-size:clamp(44px,14vw,84px);font-weight:bold;color:#ffd24a;text-shadow:3px 3px #830,0 0 24px #fa0;letter-spacing:10px}
.t-line3{font-size:clamp(9px,2.5vw,13px);color:#8f8;letter-spacing:3px;margin-top:6px}
#title-flavor{font-size:12px;color:#aab;line-height:1.7}
.big-btn{background:#142028;border:2px solid #4af;color:#bfe3ff;font-family:inherit;font-size:17px;padding:13px 34px;border-radius:10px;letter-spacing:2px}
.big-btn:active{background:#245}
#title-hint{font-size:10px;color:#667}

/* Touch */
#touch-ui{position:absolute;inset:0;pointer-events:none;z-index:20}
#dpad{position:absolute;left:16px;bottom:20px;display:grid;grid-template-columns:repeat(3,52px);grid-template-rows:repeat(3,52px);gap:4px;pointer-events:auto}
.dbtn{border:2px solid #4af;background:#4af3;color:#fff;font-size:20px;font-family:inherit;border-radius:10px;display:flex;align-items:center;justify-content:center}
.dbtn:active,.dbtn.held{background:#4af9;transform:scale(.94)}
.d-up{grid-column:2;grid-row:1;border-radius:12px 12px 4px 4px}
.d-left{grid-column:1;grid-row:2;border-radius:12px 4px 4px 12px}
.d-right{grid-column:3;grid-row:2;border-radius:4px 12px 12px 4px}
.d-down{grid-column:2;grid-row:3;border-radius:4px 4px 12px 12px}
#touch-buttons{position:absolute;right:18px;bottom:24px;display:flex;flex-direction:column;gap:12px;align-items:center;pointer-events:auto}
.tbtn{width:70px;height:70px;border-radius:50%;border:2px solid #4af;background:#4af3;color:#fff;font-size:24px;font-family:inherit;font-weight:bold}
.tbtn.small{width:46px;height:46px;font-size:16px;background:#8883;border-color:#888}
.tbtn:active{background:#4af8}
@media (hover:hover) and (pointer:fine){#touch-ui{display:none!important}}

/* uncertainty meter (evidence-based battles) */
.unc-track { margin-top: 4px; border-color: #c9a227; }
.bar-fill.unc { background: linear-gradient(90deg, #8a6a10, #ffd24a); width: 100%; }
#enemy-unc-text { font-size: 8px; color: #ffd24a; letter-spacing: 1px; margin-top: 2px; text-align: center; }
.hyp-btn { border-color: #c9a227 !important; }

/* confidence meter */
.conf-track { margin-top: 4px; border-color: #4af; }
.bar-fill.conf { background: linear-gradient(90deg, #1a3a8a, #4af); width: 10%; }
#enemy-conf-text { font-size: 8px; color: #7fb4ff; letter-spacing: 1px; margin-top: 2px; text-align: center; }

/* v6.0.1 — mobile touch targets (WCAG-ish): dialogs & battle actions */
@media (pointer: coarse) {
  #dlg-options button,
  #battle-actions button,
  #eod-rewards button {
    min-height: 40px;
    padding: 10px 12px;
    font-size: 11px;
  }
}

/* v6.2 — modern/clean polish: frosted dialogs, softer depth */
#dialogue, #panel, #eod-summary {
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 8px 32px #0009, inset 0 1px 0 #ffffff11;
}
#battle-scene { backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }

/* v6.4 Felicia — Watchdog Protocol */
#v64-panel { position: fixed; right: 10px; top: 54px; z-index: 40; width: 168px; background: #071426ee; border: 1px solid #00d9ff55; border-radius: 10px; padding: 8px 10px; font: 11px/1.5 monospace; color: #bfeaff; box-shadow: 0 4px 18px #000a; backdrop-filter: blur(6px); }
#v64-panel .v64-h { color: #00d9ff; font-weight: bold; letter-spacing: 1px; display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
#v64-panel .v64-h button { background: #00d9ff22; color: #00d9ff; border: 1px solid #00d9ff66; border-radius: 6px; font: 9px monospace; padding: 2px 5px; cursor: pointer; }
#v64-panel .v64-row { display: flex; justify-content: space-between; }
#v64-panel .v64-row b { color: #39ff88; }
#v64-panel .v64-ao { margin-top: 6px; border-top: 1px dashed #00d9ff33; padding-top: 4px; color: #8fb8cc; }
#v64-panel .v64-ao .done { color: #39ff88; }
#btn-felicia { display: block; margin: 10px auto 0; padding: 12px 18px; background: linear-gradient(135deg, #0b0f1a, #071426); color: #00d9ff; border: 1px solid #00d9ff; border-radius: 10px; font: bold 14px monospace; letter-spacing: 1px; cursor: pointer; box-shadow: 0 0 18px #00d9ff44; }
#btn-felicia:hover { background: #00d9ff22; }
#v64-backmike { text-align: center; margin-top: 6px; color: #8fb8cc; font: 11px monospace; cursor: pointer; text-decoration: underline; }
img.v64-portrait { float: left; width: 64px; height: 64px; margin: 0 10px 6px 0; image-rendering: pixelated; border: 1px solid #00d9ff55; border-radius: 8px; background: #071426; }

/* ===== v6.6 AAA Polish ===== */
.bar-fill { transition: width .45s cubic-bezier(.22, 1, .36, 1); }
#toast { animation: v66-pop .28s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes v66-pop { 0% { transform: scale(.7) translateY(8px); opacity: 0; } 100% { transform: scale(1) translateY(0); opacity: 1; } }

#battle-enemy, #battle-player { position: relative; }
#battle-enemy.v66-intro { animation: v66-intro .5s cubic-bezier(.22, 1, .36, 1); }
@keyframes v66-intro { 0% { transform: translateX(60px) scale(.6); opacity: 0; filter: brightness(3); } 100% { transform: none; opacity: 1; filter: none; } }
#battle-enemy.v66-hit #enemy-sprite { animation: v66-hitflash .3s steps(2); }
@keyframes v66-hitflash { 0%, 50% { filter: brightness(3) saturate(.2); transform: translateX(-4px); } 25%, 75% { filter: none; transform: translateX(3px); } }
#battle-scene.v66-shake { animation: v66-shake .32s linear; }
@keyframes v66-shake { 0%,100% { transform: translate(0,0); } 20% { transform: translate(-5px,2px); } 40% { transform: translate(4px,-3px); } 60% { transform: translate(-3px,-2px); } 80% { transform: translate(3px,2px); } }
#battle-scene.v66-phit { animation: v66-phit .45s ease-out; }
@keyframes v66-phit { 0% { box-shadow: inset 0 0 90px #ff2a2acc; } 100% { box-shadow: inset 0 0 0 transparent; } }
#enemy-sprite.v66-kill { animation: v66-kill .7s ease-in forwards; }
@keyframes v66-kill { 0% { filter: brightness(4); transform: scale(1.15); opacity: 1; } 40% { filter: brightness(2.5); transform: scale(1.05); } 100% { filter: brightness(0) blur(2px); transform: scale(.7); opacity: 0; } }

.v66-float { position: absolute; top: 18%; font: bold 20px "Press Start 2P", monospace; font-size: 15px; color: #fff; text-shadow: 2px 2px 0 #000; pointer-events: none; animation: v66-float 1.1s ease-out forwards; z-index: 30; }
.v66-float.dmg { color: #ffe066; }
.v66-float.crit { color: #ffd700; font-size: 19px; text-shadow: 0 0 8px #ff9500, 2px 2px 0 #000; }
.v66-float.phit { color: #ff6b6b; }
.v66-float.heal { color: #7dd87d; }
@keyframes v66-float { 0% { transform: translateY(0) scale(.6); opacity: 0; } 15% { transform: translateY(-8px) scale(1.15); opacity: 1; } 100% { transform: translateY(-64px) scale(1); opacity: 0; } }

.v66-confetti { position: absolute; top: -8px; width: 8px; height: 8px; pointer-events: none; animation: v66-fall linear forwards; z-index: 40; }
@keyframes v66-fall { 0% { transform: translateY(0) rotate(0); opacity: 1; } 100% { transform: translateY(420px) rotate(540deg); opacity: 0; } }

.v66-lognew { animation: v66-lognew .25s ease-out; display: inline-block; }
@keyframes v66-lognew { 0% { transform: translateX(-10px); opacity: 0; } 100% { transform: none; opacity: 1; } }

.v66-dlgfade { animation: v66-dlgfade .35s ease-out; }
@keyframes v66-dlgfade { 0% { opacity: 0; transform: translateY(6px); } 100% { opacity: 1; transform: none; } }
#dlg-text { cursor: pointer; min-height: 2.4em; }

#game-wrap.v66-lowhp::after { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 25; animation: v66-heartbeat 1.1s ease-in-out infinite; }
@keyframes v66-heartbeat { 0%, 100% { box-shadow: inset 0 0 40px #ff2a2a22; } 50% { box-shadow: inset 0 0 110px #ff2a2a66; } }

/* ===== v6.7 Cinematic Combat ===== */
#quest-tracker { background: #0a0a12b8; border-radius: 6px; padding: 4px 6px; max-width: 46%; }

#v67-gear, #v67-gal { pointer-events: auto; }
#v67-settings, #v67-gallery { position: absolute; inset: 0; z-index: 55; background: #05050ccc; display: flex; align-items: center; justify-content: center; }
.v67-set-card { width: min(340px, 88%); background: #0d0d1af5; border: 2px solid #4af; border-radius: 12px; padding: 14px 16px; font-size: 12px; color: #dde; box-shadow: 0 8px 32px #000c; }
.v67-set-h { color: #ffd24a; font-family: "Press Start 2P", monospace; font-size: 11px; display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.v67-set-h button { background: none; border: 1px solid #666; color: #fff; border-radius: 6px; padding: 2px 8px; font-family: inherit; }
.v67-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px dotted #333; }
.v67-row input[type=range] { width: 130px; accent-color: #4af; }
.v67-row input[type=checkbox] { width: 18px; height: 18px; accent-color: #4af; }
.v67-note { color: #889; font-size: 10px; margin-top: 10px; text-align: center; }
.v67-gal-card { max-height: 70vh; overflow-y: auto; }
.v67-gal-item { display: block; width: 100%; text-align: left; background: #141428; border: 1px solid #66f; color: #ccf; padding: 9px; border-radius: 8px; margin-bottom: 6px; font-family: inherit; font-size: 12px; }
.v67-gal-item small { color: #8f8; }

/* boss cinematic */
#v67-cine { position: absolute; inset: 0; z-index: 45; pointer-events: auto; }
#v67-cine.hidden { display: none; }
#v67-cine .v67-bar { position: absolute; left: 0; right: 0; height: 0; background: #000; transition: height .5s cubic-bezier(.22,1,.36,1); }
#v67-cine .v67-bar.top { top: 0; } #v67-cine .v67-bar.bot { bottom: 0; }
#v67-cine.v67-cine-in .v67-bar { height: 12%; }
#v67-cine.v67-cine-out .v67-bar { height: 0; }
#v67-cine .v67-card { position: absolute; left: 0; right: 0; top: 40%; text-align: center; opacity: 0; }
#v67-cine.v67-cine-in .v67-card { animation: v67-card .6s .3s cubic-bezier(.34,1.56,.64,1) forwards; }
#v67-cine.v67-cine-out .v67-card { animation: v67-cardout .4s forwards; }
.v67-card-t { font-family: "Press Start 2P", monospace; font-size: clamp(16px, 4vw, 26px); color: #ff5252; text-shadow: 0 0 18px #f008, 2px 2px 0 #000; letter-spacing: 3px; }
.v67-card-s { font-size: 12px; color: #fdd; margin-top: 8px; }
@keyframes v67-card { 0% { opacity: 0; transform: scale(1.6); } 100% { opacity: 1; transform: scale(1); } }
@keyframes v67-cardout { 100% { opacity: 0; transform: scale(.9); } }
#battle.v67-zoom #battle-scene { animation: v67-zoom 2.2s cubic-bezier(.22,1,.36,1); }
@keyframes v67-zoom { 0% { transform: scale(1.14); } 100% { transform: scale(1); } }
#battle.v67-finisher #battle-scene { animation: v67-fin .5s ease-out; }
@keyframes v67-fin { 0% { transform: scale(1.07); filter: brightness(1.5); } 100% { transform: scale(1); filter: none; } }

/* ability projectiles */
.v67-proj { position: absolute; left: 18%; top: 46%; font-size: 26px; z-index: 32; pointer-events: none; text-shadow: 0 0 12px var(--pc, #ffd24a); animation: v67-proj .55s cubic-bezier(.3,.7,.4,1) forwards; }
@keyframes v67-proj { 0% { left: 18%; transform: scale(.6) rotate(-20deg); opacity: 0; } 15% { opacity: 1; } 85% { transform: scale(1.15) rotate(8deg); } 100% { left: 46%; transform: scale(1.3) rotate(0deg); opacity: 0; } }

/* flavor combat text */
.v67-flavor { position: absolute; top: 2%; left: 50%; transform: translateX(-50%); font-family: "Press Start 2P", monospace; font-size: 13px; color: #ffd700; text-shadow: 0 0 12px #ff9500, 2px 2px 0 #000; pointer-events: none; z-index: 34; animation: v67-flavor 1.25s ease-out forwards; white-space: nowrap; }
.v67-flavor.denied { color: #ff6b6b; text-shadow: 0 0 12px #f008, 2px 2px 0 #000; }
.v67-flavor.breach { color: #ffd700; }
.v67-flavor.combo { color: #ff9d00; font-size: 11px; top: 10%; }
@keyframes v67-flavor { 0% { opacity: 0; transform: translateX(-50%) scale(1.8); } 18% { opacity: 1; transform: translateX(-50%) scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: translateX(-50%) translateY(-14px); } }
#v67-combo { position: absolute; top: -14px; right: 8%; font-family: "Press Start 2P", monospace; font-size: 11px; color: #ff9d00; text-shadow: 0 0 10px #ff6a00, 2px 2px 0 #000; z-index: 34; animation: v66-pop .25s; }

/* colorblind-safe palette */
body.v67-cb .bar-fill.hp { background: #56b4e9; }
body.v67-cb .bar-fill.stress { background: linear-gradient(90deg, #e69f00, #d55e00); }
body.v67-cb .bar-fill.xp { background: #f0e442; }
body.v67-cb .v66-float.heal { color: #56b4e9; }
body.v67-cb .v66-float.phit { color: #d55e00; }
body.v67-cb .v66-float.crit, body.v67-cb .v67-flavor { color: #f0e442; }
body.v67-cb #battle-log .heal { color: #56b4e9; }
body.v67-cb #battle-log .dmg { color: #e69f00; }

/* Shared restrained scene entrance; no input delay or additional modal owner. */
@keyframes techops-scene-in{from{opacity:0;transform:translateY(5px)}to{opacity:1;transform:translateY(0)}}
#dialogue:not(.hidden),#battle:not(.hidden),#v722-cine,#good-boys-campaign-intro{animation:techops-scene-in 180ms ease-out both}
@media(prefers-reduced-motion:reduce){#dialogue:not(.hidden),#battle:not(.hidden),#v722-cine,#good-boys-campaign-intro{animation:none}}

/* Safari must keep long presses on game controls inside the game. */
#game,canvas,button{-webkit-touch-callout:none;-webkit-user-select:none;user-select:none}

/* ===== Production title / readiness experience ===== */
#title-screen.production-title-experience{
  justify-content:flex-start;
  gap:14px;
  overflow-x:hidden;
  overflow-y:auto;
  padding:max(24px,env(safe-area-inset-top)) max(18px,env(safe-area-inset-right)) max(20px,env(safe-area-inset-bottom)) max(18px,env(safe-area-inset-left));
  background:
    radial-gradient(circle at 50% 14%,rgba(50,139,216,.18),transparent 34%),
    linear-gradient(180deg,rgba(3,9,20,.84),rgba(5,12,24,.94) 58%,rgba(2,7,15,.98));
}
#title-screen.production-title-experience #title-logo,
#title-screen.production-title-experience #title-flavor,
#title-screen.production-title-experience #title-hint,
#title-screen.production-title-experience #title-mode-grid,
#title-screen.production-title-experience #title-system-panel{position:relative;z-index:1}
#title-screen.production-title-experience #title-logo{margin-top:auto}
#title-screen.production-title-experience #title-flavor{max-width:720px;color:#b7c7d5;text-wrap:balance}
#title-mode-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
  width:min(820px,100%);
  margin:2px auto 0;
}
#title-mode-grid .title-mode-card{
  --mode-accent:#67c8ff;
  --mode-glow:rgba(50,160,230,.22);
  position:relative;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  min-width:0;
  min-height:86px;
  margin:0;
  padding:13px 15px;
  overflow:hidden;
  border:1px solid #41637d;
  border-color:color-mix(in srgb,var(--mode-accent) 64%,#213446);
  border-radius:10px;
  background:linear-gradient(135deg,rgba(8,22,36,.96),rgba(4,12,23,.96));
  color:#edf8ff;
  box-shadow:inset 0 1px rgba(255,255,255,.06),0 10px 30px rgba(0,0,0,.26);
  font-family:"Courier New",monospace;
  text-align:left;
  letter-spacing:normal;
  cursor:pointer;
  transition:border-color 160ms ease,box-shadow 160ms ease,transform 160ms ease,filter 160ms ease;
}
#title-mode-grid .title-mode-card::before{
  content:"";
  position:absolute;
  inset:0 auto 0 0;
  width:3px;
  background:var(--mode-accent);
  box-shadow:0 0 18px var(--mode-accent);
}
#title-mode-grid .title-mode-card--day{--mode-accent:#64d4ff;--mode-glow:rgba(72,183,255,.24)}
#title-mode-grid .title-mode-card--continue{--mode-accent:#6bf1a8;--mode-glow:rgba(72,220,145,.22)}
#title-mode-grid .title-mode-card--gooddogs{--mode-accent:#d9b26f;--mode-glow:rgba(224,169,83,.23)}
#title-mode-grid .title-mode-card--nightcrawler{--mode-accent:#ad8cff;--mode-glow:rgba(142,96,255,.25)}
#title-mode-grid .title-mode-card:hover:not(:disabled){
  border-color:var(--mode-accent);
  box-shadow:inset 0 1px rgba(255,255,255,.09),0 12px 34px var(--mode-glow);
  transform:translateY(-2px);
}
#title-mode-grid .title-mode-card:focus-visible,
#title-readiness-retry:focus-visible,
#title-night-new:focus-visible{
  outline:3px solid #f8e49b;
  outline-offset:3px;
}
#title-mode-grid .title-mode-card:active:not(:disabled){transform:translateY(0)}
#title-mode-grid .title-mode-card:disabled{
  cursor:wait;
  filter:saturate(.42);
  opacity:.58;
}
.title-mode-copy{display:grid;gap:4px;min-width:0}
.title-mode-kicker{
  color:var(--mode-accent);
  font:700 8px/1.2 "Press Start 2P","Courier New",monospace;
  letter-spacing:.08em;
}
.title-mode-name{
  color:#f4f9ff;
  font:700 clamp(15px,2vw,19px)/1.18 "Press Start 2P","Courier New",monospace;
  text-shadow:0 0 12px var(--mode-glow);
}
.title-mode-detail{color:#aec0cf;font:11px/1.35 "Courier New",monospace}
.title-mode-arrow{
  flex:0 0 auto;
  color:var(--mode-accent);
  font:30px/1 monospace;
  transform:translateX(-2px);
}
#title-system-panel{
  display:grid;
  gap:8px;
  width:min(820px,100%);
  margin:0 auto;
}
#title-readiness,
#title-night-result{
  display:flex;
  align-items:center;
  gap:10px;
  min-height:42px;
  padding:9px 12px;
  border:1px solid rgba(116,158,191,.32);
  border-radius:8px;
  background:rgba(3,12,22,.82);
  box-shadow:inset 0 1px rgba(255,255,255,.04);
  text-align:left;
}
#title-readiness-dot{
  flex:0 0 auto;
  width:9px;
  height:9px;
  border-radius:50%;
  background:#77bfff;
  box-shadow:0 0 12px #77bfff;
  animation:title-readiness-pulse 1.25s ease-in-out infinite;
}
@keyframes title-readiness-pulse{50%{opacity:.35;transform:scale(.8)}}
#title-readiness[data-state="ready"]{border-color:rgba(77,230,153,.36)}
#title-readiness[data-state="ready"] #title-readiness-dot{background:#55ef9b;box-shadow:0 0 12px #55ef9b;animation:none}
#title-readiness[data-state="failed"]{border-color:rgba(255,116,132,.48)}
#title-readiness[data-state="failed"] #title-readiness-dot{background:#ff7484;box-shadow:0 0 12px #ff7484;animation:none}
.title-readiness-copy{display:grid;flex:1;gap:3px;min-width:0}
#title-readiness-label,
.title-night-result-kicker{color:#d9eaff;font:700 8px/1.25 "Press Start 2P","Courier New",monospace;letter-spacing:.07em}
#title-readiness-detail{color:#91a9ba;font:11px/1.35 "Courier New",monospace}
#title-readiness-retry,
#title-night-new{
  flex:0 0 auto;
  min-height:44px;
  padding:8px 12px;
  border:1px solid #ff9baa;
  border-radius:7px;
  background:#2b1019;
  color:#fff1f3;
  font:700 9px "Press Start 2P","Courier New",monospace;
  cursor:pointer;
}
#title-night-new{justify-self:start;border-color:#8872ae;background:#171323;color:#dacbef;font:700 12px/1.5 "Courier New",monospace}
#title-night-result{
  display:grid;
  grid-template-columns:auto 1fr;
  column-gap:12px;
  border-color:rgba(183,137,255,.44);
  background:linear-gradient(90deg,rgba(32,15,58,.9),rgba(6,15,27,.88));
}
#title-night-result[hidden]{display:none!important}
.title-night-result-kicker{grid-row:1/3;color:#c9adff}
#title-night-result-summary{color:#f2ecff;font:700 12px/1.3 "Courier New",monospace}
#title-night-result-message{color:#bbaed2;font:11px/1.35 "Courier New",monospace}
#title-screen.production-title-experience #title-hint{margin-bottom:auto;color:#71889b}

@media(max-width:620px){
  #title-screen.production-title-experience{gap:10px;padding-top:max(16px,env(safe-area-inset-top))}
  #title-screen.production-title-experience #title-logo{margin-top:0}
  #title-mode-grid{grid-template-columns:1fr;gap:7px}
  #title-mode-grid .title-mode-card{min-height:68px;padding:10px 12px}
  .title-mode-name{font-size:14px}
  .title-mode-detail{font-size:10px}
  #title-readiness,#title-night-result{padding:8px 10px}
  #title-night-result{grid-template-columns:1fr;gap:4px}
  .title-night-result-kicker{grid-row:auto}
}
@media(max-height:690px) and (min-width:621px){
  #title-screen.production-title-experience{gap:8px;padding-top:max(12px,env(safe-area-inset-top));padding-bottom:max(12px,env(safe-area-inset-bottom))}
  #title-screen.production-title-experience #title-logo{margin-top:0}
  #title-mode-grid .title-mode-card{min-height:70px;padding-block:9px}
  .title-mode-detail{font-size:10px}
}
@media(prefers-reduced-motion:reduce){
  *,*::before,*::after{scroll-behavior:auto!important;animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}
  #title-readiness-dot{animation:none}
  #title-mode-grid .title-mode-card{transition:none}
}

/* Production composition: readable chrome, one reserved conversation surface. */
:root{
  --ops-ink:#09121c;
  --ops-panel:#0b1724f5;
  --ops-line:#44647b;
  --ops-paper:#e5eff6;
  --ops-muted:#a6bdcd;
  --ops-accent:#79c9f3;
  --ops-gold:#e6c27b;
  --ops-safe-left:max(12px,env(safe-area-inset-left));
  --ops-safe-right:max(12px,env(safe-area-inset-right));
  --ops-safe-bottom:max(12px,env(safe-area-inset-bottom));
}
body #game-wrap::before{z-index:8;background:radial-gradient(ellipse at center,transparent 52%,#050a1245 100%)}
body #game-wrap::after{z-index:9;opacity:.22}
body #dialogue{
  left:max(var(--ops-safe-left),calc((100% - 1040px)/2));
  right:max(var(--ops-safe-right),calc((100% - 1040px)/2));
  bottom:var(--ops-safe-bottom);
  max-height:52vh;max-height:52dvh;
  padding:18px 22px;overflow-y:auto;overscroll-behavior:contain;
  border:1px solid var(--ops-line);border-top:2px solid var(--ops-accent);
  border-radius:12px;background:var(--ops-panel);
  box-shadow:0 12px 48px #0009,inset 0 1px #d9f0ff12;
  scrollbar-color:#567c95 #0a1520;scrollbar-width:thin;
}
body #dlg-name{font:700 12px/1.6 "Courier New",monospace;letter-spacing:.1em;color:var(--ops-gold);margin-bottom:8px;overflow-wrap:anywhere}
body #dlg-text{font:14px/1.65 "Courier New",monospace;color:var(--ops-paper);text-wrap:pretty;overflow-wrap:anywhere}
body #dlg-options{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,280px),1fr));gap:8px;margin-top:14px}
body #dlg-options button{
  min-height:44px;padding:11px 14px;font:700 12px/1.45 "Courier New",monospace;
  color:#daecf7;background:#14283a;border:1px solid #42647b;border-radius:7px;
  overflow-wrap:anywhere;cursor:pointer;transition:background 120ms ease,border-color 120ms ease;
}
body #dlg-options button:hover{background:#203b50;border-color:#8ac7e9}
body #dlg-options button:focus-visible,body .hud-btn:focus-visible,body #panel button:focus-visible{outline:3px solid #f4d58d;outline-offset:3px}
body #panel{inset:max(12px,env(safe-area-inset-top)) var(--ops-safe-right) var(--ops-safe-bottom) var(--ops-safe-left);max-width:1000px;margin-inline:auto;border:1px solid var(--ops-line);background:var(--ops-panel)}
body #panel-close,body #panel-tabs button{min-height:44px;min-width:44px}
body #panel-body{font-size:14px}
body #toast{font:13px/1.5 "Courier New",monospace;border:1px solid #d7b571;background:#101d2bf5;border-radius:8px;box-shadow:0 8px 24px #0007;max-width:min(620px,84vw)}
@keyframes v66-pop{from{transform:translateX(-50%) translateY(5px);opacity:0}to{transform:translateX(-50%);opacity:1}}

/* The previous vertical toolbar pushed the objective list into the actor's feet. */
body.recording-day #game-wrap #hud-top{
  display:grid;grid-template-columns:minmax(180px,1fr) minmax(100px,180px) auto;
  gap:18px;padding:max(14px,env(safe-area-inset-top)) var(--ops-safe-right) 12px var(--ops-safe-left);
  background:linear-gradient(#06111ced,#081421cf 75%,#08142100);
}
body.recording-day #game-wrap #hud-right{
  display:grid;grid-template-columns:repeat(7,44px);grid-auto-rows:auto;
  gap:5px!important;align-items:center;text-align:right;font:11px/1.4 "Courier New",monospace;
}
body.recording-day #hud-right #hud-budget{grid-area:1/1/2/3}
body.recording-day #hud-right #hud-tickets{grid-area:1/3/2/5}
body.recording-day #hud-right #hud-prod{grid-area:1/5/2/8}
body.recording-day #hud-right button{grid-row:2;min-width:44px;min-height:44px;margin:0}
body.recording-day #game-wrap #hud-bars{max-width:none;padding-top:4px;gap:8px}
body.recording-day #game-wrap #hud-title{font:11px/1.5 "Courier New",monospace;color:#bdd1e0}
body.recording-day #game-wrap #hud-day{font:700 13px/1.6 "Courier New",monospace;letter-spacing:.05em;color:var(--ops-gold)}
body.recording-day #game-wrap #hud-clock{font:11px/1.5 "Courier New",monospace;color:#a6d8c4}
body.recording-day #game-wrap #quest-tracker{
  margin:0 var(--ops-safe-left);max-width:min(390px,40vw);font:11px/1.45 "Courier New",monospace;
  border:1px solid #637e924d;border-radius:8px;padding:9px 11px;background:#07121cdb;
  box-shadow:0 6px 24px #0003;max-height:min(280px,26dvh);overflow:auto;pointer-events:auto;overscroll-behavior:contain;
}
body.recording-day #quest-tracker .v75-qh{font:700 10px/1.5 "Courier New",monospace;color:#b9d2e1;letter-spacing:.07em}
body.recording-day #quest-tracker .v75-qt{font-size:0}
body.recording-day #quest-tracker .v75-qt::after{content:"OBJECTIVES";font:700 10px/1.5 "Courier New",monospace}
body.recording-day #quest-tracker .v75-qb{min-width:28px;min-height:28px}
body #hud-right [data-control-label]{position:relative;color:transparent!important;font-size:0!important;background:#0d1b28e8;border:1px solid #486779;border-radius:8px}
body #hud-right [data-control-label]::after{content:attr(data-control-label);position:absolute;inset:0;display:grid;place-items:center;color:#d7e7f1;font:700 9px/1 "Courier New",monospace;letter-spacing:.015em;pointer-events:none}
body.recording-day #hud-right #v54-phone{position:relative;inset:auto;grid-row:2;min-width:44px;min-height:44px}
body #hud-right #v54-badge{font:700 9px/1 "Courier New",monospace;z-index:1}

/* Existing authored plates occupy the scene above dialogue at every aspect ratio. */
body.act1-scene-open #act1-reference{
  position:absolute;inset:0 0 var(--techops-dialog-height,250px);z-index:13;
  background:#07111a;min-height:110px;
}
body.act1-scene-open #act1-reference .a1-bg{inset:0;background-size:cover;background-position:center 38%;filter:brightness(.85) saturate(.85);animation:none}
body.act1-scene-open #act1-reference.a1-board .a1-bg{background-size:cover;background-position:center 25%}
body.act1-scene-open #act1-reference .a1-grade{background:linear-gradient(180deg,#061019bb,transparent 24%,transparent 62%,#061019e8),linear-gradient(90deg,#06101955,transparent 30%,transparent 75%,#06101955)}
body.act1-scene-open #act1-reference .a1-label{left:var(--ops-safe-left);right:var(--ops-safe-right);top:max(18px,env(safe-area-inset-top));font:700 12px/1.5 "Courier New",monospace;letter-spacing:.14em;color:#e3eef5}
body.act1-scene-open #act1-reference .a1-status{left:var(--ops-safe-left);right:var(--ops-safe-right);bottom:14px;font:700 11px/1.5 "Courier New",monospace;padding:10px 14px;border:1px solid #53768c66;border-left:3px solid var(--ops-accent);background:#07121ce8;text-align:left}
body.act1-scene-open #act1-reference .a1-props{bottom:calc(var(--a1-floor-bottom,13%) + 4%);height:28%;left:10%;right:10%;justify-content:center}
body.act1-scene-open #act1-reference .a1-actor{height:48%;max-width:37%;bottom:var(--a1-floor-bottom,13%);right:8%}
body.act1-scene-open #act1-reference.a1-side_view .a1-props{right:43%;height:32%;justify-content:flex-start}
body.act1-scene-open #act1-reference.a1-first_person .a1-props{left:12%;right:12%;height:56%;bottom:17%}
body.act1-scene-open #act1-reference.a1-first_person .a1-prop{max-width:45%}
/* Dialogue owns interaction; movement controls return as soon as it closes. */
body.act1-scene-open #touch-ui{visibility:hidden;pointer-events:none}
body.act1-scene-open #toast{top:max(54px,calc(env(safe-area-inset-top) + 42px));left:var(--ops-safe-left);right:var(--ops-safe-right);transform:none;max-width:500px;animation:none}

@media(max-width:640px){
  body #dialogue{padding:13px 14px;max-height:49vh;max-height:49dvh}
  body:not(.act1-scene-open) #dialogue{max-height:72vh;max-height:72dvh}
  body #dlg-name{font-size:11px;margin-bottom:6px}
  body #dlg-text{font-size:13px;line-height:1.6}
  body #dlg-options{grid-template-columns:1fr;gap:7px;margin-top:10px}
  body #dlg-options button{font-size:12px;padding:11px 12px}
  body #dialogue.v77-hasbig{padding-left:14px;padding-top:86px}
  body #dialogue .v77-portrait{top:10px;left:14px;width:64px;height:64px;transform:none}
  body.recording-day #game-wrap #hud-top{grid-template-columns:1fr 125px;gap:7px!important;padding:max(10px,env(safe-area-inset-top)) var(--ops-safe-right) 8px var(--ops-safe-left)!important}
  body.recording-day #game-wrap #hud-right{grid-column:1/-1;grid-template-columns:repeat(7,minmax(0,1fr));font-size:10px!important;gap:4px!important}
  body.recording-day #game-wrap #hud-right button{width:100%;min-width:0;height:44px}
  body.recording-day #game-wrap #hud-bars{max-width:none!important}
  body.recording-day #game-wrap #quest-tracker{max-width:min(66vw,290px)!important;margin:2px var(--ops-safe-left)!important;font-size:10px!important;line-height:1.4!important;padding:7px 9px!important}
  body.recording-day #game-wrap #touch-buttons .tbtn.small{width:44px!important;height:44px!important}
  body.act1-scene-open #act1-reference .a1-label{font-size:11px;letter-spacing:.07em}
  body.act1-scene-open #act1-reference .a1-status{font-size:10px;bottom:10px;padding:9px 10px}
  body.act1-scene-open #act1-reference.a1-board .a1-bg{background-position:43% 30%}
  body.act1-scene-open #act1-reference .a1-props{height:24%;bottom:calc(var(--a1-floor-bottom,15%) + 4%);left:5%;right:5%}
  body.act1-scene-open #act1-reference .a1-prop{max-width:40%}
  body.act1-scene-open #act1-reference.a1-first_person .a1-props{left:5%;right:5%;height:47%;bottom:23%}
}
@media(max-height:500px) and (min-width:641px){
  body #dialogue{max-height:82vh;max-height:82dvh;padding:12px 16px}
  body.act1-scene-open #dialogue{left:46%;right:var(--ops-safe-right);top:max(10px,env(safe-area-inset-top));bottom:var(--ops-safe-bottom);max-height:none}
  body.act1-scene-open #dlg-options{grid-template-columns:1fr}
  body.act1-scene-open #act1-reference{inset:0 55% 0 0}
  body.act1-scene-open #toast{right:56%;font-size:11px}
  body.recording-day #game-wrap #hud-top{padding-top:max(8px,env(safe-area-inset-top));gap:10px;grid-template-columns:minmax(140px,1fr) minmax(95px,135px) auto}
  body.recording-day #game-wrap #quest-tracker{max-width:31vw;max-height:max(52px,calc(100dvh - 280px));overflow:auto;pointer-events:auto;overscroll-behavior:contain;font-size:10px}
  body.recording-day #quest-tracker .v75-qh{position:sticky;top:0;background:#0a1723;z-index:1}
}
@media(max-width:360px){
  body.recording-day #game-wrap #hud-right{grid-template-columns:repeat(6,minmax(0,1fr))}
  body.recording-day #hud-right #hud-budget{grid-column:1/3}
  body.recording-day #hud-right #hud-tickets{grid-column:3/5}
  body.recording-day #hud-right #hud-prod{grid-column:5/7}
  body.recording-day #game-wrap #hud-right button,body.recording-day #hud-right #v54-phone{grid-row:auto;min-width:44px}
  body.recording-day #game-wrap #quest-tracker{max-height:18dvh}
}

/* Scripted standup: one framed mid-shot keeps the speaking crew on stage.
   The room renderer raises the floor line to 62% while this class is on, so
   the capped panel never reaches the actors; speakers carry a scene marker. */
body.day-standup-open #dialogue{max-height:38vh;max-height:38dvh}
/* Auxiliary fine print inside standup lines (timestamps, asides) is the main
   overflow source on compact screens; drop it instead of scrolling the panel. */
body.day-standup-open #dlg-text small{display:none}
@media(max-width:640px){
  body.day-standup-open #dialogue{max-height:34vh;max-height:34dvh}
  body.day-standup-open #dlg-options{grid-template-columns:1fr 1fr}
}
@media(max-width:360px){
  body.day-standup-open #dialogue{max-height:30vh;max-height:30dvh}
}
@media(max-height:500px) and (min-width:641px){
  body.day-standup-open #dialogue{max-height:46vh;max-height:46dvh}
}

/* The arrival card outranks the body-level route HUD; the HUD yields instead of
   stacking under it. */
body.arrival-card-on #day-route-hud{opacity:0;pointer-events:none;transition:opacity .25s ease}

/* Gameplay targets stay fixed under hover, press, and held feedback. Keep the
   existing color/brightness feedback without translating or shrinking hit areas. */
html body #game-wrap #dpad .dbtn,
html body #game-wrap #touch-buttons .tbtn,
html body #game-wrap #v55-nmbtns .v55-nbtn,
html body.good-boys-controls #good-dogs-touch button[data-utility]{transform:none!important}

/* A short landscape viewport has one control strip below the projected floor.
   Existing directional buttons and input handlers remain the same elements. */
@media(orientation:landscape) and (max-height:500px){
  html body #game-wrap #dpad{
    left:max(8px,env(safe-area-inset-left))!important;bottom:max(8px,env(safe-area-inset-bottom))!important;
    grid-template-columns:repeat(4,44px)!important;grid-template-rows:44px!important;gap:6px!important;
    width:194px!important;height:44px!important;transform:none!important;
  }
  html body #game-wrap #dpad .dbtn{grid-row:1!important;width:44px!important;height:44px!important;min-width:44px!important;min-height:44px!important;border-radius:9px!important;font-size:18px!important}
  html body #game-wrap #dpad .d-left{grid-column:1!important}
  html body #game-wrap #dpad .d-up{grid-column:2!important}
  html body #game-wrap #dpad .d-down{grid-column:3!important}
  html body #game-wrap #dpad .d-right{grid-column:4!important}
  html body #game-wrap #touch-buttons{right:max(8px,env(safe-area-inset-right))!important;bottom:max(8px,env(safe-area-inset-bottom))!important;flex-direction:row!important;gap:6px!important}
  html body #game-wrap #touch-buttons #tb-interact,html body #game-wrap #touch-buttons #tb-menu{width:44px!important;height:44px!important;min-width:44px!important;min-height:44px!important;font-size:16px!important}
  html body #game-wrap #v55-nmbtns[data-night-combat-input="active"]{
    right:max(114px,calc(env(safe-area-inset-right) + 114px))!important;bottom:max(8px,env(safe-area-inset-bottom))!important;
    display:flex!important;flex-direction:row!important;flex-wrap:nowrap!important;gap:6px!important;width:auto!important;
  }
  html body #game-wrap #v55-nmbtns[data-night-combat-input="active"]>.v55-nbtn{width:50px!important;height:44px!important;min-width:50px!important;min-height:44px!important}
}
@media(orientation:landscape) and (max-height:500px) and (min-width:560px){
  html body.good-boys-controls #good-dogs-touch{
    right:max(8px,env(safe-area-inset-right))!important;bottom:max(8px,env(safe-area-inset-bottom))!important;
    width:min(490px,calc(100vw - max(8px,env(safe-area-inset-left)) - max(8px,env(safe-area-inset-right)) - 208px))!important;
    grid-template-columns:repeat(7,minmax(44px,1fr))!important;grid-template-rows:44px!important;gap:4px!important;padding:0!important;
  }
  html body.good-boys-controls #good-dogs-touch button,html body.good-boys-controls #good-dogs-touch button[data-utility='1']{
    grid-area:auto!important;width:100%!important;min-width:44px!important;height:44px!important;min-height:44px!important;font-size:8px!important;padding:4px 2px!important;
  }
  html body.good-boys-controls #good-dogs-touch button#gb-use{grid-area:auto!important;width:100%!important;height:44px!important;min-height:44px!important}
}
/* Reserve narrow movement/menu spacing from the first frame in every mode.
   Night action geometry follows input ownership, without waiting for the optional
   visual decorator class or resizing targets when MORE opens. */
@media(orientation:landscape) and (max-height:500px) and (min-width:560px) and (max-width:640px){
  html body #game-wrap #dpad{width:176px!important;gap:0!important}
  html body #game-wrap #touch-buttons{gap:2px!important}
  html body #game-wrap #v55-nmbtns[data-night-combat-input="active"]{right:max(102px,calc(env(safe-area-inset-right) + 102px))!important;gap:1px!important}
  html body #game-wrap #v55-nmbtns[data-night-combat-input="active"]>.v55-nbtn{width:44px!important;min-width:44px!important}
}
