/* ═══════════════════════════════════════════════════════════
   Espiralito Studio – Professional Generative Art Instrument
   ═══════════════════════════════════════════════════════════ */

/* ── Design Tokens ── */
:root {
  --bg: #08080f;
  --surface: #0e0e1a;
  --surface-2: #14142a;
  --surface-3: #1c1c34;
  --surface-hover: #222240;
  --border: #252548;
  --border-subtle: #1a1a32;
  --text: #e4e4f0;
  --text-secondary: #a0a0c0;
  --text-muted: #6868a0;
  --accent: #ff6bcb;
  --accent-dim: rgba(255,107,203,.15);
  --accent-glow: rgba(255,107,203,.35);
  --success: #4ade80;
  --warning: #fbbf24;
  --danger: #f87171;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", monospace;
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px;
  --radius-sm: 6px; --radius: 10px; --radius-lg: 14px; --radius-xl: 20px;
  --shadow: 0 2px 8px rgba(0,0,0,.35);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.55);
  --shadow-glow: 0 0 20px var(--accent-glow);
  --ease: cubic-bezier(.4,0,.2,1);
  --dur: 180ms;
}

/* ── Reset ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button { font-family: inherit; cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Screen reader only ── */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ── Skip link ── */
.skip-link {
  position: absolute; top: -100%; left: 16px;
  background: var(--accent); color: #fff; padding: 8px 16px;
  border-radius: var(--radius-sm); font-weight: 600; z-index: 100;
  text-decoration: none; transition: top .2s;
}
.skip-link:focus { top: 8px; }

/* ═══════ TOPBAR ═══════ */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: var(--sp-3) var(--sp-6);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky; top: 0; z-index: 10;
  background: rgba(8,8,15,.85);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.logo { font-weight: 700; font-size: 1.15rem; color: var(--text); text-decoration: none; }
.logo:hover { text-decoration: none; }
.logo-mark { color: var(--accent); }
.topbar nav { display: flex; gap: var(--sp-4); }
.topbar nav a {
  color: var(--text-secondary); text-decoration: none; font-size: .9rem;
  transition: color var(--dur) var(--ease);
}
.topbar nav a:hover { color: var(--text); text-decoration: none; }

/* ═══════ HERO ═══════ */
.hero {
  text-align: center; padding: var(--sp-8) var(--sp-6) var(--sp-4);
  max-width: 720px; margin: 0 auto;
}
.hero h1 { font-size: 2rem; font-weight: 700; margin-bottom: var(--sp-3); letter-spacing: -.02em; }
.hero-sub { color: var(--text-secondary); font-size: 1.05rem; }

/* ═══════ STUDIO ═══════ */
.studio {
  max-width: 1340px; margin: 0 auto;
  padding: 0 var(--sp-6) var(--sp-6);
}

/* ── Action Bar ── */
.studio-actions {
  display: flex; justify-content: space-between; align-items: center;
  padding: var(--sp-3) 0; gap: var(--sp-3);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--sp-4);
}
.actions-left, .actions-right { display: flex; align-items: center; gap: var(--sp-2); }

