/* --- AetherFlow Studio CSS Styling --- */

:root {
  /* HSL-based harmonious dark colors */
  --bg-deep: hsl(230, 25%, 5%);
  --bg-surface: hsl(230, 22%, 8%);
  --bg-panel: hsla(230, 20%, 12%, 0.65);
  --bg-panel-solid: hsl(230, 20%, 12%);
  --bg-input: hsla(230, 18%, 18%, 0.8);
  
  /* Primary Gradients & Glowing Accents */
  --accent-cyan: hsl(183, 100%, 50%);
  --accent-blue: hsl(209, 100%, 60%);
  --accent-purple: hsl(281, 98%, 57%);
  
  --grad-primary: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-blue) 100%);
  --grad-glow: linear-gradient(135deg, hsla(183, 100%, 50%, 0.15) 0%, hsla(281, 98%, 57%, 0.15) 100%);
  --grad-premium: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-purple) 100%);

  /* Text colors */
  --text-primary: hsl(220, 30%, 96%);
  --text-secondary: hsl(220, 15%, 70%);
  --text-muted: hsl(220, 12%, 50%);
  
  /* Borders & Shadows */
  --border-light: hsla(0, 0%, 100%, 0.06);
  --border-glow: hsla(183, 100%, 50%, 0.25);
  --border-purple-glow: hsla(281, 98%, 57%, 0.25);
  
  --shadow-lg: 0 16px 40px -10px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 25px -5px hsla(183, 100%, 50%, 0.15);
  
  /* Layout constraints */
  --border-radius-lg: 16px;
  --border-radius-md: 10px;
  --border-radius-sm: 6px;
  --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Base Resets & Layout */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-deep);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
  background-image: 
    radial-gradient(circle at 10% 20%, hsla(281, 98%, 57%, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, hsla(183, 100%, 50%, 0.05) 0%, transparent 40%);
  background-attachment: fixed;
}

.app-container {
  width: 100%;
  max-width: 1560px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow-x: hidden; /* Prevent horizontal scroll leak on touch screens */
}

/* Header Styling */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: var(--bg-panel);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-lg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-lg);
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo-icon {
  width: 42px;
  height: 42px;
  filter: drop-shadow(0 0 8px hsla(183, 100%, 50%, 0.5));
  animation: float 4s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.brand h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #ffffff 30%, #a2a8bd 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand h1 span {
  background: var(--grad-premium);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand .tagline {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 600;
  margin-top: 2px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  background: hsla(183, 100%, 50%, 0.08);
  border: 1px solid rgba(0, 242, 254, 0.2);
  color: var(--accent-cyan);
}

.ping-dot {
  width: 8px;
  height: 8px;
  background-color: var(--accent-cyan);
  border-radius: 50%;
  position: relative;
}

.ping-dot::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border-radius: 50%;
  background-color: var(--accent-cyan);
  animation: ping 1.5s infinite;
}

@keyframes ping {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(2.5); opacity: 0; }
}

/* Button UI */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--border-radius-md);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
  border: none;
}

.btn-secondary {
  background: hsla(220, 15%, 20%, 0.6);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
}

.btn-secondary:hover {
  background: hsla(220, 15%, 25%, 0.8);
  border-color: var(--text-muted);
}

.icon {
  width: 16px;
  height: 16px;
}

.mobile-view-switcher {
  display: none;
}

/* Workspace Grid Layout */
.workspace-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 24px;
}

@media (max-width: 1024px) {
  .workspace-grid {
    grid-template-columns: 1fr;
  }
}

/* Panel Design */
.panel {
  display: flex;
  flex-direction: column;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  transition: var(--transition-smooth);
}

.glass-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-light);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.glass-panel:hover {
  border-color: rgba(255, 255, 255, 0.1);
}

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

.panel-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.panel-icon {
  width: 22px;
  height: 22px;
  color: var(--accent-cyan);
}

.panel h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}

