/* ===== WorldWarClicks — Global Styles ===== */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;600;700;900&family=Inter:wght@300;400;500;600;700&display=swap');

/* --- Design Tokens --- */
:root {
  --bg-primary: #06060e;
  --bg-secondary: #0d0d1a;
  --bg-card: rgba(20, 20, 40, 0.7);
  --bg-card-solid: #14142a;
  --accent-red: #ff3a3a;
  --accent-orange: #ff8c00;
  --accent-cyan: #00d4ff;
  --accent-purple: #a855f7;
  --accent-green: #22c55e;
  --text-primary: #f0f0ff;
  --text-secondary: #7a7a9e;
  --text-muted: #4a4a6a;
  --gold: #ffd700;
  --silver: #c0c0c0;
  --bronze: #cd7f32;
  --glow-red: 0 0 20px rgba(255, 58, 58, 0.5), 0 0 60px rgba(255, 58, 58, 0.2);
  --glow-cyan: 0 0 20px rgba(0, 212, 255, 0.4);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 50%;
  --font-display: 'Orbitron', sans-serif;
  --font-body: 'Inter', sans-serif;
  --transition-fast: 0.15s ease;
  --transition-med: 0.3s ease;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Animated background grid */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    linear-gradient(rgba(255,58,58,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,58,58,0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
  z-index: 0;
}
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(255,58,58,0.08) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* --- Navigation --- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 64px;
  background: rgba(6,6,14,0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255,58,58,0.15);
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 900;
  letter-spacing: 2px;
  background: linear-gradient(135deg, var(--accent-red), var(--accent-orange));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-decoration: none;
}
.nav-logo img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  filter: drop-shadow(0 0 5px var(--accent-red));
}
.nav-links { display: flex; gap: 0.5rem; }
.nav-links a {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
}
.nav-links a:hover, .nav-links a.active {
  color: var(--accent-red);
  background: rgba(255,58,58,0.1);
}

/* --- Main Layout --- */
.main-content {
  position: relative;
  z-index: 1;
  padding-top: 80px;
  min-height: 100vh;
}

/* --- Game Page --- */
.game-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  padding: 1rem 1rem 3rem;
  max-width: 1200px;
  margin: 0 auto;
}

/* Country Panel */
.country-panel {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 2rem;
  background: var(--bg-card);
  border: 1px solid rgba(255,58,58,0.15);
  border-radius: var(--radius-md);
  backdrop-filter: blur(12px);
}
.country-flag { font-size: 2.5rem; }
.country-info h2 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 1px;
}
.country-info p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 2px;
}
.country-online {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--accent-green);
  background: rgba(34, 197, 94, 0.1);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid rgba(34, 197, 94, 0.3);
}
.pulse-dot {
  width: 6px;
  height: 6px;
  background-color: var(--accent-green);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-green);
  animation: pulse-dot 1.5s infinite;
}
@keyframes pulse-dot {
  0% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.2); }
  100% { opacity: 1; transform: scale(1); }
}

/* Stats Row */
.stats-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
  max-width: 600px;
}
.stat-card {
  flex: 1;
  min-width: 120px;
  padding: 1rem;
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-md);
  backdrop-filter: blur(8px);
  text-align: center;
}
.stat-card .stat-value {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-cyan);
}
.stat-card .stat-label {
  font-size: 0.65rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Attack Button Area */
.attack-area {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  margin: 1rem 0;
}

.attack-btn {
  position: relative;
  width: 220px;
  height: 220px;
  border-radius: var(--radius-full);
  border: 3px solid var(--accent-red);
  background: radial-gradient(circle at 40% 35%, #3a1010, #1a0505);
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 900;
  letter-spacing: 3px;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.2s ease;
  box-shadow: var(--glow-red);
  z-index: 2;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}
.attack-btn .btn-icon { font-size: 2.2rem; display: block; margin-bottom: 6px; }
.attack-btn::before {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: var(--radius-full);
  border: 2px solid rgba(255,58,58,0.2);
  animation: pulse-ring 2s ease-out infinite;
}
.attack-btn::after {
  content: '';
  position: absolute;
  inset: -16px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255,58,58,0.08);
  animation: pulse-ring 2s ease-out 0.5s infinite;
}
.attack-btn:hover {
  box-shadow: 0 0 30px rgba(255,58,58,0.6), 0 0 80px rgba(255,58,58,0.3);
  transform: scale(1.04);
}
.attack-btn:active {
  transform: scale(0.93);
  box-shadow: 0 0 10px rgba(255,58,58,0.4);
}
.attack-btn.clicked {
  animation: btn-flash 0.12s ease;
}

/* Combo Badge */
.combo-badge {
  position: absolute;
  top: -10px;
  right: -10px;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 900;
  padding: 4px 12px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--accent-orange), var(--accent-red));
  color: #fff;
  opacity: 0;
  transform: scale(0);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 5;
  pointer-events: none;
}
.combo-badge.visible {
  opacity: 1;
  transform: scale(1);
}
.combo-badge.super {
  background: linear-gradient(135deg, var(--gold), var(--accent-orange));
  font-size: 1.1rem;
  box-shadow: 0 0 20px rgba(255,215,0,0.5);
}