.btn {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: 7px 14px; border: none; border-radius: var(--radius-sm);
  font-size: .88rem; font-weight: 500; cursor: pointer;
  background: var(--surface-2); color: var(--text-secondary);
  transition: all var(--dur) var(--ease);
  white-space: nowrap;
}
.btn:hover { background: var(--surface-3); color: var(--text); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .35; cursor: default; transform: none; }
.btn-icon-only {
  padding: 7px 10px; font-size: 1.1rem;
  min-width: 36px; justify-content: center;
}
.btn-accent {
  background: var(--accent); color: #fff;
}
.btn-accent:hover { background: #ff85d8; color: #fff; filter: brightness(1.08); }
.btn-group { display: flex; gap: 2px; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.btn-group .btn:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

.btn-split { display: flex; }
.btn-split .btn { border-radius: 0; }
.btn-split .btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.btn-split .btn:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.btn-split-arrow { padding: 7px 8px; font-size: .8rem; }

/* ── Studio Body ── */
.studio-body {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: var(--sp-4);
  align-items: start;
}
.canvas-column { display: flex; flex-direction: column; gap: var(--sp-3); }

/* ── Stage (Canvas) ── */
.stage {
  position: relative;
  aspect-ratio: 1;
  background: #000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-lg), inset 0 0 60px rgba(0,0,0,.3);
  transition: box-shadow .3s var(--ease);
}
.stage:hover { box-shadow: var(--shadow-lg), 0 0 30px rgba(255,107,203,.06); }
.stage:fullscreen { border-radius: 0; aspect-ratio: auto; border: none; }
#canvas { width: 100%; height: 100%; display: block; }

.btn-fullscreen {
  position: absolute; top: 10px; right: 10px; z-index: 5;
  padding: 6px 10px; font-size: .9rem; border-radius: var(--radius-sm);
  background: rgba(14,14,26,.72); border: 1px solid rgba(255,255,255,.08);
  color: var(--text-secondary); cursor: pointer; opacity: 0;
  transition: opacity .25s var(--ease), background .15s;
  backdrop-filter: blur(6px);
}
.stage:hover .btn-fullscreen { opacity: .8; }
.btn-fullscreen:hover { opacity: 1 !important; background: rgba(14,14,26,.9); color: var(--text); }
@media (hover: none) {
  .btn-fullscreen { opacity: .8; }
}

.zoom-indicator {
  position: absolute; bottom: 10px; left: 10px; z-index: 5;
  padding: 3px 8px; font-size: .72rem; font-family: var(--font-mono);
  background: rgba(14,14,26,.72); border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius-sm); color: var(--text-secondary);
  backdrop-filter: blur(6px);
  pointer-events: none;
}

/* ── URL Bar ── */
.url-bar {
  display: flex; align-items: center;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.url-box {
  flex: 1; display: block; padding: 8px 12px;
  font-family: var(--font-mono); font-size: .78rem;
  color: var(--text-muted); cursor: copy;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: color var(--dur);
}
.url-box:hover { color: var(--text-secondary); }
.url-box.copied { color: var(--accent); }

/* ── Preset Strip ── */
.preset-strip-wrapper {
  margin-top: var(--sp-4);
  border-top: 1px solid var(--border-subtle);
  padding-top: var(--sp-4);
}
.preset-strip-title {
  font-size: .8rem; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .06em;
  margin-bottom: var(--sp-3);
}
.preset-strip-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--sp-3);
}
.preset-strip-header .preset-strip-title { margin-bottom: 0; }
.preset-strip {
  display: flex; gap: var(--sp-3);
  overflow-x: auto; overflow-y: hidden;
  padding-bottom: var(--sp-2);
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--surface-3) transparent;
}
.preset-strip::-webkit-scrollbar { height: 4px; }
.preset-strip::-webkit-scrollbar-track { background: transparent; }
.preset-strip::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 2px; }

.preset-card {
  flex: 0 0 auto; width: 110px;
  scroll-snap-align: start;
  border-radius: var(--radius);
  overflow: hidden; cursor: pointer;
  border: 2px solid transparent;
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
  background: var(--surface);
}
.preset-card:hover { border-color: var(--border); transform: translateY(-2px); }
.preset-card.active { border-color: var(--accent); box-shadow: var(--shadow-glow); }
.preset-card-thumb {
  width: 100%; aspect-ratio: 1;
  background: #000; display: block; object-fit: cover;
}
.preset-card-name {
  padding: 5px 8px; font-size: .72rem; font-weight: 500;
  color: var(--text-secondary); text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ═══════ PANEL (Sidebar) ═══════ */
.panel {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  max-height: calc(100vh - 160px);
  overflow-y: auto;
  position: sticky; top: 68px;
  scrollbar-width: thin;
  scrollbar-color: var(--surface-3) transparent;
}
.panel::-webkit-scrollbar { width: 4px; }
.panel::-webkit-scrollbar-track { background: transparent; }
.panel::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 2px; }

