/* Vectorizer (Altay Studio) -- single-page workspace */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=Syne:wght@500;600;700;800&display=swap');

:root {
  --color-bg-primary: #0a0e1a;
  --color-bg-secondary: #111827;
  --color-bg-card: #0f1729;
  --color-bg-overlay: rgba(10, 14, 26, 0.85);
  --color-neon-cyan: #00e5ff;
  --color-neon-magenta: #ff2d95;
  --color-neon-green: #39ff14;
  --color-neon-purple: #b44dff;
  --color-neon-yellow: #ffe14d;
  --color-text-primary: #f0f0f0;
  --color-text-secondary: #8899aa;
  --color-text-heading: #ffffff;
  --glow-cyan: 0 0 10px #00e5ff, 0 0 30px rgba(0, 229, 255, 0.3);
  --glow-magenta: 0 0 10px #ff2d95, 0 0 30px rgba(255, 45, 149, 0.3);
  --glow-purple: 0 0 10px #b44dff, 0 0 30px rgba(180, 77, 255, 0.3);
  --radius-card: 12px;
  --radius-button: 24px;
  --font-heading: 'Syne', system-ui, sans-serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
  --sidebar-w: 340px;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background:
    radial-gradient(circle at 15% -10%, rgba(0, 229, 255, 0.08) 0%, transparent 45%),
    radial-gradient(circle at 90% 0%, rgba(180, 77, 255, 0.10) 0%, transparent 40%),
    var(--color-bg-primary);
  color: var(--color-text-primary);
  line-height: 1.5;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font-heading);
  color: var(--color-text-heading);
  letter-spacing: 1px;
  margin: 0;
}

.engine-badge {
  font-family: var(--font-heading);
  font-size: 0.58rem; font-weight: 700;
  padding: 0.25rem 0.6rem; border-radius: 16px;
  text-transform: uppercase; letter-spacing: 1.5px;
  color: var(--color-neon-purple);
  background: rgba(180, 77, 255, 0.12);
  border: 1.5px solid var(--color-neon-purple);
  box-shadow: var(--glow-purple);
  vertical-align: middle;
}

.muted { color: var(--color-neon-cyan); font-size: 0.75rem; }
.muted-inline { color: var(--color-text-secondary); }

/* ---- Landing (empty) ---- */
.landing {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.landing-inner {
  width: 100%;
  max-width: 560px;
  text-align: center;
}
.brand-kicker {
  margin: 0 0 0.55rem;
  font-family: var(--font-heading);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-neon-cyan);
}
.landing-inner h1 {
  font-size: clamp(2.1rem, 5vw, 2.8rem);
  margin-bottom: 0.6rem;
  text-shadow: 0 0 18px rgba(0, 229, 255, 0.25);
}
.landing-sub {
  color: var(--color-text-secondary);
  margin: 0 0 1.75rem;
  font-size: 0.95rem;
}

.dropzone {
  border: 2px dashed rgba(0, 229, 255, 0.5);
  border-radius: var(--radius-card);
  padding: 3rem 2rem;
  text-align: center;
  transition: all 0.25s ease;
  cursor: pointer;
  background: rgba(0, 229, 255, 0.03);
}
.dropzone:hover, .dropzone.dragging {
  border-color: var(--color-neon-cyan);
  background: rgba(0, 229, 255, 0.08);
  box-shadow: var(--glow-cyan);
}
.dropzone-label {
  display: flex; flex-direction: column; align-items: center; gap: 0.85rem;
  cursor: pointer; color: var(--color-text-secondary);
}
.dropzone-label svg {
  color: var(--color-neon-cyan);
  filter: drop-shadow(0 0 8px rgba(0, 229, 255, 0.5));
}
.file-types { font-size: 0.8rem; opacity: 0.7; margin: 0; }

/* ---- Workspace (single page) ---- */
.workspace {
  height: 100dvh;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.workspace-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  background: var(--color-bg-secondary);
  border-bottom: 1px solid rgba(0, 229, 255, 0.15);
  flex-wrap: wrap;
}
.workspace-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}
.workspace-brand h1 { font-size: 1.15rem; white-space: nowrap; }
.file-chip {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 280px;
}
.workspace-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-primary, .btn-secondary {
  padding: 0.55rem 1rem;
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 0.68rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  border-radius: var(--radius-button);
  cursor: pointer;
  transition: all 0.25s ease;
  border: 1.5px solid;
  color: var(--color-text-primary);
  background: transparent;
}
.btn-primary {
  background: rgba(0, 229, 255, 0.18);
  border-color: var(--color-neon-cyan);
}
.btn-primary:hover:not(:disabled) {
  background: rgba(0, 229, 255, 0.32);
  box-shadow: var(--glow-cyan);
}
.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.22);
}
.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.4);
}
.btn-primary:disabled, .btn-secondary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn-file { display: inline-flex; align-items: center; cursor: pointer; }