/* Progress Bar (Power Meter) */
.power-meter {
  width: 280px;
  max-width: 90vw;
}
.power-meter-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.power-meter-bar {
  height: 8px;
  background: rgba(255,255,255,0.06);
  border-radius: 10px;
  overflow: hidden;
}
.power-meter-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-red), var(--accent-orange), var(--gold));
  border-radius: 10px;
  transition: width 0.1s ease;
  box-shadow: 0 0 10px rgba(255,140,0,0.4);
}
.power-meter-fill.maxed {
  background: linear-gradient(90deg, #aa0000, var(--accent-red), #ff0000);
  animation: overheat-shake 0.1s ease infinite, overheat-glow 0.5s ease infinite alternate;
}

@keyframes overheat-shake {
  0% { transform: translateX(-2px); }
  50% { transform: translateX(2px); }
  100% { transform: translateX(-2px); }
}

@keyframes overheat-glow {
  from { box-shadow: 0 0 10px rgba(255, 0, 0, 0.6); }
  to { box-shadow: 0 0 30px rgba(255, 0, 0, 1); }
}

/* Floating +1 */
.float-plus {
  position: absolute;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.4rem;
  color: var(--accent-orange);
  pointer-events: none;
  z-index: 10;
  animation: float-up 0.8s ease-out forwards;
  text-shadow: 0 0 10px rgba(255,140,0,0.6);
}
.float-plus.bonus {
  font-size: 2rem;
  color: var(--gold);
  text-shadow: 0 0 20px rgba(255,215,0,0.7);
}

/* Screen shake */
.shake {
  animation: screen-shake 0.15s ease;
}

/* Mini Leaderboard */
.mini-leaderboard {
  width: 100%;
  max-width: 500px;
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-md);
  backdrop-filter: blur(8px);
  overflow: hidden;
}
.mini-leaderboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.8rem 1.2rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.mini-leaderboard-header h3 {
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.mini-filter {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-primary);
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  outline: none;
  cursor: pointer;
  margin-left: auto;
  margin-right: 10px;
}
.mini-leaderboard-header a {
  font-size: 0.7rem;
  color: var(--accent-cyan);
  text-decoration: none;
}
.lb-row {
  display: flex;
  align-items: center;
  padding: 0.6rem 1.2rem;
  gap: 0.8rem;
  transition: background var(--transition-fast);
}
.lb-row:hover { background: rgba(255,255,255,0.03); }
.lb-row.highlight { background: rgba(255,58,58,0.08); }
.lb-rank {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  width: 28px;
  text-align: center;
  color: var(--text-muted);
}
.lb-rank.gold { color: var(--gold); }
.lb-rank.silver { color: var(--silver); }
.lb-rank.bronze { color: var(--bronze); }
.lb-flag { font-size: 1.3rem; }
.lb-name { flex: 1; font-size: 0.85rem; font-weight: 500; }
.lb-clicks {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-cyan);
}

/* Canvas overlay for particles */
#particle-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 50;
}

/* --- Rankings Page --- */
.ranking-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 1rem 1rem 3rem;
}
.ranking-header {
  text-align: center;
  margin-bottom: 2rem;
}
.ranking-header h1 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: 2px;
  background: linear-gradient(135deg, var(--accent-red), var(--accent-orange));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.ranking-header p {
  color: var(--text-secondary);
  margin-top: 0.4rem;
  font-size: 0.9rem;
}

/* Global Stats Banner */
.global-stats {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}
.global-stat {
  padding: 1rem 1.5rem;
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-md);
  backdrop-filter: blur(8px);
  text-align: center;
  min-width: 140px;
}
.global-stat .gs-value {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent-orange);
}
.global-stat .gs-label {
  font-size: 0.6rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Continent Tabs */
.continent-tabs {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 1.5rem;
}
.continent-tab {
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.08);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
}
.continent-tab:hover {
  color: var(--text-primary);
  border-color: rgba(255,255,255,0.15);
}
.continent-tab.active {
  color: var(--accent-red);
  border-color: var(--accent-red);
  background: rgba(255,58,58,0.1);
}

