/* ============================================================
   Aurora — Atmospheric Gradient Studio
   Palette: midnight-pearl + iridescent (custom)
   ============================================================ */

:root {
  /* surfaces */
  --bg-0: #06051a;
  --bg-1: #0a0820;
  --bg-2: #14112e;
  --surface: rgba(28, 22, 56, 0.55);
  --surface-2: rgba(40, 32, 78, 0.45);
  --surface-strong: rgba(46, 36, 92, 0.78);
  --border: rgba(160, 140, 255, 0.14);
  --border-strong: rgba(180, 160, 255, 0.30);

  /* aurora palette */
  --aurora-violet: #7B5CFA;
  --aurora-teal:   #2DD4BF;
  --aurora-pink:   #F472B6;
  --aurora-amber:  #F4A261;
  --aurora-pearl:  #E8E4FF;

  /* text */
  --text-1: #F2EEFF;
  --text-2: rgba(232, 228, 255, 0.74);
  --text-3: rgba(232, 228, 255, 0.52);
  --text-4: rgba(232, 228, 255, 0.34);

  /* semantic */
  --good: #2DD4BF;
  --warn: #F4A261;
  --bad:  #F472B6;

  /* glow */
  --glow-violet: 0 0 40px rgba(123, 92, 250, 0.45);
  --glow-teal:   0 0 30px rgba(45, 212, 191, 0.35);

  /* spring */
  --spring: cubic-bezier(.34,1.56,.64,1);
  --ease:   cubic-bezier(.4,0,.2,1);
}

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

html, body {
  height: 100%;
  background: var(--bg-0);
  color: var(--text-1);
  font-family: 'Heebo', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(123, 92, 250, 0.25), transparent 60%),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(45, 212, 191, 0.18), transparent 50%),
    var(--bg-0);
  background-attachment: fixed;
  padding-bottom: 92px;
}

.serif { font-family: 'Frank Ruhl Libre', serif; font-weight: 700; letter-spacing: -0.02em; }
.serif.italic { font-family: 'Instrument Serif', serif; font-style: italic; font-weight: 400; }
.mono { font-family: 'IBM Plex Mono', monospace; }

button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font: inherit; }
input[type="search"], input[type="text"] {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-1);
  border-radius: 12px;
  padding: 10px 14px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
input[type="search"]:focus, input[type="text"]:focus {
  border-color: var(--border-strong);
  box-shadow: 0 0 0 3px rgba(123, 92, 250, 0.18);
}

/* ============= ambient ============= */
.ambient {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
  animation: drift 22s ease-in-out infinite;
}
.orb-1 {
  width: 420px; height: 420px;
  background: radial-gradient(circle, var(--aurora-violet), transparent 70%);
  top: -120px; right: -100px;
}
.orb-2 {
  width: 360px; height: 360px;
  background: radial-gradient(circle, var(--aurora-teal), transparent 70%);
  bottom: -80px; left: -120px;
  animation-delay: -10s;
}
.orb-3 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, var(--aurora-pink), transparent 70%);
  top: 40%; left: 50%;
  animation-delay: -16s;
  opacity: 0.35;
}
.grain {
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.05 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  opacity: 0.6;
  mix-blend-mode: overlay;
}
@keyframes drift {
  0%, 100% { transform: translate(0,0) scale(1); }
  50% { transform: translate(30px, -20px) scale(1.08); }
}

/* ============= app shell ============= */
.app {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 18px;
}