.step-num {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  background: hsla(0, 0%, 100%, 0.05);
  padding: 4px 8px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-light);
}

.panel-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.flex-column {
  flex: 1;
}

/* Forms & Textareas */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.2px;
}

.tip-tooltip {
  font-size: 11px;
  color: var(--accent-cyan);
  cursor: help;
  position: relative;
}

.tip-tooltip::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 130%;
  right: 0;
  width: 220px;
  padding: 10px;
  background-color: var(--bg-panel-solid);
  border: 1px solid var(--border-glow);
  color: var(--text-primary);
  border-radius: var(--border-radius-md);
  font-size: 11px;
  line-height: 1.4;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: var(--transition-smooth);
  z-index: 100;
}

.tip-tooltip:hover::before {
  opacity: 1;
  transform: translateY(-4px);
}

textarea {
  width: 100%;
  min-height: 80px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-md);
  padding: 12px;
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 13.5px;
  resize: vertical;
  line-height: 1.5;
  transition: var(--transition-smooth);
}

textarea:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 15px -3px hsla(183, 100%, 50%, 0.15);
}

/* Quick Helper Tags */
.quick-helpers {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.helper-tag {
  background: hsla(230, 15%, 20%, 0.4);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.helper-tag:hover {
  background: hsla(183, 100%, 50%, 0.08);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.helper-tag.active {
  background: hsla(183, 100%, 50%, 0.15);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  box-shadow: 0 0 10px hsla(183, 100%, 50%, 0.2);
}

.divider {
  height: 1px;
  background-color: var(--border-light);
  margin: 8px 0;
}

/* Input Fields */
input[type="url"], input[type="number"] {
  background-color: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-md);
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 13px;
  transition: var(--transition-smooth);
  width: 100%;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 15px -3px hsla(183, 100%, 50%, 0.15);
}

.mode-indicator {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent-cyan);
  background: hsla(183, 100%, 50%, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
}

/* Camera Rig Controller Styles */
.camera-control-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: rgba(255, 255, 255, 0.01);
  border: 1px dashed var(--border-light);
  padding: 18px;
  border-radius: var(--border-radius-lg);
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.section-icon {
  width: 18px;
  height: 18px;
  color: var(--accent-cyan);
}

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

@media (max-width: 600px) {
  .grid-2-col {
    grid-template-columns: 1fr;
  }
}

.control-card {
  background: hsla(230, 20%, 15%, 0.5);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: var(--transition-smooth);
}

.control-card:hover {
  border-color: rgba(255, 255, 255, 0.1);
  background: hsla(230, 20%, 16%, 0.7);
}

.control-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.control-val {
  font-family: 'Fira Code', monospace;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-cyan);
  background: hsla(183, 100%, 50%, 0.1);
  padding: 2px 8px;
  border-radius: 12px;
}

/* Custom styled Range Inputs */
input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--bg-input);
  outline: none;
  margin: 6px 0;
  transition: var(--transition-smooth);
}

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

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

.range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
}

.single-row-control {
  width: 100%;
}

/* Advanced Config Selectors */
.advanced-settings {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.grid-3-col {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

.form-group-small {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group-small label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

select {
  background-color: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-md);
  padding: 10px;
  color: var(--text-primary);
  font-size: 12px;
  cursor: pointer;
  width: 100%;
}

select option {
  background-color: var(--bg-panel-solid);
  color: var(--text-primary);
}

/* Right Panel: Code Sandbox */
.api-tabs {
  display: flex;
  background-color: var(--bg-input);
  padding: 4px;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-light);
  gap: 4px;
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  padding: 8px;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.tab-btn:hover {
  color: var(--text-primary);
  background-color: hsla(0, 0%, 100%, 0.03);
}

.tab-btn.active {
  background: var(--grad-primary);
  color: var(--bg-deep);
  font-weight: 700;
  box-shadow: var(--shadow-glow);
}

/* Info Box Alert */
.info-alert {
  padding: 14px 18px;
  background: hsla(281, 98%, 57%, 0.06);
  border: 1px solid var(--border-purple-glow);
  border-radius: var(--border-radius-md);
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.info-alert strong {
  color: var(--text-primary);
}

.info-alert a {
  color: var(--accent-cyan);
  text-decoration: none;
  font-weight: 600;
}

.info-alert a:hover {
  text-decoration: underline;
}

/* Code Sandbox Display */
.code-box-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.5);
  min-height: 320px;
}

.code-box-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: hsla(230, 20%, 10%, 0.8);
  border-bottom: 1px solid var(--border-light);
}

