:root {
  --accent: #e7ff52;
  --bg: #0a0a0a;
  --bg-1: #111111;
  --bg-2: #161616;
  --bg-3: #1c1c1c;
  --line: #242424;
  --line-2: #2e2e2e;
  --text: #f4f4f0;
  --text-dim: #a8a8a0;
  --text-muted: #6a6a64;
  --danger: #ff6b4d;

  --font-display: "Geist", "Manrope", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: "Geist", "Noto Sans TC", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;

  --pad-card: 18px;
  --gap-grid: 28px;
}

[data-density="spacious"] {
  --pad-card: 26px;
  --gap-grid: 40px;
}
[data-density="compact"] {
  --pad-card: 12px;
  --gap-grid: 16px;
}

* { box-sizing: border-box; }
html, body, #root { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.005em;
}
button { font-family: inherit; cursor: pointer; }
::selection { background: var(--accent); color: #000; }

/* ---------------- Topbar ---------------- */
.tbar {
  height: 52px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 30;
}
.tbar-left, .tbar-right { display: flex; align-items: center; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 8px; }
.brand-mark {
  color: var(--accent);
  font-size: 16px;
  display: inline-block;
  transform: translateY(-1px);
}
.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 16px;
}
.tbar-sep { width: 1px; height: 18px; background: var(--line); }
.tbar-crumb { color: var(--text-dim); font-size: 13px; }
.tbar-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-dim);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tbar-pill-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}
.tbar-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--bg-3);
  border: 1px solid var(--line);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--text);
  font-family: var(--font-mono);
}

/* ---------------- Hero (input phase) ---------------- */
.hero { min-height: 100vh; }
.hero-inner {
  max-width: 920px;
  margin: 0 auto;
  padding: 80px 32px 120px;
}
.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  text-transform: uppercase;
  display: inline-flex; align-items: center; gap: 8px;
  margin-bottom: 28px;
}
.hero-eyebrow .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}
.hero-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 56px;
  line-height: 1.05;
  letter-spacing: -0.035em;
  margin: 0 0 20px;
  text-wrap: balance;
}
.hero-accent { color: var(--accent); }
.hero-sub {
  color: var(--text-dim);
  font-size: 16px;
  max-width: 580px;
  margin: 0 0 40px;
  line-height: 1.6;
}

.paste-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-1);
  overflow: hidden;
}
.paste-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
}
.paste-tabs { display: flex; gap: 4px; }
.paste-tab {
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  font-size: 12px;
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 999px;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all 0.12s;
}
.paste-tab:hover { color: var(--text); }
.paste-tab-on {
  background: var(--bg-3);
  color: var(--text);
  border-color: var(--line-2);
}
.paste-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}
.paste-area {
  width: 100%;
  background: transparent;
  border: 0;
  outline: none;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.65;
  padding: 22px 20px;
  resize: none;
}
.paste-area::placeholder { color: var(--text-muted); }
.paste-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
}
.paste-hints {
  display: flex; align-items: center; gap: 8px;
  color: var(--text-muted);
  font-size: 12px;
}
.kbd {
  display: inline-flex;
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 6px;
  border: 1px solid var(--line-2);
  border-radius: 4px;
  background: var(--bg-2);
  color: var(--text-dim);
}
.paste-divider { color: var(--line-2); }
.btn-primary {
  background: var(--accent);
  color: #0a0a0a;
  border: 0;
  border-radius: 999px;
  padding: 11px 20px;
  font-weight: 600;
  font-size: 14px;
  display: inline-flex; align-items: center; gap: 8px;
  letter-spacing: -0.01em;
  transition: transform .12s ease, filter .12s ease;
}
.btn-primary:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn-arrow {
  display: inline-block;
  transition: transform .15s ease;
}
.btn-primary:hover .btn-arrow { transform: translateX(3px); }

.hero-platforms {
  margin-top: 28px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.hp-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-1);
}
.hp-chip-key {
  font-family: var(--font-mono);
  font-size: 10px;
  background: var(--bg-3);
  border: 1px solid var(--line-2);
  border-radius: 4px;
  padding: 2px 6px;
  color: var(--accent);
}
.hp-chip-name { font-size: 13px; }
.hp-chip-spec { font-size: 11px; color: var(--text-muted); margin-left: auto; font-family: var(--font-mono); }

/* ---------------- Workspace ---------------- */
.ws { display: flex; flex-direction: column; min-height: 100vh; }

.src-bar {
  border-bottom: 1px solid var(--line);
  background: var(--bg-1);
  position: sticky; top: 52px; z-index: 20;
}
.src-bar-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  padding: 14px 20px 12px;
  align-items: center;
}
.src-favicon {
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--bg-3); border: 1px solid var(--line-2);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--accent); font-size: 14px;
}
.src-meta { min-width: 0; }
.src-row1 { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.src-domain { font-family: var(--font-mono); color: var(--accent); }
.src-divider { color: var(--text-muted); }
.src-title {
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 540px;
}
.src-row2 {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: 2px;
}
.src-actions { display: flex; gap: 8px; }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-ghost:hover { border-color: var(--line-2); background: var(--bg-2); }
.btn-icon { color: var(--text-dim); }

.src-progress {
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px 12px;
}
.sp-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}
.sp-track { flex: 1; height: 2px; background: var(--bg-3); border-radius: 2px; overflow: hidden; }
.sp-bar { height: 100%; background: var(--accent); transition: width .4s ease; }

.ws-body {
  display: grid;
  grid-template-columns: 280px 1fr;
  flex: 1;
}

