:root {
  --ui-bg: #101014;
  --ui-panel: #17171d;
  --ui-panel2: #1d1d24;
  --ui-border: #26262f;
  --ui-text: #e8e8ee;
  --ui-dim: #9a9aa8;
  --ui-accent: #7c6cf0;
}
* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: ui-sans-serif, system-ui, -apple-system, sans-serif;
  background: var(--ui-bg);
  color: var(--ui-text);
  font-size: 13px;
}

#app {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-columns: 296px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
}

/* ---------- sidebar ---------- */
#sidebar {
  background: var(--ui-panel);
  border-right: 1px solid var(--ui-border);
  display: flex; flex-direction: column;
  overflow-y: auto;
  min-height: 0;
}
.side-head {
  display: flex; align-items: baseline; gap: 6px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--ui-border);
}
.logo { font-weight: 700; font-size: 17px; letter-spacing: -0.02em; }
.logo-dot { color: var(--ui-accent); font-size: 11px; margin-left: 3px; }
.tagline { color: var(--ui-dim); font-size: 11px; text-transform: uppercase; letter-spacing: 0.14em; }

.group { padding: 14px 16px 4px; display: flex; flex-direction: column; gap: 7px; }

/* look gallery */
#looksGrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.look-card {
  border: 1px solid var(--ui-border);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  background: var(--ui-panel2);
  transition: border-color .15s, transform .15s;
}
.look-card:hover { transform: translateY(-2px); }
.look-card.on { border-color: var(--ui-accent); outline: 2px solid color-mix(in srgb, var(--ui-accent) 45%, transparent); }
.lc-frame { padding: 10px; display: flex; flex-direction: column; gap: 6px; min-height: 86px; }
.lc-head { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.1; }
.lc-lines i { display: block; height: 4px; border-radius: 2px; background: currentColor; opacity: .28; margin-top: 4px; }
.lc-lines i:last-child { width: 65%; }
.lc-row { display: flex; align-items: center; gap: 6px; margin-top: auto; }
.lc-btn { font-size: 9.5px; font-weight: 700; padding: 3px 8px; color: #fff; background: var(--lc-btn, var(--ui-accent)); border-radius: inherit; }
.lc-chip { font-size: 8.5px; font-weight: 600; padding: 2px 6px; color: var(--lctx); border: 1px solid currentColor; opacity: .7; }
.lc-strip { display: flex; height: 10px; }
.lc-strip i { flex: 1; }
.lc-name { font-size: 10.5px; color: var(--ui-dim); padding: 6px 8px; border-top: 1px solid var(--ui-border); }

/* session shuffle history */
#historySection { display: flex; flex-direction: column; gap: 6px; margin-top: 2px; }
#historyStrip { display: flex; gap: 6px; flex-wrap: wrap; }
.hist-chip {
  display: flex; height: 20px; padding: 0;
  border: 1px solid var(--ui-border); border-radius: 6px;
  overflow: hidden; cursor: pointer; background: none;
}
.hist-chip:hover { border-color: var(--ui-accent); }
.hist-chip.on { outline: 2px solid var(--ui-accent); }
.hist-chip i { width: 10px; display: block; }

/* fine-tune drawer */
#fineTune { border-bottom: 1px solid var(--ui-border); padding-bottom: 10px; }
#fineTune > summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 16px 6px;
  font-size: 10.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--ui-accent);
}
#fineTune > summary::-webkit-details-marker { display: none; }
#fineTune > summary::after { content: " ▸"; font-size: 9px; }
#fineTune[open] > summary::after { content: " ▾"; }
#fineTune[open] > summary { margin-bottom: 6px; }
.group-label {
  font-size: 10.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--ui-dim);
}
.hint { float: right; font-weight: 400; text-transform: none; letter-spacing: 0; }

input[type="text"], input[list], select, textarea {
  width: 100%;
  background: var(--ui-panel2);
  border: 1px solid var(--ui-border);
  border-radius: 8px;
  color: var(--ui-text);
  padding: 7px 9px;
  font-size: 13px;
  outline: none;
}
input:focus, select:focus { border-color: var(--ui-accent); }

input[type="range"] { width: 100%; accent-color: var(--ui-accent); }

