
:root {
  --bg-color: #0b0e14;
  --panel-bg: rgba(15, 20, 28, 0.85);
  --panel-border: rgba(255, 255, 255, 0.12);
  --panel-glow: rgba(0, 0, 0, 0.6);
  --accent-red: #ef4444;
  --accent-red-glow: rgba(239, 68, 68, 0.4);
  --accent-green: #22c55e;
  --accent-green-glow: rgba(34, 197, 94, 0.4);
  --accent-amber: #f59e0b;
  --accent-cyan: #06b6d4;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-color);
  font-family: var(--font-family);
  color: var(--text-main);
  background: radial-gradient(circle at center, #141a24 0%, #080a0f 100%);
}

#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

canvas#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  background-color: #11141c;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.vignette-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 55%, rgba(0, 0, 0, 0.75) 100%);
  z-index: 10;
}

#top-xp-bar-wrap {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 10px;
  background: rgba(8, 12, 20, 0.92);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  z-index: 30;
  pointer-events: none;
  overflow: visible;
}

#top-xp-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #059669 0%, #10b981 60%, #34d399 100%);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.75);
  transition: width 0.16s ease-out;
}

#top-xp-bar-wrap.levelup-flash #top-xp-bar-fill {
  background: linear-gradient(90deg, #f59e0b 0%, #fde047 50%, #4ade80 100%);
  box-shadow: 0 0 24px rgba(250, 204, 21, 0.95);
}

#top-xp-bar-wrap.levelup-flash {
  animation: xpBarFlash 0.65s ease-out;
}

@keyframes xpBarFlash {
  0% { filter: brightness(2.4); box-shadow: 0 0 28px rgba(250, 204, 21, 0.95); }
  100% { filter: brightness(1); box-shadow: none; }
}

#top-xp-level-tag {
  position: absolute;
  left: 50%;
  top: 12px;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #6ee7b7;
  background: rgba(10, 15, 24, 0.85);
  border: 1px solid rgba(16, 185, 129, 0.35);
  padding: 2px 10px;
  border-radius: 4px;
  white-space: nowrap;
}

#low-hp-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(220, 38, 38, 0) 48%, rgba(220, 38, 38, 0.48) 100%);
  opacity: 0;
  z-index: 11;
}

#low-hp-overlay.active {
  animation: lowHpPulse 1.15s ease-in-out infinite;
}

@keyframes lowHpPulse {
  0%, 100% { opacity: 0.25; }
  50% { opacity: 0.92; }
}

#hurt-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(239, 68, 68, 0) 30%, rgba(220, 38, 38, 0.48) 100%);
  opacity: 0;
  transition: opacity 0.15s ease-out;
  z-index: 12;
}

#hurt-overlay.active {
  opacity: 1;
}

#hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 20;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 28px 24px 18px;
}

.hud-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  width: 100%;
  position: relative;
}

.hud-panel {
  background: var(--panel-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--panel-border);
  box-shadow: 0 4px 18px var(--panel-glow);
  border-radius: 8px;
  padding: 12px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: auto;
}

.hud-left {
  min-width: 250px;
}

.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.stat-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 11px;
}