/* Rail */
.rail {
  border-right: 1px solid var(--line);
  background: var(--bg-1);
  padding: 18px 12px;
  position: sticky; top: 124px; align-self: start;
  height: calc(100vh - 124px);
  overflow: auto;
  display: flex; flex-direction: column;
}
.rail-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 6px 12px;
}
.rail-head-label {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--text-muted); letter-spacing: 0.12em;
  text-transform: uppercase;
}
.rail-head-count { font-family: var(--font-mono); font-size: 11px; color: var(--text-dim); }
.rail-list { display: flex; flex-direction: column; gap: 4px; }
.rail-row {
  display: grid;
  grid-template-columns: 36px 1fr auto auto;
  align-items: center; gap: 10px;
  padding: 10px 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  text-align: left;
  color: var(--text);
}
.rail-row:hover { background: var(--bg-2); }
.rail-row.on { background: var(--bg-2); border-color: var(--line); }
.rail-chip {
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--bg-3); border: 1px solid var(--line-2);
  font-family: var(--font-mono); font-size: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-dim);
}
.rail-row.on .rail-chip { color: var(--accent); border-color: var(--accent); }
.rail-name { display: flex; flex-direction: column; min-width: 0; }
.rail-name-1 { font-size: 13px; }
.rail-name-2 { font-size: 10px; color: var(--text-muted); font-family: var(--font-mono); }
.rail-status { width: 8px; }
.rail-dot { display: block; width: 6px; height: 6px; border-radius: 50%; }
.rail-dot-load { background: var(--accent); animation: pulse 0.9s infinite ease-in-out; }
.rail-dot-ok { background: var(--accent); box-shadow: 0 0 6px var(--accent); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

.switch {
  width: 32px; height: 18px;
  border-radius: 999px;
  background: var(--bg-3);
  border: 1px solid var(--line-2);
  position: relative;
  transition: background .18s ease, border-color .18s ease;
}
.switch.on {
  background: var(--accent);
  border-color: var(--accent);
}
.switch-thumb {
  position: absolute; top: 1px; left: 1px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #f4f4f0;
  transition: transform .18s ease, background .18s ease;
}
.switch.on .switch-thumb { transform: translateX(14px); background: #0a0a0a; }

.rail-foot {
  margin-top: auto;
  padding: 14px 10px 4px;
  border-top: 1px solid var(--line);
}
.rail-foot-row {
  display: flex; justify-content: space-between;
  font-size: 12px; padding: 4px 0;
}
.rail-foot-label { color: var(--text-muted); }
.rail-foot-val { color: var(--text); }
.rail-foot-tip {
  margin-top: 8px;
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Preview area */
.preview-area { padding: var(--gap-grid); overflow: auto; }
.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: var(--gap-grid);
  align-items: start;
}
.empty {
  grid-column: 1 / -1;
  height: 240px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--text-muted);
  border: 1px dashed var(--line-2);
  border-radius: var(--radius-lg);
}
.empty-mark { font-size: 24px; margin-bottom: 6px; }

/* Preview card */
.pc {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-1);
  overflow: hidden;
}
.pc-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
}
.pc-head-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pc-chip {
  font-family: var(--font-mono); font-size: 10px;
  padding: 3px 7px; border-radius: 4px;
  background: var(--bg-3); border: 1px solid var(--line-2);
  color: var(--accent);
}
.pc-name { font-size: 13px; }
.pc-spec { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); }
.pc-head-right { display: flex; align-items: center; gap: 6px; }
.pc-vlabel { font-family: var(--font-mono); font-size: 10px; color: var(--text-muted); margin-right: 4px; }
.pc-btn {
  width: 26px; height: 26px;
  border-radius: 6px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-dim);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px;
}
.pc-btn:hover { background: var(--bg-3); color: var(--text); }
.pc-stage {
  padding: var(--pad-card);
  background:
    radial-gradient(circle at 1px 1px, var(--line) 1px, transparent 1px) 0 0 / 14px 14px,
    var(--bg-1);
  display: flex; justify-content: center;
  min-height: 200px;
}
.pc-stage-inner {
  width: 100%;
  max-width: var(--card-w, 480px);
  position: relative;
}
.pc-idle {
  color: var(--text-muted);
  text-align: center;
  padding: 60px 0;
  font-family: var(--font-mono);
  font-size: 12px;
}

