/* Wonder Backgrounds — Neumorphism Soft-UI Design System (Light & Dark) */
:root {
  color-scheme: light;
  --bg: #e7ecf5;
  --bg-deep: #dce3f0;
  --surface: #e7ecf5;
  --surface-alt: #edf1f8;
  --ink: #24293d;
  --body: #4d556e;
  --muted: #76809c;
  --accent: #5b46f6;
  --accent-2: #8b5cf6;
  --accent-soft: #dcd8fc;
  --on-accent: #ffffff;
  --neu-light: rgba(255, 255, 255, 0.88);
  --neu-dark: rgba(163, 177, 198, 0.58);
  --neu-border: rgba(255, 255, 255, 0.45);
  --sh-xs: 3px 3px 7px var(--neu-dark), -3px -3px 7px var(--neu-light);
  --sh-sm: 5px 5px 11px var(--neu-dark), -5px -5px 11px var(--neu-light);
  --sh-md: 8px 8px 18px var(--neu-dark), -8px -8px 18px var(--neu-light);
  --sh-lg: 14px 14px 28px var(--neu-dark), -14px -14px 28px var(--neu-light);
  --sh-in: inset 4px 4px 9px var(--neu-dark), inset -4px -4px 9px var(--neu-light);
  --sh-in-lg: inset 7px 7px 14px var(--neu-dark), inset -7px -7px 14px var(--neu-light);
  --r-sm: 14px;
  --r-md: 20px;
  --r-lg: 28px;
  --r-pill: 999px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1d212d;
  --bg-deep: #161923;
  --surface: #1d212d;
  --surface-alt: #222736;
  --ink: #eef1fa;
  --body: #bac2d8;
  --muted: #828ca8;
  --accent: #8c78ff;
  --accent-2: #38bdf8;
  --accent-soft: #2b264d;
  --on-accent: #ffffff;
  --neu-light: rgba(255, 255, 255, 0.055);
  --neu-dark: rgba(9, 11, 16, 0.72);
  --neu-border: rgba(255, 255, 255, 0.06);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }

body {
  font: 400 15px/1.6 var(--font);
  background: var(--bg);
  color: var(--body);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.wrap { max-width: 1320px; margin: 0 auto; padding: 0 24px; }

/* Header */
.neu-header {
  position: sticky;
  top: 0;
  z-index: 80;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--neu-border);
}
.neu-header .wrap {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding-top: 10px;
  padding-bottom: 10px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  color: var(--ink);
}
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--sh-sm);
  border: 1px solid var(--neu-border);
  display: grid;
  place-items: center;
  color: var(--accent);
}
.brand-txt b { display: block; font-size: 16px; letter-spacing: -0.02em; }
.brand-txt b em { font-style: normal; color: var(--accent); }
.brand-txt small { display: block; font-size: 11px; color: var(--muted); font-weight: 500; }

.nav-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Neumorphic Buttons & Pills */
.neu-btn {
  height: 42px;
  padding: 0 16px;
  border: 1px solid var(--neu-border);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  font-size: 13.5px;
  box-shadow: var(--sh-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: transform 0.16s ease, box-shadow 0.16s ease, color 0.16s ease, background 0.16s ease;
  user-select: none;
}
.neu-btn:hover { transform: translateY(-1px); box-shadow: var(--sh-md); color: var(--accent); }
.neu-btn:active, .neu-btn.pressed { transform: scale(0.97); box-shadow: var(--sh-in); }
.neu-btn.icon { width: 42px; padding: 0; }
.neu-btn.sm { height: 34px; padding: 0 13px; font-size: 12.5px; }
.neu-btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--on-accent);
  border-color: transparent;
}
.neu-btn.primary:hover { color: var(--on-accent); filter: brightness(1.06); }
.neu-btn.primary:active { box-shadow: inset 3px 3px 8px rgba(0,0,0,0.35); }
.neu-btn.active {
  box-shadow: var(--sh-in);
  color: var(--accent);
  background: var(--surface-alt);
}
.neu-btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

/* Surfaces & Wells */
.neu-card {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-lg);
  border: 1px solid var(--neu-border);
  padding: 24px;
}
.neu-well {
  background: var(--surface);
  border-radius: var(--r-md);
  box-shadow: var(--sh-in);
  border: 1px solid var(--neu-border);
  padding: 16px;
}
.neu-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--r-pill);
  background: var(--surface);
  box-shadow: var(--sh-in);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* Hero / Style Intro */
.style-hero {
  padding: 28px 0 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}
