:root {
  --bg: #050506;
  --surface: #0a0a0f;
  --panel: #0f0f14;
  --panel-2: #14141c;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #f8fafc;
  --muted: rgba(255, 255, 255, 0.52);
  --muted-dim: rgba(255, 255, 255, 0.34);
  --primary: #fbbf24;
  --primary-glow: rgba(251, 191, 36, 0.45);
  --primary-dim: rgba(251, 191, 36, 0.1);
  --primary-border: rgba(251, 191, 36, 0.38);
  --accent: #a78bfa;
  --accent-dim: rgba(167, 139, 250, 0.12);
  --radius: 14px;
  --sidebar: 340px;
  --header: 56px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.meshy-pro .stage {
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(167, 139, 250, 0.08), transparent 55%),
    radial-gradient(ellipse 60% 50% at 80% 100%, rgba(251, 191, 36, 0.06), transparent 50%),
    var(--surface);
}

/* Header */
.shell-header {
  flex-shrink: 0;
  height: var(--header);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(8, 8, 12, 0.94);
  backdrop-filter: blur(12px);
  z-index: 30;
}
.shell-header .logo { height: 26px; width: auto; }
.nav-pill {
  display: inline-flex;
  padding: 7px 14px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid transparent;
  transition: 0.15s;
}
.nav-pill:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.nav-pill.active {
  color: var(--text);
  border-color: rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.06);
}
.nav-pill.active.primary {
  border-color: var(--primary-border);
  background: var(--primary-dim);
  color: var(--primary);
}
.header-spacer { flex: 1; }

.alert-banner {
  flex-shrink: 0;
  padding: 10px 16px;
  font-size: 13px;
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.1);
  border-bottom: 1px solid rgba(239, 68, 68, 0.2);
}

/* Friendly plan / login gate (sidebar) */
.plan-gate {
  margin-bottom: 12px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  background: linear-gradient(145deg, rgba(167, 139, 250, 0.1), rgba(251, 191, 36, 0.06));
}
.plan-gate-inner {
  display: flex;
  gap: 12px;
  padding: 14px;
  align-items: flex-start;
}
.plan-gate-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-dim);
  border: 1px solid rgba(167, 139, 250, 0.25);
  color: var(--accent);
}
.plan-gate-icon svg { display: block; }
.plan-gate-body { flex: 1; min-width: 0; }
.plan-gate-title {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.plan-gate-text {
  margin: 0;
  font-size: 11px;
  line-height: 1.45;
  color: var(--muted);
}
.plan-gate-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 14px 14px;
}
.plan-gate-actions .btn-plan {
  flex: 1;
  min-width: 120px;
  padding: 9px 12px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: filter 0.15s, transform 0.1s;
}
.plan-gate-actions .btn-plan:hover { filter: brightness(1.08); }
.plan-gate-actions .btn-plan:active { transform: scale(0.98); }
.btn-plan-discord {
  background: #5865f2;
  color: #fff;
}
.btn-plan-discord:hover { color: #fff; }
.btn-plan-shop {
  background: var(--primary-dim);
  color: var(--primary);
  border: 1px solid var(--primary-border);
}
.btn-plan-shop:hover { color: var(--primary); }

.plan-gate--ready {
  background: linear-gradient(145deg, rgba(52, 211, 153, 0.08), rgba(167, 139, 250, 0.05));
  border-color: rgba(52, 211, 153, 0.22);
}
.plan-gate--ready .plan-gate-inner { padding: 10px 14px; align-items: center; }
.plan-gate--ready .plan-gate-icon {
  background: rgba(52, 211, 153, 0.12);
  border-color: rgba(52, 211, 153, 0.28);
  color: #34d399;
  width: 32px;
  height: 32px;
  border-radius: 8px;
}
.plan-gate--ready .plan-gate-title { margin: 0; font-size: 12px; font-weight: 600; }
.plan-gate--ready .plan-gate-text { font-size: 11px; }
.plan-gate-credits {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
}

.efm-itm-credits-hint {
  margin: 0 0 10px;
  font-size: 11px;
  line-height: 1.45;
  color: var(--muted);
  text-align: center;
}

.plan-gate--warn {
  background: linear-gradient(145deg, rgba(251, 191, 36, 0.1), rgba(167, 139, 250, 0.06));
  border-color: rgba(251, 191, 36, 0.28);
}
.plan-gate--warn .plan-gate-icon {
  background: var(--primary-dim);
  border-color: var(--primary-border);
  color: var(--primary);
}

.workspace {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

.stage {
  flex: 1;
  position: relative;
  min-width: 0;
  border-right: 1px solid var(--border);
}

/* Upload hero */
.hero-upload {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.dropzone-hero {
  position: relative;
  width: 100%;
  max-width: 640px;
  min-height: 420px;
  border-radius: calc(var(--radius) + 4px);
  border: 1px dashed var(--border-strong);
  background: rgba(0, 0, 0, 0.35);
  cursor: pointer;
  transition: 0.25s;
  overflow: hidden;
}
.dropzone-hero:hover, .dropzone-hero.drag {
  border-color: var(--primary-border);
  box-shadow: 0 0 40px rgba(251, 191, 36, 0.08);
}
.dropzone-inner {
  position: relative;
  z-index: 2;
  padding: 48px 32px;
  text-align: center;
}
.dropzone-glow {
  position: absolute;
  inset: -40%;
  background: radial-gradient(circle, var(--primary-glow) 0%, transparent 65%);
  opacity: 0.15;
  pointer-events: none;
}
.dropzone-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--primary-dim), var(--accent-dim));
  border: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
}
.dropzone-hero h2 {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.dropzone-hero p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}
.dropzone-hint {
  margin-top: 16px !important;
  font-size: 11px !important;
  color: var(--muted-dim) !important;
}
.hero-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #08080c;
  padding: 24px;
  z-index: 1;
}
.dropzone-hero.has-image .dropzone-inner {
  opacity: 0;
  pointer-events: none;
}
.dropzone-hero.has-image { border-style: solid; }

