
:root{
  --bg:#06130b;
  --panel:#071f11;
  --fg:var(--accent);
  --fg-dim:var(--accent-dim);
  --line:var(--accent-dim);
  --line-dim:var(--accent-dim);
  --danger:#ff3b3b;
  --shadow:rgba(0,0,0,.6);
  --glow:0 0 6px var(--accent-dim), 0 0 18px var(--accent-dim);
}
body.amber{
  --fg:#ffbf3a;
  --fg-dim:rgba(255,191,58,.65);
  --line:rgba(255,191,58,.88);
  --line-dim:rgba(255,191,58,.35);
  --glow:0 0 6px rgba(255,191,58,.28), 0 0 18px rgba(255,191,58,.10);
}
html,body{ background:var(--bg); color:var(--fg); }
body{
  text-shadow: 0 0 2px rgba(0,0,0,.9), 0 0 10px rgba(0,0,0,.35);
}
body::before{
  content:"";
  position:fixed; inset:0;
  pointer-events:none;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(255,255,255,.06) 0px,
      rgba(255,255,255,.06) 1px,
      rgba(0,0,0,0) 2px,
      rgba(0,0,0,0) 4px
    );
  opacity:.14;
  mix-blend-mode: overlay;
}
body::after{
  content:"";
  position:fixed; inset:-20%;
  pointer-events:none;
  background: radial-gradient(circle at 50% 30%, rgba(0,0,0,0) 0%, rgba(0,0,0,.55) 70%, rgba(0,0,0,.85) 100%);
  opacity:.9;
}
@keyframes crtFlicker{
  0%,100%{ opacity:1; }
  50%{ opacity:.985; }
}
.app-root{ animation: crtFlicker 4s infinite; }

:root{
  --p:var(--accent);
  --bg:#050505;
}

*{box-sizing:border-box;}
html,body{
  font-size: 18px;
height:100%;}

body{
  font-size: 18px;

  background-color:var(--bg);
  background-size:cover;
  background-position:center;
  background-attachment:fixed;
  color:var(--p);
  font-family:'VT323', monospace;
  margin:0;
  overflow:hidden;
  text-transform:uppercase;
}

/* Container */
.terminal-container{
  padding-top: calc(10px + env(safe-area-inset-top));
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  padding-left: calc(10px + env(safe-area-inset-left));
  padding-right: calc(10px + env(safe-area-inset-right));

  display:flex;
  flex-direction:column;
  height:100dvh;
  box-sizing:border-box;
  position:relative;
  z-index:10;
}

/* Needed for positioning floating UI elements inside the top bar */
header{ position: relative; }

.logo-container{
  border:2px solid var(--p);
  padding:5px;
  text-align:center;
  margin-bottom:5px;
}

.bv-logo{
  display:block;
  width:min(900px, 96%);
  height:48px;
  margin:0 auto;
  max-width:92%;
  object-fit:contain;

  /* subtle base glow */
  filter:
    drop-shadow(0 0 6px rgba(255, 180, 80, 0.22))
    drop-shadow(0 0 14px rgba(255, 140, 40, 0.12));
  opacity:0.98;

  transition:
    filter 180ms ease,
    transform 180ms ease,
    opacity 180ms ease;
}

.bv-logo:hover{
  filter:
    drop-shadow(0 0 10px rgba(255, 190, 90, 0.35))
    drop-shadow(0 0 22px rgba(255, 140, 40, 0.18));
  transform:translateY(-1px);
  opacity:1;
}

.bv-logo:active{
  transform:translateY(0px) scale(0.995);
}

@media (prefers-reduced-motion: no-preference){
  .bv-logo{ animation:bvGlowBreath 3.8s ease-in-out infinite; }
  .bv-logo:hover{ animation:bvGlowHover 1.2s ease-in-out infinite; }
}

@keyframes bvGlowBreath{
  0%, 100%{
    filter:
      drop-shadow(0 0 6px rgba(255, 180, 80, 0.18))
      drop-shadow(0 0 14px rgba(255, 140, 40, 0.10));
  }
  50%{
    filter:
      drop-shadow(0 0 8px rgba(255, 190, 90, 0.26))
      drop-shadow(0 0 18px rgba(255, 140, 40, 0.14));
  }
}

@keyframes bvGlowHover{
  0%, 100%{
    filter:
      drop-shadow(0 0 10px rgba(255, 200, 110, 0.40))
      drop-shadow(0 0 24px rgba(255, 140, 40, 0.18));
  }
  50%{
    filter:
      drop-shadow(0 0 14px rgba(255, 210, 120, 0.55))
      drop-shadow(0 0 30px rgba(255, 140, 40, 0.24));
  }
}

 (max-width: 520px){
  .bv-logo{ height:36px; }
}


.status-grid{
  display:flex;
  justify-content:space-between;
  align-items:center;
  font-size:0.9rem;
  border-bottom:1px solid var(--p);
  padding:5px 0;
  margin-bottom:5px;
}

.music-ctrl{display:flex;align-items:center;gap:8px;}
.theme-ctrl{display:flex;align-items:center;gap:8px;}
.info-ctrl{display:flex;align-items:center;gap:8px;}

main#game-screen{
  flex:1;
  min-height:0;
  overflow:hidden;
  display:flex;
  flex-direction:column;
}

/* Map */
#map-view{
  display:flex;
  flex-direction:column;
  flex:1;
  min-height:0;
  overflow:hidden;
  position:relative;
}

#map-container{position:relative; flex: 0 0 auto;}
#map{
  height:min(46vh, 420px);
  width:100%;
  border:2px solid var(--p);
  background:#000;
  z-index:1;
}

#locate-btn{
  position:absolute;
  top:10px;
  right:10px;
  z-index:1000;
  background:rgba(0,0,0,0.8);
  color:var(--p);
  border:1px solid var(--p);
  padding:5px;
  cursor:pointer;
  font-family:'VT323';
}

.sector-info{
  background: var(--accent-bg);
  padding:8px 8px;
  text-align:center;
  border:1px solid var(--p);
  margin:5px 0;
}

.session-row{
  margin:6px 0 8px;
  opacity:.95;
}

.personal-stats{
  font-size:1.4rem;
  text-align:center;
  border:1px double var(--p);
  padding:6px 6px;
  background: var(--accent-bg);
  margin-bottom:5px;
}

#combat-log{
  flex:1;
  min-height:0;
  overflow:auto;
  font-size:0.85rem;
  padding:6px;
  border-top:1px dashed var(--p);
  margin-bottom:8px;
}

/* Bottom primary actions */
.bottom-actions{
  margin-top:auto;
  padding-top:6px;
  display:flex;
  flex-direction:column;
  gap:8px;
}

.btn-large{
  width:100%;
  font-family:inherit;
  font-size:2.2rem;
  padding:14px 10px;
  border:2px solid var(--p);
  background:rgba(0,0,0,.6);
  color:var(--p);
  cursor:pointer;
}

.btn-large.btn-secondary{opacity:.92;}

/* Buttons */
.retro-btn, .retro-btn-outline, .modal-content button{
  font-family:inherit;
  font-size:1.6rem;
  padding:10px 12px;
  cursor:pointer;
  border:2px solid var(--p);
}

.retro-btn{
  background:var(--p);
  color:#001a08;
}

.retro-btn-outline{
  background:transparent;
  color:var(--p);
}

/* Hidden */
.hidden{display:none !important;}

/* Splash */
#splash-screen{
  position:fixed;
  inset:0;
  z-index:99999;
  display:flex;
  align-items:center;
  justify-content:center;
  background:#000 url('splash_desktop.webp') center center / cover no-repeat;
}
#splash-screen::before{
  content:"";
  position:absolute;
  inset:0;
  background:radial-gradient(circle at center, rgba(0,0,0,0.25) 0%, rgba(0,0,0,0.85) 75%, rgba(0,0,0,0.95) 100%);
}
.splash-content{
  position:relative;
  text-align:center;
  padding:18px 16px;
  background:rgba(0,0,0,.35);
  border:2px solid var(--accent-dim);
}
.loading-bar{
  width:260px;
  height:12px;
  border:2px solid var(--p);
  margin:14px auto 0;
  overflow:hidden;
}
.loading-progress{
  height:100%;
  width:0%;
  background:var(--p);
  animation:load 2.2s linear forwards;
}
@keyframes load{to{width:100%;}}
.blink{animation:blink .9s steps(2,start) infinite;}
@keyframes blink{to{visibility:hidden;}}

/* Ticker */
.ticker-wrap{
  position:fixed;
  bottom:0;
  left:0;
  width:100%;
  height:35px;
  background:#000;
  border-top:2px solid var(--p);
  overflow:hidden;
  z-index:2000;
}
.ticker{
  white-space:nowrap;
  display:inline-block;
  animation:ticker-anim 50s linear infinite;
  padding-top:8px;
  font-size:1.2rem;
}
@keyframes ticker-anim{
  0%{transform:translateX(100vw);}
  100%{transform:translateX(-100%);}
}

/* Switch */
.switch{position:relative;display:inline-block;width:40px;height:20px;}
.switch input{opacity:0;width:0;height:0;}
.slider{
  position:absolute;
  cursor:pointer;
  top:0;left:0;right:0;bottom:0;
  background:rgba(0,0,0,.75);
  border:1px solid var(--p);
  transition:.2s;
}
.slider:before{
  position:absolute;
  content:"";
  height:14px;width:14px;
  left:3px;bottom:2px;
  background:var(--p);
  transition:.2s;
}
input:checked + .slider:before{transform:translateX(18px);}