.style-hero h1 {
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.1;
  color: var(--ink);
  letter-spacing: -0.03em;
  margin-top: 10px;
}
.style-hero p {
  max-width: 68ch;
  margin-top: 8px;
  color: var(--body);
}
.hero-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* Studio Layout */
.studio-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.95fr);
  gap: 24px;
  align-items: start;
}
@media (max-width: 980px) {
  .studio-grid { grid-template-columns: 1fr; }
}

.stage-well {
  background: var(--surface);
  border-radius: var(--r-md);
  box-shadow: var(--sh-in-lg);
  padding: 16px;
  display: grid;
  place-items: center;
  min-height: 280px;
}
.canvas-frame {
  position: relative;
  width: 100%;
  max-height: 58vh;
  aspect-ratio: var(--ar, 16 / 9);
  border-radius: var(--r-sm);
  overflow: hidden;
  box-shadow: var(--sh-md);
  background: #0b0d14;
  margin: 0 auto;
}
.canvas-frame canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.stage-overlay {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
}
.stage-chip {
  pointer-events: auto;
  padding: 5px 11px;
  border-radius: var(--r-pill);
  background: rgba(15, 18, 28, 0.68);
  backdrop-filter: blur(8px);
  color: #f3f6ff;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.14);
}
.stage-mockup {
  position: absolute;
  inset: 16% 10%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
  padding: 20px;
  border-radius: var(--r-md);
  background: rgba(14, 16, 26, 0.28);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #ffffff;
  pointer-events: none;
}
.stage-mockup h3 { font-size: clamp(18px, 2.5vw, 28px); letter-spacing: -0.02em; }
.stage-mockup p { font-size: 13px; opacity: 0.9; max-width: 40ch; }
.stage-mockup span {
  padding: 6px 14px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.3);
  font-size: 12px;
  font-weight: 600;
}

/* Export Bar */
.section-lbl {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.section-lbl span { color: var(--accent); font-weight: 700; }

.export-box { margin-top: 20px; display: flex; flex-direction: column; gap: 14px; }
.size-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.neu-select, .neu-input {
  height: 42px;
  border-radius: var(--r-pill);
  border: 1px solid var(--neu-border);
  background: var(--surface);
  box-shadow: var(--sh-in);
  padding: 0 16px;
  color: var(--ink);
  font-weight: 600;
  font-size: 13.5px;
  outline: none;
}
.neu-select { cursor: pointer; flex: 1; min-width: 210px; }
.neu-num { width: 92px; text-align: center; padding: 0 10px; }

.dl-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}
@media (max-width: 600px) {
  .dl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.dl-btn {
  height: 44px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 700;
}

.progress-well {
  padding: 10px 14px;
  border-radius: var(--r-sm);
  box-shadow: var(--sh-in);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
}
.progress-track {
  height: 8px;
  border-radius: var(--r-pill);
  background: var(--bg-deep);
  box-shadow: var(--sh-in);
  overflow: hidden;
  margin-top: 8px;
}
.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.12s linear;
}

/* Controls Panel */
.ctrl-panel { display: flex; flex-direction: column; gap: 18px; }
.ctrl-group {
  padding-top: 16px;
  border-top: 1px solid var(--neu-border);
}
.ctrl-group:first-child { padding-top: 0; border-top: 0; }

.color-slots {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.color-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 6px;
  border-radius: var(--r-pill);
  background: var(--surface);
  box-shadow: var(--sh-in);
  border: 1px solid var(--neu-border);
}
.color-swatch {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  box-shadow: var(--sh-xs);
  border: 3px solid var(--surface);
  overflow: hidden;
  flex: none;
  cursor: pointer;
}
.color-swatch input[type="color"] {
  position: absolute;
  inset: -8px;
  width: 52px;
  height: 52px;
  opacity: 0;
  cursor: pointer;
}
.color-hex {
  border: 0;
  background: transparent;
  width: 100%;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 700;
  font-size: 13px;
  color: var(--ink);
  text-transform: uppercase;
  outline: none;
}

/* Sliders */
.slider-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
}
@media (max-width: 520px) {
  .slider-grid { grid-template-columns: 1fr; }
}
.slider-item label {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}
.slider-item label b { color: var(--accent); font-weight: 700; }
.neu-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 12px;
  border-radius: var(--r-pill);
  background: var(--surface);
  box-shadow: var(--sh-in);
  outline: none;
  cursor: pointer;
}
.neu-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--accent);
  box-shadow: var(--sh-xs);
  cursor: pointer;
  transition: transform 0.12s;
}
.neu-range::-webkit-slider-thumb:hover { transform: scale(1.12); }
.neu-range::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--accent);
  box-shadow: var(--sh-xs);
  cursor: pointer;
}

