* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --accent: #ffd23e;
  --accent-dim: #b8860b;
  --danger: #ff5449;
  --warn: #ffcc33;
  --panel-bg: rgba(23, 66, 110, 0.92);
  --panel-border: #0e3a63;
  --btn-top: #ffb14d;
  --btn-bottom: #f68b1f;
  --btn-border: #8a4d0f;
  font-family: 'Trebuchet MS', 'Arial Rounded MT Bold', Arial, sans-serif;
}

html, body {
  width: 100%; height: 100%;
  background: #123d66;
  color: #f2f7ff;
  overflow: hidden;
  font-family: 'Trebuchet MS', 'Arial Rounded MT Bold', Arial, sans-serif;
  user-select: none;
}

#app { position: relative; width: 100vw; height: 100vh; }

.screen {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, #2f74b5 0%, #123d66 100%);
}
.hidden { display: none !important; }

/* ---------- Menu ---------- */
.title-wrap { text-align: center; margin-bottom: 40px; }
.game-title {
  font-size: 5.2rem;
  letter-spacing: 0.12em;
  font-weight: 900;
  color: #ffd23e;
  -webkit-text-stroke: 3px #7a3d05;
  text-shadow: 0 6px 0 #7a3d05, 0 10px 18px rgba(0,0,0,0.4);
}
.subtitle {
  letter-spacing: 0.4em;
  color: #cfe4ff;
  margin-top: 8px;
  text-transform: uppercase;
  font-size: 0.9rem;
}
.menu-panel { display: flex; flex-direction: column; gap: 14px; width: 320px; }
.menu-btn {
  font-family: inherit;
  background: linear-gradient(180deg, var(--btn-top), var(--btn-bottom));
  border: 3px solid var(--btn-border);
  border-radius: 16px;
  color: #fff;
  font-weight: 800;
  padding: 14px 18px;
  font-size: 1.05rem;
  letter-spacing: 0.08em;
  cursor: pointer;
  box-shadow: 0 5px 0 var(--btn-border), 0 8px 14px rgba(0,0,0,0.35);
  text-shadow: 0 2px 0 rgba(0,0,0,0.3);
  transition: transform 0.08s, filter 0.15s;
}
.menu-btn:hover { filter: brightness(1.1); }
.menu-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--btn-border); }
.version { position: absolute; bottom: 12px; right: 16px; font-size: 0.7rem; color: #7fa8cf; }

.panel {
  background: var(--panel-bg);
  border: 4px solid var(--panel-border);
  border-radius: 22px;
  padding: 32px 40px;
  max-width: 640px;
  width: 90%;
  box-shadow: 0 10px 0 rgba(9,30,52,0.9), 0 18px 34px rgba(0,0,0,0.45);
}
.panel h2 { color: #ffd23e; letter-spacing: 0.15em; margin-bottom: 16px; }
.scroll-panel { max-height: 85vh; overflow-y: auto; }

.howto-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 24px; margin: 16px 0 20px; }
.howto-grid > div { display: flex; justify-content: space-between; border-bottom: 1px dashed rgba(255,255,255,0.2); padding-bottom: 4px; }
.howto-grid b { color: var(--warn); margin-right: 10px; }
.howto-grid span { color: #dcebff; text-align: right; }
.hint { color: #c4dcf5; font-size: 0.85rem; line-height: 1.5; margin-bottom: 20px; }

.briefing-label { color: var(--warn); letter-spacing: 0.3em; font-size: 0.8rem; margin-bottom: 6px; }
#briefing-text { color: #dcebff; line-height: 1.5; margin-bottom: 16px; }
.objectives { margin-bottom: 22px; display: flex; flex-direction: column; gap: 6px; }
.objectives div { color: #eaf3ff; font-size: 0.9rem; }
.objectives div::before { content: "▸ "; color: var(--accent); }

/* ---------- Game ---------- */
#screen-game { padding: 0; background: #000; }
/* soft permanent vignette over the 3D view (under the HUD) */
#screen-game::after {
  content: '';
  position: absolute; inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,8,0.32) 100%);
  z-index: 3;
}
#game-canvas {
  display: block;
  width: 100%; height: 100%;
  cursor: none;
}