/* ── Panel Sections ── */
.panel-section { border-bottom: 1px solid var(--border-subtle); }
.panel-section:last-child { border-bottom: none; }

.panel-section-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-3) var(--sp-4);
  cursor: pointer; user-select: none;
  transition: background var(--dur) var(--ease);
}
.panel-section-header:hover { background: var(--surface-2); }
.panel-section-title {
  font-size: .78rem; font-weight: 600; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: .05em;
}
.panel-section-chevron {
  font-size: .7rem; color: var(--text-muted);
  transition: transform .25s var(--ease);
}
.panel-section.collapsed .panel-section-chevron { transform: rotate(-90deg); }
.panel-section-body {
  padding: 0 var(--sp-4) var(--sp-4);
  display: flex; flex-direction: column; gap: var(--sp-3);
  transition: max-height .3s var(--ease), opacity .25s var(--ease);
  overflow: hidden;
  max-height: 1200px;
}
.panel-section.collapsed .panel-section-body {
  max-height: 0; opacity: 0; padding-top: 0; padding-bottom: 0;
}

/* ── Slider Control ── */
.ctrl {
  display: flex; flex-direction: column; gap: 3px;
}
.ctrl-row {
  display: flex; align-items: center; gap: var(--sp-2);
}
.ctrl-label {
  font-size: .8rem; color: var(--text-secondary);
  min-width: 60px; flex-shrink: 0;
}
.ctrl-value {
  font-size: .78rem; font-family: var(--font-mono);
  color: var(--text-muted); min-width: 38px; text-align: right;
}
.ctrl-lock {
  width: 22px; height: 22px; border: none; background: none;
  color: var(--text-muted); font-size: .8rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  border-radius: 4px; transition: all var(--dur);
  flex-shrink: 0; opacity: .5;
}
.ctrl-lock:hover { opacity: 1; background: var(--surface-3); }
.ctrl-lock.locked { opacity: 1; color: var(--accent); }
.ctrl-lock.locked::after { content: "🔒"; font-size: .65rem; }
.ctrl-lock:not(.locked)::after { content: "🔓"; font-size: .65rem; }
.ctrl-slider {
  flex: 1; height: 4px;
  -webkit-appearance: none; appearance: none;
  background: var(--surface-3);
  border-radius: 2px; outline: none;
  transition: background var(--dur);
}
.ctrl-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%; background: var(--accent);
  border: 2px solid var(--bg);
  cursor: pointer;
  box-shadow: 0 0 6px var(--accent-glow);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur);
}
.ctrl-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 12px var(--accent-glow);
}
.ctrl-slider::-moz-range-thumb {
  width: 14px; height: 14px;
  border-radius: 50%; background: var(--accent);
  border: 2px solid var(--bg); cursor: pointer;
}
.ctrl:focus-within { outline: none; }
.ctrl:focus-within .ctrl-slider::-webkit-slider-thumb {
  box-shadow: 0 0 0 3px var(--accent-dim);
}

/* ── Select Control ── */
.ctrl-select {
  display: flex; flex-direction: column; gap: 3px;
}
.ctrl-select select {
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 6px 10px; font-size: .85rem;
  cursor: pointer; transition: border-color var(--dur);
}
.ctrl-select select:hover { border-color: var(--accent-dim); }
.ctrl-select select:focus { outline: none; border-color: var(--accent); }

/* ── Shape Grid ── */
.shape-grid {
  display: flex; gap: var(--sp-2); flex-wrap: wrap;
}
.shape-btn {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); border: 2px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer;
  color: var(--text-muted);
  transition: all var(--dur) var(--ease);
}
.shape-btn:hover { border-color: var(--text-muted); color: var(--text); }
.shape-btn.active { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.shape-btn svg { width: 20px; height: 20px; }

/* ── Palette Grid ── */
.palette-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(32px, 1fr));
  gap: var(--sp-2);
}
.palette-swatch {
  width: 32px; height: 32px;
  border-radius: 50%; border: 2px solid transparent;
  cursor: pointer; overflow: hidden;
  transition: all var(--dur) var(--ease);
  position: relative;
}
.palette-swatch:hover { transform: scale(1.15); }
.palette-swatch.active {
  border-color: var(--text);
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
}
.palette-swatch-gradient {
  width: 100%; height: 100%; display: block;
}

