/* ==========================================================================
   Aurora Borealis WebGL2 Studio & Website Background Demo Stylesheet
   ========================================================================== */

:root {
  --bg-deep: #030712;
  --surface-glass: rgba(15, 23, 42, 0.72);
  --surface-glass-hover: rgba(30, 41, 59, 0.85);
  --border-glass: rgba(255, 255, 255, 0.12);
  --border-active: rgba(52, 211, 153, 0.5);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --aurora-green: #34d399;
  --aurora-cyan: #38bdf8;
  --aurora-magenta: #f472b6;
  --aurora-red: #f87171;
  --accent: #10b981;
  --accent-glow: rgba(16, 185, 129, 0.25);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
}

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

html, body {
  width: 100%;
  max-width: 100vw;
  height: 100%;
  overflow-x: hidden;
  overflow: hidden;
  background-color: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   Full-Screen Background Canvas Container
   ========================================================================== */
#aurora-viewport {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  overflow: hidden;
}

.aurora-canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* Drag overlay hint */
.viewport-hint {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 12px;
  color: var(--text-secondary);
  pointer-events: none;
  z-index: 5;
  letter-spacing: 0.02em;
  transition: opacity 0.5s ease;
}

/* ==========================================================================
   Header / Studio Topbar
   ========================================================================== */
#studio-topbar {
  position: absolute;
  top: 16px;
  left: 20px;
  right: 20px;
  height: 56px;
  background: var(--surface-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 20;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

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

.brand-icon {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--aurora-magenta), var(--aurora-green), var(--aurora-cyan));
  border-radius: 8px;
  box-shadow: 0 0 16px var(--accent-glow);
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-icon svg {
  width: 16px;
  height: 16px;
  fill: #fff;
}

.brand-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-primary);
}

.brand-badge {
  font-size: 10px;
  font-family: var(--font-mono);
  background: rgba(52, 211, 153, 0.15);
  color: var(--aurora-green);
  border: 1px solid rgba(52, 211, 153, 0.3);
  padding: 2px 7px;
  border-radius: 9999px;
  font-weight: 600;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.preset-picker-group {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.35);
  padding: 4px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
}

.preset-picker-group label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.preset-select {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
}

.preset-select option {
  background: #0f172a;
  color: #f8fafc;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  text-decoration: none;
}

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

.btn-primary {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.8), rgba(5, 150, 105, 0.9));
  border-color: rgba(52, 211, 153, 0.4);
  color: #fff;
  box-shadow: 0 4px 14px var(--accent-glow);
}

.btn-primary:hover {
  background: linear-gradient(135deg, rgba(16, 185, 129, 1.0), rgba(5, 150, 105, 1.0));
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.btn-accent {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.3);
  color: var(--aurora-cyan);
}

.btn-accent:hover {
  background: rgba(56, 189, 248, 0.22);
}

.fps-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  background: rgba(0, 0, 0, 0.4);
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-glass);
  color: var(--aurora-green);
  display: flex;
  align-items: center;
  gap: 6px;
}

.fps-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--aurora-green);
  box-shadow: 0 0 8px var(--aurora-green);
  animation: pulse-dot 2s infinite ease-in-out;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

/* ==========================================================================
   Floating Control Drawer / Sidebar
   ========================================================================== */
#studio-drawer {
  position: absolute;
  top: 76px;
  right: 16px;
  width: 290px;
  max-height: calc(100vh - 96px);
  background: var(--surface-glass);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  z-index: 20;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

#studio-drawer.collapsed {
  transform: translateX(330px);
  opacity: 0;
  pointer-events: none;
}

.drawer-header {
  height: 40px;
  min-height: 40px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.drawer-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 7px;
}

.drawer-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.drawer-close:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