/* Loading shimmer */
.shimmer {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius);
  position: relative;
  background: var(--bg-2);
  border: 1px solid var(--line);
  overflow: hidden;
}
.shimmer-bg {
  position: absolute; inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,0.04) 50%, transparent 70%);
  background-size: 200% 100%;
  animation: shim 1.4s linear infinite;
}
@keyframes shim { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.shimmer-content {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px;
}
.shimmer-spinner {
  width: 22px; height: 22px;
  border: 2px solid var(--line-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.shimmer-step {
  font-family: var(--font-mono); font-size: 12px; color: var(--text);
}
.shimmer-meta { font-family: var(--font-mono); font-size: 10px; color: var(--text-muted); }

/* ============================================================ */
/* Platform-specific styles                                     */
/* ============================================================ */

/* ----- Instagram ----- */
.ig-frame { aspect-ratio: 1/1; border-radius: 12px; overflow: hidden; position: relative; background: #1a1a1a; }
.ig-v0 { color: #fff; }
.ig-hero-img { width: 100%; height: 100%; display: block; }
.ig-overlay {
  position: absolute; inset: auto 0 0 0;
  padding: 22px 22px 22px;
  background: linear-gradient(to top, rgba(0,0,0,0.78), rgba(0,0,0,0));
}
.ig-eyebrow {
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.18em; color: #f4f4f0;
  text-transform: uppercase; margin-bottom: 6px;
  opacity: 0.85;
}
.ig-eyebrow-dark { color: #0a0a0a; opacity: 1; }
.ig-head {
  font-family: var(--font-display);
  font-size: 26px; font-weight: 700;
  letter-spacing: -0.02em; line-height: 1.08;
  color: #fff;
  min-height: 1.08em;
}
.ig-head-dark { color: #0a0a0a; }
.ig-sub {
  font-size: 14px; margin-top: 6px; color: rgba(255,255,255,0.85);
  min-height: 1.2em;
}
.ig-sub-dark { color: rgba(10,10,10,0.78); }
.ig-pill {
  position: absolute; top: 16px; right: 16px;
  background: var(--accent); color: #0a0a0a;
  font-family: var(--font-mono); font-size: 10px;
  padding: 6px 10px; border-radius: 999px;
  letter-spacing: 0.06em;
}

.ig-v1 { display: grid; grid-template-rows: 56% 44%; background: var(--accent); }
.ig-img-half { overflow: hidden; }
.ig-text-half {
  padding: 16px 18px 18px;
  display: flex; flex-direction: column; gap: 6px;
}
.ig-cap-line {
  font-size: 11px; line-height: 1.5;
  color: rgba(10,10,10,0.7);
  margin-top: auto;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}

.ig-v2 { background: #f4f4f0; color: #0a0a0a; padding: 16px; }
.ig-v2-head-row {
  display: flex; justify-content: space-between; align-items: baseline;
  font-family: var(--font-mono); font-size: 11px; color: #6a6a64;
  margin-bottom: 12px;
}
.ig-v2-num { font-size: 22px; color: #0a0a0a; font-weight: 600; }
.ig-v2-stage {
  border: 1px solid #d8d8d2;
  border-radius: 8px; overflow: hidden;
  aspect-ratio: 4/3;
}
.ig-v2-img { width: 100%; height: 100%; }
.ig-v2-foot {
  margin-top: 14px;
  display: flex; flex-direction: column; gap: 8px;
}
.ig-v2-head {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 600;
  letter-spacing: -0.02em; line-height: 1.1;
  min-height: 1.1em;
}
.ig-v2-tag {
  font-family: var(--font-mono); font-size: 11px; color: #6a6a64;
}

/* ----- Facebook ----- */
.fb-frame {
  background: #ffffff; color: #050505;
  border-radius: 8px;
  overflow: hidden;
  font-family: var(--font-body);
  border: 1px solid #d8d8d2;
}
.fb-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 12px 14px 8px;
}
.fb-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, #ec4899, #a855f7);
  color: #fff; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-family: var(--font-display);
}
.fb-page { font-weight: 600; font-size: 14px; }
.fb-time { font-size: 11px; color: #65676b; display: flex; align-items: center; gap: 4px; }
.fb-globe { font-size: 9px; }
.fb-dots { color: #65676b; font-size: 18px; padding: 0 4px; }
.fb-body { padding: 0 14px 10px; }
.fb-title { font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.fb-body-line { font-size: 13px; line-height: 1.5; white-space: pre-wrap; }
.fb-body-long { font-size: 13px; }
.fb-image { position: relative; }
.fb-hero { width: 100%; aspect-ratio: 16/10; display: block; }
.fb-image-narrow .fb-hero { aspect-ratio: 16/8; }
.fb-link-strip {
  background: #f0f2f5;
  padding: 10px 14px;
  border-top: 1px solid #e4e6eb;
}
.fb-link-domain {
  font-family: var(--font-mono); font-size: 10px;
  color: #65676b; letter-spacing: 0.05em;
  text-transform: uppercase;
}
.fb-link-title { font-weight: 700; font-size: 14px; margin-top: 2px; line-height: 1.3; }
.fb-link-cta { font-size: 12px; color: #65676b; margin-top: 4px; }
.fb-link-card {
  display: grid; grid-template-columns: 130px 1fr;
  border-top: 1px solid #e4e6eb;
  background: #f0f2f5;
}
.fb-link-img { width: 100%; height: 100%; aspect-ratio: 1/1; }
.fb-link-info { padding: 12px; display: flex; flex-direction: column; justify-content: center; }
.fb-actions {
  border-top: 1px solid #e4e6eb;
  padding: 8px 14px 12px;
}
.fb-react {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: #65676b;
  padding-bottom: 8px;
  border-bottom: 1px solid #e4e6eb;
  margin-bottom: 6px;
}
.fb-emoji-stack { display: inline-flex; }
.fb-emoji-stack span:nth-child(2) { margin-left: -4px; }
.fb-act-row {
  display: flex; justify-content: space-around;
  font-size: 13px; color: #65676b; font-weight: 600;
  padding-top: 4px;
}

/* ----- Threads ----- */
.th-frame {
  background: #fff; color: #0a0a0a;
  border-radius: 12px;
  border: 1px solid #d8d8d2;
  padding: 14px 16px;
}
.th-tweet {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 12px;
  padding: 8px 0;
  position: relative;
}
.th-reply::after {
  content: ""; position: absolute;
  left: 19px; top: 50px; bottom: -8px;
  width: 2px; background: #e4e6eb;
}
.th-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, #ec4899, #a855f7);
  color: #fff; font-weight: 700;
  font-family: var(--font-display);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px;
}
.th-row { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.th-name { font-weight: 700; }
.th-handle, .th-time, .th-dot { color: #65676b; }
.th-text {
  font-size: 14px; line-height: 1.5; margin-top: 4px;
  white-space: pre-wrap;
}
.th-img {
  margin-top: 10px; border-radius: 12px; overflow: hidden;
  border: 1px solid #e4e6eb;
}
.th-img-el { width: 100%; aspect-ratio: 16/10; display: block; }
.th-actions {
  display: flex; gap: 22px; margin-top: 10px;
  font-size: 12px; color: #65676b;
}

/* ----- YouTube thumbnail ----- */
.yt-frame {
  aspect-ratio: 16/9;
  border-radius: 8px;
  overflow: hidden; position: relative;
  background: #0a0a0a;
}
.yt-bg { width: 100%; height: 100%; display: block; }
.yt-scrim {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.1) 50%, rgba(0,0,0,0) 100%);
}
.yt-tag {
  position: absolute; top: 14px; left: 14px;
  background: var(--accent); color: #0a0a0a;
  font-family: var(--font-mono); font-size: 10px;
  padding: 4px 8px; border-radius: 4px;
  letter-spacing: 0.05em;
}
.yt-tag-dark { position: static; display: inline-block; margin-bottom: 12px; }
.yt-overlay {
  position: absolute; top: 14px; right: 14px;
  background: #0a0a0a; color: #fff;
  font-family: var(--font-display);
  font-weight: 700; font-size: 22px;
  padding: 6px 12px;
  border-radius: 4px;
  letter-spacing: -0.01em;
  transform: rotate(-2deg);
  border: 2px solid var(--accent);
}
.yt-title {
  position: absolute; left: 18px; right: 18px; bottom: 18px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 28px; line-height: 1.05;
  color: #fff;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 12px rgba(0,0,0,0.6);
}
.yt-v1 { display: grid; grid-template-columns: 1fr 1fr; background: #0a0a0a; }
.yt-text-left { padding: 24px; display: flex; flex-direction: column; justify-content: center; gap: 6px; }
.yt-big {
  font-family: var(--font-display);
  font-weight: 800; font-size: 36px; line-height: 1;
  color: var(--accent);
  letter-spacing: -0.03em;
}
.yt-arrow { font-size: 32px; color: #fff; margin-top: 6px; }
.yt-img-right { overflow: hidden; }
.yt-img-right .yt-bg { width: 100%; height: 100%; }
.yt-v2 .yt-bg { width: 100%; height: 100%; }
.yt-strip {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: rgba(10,10,10,0.85);
  backdrop-filter: blur(6px);
  padding: 10px 14px;
  display: flex; justify-content: space-between;
  color: #fff;
  font-size: 14px;
}
.yt-strip-tag { color: var(--accent); font-family: var(--font-mono); font-size: 11px; }

/* ----- LINE ----- */
.line-frame {
  background: #8baadd;
  border-radius: 18px;
  overflow: hidden;
  aspect-ratio: 9/16;
  display: flex; flex-direction: column;
  font-family: var(--font-body);
}
.line-chat-head {
  background: #6a8bc8;
  color: #fff;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  padding: 12px 14px;
  font-size: 14px;
  gap: 10px;
}
.line-back { font-size: 18px; }
.line-chat-name { font-weight: 600; }
.line-chat-icons { display: flex; gap: 10px; font-size: 14px; }
.line-chat-body {
  flex: 1;
  padding: 14px 12px;
  display: flex; flex-direction: column; gap: 10px;
  overflow: hidden;
}
.line-time {
  align-self: center;
  background: rgba(0,0,0,0.25);
  color: #fff;
  font-size: 10px;
  padding: 3px 10px;
  border-radius: 999px;
}
.line-msg { display: flex; flex-direction: column; gap: 6px; max-width: 88%; }
.line-card {
  background: #fff; color: #0a0a0a;
  border-radius: 14px;
  overflow: hidden;
  display: flex; flex-direction: column;
}
.line-card-img { width: 100%; aspect-ratio: 4/3; display: block; }
.line-card-text { padding: 12px 14px 8px; }
.line-card-title { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.line-card-body { font-size: 12px; color: #4a4a44; line-height: 1.45; }
.line-card-btn {
  margin: 8px 12px 12px;
  background: var(--accent); color: #0a0a0a;
  border: 0; border-radius: 999px;
  padding: 9px 14px; font-weight: 600; font-size: 12px;
}
.line-bubble {
  background: #fff; color: #0a0a0a;
  border-radius: 14px 14px 14px 4px;
  padding: 10px 12px;
}
.line-bubble-title { font-weight: 700; font-size: 13px; margin-bottom: 4px; }
.line-bubble-body { font-size: 12px; line-height: 1.5; }
.line-msg-img { border-radius: 12px; overflow: hidden; }
.line-img-el { width: 100%; aspect-ratio: 4/3; display: block; }
.line-imagemap { position: relative; border-radius: 12px; overflow: hidden; }
.line-imagemap-img { width: 100%; aspect-ratio: 1/1; display: block; }
.line-imagemap-overlay {
  position: absolute; inset: auto 0 0 0;
  padding: 14px; color: #fff;
  background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
}
.line-imagemap-title { font-weight: 700; font-size: 14px; margin-bottom: 8px; }
.line-imagemap-btn {
  background: var(--accent); color: #0a0a0a;
  border: 0; padding: 6px 10px;
  border-radius: 999px;
  font-weight: 600; font-size: 11px;
}

/* ----- EDM ----- */
.edm-frame {
  background: #fafaf6; color: #0a0a0a;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #d8d8d2;
}
.edm-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 24px;
  border-bottom: 1px solid #e4e4de;
}
.edm-bar-on-image { border: 0; }
.edm-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.edm-mark { color: var(--accent); }
.edm-brand-name { font-family: var(--font-display); font-size: 16px; }
.edm-nav { display: flex; gap: 18px; font-size: 12px; color: #4a4a44; font-family: var(--font-mono); }
.edm-nav-light { color: #fafaf6; }
.edm-hero {
  display: grid; grid-template-columns: 1.1fr 1fr;
  min-height: 240px;
}
.edm-text {
  padding: 28px 24px;
  display: flex; flex-direction: column; justify-content: center; gap: 10px;
}
.edm-eyebrow {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.15em;
  color: #6a6a64; text-transform: uppercase;
}
.edm-eyebrow-light { color: #f4f4f0; }
.edm-head {
  font-family: var(--font-display);
  font-size: 30px; font-weight: 700; line-height: 1.05;
  letter-spacing: -0.025em;
  white-space: pre-wrap;
  min-height: 1.1em;
}
.edm-head-light { color: #fff; text-shadow: 0 2px 12px rgba(0,0,0,0.4); }
.edm-head-small { font-size: 18px; }
.edm-sub {
  font-size: 13px; color: #4a4a44; line-height: 1.5; max-width: 420px;
}
.edm-sub-light { color: rgba(255,255,255,0.92); }
.edm-cta {
  align-self: flex-start;
  background: #0a0a0a; color: #fafaf6;
  border: 0; border-radius: 999px;
  padding: 10px 18px;
  font-weight: 600; font-size: 13px;
  margin-top: 6px;
}
.edm-cta-light { background: var(--accent); color: #0a0a0a; }
.edm-cta-ghost { background: transparent; border: 1px solid #0a0a0a; color: #0a0a0a; }
.edm-img-wrap { overflow: hidden; }
.edm-img-el { width: 100%; height: 100%; display: block; }
.edm-hero-center { position: relative; min-height: 280px; }
.edm-bg { width: 100%; height: 100%; position: absolute; inset: 0; }
.edm-scrim { position: absolute; inset: 0; background: rgba(10,10,10,0.4); }
.edm-center-text {
  position: relative; z-index: 1;
  padding: 40px 24px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.edm-banner {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 16px 20px;
}
.edm-banner-thumb { border-radius: 6px; overflow: hidden; aspect-ratio: 1/1; }
.edm-banner-text { display: flex; flex-direction: column; gap: 4px; }

/* ============= Tweaks panel theming overrides ============= */
.tweaks-panel { background: var(--bg-1) !important; border-color: var(--line) !important; color: var(--text) !important; }
.tweaks-panel-header { border-color: var(--line) !important; }

/* Responsive guard */
@media (max-width: 900px) {
  .ws-body { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .hero-platforms { grid-template-columns: 1fr; }
  .hero-title { font-size: 40px; }
}

/* ============================================================ */
/* Landing page                                                 */
/* ============================================================ */
.tbar-link {
  font-size: 13px; color: var(--text-dim);
  padding: 4px 8px;
  cursor: pointer;
}
.tbar-link:hover { color: var(--text); }
.tbar-cta { padding: 8px 14px !important; font-size: 13px !important; }

.lp { background: var(--bg); }

/* Hero */
.lp-hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  min-height: 720px;
}
.lp-hero-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 80px 32px 60px;
  position: relative;
  z-index: 2;
  max-width: 760px;
  margin-left: 80px;
}
.lp-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  text-transform: uppercase;
  display: inline-flex; align-items: center; gap: 8px;
  margin-bottom: 28px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-1);
}
.lp-eyebrow .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}
.lp-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 84px;
  line-height: 0.96;
  letter-spacing: -0.04em;
  margin: 0 0 28px;
  text-wrap: balance;
}
.lp-arrow { color: var(--accent); display: inline-block; margin: 0 12px; transform: translateY(-6px); }
.lp-title-accent { color: var(--accent); }
.lp-title-soft {
  color: var(--text-dim);
  font-weight: 400;
  font-size: 42px;
  letter-spacing: -0.02em;
}
.lp-sub {
  color: var(--text-dim);
  font-size: 17px;
  max-width: 560px;
  margin: 0 0 36px;
  line-height: 1.6;
}
.lp-cta-row {
  display: flex; align-items: center; gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 56px;
}
.lp-cta { padding: 14px 24px !important; font-size: 15px !important; }
.btn-ghost-lg {
  background: transparent;
  border: 1px solid var(--line-2);
  color: var(--text);
  border-radius: 999px;
  padding: 13px 18px;
  font-size: 14px;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn-ghost-lg:hover { background: var(--bg-2); }
.lp-cta-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.lp-stat-row {
  display: flex;
  gap: 48px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}
.lp-stat-num {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
}
.lp-stat-lbl {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
  letter-spacing: 0.05em;
}

/* Floating preview cluster */
.lp-cluster {
  position: absolute;
  right: -80px;
  top: 60px;
  bottom: 0;
  width: 700px;
  pointer-events: none;
  z-index: 1;
  opacity: 0.95;
  mask-image: linear-gradient(to bottom, black 75%, transparent 100%);
}
.lp-cluster-inner { position: relative; width: 100%; height: 100%; }
.lp-float {
  position: absolute;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-1);
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(0,0,0,0.6);
  width: var(--w);
  max-width: 360px;
  transition: transform 0.4s ease;
}
.lp-float-tag {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
}
.lp-float-stage { padding: 14px; background: var(--bg-1); }
.lp-float-0 { top: 30px; right: 60px; transform: rotate(2deg); }
.lp-float-1 { top: 200px; right: 280px; transform: rotate(-3deg); }
.lp-float-2 { top: 380px; right: 30px; transform: rotate(1.5deg); width: 320px; }
.lp-float-3 { top: 520px; right: 240px; transform: rotate(-1.5deg); width: 280px; }

/* Sections */
.lp-section {
  max-width: 1280px;
  margin: 0 auto;
  padding: 100px 32px 40px;
}
.lp-section-head {
  margin-bottom: 56px;
  max-width: 720px;
}
.lp-section-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 16px;
}
.lp-section-title {
  font-family: var(--font-display);
  font-size: 44px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin: 0 0 16px;
  text-wrap: balance;
}
.lp-section-sub {
  color: var(--text-dim);
  font-size: 16px;
  line-height: 1.6;
  margin: 0;
}

/* Demo grid */
.lp-demo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 24px;
}
.lp-demo-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-1);
  overflow: hidden;
}
.lp-demo-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
}
.lp-demo-stage {
  padding: 24px;
  background:
    radial-gradient(circle at 1px 1px, var(--line) 1px, transparent 1px) 0 0 / 14px 14px,
    var(--bg-1);
  display: flex; justify-content: center;
  min-height: 220px;
}
.lp-demo-stage-inner {
  width: 100%;
}

/* Features */
.lp-feat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.lp-feat {
  background: var(--bg-1);
  padding: 28px 24px;
  min-height: 200px;
}
.lp-feat-num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.1em;
  margin-bottom: 18px;
}
.lp-feat-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}
.lp-feat-body {
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.6;
}

/* Steps */
.lp-steps {
  display: flex; flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-1);
}
.lp-step {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 24px;
  padding: 28px 32px;
  border-bottom: 1px solid var(--line);
  align-items: center;
}
.lp-step-last { border-bottom: 0; }
.lp-step-num {
  font-family: var(--font-display);
  font-size: 48px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--accent);
  line-height: 1;
}
.lp-step-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.lp-step-body {
  color: var(--text-dim);
  font-size: 14px;
}

/* Final CTA */
.lp-final {
  margin: 80px 32px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(800px 300px at 50% 0%, rgba(231,255,82,0.15), transparent 70%),
    var(--bg-1);
  padding: 80px 24px;
}
.lp-final-inner {
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
}
.lp-final-title {
  font-family: var(--font-display);
  font-size: 48px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin: 0 0 32px;
  text-wrap: balance;
}
.lp-final-meta {
  margin-top: 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

/* Footer */
.lp-foot {
  max-width: 1280px;
  margin: 80px auto 0;
  padding: 32px;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 32px;
  align-items: center;
}
.lp-foot-links { display: flex; gap: 24px; justify-content: center; font-size: 13px; color: var(--text-dim); }
.lp-foot-meta { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }

/* Hero back button */
.hero-back {
  background: transparent;
  border: 0;
  color: var(--text-dim);
  font-size: 13px;
  margin-bottom: 24px;
  padding: 0;
}
.hero-back:hover { color: var(--text); }

/* ============================================================ */
/* Workspace stack (vertical: source → select → preview)        */
/* ============================================================ */
.ws-stack {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.ws-source, .ws-select, .ws-preview {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-1);
  overflow: hidden;
}
.ws-source-head, .ws-select-head, .ws-preview-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
  gap: 16px;
}
.ws-source-title {
  display: flex; align-items: center; gap: 12px;
  font-size: 14px;
}
.ws-step {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--bg-3);
  border: 1px solid var(--line-2);
  color: var(--accent);
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 0.05em;
}
.ws-source-meta {
  display: flex; align-items: center; gap: 6px;
}
.paste-area-flat {
  border: 0;
  background: transparent;
  padding: 20px 18px;
}

.ws-select-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
}
.ws-pills {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
  padding: 16px;
}
.ws-pill {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center; gap: 10px;
  padding: 10px 12px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-align: left;
  color: var(--text);
}
.ws-pill:hover { border-color: var(--line-2); }
.ws-pill.on { border-color: var(--accent); background: var(--bg-3); }
.ws-pill-chip {
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--bg-3); border: 1px solid var(--line-2);
  font-family: var(--font-mono); font-size: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-dim);
}
.ws-pill.on .ws-pill-chip { color: var(--accent); border-color: var(--accent); }
.ws-pill-text { display: flex; flex-direction: column; min-width: 0; }
.ws-pill-name { font-size: 13px; }
.ws-pill-spec { font-size: 10px; color: var(--text-muted); font-family: var(--font-mono); }

.ws-gen-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  background: var(--bg-2);
}
.ws-gen-bottom {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.ws-gen-meta {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; color: var(--text-dim);
  flex-wrap: wrap;
}
.ws-gen-meta strong { color: var(--text); font-weight: 600; }
.ws-gen-divider { color: var(--line-2); }
.ws-gen-tip { color: var(--text-muted); font-size: 11px; font-family: var(--font-mono); }
.ws-gen-btn { padding: 11px 18px !important; }
.ws-gen-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ws-progress {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 18px 14px;
}

.ws-preview-head { padding: 14px 18px; }
.ws-preview .preview-grid { padding: 24px; }
.ws-empty {
  padding: 80px 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--text-muted);
  gap: 8px;
}
.ws-empty-mark { font-size: 24px; }
.ws-empty-text { font-size: 13px; }

/* old ws-body grid is no longer used; preview-grid alone */
@media (max-width: 1180px) {
  .lp-cluster { display: none; }
  .lp-hero-inner { margin-left: 0; max-width: none; }
  .lp-feat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .lp-title { font-size: 56px; }
  .lp-title-soft { font-size: 28px; }
  .lp-section-title { font-size: 32px; }
  .lp-final-title { font-size: 32px; }
  .lp-feat-grid { grid-template-columns: 1fr; }
  .lp-step { grid-template-columns: 1fr; }
  .lp-stat-row { gap: 24px; flex-wrap: wrap; }
}

/* ============================================================ */
/* AdHydra additions: brand image, gear, error, settings modal  */
/* ============================================================ */

.brand-mark-img-wrap {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg-2);
  flex-shrink: 0;
}
.brand-mark-img {
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
}