/* Lever-style button (matches switch visuals) */
.lever-btn{
  position:relative;
  width:40px;
  height:20px;
  padding:0;
  border:1px solid var(--p);
  background:rgba(0,0,0,.75);
  color:var(--p);
  cursor:pointer;
}
.lever-btn:before{
  content:"";
  position:absolute;
  left:3px;
  bottom:2px;
  width:14px;
  height:14px;
  background:var(--p);
}
.lever-btn .lever-icon{
  position:absolute;
  right:6px;
  top:50%;
  transform:translateY(-50%);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size:12px;
  letter-spacing:0;
}
.lever-btn:active{transform:translateY(1px);}

/* Modals */
.modal-overlay{position:fixed;inset:0;background:rgba(0,0,0,.65);}

#scores-modal,#auth-modal{
  position:fixed;inset:0;
  display:flex;align-items:center;justify-content:center;
  z-index:9999;
}

.modal-content,.auth-modal-content{
  position:relative;
  width:min(520px, 92vw);
  max-height:min(80vh, 700px);
  overflow-y:auto;
  -webkit-overflow-scrolling:touch;
  background:rgba(0,0,0,.88);
  border:2px solid var(--p);
  padding:14px 14px;
  text-align:center;
}

.auth-modal-content input{
  width:min(320px, 90%);
  font-family:inherit;
  font-size:2rem;
  padding:10px 10px;
  background:rgba(0,0,0,.7);
  color:var(--p);
  border:2px solid var(--p);
  outline:none;
}

.auth-actions{
  display:flex;
  gap:8px;
  justify-content:center;
  margin-top:12px;
  flex-wrap:wrap;
}

.auth-hint{opacity:.75;margin-top:10px;}

@media (max-height: 700px){
  #map{height:min(42vh, 360px);}
  .btn-large{font-size:2rem;padding:12px 10px;}
}


.build-id{
  position:fixed;
  right:10px;
  bottom:10px;
  border:1px solid var(--line);
  padding:4px 8px;
  font-size:1rem;
  background:rgba(0,0,0,.55);
  opacity:.75;
  pointer-events:none;
  z-index:9999;
}


body::before{
  content:"";
  position:fixed;
  inset:0;
  background-size:cover;
  background-position:center;
  opacity:.22;
  mix-blend-mode:screen;
  pointer-events:none;
  z-index:5;
}
body::after{
  content:"";
  position:fixed;
  inset:0;
  background:radial-gradient(ellipse at center, rgba(0,0,0,0) 0%, rgba(0,0,0,.55) 70%, rgba(0,0,0,.78) 100%);
  pointer-events:none;
  z-index:6;
}

/* Mockup metal button skin (large actions) */
.btn-large{
  background-size:100% 100%;
  background-repeat:no-repeat;
  border-color:var(--accent-dim);
  color:var(--accent-dim);
  text-shadow:0 0 10px var(--accent-dim);
}
.btn-primary.btn-large{
  filter:brightness(1.05);
}

@media (max-width: 420px){
  .btn-large{font-size:2.0rem;padding:12px 10px;}
  .logo{font-size:2.1rem;}
}

/* V6: make LOGIN comfortably tappable above iPhone home indicator */
#locked-actions{ margin-bottom: 10px; }
#live-actions{ margin-bottom: 6px; }

@media (max-width: 480px){
  .ticker-wrap{ padding: 6px 10px; }
}

/* V6: extra mockup-style overlays */
body::before{
  content:"";
  position:fixed;
  inset:0;
  pointer-events:none;
  background:
    none center/cover no-repeat,
    none center/512px 512px repeat;
  opacity:0.35;
  mix-blend-mode: screen;
  z-index:2;
}
body::after{
  content:"";
  position:fixed;
  inset:0;
  pointer-events:none;
  background: none center/cover no-repeat;
  opacity:0.28;
  z-index:3;
}
.terminal-container{ position:relative; z-index:4; }

/* V14 PROPER: lift bottom LOGIN button for iOS Home Screen + Large Text */
#bottom-login{
  transform: translateY(-36px);
}
@supports(padding: env(safe-area-inset-bottom)){
  #bottom-login{
    transform: translateY(calc(-36px - env(safe-area-inset-bottom) * 0.55));
  }
}
/* V14 PROPER: safe padding for bottom actions */
#bottom-actions{
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}

/* V14 PROPER: WORLD SCAN separate full-screen modal */
#worldscan-modal{
  position:fixed;
  inset:0;
  z-index:10000;
  display:flex;
  align-items:center;
  justify-content:center;
}
.modal-overlay{
  position:absolute;
  inset:0;
  background:rgba(0,0,0,.72);
}
.worldscan-shell{
  position:relative;
  width:min(980px, 96vw);
  height:min(92vh, 920px);
  background:rgba(0,0,0,.92);
  border:2px solid var(--line);
  box-shadow:0 0 24px var(--line-dim);
  display:flex;
  flex-direction:column;
}
.worldscan-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:10px 12px;
  border-bottom:1px solid var(--line-dim);
  background:rgba(255,255,255,.02);
}
.ws-title{font-size:1.5rem; letter-spacing:.08em;}
.ws-close{padding:8px 10px; font-size:1.2rem;}

.worldscan-body{
  flex:1;
  min-height:0;
  display:grid;
  grid-template-columns: 1fr 260px;
  gap:10px;
  padding:10px;
}
.worldscan-mapwrap{
  position:relative;
  min-height:0;
  border:1px solid var(--line);
}
#worldscan-map{
  width:100%;
  height:100%;
  min-height:320px;
  background:#000;
}
.ws-hint{
  position:absolute;
  left:10px;
  bottom:10px;
  padding:6px 8px;
  border:1px solid var(--line-dim);
  background:rgba(0,0,0,.65);
  font-size:1rem;
  opacity:.9;
}

.worldscan-panel{
  display:flex;
  flex-direction:column;
  gap:10px;
}
.ws-panel-box{
  border:1px solid var(--line);
  background:rgba(255,255,255,.02);
  padding:10px;
}
.ws-row{font-size:1.3rem; margin-bottom:6px;}
.ws-filter{display:flex; flex-direction:column; gap:6px; font-size:1.2rem;}
.ws-filter input{transform:scale(1.1); margin-right:8px;}

/* World Scan select (filters) */
.ws-select{
  background: rgba(0,0,0,.35);
  border: 1px solid rgba(0,255,65,.35);
  color: rgba(0,255,65,.95);
  padding: 6px 8px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 12px;
}
.amber .ws-select{
  border-color: rgba(255,170,0,.45);
  color: rgba(255,170,0,.95);
}
.ws-refresh{width:100%; font-size:1.4rem; padding:10px 10px; margin-top:10px;}
.ws-stats{margin-top:auto;}
#ws-stats{font-size:1.1rem; opacity:.9; line-height:1.25;}

@media (max-width: 720px){
  .worldscan-shell{ width:96vw; height:94vh; }
  .worldscan-body{ grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .worldscan-panel{ flex-direction:row; flex-wrap:wrap; }
  .ws-panel-box{ flex:1 1 46%; }
  .ws-stats{ flex:1 1 100%; }
}

/* V17: world scan grid always visible, claimedZones only (no sync) */





/* V26: local dev + responsive scaling (desktop Safari + phone landscape) */
html, body {
  height: 100%;
  overflow: hidden;
}
/* Use dynamic viewport units on iOS */
:root {
  --vh: 100dvh;
}
.app, .app-root, #app, #app-root {
  height: var(--vh);
  max-height: var(--vh);
}
/* Ensure main game screen never becomes taller than viewport */
#screen-game, #screen-login, #screen-boot {
  height: var(--vh);
  max-height: var(--vh);
  overflow: hidden;
}
/* Desktop Safari: center and cap width for readability */
@media (min-width: 900px) {
  .phone-frame, .app, .app-root, #app, #app-root {
    max-width: 520px;
    margin: 0 auto;
  }
}
/* Phone landscape: use two columns so everything fits */
@media (orientation: landscape) and (max-height: 520px) {
  /* turn the main game panel into 2 columns: HUD left, map right */
  .game-layout {
    display: grid !important;
    grid-template-columns: 260px 1fr !important;
    grid-template-rows: 1fr auto !important;
    gap: 10px !important;
    align-items: stretch !important;
  }
  .hud-panel {
    grid-column: 1;
    grid-row: 1 / span 2;
    overflow: hidden;
  }
  .map-panel {
    grid-column: 2;
    grid-row: 1;
    min-height: 0;
  }
  .bottom-panel {
    grid-column: 2;
    grid-row: 2;
  }
  /* Buttons not gigantic in landscape */
  button, .btn {
    font-size: 14px !important;
  }
}
/* World scan: make grid overlay stable (no zoom flicker) */
#ws-map, #worldscan-map, .ws-map, .leaflet-container.ws {
  position: relative;
}
/* V27: Desktop Safari fit-to-viewport (no hidden buttons) */
@media (min-width: 900px) {
  :root { --vh: 100vh; }

  /* Make the app use full viewport height */
  body {
    display: flex;
    justify-content: center;
    align-items: stretch;
  }

  /* Container: full height, allow layout to flex */
  .phone-frame, .app, .app-root, #app, #app-root {
    width: min(520px, 100vw);
    height: 100vh;
    max-height: 100vh;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
  }

  /* Game screen: use column flex so bottom buttons stay visible */
  #screen-game, #screen-login, #screen-boot {
    height: 100%;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  /* If your markup has these wrappers, make them flex */
  .game-layout {
    flex: 1 1 auto !important;
    min-height: 0;
    display: flex !important;
    flex-direction: column !important;
    gap: 10px;
  }

  /* Map should expand; other blocks should not force overflow */
  .map-panel, #map, #mapid, .map, .leaflet-container {
    flex: 1 1 auto !important;
    min-height: 240px;
  }

  /* HUD area should scroll internally if needed */
  .hud-panel, .hud, #hud {
    max-height: 40vh;
    overflow: auto;
  }

  /* Big buttons: slightly smaller on desktop to fit without clipping */
  button, .btn {
    padding: 10px 12px !important;
    font-size: 14px !important;
  }
}



