:root {
  --bg-color: #030712;
  --surface: rgba(10, 18, 34, 0.88);
  --surface-elevated: rgba(15, 26, 48, 0.95);
  --border: rgba(0, 229, 255, 0.35);
  --border-subtle: rgba(255, 255, 255, 0.12);
  --primary: #00e5ff;
  --primary-glow: rgba(0, 229, 255, 0.4);
  --danger: #ff1744;
  --danger-glow: rgba(255, 23, 68, 0.5);
  --success: #00e676;
  --success-glow: rgba(0, 230, 118, 0.4);
  --warning: #ffd600;
  --warning-glow: rgba(255, 214, 0, 0.4);
  --slot-theme: #00e5ff;
  --slot-glow: rgba(0, 229, 255, 0.45);
  --font-hud: 'Chakra Petch', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-text: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: none; /* prevent mobile pinch/zoom */
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-color);
  background-image: 
    radial-gradient(ellipse at 50% 12%, rgba(0, 229, 255, 0.15) 0%, transparent 65%),
    radial-gradient(ellipse at 80% 85%, rgba(255, 23, 68, 0.08) 0%, transparent 50%),
    linear-gradient(rgba(0, 229, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 229, 255, 0.03) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 28px 28px, 28px 28px;
  background-position: 0 0, 0 0, -1px -1px, -1px -1px;
  font-family: var(--font-hud);
  color: #fff;
}

/* Cybernetic Viewport Container */
.controller-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 14px 18px env(safe-area-inset-bottom, 14px);
  justify-content: space-between;
  position: relative;
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(2, 5, 12, 0.94);
  backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-box {
  background: linear-gradient(165deg, rgba(15, 26, 48, 0.98), rgba(8, 14, 26, 0.98));
  border: 2px solid var(--border);
  border-top: 4px solid var(--primary);
  border-radius: 16px;
  padding: 32px 26px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: 0 15px 60px rgba(0, 0, 0, 0.9), 0 0 35px var(--primary-glow);
  position: relative;
  overflow: hidden;
}

.modal-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #00e5ff, transparent);
}

.modal-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 2.5px;
  color: #00e5ff;
  margin-bottom: 12px;
  text-shadow: 0 0 16px rgba(0, 229, 255, 0.7);
}

.modal-subtitle {
  font-family: var(--font-text);
  font-size: 14px;
  font-weight: 500;
  color: #94a3b8;
  line-height: 1.5;
  margin-bottom: 24px;
}

#nickname-input {
  width: 100%;
  padding: 16px 18px;
  background: rgba(2, 6, 16, 0.8);
  border: 2px solid rgba(0, 229, 255, 0.4);
  border-radius: 12px;
  color: #ffffff;
  font-family: var(--font-hud);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 22px;
  outline: none;
  text-align: center;
  letter-spacing: 1.5px;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.6);
  transition: border-color 0.2s, box-shadow 0.2s;
}

#nickname-input::placeholder {
  color: #64748b;
  font-weight: 600;
}

#nickname-input:focus {
  border-color: #00e5ff;
  background: rgba(6, 15, 32, 0.95);
  box-shadow: 0 0 20px rgba(0, 229, 255, 0.5), inset 0 2px 8px rgba(0, 0, 0, 0.6);
}

.btn-primary {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, #00b0ff, #00e5ff);
  border: none;
  border-radius: 12px;
  color: #030712;
  font-family: var(--font-hud);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 2px;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(0, 229, 255, 0.5);
  transition: transform 0.1s, box-shadow 0.1s;
}

.btn-primary:active {
  transform: scale(0.98);
  box-shadow: 0 2px 12px rgba(0, 229, 255, 0.7);
}

/* Header HUD Bar */
.controller-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 12px 18px;
  backdrop-filter: blur(16px);
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.6), 0 0 15px var(--slot-glow);
  position: relative;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.controller-header::before,
.controller-header::after {
  content: '';
  position: absolute;
  width: 8px;
  height: 8px;
  border: 2px solid var(--slot-theme);
  pointer-events: none;
}

.controller-header::before {
  top: -2px;
  left: -2px;
  border-right: none;
  border-bottom: none;
}

.controller-header::after {
  bottom: -2px;
  right: -2px;
  border-left: none;
  border-top: none;
}

.player-badge {
  display: flex;
  align-items: center;
  gap: 12px;
}

.slot-tag {
  background: var(--slot-theme);
  color: #030712;
  font-weight: 900;
  font-size: 16px;
  padding: 5px 12px;
  border-radius: 8px;
  letter-spacing: 1.5px;
  box-shadow: 0 0 12px var(--slot-glow);
  transition: background 0.3s, box-shadow 0.3s;
}

.name-tag {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: #ffffff;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9);
}

.status-indicators {
  display: flex;
  gap: 18px;
}

.stat-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 95px;
}

.stat-label {
  font-size: 11px;
  font-weight: 800;
  color: #94a3b8;
  letter-spacing: 1.2px;
  display: flex;
  justify-content: space-between;
}

.stat-bar {
  width: 100%;
  height: 9px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 5px;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6);
}

