:root {
  --bg-color: #06070a;
  --panel-bg: rgba(18, 20, 28, 0.72);
  --panel-border: rgba(255, 255, 255, 0.1);
  --panel-hover: rgba(255, 255, 255, 0.15);
  --accent-color: #ff3366;
  --accent-secondary: #ffb830;
  --accent-cyan: #00f0ff;
  --accent-green: #2ecc71;
  --text-main: #f0f2f5;
  --text-dim: #8b92a5;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, Monaco, monospace;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.4;
}

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

canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* TouchDesigner Style Top Bar */
.td-top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 32px;
  background: rgba(14, 15, 20, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--panel-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  z-index: 10;
}

.td-nav-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.td-logo {
  font-weight: 700;
  color: #ff3366;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.td-logo-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff3366;
  box-shadow: 0 0 8px #ff3366;
  animation: pulse 2s infinite ease-in-out;
}

@keyframes pulse {
  0%, 100% { opacity: 0.8; transform: scale(0.95); }
  50% { opacity: 1; transform: scale(1.1); }
}

.td-tag {
  color: var(--text-dim);
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.8px;
}

.td-path {
  color: #7b889b;
}

.td-path span {
  color: #c0cadc;
}

.td-nav-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.td-badge {
  padding: 2px 7px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
}

.badge-rt {
  background: rgba(46, 204, 113, 0.15);
  color: #2ecc71;
  border: 1px solid rgba(46, 204, 113, 0.3);
}

.badge-fps {
  background: rgba(255, 184, 48, 0.15);
  color: #ffb830;
  border: 1px solid rgba(255, 184, 48, 0.3);
}

.badge-pts {
  background: rgba(0, 240, 255, 0.15);
  color: #00f0ff;
  border: 1px solid rgba(0, 240, 255, 0.3);
}

/* Floating HUD Controls Panel */
.hud-panel {
  position: fixed;
  top: 44px;
  right: 14px;
  width: 290px;
  max-height: calc(100vh - 90px);
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.5), 0 0 1px rgba(255, 255, 255, 0.1);
  padding: 16px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.hud-panel.collapsed {
  transform: translateX(310px);
  opacity: 0;
  pointer-events: none;
}

.hud-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--panel-border);
}

.hud-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-title svg {
  color: var(--accent-color);
}

.toggle-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.toggle-btn:hover {
  color: var(--text-main);
  background: var(--panel-hover);
}

.hud-toggle-floating {
  position: fixed;
  top: 44px;
  right: 14px;
  z-index: 9;
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--panel-border);
  color: var(--text-main);
  padding: 7px 11px;
  border-radius: 8px;
  font-size: 11px;
  font-family: var(--font-mono);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.hud-toggle-floating:hover {
  border-color: var(--accent-color);
}

/* Control Groups */
.control-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

/* Presets Grid */
.presets-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.preset-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--panel-border);
  color: var(--text-main);
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-family: var(--font-sans);
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.preset-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.preset-btn.active {
  background: rgba(255, 51, 102, 0.18);
  border-color: var(--accent-color);
  color: #fff;
}

.preset-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Sliders */
.slider-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

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

.slider-value {
  font-family: var(--font-mono);
  color: var(--text-dim);
  font-size: 10px;
}

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

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-color);
  cursor: pointer;
  box-shadow: 0 0 8px rgba(255, 51, 102, 0.6);
  transition: transform 0.1s;
}

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

/* Switch / Checkbox rows */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  padding: 2px 0;
}

.switch {
  position: relative;
  display: inline-block;
  width: 32px;
  height: 18px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider-switch {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(255, 255, 255, 0.15);
  transition: 0.2s;
  border-radius: 18px;
}

.slider-switch:before {
  position: absolute;
  content: "";
  height: 12px;
  width: 12px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.2s;
  border-radius: 50%;
}

input:checked + .slider-switch {
  background-color: var(--accent-color);
}

input:checked + .slider-switch:before {
  transform: translateX(14px);
}

/* Button rows */
.button-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 4px;
}

.action-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  color: var(--text-main);
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
  font-weight: 500;
}

.action-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
}

.action-btn.primary {
  background: rgba(255, 51, 102, 0.2);
  border-color: rgba(255, 51, 102, 0.5);
  color: #ff99b3;
}

.action-btn.primary:hover {
  background: rgba(255, 51, 102, 0.35);
  color: #fff;
}

/* Bottom Transport Bar */
.td-transport-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 38px;
  background: rgba(14, 15, 20, 0.92);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--panel-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  z-index: 10;
}

.transport-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.transport-timecode {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 1px;
  background: rgba(0, 0, 0, 0.4);
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.transport-frame {
  color: var(--accent-secondary);
  font-weight: 600;
}

.transport-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.transport-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--panel-border);
  color: var(--text-main);
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.transport-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

.transport-btn.active {
  background: rgba(255, 184, 48, 0.25);
  border-color: var(--accent-secondary);
  color: var(--accent-secondary);
}

.transport-timeline {
  flex: 1;
  max-width: 480px;
  margin: 0 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.timeline-track {
  position: relative;
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}

.timeline-progress {
  height: 100%;
  width: 25%;
  background: linear-gradient(90deg, var(--accent-color), var(--accent-secondary));
  transition: width 0.05s linear;
}

.transport-right {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-dim);
  font-size: 10px;
}

/* Mouse Interaction Hint */
.interaction-hint {
  position: fixed;
  bottom: 48px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(14, 16, 22, 0.7);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 11px;
  color: var(--text-dim);
  pointer-events: none;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: opacity 0.4s ease;
}

.interaction-hint kbd {
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-main);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .hud-panel {
    width: 260px;
    right: 8px;
  }
  .td-path, .transport-timeline {
    display: none;
  }
}