#hud { position: absolute; inset: 0; pointer-events: none; font-size: 0.85rem; z-index: 8; } /* above the night-darkness overlay canvas (z 5) */

#hud-top-left { position: absolute; top: 16px; left: 16px; width: 220px; display: flex; flex-direction: column; gap: 6px; }
#score-hud {
  position: absolute; top: 68px; left: 16px;
  background: var(--panel-bg); border: 3px solid var(--panel-border); border-radius: 12px;
  color: #ffd23e; font-weight: 800; font-size: 0.85rem; padding: 4px 12px;
}
#grenade-count { color: #9fe08a; font-weight: 800; font-size: 0.8rem; }
#menu-points {
  margin-top: 18px; color: #ffd23e; font-weight: 800; letter-spacing: 0.06em;
  background: rgba(9,30,52,0.6); border: 3px solid var(--panel-border); border-radius: 12px;
  padding: 6px 18px;
}
.bar-row { display: flex; align-items: center; gap: 8px; }
.bar-label { width: 34px; font-size: 0.7rem; color: #cfe4ff; font-weight: 700; letter-spacing: 0.05em; }
.bar { flex: 1; height: 16px; background: rgba(9,30,52,0.75); border: 2px solid #0e3a63; border-radius: 9px; position: relative; overflow: hidden; }
.bar-fill { height: 100%; width: 100%; transition: width 0.15s linear; }
.health-bar .bar-fill { background: linear-gradient(90deg, #7a1616, #ff4d4d); }
.stamina-bar .bar-fill { background: linear-gradient(90deg, #16607a, #4dd2ff); }

#alert-indicator {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px;
  background: var(--panel-bg); border: 3px solid var(--panel-border); border-radius: 14px; padding: 6px 16px;
  letter-spacing: 0.2em; font-size: 0.75rem;
}
#alert-icon { font-size: 1rem; color: #7dff8a; }
#alert-indicator.suspicious { border-color: var(--warn); }
#alert-indicator.suspicious #alert-icon, #alert-indicator.suspicious #alert-text { color: var(--warn); }
#alert-indicator.alert { border-color: var(--danger); animation: pulse 0.6s infinite; }
#alert-indicator.alert #alert-icon, #alert-indicator.alert #alert-text { color: var(--danger); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.55; } }

#hud-objective {
  position: absolute; top: 16px; right: 16px; max-width: 260px;
  background: var(--panel-bg); border: 3px solid var(--panel-border); border-radius: 14px; padding: 8px 12px;
  font-size: 0.75rem; color: #eaf3ff;
}
#objective-list div { margin-bottom: 3px; }
#objective-list div.done { color: #8aa8c8; text-decoration: line-through; }

#hud-bottom {
  position: absolute; bottom: 16px; left: 16px; right: 16px;
  display: flex; justify-content: space-between; align-items: flex-end;
}
#weapon-panel {
  background: var(--panel-bg); border: 3px solid var(--panel-border); border-radius: 14px;
  padding: 8px 14px; min-width: 200px;
}
#weapon-name { color: #ffd23e; font-weight: 800; letter-spacing: 0.05em; font-size: 0.9rem; }
#ammo-count { font-size: 1.3rem; color: #eef; letter-spacing: 0.05em; }
#weapon-slots { display: flex; gap: 4px; margin-top: 6px; }
.weapon-slot {
  width: 22px; height: 22px; border: 2px solid #0e3a63; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; color: #9db9d9; background: rgba(9,30,52,0.6);
}
.weapon-slot.active { border-color: #ffd23e; color: #ffd23e; background: rgba(255,210,62,0.18); }
.weapon-slot.empty { opacity: 0.25; }

#minimap-wrap {
  display: flex; flex-direction: column; align-items: flex-end; gap: 6px;
}
#minimap-canvas {
  border: 3px solid var(--panel-border); border-radius: 14px;
  background: rgba(9,30,52,0.6);
}
/* current-zone indicator, pops when the player enters a new zone */
#zone-indicator {
  background: var(--panel-bg); border: 3px solid var(--panel-border); border-radius: 12px;
  color: #ffd23e; font-weight: 800; letter-spacing: 0.08em; font-size: 0.8rem;
  padding: 5px 14px;
  max-width: 220px; text-align: center;
}
#zone-indicator.pop { animation: zonepop 0.35s ease-out; }
@keyframes zonepop {
  0% { transform: scale(0.6); opacity: 0; }
  60% { transform: scale(1.12); opacity: 1; }
  100% { transform: scale(1); }
}