.hp-bar .bar-fill {
  background: linear-gradient(90deg, #10b981, #00e676);
  box-shadow: 0 0 8px rgba(0, 230, 118, 0.6);
  transition: width 0.2s ease, background 0.3s;
}

.ammo-bar .bar-fill {
  background: linear-gradient(90deg, #f59e0b, #ffd600);
  box-shadow: 0 0 8px rgba(255, 214, 0, 0.6);
  transition: width 0.1s ease;
}

.stat-val {
  font-size: 13px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.5px;
}

/* Gamepad Zone */
.gamepad-area {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: space-around;
  padding: 14px 0;
  gap: 20px;
}

/* Left Joystick Zone */
.joystick-zone {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.joystick-base {
  position: relative;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: 
    radial-gradient(circle at center, rgba(0, 229, 255, 0.08) 0%, rgba(10, 18, 34, 0.75) 60%, rgba(4, 8, 16, 0.95) 100%);
  border: 2px solid rgba(0, 229, 255, 0.4);
  box-shadow: 0 0 35px rgba(0, 229, 255, 0.2), inset 0 0 25px rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Radar compass tick marks */
.joystick-base::before {
  content: '';
  position: absolute;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  border: 1px dashed rgba(0, 229, 255, 0.25);
  pointer-events: none;
}

/* Deadzone Inner Circle */
.deadzone-circle {
  position: absolute;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 214, 0, 0.6);
  background: radial-gradient(circle, rgba(255, 214, 0, 0.2) 0%, rgba(255, 214, 0, 0.02) 100%);
  box-shadow: 0 0 10px rgba(255, 214, 0, 0.3);
  pointer-events: none;
}

/* Tactile Thumbstick Knob */
.joystick-stick {
  position: absolute;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: 
    radial-gradient(circle at 35% 30%, #ffffff 0%, #00e5ff 30%, #007799 75%, #004455 100%);
  border: 2px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.8), 0 0 20px var(--slot-glow);
  pointer-events: none;
  transition: transform 0.05s ease-out;
  display: flex;
  align-items: center;
  justify-content: center;
}

.joystick-stick::after {
  content: '✦';
  font-size: 16px;
  color: #030712;
  font-weight: 900;
  text-shadow: 0 0 4px rgba(255, 255, 255, 0.8);
}

.joystick-hint {
  margin-top: 14px;
  display: flex;
  gap: 14px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.8px;
}

.hint-inner {
  color: var(--warning);
  text-shadow: 0 0 8px var(--warning-glow);
}

.hint-outer {
  color: var(--primary);
  text-shadow: 0 0 8px var(--primary-glow);
}

/* Right Action Zone */
.action-zone {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
}

.quick-callouts {
  display: flex;
  gap: 12px;
  width: 100%;
  max-width: 210px;
  justify-content: center;
}

.callout-btn {
  flex: 1;
  padding: 12px 10px;
  background: rgba(15, 26, 48, 0.85);
  border: 1.5px solid rgba(0, 229, 255, 0.35);
  border-radius: 10px;
  color: #ffffff;
  font-family: var(--font-hud);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5), 0 0 10px rgba(0, 229, 255, 0.15);
  transition: all 0.15s ease;
}

.callout-btn:active {
  background: rgba(0, 229, 255, 0.35);
  border-color: #00e5ff;
  color: #fff;
  transform: scale(0.96);
  box-shadow: 0 0 20px rgba(0, 229, 255, 0.5);
}

/* High-Impact Tactical Fire Button */
.shoot-btn {
  width: 165px;
  height: 165px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff5252 0%, #ff1744 40%, #b71c1c 80%, #7f0000 100%);
  border: 4px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 10px 40px rgba(255, 23, 68, 0.65), 0 0 25px rgba(255, 23, 68, 0.4), inset 0 3px 8px rgba(255, 255, 255, 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.06s ease, box-shadow 0.06s ease;
  position: relative;
  overflow: hidden;
}

.shoot-btn::before {
  content: '';
  position: absolute;
  width: 145px;
  height: 145px;
  border-radius: 50%;
  border: 2px dashed rgba(255, 255, 255, 0.3);
  pointer-events: none;
}

.shoot-btn:active, .shoot-btn.active {
  transform: scale(0.92);
  box-shadow: 0 2px 15px rgba(255, 23, 68, 0.9), inset 0 0 25px rgba(0, 0, 0, 0.85);
  background: radial-gradient(circle at 35% 30%, #ff1744 0%, #b71c1c 60%, #4a0000 100%);
}

.shoot-icon {
  font-size: 38px;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.8));
}

.shoot-label {
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 2.5px;
  color: #ffffff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.95);
}

.shoot-sub {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.2px;
  color: #ffcdd2;
  text-shadow: 0 1px 4px #000;
}

/* Footer Status Bar */
.controller-footer {
  text-align: center;
  padding: 8px 14px;
  background: rgba(10, 18, 34, 0.75);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  backdrop-filter: blur(12px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

.status-msg {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: #00e5ff;
  text-shadow: 0 0 8px rgba(0, 229, 255, 0.4);
}