.stat-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.bar-track {
  width: 100%;
  height: 9px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.bar-fill {
  height: 100%;
  width: 100%;
  transition: width 0.15s ease-out;
  border-radius: 3px;
}

.hp-fill {
  background: linear-gradient(90deg, #dc2626 0%, #ef4444 100%);
  box-shadow: 0 0 8px var(--accent-red-glow);
}

.xp-fill {
  background: linear-gradient(90deg, #059669 0%, #10b981 100%);
  box-shadow: 0 0 8px var(--accent-green-glow);
}

.weapon-info {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 2px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.weapon-name {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #e2e8f0;
}

.ammo-display {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #38bdf8;
}

.ammo-display.low {
  color: #f87171;
  animation: pulseLow 0.8s infinite alternate;
}

.ammo-display.reloading {
  color: var(--accent-amber);
  font-size: 12px;
  animation: pulseReload 0.6s infinite alternate;
}

.character-badge-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

.char-hud-badge {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #38bdf8;
  text-transform: uppercase;
}

.passive-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 2px;
}

.passive-status-row:empty {
  display: none;
}

.passive-pill {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #cbd5e1;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.passive-pill.ready {
  border-color: rgba(56, 189, 248, 0.55);
  color: #38bdf8;
}

.passive-pill.active-buff {
  border-color: rgba(239, 68, 68, 0.7);
  color: #fca5a5;
  background: rgba(127, 29, 29, 0.45);
}

.passive-pill.shield-up {
  border-color: rgba(34, 211, 238, 0.65);
  color: #67e8f9;
  background: rgba(8, 51, 68, 0.55);
}

@keyframes pulseLow {
  from { opacity: 1; text-shadow: 0 0 4px rgba(248, 113, 113, 0.2); }
  to { opacity: 0.5; text-shadow: 0 0 10px rgba(248, 113, 113, 0.8); }
}

@keyframes pulseReload {
  from { opacity: 1; }
  to { opacity: 0.4; }
}

.hud-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 380px;
  max-width: 90vw;
  pointer-events: none;
}

#boss-hud {
  width: 100%;
  display: none;
  background: rgba(18, 12, 16, 0.9);
  border: 1px solid rgba(239, 68, 68, 0.5);
  border-radius: 8px;
  padding: 10px 16px;
  box-shadow: 0 0 24px rgba(220, 38, 38, 0.35);
  backdrop-filter: blur(8px);
}

.boss-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.boss-name {
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 2px;
  color: #f87171;
  text-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
}

.boss-hp-text {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: #fca5a5;
}

.boss-bar-track {
  width: 100%;
  height: 12px;
  background: #1e1014;
  border-radius: 4px;
  border: 1px solid rgba(239, 68, 68, 0.3);
  overflow: hidden;
}

.boss-bar-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #b91c1c 0%, #ef4444 50%, #f87171 100%);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.8);
  transition: width 0.1s linear;
}

#warning-banner,
#horde-banner {
  display: none;
  background: rgba(185, 28, 28, 0.95);
  border: 2px solid #ef4444;
  color: #fff;
  padding: 10px 24px;
  border-radius: 6px;
  font-weight: 900;
  font-size: 16px;
  letter-spacing: 2px;
  text-align: center;
  text-transform: uppercase;
  box-shadow: 0 0 30px rgba(239, 68, 68, 0.7);
  animation: bannerShake 0.4s infinite alternate;
}

#horde-banner {
  background: rgba(154, 52, 18, 0.95);
  border-color: #f97316;
  box-shadow: 0 0 28px rgba(249, 115, 22, 0.75);
}

@keyframes bannerShake {
  0% { transform: scale(1); }
  100% { transform: scale(1.03); }
}

.hud-right {
  min-width: 180px;
  text-align: right;
}

.hud-right .stat-row {
  justify-content: flex-end;
  gap: 12px;
}

.timer-large {
  font-size: 22px;
  color: #f8fafc;
  letter-spacing: 1px;
}

.kills-value {
  color: #ef4444;
  font-size: 15px;
}

.score-value {
  color: var(--accent-amber);
  font-size: 15px;
}

.hud-bottom {
  display: flex;
  justify-content: center;
  align-items: center;
}

.controls-hint {
  background: rgba(15, 20, 28, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 6px 18px;
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.5px;
  font-weight: 500;
  backdrop-filter: blur(4px);
}

.controls-hint span {
  color: var(--text-muted);
  font-weight: 700;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 7, 12, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease-out;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: #111622;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 20px rgba(0, 0, 0, 0.5);
  padding: 30px 36px;
  max-width: 680px;
  width: 92%;
  max-height: 90vh;
  overflow-y: auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transform: translateY(12px) scale(0.97);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-box::-webkit-scrollbar {
  width: 6px;
}
.modal-box::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

.character-select-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(0, 0, 0, 0.4);
  padding: 16px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.char-section-title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--accent-amber);
  text-align: left;
  text-transform: uppercase;
}

.character-select-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.career-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  background: rgba(0, 0, 0, 0.38);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 8px 12px;
}