.tbar-gear {
  appearance: none;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-dim);
  width: 30px; height: 30px;
  border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.tbar-gear:hover {
  background: var(--bg-2);
  color: var(--text);
  border-color: var(--line-2);
}
.tbar-pill-warn {
  border-color: rgba(255, 107, 77, 0.5);
  color: #ffb09c;
}
.tbar-pill-warn .tbar-pill-dot {
  background: var(--danger);
  box-shadow: 0 0 8px var(--danger);
}

/* Error row in workspace */
.ws-error {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  background: rgba(255, 107, 77, 0.06);
  color: #ffb09c;
  font-size: 13px;
}
.ws-error-mark {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--danger);
  color: #1c1c1c;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
  flex-shrink: 0;
}
.ws-error-text { flex: 1; min-width: 0; word-break: break-word; }
.ws-error-btn {
  appearance: none;
  background: transparent;
  border: 1px solid rgba(255, 107, 77, 0.5);
  color: #ffb09c;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  font-family: var(--font-body);
}
.ws-error-btn:hover { background: rgba(255, 107, 77, 0.12); }

.pc-idle-err {
  color: var(--danger);
}

/* Settings modal */
.md-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.55);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  animation: md-fade-in 0.15s ease-out;
}
@keyframes md-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.md-card {
  width: 100%;
  max-width: 520px;
  background: var(--bg-1);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  display: flex; flex-direction: column;
  max-height: calc(100vh - 48px);
  overflow: hidden;
  animation: md-pop 0.2s cubic-bezier(0.2, 0.9, 0.4, 1);
}
@keyframes md-pop {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.md-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
}
.md-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.01em;
}
.md-close {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--text-muted);
  font-size: 16px;
  width: 28px; height: 28px;
  border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
}
.md-close:hover { background: var(--bg-3); color: var(--text); }