/* ============= top bar ============= */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0 14px;
  position: sticky;
  top: 0;
  z-index: 30;
  background: linear-gradient(to bottom, var(--bg-0) 70%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo {
  width: 44px; height: 44px;
  filter: drop-shadow(0 4px 18px rgba(123, 92, 250, 0.55));
  transition: transform .4s var(--spring);
}
.brand:hover .brand-logo { transform: rotate(-8deg) scale(1.06); }
.brand h1 {
  font-family: 'Frank Ruhl Libre', serif;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.02em;
  background: linear-gradient(120deg, var(--aurora-pearl), var(--aurora-violet) 50%, var(--aurora-teal));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1;
}
.brand-text span {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
  letter-spacing: 0.05em;
}

.topbar-actions { display: flex; gap: 8px; }
.icon-btn {
  width: 38px; height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
  transition: all .2s var(--ease);
}
.icon-btn:hover {
  color: var(--text-1);
  background: var(--surface-strong);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
.icon-btn:active { transform: translateY(0) scale(0.96); }

/* ============= hero ============= */
.hero {
  position: relative;
  margin: 8px 0 22px;
  border-radius: 28px;
  overflow: hidden;
  min-height: 280px;
  border: 1px solid var(--border);
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.6);
}
.hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: saturate(1.1);
}
.hero-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(10, 8, 32, 0.05) 30%, rgba(10, 8, 32, 0.85) 100%),
    linear-gradient(to top, rgba(10, 8, 32, 0.6), transparent 60%);
}
.hero-content {
  position: relative;
  padding: 32px 26px 26px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 280px;
}
.kicker {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-3);
  margin-bottom: 12px;
}
.hero-title {
  font-size: clamp(28px, 7vw, 38px);
  line-height: 1.05;
  margin-bottom: 10px;
}
.hero-title .serif { display: block; color: var(--text-1); }
.hero-title .serif.italic {
  background: linear-gradient(120deg, var(--aurora-teal), var(--aurora-violet) 50%, var(--aurora-pink));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-size: 1.05em;
  margin-top: 2px;
}
.hero-sub {
  color: var(--text-2);
  max-width: 520px;
  font-size: 14.5px;
  margin-bottom: 18px;
}
.hero-stats {
  display: flex;
  gap: 24px;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat-num {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 600;
  font-size: 22px;
  color: var(--text-1);
  line-height: 1;
}
.stat-lbl {
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0.05em;
}

/* ============= tabs ============= */
.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  margin-bottom: 22px;
  position: sticky;
  top: 78px;
  z-index: 20;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  border-radius: 13px;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 500;
  transition: all .25s var(--ease);
}
.tab i { font-size: 16px; }
.tab.active {
  background: linear-gradient(135deg, var(--aurora-violet), var(--aurora-pink));
  color: white;
  box-shadow: 0 8px 24px -8px rgba(123, 92, 250, 0.6);
}
.tab:not(.active):hover { color: var(--text-1); background: var(--surface-2); }

/* ============= views ============= */
.view { display: none; animation: viewIn .35s var(--ease); }
.view.active { display: block; }
@keyframes viewIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============= STUDIO ============= */
.canvas-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: 0 14px 40px -16px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.canvas {
  border-radius: 18px;
  width: 100%;
  aspect-ratio: 16/10;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--aurora-violet), var(--aurora-teal));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06), 0 12px 30px -12px rgba(0,0,0,0.7);
  transition: background .45s var(--ease);
}
.canvas-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 14px 4px 12px;
}
.canvas-name {
  font-family: 'Frank Ruhl Libre', serif;
  font-weight: 500;
  font-size: 17px;
  color: var(--text-1);
}
.canvas-fmt {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11.5px;
  color: var(--text-3);
  letter-spacing: 0.05em;
}
.canvas-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-1);
  font-size: 13px;
  font-weight: 500;
  transition: all .2s var(--ease);
  flex: 1;
  justify-content: center;
}
.chip-btn:hover { background: var(--surface-strong); transform: translateY(-1px); }
.chip-btn:active { transform: scale(0.97); }
.chip-btn.primary {
  background: linear-gradient(135deg, var(--aurora-violet), var(--aurora-pink));
  border-color: transparent;
  color: white;
  box-shadow: 0 6px 18px -6px rgba(123, 92, 250, 0.6);
}

.control-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.control-row { display: flex; flex-direction: column; gap: 10px; }
.control-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
}
.control-val {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--text-1);
  text-transform: none;
}