.drawer-content {
  overflow-y: auto;
  padding: 8px 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.drawer-content::-webkit-scrollbar {
  width: 4px;
}
.drawer-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

/* Drawer Action Card: Mobile-First Save, Copy, Load, Reset */
.drawer-action-card {
  flex-shrink: 0;
  background: rgba(16, 24, 39, 0.65);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.drawer-action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  width: 100%;
}

.drawer-action-row .btn {
  padding: 7px 8px;
  font-size: 11px;
  font-weight: 600;
  justify-content: center;
  border-radius: var(--radius-sm);
  gap: 6px;
  text-align: center;
  white-space: nowrap;
}

.btn-save-action {
  background: rgba(16, 185, 129, 0.22);
  border-color: rgba(52, 211, 153, 0.45);
  color: #34d399;
}

.btn-save-action:hover {
  background: rgba(16, 185, 129, 0.35);
  border-color: #34d399;
}

.btn-copy-action {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.4);
  color: #38bdf8;
}

.btn-copy-action:hover {
  background: rgba(56, 189, 248, 0.28);
}

/* Master Flow Speed Card */
.master-speed-bar {
  flex-shrink: 0;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(52, 211, 153, 0.35);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  box-shadow: 0 0 16px rgba(52, 211, 153, 0.08);
}

/* Quick Camera Angle Chips */
.quick-angle-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 6px;
}

.angle-chip {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.angle-chip:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.4);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.angle-chip:active {
  transform: scale(0.96);
}

/* Accordion sections - flex-shrink: 0 guarantees headers never collapse into thin lines */
.accordion-section {
  flex-shrink: 0;
  width: 100%;
  border: 1px solid var(--border-glass);
  background: rgba(0, 0, 0, 0.30);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.accordion-section:hover {
  border-color: rgba(255, 255, 255, 0.22);
}

.accordion-header {
  height: 36px;
  min-height: 36px;
  flex-shrink: 0;
  padding: 0 12px;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.03);
  transition: color 0.2s ease, background 0.2s ease;
}

.accordion-header:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

.accordion-header .acc-title {
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.accordion-header .acc-arrow {
  transition: transform 0.2s ease;
  font-size: 9px;
  color: var(--text-muted);
}

.accordion-section.open .accordion-header .acc-arrow {
  transform: rotate(90deg);
  color: var(--aurora-cyan);
}

.accordion-body {
  display: none;
  padding: 10px 12px 14px;
  flex-direction: column;
  gap: 10px;
  border-top: 1px solid var(--border-glass);
  background: rgba(0, 0, 0, 0.20);
}

.accordion-section.open .accordion-body {
  display: flex;
}

/* Control elements */
.control-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.control-label-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
}

.control-title {
  color: var(--text-secondary);
  font-weight: 500;
}

.control-val-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--aurora-cyan);
  background: rgba(56, 189, 248, 0.1);
  padding: 1px 5px;
  border-radius: 4px;
}

.slider-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--aurora-green);
  box-shadow: 0 0 10px var(--accent-glow);
  cursor: pointer;
  transition: transform 0.1s ease;
}

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

/* Color pickers */
.color-picker-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
}

.color-picker-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.color-picker-title {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-primary);
}

.color-picker-sub {
  font-size: 10px;
  color: var(--text-muted);
}

.color-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

input[type="color"] {
  -webkit-appearance: none;
  border: none;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  cursor: pointer;
  background: transparent;
}

input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

input[type="color"]::-webkit-color-swatch {
  border: 1px solid var(--border-glass);
  border-radius: 6px;
}

/* Toggle Switch */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.toggle-title {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
}

.switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}

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

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

.slider-round:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.25s ease;
  border-radius: 50%;
}

input:checked + .slider-round {
  background-color: var(--aurora-green);
}

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

/* ==========================================================================
   Website Content Demonstration Overlay
   ========================================================================== */
#website-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  z-index: 10;
  pointer-events: auto;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

#website-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.site-navbar {
  max-width: 1100px;
  margin: 24px auto 0;
  padding: 12px 24px;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-nav-links {
  display: flex;
  gap: 24px;
  list-style: none;
}

.site-nav-links a {
  color: var(--text-secondary);
  font-size: 13px;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.site-nav-links a:hover {
  color: var(--text-primary);
}

.hero-container {
  max-width: 900px;
  margin: 100px auto 40px;
  text-align: center;
  padding: 0 20px;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.3);
  color: var(--aurora-green);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: 9999px;
  margin-bottom: 24px;
  letter-spacing: 0.03em;
}