.career-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.career-stat span {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 0.5px;
}

.career-stat strong {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 800;
  color: #f8fafc;
}

.career-stat.sp-stat strong {
  color: #38bdf8;
}

.char-card-btn {
  background: #161c27;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.15s ease-out;
  text-align: center;
  position: relative;
}

.char-card-btn:hover {
  background: #1f2737;
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
}

.char-card-btn.active {
  background: #1e283b;
  border-color: #38bdf8;
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.35);
  transform: translateY(-2px);
}

.char-card-btn.locked {
  opacity: 0.62;
  background: #10141d;
  border-style: dashed;
  border-color: rgba(245, 158, 11, 0.35);
}

.char-card-btn.locked:hover {
  transform: none;
  border-color: rgba(245, 158, 11, 0.65);
}

.char-lock-hint {
  font-size: 10px;
  color: #fbbf24;
  font-weight: 700;
  line-height: 1.2;
}

.char-card-icon {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: rgba(255, 255, 255, 0.06);
}

.char-card-name {
  font-size: 12px;
  font-weight: 800;
  color: #f8fafc;
  line-height: 1.2;
}

.char-card-title {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.char-mini-bars {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 2px;
}

.char-mini-bar-row {
  display: grid;
  grid-template-columns: 32px 1fr;
  align-items: center;
  gap: 4px;
  font-size: 9px;
  color: #94a3b8;
  text-align: left;
}

.char-mini-track {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
}

.char-mini-fill {
  height: 100%;
  border-radius: 2px;
}

.char-mini-fill.hp { background: #ef4444; }
.char-mini-fill.spd { background: #10b981; }
.char-mini-fill.dmg { background: #f59e0b; }

.character-detail-card {
  background: #111722;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.char-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 6px;
}

.char-detail-name {
  font-size: 14px;
  font-weight: 800;
  color: #f1f5f9;
  display: flex;
  align-items: center;
  gap: 8px;
}

.char-weapon-pill {
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 700;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.25);
  padding: 2px 8px;
  border-radius: 4px;
}

.char-detail-desc {
  font-size: 12px;
  color: #cbd5e1;
  line-height: 1.45;
}

.char-perks-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.char-perk-item {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.char-perk-item strong {
  color: #f8fafc;
}

.color-palette-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #111722;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 10px 14px;
}

.color-palette-grid {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  flex-wrap: wrap;
}

.color-swatch-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: all 0.15s ease-out;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.color-swatch-btn:hover {
  transform: scale(1.15);
  border-color: #fff;
}

.color-swatch-btn.active {
  transform: scale(1.18);
  border-color: #f8fafc;
  box-shadow: 0 0 12px currentColor;
}

.color-swatch-btn.active::after {
  content: '✓';
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

.modal-box.language-box {
  max-width: 520px;
  padding: 36px 32px;
  gap: 22px;
}

.lang-select-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.lang-btn {
  background: #182232;
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  color: #f8fafc;
}

.lang-btn:hover {
  background: #223048;
  border-color: var(--accent-amber);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 16px rgba(245, 158, 11, 0.25);
}

.lang-flag {
  font-size: 32px;
}

.lang-name {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.lang-desc {
  font-size: 11px;
  color: var(--text-muted);
}

.modal-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.lang-switch-badge {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--text-main);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.lang-switch-badge:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: var(--accent-amber);
}

.hud-pause-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 4px;
  align-self: flex-end;
  transition: all 0.15s ease;
}

.hud-pause-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.mobile-controls-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 25;
  display: none;
}

.joystick-zone {
  position: absolute;
  left: 20px;
  bottom: 24px;
  width: 130px;
  height: 130px;
  pointer-events: auto;
  touch-action: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.joystick-base {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(30, 41, 59, 0.6) 0%, rgba(15, 23, 42, 0.8) 100%);
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.joystick-thumb {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
  border: 2px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 2px 10px rgba(56, 189, 248, 0.5);
  position: absolute;
  transform: translate(0px, 0px);
  pointer-events: none;
  transition: transform 0.04s linear;
}

.touch-actions-group {
  position: absolute;
  right: 20px;
  bottom: 24px;
  display: flex;
  gap: 16px;
  align-items: flex-end;
  pointer-events: auto;
  touch-action: none;
}

.touch-circle-btn {
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 255, 255, 0.3);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  transition: transform 0.1s ease, background 0.1s ease;
}

.touch-circle-btn:active {
  transform: scale(0.92);
}

.touch-circle-btn.reload-btn {
  width: 58px;
  height: 58px;
  margin-bottom: 12px;
  background: rgba(30, 41, 59, 0.88);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.45);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}

.touch-circle-btn.dash-btn {
  width: 58px;
  height: 58px;
  margin-bottom: 12px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.9) 0%, rgba(5, 150, 105, 0.9) 100%);
  color: #ffffff;
  border-color: rgba(110, 231, 183, 0.7);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.45);
}