.seg {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 4px;
  background: var(--bg-0);
  border-radius: 14px;
  border: 1px solid var(--border);
}
.seg-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 4px;
  border-radius: 10px;
  font-size: 10.5px;
  color: var(--text-3);
  transition: all .2s var(--ease);
}
.seg-btn i { font-size: 14px; }
.seg-btn.active {
  background: var(--surface-strong);
  color: var(--text-1);
  box-shadow: inset 0 0 0 1px var(--border-strong);
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(to right, var(--aurora-violet), var(--aurora-teal));
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--aurora-pearl);
  border: 3px solid var(--bg-0);
  cursor: grab;
  box-shadow: 0 0 0 1px var(--border-strong), var(--glow-violet);
  transition: transform .2s var(--spring);
}
input[type="range"]::-webkit-slider-thumb:active { transform: scale(1.18); cursor: grabbing; }
input[type="range"]::-moz-range-thumb {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--aurora-pearl);
  border: 3px solid var(--bg-0);
  cursor: grab;
}

.stops {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.stop-row {
  display: grid;
  grid-template-columns: 32px 1fr 60px auto;
  gap: 10px;
  align-items: center;
  padding: 8px 12px 8px 10px;
  background: var(--bg-0);
  border-radius: 14px;
  border: 1px solid var(--border);
}
.stop-swatch {
  width: 28px; height: 28px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.stop-swatch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.stop-hex {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12.5px;
  color: var(--text-1);
  background: transparent;
  border: none;
  padding: 0;
  outline: none;
  text-transform: uppercase;
}
.stop-pos {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11.5px;
  color: var(--text-3);
  text-align: center;
}
.stop-del {
  width: 26px; height: 26px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--text-3);
  transition: all .2s var(--ease);
}
.stop-del:hover { color: var(--bad); background: rgba(244, 114, 182, 0.1); }

.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  transition: all .2s var(--ease);
}
.ghost-btn:hover { color: var(--text-1); background: var(--surface-strong); border-style: solid; }
.ghost-btn.danger { color: var(--bad); border-color: rgba(244, 114, 182, 0.3); }
.ghost-btn.danger:hover { background: rgba(244, 114, 182, 0.08); }

.moods {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.moods::-webkit-scrollbar { display: none; }
.mood-chip {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-1);
  font-size: 12.5px;
  font-weight: 500;
  transition: all .2s var(--spring);
}
.mood-chip:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.mood-swatch {
  width: 18px; height: 18px;
  border-radius: 5px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.15);
}

.mesh-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  aspect-ratio: 1;
  padding: 12px;
  background: var(--bg-0);
  border-radius: 14px;
  border: 1px solid var(--border);
}
.mesh-cell {
  border-radius: 10px;
  cursor: pointer;
  position: relative;
  transition: transform .2s var(--spring);
  border: 1px solid rgba(255,255,255,0.1);
}
.mesh-cell input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.mesh-cell:hover { transform: scale(1.05); }

/* ============= LIBRARY ============= */
.view-head {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 18px;
}
.view-title {
  font-family: 'Frank Ruhl Libre', serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-1);
}
.view-tools {
  display: flex;
  gap: 8px;
}
.search-input { flex: 1; }
.select-input {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-1);
  border-radius: 12px;
  padding: 10px 14px;
  outline: none;
  cursor: pointer;
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}
.lib-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  transition: all .25s var(--spring);
  position: relative;
  cursor: pointer;
}
.lib-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
  box-shadow: 0 18px 36px -16px rgba(0, 0, 0, 0.6);
}
.lib-thumb {
  aspect-ratio: 4/3;
  width: 100%;
  position: relative;
}
.lib-fav {
  position: absolute;
  top: 8px;
  inset-inline-end: 8px;
  width: 30px; height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(8px);
  color: var(--text-2);
  font-size: 13px;
  transition: all .2s var(--spring);
}
.lib-fav.on { color: var(--aurora-amber); }
.lib-info {
  padding: 12px 14px 14px;
}
.lib-name {
  font-family: 'Frank Ruhl Libre', serif;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text-1);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lib-meta {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10.5px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.empty {
  text-align: center;
  padding: 32px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
}
.empty img {
  width: 180px;
  max-width: 70%;
  margin: 0 auto 14px;
  display: block;
  opacity: 0.95;
  filter: drop-shadow(0 8px 24px rgba(123, 92, 250, 0.3));
}
.empty h4 {
  font-family: 'Frank Ruhl Libre', serif;
  font-size: 19px;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 6px;
}
.empty p { color: var(--text-3); margin-bottom: 18px; max-width: 320px; margin-inline: auto; }

.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  background: linear-gradient(135deg, var(--aurora-violet), var(--aurora-pink));
  color: white;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 8px 24px -8px rgba(123, 92, 250, 0.55);
  transition: all .2s var(--spring);
}
.primary-btn:hover { transform: translateY(-2px); }
.primary-btn:active { transform: scale(0.97); }
.primary-btn.full { width: 100%; }

