:root {
  --bg-primary: #080a0e;
  --bg-surface: #0e1219;
  --bg-card: #131822;
  --color-amber: #f59e0b;
  --color-amber-glow: rgba(245, 158, 11, 0.4);
  --color-orange: #ff7700;
  --color-gold: #fbbf24;
  --color-cyan: #38bdf8;
  --color-green: #10b981;
  --color-red: #ef4444;
  --border-tactical: #1e293b;
  --text-bright: #f8fafc;
  --text-muted: #94a3b8;
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-bright);
  font-family: 'Share Tech Mono', monospace;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 50% 15%, rgba(245, 158, 11, 0.08) 0%, transparent 45%),
    radial-gradient(circle at 80% 85%, rgba(56, 189, 248, 0.04) 0%, transparent 40%),
    linear-gradient(rgba(15, 23, 42, 0.8) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.8) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 28px 28px, 28px 28px;
}

.screen-container {
  width: 100%;
  max-width: 520px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

/* 1. Server Status Bar */
.server-status-bar {
  width: 100%;
  background: linear-gradient(90deg, rgba(15, 23, 42, 0.95), rgba(10, 14, 23, 0.95));
  border: 1px solid #f59e0b;
  border-left: 4px solid #f59e0b;
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.2);
  border-radius: 4px;
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.server-info-col {
  display: flex;
  flex-direction: column;
}

.server-badge {
  font-family: 'Orbitron', 'Teko', sans-serif;
  font-size: 13px;
  font-weight: 800;
  color: #ffaa00;
  letter-spacing: 1.5px;
  text-shadow: 0 0 8px rgba(255, 170, 0, 0.5);
}

.server-sub {
  font-size: 9px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.server-stats-col {
  display: flex;
  align-items: center;
  gap: 10px;
}

.server-stat-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
}

.pulse-online-dot {
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 8px #10b981;
  animation: pulseDot 1.4s infinite alternate;
}

@keyframes pulseDot {
  0% { transform: scale(0.8); opacity: 0.6; }
  100% { transform: scale(1.2); opacity: 1; box-shadow: 0 0 12px #10b981; }
}

.stat-status-text {
  color: #10b981;
  font-weight: bold;
  font-size: 10px;
  letter-spacing: 1px;
}

.stat-highlight {
  color: #fff;
  font-family: 'Orbitron', monospace;
  font-weight: bold;
  font-size: 12px;
}

.stat-slash {
  color: var(--text-muted);
  font-size: 10px;
}

.server-connect-btn {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(245, 158, 11, 0.4));
  border: 1px solid #f59e0b;
  color: #fff;
  padding: 4px 8px;
  border-radius: 3px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.server-connect-btn:hover {
  background: #f59e0b;
  color: #000;
  box-shadow: 0 0 10px #f59e0b;
}

/* 2. HUD Header */
.hud-header {
  width: 100%;
  background: rgba(14, 18, 25, 0.95);
  border: 1px solid var(--border-tactical);
  border-radius: 6px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hud-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 8px;
}

.brand-box {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bcu-icon {
  width: 14px;
  height: 14px;
  background: #f59e0b;
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
  animation: bcuGlow 2s infinite alternate;
}

@keyframes bcuGlow {
  0% { box-shadow: 0 0 4px #f59e0b; opacity: 0.7; }
  100% { box-shadow: 0 0 12px #f59e0b; opacity: 1; }
}

.hud-title {
  font-family: 'Orbitron', monospace;
  font-size: 13px;
  font-weight: 900;
  color: #fff;
  letter-spacing: 1px;
}

.hud-subtitle {
  font-size: 9px;
  color: var(--color-amber);
  display: block;
}

.difficulty-picker {
  display: flex;
  gap: 4px;
}

.diff-btn {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid #334155;
  color: #94a3b8;
  padding: 4px 8px;
  font-size: 10px;
  font-family: 'Orbitron', monospace;
  font-weight: bold;
  border-radius: 3px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.diff-btn.active {
  border-color: #f59e0b;
  color: #fff;
  background: rgba(245, 158, 11, 0.2);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.3);
}

.diff-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.diff-dot.iron { background: #94a3b8; }
.diff-dot.silver { background: #e2e8f0; box-shadow: 0 0 4px #e2e8f0; }
.diff-dot.gold { background: #fbbf24; box-shadow: 0 0 6px #fbbf24; }
.diff-dot.killbox { background: #ef4444; box-shadow: 0 0 6px #ef4444; }

.hud-stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.stat-card {
  background: rgba(6, 9, 14, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  padding: 5px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  justify-content: center;
}

.stat-title {
  font-size: 8px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.stat-val {
  font-family: 'Orbitron', monospace;
  font-size: 11px;
  font-weight: bold;
}

.text-amber { color: #f59e0b; }
.text-cyan { color: #38bdf8; }
.text-green { color: #10b981; }
.text-gold { color: #fbbf24; }

.pick-icons-container {
  display: flex;
  gap: 2px;
  font-size: 11px;
}

.stress-bar-wrapper {
  width: 100%;
  height: 8px;
  background: rgba(30, 41, 59, 0.8);
  border-radius: 2px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: 2px;
}

.stress-bar-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #10b981, #f59e0b, #ef4444);
  transition: width 0.06s ease;
}

/* 3. Game Wrapper & Canvas */
.game-wrapper {
  width: 100%;
  display: flex;
  justify-content: center;
}

.canvas-border {
  position: relative;
  border: 2px solid #334155;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 0 25px rgba(0, 0, 0, 0.8), 0 0 10px rgba(245, 158, 11, 0.15);
  background: #050608;
  width: 460px;
  height: 460px;
}

.canvas-border.scanlines::after {
  content: " ";
  display: block;
  position: absolute;
  top: 0; left: 0; bottom: 0; right: 0;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%);
  background-size: 100% 4px;
  z-index: 10;
  pointer-events: none;
}

#lockCanvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #0a0d14;
}

/* Cam Overlays */
.cam-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 5;
}

.cam-corner {
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(245, 158, 11, 0.5);
}
.cam-corner.tl { top: 8px; left: 8px; border-right: 0; border-bottom: 0; }
.cam-corner.tr { top: 8px; right: 8px; border-left: 0; border-bottom: 0; }
.cam-corner.bl { bottom: 8px; left: 8px; border-right: 0; border-top: 0; }
.cam-corner.br { bottom: 8px; right: 8px; border-left: 0; border-top: 0; }

/* 4. Overlay Modals */
.game-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(4, 6, 10, 0.88);
  backdrop-filter: blur(5px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 20;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  padding: 16px;
}

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

.overlay-card {
  background: linear-gradient(180deg, #131822, #0d1117);
  border: 1px solid #f59e0b;
  border-radius: 8px;
  box-shadow: 0 0 25px rgba(245, 158, 11, 0.3);
  padding: 18px 16px;
  text-align: center;
  max-width: 380px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.lock-badge-icon {
  font-size: 32px;
  filter: drop-shadow(0 0 8px rgba(245, 158, 11, 0.6));
}

.overlay-title {
  font-family: 'Orbitron', monospace;
  font-size: 16px;
  font-weight: 900;
  color: #fff;
  letter-spacing: 1px;
}

.overlay-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Loot Display */
.loot-container {
  width: 100%;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(16, 185, 129, 0.4);
  border-radius: 6px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.loot-container.hidden { display: none; }

.loot-badge {
  font-size: 10px;
  color: #10b981;
  font-weight: bold;
  letter-spacing: 1px;
}

.loot-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.loot-item-card {
  background: rgba(6, 9, 14, 0.8);
  border: 1px solid #334155;
  border-radius: 4px;
  padding: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
}

.loot-item-icon {
  font-size: 18px;
}

.loot-item-name {
  font-size: 10px;
  font-weight: bold;
  color: #fff;
  display: block;
}

.loot-item-qty {
  font-size: 8px;
  color: #fbbf24;
}

/* Reward Claim Box */
.reward-box {
  width: 100%;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: 6px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.reward-box.hidden { display: none; }

.reward-tag {
  font-size: 9px;
  color: #fbbf24;
  font-weight: bold;
}

.code-wrapper {
  display: flex;
  gap: 6px;
}

#claimCodeInput {
  flex: 1;
  background: #06090e;
  border: 1px solid #334155;
  color: #10b981;
  font-family: 'Share Tech Mono', monospace;
  font-size: 11px;
  font-weight: bold;
  padding: 6px 8px;
  border-radius: 3px;
  text-align: center;
}

.hud-btn-sm {
  background: #f59e0b;
  color: #000;
  border: none;
  font-family: 'Orbitron', monospace;
  font-size: 10px;
  font-weight: bold;
  padding: 0 10px;
  border-radius: 3px;
  cursor: pointer;
}

.reward-hint {
  font-size: 8px;
  color: var(--text-muted);
}

.hud-btn-main {
  width: 100%;
  background: linear-gradient(135deg, #ff7700, #f59e0b);
  border: 1px solid #ffaa00;
  color: #000;
  font-family: 'Orbitron', monospace;
  font-size: 12px;
  font-weight: 900;
  padding: 10px 14px;
  border-radius: 4px;
  cursor: pointer;
  letter-spacing: 1px;
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.4);
  transition: all 0.2s ease;
}

.hud-btn-main:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.6);
}

/* 5. Mobile Controls */
.mobile-controls {
  width: 100%;
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.touch-angle-pad {
  flex: 1;
  background: rgba(14, 18, 25, 0.8);
  border: 1px dashed rgba(245, 158, 11, 0.4);
  border-radius: 6px;
  height: 80px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  touch-action: none;
}

.pad-hint {
  font-size: 8px;
  color: #94a3b8;
  pointer-events: none;
}

.pad-indicator {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(245, 158, 11, 0.6);
  border: 2px solid #fff;
  pointer-events: none;
  transform: translate(-50%, -50%);
  display: none;
}

.touch-tension-btn-wrapper {
  width: 140px;
}

.tension-btn {
  width: 100%;
  height: 80px;
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.25), rgba(239, 68, 68, 0.45));
  border: 2px solid #ef4444;
  border-radius: 6px;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.1s ease;
}

.tension-btn:active, .tension-btn.active {
  background: linear-gradient(180deg, #ef4444, #dc2626);
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.8);
  transform: scale(0.96);
}

.tension-btn-icon {
  font-size: 20px;
}

.tension-btn-text {
  font-family: 'Orbitron', monospace;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 1px;
}

.tension-btn-sub {
  font-size: 7px;
  color: rgba(255, 255, 255, 0.8);
}

/* 6. Footer Actions */
.hud-footer {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 9px;
  color: var(--text-muted);
}

.footer-actions {
  display: flex;
  gap: 6px;
}

.hud-btn-alt {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid #334155;
  color: #94a3b8;
  padding: 4px 8px;
  font-size: 9px;
  font-family: 'Share Tech Mono', monospace;
  border-radius: 3px;
  cursor: pointer;
}

.hud-btn-alt:hover {
  color: #fff;
  border-color: #f59e0b;
}

@media (max-width: 480px) {
  .canvas-border {
    width: 330px;
    height: 330px;
  }
  .hud-stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .hide-mobile {
    display: none !important;
  }
}
