:root {
  --bg: #0a0a0c;
  --panel: #121216;
  --panel-2: #17171c;
  --border: #26262e;
  --border-soft: #1d1d23;
  --ink: #f4f4f6;
  --ink-dim: #a0a0aa;
  --ink-faint: #6c6c78;
  --accent: #c9f24e;
  --radius: 14px;
  --sidebar-w: 232px;
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

#app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
  overflow: hidden;
}

/* ---------- Sidebar ---------- */
.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--border-soft);
  padding: 18px 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.brand {
  display: flex; align-items: center; gap: 9px;
  padding: 4px 6px 14px;
}
.brand-dot {
  width: 18px; height: 18px; border-radius: 6px;
  background: conic-gradient(from 200deg, var(--accent), #6be0ff, #c98aff, var(--accent));
}
.brand-name { font-size: 15px; letter-spacing: -0.02em; font-weight: 600; }
.brand-name b { font-weight: 800; }

.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--panel-2);
  border: 1px solid var(--border-soft);
  border-radius: 9px;
  padding: 8px 10px;
  color: var(--ink-faint);
  margin-bottom: 8px;
}
.search input {
  background: none; border: none; outline: none;
  color: var(--ink); font-size: 13px; width: 100%;
  font-family: inherit;
}
.search input::placeholder { color: var(--ink-faint); }

.nav-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--ink-faint); margin: 14px 6px 6px; font-weight: 600;
}
.nav-group { display: flex; flex-direction: column; gap: 1px; }
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 9px; border-radius: 8px;
  color: var(--ink-dim); font-size: 13px; cursor: pointer;
  border: none; background: none; text-align: left; width: 100%;
  font-family: inherit;
}
.nav-item:hover { background: var(--panel-2); color: var(--ink); }
.nav-item.active { background: var(--panel-2); color: var(--ink); }
.nav-item.active .dot { background: var(--accent); }
.nav-item .dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--ink-faint);
}

.tag-cloud { display: flex; flex-wrap: wrap; gap: 5px; padding: 0 4px; }
.tag-chip {
  font-size: 11.5px; padding: 4px 9px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--border-soft);
  color: var(--ink-dim); cursor: pointer; font-family: inherit;
}
.tag-chip:hover { color: var(--ink); border-color: var(--border); }
.tag-chip.active { background: var(--accent); color: #10100a; border-color: var(--accent); font-weight: 600; }

.creators { display: flex; flex-direction: column; gap: 2px; }
.creator {
  display: flex; align-items: center; gap: 9px;
  padding: 6px; border-radius: 8px; cursor: pointer; font-size: 12.5px;
  color: var(--ink-dim); border: none; background: none; width: 100%;
  text-align: left; font-family: inherit;
}
.creator:hover { background: var(--panel-2); color: var(--ink); }
.creator .avatar {
  width: 22px; height: 22px; border-radius: 50%; flex: none;
}

/* ---------- Main ---------- */
.main { overflow-y: auto; }
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 26px;
  background: linear-gradient(var(--bg) 70%, transparent);
  backdrop-filter: blur(4px);
}
.topbar-title { display: flex; align-items: baseline; gap: 12px; }
.topbar-title h1 { font-size: 20px; margin: 0; letter-spacing: -0.02em; }
.count { color: var(--ink-faint); font-size: 13px; }
.ghost-btn {
  background: var(--panel); border: 1px solid var(--border);
  color: var(--ink-dim); padding: 8px 12px; border-radius: 9px;
  font-size: 13px; cursor: pointer; font-family: inherit;
}
.ghost-btn:hover { color: var(--ink); }
.pill {
  background: var(--accent); color: #10100a; border-radius: 999px;
  padding: 1px 7px; font-size: 11px; font-weight: 700; margin-left: 2px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
  padding: 6px 26px 60px;
}
.empty { padding: 60px; text-align: center; color: var(--ink-faint); }

