/* Shift & Ratio - Modern Arcade Glassmorphism HUD Styling */

:root {
  --bg-dark: #0a0e17;
  --panel-bg: rgba(16, 22, 36, 0.85);
  --panel-border: rgba(0, 240, 255, 0.3);
  --accent-cyan: #00f0ff;
  --accent-pink: #ff0055;
  --accent-yellow: #ffcc00;
  --accent-green: #00e676;
  --accent-orange: #ff6d00;
  --text-main: #f0f4f8;
  --text-muted: #8c9ba5;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
}

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

#canvas-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* =========================================
   TOP STATUS BAR
   ========================================= */
#top-hud {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
  pointer-events: none;
}

.hud-panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 10px 18px;
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.credits-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent-yellow);
}

.credits-badge span {
  font-size: 1.3rem;
}

select.hud-select {
  background: rgba(0, 240, 255, 0.1);
  border: 1px solid var(--accent-cyan);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: 8px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}

select.hud-select option {
  background: #121826;
  color: #fff;
}

.btn-hud {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text-main);
  padding: 6px 14px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-hud:hover {
  background: var(--accent-cyan);
  color: #000;
  border-color: var(--accent-cyan);
}

/* =========================================
   BOTTOM HUD: CLUSTER & GAUGES
   ========================================= */
#bottom-hud {
  position: absolute;
  bottom: 20px;
  left: 20px;
  right: 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  z-index: 10;
  pointer-events: none;
}

/* Left cluster: Fuel & Mission */
.cluster-left {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mission-card {
  width: 320px;
  border-left: 4px solid var(--accent-cyan);
}

.mission-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent-cyan);
  font-weight: 700;
  margin-bottom: 4px;
}

.mission-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.mission-progress {
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--accent-yellow);
  font-weight: 600;
}

.gauge-card {
  width: 440px;
  max-width: 440px;
  padding: 10px 14px;
  display: block; /* Override default .hud-panel flex row */
  box-sizing: border-box;
}

.telemetry-table {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  width: 100%;
  gap: 0;
}

.telemetry-col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: center;
  padding: 0 4px;
  box-sizing: border-box;
}

.telemetry-divider {
  width: 1px;
  background: rgba(255, 255, 255, 0.14);
  margin: 2px 4px;
  align-self: stretch;
  flex-shrink: 0;
}

/* Row 1: Header / Metric Labels */
.telemetry-cell.cell-top {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
  line-height: 1.2;
}

/* Row 2: Numbers / Primary Metrics */
.telemetry-cell.cell-mid {
  font-size: 0.96rem;
  font-weight: 800;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
  margin-bottom: 2px;
}

/* Row 3: Status / Percentages */
.telemetry-cell.cell-bot {
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
  margin-bottom: 4px;
}

/* Slim Progress Bar inside each column */
.telemetry-bar-bg {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 2px;
}

.telemetry-bar-fill {
  height: 100%;
  width: 50%;
  border-radius: 2px;
  transition: width 0.15s ease;
}