/* Presets Section */
.presets-sec { padding: 36px 0 48px; }
.presets-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
}
.presets-head h2 {
  font-size: clamp(22px, 3vw, 30px);
  color: var(--ink);
  letter-spacing: -0.02em;
}
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.search-input {
  min-width: 230px;
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
}
.preset-card {
  background: var(--surface);
  border-radius: var(--r-md);
  box-shadow: var(--sh-md);
  border: 1px solid var(--neu-border);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.preset-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--sh-lg);
}
.preset-card.selected {
  box-shadow: var(--sh-in), 0 0 0 2px var(--accent);
}
.preset-thumb {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: var(--r-sm);
  overflow: hidden;
  box-shadow: var(--sh-in);
  background: #0b0d14;
  cursor: pointer;
  position: relative;
}
.preset-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.preset-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.preset-title-row b {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.25;
}
.preset-src {
  font-size: 11px;
  color: var(--muted);
  display: block;
  margin-top: 2px;
}
.dots-mini {
  display: flex;
  align-items: center;
  flex: none;
}
.dots-mini i {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid var(--surface);
  margin-left: -4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
.dots-mini i:first-child { margin-left: 0; }
.preset-actions {
  display: flex;
  gap: 8px;
}
.preset-actions .neu-btn { flex: 1; }

/* Code Well */
.code-well {
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  background: var(--surface);
  box-shadow: var(--sh-in);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--ink);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 110px;
}

/* Style Switcher Modal */
.neu-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(15, 18, 28, 0.48);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  padding: 20px;
}
.neu-modal-card {
  width: min(960px, 100%);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-lg);
  border: 1px solid var(--neu-border);
  padding: 24px;
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.modal-head h3 { font-size: 20px; color: var(--ink); }
.style-links-grid {
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
  padding: 4px;
}
.style-link-tile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--surface);
  box-shadow: var(--sh-sm);
  border: 1px solid var(--neu-border);
  transition: transform 0.15s, box-shadow 0.15s;
}
.style-link-tile:hover { transform: translateY(-2px); box-shadow: var(--sh-md); color: var(--accent); }
.style-link-tile.current { box-shadow: var(--sh-in); color: var(--accent); }
.tile-swatch {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  flex: none;
  box-shadow: var(--sh-xs);
}
.style-link-tile b { display: block; font-size: 13.5px; color: var(--ink); line-height: 1.2; }
.style-link-tile small { display: block; font-size: 11px; color: var(--muted); }

/* Toast */
.neu-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 16px);
  opacity: 0;
  pointer-events: none;
  z-index: 300;
  padding: 11px 20px;
  border-radius: var(--r-pill);
  background: var(--ink);
  color: var(--bg);
  font-weight: 600;
  font-size: 13.5px;
  box-shadow: var(--sh-md);
  transition: opacity 0.2s, transform 0.2s;
}
.neu-toast.on { opacity: 1; transform: translate(-50%, 0); }

/* Footer */
.neu-footer {
  border-top: 1px solid var(--neu-border);
  padding: 28px 0 36px;
  margin-top: 24px;
  color: var(--muted);
  font-size: 13px;
}
.neu-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.neu-footer a:hover { color: var(--accent); }

/* Index / Gallery Hub additions */
.hub-hero {
  padding: 44px 0 28px;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 28px;
  align-items: center;
}
@media (max-width: 900px) { .hub-hero { grid-template-columns: 1fr; } }
.hub-hero h1 {
  font-size: clamp(32px, 4.8vw, 54px);
  line-height: 1.08;
  color: var(--ink);
  letter-spacing: -0.03em;
  margin-top: 14px;
}
.hub-hero h1 em { font-style: normal; color: var(--accent); }
.hub-hero p { margin-top: 14px; font-size: 16px; max-width: 56ch; }
.styles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(265px, 1fr));
  gap: 22px;
}
.style-card {
  background: var(--surface);
  border-radius: var(--r-md);
  box-shadow: var(--sh-md);
  border: 1px solid var(--neu-border);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.style-card:hover { transform: translateY(-4px); box-shadow: var(--sh-lg); }
.style-card-preview {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: var(--r-sm);
  overflow: hidden;
  box-shadow: var(--sh-in);
  background: #0b0d14;
}
.style-card-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.style-card-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.style-card-meta b { font-size: 16px; color: var(--ink); }
.style-card-desc { font-size: 12.5px; color: var(--muted); line-height: 1.45; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