/* ---------- font combobox ---------- */
.combo { position: relative; }
.combo-pop {
  position: absolute; z-index: 20;
  left: 0; right: 0; top: calc(100% + 4px);
  background: var(--ui-panel2);
  border: 1px solid var(--ui-border);
  border-radius: 8px;
  box-shadow: 0 14px 34px -12px rgba(0,0,0,.75);
  overflow: hidden;
}
.combo-list { list-style: none; margin: 0; padding: 4px; max-height: 218px; overflow-y: auto; }
.combo-list::-webkit-scrollbar { width: 8px; }
.combo-list::-webkit-scrollbar-thumb { background: var(--ui-border); border-radius: 4px; }
.combo-opt {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  padding: 5px 8px; border-radius: 6px; cursor: pointer;
  font-size: 13.5px; line-height: 1.4;
}
.combo-opt:hover { background: color-mix(in srgb, var(--ui-accent) 26%, transparent); }
.combo-opt.on { background: var(--ui-accent); color: #fff; }
.combo-fam { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combo-cat {
  flex: none; font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--ui-dim);
}
.combo-opt.on .combo-cat { color: rgba(255,255,255,.8); }
.combo-meta {
  padding: 5px 9px; font-size: 10.5px; color: var(--ui-dim);
  border-top: 1px solid var(--ui-border);
}

.chip-row { display: flex; flex-wrap: wrap; gap: 5px; }
.chip {
  border: 1px solid var(--ui-border);
  background: var(--ui-panel2);
  color: var(--ui-dim);
  border-radius: 999px;
  padding: 4px 10px;
  cursor: pointer;
  font-size: 11.5px;
}
.chip.on { border-color: var(--ui-accent); color: var(--ui-text); background: color-mix(in srgb, var(--ui-accent) 18%, transparent); }
.chip-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; box-shadow: 0 0 0 1px rgba(255,255,255,.18) inset; }

.seg { display: flex; border: 1px solid var(--ui-border); border-radius: 8px; overflow: hidden; }
.seg button {
  flex: 1;
  background: transparent; border: none; color: var(--ui-dim);
  padding: 6px 0; cursor: pointer; font-size: 11.5px;
  border-right: 1px solid var(--ui-border);
}
.seg button:last-child { border-right: none; }
.seg button.on { background: var(--ui-panel2); color: var(--ui-text); font-weight: 600; }
.seg.mini button { padding: 4px 14px; flex: none; }

.row { display: flex; gap: 6px; }

.btn {
  border: 1px solid var(--ui-border);
  background: var(--ui-panel2);
  color: var(--ui-text);
  border-radius: 8px;
  padding: 7px 12px;
  cursor: pointer;
  font-size: 12.5px;
}
.btn:hover { border-color: var(--ui-accent); }
.btn.primary {
  background: linear-gradient(180deg, var(--ui-accent), color-mix(in srgb, var(--ui-accent) 78%, black));
  border-color: transparent;
  font-weight: 600;
}
.btn.small { padding: 5px 9px; font-size: 11.5px; flex: 1; }
.btn.wide { width: 100%; padding: 10px; }
.btn.ghost { background: transparent; }

.side-foot { margin-top: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.status { min-height: 16px; font-size: 11.5px; color: var(--ui-dim); text-align: center; }
.status.ok { color: #6fdc8c; }
.status.err { color: #ff7a7a; }

/* ---------- main ---------- */
#main {
  display: flex; flex-direction: column;
  overflow: hidden;
  height: 100%;
  min-height: 0; min-width: 0;
}
#main::-webkit-scrollbar, #preview::-webkit-scrollbar { width: 10px; }
#main::-webkit-scrollbar-track, #preview::-webkit-scrollbar-track { background: transparent; }
#main::-webkit-scrollbar-thumb, #preview::-webkit-scrollbar-thumb { background: var(--ui-border); border-radius: 5px; }
#main::-webkit-scrollbar-thumb:hover, #preview::-webkit-scrollbar-thumb:hover { background: var(--ui-dim); }
#previewBar {
  position: sticky; top: 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 18px;
  background: color-mix(in srgb, var(--ui-bg) 82%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--ui-border);
}
.bar-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--ui-dim); }

