:root {
  --ui-bg: #141428;
  --ui-panel: rgba(20, 20, 40, 0.95);
  --ui-border: #4a90e2;
  --ui-accent: #673ab7;
  --ui-text: #ffffff;
  --ui-muted: rgba(255, 255, 255, 0.7);
  --overlay-dark: rgba(0, 0, 0, 0.85);
}

/* Global reset styles (moved from inline HTML) */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  position: fixed;
  touch-action: none;
  -webkit-overflow-scrolling: none;
}

body {
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #0a0a0a;
  font-family: 'Orbitron', sans-serif;
}

#gameCanvas {
  display: block;
  background-color: #1a1a2e;
  max-width: 100vw;
  max-height: 100vh;
  width: auto;
  height: auto;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
}

/* Base UI overlay + resets that don't fight existing global resets */
#ui-root {
  position: fixed;
  inset: 0;
  z-index: 1000;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

#ui-root * {
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* Utility layers (BEM) */
.ui-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.ui-layer--modal {
  background: var(--overlay-dark);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Generic modal block */
.modal {
  pointer-events: auto;
  background: var(--ui-panel);
  color: var(--ui-text);
  border: 2px solid var(--ui-border);
  border-radius: 8px;
  max-width: min(900px, 92vw);
  max-height: min(85vh, 800px);
  width: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal__header {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(150, 150, 255, 0.3);
  font-weight: 700;
}

.modal__body {
  padding: 16px 20px;
  overflow: auto;
  font-weight: 500;
  line-height: 1.6;
}

.modal__footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(150, 150, 255, 0.3);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.btn {
  pointer-events: auto;
  background: transparent;
  color: var(--ui-text);
  border: 2px solid var(--ui-border);
  padding: 10px 14px;
  border-radius: 6px;
  cursor: pointer;
}

.btn--primary {
  background: rgba(100, 100, 255, 0.2);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.pause-button {
  position: fixed;
  top: 12px;
  right: 12px;
}

/* Character Sheet specific */
.character-sheet {
  max-width: 1280px;
  max-height: 92vh;
}

.cs-grid {
  display: grid;
  grid-template-columns: 280px 1fr 280px;
  grid-auto-rows: min-content;
  gap: 16px;
  padding: 6px;
}

.cs-panel {
  background: rgba(10, 12, 22, 0.55);
  border: 2px solid rgba(120, 160, 255, 0.35);
  border-radius: 4px;
  padding: 10px;
}

.cs-panel--center {
  min-height: 420px;
}

.cs-title {
  color: #ffaa88;
  font-weight: 700;
  margin-bottom: 8px;
  text-align: center;
}

.cs-subtitle {
  color: #88ddff;
  font-weight: 700;
  margin: 4px 0 8px;
}

.cs-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cs-chip {
  border: 1px solid rgba(150, 150, 255, 0.3);
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  padding: 4px 8px;
  color: #fff;
  font-size: 12px;
}

.cs-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 18px;
  margin-top: 8px;
}

.cs-card {
  position: relative;
  border-radius: 10px;
  border: 2px solid #666;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(16, 16, 28, 0.95) 0%, rgba(10, 10, 20, 0.95) 100%);
  padding: 8px 10px 12px 10px;
  min-height: 210px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.cs-card__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.cs-card__name {
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 70%;
}

.cs-card__tag {
  color: #cfd8ff;
  font-weight: 700;
  font-size: 10px;
}

.cs-card__origin {
  font-weight: 700;
  font-size: 11px;
}

.cs-card__emblem {
  width: 0;
  height: 0;
  border-left: 16px solid transparent;
  border-right: 16px solid transparent;
  border-bottom: 34px solid #9c27b0;
  margin: 16px auto 10px auto;
  opacity: 0.9;
}

.cs-card__desc {
  color: #cfd8ff;
  font-size: 11px;
  line-height: 1.35;
  margin-top: 8px;
}

.cs-empty {
  border: 2px dashed rgba(200, 200, 200, 0.35);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(200, 200, 220, 0.7);
  font-weight: 700;
}

.cs-list {
  display: grid;
  gap: 6px;
}

.cs-badges {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cs-badge {
  border: 1px solid rgba(150, 150, 255, 0.3);
  border-radius: 3px;
  padding: 6px 8px;
  color: #fff;
  font-size: 12px;
  display: flex;
  justify-content: space-between;
}

/* Nexus Machine Scrollbar Styling */
.nexus-scrollbar {
  scrollbar-width: thin;
  scrollbar-color: rgba(74, 144, 226, 0.6) rgba(20, 20, 40, 0.3);
}

.nexus-scrollbar::-webkit-scrollbar {
  width: 12px;
}

.nexus-scrollbar::-webkit-scrollbar-track {
  background: rgba(20, 20, 40, 0.3);
  border-radius: 6px;
}

.nexus-scrollbar::-webkit-scrollbar-thumb {
  background: rgba(74, 144, 226, 0.6);
  border-radius: 6px;
  border: 2px solid rgba(20, 20, 40, 0.3);
}

.nexus-scrollbar::-webkit-scrollbar-thumb:hover {
  background: rgba(74, 144, 226, 0.8);
}

/* Mobile 21:9 Scaling - Target devices with aspect ratio >= 2:1 and width < 1024px */
@media (min-aspect-ratio: 2/1) and (max-width: 1024px) {

  /* Scale modals for mobile */
  .modal {
    max-width: min(90vw, 900px);
    max-height: min(90vh, 800px);
  }

  /* Scale modal body padding and font sizes */
  .modal__header {
    padding: 12px 16px;
    font-size: 0.9em;
  }

  .modal__body {
    padding: 12px 16px;
    font-size: 0.9em;
  }

  .modal__footer {
    padding: 10px 12px;
    gap: 6px;
  }

  /* Scale buttons */
  .btn {
    padding: 8px 12px;
    font-size: 0.9em;
    border-radius: 5px;
  }

  /* Scale character sheet */
  .character-sheet {
    max-width: 95vw;
    max-height: 90vh;
  }

  .cs-grid {
    gap: 12px;
    padding: 4px;
  }

  .cs-panel {
    padding: 8px;
  }

  /* Scale card grid */
  .cs-cards {
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  }

  .cs-card {
    padding: 6px 8px 10px 8px;
    min-height: 180px;
  }

  /* Scale chips and badges */
  .cs-chips {
    gap: 6px;
  }

  .cs-chip {
    padding: 3px 6px;
    font-size: 11px;
  }

  .cs-badge {
    padding: 5px 6px;
    font-size: 11px;
  }

  /* HUD mobile scaling and repositioning */
  #dom-hud {
    bottom: 200px !important;
    /* Move above touch controls (controls are at ~16-18% from bottom) */
    left: 10px !important;
    right: 10px !important;
    transform: scale(0.85) !important;
    transform-origin: left bottom !important;
  }

  #dom-hud #dom-hp-bar,
  #dom-hud #dom-shield-bar {
    max-width: 320px !important;
    height: 12px !important;
  }

  #dom-hud #dom-hp-bar-text,
  #dom-hud #dom-shield-bar-text {
    font-size: 9px !important;
  }

  #dom-hud #dom-xp-bar {
    max-width: 320px !important;
    height: 8px !important;
    margin-top: 6px !important;
  }

  #dom-hud #dom-cooldowns-row {
    gap: 10px !important;
    margin-top: 6px !important;
  }

  #dom-hud #dom-cooldowns-row>div {
    gap: 3px !important;
  }

  #dom-hud #dom-cooldowns-row>div>div:first-child {
    width: 120px !important;
    height: 12px !important;
  }

  #dom-hud #dom-cooldowns-row>div>div:last-child {
    font-size: 10px !important;
    margin-top: 1px !important;
  }

  #dom-hud .hud>div:first-child {
    font-size: 11px !important;
    margin-right: 4px !important;
  }

  /* Room info mobile scaling */
  .room-info-panel {
    top: 8px !important;
    width: 180px !important;
    min-height: 45px !important;
    padding: 6px 10px !important;
  }

  .room-info-panel .room-info__number {
    font-size: 24px !important;
    margin-bottom: 2px !important;
  }

  .room-info-panel .room-info__enemies {
    font-size: 12px !important;
    min-height: 18px !important;
  }

  .room-info-panel .room-info__status {
    font-size: 14px !important;
    top: calc(100% + 6px) !important;
  }

  /* Room/Level banner mobile scaling */
  .ui-layer[style*="top: 12px"] {
    top: 8px !important;
    padding: 0 12px !important;
  }

  .ui-layer[style*="top: 12px"]>div {
    font-size: 14px !important;
  }

  /* Teammate health bars mobile positioning */
  #dom-teammate-health {
    bottom: 280px !important;
    /* Above HUD (which is at 200px) */
    left: 10px !important;
    transform: scale(0.85) !important;
    transform-origin: left bottom !important;
  }

  /* Pause menu mobile styling */
  .pause-menu {
    max-width: 95vw !important;
    max-height: 90vh !important;
    width: 500px !important;
  }

  .pause-menu .modal__header {
    padding: 12px 16px !important;
    font-size: 16px !important;
  }

  .pause-menu .modal__body {
    padding: 16px !important;
    padding-right: 12px !important;
    overflow-y: scroll !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(74, 144, 226, 0.8) rgba(20, 20, 40, 0.4);
    scrollbar-gutter: stable;
  }

  /* Always show scrollbar on webkit browsers (Chrome, Safari, Edge) */
  .pause-menu .modal__body::-webkit-scrollbar {
    -webkit-appearance: none;
    width: 10px;
  }

  .pause-menu .modal__body::-webkit-scrollbar-track {
    background: rgba(20, 20, 40, 0.4);
    border-radius: 5px;
    -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
  }

  .pause-menu .modal__body::-webkit-scrollbar-thumb {
    background: rgba(74, 144, 226, 0.8);
    border-radius: 5px;
    border: 2px solid rgba(20, 20, 40, 0.4);
    -webkit-box-shadow: 0 0 6px rgba(74, 144, 226, 0.5);
  }

  .pause-menu .modal__body::-webkit-scrollbar-thumb:hover {
    background: rgba(74, 144, 226, 1);
  }

  /* Force scrollbar to always be visible (prevent auto-hide) */
  .pause-menu .modal__body::-webkit-scrollbar-thumb:vertical {
    min-height: 30px;
  }

  .pause-menu .modal__body>div {
    gap: 12px !important;
  }

  .pause-menu .btn {
    padding: 12px 16px !important;
    font-size: 15px !important;
    min-height: 48px !important;
  }

  .pause-menu .modal__footer {
    padding: 12px 16px !important;
  }

  /* Ensure pause menu appears above HUD */
  .ui-layer--modal {
    z-index: 10000 !important;
  }

  /* Character sheet mobile scaling */
  .character-sheet {
    max-width: 98vw !important;
    max-height: 96vh !important;
    transform: scale(0.85);
    transform-origin: center center;
  }

  .character-sheet .modal__header {
    padding: 8px 12px !important;
    font-size: 14px !important;
  }

  .character-sheet .modal__body {
    padding: 8px 10px !important;
    font-size: 11px !important;
    max-height: 70vh !important;
    overflow: hidden !important;
  }

  .character-sheet .modal__footer {
    padding: 6px 10px !important;
  }

  .character-sheet .cs-grid {
    grid-template-columns: 1fr 1.5fr 1fr !important;
    gap: 8px !important;
    padding: 3px !important;
  }

  .character-sheet .cs-panel {
    padding: 5px !important;
    font-size: 10px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
  }

  /* Custom scrollbar for mobile panels */
  .character-sheet .cs-panel::-webkit-scrollbar {
    width: 6px;
  }

  .character-sheet .cs-panel::-webkit-scrollbar-track {
    background: rgba(20, 20, 40, 0.3);
    border-radius: 3px;
  }

  .character-sheet .cs-panel::-webkit-scrollbar-thumb {
    background: rgba(74, 144, 226, 0.6);
    border-radius: 3px;
  }

  .character-sheet .cs-panel::-webkit-scrollbar-thumb:hover {
    background: rgba(74, 144, 226, 0.8);
  }

  .character-sheet .cs-title {
    font-size: 12px !important;
    margin-bottom: 4px !important;
  }

  .character-sheet .cs-subtitle {
    font-size: 11px !important;
    margin: 2px 0 4px !important;
  }

  .character-sheet .cs-cards {
    gap: 8px !important;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)) !important;
  }

  .character-sheet .cs-card {
    padding: 5px 6px !important;
    min-height: 150px !important;
    font-size: 10px !important;
  }

  .character-sheet .cs-card__name {
    font-size: 10px !important;
  }

  .character-sheet .cs-card__tag {
    font-size: 9px !important;
  }

  .character-sheet .cs-card__desc {
    font-size: 9px !important;
  }

  /* Ensure character sheet button stays on top when sheet is open */
  .charsheet-button {
    z-index: 10001 !important;
  }
}

/*# sourceMappingURL=base.css.map */