/* Sidebar image validation */
.validate-gate {
  margin-bottom: 10px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid rgba(251, 191, 36, 0.28);
  background: linear-gradient(145deg, rgba(251, 191, 36, 0.12), rgba(167, 139, 250, 0.06));
}
.validate-gate.is-ready {
  border-color: rgba(74, 222, 128, 0.35);
  background: linear-gradient(145deg, rgba(74, 222, 128, 0.1), rgba(251, 191, 36, 0.05));
}
.validate-gate-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.validate-gate-title {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.01em;
}
.validate-gate.is-ready .validate-gate-title {
  color: #4ade80;
}
.validate-gate-pct {
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  flex-shrink: 0;
}
.validate-gate.is-ready .validate-gate-pct {
  color: #4ade80;
}
.validate-gate-bar {
  height: 6px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin-bottom: 10px;
}
.validate-gate-fill {
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: linear-gradient(90deg, #b45309, #fbbf24, #fde68a);
  box-shadow: 0 0 14px rgba(251, 191, 36, 0.5);
  transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.validate-gate.is-ready .validate-gate-fill {
  background: linear-gradient(90deg, #16a34a, #4ade80);
  box-shadow: 0 0 12px rgba(74, 222, 128, 0.45);
}
.validate-gate-msg {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.45;
}
.validate-gate.is-ready .validate-gate-msg {
  color: #4ade80;
}
.validate-gate-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 5px;
}
.validate-gate-steps li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.28);
  transition: color 0.25s ease;
}
.validate-gate-steps li.active { color: var(--text); }
.validate-gate-steps li.done { color: rgba(255, 255, 255, 0.55); }
.validate-gate-steps li.active .gen-step-dot {
  background: var(--primary);
  border-color: rgba(251, 191, 36, 0.5);
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.5);
  animation: gen-pulse 1.2s ease-in-out infinite;
}
.validate-gate-steps li.done .gen-step-dot {
  background: #4ade80;
  border-color: rgba(74, 222, 128, 0.4);
  box-shadow: none;
}

