@import './mobile.css';

@tailwind base;
@tailwind components;
@tailwind utilities;

@font-face {
  font-family: "TASAOrbiter";
  src: url("./assets/typefaces/TASAOrbiterVF.woff2");
}

/* ─── Design Tokens ─────────────────────────────────────────────────────────── */
:root {
  /* Core palette */
  --bg-base:        #080b0f;
  --bg-panel:       #0d1117;
  --bg-card:        #111620;
  --bg-card-hover:  #161c28;
  --bg-border:      #1e2736;
  --bg-border-dim:  #151c27;

  /* Team colors */
  --t-color:        #f5a623;
  --t-dim:          rgba(245,166,35,0.12);
  --t-border:       rgba(245,166,35,0.22);
  --ct-color:       #4a9eff;
  --ct-dim:         rgba(74,158,255,0.12);
  --ct-border:      rgba(74,158,255,0.22);

  /* Text */
  --text-primary:   #ffffff;
  --text-secondary: #c2c2c2;
  --text-muted:     #2e3d50;

  /* Status */
  --hp-high:   #3dd68c;
  --hp-mid:    #f0b429;
  --hp-low:    #e05252;
  --money:     #3dd68c;

  /* Sizing — rebirth: fully rounded edges */
  --card-radius:  10px;
  --panel-radius:  14px;
  --btn-radius:    8px;
}

/* ─── Rebirth: global panel softness ───────────────────────────────────────── */
[data-theme="default"] .settings-panel,
[data-theme="default"] .scoreboard,
[data-theme="default"] #radar {
  border-radius: var(--panel-radius);
}

[data-theme="default"] .player-card,
[data-theme="default"] li[style*="borderRadius:6"] {
  border-radius: var(--card-radius);
}

/* ─── Rebirth: smooth corner shadows ───────────────────────────────────────── */
[data-theme="default"] .settings-panel {
  box-shadow:
    0 8px 40px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255,255,255,0.04);
}

[data-theme="default"] #radar {
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.04),
    0 8px 48px rgba(0, 0, 0, 0.7);
}

/* ─── Rebirth: HUD overlay panels with blur + round ─────────────────────────── */
[data-theme="default"] [style*="rgba(13,17,23,0.92)"],
[data-theme="default"] [style*="rgba(10,14,20,0.95)"] {
  border-radius: var(--panel-radius) !important;
  backdrop-filter: blur(12px) saturate(1.4);
}

/* ─── Rebirth: smoother weapon slots ─────────────────────────────────────────── */
[data-theme="default"] [style*="borderRadius:3"] {
  border-radius: 8px !important;
}

/* ─── Reset & Base ──────────────────────────────────────────────────────────── */
* {
  outline-offset: 4px;
  box-sizing: border-box;
}

html, body {
  margin: 0;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: "TASAOrbiter", "Rajdhani", ui-monospace, monospace;
  color: var(--text-primary);
  background: var(--bg-base);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: relative;
}

/* Overlay to reduce background opacity without affecting content */
body::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-base);
  opacity: 0.5;
  z-index: -1;
  pointer-events: none;
}

/* ─── Scrollbar ─────────────────────────────────────────────────────────────── */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-border); border-radius: 2px; }

/* ─── Team header labels ────────────────────────────────────────────────────── */
.team-label {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  line-height: 1;
}

.team-label-t  { color: var(--t-color); }
.team-label-ct { color: var(--ct-color); }

/* ─── Player card ───────────────────────────────────────────────────────────── */
.player-card {
  position: relative;
  display: flex;
  align-items: stretch;
  overflow: hidden;
  border-radius: var(--card-radius);
  background: var(--bg-card);
  border: 1px solid var(--bg-border-dim);
  transition: border-color 0.2s, background 0.2s;
  min-height: 72px;
}

.player-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--bg-border);
}

.player-card.dead {
  opacity: 0.38;
  filter: grayscale(0.6);
}

/* ─── Scoreboard ────────────────────────────────────────────────────────────── */
.scoreboard {
  display: flex;
  align-items: stretch;
  border-radius: var(--panel-radius);
  overflow: hidden;
  border: 1px solid var(--bg-border);
  background: var(--bg-panel);
}