/* V28: Desktop Safari/Chrome usability — always reachable buttons */
@media (min-width: 900px) {
  html, body { height: 100%; }
  body { overflow: auto !important; }

  /* Use wider layout on desktop (not phone width) */
  .phone-frame, .app, .app-root, #app, #app-root {
    max-width: none !important;
    width: min(980px, 100vw) !important;
    height: auto !important;
    max-height: none !important;
    margin: 0 auto !important;
  }

  /* Allow scrolling inside main column if needed */
  #game-screen, #map-view {
    overflow: auto !important;
  }

  /* Give the map a sensible desktop height */
  #map-container, .map-container {
    height: min(62vh, 620px) !important;
    min-height: 420px !important;
    flex: 0 0 auto !important;
  }
  #map {
    height: 100% !important;
  }

  /* Keep primary actions visible: stick to bottom inside scroll */
  #bottom-actions, .bottom-actions {
    position: sticky;
    bottom: 0;
    z-index: 999;
    padding-bottom: 14px;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(4px);
    border-top: 1px solid var(--accent-dim);
  }

  /* Slightly tighter vertical spacing */
  .sector-info { margin-top: 10px !important; }
  #combat-log { max-height: 22vh; overflow: auto; }
}



/* V29: Dedicated desktop layout (landscape-first) */
.is-desktop body {
  overflow: auto !important;
}
.is-desktop #screen-game,
.is-desktop #screen-login,
.is-desktop #screen-boot {
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
}

/* Desktop: widen the main container */
.is-desktop .phone-frame,
.is-desktop .app,
.is-desktop .app-root,
.is-desktop #app,
.is-desktop #app-root {
  width: min(980px, 100vw);
  max-width: 980px;
}

/* Desktop: two-column game layout: left HUD, right map */
.is-desktop .game-layout{
  display: grid !important;
  grid-template-columns: 340px 1fr !important;
  grid-template-rows: auto 1fr auto !important;
  gap: 14px !important;
  align-items: stretch !important;
}

/* Header spans full width if present */
.is-desktop .top-banner,
.is-desktop .header,
.is-desktop .title-panel {
  grid-column: 1 / -1;
}

.is-desktop .hud-panel{
  grid-column: 1;
  grid-row: 2;
  align-self: start;
  position: sticky;
  top: 12px;
  max-height: calc(100vh - 24px);
  overflow: auto;
}

.is-desktop .map-panel{
  grid-column: 2;
  grid-row: 2;
  min-height: 70vh;
  height: 70vh;
}

.is-desktop #map,
.is-desktop #mapid,
.is-desktop .leaflet-container{
  height: 100% !important;
  min-height: 70vh;
}

/* Bottom actions span width */
.is-desktop .bottom-panel,
.is-desktop .bottom-actions,
.is-desktop .actions-panel{
  grid-column: 1 / -1;
  grid-row: 3;
  position: sticky;
  bottom: 0;
  backdrop-filter: blur(6px);
}

/* Desktop buttons a bit larger */
.is-desktop button, .is-desktop .btn{
  font-size: 16px !important;
  padding: 12px 14px !important;
}

/* Desktop: ensure login button is never clipped */
.is-desktop #login-btn, .is-desktop .login-btn, .is-desktop #btn-login{
  position: sticky;
  bottom: 12px;
}



/* V30: Real desktop layout targeting actual DOM (#map-view etc.) */
.is-desktop body{
  overflow: auto !important;
}

/* Let terminal container breathe on desktop */
.is-desktop .terminal-container{
  width: min(1100px, 100vw);
  margin: 0 auto;
  padding: 18px 18px 90px;
}

/* Header stays at top; show a tiny mode badge */
.is-desktop .terminal-container header{
  position: sticky;
  top: 0;
  z-index: 50;
}
.is-desktop .terminal-container header::after{
  content: "DESKTOP MODE";
  display: inline-block;
  margin-left: 12px;
  font-family: "VT323", monospace;
  font-size: 16px;
  color: var(--accent-dim);
  opacity: .8;
}

/* Two-column layout: left = controls/info, right = map */
.is-desktop #map-view{
  display: grid;
  grid-template-columns: 380px 1fr;
  grid-template-rows: auto auto 1fr auto;
  gap: 14px;
  align-items: start;
}

/* Map on the right spanning all rows */
.is-desktop #map-container{
  grid-column: 2;
  grid-row: 1 / -1;
  height: calc(100vh - 170px);
  min-height: 520px;
}

/* Keep Leaflet map filling its container */
.is-desktop #map{
  height: 100% !important;
  min-height: 520px;
}

/* Left column blocks */
.is-desktop #sector-display{ grid-column: 1; grid-row: 1; }
.is-desktop #personal-stats-box{ grid-column: 1; grid-row: 2; }
.is-desktop #combat-log{ grid-column: 1; grid-row: 3; max-height: 45vh; overflow: auto; }

/* Retro outline buttons (VIEW LEADERBOARD / WORLD SCAN) become a vertical stack in left column */
.is-desktop #map-view > button.retro-btn-outline{
  grid-column: 1;
  width: 100%;
}

/* Put the two outline buttons right under personal stats */
.is-desktop #map-view > button.retro-btn-outline:nth-of-type(1){ grid-row: 2; }
.is-desktop #map-view > button.retro-btn-outline:nth-of-type(2){ grid-row: 2; margin-top: 54px; }

/* Bottom big actions stick to bottom-left; always visible */
.is-desktop #map-view .bottom-actions{
  grid-column: 1;
  grid-row: 4;
  position: sticky;
  bottom: 12px;
  z-index: 40;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(6px);
  padding: 10px;
  border: 1px solid var(--accent-dim);
}

/* Make big buttons readable on desktop */
.is-desktop .btn-large{
  font-size: 18px !important;
  padding: 14px 16px !important;
}

/* Ensure LOGIN is never clipped on desktop */
.is-desktop .btn-large#login-btn,
.is-desktop .btn-large.btn-login,
.is-desktop .btn-large[data-action="login"]{
  position: sticky;
  bottom: 12px;
}


/* V32: Remove CSS pixel grid from World Scan (use geographic grid) */


/* V34: Desktop layout overlap fixes */
.is-desktop .left-panel,
.is-desktop .hud-panel,
.is-desktop #left-panel,
.is-desktop #hud-left,
.is-desktop #hud,
.is-desktop #hud-panel{
  display: flex !important;
  flex-direction: column !important;
  gap: 12px !important;
  min-width: 320px;
}

.is-desktop .left-panel .btn,
.is-desktop .hud-panel .btn,
.is-desktop #left-panel button,
.is-desktop #hud-left button,
.is-desktop #hud button{
  width: 100%;
  box-sizing: border-box;
}

/* Ensure login/worldscan/leaderboard never share the same row */
.is-desktop .left-panel .btn-row,
.is-desktop .hud-panel .btn-row,
.is-desktop #left-panel .btn-row,
.is-desktop #hud-left .btn-row,
.is-desktop #hud .btn-row{
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
}

/* Specifically separate WORLD SCAN + LOGIN buttons if they live in same container */
.is-desktop #btn-login,
.is-desktop #login-btn,
.is-desktop #btn-worldscan,
.is-desktop #worldscan-btn,
.is-desktop #btn-leaderboard,
.is-desktop #leaderboard-btn{
  margin: 0 !important;
}

/* Fix overlap between "CONQUERED UNITS" and leaderboard button in desktop */
.is-desktop #units-panel,
.is-desktop .units-panel,
.is-desktop #conquered-panel{
  margin-bottom: 0 !important;
}
.is-desktop #btn-leaderboard,
.is-desktop #leaderboard-btn,
.is-desktop .btn-leaderboard{
  margin-top: 0 !important;
}

/* Give the units display its own block height */
.is-desktop #conquered-units,
.is-desktop #units-display,
.is-desktop .units-display{
  display: block;
  padding: 10px 12px;
}

/* Prevent accidental absolute positioning in desktop that causes stacking */
.is-desktop .bottom-actions,
.is-desktop .actions-panel{
  position: static !important;
}


/* V34: Ensure desktop map-view grid has enough vertical room */
.is-desktop #map-view{
  align-items: start;
}
.is-desktop #map-container{
  min-height: 520px;
}