/* ── Background Toggle ── */
.bg-toggle {
  display: flex; gap: var(--sp-2);
}
.bg-btn {
  flex: 1; height: 36px;
  border-radius: var(--radius-sm); border: 2px solid var(--border);
  cursor: pointer; transition: all var(--dur);
  position: relative; overflow: hidden;
}
.bg-btn:hover { border-color: var(--text-muted); }
.bg-btn.active { border-color: var(--accent); box-shadow: 0 0 8px var(--accent-dim); }
.bg-btn-dark {
  background: radial-gradient(circle at 30% 30%, #1b2a4a, #05070f);
}
.bg-btn-light {
  background: radial-gradient(circle at 30% 30%, #eafcff, #7fd4e8);
}

/* ── Effect Toggle ── */
.effect-toggle {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 0;
}
.effect-label {
  font-size: .83rem; color: var(--text-secondary);
}
.effect-switch {
  position: relative; width: 36px; height: 20px;
  flex-shrink: 0;
}
.effect-switch input {
  opacity: 0; width: 0; height: 0; position: absolute;
}
.effect-switch-track {
  position: absolute; inset: 0;
  background: var(--surface-3); border-radius: 10px;
  cursor: pointer; transition: background var(--dur);
}
.effect-switch-track::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: var(--text-muted); border-radius: 50%;
  transition: transform .2s var(--ease), background .2s;
}
.effect-switch input:checked + .effect-switch-track {
  background: var(--accent-dim);
}
.effect-switch input:checked + .effect-switch-track::after {
  transform: translateX(16px);
  background: var(--accent);
}

/* ═══════ EXPORT MODAL ═══════ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .25s var(--ease);
  pointer-events: none;
}
.modal-overlay.visible { opacity: 1; pointer-events: auto; }
.modal-overlay[hidden] { display: none; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 90%; max-width: 440px;
  max-height: 85vh; overflow-y: auto;
}
.modal-sm { max-width: 360px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border-subtle);
}
.modal-header h3 { font-size: 1rem; font-weight: 600; }
.modal-close {
  background: none; border: none; color: var(--text-muted);
  font-size: 1.1rem; padding: 4px; cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color var(--dur), background var(--dur);
}
.modal-close:hover { color: var(--text); background: var(--surface-3); }
.modal-body { padding: var(--sp-5); }

/* ── Export Tabs ── */
.export-tabs {
  display: flex; gap: 2px; margin-bottom: var(--sp-4);
  background: var(--surface-2); border-radius: var(--radius-sm);
  padding: 3px;
}
.export-tab {
  flex: 1; padding: 7px; text-align: center;
  border: none; border-radius: 4px;
  background: none; color: var(--text-muted);
  font-size: .85rem; font-weight: 500;
  cursor: pointer; transition: all var(--dur);
}
.export-tab:hover { color: var(--text-secondary); }
.export-tab.active { background: var(--surface-3); color: var(--text); }

.export-options {
  display: flex; flex-direction: column; gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}
.export-option-row {
  display: flex; align-items: center; gap: var(--sp-3);
}
.export-option-row label {
  font-size: .85rem; color: var(--text-secondary); min-width: 60px;
}
.export-option-row select {
  flex: 1; background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 7px 10px; font-size: .85rem;
}

.btn-export-go {
  width: 100%; padding: 10px; font-size: .95rem;
  justify-content: center; margin-top: var(--sp-2);
}

/* ── Progress Bar ── */
.export-progress { margin-bottom: var(--sp-3); }
.progress-bar {
  height: 4px; background: var(--surface-3);
  border-radius: 2px; overflow: hidden; margin-bottom: var(--sp-2);
}
.progress-fill {
  height: 100%; background: var(--accent);
  border-radius: 2px; width: 0%;
  transition: width .15s linear;
}
.progress-text { font-size: .8rem; color: var(--text-muted); }

/* ═══════ SHORTCUTS ═══════ */
.shortcuts-body { padding: var(--sp-4) var(--sp-5); }
.shortcuts-list {
  display: grid; grid-template-columns: auto 1fr; gap: var(--sp-2) var(--sp-4);
  align-items: center;
}
.shortcuts-list dt { text-align: right; }
.shortcuts-list dd { font-size: .88rem; color: var(--text-secondary); }
kbd {
  display: inline-block; padding: 2px 7px;
  background: var(--surface-3); border: 1px solid var(--border);
  border-radius: 4px; font-family: var(--font-mono);
  font-size: .78rem; color: var(--text-secondary);
  min-width: 24px; text-align: center;
}

/* ═══════ SECTION (SEO content) ═══════ */
.section {
  max-width: 1000px; margin: 0 auto; padding: var(--sp-10) var(--sp-6);
  position: relative;
}
.section::before {
  content: ""; display: block; width: 60px; height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent);
  margin: 0 auto var(--sp-8); border-radius: 1px;
}
.section:first-child::before { display: none; }
.section h2 { font-size: 1.5rem; margin-bottom: var(--sp-4); color: var(--text); }
.section h2 .accent { color: var(--accent); }
.muted, .section p { color: var(--text-secondary); line-height: 1.6; }