/* prominent light/dark toggle */
.mode-toggle { display: inline-flex; gap: 2px; background: var(--ui-panel2); border: 1px solid var(--ui-border); border-radius: 999px; padding: 3px; }
.mode-toggle button {
  border: none; background: transparent; color: var(--ui-dim);
  padding: 7px 18px; border-radius: 999px; cursor: pointer;
  font-size: 12.5px; font-weight: 600;
}
.mode-toggle button.on { background: var(--ui-accent); color: #fff; }

#ramps {
  display: flex; flex-direction: column; gap: 4px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--ui-border);
}
.ramp-row { display: flex; gap: 4px; align-items: center; }
.ramp-name { width: 58px; color: var(--ui-dim); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; }
.swatch {
  height: 22px; flex: 1; border-radius: 4px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 9.5px; transition: opacity .15s;
}

/* ---------- preview ---------- */
#preview {
  flex: 1; min-height: 0;
  margin: 14px 18px 18px;
  border-radius: 14px;
  outline: 1px solid var(--ui-border);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.pv-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 34px;
  background: var(--pv-background);
  border-bottom: 1px solid var(--pv-border);
}
.pv-brand { font-family: var(--font-heading); font-weight: 700; font-size: 17px; color: var(--pv-text); }
.pv-links { display: flex; gap: 20px; }
.pv-links a { color: var(--pv-muted-text); font-size: 13.5px; cursor: pointer; }
.pv-links a:hover { color: var(--pv-text); }

.pv-hero { padding: 64px 34px 56px; background: var(--pv-background); text-align: center; }
.pv-h1 {
  font-family: var(--font-heading);
  font-size: calc(var(--text-2xl) * 1.55);
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: var(--pv-text);
  max-width: 560px; margin: 0 auto 14px;
}
.pv-sub { font-family: var(--font-body); font-size: var(--text-base); color: var(--pv-muted-text); max-width: 480px; margin: 0 auto 24px; line-height: 1.6; }
.pv-row { display: flex; gap: 10px; justify-content: center; }

.pv-btn {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  padding: 11px 22px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
}
.pv-btn.pv-sm { padding: 7px 15px; font-size: var(--text-xs); }
.pv-primary {
  background: var(--color-primary-600);
  color: #fff;
  box-shadow: 0 1px 0 rgba(255,255,255,.12) inset, 0 6px 18px -8px var(--color-primary-600);
}
.pv-primary:hover { background: var(--color-primary-500); }
.pv-ghost { background: transparent; border-color: var(--pv-border); color: var(--pv-text); }

.pv-cards {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
  padding: 32px 34px;
  background: var(--pv-surface);
  border-top: 1px solid var(--pv-border);
}
.pv-card {
  background: var(--pv-background);
  border: 1px solid var(--pv-border);
  border-radius: var(--radius-lg);
  padding: 14px;
  position: relative;
}
.pv-card h3 { font-family: var(--font-heading); font-size: var(--text-lg); color: var(--pv-text); margin: 10px 0 6px; }
.pv-card p { font-family: var(--font-body); font-size: var(--text-sm); color: var(--pv-muted-text); line-height: 1.55; }
.pv-thumb { height: 84px; border-radius: var(--radius-lg); }
.t1 { background: linear-gradient(135deg, var(--color-primary-300), var(--color-accent-400)); }
.t2 { background: linear-gradient(135deg, var(--color-accent-400), var(--color-neutral-400)); }
.t3 { background: linear-gradient(135deg, var(--color-primary-500), var(--color-primary-800)); }
.pv-chip {
  position: absolute; top: 22px; left: 22px;
  font-family: var(--font-mono); font-size: 10px;
  background: var(--pv-background);
  color: var(--pv-muted-text);
  border: 1px solid var(--pv-border);
  padding: 2px 8px; border-radius: 999px;
}

.pv-form {
  padding: 36px 34px;
  background: var(--pv-background);
  border-top: 1px solid var(--pv-border);
  display: flex; flex-direction: column; gap: 14px; max-width: 520px; margin: 0 auto; width: 100%;
}
.pv-form .pv-alert { margin-bottom: 4px; }
.pv-h2 { font-family: var(--font-heading); font-size: var(--text-xl); color: var(--pv-text); }
.pv-field { display: flex; flex-direction: column; gap: 5px; }
.pv-field label { font-family: var(--font-body); font-size: var(--text-xs); color: var(--pv-muted-text); font-weight: 600; }
.pv-field input, .pv-field textarea {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  background: var(--pv-surface);
  border: 1px solid var(--pv-border);
  border-radius: var(--radius-sm);
  color: var(--pv-text);
  padding: 9px 12px;
  outline: none;
}
.pv-field input:focus, .pv-field textarea:focus { border-color: var(--semantic-ring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--semantic-ring) 25%, transparent); }