#crosshair {
  position: absolute; top: 50%; left: 50%; width: 16px; height: 16px; transform: translate(-50%,-50%);
  border: 1px solid rgba(255,255,255,0.6); border-radius: 50%;
}
#crosshair::before, #crosshair::after {
  content: ""; position: absolute; background: rgba(255,255,255,0.7);
}
#crosshair::before { top: 50%; left: -6px; width: 4px; height: 1px; transform: translateY(-50%); }
#crosshair::after { top: -6px; left: 50%; width: 1px; height: 4px; transform: translateX(-50%); }

#hit-marker {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  color: var(--danger); font-size: 1.4rem; font-weight: bold; opacity: 0;
}
#hit-marker.show { animation: hitflash 0.25s ease-out; }
@keyframes hitflash { 0% { opacity: 1; transform: translate(-50%,-50%) scale(1.4);} 100% { opacity: 0; transform: translate(-50%,-50%) scale(1);} }

#damage-vignette {
  position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 0 0 rgba(255,0,0,0);
  transition: box-shadow 0.2s;
}
#damage-vignette.hit { box-shadow: inset 0 0 120px 40px rgba(255,0,0,0.55); }

#interact-prompt {
  position: absolute; bottom: 45%; left: 50%; transform: translateX(-50%);
  background: var(--panel-bg); border: 3px solid #ffd23e; border-radius: 12px; color: #ffd23e;
  font-weight: 800; padding: 5px 14px; font-size: 0.8rem;
}

/* ---------- Touch controls ---------- */
#touch-controls { position: absolute; inset: 0; pointer-events: none; z-index: 20; }
.touch-zone {
  position: absolute; bottom: 0; height: 80%; pointer-events: auto; touch-action: none;
}
#touch-move { left: 0; width: 46%; }
/* right side = fire-on-touch pad (fills the lower-right, below the buttons) */
#touch-aim { right: 0; width: 54%; height: 62%; }

.stick-base, .stick-knob {
  position: absolute; border-radius: 50%; transform: translate(-50%, -50%);
  pointer-events: none; opacity: 0; transition: opacity 0.12s;
}
.stick-base {
  width: 118px; height: 118px; border: 2px solid rgba(125,255,138,0.4);
  background: rgba(125,255,138,0.06);
}
/* inner ring marks the silent-walk zone; past it = running (audible) */
.stick-base:not(.aim)::after {
  content: '';
  position: absolute; inset: 18%;
  border: 1.5px dashed rgba(125,255,138,0.4);
  border-radius: 50%;
}
.stick-knob.running {
  background: rgba(255,170,60,0.4);
  border-color: rgba(255,170,60,0.85);
}
.stick-base.aim { border-color: rgba(255,90,90,0.45); background: rgba(255,90,90,0.06); }
.stick-knob {
  width: 52px; height: 52px; background: rgba(125,255,138,0.35);
  border: 2px solid rgba(125,255,138,0.7);
}
.stick-knob.aim { background: rgba(255,90,90,0.35); border-color: rgba(255,90,90,0.75); }
.stick-base.active, .stick-knob.active { opacity: 1; }

/* action buttons sit high on the right so they never clash with the fire
   pad your thumb holds at the bottom-right */