/* ── Steps ── */
.steps {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--sp-4); position: relative;
}
.steps::before {
  content: ""; position: absolute; top: 28px; left: 0; right: 0;
  height: 2px; background: var(--border-subtle); z-index: 0;
}
.step {
  background: var(--surface); border-radius: var(--radius-lg);
  padding: var(--sp-5); position: relative; z-index: 1;
  border: 1px solid var(--border-subtle);
}
.step::before {
  content: ""; display: block; width: 12px; height: 12px;
  background: var(--accent); border-radius: 50%;
  margin: 0 auto var(--sp-3);
}
.step h3 { font-size: 1rem; margin-bottom: var(--sp-2); color: var(--text); }
.step p { color: var(--text-secondary); line-height: 1.6; font-size: .92rem; }

.determinism-note {
  margin-top: var(--sp-6); padding: var(--sp-4);
  background: var(--surface); border-left: 3px solid var(--accent);
  border-radius: var(--radius); color: var(--text-secondary);
  line-height: 1.6;
}

/* ── License ── */
.license p { max-width: 720px; line-height: 1.7; }

/* ── Gallery ── */
.gallery-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--sp-3);
}
.gallery-item {
  position: relative; border-radius: var(--radius);
  overflow: hidden; cursor: pointer;
  background: #000; aspect-ratio: 1;
  border: 1px solid var(--border-subtle);
  transition: border-color var(--dur), transform var(--dur);
}
.gallery-item:hover { border-color: var(--border); transform: translateY(-2px); }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── FAQ ── */
details.faq-item {
  border-bottom: 1px solid var(--border-subtle); padding: var(--sp-3) 0;
}
summary { cursor: pointer; font-weight: 600; display: flex; align-items: center; gap: var(--sp-2); }
details p { margin-top: var(--sp-2); color: var(--text-secondary); line-height: 1.6; max-width: 720px; }
.faq-badge {
  display: inline-block; font-size: .68rem; font-weight: 600;
  padding: 2px 8px; border-radius: 4px; text-transform: uppercase;
  letter-spacing: .04em; background: var(--surface-3); color: var(--text-muted);
  flex-shrink: 0;
}
.faq-badge[data-cat="usage"] { background: #2e2a1a; color: #dfc06b; }
.faq-badge[data-cat="technical"] { background: #1a2a2e; color: #6bbddf; }

/* ── Footer ── */
.footer {
  text-align: center; padding: var(--sp-8) var(--sp-6);
  color: var(--text-muted); font-size: .9rem;
  border-top: 1px solid var(--border-subtle); margin-top: var(--sp-10);
}
.footer a { color: var(--text-muted); }
.footer a:hover { color: var(--text-secondary); }

/* ── Saved Designs ── */
.saved {
  margin-top: var(--sp-4);
  border-top: 1px solid var(--border-subtle);
  padding-top: var(--sp-4);
}
.saved-toolbar {
  display: flex; align-items: center; gap: var(--sp-2);
  flex-wrap: wrap;
}
.btn-small {
  padding: 4px 10px; font-size: .78rem;
  background: var(--surface-2); color: var(--text-secondary);
}
.btn-small:hover { background: var(--surface-3); color: var(--text); }
#save-status {
  color: var(--text-muted); font-size: .8rem;
}
#saved-list {
  list-style: none; margin-top: var(--sp-3);
  display: flex; flex-direction: column; gap: var(--sp-2);
}
.saved-item {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: .85rem; color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
}
.saved-item span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Ad Slot ── */
.ad-slot { max-width: 960px; margin: 8px auto; min-height: 0; text-align: center; }