/* V36: Desktop overlap fix for LOGIN / WORLD SCAN */
.is-desktop #left-panel,
.is-desktop #hud-left,
.is-desktop #hud,
.is-desktop .left-panel,
.is-desktop .hud-panel {
  display: flex !important;
  flex-direction: column !important;
  gap: 12px !important;
}
.is-desktop #btn-login,
.is-desktop #login-btn,
.is-desktop #btn-worldscan,
.is-desktop #worldscan-btn,
.is-desktop #btn-leaderboard,
.is-desktop #leaderboard-btn {
  position: static !important;
  display: block !important;
  width: 100% !important;
  margin: 0 !important;
}
.is-desktop #btn-worldscan,
.is-desktop #worldscan-btn { margin-top: 10px !important; }



/* V37: terminal-only theme (no PNG assets) */
:root{
  --bg: #050a06;
  --panel: #07140a;
  --line: var(--accent-dim);
  --text: var(--accent);
  --muted: var(--fg-dim);
  --danger: #ff4444;
  --amber: #ffb000;
}
html.amber, body.amber{
  --text: var(--amber);
  --muted: rgba(255,176,0,0.75);
  --line: rgba(255,176,0,0.35);
  --panel: #1a1405;
  --bg: #0c0902;
}
body{
  background: var(--bg) !important;
  color: var(--text) !important;
}
header, .hud, #hud, #left-panel, .panel, .modal-content{
  background: var(--panel) !important;
  border: 1px solid var(--line) !important;
  box-shadow: none !important;
}
button, .btn{
  background: transparent !important;
  color: var(--text) !important;
  border: 1px solid var(--line) !important;
}
button:hover{ filter: brightness(1.15); }



/* V37: Desktop no-frame-scroll (internal scroll only) */
.is-desktop body{ overflow:hidden !important; }
.is-desktop #app, .is-desktop #app-root, .is-desktop .app, .is-desktop .phone-frame{
  height: 100vh !important;
  max-height: 100vh !important;
}
.is-desktop #game-screen{
  height: calc(100vh - 64px) !important;
  overflow:hidden !important;
}
.is-desktop #map-view{
  height: 100% !important;
  overflow:hidden !important;
}
.is-desktop #map-container{ height: 100% !important; min-height: 0 !important; }
.is-desktop #map{ height: 100% !important; }
.is-desktop #sector-display, .is-desktop #left-panel, .is-desktop .hud-panel{
  overflow:auto !important;
  max-height: calc(100vh - 90px) !important;
}



/* --- Desktop grid stacking fixes (avoid overlaps) --- */
.is-desktop #map-view{
  grid-template-columns: 420px 1fr;
  grid-template-rows: auto auto auto 1fr;
  gap: 14px;
  align-items: start;
}
.is-desktop #map-container{
  grid-column: 2 / 3;
  grid-row: 1 / 5;
  min-height: 520px;
}
.is-desktop #sector-display,
.is-desktop #personal-stats-box,
.is-desktop #desktop-actions,
.is-desktop #combat-log{
  grid-column: 1 / 2 !important;
  grid-row: auto !important;
  position: static !important;
}
.is-desktop #desktop-actions{
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.is-desktop #desktop-actions .btn{
  width: 100%;
}


/* V39: terminal intrusion modal */
.modal{ position:fixed; inset:0; display:flex; align-items:center; justify-content:center; background:rgba(0,0,0,.72); z-index:9999; padding:16px;}
.modal.hidden{ display:none; }
.modal__panel{ width:min(680px, 96vw); border:1px solid var(--g, var(--accent)); background:rgba(0,0,0,.92); box-shadow:0 0 18px var(--accent-dim); max-height:90vh; display:flex; flex-direction:column; }
.modal__header{ display:flex; align-items:center; justify-content:space-between; padding:12px 12px; border-bottom:1px solid var(--accent-dim); }
.modal__title{ font-weight:700; letter-spacing:.12em; }
.modal__body{ padding:12px; overflow:auto; }
.modal__footer{ padding:12px; border-top:1px solid var(--accent-dim); display:flex; justify-content:flex-end; gap:10px; }
.terminal-box{ border:1px solid var(--accent-dim); padding:12px; }
.sep{ margin:10px 0; border-top:1px dashed var(--accent-dim); }
.mono{ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; white-space:pre-wrap; line-height:1.35; }
.dim{ opacity:.75; }


/* V40: button variants */
.btn{border:1px solid var(--line-dim); background:transparent; color:var(--g,var(--accent)); padding:10px 14px; font:inherit; cursor:pointer;}
.btn--primary{background:var(--accent-dim);}
.btn--ghost{background:transparent;}
.btn:active{transform:translateY(1px);} 

/* V41: speed rule + signal meter */
#hudSignal{ letter-spacing: .08em; }
#hudSignalText{ opacity:.9; }

/* V42: overspeed blink warning */
@keyframes overspeedBlink{
  0%,49% { opacity: 0.15; }
  50%,100% { opacity: 1; }
}
.hud-overspeed{
  display:none;
  margin-top:6px;
  padding:6px 8px;
  border:1px solid currentColor;
  text-align:center;
  letter-spacing: .12em;
  text-transform: uppercase;
}
body.overspeed .hud-overspeed{
  display:block;
  animation: overspeedBlink 0.8s steps(2,end) infinite;
}
body.overspeed .hud-overspeed{
  color: #ff5050;
  text-shadow: 0 0 6px rgba(255,80,80,.45);
}

/* V44: theme variables + overlay animation */
:root{
  --accent: var(--accent);
  --accent-dim: var(--accent-dim);
--accent-bg: var(--accent-dim);
}
body
.theme-green{
  --accent:#00ff41;
  --accent-dim: rgba(0,255,65,.35);
  --accent-bg: rgba(0,255,65,.12);
  --fg:#00ff41;
  --fg-dim: rgba(0,255,65,.65);
  --line: rgba(0,255,65,.55);
  --line-dim: rgba(0,255,65,.25);
  --glow:0 0 6px rgba(0,255,65,.35), 0 0 18px rgba(0,255,65,.12);
}
.theme-amber{
  --accent: #ffb000;
  --accent-dim: rgba(255,176,0,.35);
  --accent-bg: rgba(255,176,0,.12);
  --fg: #ffb000;
  --fg-dim: rgba(255,176,0,.65);
  --line: rgba(255,176,0,.55);
  --line-dim: rgba(255,176,0,.25);
  --glow:0 0 6px rgba(255,176,0,.35), 0 0 18px rgba(255,176,0,.12);
}
body, .modal__panel, .terminal-box{
  border-color: var(--accent-dim) !important;
}
.btn{ border-color: var(--accent-dim) !important; color: var(--accent) !important; }
.btn--primary{ background: var(--accent-bg) !important; }

@keyframes dots { 0%{content:"";} 33%{content:".";} 66%{content:"..";} 100%{content:"...";} }
#gpsInitText::after{ content:""; display:inline-block; width:1.5em; }
body.gps-wait #gpsInitText::after{ animation: dots 1.1s steps(1,end) infinite; }

/* V47: accent apply to map frames (game + world scan) */
#map, #ws-map, #map-container, #ws-map-container, .leaflet-container{
  border-color: var(--accent-dim) !important;
}
.leaflet-control-container .leaflet-control{
  border: 1px solid var(--accent-dim) !important;
}


/* V49: real desktop fit layout (no scroll, no browser zoom needed) */
html.is-desktop, html.is-desktop body{
  height: 100%;
  overflow: hidden !important;
}
html.is-desktop body{
  font-size: 18px;
}
html.is-desktop .terminal-container{
  width: 100vw !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 12px !important;
  height: 100vh;
  overflow: hidden !important;
}
html.is-desktop #map-view{
  display: grid !important;
  grid-template-columns: 360px 1fr !important;
  grid-template-rows: 1fr !important;
  gap: 12px !important;
  height: calc(100vh - 24px) !important;
  overflow: hidden !important;
}
html.is-desktop #map-container{
  grid-column: 2;
  grid-row: 1;
  height: 100% !important;
  min-height: 0 !important;
  border: 1px solid var(--accent-dim, var(--accent-dim));
  position: relative;
}
html.is-desktop #map, 
html.is-desktop .leaflet-container{
  height: 100% !important;
  min-height: 0 !important;
}
html.is-desktop #sector-display,
html.is-desktop #personal-stats-box,
html.is-desktop #combat-log,
html.is-desktop #login-btn,
html.is-desktop button.retro-btn-outline{
  grid-column: 1;
}
html.is-desktop #sector-display{
  margin: 0;
}
html.is-desktop #personal-stats-box{
  margin: 0;
}
html.is-desktop #combat-log{
  margin-top: 10px;
  height: auto;
  max-height: calc(100vh - 360px);
  overflow: auto;
  min-height: 120px;
  border: 1px solid var(--accent-dim, var(--accent-dim));
  padding: 10px;
}
html.is-desktop .retro-btn-outline, 
html.is-desktop #login-btn{
  width: 100%;
  margin-top: 10px;
  position: static !important;
}
html.is-desktop #locate-btn{
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 500;
}



/* V50: desktop map proportions */
html.is-desktop #map-view{
  grid-template-columns: minmax(260px, 300px) minmax(620px, 1fr) !important;
}
html.is-desktop #map-container{
  width: 100% !important;
}
html.is-desktop .sector-info,
html.is-desktop #personal-stats-box,
html.is-desktop #combat-log{
  width: 100% !important;
}