/* Ranking Table */
.ranking-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 4px;
}
.ranking-table th {
  font-family: var(--font-display);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.6rem 1rem;
  text-align: left;
}
.ranking-table th:last-child { text-align: right; }
.ranking-table td {
  padding: 0.7rem 1rem;
  background: var(--bg-card);
  font-size: 0.9rem;
}
.ranking-table tr td:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.ranking-table tr td:last-child {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  text-align: right;
}
.ranking-table tr.my-country td {
  background: rgba(255,58,58,0.1);
  border-top: 1px solid rgba(255,58,58,0.2);
  border-bottom: 1px solid rgba(255,58,58,0.2);
}
.ranking-table tr.my-country td:first-child { border-left: 1px solid rgba(255,58,58,0.2); }
.ranking-table tr.my-country td:last-child { border-right: 1px solid rgba(255,58,58,0.2); }

.rank-cell {
  font-family: var(--font-display);
  font-weight: 700;
  width: 40px;
}
.rank-cell.r1 { color: var(--gold); }
.rank-cell.r2 { color: var(--silver); }
.rank-cell.r3 { color: var(--bronze); }

.country-cell {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.country-cell .flag { font-size: 1.4rem; }
.country-cell .name { font-weight: 500; }

.clicks-cell {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--accent-cyan);
}

/* Clicks bar in ranking */
.clicks-bar-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.clicks-bar {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,0.05);
  border-radius: 10px;
  overflow: hidden;
}
.clicks-bar-inner {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-red), var(--accent-orange));
  border-radius: 10px;
  transition: width 0.5s ease;
}

/* Top 3 Podium */
.podium {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 0.8rem;
  margin-bottom: 2rem;
  padding: 0 1rem;
}
.podium-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.2rem 1rem;
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-md);
  backdrop-filter: blur(8px);
  width: 160px;
  transition: transform var(--transition-med);
}
.podium-item:hover { transform: translateY(-4px); }
.podium-item.first {
  border-color: rgba(255,215,0,0.3);
  order: 2;
  padding: 1.5rem 1rem;
}
.podium-item.second { order: 1; }
.podium-item.third { order: 3; }
.podium-medal { font-size: 2rem; margin-bottom: 0.3rem; }
.podium-flag { font-size: 2.5rem; margin-bottom: 0.3rem; }
.podium-name {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-align: center;
}
.podium-clicks {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-cyan);
  margin-top: 4px;
}

/* --- Animations --- */
@keyframes pulse-ring {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.25); opacity: 0; }
}
@keyframes btn-flash {
  0% { filter: brightness(1); }
  50% { filter: brightness(2.5); }
  100% { filter: brightness(1); }
}
@keyframes float-up {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-80px) scale(1.3); }
}
@keyframes screen-shake {
  0%,100% { transform: translate(0,0); }
  20% { transform: translate(-3px, 2px); }
  40% { transform: translate(3px, -2px); }
  60% { transform: translate(-2px, -1px); }
  80% { transform: translate(2px, 1px); }
}
@keyframes bar-glow {
  from { box-shadow: 0 0 8px rgba(255,215,0,0.4); }
  to { box-shadow: 0 0 20px rgba(255,215,0,0.8); }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideIn {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Row entrance animation */
.ranking-table tbody tr {
  animation: fadeInUp 0.4s ease backwards;
}
.ranking-table tbody tr:nth-child(1) { animation-delay: 0.05s; }
.ranking-table tbody tr:nth-child(2) { animation-delay: 0.1s; }
.ranking-table tbody tr:nth-child(3) { animation-delay: 0.15s; }
.ranking-table tbody tr:nth-child(4) { animation-delay: 0.2s; }
.ranking-table tbody tr:nth-child(5) { animation-delay: 0.25s; }
.ranking-table tbody tr:nth-child(6) { animation-delay: 0.3s; }
.ranking-table tbody tr:nth-child(7) { animation-delay: 0.35s; }
.ranking-table tbody tr:nth-child(8) { animation-delay: 0.4s; }
.ranking-table tbody tr:nth-child(9) { animation-delay: 0.45s; }
.ranking-table tbody tr:nth-child(10) { animation-delay: 0.5s; }

/* --- Loading Spinner --- */
.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: 1rem;
}
.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(255,58,58,0.15);
  border-top-color: var(--accent-red);
  border-radius: var(--radius-full);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text {
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-secondary);
}