/* ---------- Card ---------- */
.card {
  border-radius: var(--radius);
  border: 1px solid var(--border-soft);
  background: var(--panel);
  overflow: hidden; cursor: pointer;
  transition: transform .15s ease, border-color .15s ease;
  display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-3px); border-color: var(--border); }

/* live-rendered preview (the "screenshot") */
.preview {
  aspect-ratio: 16 / 10;
  position: relative; overflow: hidden;
  padding: 14px 16px;
  display: flex; flex-direction: column;
}
/* live iframe thumbnail: render at fixed width, scale to the card */
.preview.live { padding: 0; background: #0c0c10; }
.card-frame-wrap { position: absolute; top: 0; left: 0; width: 1280px; height: 800px; transform-origin: top left; }
.card-frame { width: 1280px; height: 800px; border: 0; display: block; background: #0c0c10; pointer-events: none; }
.preview-nav {
  display: flex; gap: 12px; align-items: center;
  font-size: 7.5px; opacity: .7; margin-bottom: auto;
}
.preview-nav .logo { font-weight: 700; letter-spacing: .04em; }
.preview-nav .links { display: flex; gap: 9px; margin-left: auto; }
.preview-headline {
  font-size: 23px; line-height: 1.02; letter-spacing: -0.02em;
  font-weight: 700; white-space: pre-line; margin-bottom: 8px;
}
.preview-headline .accent { display: block; }
.preview-sub { font-size: 8.5px; line-height: 1.4; max-width: 70%; opacity: .72; margin-bottom: 10px; }
.preview-cta { display: flex; gap: 6px; }
.preview-btn {
  font-size: 8px; padding: 5px 10px; border-radius: 999px; font-weight: 600;
}
.preview-btn.ghost { background: transparent; }
.preview-glow {
  position: absolute; inset: 0; pointer-events: none; opacity: .9;
}

.card-meta {
  padding: 11px 14px; display: flex; align-items: center; gap: 9px;
  border-top: 1px solid var(--border-soft);
}
.card-meta .avatar { width: 18px; height: 18px; border-radius: 50%; flex: none; }
.card-title { font-size: 13px; font-weight: 600; letter-spacing: -0.01em; }
.card-cat { font-size: 11px; color: var(--ink-faint); margin-left: auto; }
.card-flags { display: flex; gap: 5px; }
.flag {
  font-size: 9px; padding: 2px 6px; border-radius: 5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em;
}
.flag.pro { background: #2a2410; color: #e8c04b; }
.flag.feat { background: #10221a; color: #5eead4; }

/* ---------- Detail overlay ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  padding: 30px;
}
.overlay-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.62); backdrop-filter: blur(6px);
}
.detail {
  position: relative;
  width: min(1240px, 96vw); height: min(800px, 92vh);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px; overflow: hidden;
  display: grid; grid-template-columns: 1fr 430px;
  box-shadow: 0 40px 120px rgba(0,0,0,.6);
}
.detail-preview {
  position: relative; overflow: hidden;
  padding: 48px 56px; display: flex; flex-direction: column;
}
.detail-nav {
  display: flex; gap: 22px; align-items: center; font-size: 12px;
  margin-bottom: auto; opacity: .8;
}
.detail-nav .logo { font-weight: 700; letter-spacing: .05em; }
.detail-nav .links { display: flex; gap: 18px; margin-left: auto; }
.detail-headline {
  font-size: 60px; line-height: 1.0; letter-spacing: -0.03em;
  font-weight: 700; white-space: pre-line; margin: 0 0 18px;
}
.detail-headline .accent { display: block; }
.detail-sub { font-size: 15px; line-height: 1.5; max-width: 58%; opacity: .76; margin-bottom: 26px; }
.detail-cta { display: flex; gap: 12px; }
.detail-btn {
  font-size: 14px; padding: 12px 22px; border-radius: 999px; font-weight: 600;
  border: none; cursor: default;
}
.detail-btn.ghost { background: transparent; border: 1px solid currentColor; }
.detail-glow { position: absolute; inset: 0; pointer-events: none; }

/* DNA panel */
.dna {
  background: var(--panel);
  border-left: 1px solid var(--border);
  overflow-y: auto; padding: 20px;
  display: flex; flex-direction: column; gap: 14px;
  color: var(--ink);
}
.dna-head { display: flex; align-items: center; gap: 10px; }
.dna-head .avatar { width: 26px; height: 26px; border-radius: 50%; flex: none; }
.dna-head .t { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; color: var(--ink); }
.dna-head .c { font-size: 12px; color: var(--ink-faint); }
.close-x {
  margin-left: auto; background: var(--panel-2); border: 1px solid var(--border);
  color: var(--ink-dim); width: 30px; height: 30px; border-radius: 8px;
  cursor: pointer; font-size: 15px;
}
.close-x:hover { color: var(--ink); }

.dna-card {
  background: var(--panel-2); border: 1px solid var(--border-soft);
  border-radius: 12px; padding: 14px;
}
.dna-card h4 {
  margin: 0 0 11px; font-size: 11px; text-transform: uppercase;
  letter-spacing: .08em; color: var(--ink-faint); font-weight: 700;
  display: flex; align-items: center; justify-content: space-between;
}
.mini-link {
  font-size: 11px; color: var(--accent); cursor: pointer;
  text-transform: none; letter-spacing: 0; font-weight: 600;
}
.mini-link:hover { text-decoration: underline; }

.type-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.type-row:last-child { margin-bottom: 0; }
.type-spec { font-size: 12px; color: var(--ink-dim); }
.type-spec b { color: var(--ink); }
.type-sample { font-size: 22px; line-height: 1; }

.swatches { display: flex; flex-direction: column; gap: 6px; }
.swatch {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  padding: 4px; border-radius: 7px;
}
.swatch:hover { background: var(--panel); }
.swatch .chip { width: 26px; height: 26px; border-radius: 7px; flex: none; border: 1px solid rgba(255,255,255,.08); }
.swatch .name { font-size: 12px; color: var(--ink-dim); }
.swatch .hex { font-size: 12px; color: var(--ink-faint); margin-left: auto; font-variant-numeric: tabular-nums; text-transform: uppercase; }

.kv { display: flex; justify-content: space-between; font-size: 12.5px; padding: 5px 0; border-bottom: 1px solid var(--border-soft); }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--ink-faint); }
.kv .v { color: var(--ink); }

.chips-list { display: flex; flex-wrap: wrap; gap: 6px; }
.chips-list span {
  font-size: 11px; padding: 4px 9px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--border-soft); color: var(--ink-dim);
}

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.action-btn {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  background: var(--panel-2); border: 1px solid var(--border);
  color: var(--ink); padding: 11px; border-radius: 10px;
  font-size: 12.5px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.action-btn:hover { border-color: var(--ink-faint); }
.action-btn.primary {
  grid-column: 1 / -1; background: var(--accent); color: #10100a; border-color: var(--accent);
  padding: 13px; font-size: 14px;
}
.action-btn.primary:hover { filter: brightness(1.05); }
.action-btn svg { width: 15px; height: 15px; }

/* Code/markdown modal */
.md-modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 40px; }
.md-modal .bk { position: absolute; inset: 0; background: rgba(0,0,0,.6); }
.md-box {
  position: relative; width: min(720px, 94vw); height: min(80vh, 700px);
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  display: flex; flex-direction: column; overflow: hidden;
}
.md-box header { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.md-box header .t { font-weight: 700; font-size: 14px; }
.md-box pre {
  margin: 0; padding: 18px; overflow: auto; flex: 1;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 12.5px;
  line-height: 1.55; color: #d6d6dd; white-space: pre-wrap;
}

/* Toast */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #10100a; padding: 11px 18px; border-radius: 10px;
  font-size: 13px; font-weight: 600; z-index: 80; box-shadow: 0 12px 40px rgba(0,0,0,.4);
  animation: toastIn .2s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } }

/* ---------- Detail: rich spec sections ---------- */
.dna.light {
  --panel: #f7f5f0;
  --panel-2: #efece5;
  --border: #ddd8cd;
  --border-soft: #e8e4da;
  --ink: #1c1b17;
  --ink-dim: #5c594f;
  --ink-faint: #8d897d;
  --accent: #1a4a3a;
}

.sec {
  background: var(--panel-2);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 14px;
}
.sec-head { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }
.sec-ic {
  width: 24px; height: 24px; border-radius: 7px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--panel); border: 1px solid var(--border-soft);
  font-size: 12px; color: var(--ink-dim);
}
.sec-head h4 { margin: 0; font-size: 14px; font-weight: 700; letter-spacing: -0.01em; color: var(--ink); }
.sec-tag { margin-left: auto; font-size: 11px; color: var(--ink-faint); }
.sec-desc { font-size: 12.5px; line-height: 1.5; color: var(--ink-dim); margin: 0 0 12px; }
.mini-link { margin-left: auto; font-size: 11px; color: var(--accent); cursor: pointer; font-weight: 600; }
.mini-link:hover { text-decoration: underline; }

/* Typography */
.type-systems { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.type-sys-label { font-size: 12px; font-weight: 600; color: var(--ink); margin-bottom: 4px; }
.type-sys-spec { font-size: 11.5px; line-height: 1.45; color: var(--ink-faint); }
.specimen-big { font-size: 34px; line-height: 1.02; color: var(--ink); margin-bottom: 14px; letter-spacing: -0.02em; }
.specimen-letters { background: var(--panel); border: 1px solid var(--border-soft); border-radius: 10px; padding: 12px; }
.spec-l { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-faint); margin-bottom: 4px; }
.spec-glyphs { font-size: 17px; line-height: 1.5; color: var(--ink); margin-bottom: 8px; word-spacing: 2px; }
.spec-glyphs:last-child { margin-bottom: 0; }