.fill-fuel { background: linear-gradient(90deg, #00e676, #00b0ff); }
.fill-temp { background: linear-gradient(90deg, #ffcc00, #ff0055); }
.fill-assist { background: linear-gradient(90deg, #b388ff, #7c4dff); }

/* Fallbacks for legacy rows */
.gauge-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 0.9rem;
  font-weight: 600;
}

.progress-bar-bg {
  width: 100%;
  height: 12px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-bar-fill {
  height: 100%;
  width: 50%;
  border-radius: 6px;
  transition: width 0.15s ease;
}

/* Center cluster: Speedometer & Nitro Dial */
.cluster-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.speedometer {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 28px;
  border-radius: 16px;
  border: 1px solid var(--panel-border);
}

.speed-value {
  font-size: 3.2rem;
  font-weight: 900;
  letter-spacing: -2px;
  color: #fff;
  text-shadow: 0 0 20px var(--accent-cyan);
  line-height: 1;
}

.speed-unit {
  font-size: 0.85rem;
  letter-spacing: 2px;
  color: var(--text-muted);
  margin-top: 4px;
}

.burn-status-badge {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 4px 10px;
  border-radius: 20px;
  margin-top: 6px;
  text-transform: uppercase;
}

.status-clean { background: rgba(0, 230, 118, 0.2); color: var(--accent-green); border: 1px solid var(--accent-green); }
.status-standard { background: rgba(0, 240, 255, 0.2); color: var(--accent-cyan); border: 1px solid var(--accent-cyan); }
.status-sputter { background: rgba(255, 23, 68, 0.2); color: var(--accent-pink); border: 1px solid var(--accent-pink); }
.status-empty, .status-critical { background: rgba(255, 23, 68, 0.3); color: #ff5252; border: 1px solid #ff5252; }
.status-person { background: rgba(0, 240, 255, 0.25); color: var(--accent-cyan); border: 1px solid var(--accent-cyan); }

/* Right cluster: Radar & Thermals */
.cluster-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

#radar-canvas {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  border: 2px solid var(--accent-cyan);
  background: rgba(10, 14, 23, 0.9);
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.3);
}

/* =========================================
   ACTION PROMPT TOAST
   ========================================= */
#action-prompt {
  position: absolute;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 240, 255, 0.9);
  color: #0a0e17;
  padding: 10px 24px;
  border-radius: 30px;
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 0.5px;
  box-shadow: 0 0 25px rgba(0, 240, 255, 0.7);
  z-index: 20;
  display: none;
  animation: pulse-action 1s infinite alternate;
}

@keyframes pulse-action {
  from { transform: translateX(-50%) scale(1); }
  to { transform: translateX(-50%) scale(1.05); }
}

/* =========================================
   MODAL DIALOGS (Fuel Station & Garage)
   ========================================= */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(4, 7, 12, 0.85);
  backdrop-filter: blur(15px);
  z-index: 100;
  display: none;
  justify-content: center;
  align-items: center;
}

.modal-content {
  background: #101624;
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  width: 90%;
  max-width: 760px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
  position: relative;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 16px;
  margin-bottom: 20px;
}

.modal-header h2 {
  font-size: 1.6rem;
  color: var(--accent-cyan);
  font-weight: 800;
  letter-spacing: 0.5px;
}

.btn-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.8rem;
  cursor: pointer;
  line-height: 1;
}

.btn-close:hover {
  color: #fff;
}

/* Fueling Station Mixing Terminal Styles */
.station-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.fuel-spec-box {
  background: rgba(255, 255, 255, 0.04);
  padding: 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.fuel-spec-box h4 {
  color: var(--accent-yellow);
  margin-bottom: 8px;
  font-size: 1rem;
}

.spec-line {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.spec-line strong {
  color: var(--text-main);
}

.slider-group {
  margin-top: 16px;
}

.slider-label {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 8px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent-cyan);
  cursor: pointer;
}

.ratio-calculator-box {
  background: rgba(0, 240, 255, 0.05);
  border: 1px solid var(--accent-cyan);
  border-radius: 12px;
  padding: 16px;
  margin-top: 18px;
}

.calc-formula {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.95rem;
  color: var(--accent-cyan);
  margin: 6px 0;
}

.btn-action-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--accent-cyan), #0077ff);
  color: #000;
  font-weight: 800;
  font-size: 1.1rem;
  padding: 14px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  margin-top: 20px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-action-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 240, 255, 0.4);
}

/* Garage Shop Upgrade Cards */
.garage-vehicle-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.04);
  padding: 14px 18px;
  border-radius: 12px;
  margin-bottom: 20px;
}

.upgrade-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.upgrade-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.upgrade-card h4 {
  font-size: 1rem;
  color: var(--accent-cyan);
  margin-bottom: 6px;
}

.upgrade-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  min-height: 38px;
}

.upgrade-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
}

.tier-stars {
  color: var(--accent-yellow);
  font-size: 1.1rem;
  letter-spacing: 2px;
}

.btn-upgrade-buy {
  background: rgba(0, 230, 118, 0.15);
  border: 1px solid var(--accent-green);
  color: var(--accent-green);
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-upgrade-buy:hover {
  background: var(--accent-green);
  color: #000;
}

.btn-upgrade-buy:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  border-color: #555;
  color: #777;
}

/* Instructions Dialog */
.help-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  font-size: 0.92rem;
  line-height: 1.6;
}

.help-grid kbd {
  background: #252d42;
  border: 1px solid #4a5578;
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent-cyan);
  font-weight: 700;
}

/* Responsiveness */
@media (max-width: 768px) {
  .station-grid, .upgrade-grid, .help-grid {
    grid-template-columns: 1fr;
  }
  .mission-card {
    width: 240px;
  }
  .gauge-card {
    width: 330px;
    padding: 8px 10px;
  }
  .telemetry-cell.cell-top {
    font-size: 0.62rem;
  }
  .telemetry-cell.cell-mid {
    font-size: 0.82rem;
  }
  .telemetry-cell.cell-bot {
    font-size: 0.72rem;
  }
}

