/* ==========================================================================
   CS2D DELTA ARENA - BASE DESIGN SYSTEM & VIEWPORT CONFIGURATION
   Fonts, Design Tokens, Global Resets, Canvas & Viewport Guards
   ========================================================================== */

/* CS2D Delta Arena - Tactical Dark Esports Styling */
/* Local Bundled Fonts for 100% Offline WebXDC Operation */
@font-face {
  font-family: 'Chakra Petch';
  font-style: normal;
  font-weight: 500 600;
  font-display: swap;
  src: url('fonts/ChakraPetch-SemiBold.woff2') format('woff2');
}
@font-face {
  font-family: 'Chakra Petch';
  font-style: normal;
  font-weight: 700 800;
  font-display: swap;
  src: url('fonts/ChakraPetch-Bold.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('fonts/Inter-Latin.woff2') format('woff2');
}

:root {
  --color-bg: #0c1117;
  --color-ct: #3498db;
  --color-ct-glow: rgba(52, 152, 219, 0.4);
  --color-t: #e67e22;
  --color-t-glow: rgba(230, 126, 34, 0.4);
  --color-hud-bg: rgba(13, 20, 28, 0.82);
  --color-border: rgba(255, 255, 255, 0.12);
  --font-tactical: 'Chakra Petch', system-ui, -apple-system, sans-serif;
  --font-ui: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  /* Official Telegram Mini App (Bot API 8.0+) Safe Area Insets with WebKit & standard fallbacks */
  --safe-top: calc(var(--tg-safe-area-inset-top, env(safe-area-inset-top, 0px)) + var(--tg-content-safe-area-inset-top, 0px));
  --safe-bottom: calc(var(--tg-safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)) + var(--tg-content-safe-area-inset-bottom, 0px));
  --safe-left: calc(var(--tg-safe-area-inset-left, env(safe-area-inset-left, 0px)) + var(--tg-content-safe-area-inset-left, 0px));
  --safe-right: calc(var(--tg-safe-area-inset-right, env(safe-area-inset-right, 0px)) + var(--tg-content-safe-area-inset-right, 0px));
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

html, body {
  width: 100%;
  height: var(--tg-viewport-stable-height, 100dvh);
  overflow: hidden;
  background-color: var(--color-bg);
  font-family: var(--font-ui);
  touch-action: none;
}

#game-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
}

#tactical-vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 62%, rgba(8, 12, 18, 0.55) 100%);
  z-index: 25;
}

/* ============================================================
   MOBILE GPU COMPOSITOR & THERMAL GUARD
   Disables expensive per-frame WebGL backdrop-filter blurs and
   infinite glow shadow animations on mobile/touch WebViews.
   ============================================================ */
@media (max-width: 950px), (hover: none) and (pointer: coarse) {
  *, *::before, *::after {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  #tactical-vignette {
    display: none !important;
  }

  .pro-top-bar,
  .lobby-bottom-nav,
  .tab-panel-glass,
  .play-deploy-deck,
  .pause-card,
  .round-end-card,
  .scoreboard-card,
  .modal-card {
    background: rgba(8, 14, 22, 0.94) !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.65) !important;
  }
}

/* ============================================================
   TACTICAL ROTATE DEVICE PROMPT
   Smooth overlay asking mobile users to hold device in landscape
   ============================================================ */
.rotate-device-prompt {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.rotate-device-prompt.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.rotate-prompt-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(14, 23, 38, 0.96) 0%, rgba(3, 6, 10, 0.98) 100%);
}

.rotate-prompt-card {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 320px;
  padding: 30px 24px;
  background: rgba(12, 19, 31, 0.92);
  border: 1px solid rgba(0, 229, 255, 0.25);
  border-radius: 20px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.8);
}