html.is-desktop .sector-info{padding:10px !important;}


/* V51: desktop layout fixes (map uses full vertical space, buttons no overlap) */
html.is-desktop #map-view{
  height: calc(100vh - 24px) !important;
  grid-template-columns: minmax(260px, 320px) minmax(720px, 1fr) !important;
  grid-template-rows: 1fr !important;
  align-items: stretch !important;
}
html.is-desktop #map-container{
  grid-column: 2 !important;
  grid-row: 1 !important;
  height: 100% !important;
  min-height: 0 !important;
}
html.is-desktop #map,
html.is-desktop #map-container .leaflet-container{
  height: 100% !important;
  min-height: 0 !important;
}
/* Left column becomes a vertical stack that can scroll internally */
html.is-desktop #sector-display,
html.is-desktop #personal-stats-box,
html.is-desktop #combat-log,
html.is-desktop #login-btn,
html.is-desktop .retro-btn-outline{
  grid-column: 1 !important;
}
html.is-desktop #sector-display,
html.is-desktop #personal-stats-box{
  margin: 0 !important;
}
html.is-desktop #login-btn,
html.is-desktop .retro-btn-outline{
  position: static !important;
  width: 100% !important;
  margin-top: 10px !important;
}
html.is-desktop #combat-log{
  margin-top: 12px !important;
  max-height: 45vh !important;
  overflow: auto !important;
}
/* Ensure leaderboard/worldscan buttons have spacing */
html.is-desktop #leaderboard-btn,
html.is-desktop #worldscan-btn,
html.is-desktop #btn-worldscan{
  margin-top: 10px !important;
}


html.is-desktop .left-col button{ width:100%; margin-top:10px; }


/* ===== v52 Desktop fit fix ===== */
@media (min-width: 900px) {
  body.is-desktop, body.is-desktop html {
    height: 100%;
    overflow: hidden;
  }
  body.is-desktop .terminal-container {
    max-width: min(1400px, calc(100vw - 32px)) !important;
    width: min(1400px, calc(100vw - 32px)) !important;
    min-width: 0 !important;
    min-height: calc(100vh - 24px);
    display: flex;
    flex-direction: column;
  }

  body.is-desktop #game-screen {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
  }

  /* Turn the existing #map-view into a 2-column desktop layout */
  body.is-desktop #map-view {
    display: grid !important;
    grid-template-columns: 360px 1fr;
    grid-template-rows: auto 1fr;
    gap: 12px;
    height: 100%;
    min-height: 0;
    align-items: start;
  }

  body.is-desktop #sector-display {
    grid-column: 1;
    grid-row: 1;
    margin: 0 !important;
  }

  body.is-desktop #hud-stack {
    grid-column: 1;
    grid-row: 2;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
  }

  body.is-desktop #action-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  body.is-desktop #map-container {
    grid-column: 2;
    grid-row: 1 / span 2;
    height: auto !important;
    min-height: 540px;
    max-height: calc(100vh - 210px);
  }

  body.is-desktop #map {
    height: 100% !important;
    min-height: 540px;
  }

  body.is-desktop #combat-log {
    flex: 1 1 auto;
    min-height: 120px;
    max-height: 220px;
    overflow: auto;
  }
}






/* V53: Desktop window-fit + taller map */
@media (min-width: 900px) {
  body.is-desktop { min-height: 100vh; }
  body.is-desktop header { position: sticky; top: 0; z-index: 5; }
  body.is-desktop #map-view { align-items: stretch; }
  body.is-desktop #map-container { flex: 1 1 auto; min-height: 0; }
  /* Make the main map use available vertical space */
  body.is-desktop #map { height: clamp(460px, 72vh, 900px); max-height: none; }
}

/* =============================
   v54: Desktop map full-height fix
   ============================= */

html.is-desktop, html.is-desktop body{
  height: 100%;
}

/* The shell is a column; map-view grows to fill remaining height */
html.is-desktop .terminal-container{
  min-height: 100vh;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

html.is-desktop #game-screen{
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

html.is-desktop #map-view{
  flex: 1 1 auto;
  min-height: 0;
  height: auto !important;
  overflow: hidden;
}

/* Ensure the desktop main row can stretch vertically */
html.is-desktop #desktop-main{
  flex: 1 1 auto;
  min-height: 0;
}

/* Override any earlier vh-based map sizing */
html.is-desktop #map-container{
  height: 100% !important;
  flex: 1 1 auto;
  min-height: 0;
}

html.is-desktop #map{
  height: 100% !important;
}

/* DESKTOP FULLHEIGHT OVERRIDE v54b 20260209-000001Z-v54b */
@media (min-width: 980px) {
  #app-shell { height: 100vh; }
  #main-wrap { flex: 1 1 auto; min-height: 0; }
  #map-container { height: auto !important; flex: 1 1 auto !important; min-height: 60vh; }
  #map { height: 100% !important; min-height: 60vh; }
}

/* =====================================================================
   DESKTOP MAP FULL-HEIGHT OVERRIDE (v54c)
   Fixes: map only drawing on the top strip (map container was not spanning rows).
   This block is appended LAST to win over earlier desktop rules.
   ===================================================================== */
html.is-desktop #map-view{
  display: grid !important;
  grid-template-columns: 360px 1fr !important;
  grid-template-rows: auto 1fr !important;
  gap: 18px !important;
  align-items: stretch !important;
  height: 100% !important;
  min-height: 0 !important;
}
html.is-desktop #sector-display{
  grid-column: 1 !important;
  grid-row: 1 !important;
}
html.is-desktop #hud-stack{
  grid-column: 1 !important;
  grid-row: 2 !important;
  min-height: 0 !important;
  overflow: auto !important;
}
html.is-desktop #map-container{
  grid-column: 2 !important;
  grid-row: 1 / span 2 !important;
  height: 100% !important;
  min-height: 0 !important;
}
html.is-desktop #map{
  height: 100% !important;
  min-height: 0 !important;
}


/* ===== Pointer-based layout separation ===== */
/* Desktop (mouse / trackpad) is the default. */
@media (pointer: fine){
  .app-shell{
    max-width: 1280px;
    width: min(1280px, calc(100vw - 32px));
    height: min(780px, calc(100vh - 32px));
  }
  .desktop-layout{
    display:grid;
    grid-template-columns: 360px 1fr;
    grid-template-rows: auto 1fr;
    gap: 14px;
    align-items: stretch;
  }
  #hud-panel{ height: 100%; overflow: hidden; }
  #map-wrap{ height: 100%; min-height: 520px; }
  #map{ height: 100%; }
}
/* Mobile / touch */
@media (pointer: coarse){
  .app-shell{
    width: min(480px, 92vw);
    height: auto;
  }
  .desktop-layout{
    display:block;
  }
  #map-wrap{ height: 58vh; min-height: 340px; }
  #map{ height: 100%; }
  #hud-panel{ margin-top: 10px; }
}

/* =====================================================================
   V62 MOBILE LAYOUT REFACTOR
   - Keep the existing DOM + IDs (no gameplay logic changes)
   - Drive layout via body.is-mobile / body.is-desktop (set in app.js)
   ===================================================================== */

/* App shell should size to the viewport on mobile */
body.is-mobile #app{max-width:520px;margin:0 auto;padding:12px;min-height:100vh;display:flex;flex-direction:column}
body.is-mobile #hudTop{flex:0 0 auto}
body.is-mobile #gameContent{flex:1 1 auto;min-height:0}

/* Mobile: stack sidebar under a taller map, keep buttons visible */
body.is-mobile #map-view{display:flex;flex-direction:column;gap:10px}
body.is-mobile #map-wrap{order:1;flex:1 1 auto;min-height:40vh}
body.is-mobile #map{height:100%;min-height:40vh;max-height:none}
body.is-mobile #hud-stack{order:2;display:grid;gap:10px}

/* Compact the info box so it doesn't eat the viewport */
body.is-mobile .info-box{padding:10px}
body.is-mobile .info-line{font-size:12px}

/* Action buttons: 3-wide grid when possible, wrap if needed */
body.is-mobile #action-buttons{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
body.is-mobile #action-buttons button{padding:12px 10px;font-size:13px;min-height:44px}
@media (pointer: coarse) and (max-width: 390px){
  body.is-mobile #action-buttons{grid-template-columns:repeat(2,1fr)}
}

/* Disabled action button state */
.retro-btn-outline.is-disabled{ opacity:.55; pointer-events:none; }

/* Intrusion list rows */
.intr-row{display:flex;align-items:center;gap:10px;padding:10px;border:1px solid var(--accent-dim);margin:8px 0;cursor:pointer;}
.intr-row:hover{box-shadow:0 0 12px var(--accent-dim);}
.intr-row.selected{outline:2px solid var(--g,var(--accent));}
.intr-ava{width:32px;height:32px;border-radius:50%;object-fit:cover;border:1px solid var(--accent-dim);background:rgba(255,255,255,.06)}
.intr-meta{display:flex;flex-direction:column;gap:2px;min-width:0}
.intr-small{opacity:.75;font-size:12px}

/* Reduce battlelog height on mobile */
body.is-mobile #battlelog{max-height:96px}

/* World Scan overlay: maximize usable map area on mobile */
body.is-mobile #ws-overlay .ws-body{grid-template-rows:1fr auto}
body.is-mobile #ws-map{min-height:60vh}