/* Generating */
.hero-generating {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: rgba(5, 5, 6, 0.92);
  backdrop-filter: blur(8px);
}
.gen-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 40px;
  width: min(560px, 100%);
  align-items: center;
}
.gen-source .gen-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-dim);
  margin: 0 0 8px;
}
.gen-thumb {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #0a0a0d;
}
.gen-progress-wrap {
  width: 100%;
  margin-bottom: 16px;
}
.gen-progress-track {
  height: 6px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.04);
}
.gen-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: linear-gradient(90deg, #b45309, #fbbf24, #fde68a);
  box-shadow: 0 0 18px rgba(251, 191, 36, 0.45);
  transition: width 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}
.gen-progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-top: 12px;
}
.gen-msg {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
}
.gen-pct {
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 12px;
  font-weight: 500;
  color: var(--primary);
  flex-shrink: 0;
}
.gen-steps {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.gen-steps li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.28);
  transition: color 0.25s ease;
}
.gen-step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  transition: all 0.25s ease;
}
.gen-steps li.active {
  color: var(--text);
}
.gen-steps li.active .gen-step-dot {
  background: var(--primary);
  border-color: rgba(251, 191, 36, 0.5);
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.5);
  animation: gen-pulse 1.2s ease-in-out infinite;
}
.gen-steps li.done {
  color: rgba(255, 255, 255, 0.55);
}
.gen-steps li.done .gen-step-dot {
  background: #4ade80;
  border-color: rgba(74, 222, 128, 0.4);
  box-shadow: none;
}
@keyframes gen-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* Viewer */
.hero-viewer {
  position: absolute;
  inset: 0;
  z-index: 5;
}
.pane-viewer {
  position: absolute;
  inset: 0;
}
.pane-viewer canvas { display: block; width: 100% !important; height: 100% !important; }

.viewer-toolbar {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(10, 10, 14, 0.85);
  border: 1px solid var(--border);
  backdrop-filter: blur(10px);
}
.vt-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: 0.15s;
}
.vt-btn:hover { color: var(--text); background: rgba(255,255,255,0.06); }
.vt-btn.active {
  color: var(--primary);
  background: var(--primary-dim);
}
.vt-sep {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 2px;
}

.compare-chip {
  position: absolute;
  bottom: 14px;
  left: 14px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 6px;
  border-radius: 12px;
  background: rgba(10, 10, 14, 0.88);
  border: 1px solid var(--border);
  backdrop-filter: blur(10px);
}
.compare-chip img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.compare-chip span {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-dim);
}

.model-stats {
  position: absolute;
  bottom: 14px;
  right: 14px;
  z-index: 10;
  display: flex;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(10, 10, 14, 0.88);
  border: 1px solid var(--border);
  font-family: ui-monospace, monospace;
  font-size: 10px;
  color: var(--muted-dim);
}

/* Sidebar */
.sidebar {
  width: var(--sidebar);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  overflow: hidden;
}
.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.tab {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--muted-dim);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 12px;
  cursor: pointer;
  transition: 0.15s;
  border-bottom: 2px solid transparent;
}
.tab:hover:not(:disabled) { color: var(--muted); }
.tab.active {
  color: var(--text);
  border-bottom-color: var(--primary);
}
.tab:disabled { opacity: 0.35; cursor: not-allowed; }

.tab-pane {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.sidebar-head {
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-head h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}
.sidebar-head p {
  margin: 4px 0 0;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.45;
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
}

.section { margin-bottom: 16px; }
.section-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-dim);
  margin: 0 0 10px;
}
.section-divider {
  height: 1px;
  background: var(--border);
  margin: 14px 0;
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.preset {
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.3);
  color: var(--muted);
  border-radius: 10px;
  padding: 10px 6px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.15s;
}
.preset:hover { border-color: var(--border-strong); color: var(--text); }
.preset.active {
  border-color: var(--primary-border);
  background: var(--primary-dim);
  color: var(--primary);
}
.preset-desc {
  margin: 8px 0 0;
  font-size: 11px;
  color: var(--muted-dim);
}