.md-body {
  padding: 20px;
  display: flex; flex-direction: column; gap: 22px;
  overflow-y: auto;
}
.md-section { display: flex; flex-direction: column; gap: 8px; }
.md-section-info {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.md-info-title {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--accent);
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}
.md-info-body {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.55;
}

.md-label {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-dim);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.md-input-row {
  display: flex; gap: 8px;
}
.md-input {
  flex: 1; min-width: 0;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-family: var(--font-mono);
  outline: none;
}
.md-input:focus {
  border-color: var(--accent);
  background: var(--bg-3);
}
.md-input-btn {
  appearance: none;
  background: var(--bg-3);
  border: 1px solid var(--line-2);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  font-family: var(--font-body);
}
.md-input-btn:hover { background: var(--bg-2); border-color: var(--text-muted); }
.md-hint {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}
.md-mono {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
}

.md-radio-group {
  display: flex; flex-direction: column; gap: 6px;
}
.md-radio {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-dim);
  transition: border-color 0.12s, background 0.12s, color 0.12s;
}
.md-radio:hover { border-color: var(--line-2); color: var(--text); }
.md-radio.on {
  border-color: var(--accent);
  background: var(--bg-3);
  color: var(--text);
}
.md-radio input { accent-color: var(--accent); }

.md-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: var(--bg-2);
  display: flex; align-items: center; gap: 10px;
}
.md-btn {
  appearance: none;
  border: 1px solid var(--line-2);
  background: var(--bg-3);
  color: var(--text);
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-family: var(--font-body);
}
.md-btn:hover { background: var(--bg-2); }
.md-btn-ghost { background: transparent; }
.md-btn-primary {
  background: var(--accent);
  color: #0a0a0a;
  border-color: var(--accent);
  font-weight: 600;
}
.md-btn-primary:hover { background: #f1ff70; }

/* Provider tabs */
.md-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.md-tabs.md-tabs-3 {
  grid-template-columns: repeat(3, 1fr);
}
.md-tab {
  appearance: none;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  text-align: left;
  color: var(--text-dim);
  cursor: pointer;
  display: flex; flex-direction: column; gap: 4px;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
}
.md-tab:hover { border-color: var(--line-2); color: var(--text); }
.md-tab.on {
  border-color: var(--accent);
  background: var(--bg-3);
  color: var(--text);
}
.md-tab-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.005em;
}
.md-tab-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Ping result */
.md-ping {
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.55;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--text-dim);
  word-break: break-word;
}
.md-ping-loading { border-color: var(--line-2); }
.md-ping-ok {
  border-color: rgba(184, 255, 111, 0.5);
  background: rgba(184, 255, 111, 0.06);
  color: #d4ffaf;
}
.md-ping-warn {
  border-color: rgba(255, 200, 0, 0.4);
  background: rgba(255, 200, 0, 0.06);
  color: #ffe28a;
}
.md-ping-err {
  border-color: rgba(255, 107, 77, 0.5);
  background: rgba(255, 107, 77, 0.06);
  color: #ffb09c;
}