.touch-circle-btn.dash-btn.on-cooldown {
  background: rgba(15, 23, 42, 0.82);
  color: #94a3b8;
  border-color: rgba(148, 163, 184, 0.3);
  box-shadow: none;
}

.aim-joystick-zone {
  width: 120px;
  height: 120px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.aim-joystick-base {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(239, 68, 68, 0.18) 0%, rgba(15, 23, 42, 0.82) 100%);
  border: 2px dashed rgba(239, 68, 68, 0.55);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), inset 0 0 16px rgba(239, 68, 68, 0.2);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.aim-joystick-zone.active .aim-joystick-base {
  border-color: rgba(239, 68, 68, 0.95);
  border-style: solid;
  box-shadow: 0 0 25px rgba(239, 68, 68, 0.6), inset 0 0 20px rgba(239, 68, 68, 0.35);
}

.aim-joystick-thumb {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 3px 14px rgba(239, 68, 68, 0.65);
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transform: translate(0px, 0px);
  transition: transform 0.04s linear;
  color: #ffffff;
}

.aim-joystick-zone.active .aim-joystick-thumb {
  background: linear-gradient(135deg, #f87171 0%, #dc2626 100%);
  box-shadow: 0 0 18px rgba(239, 68, 68, 0.9);
}

.aim-thumb-icon {
  font-size: 20px;
  line-height: 1;
  pointer-events: none;
}

.aim-thumb-text {
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-top: 2px;
  pointer-events: none;
}

.touch-btn-icon {
  font-size: 20px;
  line-height: 1;
}

.touch-btn-text {
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-top: 2px;
}

.modal-overlay.active .modal-box {
  transform: translateY(0) scale(1);
}

.game-title {
  font-size: 38px;
  font-weight: 900;
  letter-spacing: 4px;
  color: #f1f5f9;
  text-transform: uppercase;
  margin-bottom: -6px;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
}

.game-title span {
  color: var(--accent-red);
  text-shadow: 0 0 20px var(--accent-red-glow);
}

.modal-subtitle {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-muted);
  font-weight: 600;
}

.modal-desc {
  font-size: 14px;
  color: #cbd5e1;
  line-height: 1.6;
}

.controls-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  background: rgba(0, 0, 0, 0.35);
  padding: 16px 20px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  text-align: left;
}

.ctrl-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: #94a3b8;
}

.key-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 26px;
  padding: 0 6px;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  color: #f8fafc;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 11px;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.4);
}