.code-lang {
  font-family: 'Outfit', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-muted);
}

.code-actions {
  display: flex;
  gap: 8px;
}

.btn-icon {
  background: hsla(0, 0%, 100%, 0.04);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: var(--border-radius-sm);
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-icon svg {
  width: 12px;
  height: 12px;
}

.btn-icon:hover {
  background: hsla(183, 100%, 50%, 0.08);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.syntax-highlight {
  margin: 0;
  padding: 20px;
  overflow: auto;
  flex: 1;
  background: #06070a;
}

#json-preview {
  font-family: 'Fira Code', monospace;
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
}

/* JSON syntax styling classes (applied via JS regex) */
.json-key { color: hsl(190, 90%, 65%); }
.json-string { color: hsl(95, 80%, 70%); }
.json-number { color: hsl(35, 100%, 65%); }
.json-boolean { color: hsl(280, 95%, 75%); }
.json-null { color: hsl(0, 80%, 65%); }

/* Educational Tips Card */
.tips-card {
  background: hsla(230, 20%, 14%, 0.4);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-md);
  padding: 16px 20px;
}

.tips-card h4 {
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent-cyan);
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.tips-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tips-list li {
  font-size: 11.5px;
  color: var(--text-secondary);
  position: relative;
  padding-left: 14px;
  line-height: 1.4;
}

.tips-list li::before {
  content: "•";
  color: var(--accent-cyan);
  font-weight: bold;
  position: absolute;
  left: 0;
}

/* Preset Motion Library Section */
.presets-panel {
  margin-top: 10px;
}

.count-badge {
  background: hsla(281, 98%, 57%, 0.1);
  border: 1px solid rgba(185, 39, 252, 0.2);
  color: var(--accent-purple);
}

.presets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.preset-card {
  background: hsla(230, 20%, 13%, 0.5);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-md);
  padding: 18px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: var(--transition-smooth);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.preset-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 3px;
  background: transparent;
  transition: var(--transition-smooth);
}

.preset-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255,255,255,0.12);
  background: hsla(230, 20%, 15%, 0.7);
  box-shadow: var(--shadow-lg);
}

.preset-card:hover::before {
  background: var(--accent-cyan);
}

.preset-badge {
  position: absolute;
  top: 14px;
  right: 18px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  border: 1px solid var(--border-light);
  padding: 2px 6px;
  border-radius: 4px;
  background: hsla(0, 0%, 100%, 0.02);
}

.preset-card h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  padding-right: 60px;
}

.preset-card p {
  font-size: 11.5px;
  color: var(--text-secondary);
  line-height: 1.4;
  flex: 1;
}

.preset-metrics {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.preset-metrics span {
  font-family: 'Fira Code', monospace;
  font-size: 9.5px;
  font-weight: 600;
  background: hsla(230, 20%, 10%, 0.6);
  border: 1px solid var(--border-light);
  padding: 2px 6px;
  border-radius: var(--border-radius-sm);
  color: var(--text-muted);
}

.preset-card:hover .preset-metrics span {
  color: var(--accent-cyan);
  border-color: rgba(0, 242, 254, 0.15);
}

/* Toast System Style */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 9999;
}