.ws-tooltip{
  background: rgba(0,0,0,.75);
  border: 1px solid var(--line);
  color: var(--fg);
  font-family: inherit;
  font-size: 12px;
  box-shadow: var(--glow);
}
.ws-cluster-own{ }
.ws-cluster-enemy{ }
.ws-cluster-mixed{ }
.leaflet-container{ background: rgba(0,0,0,.35); }


/* V56: unify theme vars so amber affects ALL frames + maps */
body.amber, body.theme-amber{
  --accent:#ffb000;
  --accent-dim: rgba(255,176,0,.35);
  --accent-bg: rgba(255,176,0,.12);
}
body:not(.amber):not(.theme-amber){
  --accent:var(--accent);
  --accent-dim: var(--accent-dim);
  --accent-bg: var(--accent-dim);
}
/* Tile tint for amber (subtle CRT phosphor shift) */
body.amber .leaflet-tile-pane, body.theme-amber .leaflet-tile-pane{
  filter: hue-rotate(18deg) saturate(1.25) brightness(1.02);
}


#map, #map-container, #ws-map, #worldscan-map { border-color: var(--accent-dim) !important; }


/* V57: readability fixes (CRT still there but not too dark) */
body{
  color: var(--fg) !important;
}
.topbar, .terminal-container, .sector-info, .terminal-box, .modal__panel{
  background: rgba(0,0,0,.78) !important;
}
.crt::before{
  opacity: .12 !important; /* scanlines */
}
.crt::after{
  opacity: .08 !important; /* vignette/flicker */
}
input, textarea{
  color: var(--fg) !important;
  background: rgba(0,0,0,.70) !important;
  border-color: var(--accent-dim) !important;
}
button, .btn, .retro-btn-outline, #login-btn{
  color: var(--fg) !important;
  border-color: var(--accent-dim) !important;
}



/* V57: definitive theme vars */
:root{
  --accent:#00ff41;
  --accent-dim: var(--accent-dim);
  --accent-bg: var(--accent-dim);
}
body.amber, body.theme-amber{
  --accent:#ffb000;
  --accent-dim: rgba(255,176,0,.35);
  --accent-bg: rgba(255,176,0,.12);
}


.leaflet-container, .leaflet-control-container .leaflet-control { border-color: var(--accent-dim) !important; }
.leaflet-control a{ color: var(--fg) !important; }


/* Safety: allow scroll if viewport is too short */
body.is-mobile #game-screen{overflow:auto}


/* ===== BLACK VECTOR: Responsive Layout Layers (Portrait vs Landscape) =====
   Goal:
   - Portrait: header at top, map full width under header, controls/info below.
   - Landscape: map on the RIGHT (full height), controls/info on the LEFT (scrollable).
   - Both: modal dialogs are full-usable and always have a close button.
*/

#map-view{
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#map-container{
  position: relative;
  width: 100%;
}

#left-panel{
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;

  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#map{
  width: 100%;
}

/* Portrait defaults (also used for forced portrait) */
body.layout-portrait #map-container,
body[data-layout="portrait"] #map-container{
  height: 44vh;
  min-height: 260px;
}
body.layout-portrait #map,
body[data-layout="portrait"] #map{
  height: 100%;
}

/* Landscape (orientation OR forced) */
@media (orientation: landscape){
  #map-view{
    display: grid;
    grid-template-columns: minmax(300px, 34vw) 1fr;
    grid-template-rows: 1fr;
    align-items: stretch;
    gap: 10px;
  }
  #left-panel{
    grid-column: 1;
    grid-row: 1;
    max-height: calc(100vh - 140px);
  }
  #map-container{
    grid-column: 2;
    grid-row: 1;
    height: calc(100vh - 140px);
    min-height: 320px;
  }
  #map{ height: 100%; }
}

body.layout-landscape #map-view,
body[data-layout="landscape"] #map-view{
  display: grid;
  grid-template-columns: minmax(300px, 34vw) 1fr;
  grid-template-rows: 1fr;
  align-items: stretch;
  gap: 10px;
}
body.layout-landscape #left-panel,
body[data-layout="landscape"] #left-panel{ grid-column: 1; }
body.layout-landscape #map-container,
body[data-layout="landscape"] #map-container{ grid-column: 2; }
body.layout-landscape #left-panel,
body[data-layout="landscape"] #left-panel{
  max-height: calc(100vh - 140px);
}
body.layout-landscape #map-container,
body[data-layout="landscape"] #map-container{
  height: calc(100vh - 140px);
  min-height: 320px;
}
body.layout-landscape #map,
body[data-layout="landscape"] #map{ height: 100%; }

/* ===== Modal close button ===== */
.modal-content,
.auth-modal-content{
  position: relative;
}

.modal-close{
  position: absolute;
  top: 10px;
  right: 10px;
  font-family: inherit;
  font-size: 22px;
  line-height: 1;
  padding: 6px 10px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.35);
  color: inherit;
  border-radius: 10px;
}

/* Make modals nearly full-screen on phones (portrait & landscape) */
@media (max-width: 900px){
  .modal-content,
  .auth-modal-content{
    width: calc(100vw - 16px);
    max-width: none;
    height: calc(100vh - 16px);
    max-height: none;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }
}


/* Start gate: before deploy, do not reveal in-game UI behind modals */
body.predeploy #map-view{display:none !important;}
body.predeploy #game-screen #hud, body.predeploy .hud-controls, body.predeploy #hud-clock{display:none !important;}



/* Start gate: before deploy, do not reveal in-game UI behind modals */
body.predeploy #map-view{display:none !important;}
body.predeploy .hud-controls,
body.predeploy #hud-clock,
body.predeploy #locate-btn,
body.predeploy #disconnect-btn,
body.predeploy #leaderboard-btn,
body.predeploy #login-btn{display:none !important;}

/* System error overlay (non-crash, user-friendly) */
#system-error-overlay{
  position:fixed; inset:0;
  z-index:100000;
  display:none;
  align-items:center;
  justify-content:center;
  background:rgba(0,0,0,0.86);
  padding:12px;
}
#system-error-overlay .system-error-card{
  width:min(92vw, 520px);
  border:2px solid rgba(255,68,68,.9);
  background:rgba(0,0,0,0.92);
  padding:14px;
  box-shadow:0 0 24px rgba(255,68,68,.25);
}
#system-error-overlay .system-error-title{
  font-family:var(--mono, monospace);
  color:#ff4444;
  letter-spacing:1px;
  margin-bottom:10px;
  text-transform:uppercase;
}
#system-error-overlay .system-error-msg{
  white-space:pre-wrap;
  font-family:var(--mono, monospace);
  font-size:12px;
  line-height:1.35;
  color:#ffb3b3;
  margin:0 0 12px 0;
  max-height:55vh;
  overflow:auto;
}
#system-error-overlay .system-error-actions{
  display:flex;
  justify-content:flex-end;
  gap:10px;
}


/* World Scan: true full-screen on phone landscape */
body.layout-landscape.is-mobile #worldscan-modal .worldscan-shell{
  width: calc(100vw - 16px);
  height: calc(100vh - 16px);
}
body.layout-landscape.is-mobile #worldscan-modal .worldscan-body{
  grid-template-columns: 1fr 300px;
}
@media (max-width: 900px){
  body.layout-landscape.is-mobile #worldscan-modal .worldscan-body{ grid-template-columns: 1fr 240px; }
}


/* V11: Mobile World Scan true edge-to-edge full screen (portrait + landscape) */
body.is-mobile #worldscan-modal{
  align-items:stretch;
  justify-content:stretch;
}
body.is-mobile #worldscan-modal .worldscan-shell{
  width: 100vw;
  height: var(--vh, 100vh);
  border-radius: 0;
}
body.is-mobile #worldscan-modal .worldscan-body{
  padding: 8px;
}

/* When auth/login modal is open, hide gameplay surface completely */
body.auth-open #app-shell,
body.auth-open #map-view,
body.auth-open #hud,
body.auth-open #left-panel{
  visibility: hidden !important;
}
body.auth-open #auth-modal{
  display:flex !important;
}


/* =========================================================
   UI63: CLEAN ORIENTATION LAYOUT (BLACK VECTOR baseline-safe)
   Uses body[data-layout="portrait"|"landscape"] set by app.js.
   - Portrait: Map under header, full width, fixed height; panels below.
   - Landscape: Map on RIGHT, full height; panels on LEFT (scroll).
   Notes:
   - This block is appended LAST to win over earlier experimental CSS.
   - No gameplay logic changes; UI only.
========================================================= */

:root{
  --gg-header-approx: 140px; /* header + status + margins */
  --gg-footer-approx: 52px;  /* ticker + build badge area */
  --gg-viewport-h: 100dvh;
}

body[data-layout="portrait"] #map-view{
  display:flex !important;
  flex-direction:column !important;
  gap:10px !important;
}

body[data-layout="portrait"] #map-container{
  width:100% !important;
  height: min(44vh, 420px) !important;
  min-height: 260px !important;
  flex: 0 0 auto !important;
}

body[data-layout="portrait"] #map{
  width:100% !important;
  height:100% !important;
}

body[data-layout="portrait"] #left-panel{
  width:100% !important;
  display:flex !important;
  flex-direction:column !important;
  gap:10px !important;
  min-height:0 !important;
  overflow:hidden !important;
}

