:root {
  --gold-primary: #f5b041;
  --gold-glow: #ffc83b;
  --gold-light: #fff2cc;
  --bg-dark: #080706;
  --panel-bg: rgba(14, 12, 10, 0.72);
  --panel-border: rgba(245, 176, 65, 0.22);
  --text-main: #f0ebe1;
  --text-dim: #a89f91;
  --font-heading: 'Cinzel', serif;
  --font-body: 'Inter', sans-serif;
}

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

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

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

#canvas-container:active {
  cursor: grabbing;
}

/* Atmospheric Vignette & Film Edge */
.cinematic-vignette {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
  background: radial-gradient(circle at center, transparent 40%, rgba(5, 3, 2, 0.5) 80%, rgba(2, 1, 0, 0.85) 100%);
  box-shadow: inset 0 0 100px rgba(0,0,0,0.6);
}

/* Header HUD */
.hud-header {
  position: absolute;
  top: 24px;
  left: 32px;
  right: 32px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  z-index: 10;
  pointer-events: none;
}

.title-wrap {
  pointer-events: auto;
}

.badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--gold-primary);
  background: rgba(245, 176, 65, 0.12);
  border: 1px solid rgba(245, 176, 65, 0.35);
  padding: 3px 8px;
  border-radius: 20px;
  margin-bottom: 6px;
  backdrop-filter: blur(8px);
}

.hud-header h1 {
  font-family: var(--font-heading);
  font-size: 28px;
  letter-spacing: 4px;
  color: #fff;
  text-shadow: 0 0 20px rgba(255, 195, 60, 0.6), 0 2px 4px rgba(0,0,0,0.9);
  margin-bottom: 2px;
}

.subtitle {
  font-size: 11px;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  text-transform: uppercase;
}

/* Action Buttons */
.header-actions {
  display: flex;
  gap: 10px;
  pointer-events: auto;
}

.hud-btn {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  color: var(--text-main);
  padding: 8px 14px;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  backdrop-filter: blur(16px);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.icon-btn {
  padding: 9px;
  border-radius: 50%;
}

.hud-btn:hover {
  background: rgba(245, 176, 65, 0.25);
  border-color: var(--gold-primary);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(245, 176, 65, 0.35);
}

.hud-btn.active {
  background: rgba(245, 176, 65, 0.35);
  border-color: var(--gold-primary);
  box-shadow: 0 0 16px rgba(245, 176, 65, 0.45);
}

/* Focus Hint Banner */
.interaction-hint {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(14, 12, 10, 0.65);
  border: 1px solid rgba(245, 176, 65, 0.2);
  padding: 8px 18px;
  border-radius: 30px;
  font-size: 11px;
  letter-spacing: 0.8px;
  color: #e2d9cc;
  backdrop-filter: blur(12px);
  z-index: 10;
  pointer-events: none;
  animation: fadeInHint 1.2s ease-out;
}

@keyframes fadeInHint {
  from { opacity: 0; transform: translate(-50%, 15px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* Stats HUD */
.stats-hud {
  position: absolute;
  bottom: 24px;
  left: 32px;
  display: flex;
  gap: 16px;
  z-index: 10;
  pointer-events: none;
}

.stat-item {
  background: rgba(14, 12, 10, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11px;
  backdrop-filter: blur(8px);
}

.stat-lbl {
  color: var(--gold-primary);
  margin-right: 6px;
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 1px;
}

/* Control Panel */
.control-panel {
  position: absolute;
  top: 80px;
  right: 32px;
  width: 320px;
  max-height: calc(100vh - 120px);
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 20px;
  z-index: 20;
  backdrop-filter: blur(24px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), 0 0 30px rgba(245, 176, 65, 0.08);
  overflow-y: auto;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease;
}

.control-panel.hidden {
  transform: translateX(360px);
  opacity: 0;
  pointer-events: none;
}

.control-panel::-webkit-scrollbar {
  width: 4px;
}

.control-panel::-webkit-scrollbar-thumb {
  background: rgba(245, 176, 65, 0.3);
  border-radius: 4px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(245, 176, 65, 0.15);
}

.panel-header h2 {
  font-family: var(--font-heading);
  font-size: 14px;
  letter-spacing: 2px;
  color: var(--gold-primary);
}

.close-panel-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
}

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

.control-group {
  margin-bottom: 18px;
}

.group-title {
  display: block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: var(--gold-primary);
  margin-bottom: 10px;
  text-transform: uppercase;
}

/* Preset Buttons Grid */
.preset-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.preset-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.preset-btn:hover {
  background: rgba(245, 176, 65, 0.18);
  border-color: rgba(245, 176, 65, 0.4);
}

.preset-btn.active {
  background: rgba(245, 176, 65, 0.28);
  border-color: var(--gold-primary);
  color: #fff;
  box-shadow: 0 0 10px rgba(245, 176, 65, 0.3);
}

/* Slider Controls */
.slider-control {
  margin-bottom: 12px;
}

.slider-info {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-main);
  margin-bottom: 6px;
}

.slider-info span:last-child {
  color: var(--gold-primary);
  font-family: monospace;
  font-weight: 600;
}

input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--gold-primary);
  box-shadow: 0 0 8px var(--gold-glow);
  cursor: pointer;
  transition: transform 0.15s, background-color 0.15s;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.3);
  background: #fff;
}

.reset-btn {
  width: 100%;
  justify-content: center;
  margin-top: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.12);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .hud-header {
    left: 16px;
    right: 16px;
    top: 16px;
  }
  .hud-header h1 {
    font-size: 20px;
  }
  .control-panel {
    right: 16px;
    left: 16px;
    width: auto;
    max-height: 70vh;
  }
  .interaction-hint {
    display: none;
  }
  .stats-hud {
    left: 16px;
    bottom: 16px;
  }
}