#touch-buttons {
  position: absolute; right: 12px; top: calc(env(safe-area-inset-top, 0px) + 64px);
  display: flex; flex-direction: column; gap: 10px;
  align-items: center; pointer-events: none;
}
.touch-btn {
  pointer-events: auto; touch-action: none;
  width: 56px; height: 56px; border-radius: 50%;
  background: rgba(10,20,10,0.55); border: 2px solid var(--panel-border);
  color: var(--accent); font-family: inherit; font-size: 0.72rem; letter-spacing: 0.05em;
  display: flex; align-items: center; justify-content: center;
}
.touch-btn.pressed { background: rgba(125,255,138,0.3); }
.touch-btn.small {
  position: absolute; top: calc(env(safe-area-inset-top, 0px) + 10px); right: 12px;
  width: 44px; height: 44px; font-size: 0.9rem;
}

/* D-pad (button control mode) */
#dpad {
  position: absolute; left: 18px; bottom: 40px;
  display: grid;
  grid-template-areas: ". u ." "l . r" ". d .";
  grid-template-columns: 62px 62px 62px;
  grid-template-rows: 62px 62px 62px;
  gap: 4px;
  pointer-events: none;
}
.touch-btn.dp { pointer-events: auto; width: 62px; height: 62px; font-size: 1.1rem; border-radius: 14px; }
.touch-btn.side {
  position: absolute; left: 216px; bottom: 108px;
  width: 70px; height: 54px; border-radius: 14px; font-size: 0.66rem;
}
.touch-btn.side.run { bottom: 44px; }