.toast {
  background: var(--bg-panel-solid);
  border-left: 4px solid var(--accent-cyan);
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  border-right: 1px solid var(--border-light);
  color: var(--text-primary);
  padding: 16px 20px;
  border-radius: var(--border-radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 12.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
  animation: slideIn 0.3s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
  backdrop-filter: blur(10px);
}

@keyframes slideIn {
  from { transform: translateX(120%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast.toast-purple {
  border-left-color: var(--accent-purple);
}

.toast.toast-error {
  border-left-color: #ff4a4a;
}

.toast-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  margin-left: auto;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

.toast-close-btn:hover {
  color: #ff4a4a;
}

.toast-icon {
  width: 18px;
  height: 18px;
  color: var(--accent-cyan);
}

.toast-purple .toast-icon {
  color: var(--accent-purple);
}

.toast-error .toast-icon {
  color: #ff4a4a;
}

/* --- Mobile Responsive Optimizations --- */
@media (max-width: 768px) {
  .app-container {
    padding: 12px;
    gap: 14px;
  }

  /* Compact Horizontal Header */
  .app-header {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    gap: 0;
  }

  .logo-area {
    flex-direction: row;
    align-items: center;
    gap: 10px;
    text-align: left;
  }

  .logo-icon {
    width: 32px;
    height: 32px;
    will-change: transform;
  }

  .brand h1 {
    font-size: 18px;
  }

  .brand .tagline {
    font-size: 9px;
    letter-spacing: 1px;
  }

  /* Hide badges on small screens to make header sleek */
  .header-actions .badge {
    display: none;
  }

  .header-actions {
    flex-direction: row;
    width: auto;
    gap: 8px;
  }

  /* Compact header buttons: hide text, show icons only */
  .header-actions .btn {
    padding: 10px;
    width: 40px;
    height: 40px;
    justify-content: center;
    border-radius: 50%;
    touch-action: manipulation;
  }

  .header-actions .btn svg {
    width: 18px;
    height: 18px;
    margin: 0;
  }

  /* Hide button text for sleek mobile icon-only header button rows */
  .header-actions #settings-btn,
  .header-actions #reset-btn {
    font-size: 0;
  }

  .panel-header {
    padding: 14px 16px;
  }

  .panel-body {
    padding: 16px;
    gap: 14px;
  }

  /* Swipeable Quick Helpers on Mobile */
  .quick-helpers {
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    gap: 8px;
    margin-top: 4px;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }

  .quick-helpers::-webkit-scrollbar {
    display: none; /* Hide scrollbars for absolute cleanliness */
  }

  .helper-tag {
    flex: 0 0 auto;
    font-size: 11.5px;
    padding: 8px 14px; /* tactile touch friendly sizing */
    touch-action: manipulation;
    transform: translateZ(0);
    backface-visibility: hidden;
  }

  /* Prevents auto-zooming on mobile keyboard popups */
  textarea, input[type="url"], input[type="number"], select {
    font-size: 16px !important;
  }

  /* Premium Swipeable Model Selection Bar */
  .api-tabs {
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    gap: 6px;
    padding: 4px;
    background-color: var(--bg-input);
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-light);
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }

  .api-tabs::-webkit-scrollbar {
    display: none; /* Hide scrollbar for a premium look */
  }

  .tab-btn {
    flex: 0 0 auto;
    padding: 8px 14px;
    font-size: 11.5px;
    border-radius: var(--border-radius-sm);
    touch-action: manipulation;
    transform: translateZ(0);
    backface-visibility: hidden;
  }

  .grid-3-col {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .grid-2-col {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .camera-control-section {
    padding: 12px;
    gap: 12px;
  }

  .control-card {
    padding: 12px;
    transform: translateZ(0);
    backface-visibility: hidden;
  }

  /* Large tactile slider thumbs for mobile touch with pan-y control */
  input[type="range"] {
    height: 8px;
    touch-action: pan-y; /* prevent vertical screen shake when dragging sliders */
  }

  input[type="range"]::-webkit-slider-thumb {
    width: 22px;
    height: 22px;
    box-shadow: 0 0 12px var(--accent-cyan);
  }

  #json-preview {
    font-size: 11px;
  }

  .code-box-container {
    min-height: 280px;
    max-height: 380px;
  }

  .presets-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .preset-card {
    touch-action: manipulation;
    transform: translateZ(0);
    backface-visibility: hidden;
  }

  /* Centered iOS-style bottom toast notifications */
  .toast-container {
    top: auto;
    bottom: 20px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: 90%;
    max-width: 420px;
  }

  .toast {
    width: 100%;
    min-width: 0;
    padding: 14px 16px;
    font-size: 12px;
    border-radius: var(--border-radius-md);
    animation: slideUp 0.3s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
  }

  /* Sleek Horizontal Mobile View Switcher */
  .mobile-view-switcher {
    display: flex;
    background: var(--bg-panel);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius-md);
    padding: 6px;
    gap: 6px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    position: sticky;
    top: 10px;
    z-index: 999;
    box-shadow: var(--shadow-lg);
    margin-bottom: 4px;
  }

  .switcher-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-family: 'Outfit', sans-serif;
    font-size: 12.5px;
    font-weight: 600;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition-smooth);
    touch-action: manipulation;
  }

  .switcher-btn:hover {
    color: var(--text-primary);
    background: hsla(0, 0%, 100%, 0.02);
  }

  .switcher-btn.active {
    background: var(--grad-primary);
    color: var(--bg-deep);
    font-weight: 700;
    box-shadow: var(--shadow-glow);
  }

  .switcher-icon {
    width: 14px;
    height: 14px;
  }

  /* Toggle Panel display based on active view on mobile screen viewports */
  body.view-architect .control-panel { display: flex !important; }
  body.view-architect .code-panel { display: none !important; }
  body.view-architect .presets-panel { display: none !important; }

  body.view-sandbox .control-panel { display: none !important; }
  body.view-sandbox .code-panel { display: flex !important; }
  body.view-sandbox .presets-panel { display: none !important; }

  body.view-recipes .control-panel { display: none !important; }
  body.view-recipes .code-panel { display: none !important; }
  body.view-recipes .presets-panel { display: flex !important; }
}