/* Fetch status banner */
.fetch-banner {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  background: var(--bg-2);
  font-size: 12px;
  color: var(--text-dim);
}
.fetch-banner-loading { color: var(--text); }
.fetch-banner-ok {
  background: rgba(184, 255, 111, 0.05);
  color: #d4ffaf;
  border-top-color: rgba(184, 255, 111, 0.2);
}
.fetch-banner-warn {
  background: rgba(255, 200, 0, 0.05);
  color: #ffe28a;
  border-top-color: rgba(255, 200, 0, 0.2);
}
.fetch-mark {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: rgba(255, 200, 0, 0.5);
  color: #1c1c1c;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 11px;
  flex-shrink: 0;
}
.fetch-mark-ok {
  background: var(--accent);
}
.fetch-spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.18);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: fetch-spin 0.8s linear infinite;
}
@keyframes fetch-spin {
  to { transform: rotate(360deg); }
}
.fetch-url {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  word-break: break-all;
}
.fetch-hero-thumb {
  width: 28px; height: 28px;
  border-radius: 4px;
  object-fit: cover;
  margin-left: auto;
  border: 1px solid var(--line-2);
}

/* Topbar API usage bar */
.usage-bar {
  display: flex; flex-direction: column; gap: 4px;
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  min-width: 140px;
  font-family: var(--font-mono);
  cursor: help;
}
.usage-meta {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
  font-size: 10px;
  letter-spacing: 0.04em;
}
.usage-provider {
  color: var(--text-dim);
  text-transform: uppercase;
}
.usage-count {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.usage-track {
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: var(--bg-3);
  overflow: hidden;
}
.usage-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s ease;
}
.usage-bar-ok .usage-fill {
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
}
.usage-bar-warn .usage-fill {
  background: #ffc846;
  box-shadow: 0 0 6px rgba(255, 200, 70, 0.5);
}
.usage-bar-danger .usage-fill {
  background: var(--danger);
  box-shadow: 0 0 6px var(--danger);
}
.usage-bar-warn { border-color: rgba(255, 200, 70, 0.3); }
.usage-bar-danger { border-color: rgba(255, 107, 77, 0.4); }

