/* ==========================================================
   Mecha Arena: Industrial Cyberpunk Workshop & Arena Styles
   ========================================================== */

:root {
  --bg-dark: #080c14;
  --panel-bg: rgba(15, 23, 42, 0.85);
  --accent-cyan: #00f0ff;
  --accent-gold: #facc15;
  --accent-red: #ef4444;
  --accent-green: #10b981;
  --accent-purple: #a855f7;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-glow: rgba(0, 240, 255, 0.25);
  --font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'Consolas', 'Courier New', monospace;
}

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

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-family);
}

#gameContainer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 10px;
  background: radial-gradient(circle at 50% 50%, #0f172a 0%, #080c14 100%);
}

/* ==========================================
   TOP HEADER & HUD
   ========================================== */
.mecha-header {
  width: 100%;
  max-width: 720px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-glow);
  border-radius: 14px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
  z-index: 10;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.portal-back-btn {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  transition: all 0.2s ease;
}

.portal-back-btn:hover {
  color: var(--accent-cyan);
  border-color: var(--accent-cyan);
}

.game-logo {
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hud-stats-group {
  display: flex;
  gap: 14px;
}

.hud-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
}

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

.hud-val {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 800;
}

.text-gold { color: var(--accent-gold); }
.text-cyan { color: var(--accent-cyan); }
.text-red { color: var(--accent-red); }

.header-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: white;
  padding: 5px 8px;
  font-size: 14px;
  cursor: pointer;
}

.lang-dropdown {
  background: #0f172a;
  border: 1px solid var(--border-glow);
  color: white;
  padding: 4px 6px;
  border-radius: 8px;
  font-size: 12px;
  outline: none;
}

/* ==========================================
   VIEW 1: WORKSHOP CUSTOMIZER LAYOUT
   ========================================== */
.workshop-layout {
  width: 100%;
  max-width: 720px;
  flex: 1;
  display: flex;
  gap: 14px;
  margin-top: 10px;
}

.preview-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  background: var(--panel-bg);
  border: 1px solid var(--border-glow);
  border-radius: 16px;
  padding: 16px;
}

.preview-box {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: radial-gradient(circle at 50% 50%, #1e293b 0%, #090d16 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(0, 240, 255, 0.2);
}

.holo-scanline {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, rgba(0, 240, 255, 0.05) 0%, rgba(0, 0, 0, 0) 100%);
  pointer-events: none;
}

.deploy-action-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--accent-gold), #ea580c);
  color: black;
  border: none;
  border-radius: 12px;
  font-weight: 900;
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(234, 88, 12, 0.4);
  transition: transform 0.1s ease;
}

.deploy-action-btn:hover {
  transform: scale(1.02);
}

.parts-customizer-panel {
  flex: 1.4;
  display: flex;
  flex-direction: column;
  background: var(--panel-bg);
  border: 1px solid var(--border-glow);
  border-radius: 16px;
  padding: 14px;
}

.category-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.tab-btn {
  flex: 1;
  padding: 8px 4px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.tab-btn.active {
  background: rgba(0, 240, 255, 0.15);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.parts-grid-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding-right: 4px;
}

.part-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 12px;
  transition: all 0.2s ease;
}

.part-card.equipped {
  border-color: var(--accent-cyan);
  background: rgba(0, 240, 255, 0.08);
}

.part-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.part-icon {
  font-size: 24px;
}

.part-name {
  font-size: 13px;
  font-weight: 700;
  color: white;
}

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

.part-action-btn {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
}

.part-action-btn.btn-active {
  background: var(--accent-cyan);
  color: black;
  border: none;
}

/* ==========================================
   VIEW 2: ARENA COMBAT LAYOUT
   ========================================== */
.arena-layout {
  width: 100%;
  max-width: 720px;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
}

.match-hud-bar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--panel-bg);
  border: 1px solid var(--border-glow);
  padding: 8px 14px;
  border-radius: 12px;
}

.combatant-status {
  flex: 1;
}

.bot-label {
  font-size: 11px;
  font-weight: 800;
  margin-bottom: 4px;
}

.hp-track {
  width: 100%;
  height: 10px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.hp-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #10b981);
  transition: width 0.1s linear;
}

.hp-fill-enemy {
  background: linear-gradient(90deg, #ef4444, #f97316);
}

.flee-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: white;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.arena-canvas-box {
  position: relative;
  width: 100%;
  aspect-ratio: 68 / 54;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(0, 240, 255, 0.3);
  box-shadow: 0 0 35px rgba(0, 240, 255, 0.15);
  margin-top: 8px;
}

#arenaCanvas {
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
}

.tactical-action-btn {
  position: absolute;
  bottom: 14px;
  right: 14px;
  background: linear-gradient(135deg, var(--accent-cyan), #0284c7);
  color: black;
  border: none;
  border-radius: 20px;
  padding: 8px 16px;
  font-weight: 900;
  font-size: 12px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 240, 255, 0.4);
}

/* ==========================================
   MODALS
   ========================================== */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(8, 12, 20, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-content {
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--border-glow);
  border-radius: 20px;
  padding: 28px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
}

.modal-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--accent-cyan);
  margin-bottom: 8px;
}

.modal-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  gap: 10px;
}

.primary-start-btn {
  flex: 1;
  padding: 12px;
  background: linear-gradient(135deg, var(--accent-cyan), #0284c7);
  color: black;
  border: none;
  border-radius: 10px;
  font-weight: 800;
  cursor: pointer;
}

.secondary-btn {
  flex: 1;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  padding: 12px;
  font-weight: 700;
  cursor: pointer;
}

/* Mobile Responsiveness */
@media (max-width: 640px) {
  .workshop-layout {
    flex-direction: column;
    overflow-y: auto;
  }
  .preview-box {
    max-height: 180px;
  }
  #workshopPreviewCanvas {
    width: 160px;
    height: 160px;
  }
  .hud-stats-group {
    gap: 8px;
  }
}