@keyframes slideUp {
  from { transform: translateY(80px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@media (max-width: 480px) {
  .api-tabs {
    grid-template-columns: repeat(2, 1fr);
  }

  .btn-icon {
    padding: 4px 8px;
    font-size: 10px;
  }
}

/* --- Settings Modal & AI Enhance Button Styles --- */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(6, 7, 10, 0.8);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  z-index: 10000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  width: 90%;
  max-width: 480px;
  background: var(--bg-panel-solid);
  border: 1px solid var(--border-glow);
  box-shadow: 0 20px 50px rgba(0, 242, 254, 0.15), var(--shadow-lg);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  transform: translateY(20px);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
}

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

.modal-header h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 18px;
  font-weight: 700;
}

.close-modal-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

.close-modal-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.input-tip {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: 6px;
}

/* AI Enhance Button */
.btn-enhance-ai {
  background: linear-gradient(135deg, rgba(0, 242, 254, 0.08) 0%, rgba(185, 39, 252, 0.08) 100%);
  border: 1px solid rgba(0, 242, 254, 0.25);
  color: var(--accent-cyan);
  padding: 4px 10px;
  border-radius: var(--border-radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition-smooth);
}

.btn-enhance-ai:hover {
  border-color: var(--accent-purple);
  color: var(--text-primary);
  box-shadow: 0 0 12px rgba(185, 39, 252, 0.3);
  transform: translateY(-1px);
}

.btn-enhance-ai.loading {
  pointer-events: none;
  background: hsla(230, 20%, 15%, 0.6);
  border-color: var(--text-muted);
  color: var(--text-muted);
  animation: pulseLoading 1.5s infinite ease-in-out;
}

@keyframes pulseLoading {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}