/* ============= TOOLS ============= */
.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 22px 18px;
  margin-bottom: 16px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.tool-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 16px; }
.tool-icon {
  width: 44px; height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--aurora-violet), var(--aurora-teal));
  color: white;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: var(--glow-violet);
}
.tool-head h3 {
  font-family: 'Frank Ruhl Libre', serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 2px;
}
.tool-head p { color: var(--text-3); font-size: 13px; }

.harmony-input {
  display: grid;
  grid-template-columns: 60px 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}
.harmony-input input[type="color"] {
  height: 44px;
  width: 100%;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  -webkit-appearance: none;
}
.harmony-input input[type="color"]::-webkit-color-swatch-wrapper { padding: 4px; }
.harmony-input input[type="color"]::-webkit-color-swatch { border: none; border-radius: 8px; }

.harmony-out {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-bottom: 14px;
  height: 70px;
}
.harmony-swatch {
  border-radius: 12px;
  position: relative;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.1);
  transition: transform .2s var(--spring);
}
.harmony-swatch:hover { transform: scale(1.04); }
.harmony-swatch span {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9.5px;
  background: rgba(0,0,0,0.55);
  color: white;
  padding: 2px 5px;
  border-radius: 4px;
}
.harmony-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 14px;
  border: 2px dashed var(--border-strong);
  border-radius: 16px;
  background: var(--bg-0);
  color: var(--text-3);
  cursor: pointer;
  transition: all .2s var(--ease);
  text-align: center;
}
.dropzone:hover { border-color: var(--aurora-violet); color: var(--text-1); background: var(--surface-2); }
.dropzone i { font-size: 28px; margin-bottom: 8px; color: var(--aurora-teal); }
.dropzone span { font-size: 13px; }

.extract-out {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.extract-out img {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--border);
}
.extract-palette {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  height: 60px;
}
.extract-swatch {
  border-radius: 10px;
  position: relative;
  border: 1px solid rgba(255,255,255,0.1);
}
.extract-swatch span {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9.5px;
  background: rgba(0,0,0,0.55);
  color: white;
  padding: 2px 5px;
  border-radius: 4px;
}

.wallpaper-sizes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}
.size-btn {
  padding: 12px 8px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-1);
  font-size: 12.5px;
  font-weight: 500;
  transition: all .2s var(--spring);
}
.size-btn:hover { transform: translateY(-2px); border-color: var(--border-strong); background: var(--surface-strong); }

/* ============= INSIGHTS ============= */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  overflow: hidden;
}
.kpi-card::before {
  content: '';
  position: absolute;
  top: -30px;
  inset-inline-end: -20px;
  width: 80px; height: 80px;
  background: radial-gradient(circle, var(--aurora-violet), transparent 70%);
  opacity: 0.18;
  filter: blur(12px);
}
.kpi-icon {
  font-size: 16px;
  color: var(--aurora-teal);
  margin-bottom: 4px;
}
.kpi-num {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 26px;
  font-weight: 600;
  color: var(--text-1);
  line-height: 1;
}
.kpi-lbl { font-size: 11px; color: var(--text-3); }

.insight-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 20px 18px;
  margin-bottom: 14px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.insight-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
  gap: 12px;
  flex-wrap: wrap;
}
.insight-head h3 {
  font-family: 'Frank Ruhl Libre', serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-1);
}
.insight-sub { font-size: 11.5px; color: var(--text-3); }

.activity-chart {
  width: 100%;
  height: 160px;
  display: block;
}

.favcolors {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.favcolor {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 6px;
  background: var(--bg-0);
  border-radius: 999px;
  border: 1px solid var(--border);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11.5px;
  color: var(--text-2);
}
.favcolor-sw {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.1);
}