.workspace-body {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--color-bg-secondary);
  border-right: 1px solid rgba(0, 229, 255, 0.12);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-height: 0;
  height: 100%;
}

.panel {
  background: var(--color-bg-card);
  border: 1px solid rgba(0, 229, 255, 0.18);
  border-radius: var(--radius-card);
  padding: 0.9rem;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.panel-head h2 { font-size: 0.78rem; }
.panel-hint {
  font-size: 0.7rem;
  color: var(--color-text-secondary);
  margin: 0 0 0.7rem;
  line-height: 1.4;
}
.link-btn {
  background: none;
  border: none;
  color: var(--color-neon-yellow);
  font-size: 0.72rem;
  cursor: pointer;
  padding: 0;
}

.source-thumb {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
}
.source-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* palettes */
.palette-rows { display: flex; flex-direction: column; gap: 0.35rem; }
.palette-row {
  display: flex; align-items: center; gap: 0.75rem;
  width: 100%; text-align: left;
  padding: 0.45rem 0.6rem; border-radius: 8px; cursor: pointer;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--color-text-primary); font-size: 0.85rem;
  transition: border-color 0.15s, background 0.15s;
}
.palette-row:hover {
  border-color: rgba(0, 229, 255, 0.35);
  background: rgba(0, 229, 255, 0.06);
}
.palette-row.selected {
  border-color: var(--color-neon-cyan);
  background: rgba(0, 229, 255, 0.12);
  box-shadow: var(--glow-cyan);
}
.palette-row .n {
  width: 1.4rem; font-weight: 700;
  color: var(--color-neon-cyan);
  font-variant-numeric: tabular-nums;
}
.palette-swatches { display: flex; flex-wrap: wrap; gap: 3px; flex: 1; }
.palette-swatches span {
  width: 18px; height: 18px; border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  display: inline-block;
}
.palette-loading {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  padding: 0.4rem 0;
}

.ctrl-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  margin-bottom: 0.65rem;
}
.ctrl-model {
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  color: #fff;
  border-radius: 8px;
  padding: 0.45rem 0.5rem;
  font-size: 0.72rem;
  text-align: left;
  cursor: pointer;
  line-height: 1.25;
}
.ctrl-model strong { display: block; font-size: 0.8rem; }
.ctrl-model.selected {
  border-color: var(--color-neon-cyan);
  box-shadow: 0 0 0 1px rgba(0,229,255,0.35);
  background: rgba(0,229,255,0.08);
}
.ctrl-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.85);
}
.ctrl-row select {
  flex: 0 0 55%;
  max-width: 58%;
  background: #12151c;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 6px;
  padding: 0.28rem 0.4rem;
  font-size: 0.75rem;
}
.ctrl-tabs { display: flex; gap: 0.35rem; margin-bottom: 0.55rem; }
.ctrl-tab {
  flex: 1;
  border: 1px solid rgba(255,255,255,0.12);
  background: transparent;
  color: rgba(255,255,255,0.7);
  border-radius: 6px;
  padding: 0.3rem;
  font-size: 0.72rem;
  cursor: pointer;
}
.ctrl-tab.active {
  color: #fff;
  border-color: var(--color-neon-cyan);
  background: rgba(0,229,255,0.1);
}
.ctrl-apply { width: 100%; margin-top: 0.35rem; font-size: 0.78rem; }

/* output colors */
.color-rows {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-height: 280px;
  overflow-y: auto;
}
.color-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
}
.color-row.transparent { opacity: 0.45; }
.color-swatch {
  width: 24px; height: 24px; border-radius: 5px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  cursor: pointer; position: relative; padding: 0;
}
.color-swatch:hover { border-color: var(--color-neon-cyan); }
.color-swatch input[type=color] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer;
}
.color-row .meta { flex: 1; font-size: 0.72rem; min-width: 0; }
.color-row .meta .pct {
  color: var(--color-neon-cyan);
  font-weight: 600;
  float: right;
}
.color-row .arrow { color: var(--color-neon-purple); }
.tgl {
  display: flex; align-items: center; gap: 0.3rem;
  font-size: 0.68rem; color: var(--color-text-secondary); cursor: pointer;
  white-space: nowrap;
}