/* ---------- preview sections (style-guide layout) ---------- */
.pv-section {
  padding: 30px 34px;
  background: var(--pv-background);
  border-top: 1px solid var(--pv-border);
}
.pv-label {
  font-family: var(--font-mono);
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--pv-muted-text);
  border-bottom: 1px solid var(--pv-border);
  padding-bottom: 10px; margin-bottom: 20px;
}
.pv-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pv-row { gap: 14px; }
.pv-row.left { justify-content: flex-start; }
.pv-row.wrap { flex-wrap: wrap; align-items: center; row-gap: 12px; }
.pv-row + .pv-row { margin-top: 14px; }
.pv-btn.wide { width: 100%; }

/* stats — editorial band, no boxes */
.pv-stats-band {
  display: flex;
  padding: 26px 34px;
  background: var(--pv-background);
  border-top: 1px solid var(--pv-border);
}
.pv-stat { flex: 1; padding: 2px 28px; border-left: 1px solid var(--pv-border); }
.pv-stat:first-child { padding-left: 0; border-left: none; }
.pv-stat-num { display: block; font-family: var(--font-heading); font-size: var(--text-2xl); font-weight: 700; color: var(--pv-text); }
.pv-stat-cap { font-family: var(--font-body); font-size: var(--text-xs); color: var(--pv-muted-text); }