.hero-headline {
  font-size: 52px;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 20px;
  background: linear-gradient(180deg, #ffffff 40%, rgba(255, 255, 255, 0.65) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subhead {
  font-size: 18px;
  line-height: 1.6;
  color: var(--text-secondary);
  max-width: 640px;
  margin: 0 auto 36px;
  font-weight: 400;
}

.hero-cta-group {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.hero-btn {
  padding: 12px 26px;
  font-size: 14px;
  border-radius: 9999px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
}

.hero-btn-primary {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  border: 1px solid rgba(52, 211, 153, 0.4);
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.3);
}

.hero-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(16, 185, 129, 0.45);
}

.hero-btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

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

/* Feature grid */
.features-grid {
  max-width: 1100px;
  margin: 60px auto 120px;
  padding: 0 20px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.feature-card {
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all 0.25s ease;
}

.feature-card:hover {
  transform: translateY(-4px);
  border-color: rgba(52, 211, 153, 0.4);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.4);
}

.card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  font-size: 20px;
}

.card-icon.green {
  background: rgba(52, 211, 153, 0.15);
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.card-icon.cyan {
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.card-icon.magenta {
  background: rgba(244, 114, 182, 0.15);
  border: 1px solid rgba(244, 114, 182, 0.3);
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.card-desc {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-secondary);
}

/* ==========================================================================
   Modal Dialogs (Code Export & File Import)
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(3, 7, 18, 0.85);
  backdrop-filter: blur(12px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
}

.modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.modal-card {
  background: #0f172a;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 620px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
  overflow: hidden;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
}

.code-snippet-box {
  background: #030712;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: #e2e8f0;
  line-height: 1.5;
  max-height: 360px;
  overflow-y: auto;
  white-space: pre;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-glass);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* File Drag & Drop Zone */
.dropzone-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(16, 185, 129, 0.15);
  backdrop-filter: blur(8px);
  border: 4px dashed var(--aurora-green);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  pointer-events: none;
}

.dropzone-overlay.active {
  opacity: 1;
  visibility: visible;
}

.dropzone-text {
  font-size: 22px;
  font-weight: 700;
  color: white;
  margin-top: 14px;
}

/* ==========================================================================
   Side-View Elevation Schematic Panel
   ========================================================================== */
#schematic-panel {
  position: absolute;
  bottom: 16px;
  left: 16px;
  width: 300px;
  background: var(--surface-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  z-index: 25;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease, height 0.25s ease;
}

#schematic-panel.hidden {
  transform: translateY(30px) scale(0.95);
  opacity: 0;
  pointer-events: none;
}

#schematic-panel.minimized {
  height: 38px !important;
}

#schematic-panel.minimized .schematic-canvas-wrap,
#schematic-panel.minimized .schematic-legend {
  display: none;
}

.schematic-header {
  height: 38px;
  padding: 0 12px;
  border-bottom: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.04);
  user-select: none;
  cursor: pointer;
  transition: background 0.15s ease;
}

.schematic-header:hover {
  background: rgba(255, 255, 255, 0.08);
}

.schematic-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.schematic-title svg {
  stroke: var(--aurora-cyan);
}

.schematic-actions {
  display: flex;
  align-items: center;
  gap: 3px;
}

.schematic-canvas-wrap {
  width: 100%;
  height: 165px;
  position: relative;
  background: #060b19;
  cursor: crosshair;
}

#schematic-canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.schematic-legend {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 5px 8px;
  background: rgba(0, 0, 0, 0.35);
  border-top: 1px solid var(--border-glass);
  font-size: 9px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.legend-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.legend-dot.magenta { background: var(--aurora-magenta); box-shadow: 0 0 6px var(--aurora-magenta); }
.legend-dot.green   { background: var(--aurora-green);   box-shadow: 0 0 6px var(--aurora-green); }
.legend-dot.cyan    { background: var(--aurora-cyan);    box-shadow: 0 0 6px var(--aurora-cyan); }
.legend-dot.red     { background: var(--aurora-red);     box-shadow: 0 0 6px var(--aurora-red); }