/* ─── Settings panel ────────────────────────────────────────────────────────── */
.settings-panel {
  background: var(--bg-panel);
  border: 1px solid var(--bg-border);
  border-radius: var(--panel-radius);
  box-shadow: 0 16px 48px rgba(0,0,0,0.7);
}

/* ─── Utility: hairline separator ──────────────────────────────────────────── */
.sep {
  height: 1px;
  background: var(--bg-border-dim);
}

/* ─── Pulse animations ──────────────────────────────────────────────────────── */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* ─── Shooting and Hurt Effects ─────────────────────────────────────────────── */
/* Muzzle flash effect - appears in front of player dot when shooting */
.player-dot.shooting::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,0,0.3); /* Yellow with 30% opacity */
  pointer-events: none;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.1s ease-out;
}

/* Hurt/damage indicator - appears behind player dot when taking damage */
.player-dot.hurting::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,0,0,0.3); /* Red with 30% opacity */
  pointer-events: none;
  z-index: 5;
  opacity: 0;
  transition: opacity 0.1s ease-out;
}

/* Flashed effect (flashbang) - white overlay when player is flashed */
.player-dot.flashed::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,1);
  pointer-events: none;
  z-index: 15;
  opacity: 0;
  transition: opacity 0.2s ease-out;
}

/* Flashed effect active state - full white overlay */
.player-dot.flashed-flashing::before {
  opacity: var(--flash-opacity, 0);
}

/* Eye emoji for flashed effect */
.player-dot.flashed::after,
.player-dot.flashed-flashing::after {
  content: '👁️';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0;
  pointer-events: none;
  z-index: 20;
  opacity: 0;
  transition: opacity 0.2s ease-out, font-size 0.2s ease-out;
  transform: rotate(0deg);
  text-shadow:
    -1px -1px 0 #000,
    1px -1px 0 #000,
    -1px 1px 0 #000,
    1px 1px 0 #000,
    -2px -2px 0 #000,
    2px -2px 0 #000,
    -2px 2px 0 #000,
    2px 2px 0 #000;
}

/* Active flashed state - show eye emoji with animation */
.player-dot.flashed-flashing::after {
  opacity: var(--flash-opacity, 0);
  font-size: var(--flash-eye-size, 0px);
  animation: flashEye 0.3s ease-out;
}

@keyframes flashEye {
  0% {
    opacity: 0;
    font-size: 0px;
    transform: rotate(0deg);
  }
  50% {
    opacity: var(--flash-opacity, 0);
    font-size: var(--flash-eye-size, 24px);
    transform: rotate(15deg);
  }
  100% {
    opacity: var(--flash-opacity, 0);
    font-size: var(--flash-eye-size, 24px);
    transform: rotate(0deg);
  }
}

/* Active states control opacity */
.player-dot.shooting-active::after {
  opacity: var(--shooting-opacity, 0.3);
}

.player-dot.hurting-active::before {
  opacity: var(--hurting-opacity, 0.3);
}

.player-dot.flashed-flashing::before {
  opacity: var(--flash-opacity, 0);
}

@keyframes phasePulse {
  0% { opacity: 0.6; }
  100% { opacity: 1; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.animate-spin { animation: spin 1s linear infinite; }
.animate-pulse { animation: pulse 1.8s ease-in-out infinite; }

/* ─── Connecting screen ─────────────────────────────────────────────────────── */
.connecting-ring {
  width: 44px;
  height: 44px;
  border: 2px solid var(--bg-border);
  border-top-color: var(--ct-color);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

/* ─── Touch ─────────────────────────────────────────────────────────────────── */
.touch-manipulation {
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* ─── Mobile safe areas ─────────────────────────────────────────────────────── */
@supports (padding: env(safe-area-inset-bottom)) {
  .mobile-safe-bottom { padding-bottom: max(1rem, env(safe-area-inset-bottom)); }
  .mobile-safe-top { padding-top: max(0.5rem, env(safe-area-inset-top)); }
}

/* ─── Reduce motion ─────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ─── Advisories Animation ──────────────────────────────────────────────────── */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}