/* Options screen */
.opt-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.opt-label { font-weight: 800; color: #cfe4ff; letter-spacing: 0.06em; font-size: 0.85rem; }
.opt-control { display: flex; align-items: center; gap: 10px; }
.opt-control.seg { flex-wrap: wrap; }
.seg-btn {
  font-family: inherit; font-weight: 800; font-size: 0.8rem;
  padding: 8px 14px; border-radius: 12px; cursor: pointer;
  background: rgba(9,30,52,0.6); color: #9db9d9; border: 2px solid #0e3a63;
}
.seg-btn.active { background: linear-gradient(180deg, var(--btn-top), var(--btn-bottom)); color: #fff; border-color: var(--btn-border); }
#opt-brightness { width: 180px; accent-color: #f68b1f; }
#opt-brightness-val { color: #ffd23e; font-weight: 800; min-width: 48px; }

/* Body in touch mode hides the mouse crosshair */
body.touch-mode #crosshair { display: none; }
body.touch-mode #game-canvas { cursor: default; }

/* ---------- Responsive (small screens / mobile) ---------- */
@media (max-width: 820px), (pointer: coarse) {
  .game-title { font-size: 3.2rem; }
  .menu-panel { width: 84vw; max-width: 340px; }
  #hud { font-size: 0.95rem; }
  #hud-top-left { width: 42vw; max-width: 200px; top: 10px; left: 10px; }
  #hud-objective { max-width: 40vw; font-size: 0.7rem; top: 10px; right: 10px; }
  #weapon-panel { min-width: 130px; padding: 6px 10px; }
  #ammo-count { font-size: 1.1rem; }
  #minimap-canvas { width: 110px; height: 110px; }
  .weapon-slot { width: 18px; height: 18px; }
  .panel { padding: 22px 20px; }
  .howto-grid { grid-template-columns: 1fr; }
}
@media (max-height: 480px) {
  #hud-top-left { top: 6px; }
  #minimap-canvas { width: 92px; height: 92px; }
}

#pause-overlay { background: rgba(0,0,0,0.75); pointer-events: all; }
#pause-overlay .menu-btn { margin-top: 10px; width: 260px; }

#end-stats { color: #cfe6cf; line-height: 1.8; margin-bottom: 20px; font-size: 0.9rem; }
#screen-end .menu-btn { width: 280px; margin-top: 8px; }

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-thumb { background: var(--panel-border); }

/* ---- hub / salon ---- */
#hub-points { color: #ffd23e; font-weight: bold; margin-bottom: 10px; letter-spacing: 0.08em; }
.hub-section { color: #9fd89f; letter-spacing: 0.2em; font-size: 0.8rem; margin: 14px 0 8px; text-align: left; }
.hub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 7px; }
.hub-mission {
  padding: 10px 0; font-family: inherit; font-weight: bold; font-size: 0.95rem;
  background: var(--btn-bg, #1d3557); color: #e8f1ff; border: 2px solid var(--btn-border, #0f2340);
  border-radius: 8px; cursor: pointer;
}
.hub-mission.selected { background: #ffd23e; color: #1a2233; border-color: #b8901c; }
.hub-mission.locked { opacity: 0.32; cursor: default; }
.hub-mission-name { color: #cfe6cf; font-size: 0.85rem; margin-top: 8px; min-height: 1.2em; text-align: left; }
.hub-weapons { display: flex; flex-wrap: wrap; gap: 7px; }
.hub-weapon {
  padding: 9px 13px; font-family: inherit; font-size: 0.8rem; font-weight: bold;
  background: var(--btn-bg, #1d3557); color: #e8f1ff; border: 2px solid var(--btn-border, #0f2340);
  border-radius: 8px; cursor: pointer;
}
.hub-weapon.selected { background: #2f7d4f; border-color: #1c5133; }
.hub-weapon.locked { opacity: 0.32; cursor: default; }
.hub-weapon.dimmed { opacity: 0.4; cursor: default; } /* loadout full */
.hub-weapon-wrap { display: flex; flex-direction: column; gap: 4px; }
.hub-sil { font-size: 0.62rem; font-weight: bold; letter-spacing: 0.04em; text-align: center; }
.hub-sil.on { color: #7de3a0; }
.hub-sil.never { color: #d98a6a; }
.hub-sil-buy {
  width: 100%; padding: 4px 6px; font-family: inherit; font-size: 0.62rem; font-weight: bold;
  background: #2a2f45; color: #ffd23e; border: 2px solid #43496a; border-radius: 6px; cursor: pointer;
}
.hub-sil-buy.poor { opacity: 0.45; }
.hub-actions { display: flex; gap: 10px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.hub-actions .menu-btn { margin-top: 0; }

/* inline vector icons (replace OS emoji) */
.ic { width: 0.9em; height: 0.9em; fill: currentColor; vertical-align: -0.1em; margin-right: 3px; }
#grenade-count .ic { width: 0.95em; height: 0.95em; }

/* ---------------------------------------------------------------------------
   Modern lobby: full-screen shell with a character showcase on top and a
   bottom tab bar (missions / agents / shop / loadout / career).
   --------------------------------------------------------------------------- */
#screen-hub { padding: 0; align-items: stretch; justify-content: flex-start; }
.lobby {
  width: 100%; height: 100%; max-width: 780px; margin: 0 auto;
  display: flex; flex-direction: column; overflow: hidden;
  background: linear-gradient(180deg, #16233d 0%, #101a2e 55%, #0c1425 100%);
}

/* --- top bar: rank badge, XP track, wallet --- */
.lobby-top {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-bottom: 2px solid #21324f; flex: 0 0 auto;
}
.lb-rank-badge {
  width: 40px; height: 40px; flex: 0 0 auto; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, #ffc24d, #f08a20);
  border: 2px solid #8a4d0f; color: #21160a; font-weight: 900; font-size: 1.05rem;
}
.lb-rank-info { flex: 1 1 auto; min-width: 0; text-align: left; }
.lb-rank-name { color: #cfe0ff; font-size: 0.68rem; font-weight: 800; letter-spacing: 0.16em; }
.lb-xp-track { height: 7px; margin-top: 4px; background: #0b1526; border-radius: 4px; overflow: hidden; border: 1px solid #24365a; }
.lb-xp-fill { height: 100%; width: 0%; background: linear-gradient(90deg, #4fa9ff, #8ad2ff); transition: width 0.3s; }
.lb-xp-text { color: #7f96bb; font-size: 0.56rem; margin-top: 2px; letter-spacing: 0.06em; }
.lb-wallet {
  color: #ffd23e; font-weight: 900; font-size: 0.9rem; letter-spacing: 0.04em;
  background: #0e1a2e; border: 2px solid #2b3f63; border-radius: 10px; padding: 7px 11px;
  margin: 0; white-space: nowrap;
}
.lb-close {
  width: 34px; height: 34px; flex: 0 0 auto; border-radius: 10px; cursor: pointer;
  background: #182741; border: 2px solid #2b3f63; color: #9fb6d8; font-size: 0.9rem; font-family: inherit;
}
.lb-close:active { transform: translateY(2px); }

/* --- stage: live 3D agent --- */
/* fixed share of the screen: big enough for the agent to be the hero of the
   lobby, bounded so the panel below always keeps its room */
.lobby-stage { position: relative; flex: 0 0 40%; min-height: 175px; overflow: hidden; }
#lobby-canvas { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
#lobby-canvas:active { cursor: grabbing; }
.stage-badges { position: absolute; left: 14px; top: 12px; text-align: left; pointer-events: none; }
.stage-agent { color: #fff; font-size: 1.5rem; font-weight: 900; letter-spacing: 0.06em; text-shadow: 0 2px 8px rgba(0,0,0,0.6); }
.stage-role { color: #ffd23e; font-size: 0.63rem; font-weight: 800; letter-spacing: 0.22em; margin-top: 1px; }
.stage-skin { color: #86a3cc; font-size: 0.6rem; font-weight: 700; letter-spacing: 0.12em; margin-top: 7px; }
.stage-perks { position: absolute; right: 12px; top: 12px; display: flex; flex-direction: column; gap: 4px; align-items: flex-end; pointer-events: none; }
.perk-chip {
  background: rgba(12,22,40,0.82); border: 1px solid #2f4a72; border-radius: 20px;
  padding: 3px 10px; font-size: 0.56rem; font-weight: 800; letter-spacing: 0.05em; color: #9fe8b4;
}
.perk-chip.bad { color: #ff9a8a; }
.lb-daily {
  position: absolute; left: 14px; bottom: 12px; padding: 8px 14px; cursor: pointer;
  font-family: inherit; font-size: 0.66rem; font-weight: 900; letter-spacing: 0.1em;
  background: linear-gradient(180deg, #ffd75e, #f0a020); color: #2a1c05;
  border: 2px solid #8a5a0f; border-radius: 11px; box-shadow: 0 4px 0 #8a5a0f;
  animation: dailyPulse 1.5s ease-in-out infinite;
}
@keyframes dailyPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.06); } }

/* --- tab panels --- */
.lobby-panels { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 12px 14px 8px; -webkit-overflow-scrolling: touch; }
.lb-panel { text-align: left; }
.lb-head { color: #8fb6ff; letter-spacing: 0.22em; font-size: 0.66rem; font-weight: 800; margin-bottom: 9px; }
.lb-subhead { color: #ffd23e; letter-spacing: 0.12em; font-size: 0.66rem; font-weight: 800; margin-bottom: 8px; }
.lb-desc { color: #a8bcd8; font-size: 0.72rem; line-height: 1.5; margin-top: 10px; }
.lb-row { display: flex; gap: 9px; margin-top: 11px; }
.lb-row .menu-btn { margin-top: 0; flex: 1 1 0; font-size: 0.72rem; padding: 12px 8px; }
.menu-btn.ghost {
  background: #182741; border-color: #2b3f63; color: #a8c0e0;
  box-shadow: 0 4px 0 #16243c;
}
.menu-btn.wide { flex: 1.4 1 0; }

/* --- agent / skin cards --- */
.lb-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 9px; }
.lb-card {
  position: relative; padding: 11px 11px 10px; border-radius: 13px; cursor: pointer; text-align: left;
  background: #17253d; border: 2px solid #2a3d61; font-family: inherit; color: #dce8fa;
  display: flex; flex-direction: column; gap: 3px;
}
.lb-card:active { transform: translateY(2px); }
.lb-card.selected { border-color: #ffd23e; background: #1f3050; box-shadow: 0 0 0 2px rgba(255,210,62,0.22); }
.lb-card.locked { opacity: 0.9; }
.lb-card-swatch { width: 100%; height: 26px; border-radius: 8px; margin-bottom: 5px; border: 1px solid rgba(255,255,255,0.14); }
.lb-card-name { font-size: 0.74rem; font-weight: 900; letter-spacing: 0.05em; }
.lb-card-sub { font-size: 0.58rem; font-weight: 700; letter-spacing: 0.1em; color: #ffd23e; }
.lb-card-note { font-size: 0.58rem; color: #7f96bb; letter-spacing: 0.04em; }
.lb-card-price {
  margin-top: 5px; padding: 5px 8px; border-radius: 8px; text-align: center;
  font-size: 0.6rem; font-weight: 900; letter-spacing: 0.06em;
  background: #10233d; border: 1px solid #2f4a72; color: #ffd23e;
}
.lb-card-price.poor { color: #ff8f7f; border-color: #5a3040; }
.lb-card-price.owned { color: #7de3a0; }

/* --- career stats --- */
.lb-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 9px; }
.lb-stat { background: #17253d; border: 2px solid #2a3d61; border-radius: 12px; padding: 10px; }
.lb-stat-v { color: #fff; font-size: 1.15rem; font-weight: 900; }
.lb-stat-k { color: #7f96bb; font-size: 0.55rem; font-weight: 700; letter-spacing: 0.12em; margin-top: 2px; }

/* --- bottom tab bar --- */
.lobby-nav {
  flex: 0 0 auto; display: flex; gap: 3px; padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
  background: #0d1728; border-top: 2px solid #21324f;
}
.lb-tab {
  flex: 1 1 0; padding: 7px 2px; border-radius: 10px; cursor: pointer; font-family: inherit;
  background: transparent; border: 2px solid transparent; color: #6d84a8;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.lb-tab-ic { font-size: 0.85rem; line-height: 1; }
.lb-tab em { font-style: normal; font-size: 0.5rem; font-weight: 800; letter-spacing: 0.07em; }
.lb-tab.active { background: #1b2c49; border-color: #34507d; color: #ffd23e; }

@media (max-width: 560px) {
  .stage-agent { font-size: 1.2rem; }
  .stage-perks { display: none; }
  .lb-cards { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }
}

/* ---------------------------------------------------------------------------
   Orientation support.

   Portrait (vertical) and landscape (panoramic) are both first-class. The
   lobby restacks into two columns when the screen is short and wide, and the
   in-game HUD/touch controls tuck in so nothing overlaps on a short screen.
   --------------------------------------------------------------------------- */

/* --- LOBBY, panoramic: stage on the left, panels + tabs on the right --- */
@media (orientation: landscape) and (max-height: 620px) {
  .lobby {
    max-width: 1180px;
    display: grid;
    grid-template-columns: minmax(230px, 40%) 1fr;
    grid-template-rows: auto 1fr auto;
    grid-template-areas:
      "top   top"
      "stage panels"
      "stage nav";
  }
  .lobby-top { grid-area: top; padding: 6px 12px; }
  .lobby-stage { grid-area: stage; flex: none; min-height: 0; border-right: 2px solid #21324f; }
  .lobby-panels { grid-area: panels; padding: 9px 12px 4px; }
  .lobby-nav { grid-area: nav; border-top: 2px solid #21324f; }

  .lb-rank-badge { width: 32px; height: 32px; font-size: 0.9rem; border-radius: 9px; }
  .lb-wallet { padding: 5px 9px; font-size: 0.8rem; }
  .lb-close { width: 30px; height: 30px; }
  .stage-agent { font-size: 1.15rem; }
  .stage-perks { display: none; }           /* the panel needs the width more */
  .lb-daily { padding: 6px 10px; font-size: 0.58rem; }
  .lb-row .menu-btn { padding: 9px 6px; font-size: 0.66rem; }
  .lb-cards { grid-template-columns: repeat(auto-fill, minmax(122px, 1fr)); gap: 7px; }
  .lb-tab em { font-size: 0.46rem; }
  .lb-tab { padding: 5px 2px; }
}

/* --- LOBBY, very tall portrait: give the agent more of the screen --- */
@media (orientation: portrait) and (min-height: 700px) {
  .lobby-stage { flex: 0 0 42%; }
}

/* --- IN-GAME, panoramic / short: keep the HUD out of the play area --- */
@media (orientation: landscape) and (max-height: 500px) {
  #hud-top-left { width: 34vw; max-width: 168px; top: 8px; left: 8px; }
  #hud-objective { top: 8px; right: 8px; max-width: 32vw; font-size: 0.62rem; }
  #alert-indicator { padding: 3px 11px; font-size: 0.72rem; }
  #minimap-canvas { width: 84px; height: 84px; }
  #weapon-panel { min-width: 112px; padding: 4px 8px; }
  #ammo-count { font-size: 0.95rem; }
  /* action buttons ride lower: there is no vertical room under the top HUD */
  #touch-buttons { top: auto; bottom: 12px; right: 10px; flex-direction: row; gap: 8px; }
  .touch-btn { width: 46px; height: 46px; font-size: 0.6rem; }
  .touch-btn.small { width: 38px; height: 38px; }
  /* keep the fire pad clear of that new button row */
  #touch-aim { height: 52%; }
  #dpad { bottom: 14px; left: 12px; grid-template-columns: 50px 50px 50px; grid-template-rows: 50px 50px 50px; }
  .touch-btn.dp { width: 50px; height: 50px; }
  .touch-btn.side { left: 180px; bottom: 74px; width: 62px; height: 44px; }
  .touch-btn.side.run { bottom: 24px; }
}

/* --- IN-GAME, portrait: the screen is narrow, so shrink the side panels --- */
@media (orientation: portrait) and (pointer: coarse) {
  #hud-top-left { width: 46vw; max-width: 190px; }
  #hud-objective { max-width: 44vw; }
  /* a centred badge has nowhere to go between the bars and the objectives on a
     narrow screen — drop it onto its own line underneath them */
  #alert-indicator { top: 86px; padding: 4px 12px; font-size: 0.7rem; }
  /* thumbs sit lower on a tall phone — lift both zones off the very bottom */
  #touch-move { width: 50%; }
  #touch-aim { width: 50%; height: 58%; }
  #touch-buttons { top: auto; bottom: calc(env(safe-area-inset-bottom, 0px) + 132px); right: 10px; }
}

/* same collision on any narrow viewport, touch device or not */
@media (max-width: 560px) {
  #alert-indicator { top: 86px; padding: 4px 12px; font-size: 0.7rem; }
  #hud-objective { max-width: 46vw; }
}

/* --- menus/panels on a short screen: never let a panel outgrow the view --- */
@media (max-height: 560px) {
  .panel { padding: 16px 18px; max-height: 92vh; overflow-y: auto; }
  #screen-end .menu-btn, #pause-overlay .menu-btn { width: 220px; margin-top: 6px; padding: 10px 14px; }
  .game-title { font-size: 2.2rem; }
  .menu-btn { padding: 11px 20px; }
}

/* --- options: destructive action (restart the story) --- */
.seg-btn.danger { color: #ff8f7f; border-color: #6a2a34; background: rgba(60,16,24,0.45); }
.seg-btn.danger:hover { filter: brightness(1.15); }
.opt-confirm {
  background: rgba(60,16,24,0.35); border: 2px solid #6a2a34; border-radius: 12px;
  padding: 12px 14px; margin: -6px 0 16px;
}
#opt-restart-warn { color: #ffc9bf; font-size: 0.76rem; line-height: 1.45; margin-bottom: 10px; }
.opt-confirm-row { display: flex; gap: 9px; flex-wrap: wrap; }

/* --- vector logos (never text glyphs: iOS turns ★ / ▶ into colour emoji) --- */
.lb-tab-ic { width: 21px; height: 21px; fill: currentColor; display: block; }
.lb-close svg { width: 15px; height: 15px; display: block; margin: auto; color: inherit; }
.ic-star { width: 1em; height: 1em; fill: #ffd23e; vertical-align: -0.12em; margin-right: 2px; }
/* inside a "can't afford" price chip the coin follows the warning colour */
.lb-card-price.poor .ic-star { fill: #ff8f7f; }
.lb-card-price.owned .ic-star { fill: #7de3a0; }
.hub-sil-buy .ic-star { width: 0.9em; height: 0.9em; }
/* on the yellow daily button a yellow coin would vanish — darken it */
.lb-daily .ic-star { fill: #2a1c05; }