.section-hint {
  margin: -4px 0 10px;
  font-size: 11px;
  line-height: 1.45;
  color: var(--muted-dim);
}

.section-sub {
  margin: 0 0 8px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-dim);
}

.style-prompt {
  width: 100%;
  min-height: 72px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
  resize: vertical;
  font-family: inherit;
}

.style-prompt:focus {
  outline: none;
  border-color: var(--primary-border);
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.1);
}

.style-prompt:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.char-count {
  margin: 4px 0 12px;
  font-size: 10px;
  text-align: right;
  color: var(--muted-dim);
}

.style-preset-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.style-chip {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.15s;
}

.style-chip:hover {
  border-color: var(--border-strong);
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.style-chip.active {
  border-color: var(--primary-border);
  background: var(--primary-dim);
  color: var(--primary);
}

#style-section.is-disabled .style-prompt,
#style-section.is-disabled .style-chip {
  opacity: 0.45;
  pointer-events: none;
}

/* style section stays active — retexture pipeline handles prompts */

.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  cursor: pointer;
  font-size: 12px;
  color: var(--muted);
}
.toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}
.share-community-toggle {
  margin-bottom: 6px;
}
.share-community-hint {
  margin: 0 0 8px;
  font-size: 11px;
  line-height: 1.4;
}
.toggle-note {
  font-style: normal;
  color: var(--primary);
  font-size: 11px;
}

.tip-list { margin: 0; padding: 0; list-style: none; }
.tip-list li {
  font-size: 12px;
  color: var(--muted);
  padding: 5px 0 5px 14px;
  position: relative;
}
.tip-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 11px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.8;
}

.field { display: block; margin-bottom: 12px; }
.field > span {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-dim);
  margin-bottom: 5px;
}
.field input[type=text],
.field input[type=number],
.field select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.4);
  color: var(--text);
  font-size: 13px;
  outline: none;
}
.field input:focus, .field select:focus { border-color: var(--primary-border); }
.field input[type=range] { width: 100%; accent-color: var(--primary); }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.hint { font-size: 11px; color: var(--muted-dim); margin: 0 0 10px; line-height: 1.45; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  transition: 0.15s;
  position: relative;
  overflow: hidden;
}
.btn-lg { width: auto; padding: 12px 24px; }
.btn-primary {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #111;
  box-shadow: 0 4px 20px rgba(251, 191, 36, 0.25);
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.05); transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
}
.btn-import {
  background: var(--primary-dim);
  border: 1px solid var(--primary-border);
  color: var(--primary);
}
.btn-stack { display: flex; flex-direction: column; gap: 8px; }

.sidebar-foot {
  flex-shrink: 0;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border);
}

.status-line { font-size: 11px; margin: 8px 0 0; color: var(--muted-dim); }
.status-line.ok { color: #4ade80; }
.status-line.err { color: #f87171; }
.mono {
  font-family: ui-monospace, monospace;
  font-size: 11px;
  color: var(--muted-dim);
}
.hidden { display: none !important; }

.library-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.library-head .section-title {
  margin: 0;
}
.library-all-link {
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  white-space: nowrap;
}
.library-all-link:hover {
  text-decoration: underline;
}

.library-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
  max-height: 220px;
  overflow-y: auto;
}
.library-row {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
}
.library-thumb {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: #0a0a10;
}
.library-meta { flex: 1; min-width: 0; }
.library-name {
  margin: 0;
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.library-badge {
  display: inline-block;
  margin-top: 4px;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 4px;
}
.library-badge.public {
  color: #4ade80;
  background: rgba(74, 222, 128, 0.12);
}
.library-badge.private {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
}
.library-actions { margin-top: 6px; }
.btn-sm {
  padding: 4px 10px;
  font-size: 11px;
  min-height: 0;
}

@media (max-width: 900px) {
  .workspace { flex-direction: column; }
  .sidebar { width: 100%; max-height: 44vh; }
  .gen-layout { grid-template-columns: 1fr; }
  .gen-source { display: none; }
}