/* ═══════ TOAST ═══════ */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(8px);
  background: var(--surface-2); color: var(--text);
  padding: 10px 20px; border-radius: var(--radius);
  font-size: .88rem; z-index: 200;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  opacity: 0; transition: opacity .25s var(--ease), transform .25s var(--ease);
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }

/* ── Mobile FAB ── */
.fab-create {
  display: none; position: fixed; bottom: 24px; right: 24px;
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--accent); color: #fff; border: none;
  font-size: 1.3rem; cursor: pointer; z-index: 100;
  box-shadow: 0 4px 16px rgba(255,107,203,.4);
  transition: transform .2s, box-shadow .2s;
}
.fab-create:hover { transform: scale(1.1); box-shadow: 0 6px 24px rgba(255,107,203,.5); }
.fab-create:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

/* ═══════ RESPONSIVE ═══════ */
@media (max-width: 900px) {
  .studio-body {
    grid-template-columns: 1fr;
  }
  .panel {
    position: static; max-height: none;
    border-radius: var(--radius-lg);
    order: 1;
  }
  .studio-actions {
    flex-wrap: wrap;
  }
  .actions-left, .actions-right {
    flex-wrap: wrap;
  }
  .btn { padding: 8px 12px; min-height: 40px; }
  .preset-card { width: 90px; }
}

@media (max-width: 600px) {
  .topbar { padding: var(--sp-2) var(--sp-3); }
  .topbar nav { gap: var(--sp-3); }
  .topbar nav a { font-size: .82rem; }
  .hero { padding: var(--sp-6) var(--sp-3) var(--sp-3); }
  .hero h1 { font-size: 1.5rem; }
  .hero-sub { font-size: .92rem; }
  .studio { padding: 0 var(--sp-3) var(--sp-3); }
  .studio-actions { gap: var(--sp-2); }
  .btn { font-size: .82rem; padding: 7px 10px; }
  .btn-icon-only { padding: 7px 8px; font-size: 1rem; min-width: 32px; }
  .stage { border-radius: var(--radius); }
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .section { padding: var(--sp-8) var(--sp-3); }
  .section h2 { font-size: 1.3rem; }
  .steps { grid-template-columns: 1fr; }
  .fab-create { display: flex; align-items: center; justify-content: center; }
  .preset-card { width: 80px; }
  .preset-card-name { font-size: .68rem; padding: 3px 6px; }
}

/* ── Fullscreen tweaks ── */
.stage:fullscreen {
  display: flex; align-items: center; justify-content: center;
  background: #000;
}
.stage:fullscreen #canvas {
  max-width: 100vmin; max-height: 100vmin;
}

/* ── Accessibility: focus visible ── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
button:focus-visible { outline-offset: 2px; }

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