/* Image source section */
.ws-img {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-1);
  overflow: hidden;
}
.ws-img-meta {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-dim);
}
.ws-img-empty-hint { color: var(--text-muted); }
.ws-img-focus {
  color: var(--accent);
  background: var(--bg-3);
  border: 1px solid var(--line-2);
  padding: 3px 8px;
  border-radius: 4px;
}
.ws-img-body {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 18px;
  padding: 18px;
}
@media (max-width: 720px) {
  .ws-img-body { grid-template-columns: 1fr; }
}

/* Drop zone / preview */
.ws-img-drop {
  position: relative;
  aspect-ratio: 16 / 9;
  border: 2px dashed var(--line-2);
  border-radius: var(--radius);
  background: var(--bg-2);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.15s, background 0.15s;
}
.ws-img-drop:hover { border-color: var(--accent); }
.ws-img-drop.is-over {
  border-color: var(--accent);
  background: var(--bg-3);
  box-shadow: 0 0 0 4px rgba(231, 255, 82, 0.08);
}
.ws-img-drop.has-img {
  border-style: solid;
  cursor: crosshair;
  padding: 0;
}
.ws-img-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}
.ws-img-empty-icon {
  font-size: 24px;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.ws-img-empty-sub {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  margin-top: 4px;
}
.ws-img-preview {
  width: 100%;
  height: 100%;
  display: block;
}
.ws-img-focus-dot {
  position: absolute;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #0a0a0a;
  box-shadow: 0 0 0 3px rgba(231, 255, 82, 0.35), 0 2px 8px rgba(0,0,0,0.5);
  transform: translate(-50%, -50%);
  pointer-events: none;
  transition: left 0.2s, top 0.2s;
}

.ws-img-controls {
  display: flex; flex-direction: column; gap: 10px;
}
.ws-img-btn {
  appearance: none;
  border: 1px solid var(--line-2);
  background: var(--bg-2);
  color: var(--text);
  padding: 9px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-family: var(--font-body);
  cursor: pointer;
}
.ws-img-btn:hover:not(:disabled) {
  background: var(--bg-3);
  border-color: var(--text-muted);
}
.ws-img-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.ws-img-btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #0a0a0a;
  font-weight: 600;
}
.ws-img-btn-primary:hover:not(:disabled) {
  background: #f1ff70;
}
.ws-img-btn-ghost { background: transparent; }