/* badges + inline code */
.pv-badge { font-family: var(--font-body); font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.pv-badge.solid { background: var(--color-primary-600); color: #fff; }
.pv-badge.accent { background: var(--color-accent-100); color: var(--color-accent-900); border: 1px solid var(--color-accent-300); }
.pv-badge.outline { border: 1px solid var(--pv-border); color: var(--pv-muted-text); background: transparent; }
.pv-inline-code {
  font-family: var(--font-mono); font-size: var(--text-xs);
  background: var(--pv-surface); border: 1px solid var(--pv-border);
  color: var(--pv-text); padding: 4px 9px; border-radius: var(--radius-sm);
}

/* alerts */
.pv-alert { border-radius: var(--radius-lg); padding: 14px 18px; }
.pv-alert-title { font-family: var(--font-body); font-weight: 700; font-size: var(--text-sm); margin: 0 0 2px; }
.pv-alert-body { font-family: var(--font-body); font-size: var(--text-xs); opacity: .85; margin: 0; line-height: 1.5; }
.pv-alert.ok { background: var(--color-accent-100); color: var(--color-accent-900); }
.pv-alert.warn { background: var(--color-primary-100); color: var(--color-primary-900); }

/* data table */
.pv-table-wrap { border: 1px solid var(--pv-border); border-radius: var(--radius-lg); overflow: hidden; }
.pv-table { width: 100%; border-collapse: collapse; font-family: var(--font-body); font-size: var(--text-sm); }
.pv-table th {
  text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--pv-muted-text); background: var(--pv-surface);
  padding: 10px 14px; border-bottom: 1px solid var(--pv-border);
}
.pv-table td { padding: 10px 14px; border-bottom: 1px solid var(--pv-border); color: var(--pv-text); background: var(--pv-background); }
.pv-table tbody tr:last-child td { border-bottom: none; }

/* pricing */
.pv-pricing { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.pv-tier {
  position: relative;
  background: var(--pv-surface);
  border: 1px solid var(--pv-border);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex; flex-direction: column; gap: 12px;
}
.pv-tier h3 { font-family: var(--font-heading); font-size: var(--text-lg); color: var(--pv-text); }
.pv-price { font-family: var(--font-heading); font-size: var(--text-2xl); font-weight: 700; color: var(--pv-text); }
.pv-price span { font-size: var(--text-xs); color: var(--pv-muted-text); font-weight: 400; }
.pv-tier ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.pv-tier li { font-family: var(--font-body); font-size: var(--text-xs); color: var(--pv-muted-text); padding-left: 16px; position: relative; }
.pv-tier li::before { content: "✓"; position: absolute; left: 0; color: var(--color-accent-600); font-weight: 700; }
.pv-tier.featured { border-color: var(--color-primary-500); box-shadow: 0 12px 30px -18px color-mix(in srgb, var(--color-primary-500) 70%, transparent); }
.pv-flag {
  position: absolute; top: -10px; left: 18px;
  background: var(--color-primary-600); color: #fff;
  font-family: var(--font-body); font-size: 10px; font-weight: 700;
  padding: 3px 10px; border-radius: 999px; letter-spacing: .04em;
}

/* type hierarchy */
.pv-type-row { display: flex; align-items: baseline; gap: 18px; padding: 12px 0; border-bottom: 1px solid var(--pv-border); }
.pv-type-row:last-child { border-bottom: none; }
.pv-tag { font-family: var(--font-mono); font-size: 10px; color: var(--pv-muted-text); width: 64px; flex-shrink: 0; text-transform: uppercase; letter-spacing: .06em; }
.t-h1 { font-family: var(--font-heading); font-size: var(--text-2xl); font-weight: 700; color: var(--pv-text); letter-spacing: -0.02em; }
.t-h2 { font-family: var(--font-heading); font-size: var(--text-xl); font-weight: 600; color: var(--pv-text); }
.t-h3 { font-family: var(--font-heading); font-size: var(--text-lg); font-weight: 600; color: var(--pv-text); }
.t-body { font-family: var(--font-body); font-size: var(--text-base); color: var(--pv-text); }
.t-muted { font-family: var(--font-body); font-size: var(--text-sm); color: var(--pv-muted-text); }
.t-caption { font-family: var(--font-body); font-size: var(--text-xs); color: var(--pv-muted-text); }
.t-overline { font-family: var(--font-body); font-size: var(--text-xs); letter-spacing: .08em; text-transform: uppercase; font-weight: 600; color: var(--color-accent-600); }
.t-link { font-family: var(--font-body); font-size: var(--text-base); color: var(--color-primary-600); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.t-link:hover { color: var(--color-primary-500); }
.t-code { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--pv-text); background: var(--pv-surface); border: 1px solid var(--pv-border); padding: 2px 8px; border-radius: var(--radius-sm); }

/* form validation states */
.pv-field.has-error input, .pv-field.has-error textarea { border-color: var(--color-primary-600); }
.pv-error-msg { font-family: var(--font-body); font-size: var(--text-xs); color: var(--color-primary-600); margin: 0; }
.pv-hint { font-family: var(--font-body); font-size: var(--text-xs); color: var(--pv-muted-text); margin: 0; }

/* dark surface — inverse-mode check: shows the other mode's tokens */
.pv-dark {
  background: var(--pv-inverse-bg);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-start;
}
.pv-dark h4 { font-family: var(--font-heading); font-size: var(--text-lg); color: var(--pv-inverse-text); margin: 0; }
.pv-dark p { font-family: var(--font-body); font-size: var(--text-sm); color: var(--pv-inverse-muted); margin: 0 0 8px; max-width: 60ch; }
.pv-btn.pv-accent { background: var(--color-accent-500); color: #fff; border: none; }

/* footer */
.pv-footer {
  display: flex; justify-content: space-between;
  padding: 18px 28px;
  background: var(--pv-surface);
  border-top: 1px solid var(--pv-border);
  font-family: var(--font-body); font-size: var(--text-xs); color: var(--pv-muted-text);
}

#toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: #232330; color: #fff;
  border: 1px solid #33333f;
  padding: 10px 18px; border-radius: 10px;
  font-size: 13px;
  transition: transform .25s cubic-bezier(.2,.9,.3,1.2);
  z-index: 50;
}
#toast.show { transform: translateX(-50%) translateY(0); }

/* ---------- theme DNA: per-theme personality treatments ---------- */

/* Neon — gradient fintech, Stripe-canvas energy */
#preview[data-vibe="neon"] .pv-hero { position: relative; overflow: hidden; }
#preview[data-vibe="neon"] .pv-hero::before {
  content: ""; position: absolute; inset: -1px;
  background-image: var(--gradient-mesh);
  pointer-events: none;
}
#preview[data-vibe="neon"] .pv-hero > * { position: relative; }
#preview[data-vibe="neon"] .pv-primary {
  background-image: var(--gradient-primary);
  box-shadow: 0 10px 30px -12px color-mix(in srgb, var(--color-primary-500) 75%, transparent);
}
#preview[data-vibe="neon"] .pv-grad-word {
  background-image: var(--gradient-text);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