/* --- Advertisements --- */
.ad-banner {
  width: 100%;
  max-width: 728px;
  height: 90px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 2rem auto;
  color: var(--text-muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  border-radius: var(--radius-sm);
  position: relative;
}
.ad-banner::before {
  content: 'Advertisement';
  position: absolute;
  top: -15px;
  left: 0;
  font-size: 0.5rem;
  opacity: 0.5;
}

.ad-sticky-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 90;
  background: rgba(6, 6, 14, 0.9);
  backdrop-filter: blur(10px);
  padding: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: center;
}

.ad-sidebar {
  width: 160px;
  height: 600px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed rgba(255, 255, 255, 0.1);
  display: none; /* Hidden on small screens */
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  writing-mode: vertical-rl;
  border-radius: var(--radius-sm);
}

@media (min-width: 1400px) {
  .ad-sidebar {
    display: flex;
    position: fixed;
    top: 100px;
  }
  .ad-sidebar.left { left: 20px; }
  .ad-sidebar.right { right: 20px; }
}

/* Adjust main content padding for sticky ad */
.main-content {
  padding-bottom: 120px;
}

/* --- Chat System --- */
.chat-toggle {
  position: fixed;
  bottom: 110px;
  right: 20px;
  width: 60px;
  height: 60px;
  border-radius: var(--radius-full);
  background: var(--accent-red);
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(255, 58, 58, 0.4);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}
.chat-toggle:hover { transform: scale(1.1); }
.chat-toggle .badge {
  position: absolute;
  top: 0;
  right: 0;
  background: white;
  color: var(--accent-red);
  font-size: 0.7rem;
  font-weight: 900;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-window {
  position: fixed;
  bottom: 120px;
  right: 20px;
  width: 350px;
  height: 500px;
  background: var(--bg-card-solid);
  border: 1px solid rgba(255, 58, 58, 0.2);
  border-radius: var(--radius-md);
  display: none;
  flex-direction: column;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
  z-index: 101;
  overflow: hidden;
  animation: fadeInUp 0.3s ease;
}
.chat-window.open { display: flex; }

.chat-header {
  padding: 1rem;
  background: rgba(255, 58, 58, 0.1);
  border-bottom: 1px solid rgba(255, 58, 58, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.chat-title {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.chat-title span {
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 1.5px;
  color: var(--accent-red);
  font-weight: 900;
}
.chat-title select {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 0.8rem;
  cursor: pointer;
  outline: none;
}

.chat-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 10px; }

.chat-msg {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 85%;
}
.chat-msg.me { align-self: flex-end; align-items: flex-end; }
.chat-msg-info {
  font-size: 0.65rem;
  color: var(--text-muted);
}
.chat-msg-text {
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px 12px 12px 2px;
  font-size: 0.85rem;
  line-height: 1.4;
  word-break: break-word;
}
.chat-msg.me .chat-msg-text {
  background: var(--accent-red);
  color: white;
  border-radius: 12px 12px 2px 12px;
}
.chat-msg-system {
  align-self: center;
  font-size: 0.7rem;
  color: var(--accent-orange);
  background: rgba(255, 140, 0, 0.1);
  padding: 4px 10px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.chat-input-area, .chat-nickname-area {
  padding: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
}
.chat-input-area {
  flex-direction: row;
  gap: 8px;
}
.chat-input-area input, .chat-nickname-area input {
  flex: 1;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: white;
  outline: none;
  font-size: 0.9rem;
}
.chat-input-area input:focus, .chat-nickname-area input:focus { border-color: var(--accent-red); }
.chat-input-area button, .chat-nickname-area button {
  background: var(--accent-red);
  border: none;
  color: white;
  font-family: var(--font-display);
  font-size: 0.6rem;
  font-weight: 900;
  padding: 0 15px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

@media (max-width: 640px) {
  .chat-window {
    width: calc(100vw - 40px);
    height: 60vh;
  }
}

/* --- Responsive --- */
@media (max-width: 640px) {
  .nav { padding: 0 1rem; }
  .nav-logo { font-size: 0.9rem; }
  .nav-links a { font-size: 0.6rem; padding: 0.4rem 0.7rem; }
  .attack-btn { width: 180px; height: 180px; font-size: 1rem; }
  .attack-btn .btn-icon { font-size: 1.8rem; }
  .stats-row { gap: 0.5rem; }
  .stat-card { padding: 0.7rem; min-width: 90px; }
  .stat-card .stat-value { font-size: 1.2rem; }
  .ranking-header h1 { font-size: 1.3rem; }
  .podium-item { width: 110px; padding: 0.8rem 0.5rem; }
  .podium-flag { font-size: 1.8rem; }
  .podium-name { font-size: 0.6rem; }
  .continent-tab { font-size: 0.55rem; padding: 0.4rem 0.7rem; }
}