.ws-img-url-row {
  display: flex; gap: 8px;
}
.ws-img-url {
  flex: 1; min-width: 0;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  color: var(--text);
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-family: var(--font-mono);
  outline: none;
}
.ws-img-url:focus {
  border-color: var(--accent);
  background: var(--bg-3);
}

.ws-img-action-row {
  display: flex; gap: 8px;
  flex-wrap: wrap;
}

.ws-img-status {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.5;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--text-dim);
  word-break: break-word;
}
.ws-img-status-detecting,
.ws-img-status-loading {
  border-color: var(--line-2);
}
.ws-img-status-ok {
  border-color: rgba(184, 255, 111, 0.4);
  background: rgba(184, 255, 111, 0.06);
  color: #d4ffaf;
}
.ws-img-status-err {
  border-color: rgba(255, 107, 77, 0.5);
  background: rgba(255, 107, 77, 0.06);
  color: #ffb09c;
}
.ws-img-hint {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}
.ws-img-hint strong { color: var(--accent); font-weight: 500; }

/* Per-card style switcher */
.pc-styles {
  display: flex;
  gap: 6px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
}
.pc-style-pill {
  appearance: none;
  background: transparent;
  border: 1px solid var(--line-2);
  color: var(--text-dim);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.12s;
  display: inline-flex; align-items: center; gap: 4px;
  position: relative;
}
.pc-style-pill:hover {
  background: var(--bg-3);
  color: var(--text);
  border-color: var(--text-muted);
}
.pc-style-pill.on {
  background: var(--accent);
  color: #0a0a0a;
  border-color: var(--accent);
  font-weight: 600;
}
.pc-style-pill.empty {
  color: var(--text-muted);
  font-style: italic;
}
.pc-style-pill.empty.on {
  font-style: normal;
}
.pc-style-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--bg-3);
  border: 1px solid var(--line-2);
  color: var(--text-muted);
  font-size: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  line-height: 1;
}
.pc-style-pill.on .pc-style-dot {
  background: rgba(0,0,0,0.15);
  border-color: rgba(0,0,0,0.2);
  color: rgba(0,0,0,0.7);
}

/* Model picker rows in settings */
.md-models {
  margin-top: 10px;
  display: flex; flex-direction: column; gap: 6px;
}
.md-models-title {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}
.md-model-row {
  appearance: none;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
  text-align: left;
  cursor: pointer;
  display: flex; flex-direction: column; gap: 4px;
  transition: border-color 0.12s, background 0.12s;
}
.md-model-row:hover {
  border-color: var(--line-2);
  background: var(--bg-3);
}
.md-model-row.on {
  border-color: var(--accent);
  background: var(--bg-3);
  box-shadow: 0 0 0 1px var(--accent) inset;
}
.md-model-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
}
.md-model-name {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
  word-break: break-all;
}
.md-model-strength {
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
  flex-shrink: 0;
  white-space: nowrap;
}
.md-model-row:not(.on) .md-model-strength { color: var(--text-dim); }
.md-model-note {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ---- Global style selector (ws-gen-row) ---- */
.ws-style-selector {
  display: flex; align-items: center; gap: 6px;
}
.ws-style-label {
  font-size: 12px; color: var(--text-dim);
  font-weight: 500;
  margin-right: 2px;
  white-space: nowrap;
}
.ws-style-btn {
  appearance: none;
  background: transparent;
  border: 1px solid var(--line-2);
  color: var(--text-dim);
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.12s;
  white-space: nowrap;
  flex-shrink: 0;
}
.ws-style-btn:hover {
  background: var(--bg-3);
  color: var(--text);
  border-color: var(--text-muted);
}
.ws-style-btn.on {
  background: var(--accent);
  color: #0a0a0a;
  border-color: var(--accent);
  font-weight: 600;
}

/* ---- Preview card edit button active state ---- */
.pc-btn-on {
  background: var(--accent) !important;
  color: #0a0a0a !important;
}
.pc-btn-on:hover {
  background: var(--accent) !important;
  opacity: 0.85;
}

/* ---- Preview card inline edit panel ---- */
.pc-edit-panel {
  border-top: 1px solid var(--line);
  background: var(--bg-1);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pc-edit-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pc-edit-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-family: var(--font-mono);
}
.pc-edit-input,
.pc-edit-textarea {
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 12px;
  line-height: 1.5;
  padding: 6px 8px;
  outline: none;
  width: 100%;
  transition: border-color 0.12s;
}
.pc-edit-input:focus,
.pc-edit-textarea:focus {
  border-color: var(--accent);
}
.pc-edit-textarea {
  resize: vertical;
  min-height: 60px;
}

/* ---- Source text file upload zone ---- */
.src-upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 48px 24px;
  margin: 8px 16px 16px;
  border: 1.5px dashed var(--line-2);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.14s, background 0.14s;
}
.src-upload-zone:hover {
  border-color: var(--accent);
  background: rgba(231, 255, 82, 0.04);
}
.src-upload-icon {
  font-size: 24px;
  opacity: 0.5;
}
.src-upload-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.src-upload-hint {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ---- PreviewCard error detail ---- */
.pc-err-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--danger);
  margin-bottom: 6px;
}
.pc-err-detail {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.5;
  max-width: 260px;
  text-align: center;
}
.pc-idle-err {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

/* ---- Mode dot in ws-gen-bottom ---- */
.ws-gen-mode-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  margin-right: 6px;
  vertical-align: middle;
}
.ws-gen-mode-dot.ok {
  background: #34c759;
  box-shadow: 0 0 6px #34c759;
}
