/* Model Train Yard - UI & HUD Styling */

:root {
  --bg-hud: rgba(18, 22, 28, 0.78);
  --bg-hud-card: rgba(26, 32, 42, 0.88);
  --border-hud: rgba(255, 255, 255, 0.12);
  --border-accent: rgba(212, 175, 55, 0.45);
  --gold: #d4af37;
  --gold-glow: rgba(212, 175, 55, 0.3);
  --red-accent: #cc292b;
  --yellow-accent: #fab005;
  --text-main: #f1f3f5;
  --text-muted: #9aa5b1;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

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

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

/* Glassmorphism HUD Panels */
.hud-panel {
  position: absolute;
  z-index: 10;
  background: var(--bg-hud);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-hud);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.36);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Top Bar */
.top-bar {
  top: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 10px;
}

.train-icon {
  font-size: 22px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
}

.brand-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--gold);
}

.brand-subtitle {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.4px;
}

.status-section {
  display: flex;
  align-items: center;
  gap: 16px;
}

.time-badge {
  background: rgba(0, 0, 0, 0.4);
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 13px;
  font-weight: 600;
  font-family: monospace;
  color: #ffd166;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Action Buttons */
.btn {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid var(--border-hud);
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: var(--gold);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: linear-gradient(135deg, #cc292b, #a31c1e);
  border-color: #e03131;
  color: #fff;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #e03131, #b02527);
  box-shadow: 0 0 12px rgba(204, 41, 43, 0.5);
}

/* Camera Bar (Bottom Center) */
.camera-bar {
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
}

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

.cam-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.cam-btn.active {
  background: var(--gold);
  color: #1a1a1a;
  border-color: #ffd700;
  box-shadow: 0 0 14px var(--gold-glow);
}

/* Throttle HUD Widget (Bottom Left) */
.throttle-hud {
  bottom: 16px;
  left: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 240px;
}

.throttle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
}

.throttle-label {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 75px;
}

.badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.badge-red { background: var(--red-accent); }
.badge-yellow { background: var(--yellow-accent); }

.throttle-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 5px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  outline: none;
}

.throttle-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--gold);
  cursor: pointer;
  border: 1px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

.speed-readout {
  min-width: 36px;
  text-align: right;
  font-family: monospace;
  color: var(--gold);
}

/* Instructions / Hint Toast */
.hint-toast {
  position: absolute;
  top: 68px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(18, 22, 28, 0.85);
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 11px;
  color: #ddd;
  z-index: 10;
  pointer-events: none;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

.hint-toast strong {
  color: var(--gold);
}

/* Responsive adjustments */
@media (max-width: 860px) {
  .brand-subtitle, .hint-toast {
    display: none;
  }
  .camera-bar {
    bottom: 80px;
  }
  .throttle-hud {
    width: 200px;
  }
}