body[data-layout="portrait"] #combat-log{
  min-height: 120px !important;
  max-height: 26vh !important;
}

/* LANDSCAPE: phone/tablet/desktop testing with ?layout=landscape */
body[data-layout="landscape"] #map-view{
  display:grid !important;
  grid-template-columns: minmax(320px, 38vw) 1fr !important;
  grid-template-rows: 1fr !important;
  gap: 12px !important;
  align-items: stretch !important;
}

body[data-layout="landscape"] #left-panel{
  grid-column:1 !important;
  grid-row:1 !important;
  min-width: 300px !important;
  min-height:0 !important;
  max-height: calc(var(--gg-viewport-h) - var(--gg-header-approx) - var(--gg-footer-approx)) !important;
  overflow:auto !important;
  -webkit-overflow-scrolling: touch !important;
  padding-right: 2px;
}

body[data-layout="landscape"] #map-container{
  grid-column:2 !important;
  grid-row:1 !important;
  height: calc(var(--gg-viewport-h) - var(--gg-header-approx) - var(--gg-footer-approx)) !important;
  min-height: 320px !important;
}

body[data-layout="landscape"] #map{
  width:100% !important;
  height:100% !important;
}

/* In landscape, keep the action buttons reachable */
body[data-layout="landscape"] #action-buttons{
  position: sticky;
  bottom: 0;
  padding: 10px 0 6px;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px);
  border-top: 1px dashed var(--line-dim);
}

/* Mobile modals: truly full-screen + always scrollable content */
@media (max-width: 900px){
  body.is-mobile #auth-modal .auth-modal-content,
  body.is-mobile #scores-modal .modal-content{
    width: 100vw !important;
    height: var(--gg-viewport-h) !important;
    max-height: none !important;
    border-radius: 0 !important;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)) !important;
  }
  body.is-mobile #auth-modal .modal-overlay,
  body.is-mobile #scores-modal .modal-overlay{
    display:none !important; /* tap outside on mobile can be awkward; close with X/CANCEL */
  }
}

/* Micro polish: make header/logo feel more "terminal" */
.logo-container{
  box-shadow: 0 0 0 1px var(--line-dim) inset, 0 0 18px rgba(0,0,0,.55);
}
.status-grid{
  background: rgba(0,0,0,.30);
  border: 1px solid var(--line-dim);
  padding: 6px 8px;
}

/* In-game floating online counter (top-right, next to the logo area) */
.players-online-overlay{
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 6px 10px;
  border: 1px solid var(--line-dim);
  background: rgba(0,0,0,.55);
  border-radius: 10px;
  box-shadow: 0 0 0 1px rgba(0,0,0,.4) inset, 0 0 18px rgba(0,0,0,.55);
  text-transform: uppercase;
  letter-spacing: .6px;
  font-size: 14px;
  line-height: 1;
  pointer-events: none;
  z-index: 50;
}


/* ===== UI64: Landscape width fix (ensure shell expands, prevent overflow) ===== */
@media (orientation: landscape){
  /* Make the main frame use the full viewport width in landscape (even on desktop while testing) */
  .terminal-container{
    width: 100vw !important;
    max-width: none !important;
    margin: 0 !important;
  }

  /* Grid children must be allowed to shrink without overflowing the frame */
  #map-view{ min-width: 0 !important; }
  #left-panel{ min-width: 0 !important; }
  #map-container{ min-width: 0 !important; }

  /* Prevent any accidental horizontal bleed */
  body{ overflow-x: hidden; }
}

/* Forced layout via ?layout=landscape */
body[data-layout="landscape"] .terminal-container,
body.layout-landscape .terminal-container{
  width: 100vw !important;
  max-width: none !important;
  margin: 0 !important;
}
body[data-layout="landscape"]{ overflow-x: hidden; }


/* ===============================
   UI65 – PORTRAIT SCROLL FIX
   Ensure action buttons (RANKINGS / WORLD SCAN / LOGIN) are always reachable
   on small heights and emulator landscape/portrait viewports.
   =============================== */

/* Let the info panel scroll (not the whole body) */
#left-panel{
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 14px; /* breathing room above ticker */
}

/* Keep the HUD stack flexible so the combat log can shrink before buttons disappear */
#hud-stack{
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#action-buttons{
  flex: 0 0 auto;
}

#combat-log{
  flex: 1 1 auto;
  min-height: 0;
}

/* In portrait, allow the panel to occupy the remaining space below the map */
@media (orientation: portrait){
  #map-view{ overflow: hidden; }
  #map-container{ flex: 0 0 auto; }
}



/* ===============================
   UI66 – PHONE INGAME SCALE + SCROLL
   Fix: on small phones (portrait) action buttons unreachable
        + improve ingame scaling/typography
        + fix combat log readability clipping in landscape
   =============================== */

/* Responsive base sizing for phones (keeps VT323 vibe but prevents oversized UI) */
@media (max-width: 480px){
  html,body{ font-size: 16px; }
  .logo-container{ font-size: 2.2rem; padding: 10px 6px; }
  .status-grid{ font-size: 0.85rem; padding: 4px 6px; }
  .sector-info{ padding: 6px; margin: 4px 0; }
  .personal-stats{ font-size: 1.15rem; padding: 6px; }
  .retro-btn, .retro-btn-outline, .modal-content button{ font-size: 1.35rem; padding: 9px 10px; }
}

/* Portrait: allow scrolling inside the ingame panel (body stays non-scroll for CRT feel) */
@media (orientation: portrait){
  body[data-layout="portrait"] main#game-screen,
  body.layout-portrait main#game-screen{
    overflow: hidden; /* keep main locked */
  }
  /* The scrollable region is the left panel (below the map) */
  body[data-layout="portrait"] #left-panel,
  body.layout-portrait #left-panel{
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  /* Reduce map height on small phone portrait so HUD has room */
  @media (max-width: 480px){
    #map{ height: min(34vh, 320px) !important; }
  }
  /* Keep action buttons always reachable while scrolling */
  #action-buttons{
    position: sticky;
    top: 0;
    z-index: 5;
    background: rgba(0,0,0,.55);
    padding: 8px 0 6px;
    border-bottom: 1px dashed var(--line-dim);
    backdrop-filter: blur(2px);
  }
}

/* Landscape: improve readability of combat log (fix half-cut glyphs) */
@media (orientation: landscape){
  #combat-log{
    line-height: 1.25 !important;
  }
  #combat-log *{
    line-height: 1.25 !important;
  }
}

/* General: combat log should wrap safely and never clip */
#combat-log{
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  padding-bottom: 12px;
  line-height: 1.25;
}


/* ===============================
   UI67 – MOBILE INGAME SCROLL + LOG CLIP FIX + ACTION BUTTON FRAMES
   - Fix retro-btn-outline borders (green/amber)
   - Ensure #combat-log text never clips in landscape
   - Ensure portrait ingame panel scroll works on real phones
================================== */

/* Define accent vars properly (some older blocks referenced them) */
body:not(.amber){
  --accent: #00ff41;
  --accent-dim: rgba(0,255,65,.45);
  --accent-bg: rgba(0,255,65,.10);
}
body.amber{
  --accent: #ffbf3a;
  --accent-dim: rgba(255,191,58,.45);
  --accent-bg: rgba(255,191,58,.10);
}
/* Keep --p aligned with accent for borders */
:root{ --p: var(--accent); }

/* Restore frames for the three action buttons */
.retro-btn-outline{
  border: 2px solid var(--p) !important;
  color: var(--fg) !important;
  background: rgba(0,0,0,.35);
  box-shadow: 0 0 0 1px rgba(0,0,0,.55) inset;
}
.retro-btn-outline:active{
  transform: translateY(1px);
}

/* Ingame scroll: on real phones, allow left panel to scroll within viewport */
@media (orientation: portrait){
  body[data-layout="portrait"] #game-shell{
    min-height: 0;
  }
  body[data-layout="portrait"] #left-panel{
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
    max-height: calc(100dvh - var(--header-h, 92px) - var(--map-h, 40dvh) - 42px);
    padding-bottom: 90px; /* ensure buttons can scroll above ticker */
  }
}

/* Combat log text clipping fix (glyph cut) */
#combat-log{
  line-height: 1.4 !important;
  padding-bottom: 16px !important;
  text-rendering: geometricPrecision;
}
#combat-log *{
  line-height: 1.4 !important;
}
#combat-log > div,
#combat-log > p{
  display:block;
  padding: 2px 0;
}

/* Extra safety in landscape */
@media (orientation: landscape){
  #combat-log{
    /* iOS/Safari can clip VT323 glyph descenders inside overflow containers.
       Use pixel line-height to avoid fractional rounding in landscape. */
    font-size: 16px !important;
    line-height: 22px !important;
    padding-top: 4px !important;
  }
  #combat-log *{
    line-height: 22px !important;
  }
}

/* =========================
   UI69: iOS/Safari landscape battlelog clipping hard fix
   - Some WebKit builds clip VT323 glyph descenders inside momentum-scrolling boxes.
   - Workaround: avoid fractional font metrics + give each line its own padding box.
   ========================= */
@media (orientation: landscape){
  #combat-log{
    -webkit-overflow-scrolling: touch;
    font-size: 18px !important;
    line-height: 28px !important;
    padding-top: 6px !important;
    padding-bottom: 22px !important;
    transform: translateZ(0);
  }
  #combat-log *{
    line-height: 28px !important;
  }
  #combat-log > div{
    display: block;
    padding: 2px 0 6px !important; /* extra bottom room for descenders */
    overflow: visible;
  }
}