.btn-primary {
  background: linear-gradient(180deg, #dc2626 0%, #b91c1c 100%);
  color: #ffffff;
  border: 1px solid #ef4444;
  border-radius: 8px;
  padding: 14px 28px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(220, 38, 38, 0.4);
  transition: all 0.15s ease-out;
  outline: none;
}

.btn-primary:hover {
  background: linear-gradient(180deg, #ef4444 0%, #dc2626 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(239, 68, 68, 0.55);
}

.btn-primary:active {
  transform: translateY(1px);
  box-shadow: 0 2px 10px rgba(220, 38, 38, 0.3);
}

.btn-secondary {
  background: #1e293b;
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 12px 24px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.15s ease-out;
  outline: none;
}

.btn-secondary:hover {
  background: #334155;
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.25);
}

.btn-group {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.modal-box.level-up-box {
  max-width: 860px;
  padding: 24px 28px;
}

.level-up-title {
  color: var(--accent-amber);
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 2px;
  text-shadow: 0 0 16px rgba(245, 158, 11, 0.5);
}

.upgrade-cards-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 8px 0;
}

.upgrade-card {
  background: #141c2b;
  border: 2px solid rgba(148, 163, 184, 0.45);
  border-radius: 12px;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 9px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.upgrade-card.rarity-common {
  border-color: #94a3b8;
  background: linear-gradient(180deg, rgba(148, 163, 184, 0.1) 0%, #141c2b 45%);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
}

.upgrade-card.rarity-rare {
  border-color: #38bdf8;
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.14) 0%, #131e32 45%);
  box-shadow: 0 4px 18px rgba(56, 189, 248, 0.2);
}

.upgrade-card.rarity-epic {
  border-color: #c084fc;
  background: linear-gradient(180deg, rgba(168, 85, 247, 0.2) 0%, #1a162d 48%);
  box-shadow: 0 4px 22px rgba(168, 85, 247, 0.3);
}

.upgrade-card:hover {
  transform: translateY(-4px);
}

.upgrade-card.rarity-common:hover {
  background: linear-gradient(180deg, rgba(148, 163, 184, 0.18) 0%, #1a2436 50%);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.5), 0 0 16px rgba(148, 163, 184, 0.3);
}

.upgrade-card.rarity-rare:hover {
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.22) 0%, #162640 50%);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.5), 0 0 20px rgba(56, 189, 248, 0.45);
}

.upgrade-card.rarity-epic:hover {
  background: linear-gradient(180deg, rgba(168, 85, 247, 0.28) 0%, #231c3d 50%);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.5), 0 0 24px rgba(192, 132, 252, 0.55);
}

.upgrade-card:active {
  transform: translateY(-1px);
}

.upgrade-card-top {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.upgrade-rarity-badge {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.rarity-common .upgrade-rarity-badge {
  background: rgba(148, 163, 184, 0.2);
  color: #e2e8f0;
  border: 1px solid rgba(148, 163, 184, 0.45);
}

.rarity-rare .upgrade-rarity-badge {
  background: rgba(56, 189, 248, 0.22);
  color: #7dd3fc;
  border: 1px solid rgba(56, 189, 248, 0.55);
}

.rarity-epic .upgrade-rarity-badge {
  background: rgba(168, 85, 247, 0.25);
  color: #e9d5ff;
  border: 1px solid rgba(192, 132, 252, 0.65);
}

.upgrade-category-badge {
  font-size: 10px;
  font-weight: 700;
  color: #94a3b8;
  background: rgba(0, 0, 0, 0.35);
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.upgrade-class-badge {
  font-size: 10px;
  font-weight: 800;
  color: #fcd34d;
  background: rgba(245, 158, 11, 0.16);
  border: 1px solid rgba(245, 158, 11, 0.45);
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.upgrade-icon-wrap {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

.rarity-common .upgrade-icon-wrap {
  background: rgba(148, 163, 184, 0.12);
  border-color: rgba(148, 163, 184, 0.35);
}

.rarity-rare .upgrade-icon-wrap {
  background: rgba(56, 189, 248, 0.14);
  border-color: rgba(56, 189, 248, 0.45);
}

.rarity-epic .upgrade-icon-wrap {
  background: rgba(168, 85, 247, 0.18);
  border-color: rgba(192, 132, 252, 0.55);
}

.upgrade-card-name {
  font-size: 15px;
  font-weight: 800;
  color: #f8fafc;
  line-height: 1.25;
}

.upgrade-level-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.14);
  border: 1px solid rgba(245, 158, 11, 0.35);
  padding: 2px 9px;
  border-radius: 6px;
}

.upgrade-card-desc {
  font-size: 12px;
  color: #cbd5e1;
  line-height: 1.45;
  margin-top: 2px;
}

.reroll-bar {
  display: flex;
  justify-content: center;
  margin-top: 4px;
}

.btn-reroll {
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.45);
  border-radius: 8px;
  padding: 10px 22px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.btn-reroll:hover:not(:disabled) {
  background: linear-gradient(180deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  border-color: #7dd3fc;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(56, 189, 248, 0.35);
}

.btn-reroll:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  color: #64748b;
  border-color: rgba(100, 116, 139, 0.3);
}

.btn-armory {
  background: linear-gradient(180deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  border: 1px solid #38bdf8;
  border-radius: 8px;
  padding: 12px 20px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.15s ease-out;
  box-shadow: 0 4px 16px rgba(2, 132, 199, 0.35);
}

.btn-armory:hover {
  background: linear-gradient(180deg, #0ea5e9 0%, #0284c7 100%);
  transform: translateY(-2px);
}

.sp-balance-badge {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: #cbd5e1;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 8px;
  padding: 6px 14px;
}

.sp-balance-badge strong {
  color: #38bdf8;
  font-size: 16px;
}

.armory-upgrades-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  text-align: left;
}

.armory-item-card {
  background: #161e2e;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.armory-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.armory-item-name {
  font-size: 13px;
  font-weight: 800;
  color: #f8fafc;
}

.armory-item-lv {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: #fbbf24;
}

.armory-item-desc {
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.35;
}

.btn-buy-meta {
  background: #1e293b;
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.45);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
  align-self: flex-start;
}

.btn-buy-meta:hover:not(:disabled) {
  background: #0284c7;
  color: #ffffff;
}

.btn-buy-meta:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  color: #64748b;
  border-color: rgba(100, 116, 139, 0.3);
}

.pause-build-section,
.summary-build-section {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px 12px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.build-upgrades-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 120px;
  overflow-y: auto;
}

.build-upgrade-chip {
  font-size: 11px;
  font-weight: 700;
  color: #e2e8f0;
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 6px;
  padding: 3px 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.build-upgrade-chip.rarity-rare {
  border-color: rgba(56, 189, 248, 0.55);
  color: #bae6fd;
}

.build-upgrade-chip.rarity-epic {
  border-color: rgba(192, 132, 252, 0.65);
  color: #e9d5ff;
}

.build-upgrade-empty {
  font-size: 12px;
  color: var(--text-dim);
}

.summary-share-card {
  max-width: 620px;
  background: linear-gradient(180deg, #161d2e 0%, #0e131e 100%);
  border: 1px solid rgba(239, 68, 68, 0.35);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.85);
}

.summary-share-card.victory-share-card {
  border-color: rgba(34, 197, 94, 0.45);
}

.summary-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.summary-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
  padding: 3px 10px;
  border-radius: 4px;
}

.gameover-tag {
  background: rgba(239, 68, 68, 0.16);
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: #fca5a5;
}

.victory-tag {
  background: rgba(34, 197, 94, 0.16);
  border: 1px solid rgba(34, 197, 94, 0.45);
  color: #86efac;
}

.new-record-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 1px;
  color: #fef08a;
  background: rgba(245, 158, 11, 0.25);
  border: 1px solid #f59e0b;
  padding: 3px 10px;
  border-radius: 4px;
  animation: bannerShake 0.6s infinite alternate;
}

.stats-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px 16px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 14px 18px;
  text-align: left;
}

.summary-stat-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.summary-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.summary-stat-value {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 800;
  color: #f8fafc;
}

.summary-stat-value.highlight-red {
  color: #f87171;
}

.summary-stat-value.highlight-amber {
  color: #fbbf24;
}

.summary-stat-value.highlight-green {
  color: #4ade80;
}

.summary-stat-value.highlight-cyan {
  color: #38bdf8;
}

.summary-cta-row {
  margin-top: 4px;
}

.btn-play-again-lg {
  flex: 1;
  padding: 15px 28px;
  font-size: 16px;
}

.victory-title {
  color: #4ade80;
  text-shadow: 0 0 20px rgba(74, 222, 128, 0.5);
}

.gameover-title {
  color: #ef4444;
  text-shadow: 0 0 20px rgba(239, 68, 68, 0.6);
}

.audio-toggle-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-muted);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.audio-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

@media (max-width: 768px), (pointer: coarse) {
  .mobile-controls-overlay {
    display: block;
  }
  .desktop-only {
    display: none !important;
  }
}

@media (max-width: 640px) {
  .character-select-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .career-strip {
    grid-template-columns: repeat(2, 1fr);
  }
  .armory-upgrades-grid {
    grid-template-columns: 1fr;
  }
  .upgrade-cards-container {
    grid-template-columns: 1fr;
  }
  .lang-select-grid {
    grid-template-columns: 1fr;
  }
  .hud-top {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
  }
  .hud-left {
    min-width: 170px;
    flex: 1;
    padding: 8px 12px;
  }
  .hud-right {
    min-width: 130px;
    padding: 8px 12px;
  }
  .hud-center {
    position: static;
    transform: none;
    min-width: 100%;
    order: 3;
    margin-top: 4px;
  }
  .timer-large {
    font-size: 18px;
  }
  .modal-box {
    padding: 22px 18px;
    width: 95%;
  }
  .game-title {
    font-size: 28px;
  }
}

body.touch-device .mobile-controls-overlay {
  display: block;
}

body.touch-device .desktop-only {
  display: none !important;
}

.mobile-controls-overlay.touch-hidden {
  display: none !important;
}

@media (min-width: 768px) and (max-width: 1366px) and (pointer: coarse) {
  .joystick-zone {
    width: 145px;
    height: 145px;
    left: 28px;
    bottom: 28px;
  }
  .joystick-base {
    width: 135px;
    height: 135px;
  }
  .joystick-thumb {
    width: 58px;
    height: 58px;
  }
  .touch-actions-group {
    right: 28px;
    bottom: 28px;
    gap: 18px;
  }
  .touch-circle-btn.reload-btn,
  .touch-circle-btn.dash-btn {
    width: 66px;
    height: 66px;
    margin-bottom: 16px;
  }
  .aim-joystick-zone {
    width: 145px;
    height: 145px;
  }
  .aim-joystick-base {
    width: 135px;
    height: 135px;
  }
  .aim-joystick-thumb {
    width: 68px;
    height: 68px;
  }
}

@media (max-height: 520px) {
  .modal-box {
    padding: 10px 16px !important;
    gap: 6px !important;
    max-height: 95vh !important;
  }
  .modal-box.level-up-box {
    padding: 10px 14px !important;
  }
  .level-up-title {
    font-size: 18px !important;
  }
  .upgrade-cards-container {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 8px !important;
    margin: 4px 0 !important;
  }
  .upgrade-card {
    padding: 8px 6px !important;
    gap: 4px !important;
  }
  .upgrade-icon-wrap {
    width: 32px !important;
    height: 32px !important;
    font-size: 18px !important;
  }
  .upgrade-card-name {
    font-size: 12px !important;
  }
  .upgrade-card-desc {
    font-size: 10px !important;
    line-height: 1.25 !important;
  }
  .btn-reroll {
    padding: 6px 14px !important;
    font-size: 11px !important;
  }
  .game-title {
    font-size: 20px !important;
  }
  .modal-subtitle {
    font-size: 10px !important;
  }
  .modal-desc {
    display: none !important;
  }
  .char-section-title {
    font-size: 10px !important;
  }
  .character-select-grid {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 6px !important;
  }
  .char-card-btn {
    padding: 4px 2px !important;
    gap: 2px !important;
  }
  .char-card-icon {
    width: 24px !important;
    height: 24px !important;
    font-size: 14px !important;
  }
  .char-card-name {
    font-size: 10px !important;
  }
  .char-card-title {
    display: none !important;
  }
  .character-detail-card {
    padding: 4px 8px !important;
    gap: 2px !important;
  }
  .char-detail-desc {
    display: none !important;
  }
  .color-palette-section {
    padding: 4px 8px !important;
  }
  .color-swatch-btn {
    width: 20px !important;
    height: 20px !important;
  }
  .controls-grid {
    display: none !important;
  }
  .btn-group {
    margin-top: 4px !important;
  }
}