#preview[data-vibe="neon"] .pv-nav {
  border-bottom-color: color-mix(in srgb, var(--color-accent-400) 30%, var(--pv-border));
}
#preview[data-vibe="neon"] .pv-card { backdrop-filter: blur(6px); }

/* Fun — BIG loud solid blocks. Saturated slabs, high contrast, zero gradients */
#preview[data-vibe="fun"] .pv-nav { background: var(--color-primary-600); border-bottom: none; }
#preview[data-vibe="fun"] .pv-brand,
#preview[data-vibe="fun"] .pv-links a { color: #fff; }
#preview[data-vibe="fun"] .pv-links a:hover { color: var(--color-accent-300); }
#preview[data-vibe="fun"] .pv-btn.pv-sm {
  background: var(--color-accent-400); color: #1b1b1f; font-weight: 800;
}
#preview[data-vibe="fun"] .pv-hero { background: var(--color-primary-500); padding-block: 84px; }
#preview[data-vibe="fun"] .pv-h1 { color: #fff; font-weight: 800; letter-spacing: -0.02em; }
#preview[data-vibe="fun"] .pv-sub { color: rgba(255,255,255,.92); font-weight: 600; }
#preview[data-vibe="fun"] .pv-btn.pv-primary {
  background: var(--color-accent-400); color: #1b1b1f; font-weight: 800;
}
#preview[data-vibe="fun"] .pv-btn.pv-ghost {
  background: transparent; border-color: rgba(255,255,255,.85); color: #fff;
}
#preview[data-vibe="fun"] .pv-cards { background: var(--color-accent-300); }
#preview[data-vibe="fun"] .pv-card { box-shadow: none; border: none; }
#preview[data-vibe="fun"] .t1 { background: var(--color-primary-400); }
#preview[data-vibe="fun"] .t2 { background: var(--color-accent-500); }
#preview[data-vibe="fun"] .t3 { background: var(--color-neutral-900); }
#preview[data-vibe="fun"] .pv-chip {
  background: var(--color-primary-600); color: #fff; border: none; font-weight: 700;
}
#preview[data-vibe="fun"] .pv-label { color: var(--color-primary-600); }
#preview[data-vibe="fun"] .pv-table th { background: var(--color-primary-600); color: #fff; }
#preview[data-vibe="fun"] .pv-table td { background: var(--color-accent-300); }
#preview[data-vibe="fun"] .pv-tier { background: var(--pv-background); }
#preview[data-vibe="fun"] .pv-tier.featured { background: var(--color-accent-100); border-color: var(--color-accent-500); }
#preview[data-vibe="fun"] .pv-flag { background: var(--color-accent-600); }
#preview[data-vibe="fun"] .pv-btn.pv-accent { background: var(--color-accent-400); color: #1b1b1f; font-weight: 800; }
#preview[data-vibe="fun"] .t-code { color: var(--color-accent-600); }

/* Corporate — opinionated: tight type, uppercase nav, lift-on-hover, strictly flat */
#preview[data-vibe="corporate"] .pv-h1 { letter-spacing: -0.03em; font-weight: 800; }
#preview[data-vibe="corporate"] .pv-brand { letter-spacing: -0.02em; font-weight: 800; }
#preview[data-vibe="corporate"] .pv-links a {
  text-transform: uppercase; font-size: 11px; letter-spacing: 0.09em; font-weight: 600;
}
#preview[data-vibe="corporate"] .pv-card {
  transition: transform .18s ease, box-shadow .18s ease;
  box-shadow: 0 1px 3px rgba(15,23,42,.08);
}
#preview[data-vibe="corporate"] .pv-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 26px -14px rgba(15,23,42,.25);
}

/* Tech — neon voltage */
#preview[data-vibe="tech"] .pv-nav { border-bottom-color: var(--color-primary-500); }
#preview[data-vibe="tech"] .pv-primary {
  box-shadow: 0 0 24px color-mix(in srgb, var(--color-primary-500) 60%, transparent);
}
#preview[data-vibe="tech"] .pv-chip { color: var(--color-accent-400); border-color: var(--color-accent-500); }
#preview[data-vibe="tech"] .t-code { color: var(--color-accent-400); }

/* Retro — offset print + sun-faded */
#preview[data-vibe="retro"] .pv-card { box-shadow: -6px 6px 0 color-mix(in srgb, var(--color-accent-400) 70%, transparent); }
#preview[data-vibe="retro"] .t1, #preview[data-vibe="retro"] .t2, #preview[data-vibe="retro"] .t3 { filter: saturate(.85) sepia(.12); }
#preview[data-vibe="retro"] .pv-chip { transform: rotate(-3deg); }