/* Palette */
.role-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.role { border-radius: 10px; overflow: hidden; border: 1px solid var(--border-soft); cursor: pointer; }
.role:hover { border-color: var(--ink-faint); }
.role-head { display: flex; justify-content: space-between; align-items: flex-end; padding: 14px 12px; min-height: 64px; font-size: 12.5px; font-weight: 700; }
.role-hex { font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; opacity: .85; }
.role-ramp { display: flex; height: 22px; }
.role-ramp span { flex: 1; }

/* Overview / spec grids */
.ov-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.spec-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.spec-grid:first-of-type { margin-top: 0; }
.ov-cell { background: var(--panel); border: 1px solid var(--border-soft); border-radius: 10px; padding: 10px 12px; }
.ov-cell.wide { grid-column: 1 / -1; }
.ov-k { font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-faint); margin-bottom: 4px; }
.ov-v { font-size: 13px; font-weight: 600; color: var(--ink); }
.ov-v.mono, .mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 10.5px; font-weight: 500; line-height: 1.5; word-break: break-word; }

/* Buttons */
.btn-samples { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.bs { padding: 9px 16px; font-size: 12.5px; font-weight: 600; border: none; cursor: default; font-family: inherit; }
.bs.ghost { background: transparent; padding: 9px 4px; }
.bs-icon { position: relative; width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; }
.bs-badge { position: absolute; top: -4px; right: -4px; min-width: 16px; height: 16px; border-radius: 999px; font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0 4px; }

/* Icons */
.icon-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ico { width: 32px; height: 32px; border-radius: 8px; background: var(--panel); border: 1px solid var(--border-soft); display: flex; align-items: center; justify-content: center; font-size: 15px; color: var(--ink-dim); }
.chip-soft { font-size: 11px; padding: 5px 10px; border-radius: 999px; background: var(--panel); border: 1px solid var(--border-soft); color: var(--ink-dim); margin-left: 2px; }

/* Spacing */
.space-group { margin-top: 12px; }
.space-group:first-of-type { margin-top: 0; }
.space-l { font-size: 12px; font-weight: 600; color: var(--ink); margin-bottom: 7px; }
.rulers { display: flex; flex-wrap: wrap; gap: 8px; }
.ruler { background: var(--panel); border: 1px solid var(--border-soft); border-radius: 9px; padding: 10px; min-width: 78px; }
.ruler-l { display: block; font-size: 12px; font-weight: 600; color: var(--ink); margin-bottom: 8px; }
.ruler-bar { display: block; height: 0; border-top: 1px solid var(--ink-faint); position: relative; }
.ruler-bar::before, .ruler-bar::after { content: ""; position: absolute; top: -3px; width: 1px; height: 7px; background: var(--ink-faint); }
.ruler-bar::before { left: 0; }
.ruler-bar::after { right: 60%; }

/* Elevation */
.surface-sample { border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin-bottom: 10px; background: linear-gradient(150deg, var(--panel), var(--panel-2)); }
.ss-l { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-faint); }
.ss-t { font-size: 19px; font-weight: 700; color: var(--ink); margin: 3px 0 6px; }
.ss-d { font-size: 11.5px; line-height: 1.45; color: var(--ink-dim); }