/* ==============================
   UI72: THEME ACCENT FIX (SAFE)
   Reason: --p is defined on :root, so --accent must also live on :root/html.
   We switch --accent via html.amber (html gets class "amber" in app.js).
   This only affects borders/colors that rely on var(--accent)/var(--p).
   ============================== */
html:not(.amber){
  --accent:#00ff41;
  --accent-dim: rgba(0,255,65,.45);
  --accent-bg: rgba(0,255,65,.10);
}
html.amber{
  --accent:#ffbf3a;
  --accent-dim: rgba(255,191,58,.45);
  --accent-bg: rgba(255,191,58,.10);
}
/* Keep derived token in sync */
:root{ --p: var(--accent); }



/* === BLACK VECTOR: Visual Distortion Layer (ABC) === */
.gg-typoglyph{
  letter-spacing: 0.06em;
  filter: blur(0.15px);
}

.gg-font-desync{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace !important;
  letter-spacing: 0.12em;
  text-shadow: 0 0 0.5px currentColor;
}

#gg-noise-overlay{
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.06;
  mix-blend-mode: overlay;
  background-image:
    repeating-linear-gradient(
      0deg,
      rgba(255,255,255,0.05) 0px,
      rgba(255,255,255,0.05) 1px,
      rgba(0,0,0,0.00) 2px,
      rgba(0,0,0,0.00) 4px
    ),
    repeating-linear-gradient(
      90deg,
      rgba(0,0,0,0.04) 0px,
      rgba(0,0,0,0.04) 1px,
      rgba(0,0,0,0.00) 3px,
      rgba(0,0,0,0.00) 6px
    );
}

#gg-noise-overlay.gg-noise-strong{
  opacity: 0.10;
}

.gg-drift{
  will-change: transform;
}


/* Splash background per orientation */
@media (orientation: portrait){
  #splash-screen{ background-image:url('splash_mobile.webp'); }
}

/* Boot prompt */
.boot-prompt{
  margin-top:14px;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:10px;
}
.boot-ready{
  font-family:monospace;
  letter-spacing:1px;
  font-size:12px;
  opacity:0.9;
}
.boot-subhint{
  font-family:monospace;
  font-size:11px;
  opacity:0.65;
}
.boot-continue{
  min-width:220px;
}
#splash-screen{ cursor:pointer; }
#splash-screen:focus{ outline:2px solid var(--p); outline-offset:-6px; }


/* --- BLACK VECTOR: Lore Transient Overlay (centered, non-modal) --- */
.gg-lore-overlay{
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 180ms ease;
  z-index: 9999;
}
.gg-lore-overlay.show{
  opacity: 1;
}
.gg-lore-card{
  max-width: min(640px, calc(100vw - 48px));
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.35);
  backdrop-filter: blur(6px);
}
.gg-lore-text{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 13px;
  line-height: 1.35;
  letter-spacing: 0.3px;
  color: rgba(255,255,255,0.88);
  text-align: left;
  white-space: pre-line;
}


/* --- Rankings signature --- */
.bv-signature{
  margin-top:10px;
  padding-top:8px;
  border-top:1px solid rgba(255,255,255,0.12);
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  opacity:0.9;
}

.bv-signature-logo{
  height:22px;
  width:auto;
  display:block;
  filter: drop-shadow(0 0 6px rgba(255, 180, 80, 0.20));
}

.bv-signature-text{
  font-size:0.72rem;
  letter-spacing:0.12em;
  opacity:0.85;
}
@media (max-width: 520px){
  .bv-signature-logo{ height:18px; }
  .bv-signature-text{ font-size:0.68rem; }
}


/* --- Owner avatar in HUD --- */
.owner-photo{
  width: 18px;
  height: 18px;
  border-radius: 50%;
  vertical-align: -4px;
  margin: 0 6px 0 6px;
  display: none;
  border: 1px solid rgba(0,255,65,.35);
}

/* --- Erosion visual indicator on map tiles (Leaflet paths) --- */
.bv-erosion-active{
  stroke-dasharray: 6 6;
  animation: bvErosionPulse 1.8s linear infinite;
  filter: drop-shadow(0 0 6px rgba(255,180,0,.35));
}
@keyframes bvErosionPulse{
  0%{ stroke-opacity: .55; }
  50%{ stroke-opacity: 1; }
  100%{ stroke-opacity: .55; }
}

/* --- Leaderboard rows with avatars --- */
#leaderboard-list{
  text-align:left;
}
.lb-row{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 8px;
  border-bottom:1px solid rgba(0,255,65,.12);
}
.lb-avatar{
  width:26px;
  height:26px;
  border-radius:50%;
  flex:0 0 auto;
  border:1px solid rgba(0,255,65,.35);
}
.lb-name{
  flex:1 1 auto;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.lb-val{
  flex:0 0 auto;
  opacity:.9;
}


/* ===== DEADLOCK VISUALS ===== */
#deadlock-banner{
  position:absolute;
  top:10px;
  left:50%;
  transform:translateX(-50%);
  width:calc(100% - 20px);
  text-align:center;
  font-family:'VT323', monospace;
  font-size:34px;
  letter-spacing:2px;
  color:#ff2a2a;
  text-shadow:0 0 12px rgba(255,42,42,.65);
  z-index:1200;
  pointer-events:none;
}
#deadlock-banner.hidden{ display:none; }
@keyframes bvDeadlockBannerBlink{
  0%{ opacity:1; }
  50%{ opacity:.25; }
  100%{ opacity:1; }
}
#deadlock-banner.blinking{
  animation:bvDeadlockBannerBlink 1.2s infinite;
}

@keyframes bvDeadlockStroke{
  0%{ stroke:#ff2a2a; filter:drop-shadow(0 0 8px rgba(255,42,42,.55)); }
  50%{ stroke:#ff8c1a; filter:drop-shadow(0 0 8px rgba(255,140,26,.55)); }
  100%{ stroke:#ff2a2a; filter:drop-shadow(0 0 8px rgba(255,42,42,.55)); }
}
.leaflet-interactive.bv-deadlock{
  animation:bvDeadlockStroke .9s infinite;
  stroke-width:4 !important;
}
/* ===== END DEADLOCK VISUALS ===== */


/* === PROXIMITY / INTERFERENCE VISUALS === */

.signal-banner{
  position:absolute;
  top:10px;
  left:50%;
  transform:translateX(-50%);
  width:calc(100% - 24px);
  max-width:780px;
  text-align:center;
  font-family:'VT323', monospace;
  font-size:44px;
  letter-spacing:2px;
  padding:6px 10px;
  z-index: 900;
  pointer-events:none;
  text-shadow: 0 0 10px rgba(255,0,0,0.35);
}
.signal-banner.hidden{ display:none; }

@keyframes bvSignalPulse {
  0%{ opacity:0.25; filter:blur(0px); }
  50%{ opacity:1; filter:blur(0.2px); }
  100%{ opacity:0.25; filter:blur(0px); }
}
.signal-banner.pulse{
  animation: bvSignalPulse 1.6s infinite;
}

.signal-banner.interference{
  color:#ff3b3b;
}
.signal-banner.proximity{
  color:#ff3b3b;
  text-shadow: 0 0 14px rgba(255,0,0,0.55);
}

.signal-interference-layer{
  position:absolute;
  inset:0;
  z-index: 850;
  pointer-events:none;
  mix-blend-mode: screen;
  opacity:0;
  background-image:
    repeating-linear-gradient(0deg, rgba(255,255,255,0.06) 0px, rgba(255,255,255,0.06) 1px, rgba(0,0,0,0) 3px, rgba(0,0,0,0) 6px),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.03) 0px, rgba(255,255,255,0.03) 1px, rgba(0,0,0,0) 2px, rgba(0,0,0,0) 7px);
  filter: contrast(110%) saturate(120%);
}

@keyframes bvInterferenceDrift {
  0%{ background-position: 0 0, 0 0; transform: translateZ(0); }
  50%{ background-position: 0 18px, 22px 0; }
  100%{ background-position: 0 0, 0 0; }
}
.signal-interference-layer.active{
  animation: bvInterferenceDrift 1.3s infinite linear;
}

.signal-interference-layer.hidden{ display:none; }

.signal-interference-layer.mode-interference{ opacity:0.14; }
.signal-interference-layer.mode-proximity{ opacity:0.30; }



/* --- CAPTURE DISABLED (overspeed > 10 km/h) --- */
#capture-disabled-banner{
  position:absolute;
  top:58px;
  left:50%;
  transform:translateX(-50%);
  width:calc(100% - 24px);
  max-width:780px;
  text-align:center;
  font-family:'VT323', monospace;
  font-size:34px;
  letter-spacing:2px;
  color:#ffcc33;
  text-shadow:0 0 10px rgba(255,204,51,.45);
  z-index: 850;
  pointer-events:none;
  opacity:0.0;
}
body.overspeed #capture-disabled-banner:not(.hidden){
  animation:capturePulse 1.8s ease-in-out infinite;
}
@keyframes capturePulse{
  0%{ opacity:.25; }
  50%{ opacity:.95; }
  100%{ opacity:.25; }
}