/* preview pane */
.preview-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  height: 100%;
}
.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.1rem;
  background: var(--color-bg-secondary);
  border-bottom: 1px solid rgba(0, 229, 255, 0.12);
}
.preview-toolbar h2 { font-size: 0.9rem; }
.preview-tools { display: flex; align-items: center; gap: 0.45rem; }

.icon-btn {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  width: 34px; height: 34px;
  cursor: pointer; font-size: 1rem;
  transition: all 0.2s;
}
.icon-btn:hover {
  background: rgba(0, 229, 255, 0.15);
  border-color: var(--color-neon-cyan);
}
.icon-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.bg-picker {
  position: relative;
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 0.35rem;
  cursor: pointer;
}
.bg-picker .swatch {
  width: 20px; height: 20px; border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  display: block;
}
.bg-picker input[type=color] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer;
}

.zoom-tools {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 0.1rem;
}
.zoom-label {
  min-width: 3.2rem;
  border: none;
  background: transparent;
  color: var(--color-neon-cyan);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.25rem 0.35rem;
}
.zoom-label:hover { color: #fff; }

.preview-area {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: contain;
  min-height: 360px;
}
.preview-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  font-size: 0.9rem;
  pointer-events: none;
  z-index: 1;
}
.preview-stage {
  display: inline-block;
  cursor: grab;
  touch-action: none;
}
.preview-stage:active { cursor: grabbing; }
.preview-box {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-card);
  padding: 2rem;
  pointer-events: none;
}
.preview-box svg {
  max-width: min(70vh, 100%);
  max-height: 70vh;
  width: auto;
  height: auto;
  display: block;
}
.preview-status {
  padding: 0.5rem 1.1rem;
  font-size: 0.72rem;
  color: var(--color-text-secondary);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.2);
  min-height: 2rem;
}

/* overlay / toast */
.spinner {
  width: 24px; height: 24px;
  border: 3px solid rgba(0, 229, 255, 0.2);
  border-top-color: var(--color-neon-cyan);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
.spinner.large { width: 44px; height: 44px; border-width: 4px; }
@keyframes spin { to { transform: rotate(360deg); } }

.progress-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 8, 14, 0.72);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1100;
  padding: 1.25rem;
}
.progress-overlay[hidden] { display: none !important; }

.progress-card {
  width: min(420px, 100%);
  background: var(--color-bg-card);
  border: 1px solid rgba(0, 229, 255, 0.35);
  border-radius: 14px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4), var(--glow-cyan);
  padding: 1.35rem 1.4rem 1.2rem;
  color: #fff;
}
.progress-title {
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  margin-bottom: 0.35rem;
}
.progress-stage {
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.72);
  margin-bottom: 1rem;
  min-height: 1.2em;
}
.progress-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin-bottom: 0.65rem;
}
.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #00e5ff, #7c5cff 55%, #39ff14);
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.45);
  transition: width 0.25s ease-out;
}
.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.65);
  font-variant-numeric: tabular-nums;
}
.progress-hint {
  margin: 0.85rem 0 0;
  font-size: 0.78rem;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.55);
}
.progress-hint:empty { display: none; }

.workspace.is-busy .palette-row,
.workspace.is-busy .color-row {
  pointer-events: none;
  opacity: 0.55;
}

.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(200%);
  background: var(--color-bg-card);
  color: #fff;
  padding: 0.8rem 1.5rem;
  border-radius: 8px;
  transition: transform 0.3s;
  z-index: 1200;
  border: 1px solid var(--color-neon-cyan);
  box-shadow: var(--glow-cyan);
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.success {
  border-color: var(--color-neon-green);
  box-shadow: 0 0 10px var(--color-neon-green), 0 0 30px rgba(57, 255, 20, 0.3);
}
.toast.error {
  border-color: var(--color-neon-magenta);
  box-shadow: var(--glow-magenta);
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--color-bg-primary); }
::-webkit-scrollbar-thumb { background: rgba(0, 229, 255, 0.3); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 229, 255, 0.5); }

@media (max-width: 900px) {
  .workspace-body { flex-direction: column; }
  .sidebar {
    width: 100%;
    max-height: 45vh;
    border-right: none;
    border-bottom: 1px solid rgba(0, 229, 255, 0.12);
  }
  .preview-area { min-height: 280px; }
}