.type-bars {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.type-row {
  display: grid;
  grid-template-columns: 70px 1fr 40px;
  gap: 12px;
  align-items: center;
}
.type-name {
  font-size: 12px;
  color: var(--text-2);
  text-transform: capitalize;
}
.type-bar {
  height: 8px;
  background: var(--bg-0);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.type-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--aurora-violet), var(--aurora-teal));
  border-radius: 999px;
  transition: width .6s var(--spring);
}
.type-count {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--text-1);
  text-align: center;
}

.settings-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: var(--bg-0);
  border-radius: 12px;
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-2);
}

/* ============= FAB ============= */
.fab {
  position: fixed;
  bottom: 22px;
  inset-inline-end: 22px;
  width: 60px; height: 60px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--aurora-violet), var(--aurora-pink));
  color: white;
  font-size: 20px;
  box-shadow: 0 12px 30px -8px rgba(123, 92, 250, 0.55), 0 0 50px -10px rgba(244, 114, 182, 0.4);
  z-index: 50;
  transition: all .25s var(--spring);
  animation: fabFloat 4s ease-in-out infinite;
}
.fab:hover { transform: scale(1.1) rotate(-15deg); }
.fab:active { transform: scale(0.92); }
@keyframes fabFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* ============= toast ============= */
.toast {
  position: fixed;
  bottom: 96px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface-strong);
  border: 1px solid var(--border-strong);
  color: var(--text-1);
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  backdrop-filter: blur(20px);
  box-shadow: 0 12px 30px -8px rgba(0,0,0,0.6);
  z-index: 100;
  opacity: 0;
  transition: opacity .3s var(--ease), transform .3s var(--spring);
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============= modal ============= */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 18px;
}
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 5, 26, 0.7);
  backdrop-filter: blur(8px);
  animation: fadeIn .25s var(--ease);
}
.modal-card {
  position: relative;
  max-width: 440px;
  width: 100%;
  background: linear-gradient(180deg, var(--surface-strong), var(--surface));
  border: 1px solid var(--border-strong);
  border-radius: 24px;
  padding: 28px 24px;
  text-align: center;
  animation: modalIn .35s var(--spring);
  box-shadow: 0 30px 60px -20px rgba(0,0,0,0.7);
  max-height: 90vh;
  overflow-y: auto;
}
.modal-card.narrow { max-width: 380px; text-align: right; }
.modal-card.narrow h3 { font-size: 19px; margin-bottom: 16px; }
.modal-close {
  position: absolute;
  top: 14px;
  inset-inline-end: 14px;
  width: 34px; height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 13px;
}
.modal-logo {
  width: 70px; height: 70px;
  margin: 0 auto 12px;
  display: block;
  filter: drop-shadow(0 6px 20px rgba(123, 92, 250, 0.55));
}
.modal-title { font-size: 26px; margin-bottom: 4px; }
.modal-sub { color: var(--text-3); margin-bottom: 18px; font-size: 13px; }
.modal-features {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg-0);
  padding: 16px;
  border-radius: 14px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--text-2);
}
.modal-features div { display: flex; align-items: center; gap: 10px; }
.modal-features i {
  width: 26px;
  text-align: center;
  color: var(--aurora-teal);
}
.modal-copy { font-size: 11px; color: var(--text-4); }

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.field span { font-size: 12px; color: var(--text-3); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ============= breakpoints ============= */
@media (min-width: 540px) {
  .app { padding: 0 24px; }
  .kpi-row { grid-template-columns: repeat(4, 1fr); }
  .view-tools { gap: 12px; }
}

@media (min-width: 720px) {
  .hero-content { padding: 42px 36px 32px; }
  .canvas { aspect-ratio: 16/9; }
  .library-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
}

@media (max-width: 380px) {
  .stat-num { font-size: 18px; }
  .hero-content { padding: 26px 20px 22px; }
  .tab span { display: none; }
  .tab i { font-size: 18px; }
  .seg-btn span { display: none; }
}

/* a11y */
:focus-visible {
  outline: 2px solid var(--aurora-teal);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