/* Responsive adjustments */
@media (max-width: 900px) {
  #schematic-panel {
    width: 320px;
    bottom: 16px;
    left: 16px;
  }
  .schematic-canvas-wrap {
    height: 175px;
  }
}

/* Floating Action Button (FAB) for Instant Controls Recovery */
.fab-controls {
  position: fixed;
  bottom: 24px;
  right: 20px;
  z-index: 150;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(52, 211, 153, 0.5);
  border-radius: 9999px;
  color: #f8fafc;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6), 0 0 16px rgba(52, 211, 153, 0.25);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.fab-controls svg {
  color: #34d399;
  flex-shrink: 0;
}

.fab-controls:hover {
  background: rgba(30, 41, 59, 0.95);
  border-color: rgba(52, 211, 153, 0.8);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.7), 0 0 24px rgba(52, 211, 153, 0.4);
  transform: translateY(-2px);
}

.fab-controls:active {
  transform: scale(0.96);
}

/* When drawer is open, smoothly hide the FAB */
body:not(.drawer-collapsed) .fab-controls {
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px) scale(0.9);
}

body.drawer-collapsed .fab-controls {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1.0);
}

/* Mobile & Portrait Phone Responsiveness */
@media (max-width: 768px) {
  #studio-topbar {
    top: 8px;
    left: 8px;
    right: 8px;
    height: 48px;
    padding: 0 10px;
    gap: 8px;
  }

  .brand-title {
    font-size: 13px;
  }

  .brand-badge {
    display: none;
  }

  .brand-icon {
    width: 24px;
    height: 24px;
  }

  .preset-picker-group label {
    display: none;
  }

  .preset-select {
    max-width: 120px;
    font-size: 11px;
    padding: 4px 6px;
  }

  /* Mobile topbar: Clean, zero-overflow header */
  #btn-save-preset,
  #btn-load-preset,
  #btn-embed-code,
  #btn-toggle-overlay,
  .fps-badge {
    display: none !important;
  }

  #btn-toggle-schematic {
    padding: 4px 8px;
    font-size: 11px;
  }

  #btn-toggle-schematic .btn-label {
    display: none;
  }

  #btn-toggle-drawer {
    flex-shrink: 0;
    padding: 6px 10px;
    background: rgba(16, 185, 129, 0.25);
    border-color: rgba(52, 211, 153, 0.5);
    color: #34d399;
  }

  /* Floating Control Drawer on mobile - perfectly framed with touch clearance */
  #studio-drawer {
    position: fixed;
    top: 58px;
    bottom: 16px;
    right: 12px;
    width: 300px;
    max-width: calc(100vw - 24px);
    max-height: calc(100vh - 74px);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-glass);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.75);
    z-index: 200;
    box-sizing: border-box;
    overflow-x: hidden;
  }

  #studio-drawer.collapsed {
    transform: translateX(105%);
    opacity: 0;
    pointer-events: none;
  }

  .fab-controls {
    bottom: 18px;
    right: 16px;
    padding: 8px 14px;
    font-size: 12px;
  }

  /* Schematic HUD on mobile - positioned neatly beside the floating controls button */
  #schematic-panel {
    width: 260px;
    max-width: calc(100vw - 105px);
    left: 8px;
    bottom: 8px;
    border-radius: var(--radius-md);
    z-index: 40;
  }

  #schematic-panel.minimized {
    width: auto;
    max-width: 220px;
    height: 38px !important;
  }

  .schematic-canvas-wrap {
    height: 130px;
  }

  .viewport-hint {
    bottom: 12px;
    font-size: 10px;
    padding: 4px 10px;
  }

  /* Increase slider touch areas */
  input[type="range"] {
    height: 32px;
  }

  .accordion-header {
    min-height: 42px;
    padding: 10px 12px;
  }
}



@media (prefers-reduced-motion: reduce) {
  #studio-drawer, #schematic-panel, .fab-controls {
    transition: none !important;
  }
}