/* Chips */
.chips-list { display: flex; flex-wrap: wrap; gap: 6px; }
.chips-list span { font-size: 11px; padding: 4px 9px; border-radius: 999px; background: var(--panel); border: 1px solid var(--border-soft); color: var(--ink-dim); }
.chips-list.small span { font-size: 10.5px; padding: 3px 8px; }

/* Do / Don't */
.dd-l { font-size: 12px; font-weight: 700; margin: 12px 0 6px; }
.dd-l:first-child { margin-top: 0; }
.dd-l.do { color: #5ec07a; }
.dd-l.dont { color: #e8786f; }
.dna.light .dd-l.do { color: #2e7a3c; }
.dna.light .dd-l.dont { color: #c0392b; }
.dd { margin: 0; padding-left: 16px; }
.dd li { font-size: 12px; line-height: 1.5; color: var(--ink-dim); margin-bottom: 5px; }

/* Code */
.code-block { background: var(--panel); border: 1px solid var(--border-soft); border-radius: 10px; overflow: hidden; margin-top: 8px; }
.code-l { display: flex; justify-content: space-between; padding: 9px 12px; font-size: 11px; font-weight: 600; color: var(--ink-dim); text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--border-soft); }
.code-l span { text-transform: none; color: var(--ink-faint); letter-spacing: 0; }
.code-block pre { margin: 0; padding: 12px; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 10.5px; line-height: 1.55; color: var(--ink-dim); white-space: pre-wrap; word-break: break-word; max-height: 220px; overflow: auto; }

/* ---------- DESIGN.md renderer additions ---------- */
/* Grid poster preview */
.preview.poster { justify-content: flex-start; }
.poster-name { font-size: 25px; line-height: 1.05; font-weight: 700; letter-spacing: -0.02em; margin: auto 0 9px; }
.poster-swatches { display: flex; gap: 4px; margin-bottom: 9px; }
.poster-swatches span { width: 18px; height: 18px; border-radius: 5px; }

/* Detail poster (left side) */
.poster-lg { padding: 48px 52px; }
.poster-headline { font-size: 50px; line-height: 1.03; font-weight: 700; letter-spacing: -0.02em; margin: auto 0 16px; }
.poster-chips { display: flex; gap: 8px; margin-top: 4px; }
.poster-chips span { width: 38px; height: 38px; border-radius: 9px; }

/* Typography list */
.type-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.type-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 0; }
.type-sample { font-size: 24px; line-height: 1; color: var(--ink); }

/* Palette usage */
.usage-list { display: flex; flex-direction: column; gap: 3px; }
.usage-row { display: flex; align-items: center; gap: 10px; padding: 4px; border-radius: 7px; cursor: pointer; }
.usage-row:hover { background: var(--panel); }
.usage-row .chip { width: 22px; height: 22px; border-radius: 6px; border: 1px solid rgba(128,128,128,.25); flex: none; }
.usage-row .name { font-size: 12px; color: var(--ink-dim); }
.usage-row .hex { margin-left: auto; font-size: 11.5px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }

/* Components */
.comp-card { margin-top: 12px; border: 1px solid var(--border-soft); color: var(--ink-dim); font-size: 12px; background: var(--panel); }

/* Rendered markdown body */
.md-body { font-size: 12.5px; line-height: 1.55; color: var(--ink-dim); }
.md-body > :first-child { margin-top: 0; }
.md-body p { margin: 0 0 8px; }
.md-body h5 { margin: 13px 0 6px; font-size: 12px; font-weight: 700; color: var(--ink); }
.md-body ul { margin: 0 0 8px; padding-left: 16px; }
.md-body ul ul { margin: 4px 0; }
.md-body li { margin-bottom: 4px; }
.md-body b { color: var(--ink); }
.md-body code { font-family: ui-monospace, Menlo, monospace; font-size: 11px; background: var(--panel); padding: 1px 4px; border-radius: 4px; }
.md-pre { background: var(--panel); border: 1px solid var(--border-soft); border-radius: 8px; padding: 10px; font-family: ui-monospace, Menlo, monospace; font-size: 10.5px; line-height: 1.5; color: var(--ink-dim); white-space: pre-wrap; word-break: break-word; overflow: auto; max-height: 240px; margin: 6px 0; }

/* ---------- Add design ---------- */
.add-btn {
  background: var(--accent); color: #10100a; border: none;
  padding: 9px 14px; border-radius: 9px; font-size: 13px; font-weight: 700;
  cursor: pointer; font-family: inherit;
}
.add-btn:hover { filter: brightness(1.05); }
.lib-btn {
  background: var(--panel-2); color: var(--ink-dim); border: 1px solid var(--border);
  padding: 9px 14px; border-radius: 9px; font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: inherit; margin: 0 8px 0 auto;
}
.lib-btn:hover { color: var(--ink); border-color: var(--ink-faint); }

.add-box {
  position: relative; width: min(720px, 95vw); max-height: 88vh;
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  display: flex; flex-direction: column; overflow: hidden;
}
.add-box header { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.add-box header .t { font-weight: 700; font-size: 14px; }
.add-tabs { display: flex; gap: 4px; background: var(--panel-2); border-radius: 9px; padding: 3px; }
.add-tab {
  background: none; border: none; color: var(--ink-dim); font-family: inherit;
  font-size: 12.5px; font-weight: 600; padding: 6px 12px; border-radius: 7px; cursor: pointer;
}
.add-tab.active { background: var(--panel); color: var(--ink); }
.add-body { overflow-y: auto; padding: 16px; }
.add-hint { font-size: 12.5px; color: var(--ink-faint); margin: 0 0 10px; }
.add-textarea {
  width: 100%; min-height: 320px; resize: vertical; box-sizing: border-box;
  background: var(--panel-2); border: 1px solid var(--border-soft); border-radius: 10px;
  color: var(--ink); font-family: ui-monospace, Menlo, monospace; font-size: 12px;
  line-height: 1.55; padding: 12px;
}
.add-textarea:focus { outline: none; border-color: var(--ink-faint); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ff { display: flex; flex-direction: column; gap: 5px; font-size: 12px; }
.ff > span { color: var(--ink-faint); }
.ff input[type="text"] {
  background: var(--panel-2); border: 1px solid var(--border-soft); border-radius: 8px;
  color: var(--ink); font-family: inherit; font-size: 13px; padding: 8px 10px;
}
.ff input[type="text"]:focus { outline: none; border-color: var(--ink-faint); }
.ff-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-faint); font-weight: 700; margin: 16px 0 8px; }
.color-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.ff.color { flex-direction: column; align-items: flex-start; }
.ff.color input[type="color"] {
  width: 100%; height: 34px; border: 1px solid var(--border-soft); border-radius: 8px;
  background: var(--panel-2); cursor: pointer; padding: 2px;
}
.add-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-top: 1px solid var(--border); }
.add-note { font-size: 12px; color: var(--ink-faint); }

/* ---------- Detail: inline live preview + top actions + gallery ---------- */
.detail-live { position: relative; overflow: hidden; }
.detail-frame { width: 100%; height: 100%; border: none; display: block; background: #fff; }
.detail-expand {
  position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border-radius: 9px;
  background: rgba(10,10,12,.6); color: #fff; border: 1px solid rgba(255,255,255,.22);
  cursor: pointer; font-size: 15px; backdrop-filter: blur(6px);
}
.detail-expand:hover { background: rgba(10,10,12,.85); }

.actions-top { display: flex; flex-wrap: wrap; gap: 7px; }
.actions-top .action-btn { padding: 8px 11px; font-size: 12px; }

.gallery-strip { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 4px; }
.g-thumb { flex: none; width: 92px; height: 64px; border-radius: 9px; overflow: hidden; border: 1px solid var(--border-soft); background: var(--panel-2); cursor: pointer; padding: 0; }
.g-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.g-thumb:hover { border-color: var(--ink-faint); }
.g-add { flex: none; width: 92px; height: 64px; border-radius: 9px; border: 1px dashed var(--border); color: var(--ink-faint); display: flex; align-items: center; justify-content: center; font-size: 22px; cursor: pointer; }
.g-add:hover { color: var(--ink); border-color: var(--ink-faint); }
.g-folder { flex: none; width: 40px; height: 64px; border-radius: 9px; border: 1px solid var(--border-soft); background: var(--panel-2); color: var(--ink-faint); cursor: pointer; font-size: 16px; }
.g-folder:hover { color: var(--ink); border-color: var(--ink-faint); }

.lightbox { position: fixed; inset: 0; z-index: 85; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 30px; }
.lightbox .bk { position: absolute; inset: 0; background: rgba(0,0,0,.86); backdrop-filter: blur(6px); }
.lb-stage { position: relative; z-index: 1; display: flex; align-items: center; }
.lb-main { max-width: 78vw; max-height: 68vh; display: flex; }
.lb-img { max-width: 78vw; max-height: 68vh; object-fit: contain; border-radius: 8px; }
.lb-nav { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.22); color: #fff; width: 44px; height: 44px; border-radius: 50%; font-size: 22px; cursor: pointer; margin: 0 18px; flex: none; }
.lb-nav:hover { background: rgba(255,255,255,.18); }
.lb-close { position: absolute; top: 22px; right: 22px; z-index: 2; }
.lb-foot { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 20px; }
.lb-strip { display: flex; gap: 8px; max-width: 80vw; overflow-x: auto; padding: 4px; }
.lb-strip img { width: 70px; height: 48px; object-fit: cover; border-radius: 6px; cursor: pointer; opacity: .5; border: 2px solid transparent; }
.lb-strip img.active { opacity: 1; border-color: var(--accent); }
.lb-del { padding: 6px 14px; }

/* ---------- Live site preview ---------- */
.site-overlay { position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,.72); backdrop-filter: blur(6px); display: flex; flex-direction: column; padding: 22px; }
.site-bar { display: flex; align-items: center; gap: 14px; padding: 0 4px 14px; }
.site-title { font-size: 13px; color: var(--ink-dim); }
.site-widths { display: flex; gap: 4px; background: var(--panel-2); border-radius: 8px; padding: 3px; margin-left: auto; }
.site-widths button { background: none; border: none; color: var(--ink-dim); font-family: inherit; font-size: 12.5px; font-weight: 600; padding: 5px 12px; border-radius: 6px; cursor: pointer; }
.site-widths button.active { background: var(--panel); color: var(--ink); }
.site-stage { flex: 1; display: flex; justify-content: center; overflow: auto; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; }
.site-frame { width: 100%; height: 100%; border: none; border-radius: 14px; background: #fff; transition: max-width .2s ease; }
.site-frame.mobile { max-width: 420px; border-left: 1px solid var(--border); border-right: 1px solid var(--border); border-radius: 0; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #26262e; border-radius: 10px; border: 2px solid var(--panel); }
::-webkit-scrollbar-track { background: transparent; }