.rotate-phone-anim {
  position: relative;
  width: 70px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.phone-frame {
  width: 32px;
  height: 54px;
  border: 2.5px solid #00e5ff;
  border-radius: 7px;
  position: relative;
  display: flex;
  justify-content: center;
  animation: phoneRotateLandscape 2.4s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.phone-notch {
  width: 10px;
  height: 2px;
  background: #00e5ff;
  border-radius: 1px;
  position: absolute;
  top: 2px;
}

.phone-rotate-arrow {
  position: absolute;
  color: rgba(0, 229, 255, 0.5);
  animation: arrowPulse 2.4s ease-in-out infinite;
}

@keyframes phoneRotateLandscape {
  0%, 15% {
    transform: rotate(0deg);
  }
  45%, 75% {
    transform: rotate(90deg);
  }
  95%, 100% {
    transform: rotate(90deg);
  }
}

@keyframes arrowPulse {
  0%, 100% { opacity: 0.3; transform: scale(0.9); }
  50% { opacity: 0.9; transform: scale(1.1); }
}

.rotate-brand-tag {
  font-family: var(--font-tactical);
  font-size: 0.65rem;
  font-weight: 800;
  color: #00ff88;
  letter-spacing: 1.5px;
  margin-bottom: 6px;
  display: block;
}

.rotate-title {
  font-family: var(--font-tactical);
  font-size: 1.15rem;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: 1.2px;
  margin: 0 0 8px;
}

.rotate-sub {
  font-size: 0.78rem;
  color: #8fa3b8;
  line-height: 1.4;
  margin: 0 0 20px;
}

.btn-bypass-rotate {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  padding: 6px 16px;
  color: #cbd5e1;
  font-family: var(--font-tactical);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-bypass-rotate:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

/* ============================================================
   NARROW / PORTRAIT VIEWPORT SAFETY (Delta Chat desktop window,
   phones before the CSS landscape rotation kicks in)
   ============================================================ */
@media (max-width: 720px) {
  .hud-top-center {
    top: 8px;
    padding: 4px 12px;
    gap: 8px;
  }

  .timer-text {
    font-size: 1.15rem;
  }

  .team-score {
    font-size: 1rem;
    gap: 5px;
  }

  .phase-text {
    font-size: 0.56rem;
    letter-spacing: 1px;
  }

  .hud-kill-feed {
    top: 74px;
    right: 10px;
    max-width: 190px;
  }

  .kill-entry {
    font-size: 0.68rem;
    padding: 3px 7px;
  }

  .hud-radar-box {
    width: 118px;
    height: 118px;
  }

  .hud-bgm-widget {
    max-width: 132px;
  }
}

/* ============================================================
   INLINE SVG ICON SYSTEM
   ============================================================ */
.icon {
  width: 1em;
  height: 1em;
  display: inline-block;
  vertical-align: -0.15em;
  flex: 0 0 auto;
  pointer-events: none;
}

.btn-enter-icon,
.chip-glyph,
.deploy-main-text,
.fps-tag,
.rank-tag,
.gun-icon,
.spec-header-tag,
.stick-sprint-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.chip-icon .icon { width: 13px; height: 13px; }
.stat-icon .icon { width: 14px; height: 14px; }
.gun-icon .icon { width: 9px; height: 9px; }
.hud-bgm-icon .icon { width: 11px; height: 11px; }
.hud-bgm-btn .icon { width: 11px; height: 11px; }
.hud-bgm-btn { line-height: 0; }
.killer-headshot-badge .icon { width: 12px; height: 12px; }
.killer-avatar-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}
.killer-avatar-icon .icon { width: 30px; height: 30px; color: #ff6b6b; }
.spec-nav-btn .icon { width: 15px; height: 15px; }
.spec-header-tag .icon { width: 12px; height: 12px; color: #00e5ff; }
.stick-sprint-indicator .icon { width: 10px; height: 10px; }
.minimal-btn .btn-enter-icon .icon { width: 16px; height: 16px; }
.entry-brand-title .icon,
.accolade-title .icon { width: 0.9em; height: 0.9em; }
.accolade-title { display: inline-flex; align-items: center; gap: 10px; }
.gold-accolade .accolade-title .icon { color: #f1c40f; }
.selector-chip.active .chip-glyph { color: #00e5ff; }