/* Soft Pastel — floating softness */
#preview[data-vibe="soft-pastel"] .pv-card {
  border-color: transparent;
  box-shadow: 0 16px 36px -18px color-mix(in srgb, var(--color-primary-300) 75%, transparent);
}
#preview[data-vibe="soft-pastel"] .pv-hero { padding-block: 64px; }
#preview[data-vibe="soft-pastel"] .pv-btn { padding-inline: 26px; }

/* Corporate — crisp and confident */
#preview[data-vibe="corporate"] .pv-card {
  box-shadow: 0 1px 3px rgba(0,0,0,.08), 0 8px 22px -14px rgba(0,0,0,.18);
}

/* Minimal — flat hairlines, zero ornament */
#preview[data-vibe="minimal"] .pv-card { box-shadow: none; border-width: 1px; }
#preview[data-vibe="minimal"] .pv-btn.pv-primary { box-shadow: none; }
#preview[data-vibe="minimal"] .pv-chip { display: none; }

/* Earthy — warm paper and weight */
#preview[data-vibe="earthy"] .pv-cards { background: color-mix(in srgb, var(--color-neutral-100) 55%, var(--pv-surface)); }
#preview[data-vibe="earthy"] .pv-card {
  box-shadow: 0 10px 26px -16px color-mix(in srgb, var(--color-primary-700) 55%, transparent);
}
#preview[data-vibe="earthy"] .pv-h1 { font-weight: 500; }

/* ---------- narrow screens (phone, or the site embed on one) ----------
   The desktop layout is a fixed two-pane grid; at phone width that crushed
   the preview clean off the page. Stack instead: controls on top, scrolling
   in their own half, live preview below in the other. */
@media (max-width: 720px) {
  #app {
    grid-template-columns: minmax(0, 1fr);
    /* The preview is the point: it shows a whole website, so give it the
       room. The controls collapse to a scrolling strip above it. */
    grid-template-rows: minmax(0, auto) minmax(0, 1fr);
  }
  #sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--ui-border);
    max-height: 26vh;
  }
  /* Everything that is not the website itself gets out of the way. The ramps
     are a detail you can read on a desktop; on a phone they cost a third of
     the preview. */
  #ramps {
    display: none;
  }
  #previewBar {
    padding: 8px 12px;
  }
  #preview {
    margin: 8px;
  }
  /* Tighten the strip so more of it is visible before scrolling. */
  .side-head {
    padding: 10px 14px;
  }
  .group {
    padding: 9px 14px 3px;
  }
  #looksGrid {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
  /* The looks cards are a nicety on a phone; the theme chips do the work. */
  #looksSection {
    display: none;
  }
  #historySection {
    display: none;
  }

  /* The preview renders a mock desktop site. At phone width its padding and
     two-column bands overflow, so tighten them rather than letting the
     content run off the edge. */
  .pv-nav,
  .pv-hero,
  .pv-section,
  .pv-stats-band {
    padding-left: 16px;
    padding-right: 16px;
  }
  .pv-hero {
    padding-top: 26px;
    padding-bottom: 24px;
  }
  /* The hero type is sized for a desktop canvas. Left alone it fills the whole
     phone preview with four words, so you cannot see that it is a website. */
  .pv-h1 {
    font-size: calc(var(--text-2xl) * 0.95);
    margin-bottom: 10px;
  }
  .pv-sub {
    font-size: var(--text-sm);
  }
  .pv-nav {
    flex-wrap: wrap;
    gap: 8px;
  }
  .pv-links {
    gap: 12px;
  }
  .pv-grid-2 {
    grid-template-columns: 1fr;
  }
  .pv-stats-band {
    flex-wrap: wrap;
    gap: 14px;
  }
  .pv-stat {
    flex: 1 1 44%;
    padding-left: 14px;
  }
  /* Multi-column bands: one column at phone width. Measured offenders were
     .pv-cards (419px) and .pv-pricing (467px) inside a 326px pane. */
  .pv-cards,
  .pv-pricing {
    grid-template-columns: 1fr;
  }
  /* Ramp swatches are flex:1 but will not shrink past their label. */
  .swatch {
    min-width: 0;
  }
}
