/* ==========================================================================
   EndlessSkys workspace — single stylesheet.
   Layer 1 — base tokens, set by app.js from the THEMES table:
     --bg --surface --ink --accent --on-accent --font-body --font-head --r --r-sm
   Layer 2 — derived colors (below), computed from layer 1.
   Layer 3 — style tokens (below, defaults) that each theme's personality block
     at the end of this file overrides: borders, shadows, buttons, headings, texture.
   Components only use tokens, so every theme restyles everything consistently.
   ========================================================================== */

:root, .tok {
  /* style tokens — defaults; themes override these */
  --border: 1px; --border-style: solid; --card-line: var(--line); --card-line-hover: var(--line-strong);
  --card-bg: var(--surface); --card-shadow: var(--shadow-sm); --card-shadow-hover: var(--shadow); --lift: translateY(-2px); --blur: none;
  --chrome-bg: var(--surface); --chrome-border: 1px;
  --btn-r: var(--r-sm); --btn-border: 1px; --btn-case: none; --btn-tracking: 0; --btn-weight: 600; --btn-font: var(--font-body); --btn-size: 13.5px;
  --primary-bg: var(--accent); --primary-ink: var(--on-accent); --primary-shadow: 0 6px 16px -8px var(--accent);
  --cta-r: 99px; --pill-r: 99px;
  --head-weight: 800; --head-tracking: -.025em; --head-case: none; --head-style: normal;
  --eyebrow-font: var(--font-body); --eyebrow-tracking: .1em; --eyebrow-case: uppercase; --eyebrow-style: normal;
  --texture: none; --texture-size: auto;
  --hero-bg: linear-gradient(120deg, color-mix(in srgb, var(--accent) 22%, var(--surface)), var(--surface) 70%);
  /* derived colors */
  --muted: color-mix(in srgb, var(--ink) 58%, var(--surface));
  --faint: color-mix(in srgb, var(--ink) 38%, var(--surface));
  --line: color-mix(in srgb, var(--ink) 11%, var(--surface));
  --line-strong: color-mix(in srgb, var(--ink) 20%, var(--surface));
  --surface-2: color-mix(in srgb, var(--bg) 55%, var(--surface));
  --soft: color-mix(in srgb, var(--accent) 13%, var(--surface));
  --soft-2: color-mix(in srgb, var(--accent) 22%, var(--surface));
  --accent-ink: color-mix(in srgb, var(--accent) 78%, var(--ink));
  --shadow-sm: 0 1px 2px color-mix(in srgb, var(--ink) 8%, transparent);
  --shadow: 0 1px 2px color-mix(in srgb, var(--ink) 6%, transparent), 0 8px 24px -12px color-mix(in srgb, var(--ink) 22%, transparent);
  --shadow-lg: 0 24px 60px -20px color-mix(in srgb, var(--ink) 40%, transparent);
  --ok: #1f9d6b; --warn: #d98a1c; --danger: #d64545;
}

:root {
  --bg: #eef6fc; --surface: #fff; --ink: #1d3448; --accent: #2f86c8; --on-accent: #fff;
  --font-body: 'DM Sans', system-ui, sans-serif; --font-head: 'Manrope', system-ui, sans-serif;
  --r: 14px; --r-sm: calc(var(--r) * .6);
  --sidebar: 256px;
  color-scheme: light;
}
:root[data-mode="dark"] { color-scheme: dark; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; color: var(--ink);
  background-color: var(--bg); background-image: var(--texture); background-size: var(--texture-size); background-attachment: fixed;
  font: 14px/1.5 var(--font-body); -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-head); font-weight: var(--head-weight); letter-spacing: var(--head-tracking); text-transform: var(--head-case); font-style: var(--head-style); line-height: 1.15; margin: 0; }
p { margin: 0; }
a { color: var(--accent-ink); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img, video { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 30;
  background: var(--chrome-bg); border-right: var(--chrome-border) solid var(--line); backdrop-filter: var(--blur);
  display: flex; flex-direction: column; padding: 20px 14px 16px; overflow-y: auto;
  transition: transform .25s ease;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 22px; text-decoration: none; color: var(--ink); }
.brand-mark { width: 38px; height: 38px; border-radius: calc(var(--r) * .75); object-fit: cover; box-shadow: var(--shadow-sm); flex: none; }
.brand-name { font: 800 17px/1.1 var(--font-head); letter-spacing: -.03em; }
.brand-name span { font-weight: 500; color: var(--accent-ink); }
.brand small { display: block; font: 600 10px/1.4 var(--font-body); letter-spacing: .12em; color: var(--faint); margin-top: 3px; text-transform: uppercase; }

.side-label { display: flex; align-items: center; justify-content: space-between; font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); padding: 0 10px; margin: 18px 0 6px; }
.side-label .icon-btn { width: 24px; height: 24px; font-size: 16px; }
.nav { display: grid; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; height: 38px; padding: 0 10px; width: 100%;
  border: 0; border-radius: var(--btn-r); background: transparent; color: var(--muted);
  font-weight: 500; text-align: left; text-decoration: none; transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.active { background: var(--soft); color: var(--accent-ink); font-weight: 600; }
.nav-item .ico { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav-item .count { margin-left: auto; font-size: 11.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.nav-item.active .count { color: var(--accent-ink); }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--accent); }

.sidebar-foot { margin-top: auto; padding-top: 18px; display: grid; gap: 12px; }
.storage { display: block; color: inherit; text-decoration: none; transition: border-color .15s; }
.storage:hover { border-color: var(--line-strong); }
.storage { background: var(--surface-2); border: var(--border) var(--border-style) var(--card-line); border-radius: var(--r-sm); padding: 12px 13px; font-size: 12px; }
.storage-head { display: flex; justify-content: space-between; font-weight: 600; }
.storage-head span:last-child { color: var(--muted); font-weight: 500; }
.meter { height: 5px; border-radius: 9px; background: var(--line); margin: 9px 0 7px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--accent); border-radius: inherit; width: 0; transition: width .4s; }
.storage p { color: var(--muted); font-size: 11.5px; }
.profile { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 8px; border: 0; border-top: 1px solid var(--line); background: none; text-align: left; border-radius: 0; }
.profile:hover strong { color: var(--accent-ink); }
.avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex: none; }
.profile span { display: grid; min-width: 0; }
.profile strong { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile small { font-size: 11.5px; color: var(--muted); }

/* ---------- Main + topbar ---------- */
.main { margin-left: var(--sidebar); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px;
  height: 64px; padding: 0 32px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: var(--chrome-border) solid var(--line);
}
.icon-btn.menu-toggle { display: none; }
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); min-width: 0; flex: 1 1 auto; }
.crumbs a, .crumbs span { flex: none; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); }
.crumbs strong { color: var(--ink); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.search {
  display: flex; align-items: center; gap: 8px; height: 38px; width: min(300px, 32vw); padding: 0 10px 0 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--btn-r); color: var(--muted);
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--soft); }
.search input { border: 0; outline: 0; background: none; flex: 1; min-width: 0; width: 100%; color: var(--ink); }
.search input::-webkit-search-cancel-button { cursor: pointer; }
.search input::placeholder { color: var(--faint); }
kbd { font: 600 10.5px var(--font-body); color: var(--faint); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; background: var(--surface-2); white-space: nowrap; }
.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 38px; height: 38px; flex: none;
  border: var(--btn-border) solid var(--line); background: var(--surface); color: var(--muted); border-radius: var(--btn-r);
  transition: color .15s, border-color .15s, background .15s;
}
.icon-btn:hover { color: var(--ink); border-color: var(--line-strong); }
.icon-btn.plain { border-color: transparent; background: transparent; }
.icon-btn .ico { width: 18px; height: 18px; }
.icon-btn .badge { position: absolute; top: 7px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 2px var(--surface); }

.page { width: 100%; max-width: 1240px; margin: 0 auto; padding: 32px 32px 64px; flex: 1; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 26px; }
.eyebrow { font: 700 11.5px/1.4 var(--eyebrow-font); letter-spacing: var(--eyebrow-tracking); text-transform: var(--eyebrow-case); font-style: var(--eyebrow-style); color: var(--accent-ink); margin-bottom: 8px; }
.page-head h1 { font-size: clamp(26px, 3vw, 34px); }
.page-head .sub { color: var(--muted); margin-top: 8px; font-size: 15px; max-width: 62ch; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- Buttons, inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 15px;
  border-radius: var(--btn-r); border: var(--btn-border) solid var(--line-strong); background: var(--surface); color: var(--ink);
  font-family: var(--btn-font); font-weight: var(--btn-weight); font-size: var(--btn-size); text-transform: var(--btn-case); letter-spacing: var(--btn-tracking); text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s, box-shadow .15s;
}
.btn:hover { border-color: var(--faint); background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn .ico { width: 16px; height: 16px; }
.btn.primary { background: var(--primary-bg); border-color: transparent; color: var(--primary-ink); box-shadow: var(--primary-shadow); }
.btn.primary:hover { background: var(--primary-bg); border-color: transparent; filter: brightness(.93) saturate(1.1); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: color-mix(in srgb, var(--danger) 10%, var(--surface)); border-color: var(--danger); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent-ink); font-weight: 600; font-size: 13px; text-decoration: none; }
.link-btn:hover { text-decoration: underline; }

.field { display: grid; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--ink); }
.field small, .hint { font-weight: 400; color: var(--muted); font-size: 12px; }
.input, .field input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="range"]):not([type="file"]), .field select, .field textarea, .select {
  width: 100%; height: 40px; padding: 0 12px; border-radius: var(--r-sm); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); font-weight: 400; font-size: 14px; outline: 0; transition: border-color .15s, box-shadow .15s;
}
.field textarea, textarea.input { height: auto; min-height: 92px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--soft); }
.select { height: 36px; width: auto; padding-right: 30px; font-size: 13px; font-weight: 500; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
.field select { appearance: none; padding-right: 32px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
input[type="color"] { width: 100%; height: 40px; padding: 3px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); cursor: pointer; }
input[type="file"] { font-size: 13px; color: var(--muted); }
input[type="file"]::file-selector-button { margin-right: 10px; height: 34px; padding: 0 12px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--ink); font-weight: 600; cursor: pointer; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .wide { grid-column: 1 / -1; }
.stack { display: grid; gap: 14px; }

.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: calc(var(--btn-r) + 3px); }
.seg button { border: 0; background: none; height: 30px; padding: 0 12px; border-radius: var(--btn-r); color: var(--muted); font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.seg .ico { width: 15px; height: 15px; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 20px; }
.toolbar .spacer { flex: 1; }

.tag { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: var(--pill-r); font-size: 11.5px; font-weight: 600; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.tag.green { background: color-mix(in srgb, var(--ok) 12%, var(--surface)); color: color-mix(in srgb, var(--ok) 80%, var(--ink)); border-color: transparent; }
.tag.orange { background: color-mix(in srgb, var(--warn) 14%, var(--surface)); color: color-mix(in srgb, var(--warn) 75%, var(--ink)); border-color: transparent; }
.tag.accent { background: var(--soft); color: var(--accent-ink); border-color: transparent; }
.tag.example { background: transparent; border-style: dashed; color: var(--faint); }
.vis { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.vis::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.vis.public::before { background: var(--ok); }

/* ---------- Panels, sections ---------- */
.panel { background: var(--card-bg); border: var(--border) var(--border-style) var(--card-line); box-shadow: var(--card-shadow); backdrop-filter: var(--blur); border-radius: var(--r); padding: 20px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-head h2 { font-size: 16px; display: flex; align-items: baseline; gap: 8px; }
.section-head h2 span { font: 500 12.5px var(--font-body); color: var(--muted); letter-spacing: 0; }
.section { margin-top: 34px; }
.empty { display: grid; place-items: center; text-align: center; gap: 8px; padding: 36px 20px; border: 1.5px dashed var(--line-strong); border-radius: var(--r); color: var(--muted); background: color-mix(in srgb, var(--surface) 50%, transparent); }
.empty strong { color: var(--ink); font-size: 15px; }
.empty .btn { margin-top: 6px; }

/* ---------- Home ---------- */
.hero-card {
  position: relative; overflow: hidden; border-radius: calc(var(--r) * 1.3); padding: 34px 36px; margin-bottom: 26px;
  background: var(--hero-bg); border: var(--border) var(--border-style) var(--card-line); box-shadow: var(--card-shadow); backdrop-filter: var(--blur); display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap;
}
.hero-card::after { content: ""; position: absolute; right: -80px; top: -120px; width: 380px; height: 380px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--accent) 30%, transparent), transparent 65%); pointer-events: none; }
.hero-card > * { position: relative; z-index: 1; }
.hero-card h1 { font-size: clamp(26px, 3.2vw, 36px); }
.hero-card .sub { color: var(--muted); margin-top: 8px; font-size: 15px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 8px; }
.stat { background: var(--card-bg); border: var(--border) var(--border-style) var(--card-line); box-shadow: var(--card-shadow); backdrop-filter: var(--blur); border-radius: var(--r); padding: 16px 18px; text-decoration: none; color: inherit; transition: border-color .15s, transform .15s; }
a.stat:hover { border-color: var(--accent); transform: var(--lift); box-shadow: var(--card-shadow-hover); }
.stat-top { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.stat-top .ico { width: 18px; height: 18px; color: var(--accent); }
.stat strong { display: block; font: 800 28px/1 var(--font-head); margin-top: 12px; letter-spacing: -.03em; }
.stat small { color: var(--muted); font-size: 12px; }
.two-col { display: grid; grid-template-columns: 1.35fr 1fr; gap: 18px; align-items: start; }

.activity { display: grid; gap: 2px; }
.activity-item { display: flex; gap: 12px; align-items: flex-start; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.activity-item:last-child { border-bottom: 0; }
.activity-ico { width: 30px; height: 30px; border-radius: 50%; background: var(--soft); color: var(--accent-ink); display: grid; place-items: center; flex: none; }
.activity-ico .ico { width: 15px; height: 15px; }
.activity-item p { font-size: 13.5px; }
.activity-item time { font-size: 12px; color: var(--muted); }

/* ---------- Project cards ---------- */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.pcard {
  position: relative; display: flex; flex-direction: column; background: var(--card-bg); border: var(--border) var(--border-style) var(--card-line); box-shadow: var(--card-shadow); backdrop-filter: var(--blur);
  border-radius: var(--r); overflow: hidden; color: inherit; text-decoration: none;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s;
}
.pcard:hover { transform: var(--lift); box-shadow: var(--card-shadow-hover); border-color: var(--card-line-hover); }
.pcard-art { position: relative; aspect-ratio: 16 / 8.5; overflow: hidden; }
.pcard-art .art-label { position: absolute; left: 16px; bottom: 13px; z-index: 2; color: #fff; font: 800 19px var(--font-head); letter-spacing: -.02em; text-shadow: 0 1px 10px rgba(0,0,0,.25); }
.pcard-body { padding: 15px 16px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.pcard-title { display: flex; align-items: center; gap: 8px; padding-right: 30px; }
.pcard-title strong { font-family: var(--font-head); font-size: 15.5px; font-weight: var(--head-weight); font-style: var(--head-style); text-transform: var(--head-case); letter-spacing: var(--head-tracking); }
.pcard-desc { color: var(--muted); font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pcard-meta { display: flex; align-items: center; gap: 10px; margin-top: auto; padding-top: 10px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.pcard-meta .time { margin-left: auto; }
.pcard-link { color: inherit; text-decoration: none; }
.pcard-link::after { content: ""; position: absolute; inset: 0; z-index: 2; }
.pcard-link:focus-visible { outline: none; }
.pcard:has(.pcard-link:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.art-kicker { position: absolute; left: 12px; top: 12px; z-index: 2; padding: 3px 9px; border-radius: var(--pill-r); background: rgba(255,255,255,.82); color: #1d2733; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; backdrop-filter: blur(6px); }
.bgimg { position: absolute; inset: 0; z-index: 0; background-size: cover; background-position: center; }
.pcard-menu { position: absolute; z-index: 3; right: 10px; top: 10px; width: 32px; height: 32px; border-radius: var(--r-sm); border: 0; display: grid; place-items: center; background: color-mix(in srgb, #fff 80%, transparent); color: #1d2733; backdrop-filter: blur(6px); opacity: 0; transition: opacity .15s; }
.pcard:hover .pcard-menu, .pcard-menu:focus-visible, .pcard-menu[aria-expanded="true"] { opacity: 1; }
.pcard-menu .ico { width: 16px; height: 16px; }
@media (hover: none) { .pcard-menu { opacity: 1; } }

.project-grid.list { grid-template-columns: 1fr; gap: 10px; }
.project-grid.list .pcard { flex-direction: row; align-items: stretch; }
.project-grid.list .pcard-art { width: 170px; aspect-ratio: auto; flex: none; }
.project-grid.list .pcard-art .art-label { display: none; }
.project-grid.list .pcard-menu { opacity: 1; background: var(--surface-2); color: var(--muted); top: 50%; transform: translateY(-50%); }

.art { position: absolute; inset: 0; width: 100%; height: 100%; }
.cover-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }

/* ---------- Files ---------- */
.file-list { display: grid; }
.file-row {
  display: grid; grid-template-columns: 40px minmax(0, 1fr) auto auto; align-items: center; gap: 14px;
  padding: 10px 12px; border-radius: var(--r-sm); text-decoration: none; color: inherit; cursor: pointer; border: 0; background: none; width: 100%; text-align: left;
}
.file-row:hover { background: var(--surface-2); }
.file-row + .file-row { border-top: 1px solid var(--line); }
.file-row:hover, .file-row:hover + .file-row { border-top-color: transparent; }
.ficon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font: 800 10px var(--font-body); letter-spacing: .04em; color: var(--fc, #5677a8); background: color-mix(in srgb, var(--fc, #5677a8) 14%, var(--surface)); flex: none; }
.ficon[data-k="img"] { --fc: #2f8fd0; } .ficon[data-k="vid"] { --fc: #c0504d; } .ficon[data-k="zip"] { --fc: #c27c1a; }
.ficon[data-k="doc"] { --fc: #3e8e63; } .ficon[data-k="code"] { --fc: #7a5ac7; } .ficon[data-k="audio"] { --fc: #c2477f; }
.fmeta { min-width: 0; }
.fname { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; min-width: 0; }
.fname span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fsub { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fsize { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; min-width: 60px; }
.file-list.grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.file-list.grid .file-row { grid-template-columns: 1fr; gap: 10px; padding: 16px; background: var(--card-bg); border: var(--border) var(--border-style) var(--card-line); box-shadow: var(--card-shadow); backdrop-filter: var(--blur); border-radius: var(--r); }
.file-list.grid .file-row + .file-row { border-top: var(--border) var(--border-style) var(--card-line); }
.file-list.grid .ficon { width: 48px; height: 48px; }
.file-list.grid .fsize { text-align: left; }
.file-list.grid .vis { display: none; }

/* ---------- Project detail ---------- */
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.detail-cover { position: relative; aspect-ratio: 16 / 6.5; border-radius: var(--r); overflow: hidden; border: var(--border) var(--border-style) var(--card-line); box-shadow: var(--card-shadow); margin-bottom: 20px; }
.detail-cover .art-label { position: absolute; left: 26px; bottom: 22px; z-index: 2; color: #fff; text-shadow: 0 2px 14px rgba(0,0,0,.25); }
.detail-cover .art-label small { display: block; font: 700 11px var(--font-body); letter-spacing: .14em; text-transform: uppercase; opacity: .9; }
.detail-cover .art-label strong { font: 800 clamp(26px, 4vw, 40px) var(--font-head); letter-spacing: -.03em; }
.info-card dl { display: grid; gap: 14px; margin: 0; }
.info-card dt { font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--faint); }
.info-card dd { margin: 3px 0 0; font-size: 14px; }
.info-card .desc { color: var(--muted); margin: 8px 0 16px; }
.share-box { display: flex; align-items: center; gap: 6px; margin-top: 6px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 4px 4px 4px 10px; }
.share-box a { flex: 1; min-width: 0; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: none; }
.share-box a:hover { text-decoration: underline; }
.notes textarea { width: 100%; min-height: 130px; border: 1px dashed var(--line-strong); border-radius: var(--r-sm); padding: 12px; background: var(--surface-2); resize: vertical; outline: 0; line-height: 1.55; }
.notes textarea:focus { border-color: var(--accent); border-style: solid; background: var(--surface); }
.private-tag { display: inline-flex; align-items: center; gap: 5px; }
.private-tag .ico { width: 13px; height: 13px; }
.saved-hint { font-size: 12px; color: var(--muted); transition: opacity .3s; }

/* ---------- Servers ---------- */
.note-bar { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r); background: var(--soft); color: var(--ink); margin-bottom: 20px; font-size: 13.5px; }
.note-bar .ico { width: 18px; height: 18px; color: var(--accent-ink); flex: none; margin-top: 1px; }
.server-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.server-card { display: flex; flex-direction: column; gap: 10px; }
.server-card .top { display: flex; align-items: center; gap: 10px; }
.server-card .sico { width: 40px; height: 40px; border-radius: 10px; background: var(--soft); color: var(--accent-ink); display: grid; place-items: center; }
.server-card .sico .ico { width: 20px; height: 20px; }
.server-card h3 { font-size: 16px; }
.server-card .game { color: var(--muted); font-size: 13px; }
.addr { display: flex; align-items: center; gap: 8px; font: 500 13px ui-monospace, 'JetBrains Mono', Consolas, monospace; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 10px; }
.addr span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.server-card .notes-text { font-size: 13px; color: var(--muted); white-space: pre-wrap; }
.server-card footer { display: flex; gap: 8px; margin-top: auto; padding-top: 6px; flex-wrap: wrap; }

/* ---------- Settings ---------- */
.settings { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.settings .panel { display: grid; gap: 14px; align-content: start; }
.settings .wide { grid-column: 1 / -1; }
.settings h2 { font-size: 16px; }
.settings p.hint { margin-top: -6px; }

.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.theme-opt { position: relative; display: grid; gap: 7px; cursor: pointer; font-size: 12.5px; font-weight: 600; }
.theme-opt input { position: absolute; opacity: 0; }
/* A swatch is a miniature of the theme: it carries data-theme, so it shows the real
   texture, heading font, card shape, shadow and button style of that theme. */
.swatch {
  height: 96px; border-radius: 10px; overflow: hidden; border: 2px solid var(--line);
  background-color: var(--bg); background-image: var(--texture); background-size: var(--texture-size);
  display: grid; grid-template-columns: 24% 1fr; transition: border-color .15s, transform .15s;
}
.theme-opt:hover .swatch { transform: translateY(-1px); }
.theme-opt input:checked + .swatch { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.theme-opt input:focus-visible + .swatch { outline: 2px solid var(--accent); outline-offset: 2px; }
.swatch .sw-side { background: var(--chrome-bg); border-right: var(--chrome-border) solid var(--line); padding: 9px 5px; display: grid; gap: 5px; align-content: start; }
.swatch .sw-side i { height: 4px; border-radius: 3px; background: var(--line-strong); }
.swatch .sw-side i:first-child { background: var(--accent); }
.swatch .sw-main { padding: 7px 10px 10px; display: grid; gap: 5px; align-content: start; min-width: 0; }
.swatch .sw-main b { font-family: var(--font-head); font-weight: var(--head-weight); font-style: var(--head-style); text-transform: var(--head-case); letter-spacing: var(--head-tracking); font-size: 19px; line-height: 1.1; color: var(--ink); }
.swatch .sw-card { height: 34px; border-radius: min(var(--r), 10px); background: var(--card-bg); border: var(--border) var(--border-style) var(--card-line); box-shadow: var(--card-shadow); display: flex; align-items: flex-end; justify-content: space-between; gap: 6px; padding: 5px 6px; margin-right: 6px; }
.swatch .sw-card em { height: 4px; flex: 1; border-radius: 3px; background: var(--line-strong); align-self: center; }
.swatch .sw-card u { width: 28px; height: 10px; flex: none; border-radius: min(var(--btn-r), 6px); background: var(--primary-bg); box-shadow: var(--primary-shadow); }
.theme-name { display: grid; gap: 1px; line-height: 1.3; }
.theme-name small { font-weight: 400; font-size: 11px; color: var(--muted); }
.inspector .theme-name small { display: none; }

/* ---------- Modal, menu, toast ---------- */
.backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: color-mix(in srgb, #0b1420 45%, transparent); backdrop-filter: blur(3px); opacity: 0; pointer-events: none; transition: opacity .18s; }
.backdrop.open { opacity: 1; pointer-events: auto; }
.modal {
  width: min(560px, 100%); max-height: calc(100vh - 40px); overflow: auto; background: var(--surface); color: var(--ink);
  border-radius: calc(var(--r) * 1.15); box-shadow: var(--shadow-lg); border: var(--border) solid var(--card-line);
  transform: translateY(8px) scale(.98); transition: transform .2s ease;
}
.modal.wide { width: min(820px, 100%); }
.backdrop.open .modal { transform: none; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 22px 24px 0; }
.modal-head h2 { font-size: 19px; }
.modal-head p { color: var(--muted); margin-top: 5px; font-size: 13.5px; }
.modal-body { padding: 18px 24px; display: grid; gap: 14px; }
.modal-foot { display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding: 14px 24px 20px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--surface); }
.modal-foot .left { margin-right: auto; }
details.more { border: 1px solid var(--line); border-radius: var(--r-sm); }
details.more summary { cursor: pointer; padding: 11px 14px; font-weight: 600; font-size: 13.5px; display: flex; justify-content: space-between; list-style: none; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::after { content: "+"; color: var(--muted); font-size: 17px; line-height: 1; }
details.more[open] summary::after { content: "–"; }
details.more summary span { color: var(--faint); font-weight: 500; font-size: 12px; margin-left: auto; margin-right: 12px; }
details.more > div { padding: 4px 14px 14px; }
.dropzone { position: relative; display: grid; place-items: center; gap: 4px; text-align: center; padding: 30px 16px; border: 1.5px dashed var(--line-strong); border-radius: var(--r); background: var(--surface-2); color: var(--muted); cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--soft); }
.dropzone strong { color: var(--ink); font-size: 15px; }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone .ico { width: 26px; height: 26px; color: var(--accent); }
.picked { display: grid; gap: 4px; font-size: 12.5px; color: var(--muted); max-height: 120px; overflow: auto; }
.preview-box { border-radius: var(--r-sm); overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); }
.preview-box img, .preview-box video { margin: auto; max-height: 60vh; object-fit: contain; }
.preview-box pre, pre.code { margin: 0; max-height: 60vh; overflow: auto; padding: 16px; font: 12.5px/1.6 ui-monospace, 'JetBrains Mono', Consolas, monospace; white-space: pre-wrap; word-break: break-word; }
.preview-box audio { width: 100%; margin: 20px 0; }
.preview-box iframe { width: 100%; height: 60vh; border: 0; background: #fff; }

.menu { position: fixed; z-index: 120; min-width: 190px; padding: 5px; background: var(--surface); border: var(--border) solid var(--card-line); border-radius: var(--r-sm); box-shadow: var(--shadow-lg); display: grid; }
.menu button, .menu a { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border: 0; background: none; border-radius: calc(var(--r-sm) - 2px); text-align: left; font-size: 13.5px; color: var(--ink); text-decoration: none; }
.menu button:hover, .menu a:hover { background: var(--surface-2); }
.menu .danger { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 2px; }
.menu .ico { width: 16px; height: 16px; color: var(--muted); }
.menu .danger .ico { color: var(--danger); }

.toast { position: fixed; z-index: 200; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: var(--ink); color: var(--surface); padding: 11px 18px; border-radius: 99px; font-weight: 600; font-size: 13.5px; box-shadow: var(--shadow-lg); transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.help-list { display: grid; gap: 12px; }
.help-list div { display: grid; grid-template-columns: 30px 1fr; gap: 10px; align-items: start; font-size: 13.5px; color: var(--muted); }
.help-list strong { color: var(--ink); display: block; }
.help-list .ico { width: 20px; height: 20px; color: var(--accent); margin-top: 2px; }

.ico { display: inline-block; vertical-align: middle; }

/* ---------- Preview chrome (owner/visitor toolbar) ---------- */
body.chromeless .sidebar, body.chromeless .topbar { display: none; }
body.chromeless .main { margin-left: 0; }
body.chromeless .page { max-width: none; padding: 0; }
.preview-bar {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 18px; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
}
.preview-bar .who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.preview-bar .who img { width: 28px; height: 28px; border-radius: 8px; object-fit: cover; }
.preview-bar .who strong { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preview-bar .actions { margin-left: auto; }
.notice { display: flex; align-items: center; gap: 10px; justify-content: center; padding: 10px 18px; background: color-mix(in srgb, var(--warn) 15%, var(--surface)); color: var(--ink); font-size: 13px; text-align: center; border-bottom: 1px solid var(--line); }
.notice .ico { width: 16px; height: 16px; color: var(--warn); }

.missing { max-width: 560px; margin: 12vh auto; padding: 36px; text-align: center; display: grid; gap: 14px; justify-items: center; }
.missing h1 { font-size: 26px; }
.missing p { color: var(--muted); }
.missing code { background: var(--surface-2); padding: 1px 6px; border-radius: 5px; }

/* ==========================================================================
   Public project pages (.site). Tokens are set inline per project.
   ========================================================================== */
.site { --w: 980px; background-color: var(--bg); background-image: var(--texture); background-size: var(--texture-size); color: var(--ink); font-family: var(--font-body); min-height: 100%; position: relative; }
.site.layout-wide { --w: 1240px; }
.site.layout-minimal { --w: 720px; }
.site h1, .site h2, .site h3 { font-family: var(--font-head); color: var(--ink); }
.site a { color: var(--accent-ink); }
.site-wrap { width: min(var(--w), calc(100% - 40px)); margin: 0 auto; }
.site-nav { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 0; }
.site-nav .brand-txt { font: 800 17px var(--font-head); color: var(--ink); text-decoration: none; letter-spacing: -.02em; display: flex; align-items: center; gap: 10px; }
.site-nav .mono { width: 32px; height: 32px; border-radius: calc(var(--r) * .6); background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-size: 15px; }
.site-nav nav { display: flex; align-items: center; gap: 22px; }
.site-nav nav a { color: var(--muted); text-decoration: none; font-weight: 500; font-size: 14px; }
.site-nav nav a:hover { color: var(--ink); }
.cta { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 20px; border-radius: var(--cta-r); background: var(--primary-bg); color: var(--primary-ink) !important; font-weight: 700; text-transform: var(--btn-case); letter-spacing: var(--btn-tracking); text-decoration: none; font-size: 14.5px; box-shadow: var(--primary-shadow); transition: transform .15s, box-shadow .15s; }
.cta:hover { transform: translateY(-1px); filter: brightness(.94); }
.site-nav .cta { height: 36px; padding: 0 16px; font-size: 13px; }

.site-hero { position: relative; overflow: hidden; border-radius: calc(var(--r) * 1.6); margin: 6px 0 0; min-height: 380px; display: flex; align-items: flex-end; background-size: cover; background-position: center; }
.site-hero .art { z-index: 0; }
.site-hero .shade { position: absolute; inset: 0; z-index: 1; background: linear-gradient(180deg, transparent 20%, rgba(0,0,0, calc(var(--overlay, .2) + .25))); }
.site-hero .copy { position: relative; z-index: 2; padding: 48px; max-width: 760px; color: #fff; }
.site-hero .kicker { display: inline-block; font-size: 11.5px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; padding: 5px 11px; border-radius: var(--pill-r); background: rgba(255,255,255,.18); backdrop-filter: blur(6px); margin-bottom: 16px; }
.site-hero h1 { color: #fff; font-size: clamp(36px, 6vw, 68px); line-height: 1; }
.site-hero p { font-size: clamp(16px, 1.6vw, 19px); margin-top: 14px; opacity: .92; max-width: 56ch; }
.site-hero .cta { margin-top: 24px; background: #fff; color: #111 !important; box-shadow: none; }

.site-main { padding: 56px 0 30px; display: grid; gap: 28px; }
.site-lead { font-size: clamp(18px, 2vw, 22px); line-height: 1.55; color: var(--ink); max-width: 62ch; }
.site-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.site-tags span { padding: 5px 12px; border-radius: var(--pill-r); background: var(--soft); color: var(--accent-ink); font-size: 12.5px; font-weight: 600; }
.blk { max-width: 100%; }
.blk.center { text-align: center; } .blk.right { text-align: right; }
.blk-heading h2 { font-size: clamp(24px, 3vw, 34px); padding-top: 12px; }
.blk-text p { font-size: 16.5px; line-height: 1.75; color: color-mix(in srgb, var(--ink) 86%, var(--surface)); white-space: pre-wrap; max-width: 70ch; }
.blk-text.center p { margin: 0 auto; } .blk-text.right p { margin-left: auto; }
.blk-quote { margin: 0; padding: 8px 0 8px 24px; border-left: 4px solid var(--accent); font: 500 clamp(19px, 2.2vw, 24px)/1.5 var(--font-head); color: var(--ink); }
.blk-quote.center { border-left: 0; padding-left: 0; } .blk-quote.right { border-left: 0; border-right: 4px solid var(--accent); padding: 8px 24px 8px 0; }
.blk-divider { border: 0; height: 1px; background: var(--line-strong); margin: 10px 0; }
.blk-badge span { display: inline-flex; padding: 6px 14px; border-radius: var(--pill-r); background: var(--primary-bg); color: var(--primary-ink); font-weight: 700; font-size: 13px; }
.blk-media { margin: 0; }
.blk-media .media { border-radius: var(--r); overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); min-height: 160px; display: grid; place-items: center; color: var(--muted); }
.blk-media .media img, .blk-media .media video { width: 100%; height: auto; }
.blk-media.center .media { max-width: 760px; margin: 0 auto; }
.blk-media.left .media { max-width: 560px; } .blk-media.right .media { max-width: 560px; margin-left: auto; }
.blk-media figcaption { font-size: 13px; color: var(--muted); margin-top: 8px; }
.blk-media.center figcaption { text-align: center; }
.blk-code iframe { width: 100%; min-height: 420px; border: 1px solid var(--line); border-radius: var(--r); background: #fff; }

.site-files h2 { font-size: 22px; margin-bottom: 14px; }
.site-files .kick { font-size: 11px; font-weight: 700; letter-spacing: .14em; color: var(--accent-ink); text-transform: uppercase; }
.sfile-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.sfile { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r); background: var(--card-bg); border: var(--border) var(--border-style) var(--card-line); box-shadow: var(--card-shadow); backdrop-filter: var(--blur); text-decoration: none; color: var(--ink); transition: border-color .15s, transform .15s; }
.sfile:hover { border-color: var(--accent); transform: translateY(-1px); }
.sfile span:nth-child(2) { display: grid; min-width: 0; flex: 1; }
.sfile strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sfile small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sfile .ico { width: 16px; height: 16px; color: var(--muted); }
.site-empty { color: var(--muted); font-size: 14px; padding: 18px; border: 1px dashed var(--line-strong); border-radius: var(--r); }
.site-foot { display: flex; align-items: center; gap: 12px; padding: 28px 0 40px; margin-top: 30px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13.5px; }
.site-foot img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.site-foot a { margin-left: auto; color: var(--muted); text-decoration: none; }

/* Professional format */
.site.pro .pro-hero { padding: 70px 0 54px; display: grid; grid-template-columns: 1fr auto; gap: 30px; align-items: end; border-bottom: 1px solid var(--line); position: relative; }
.site.pro .pro-hero.has-bg { padding: 70px 48px 54px; border-radius: var(--r); border: 0; color: #fff; background-size: cover; background-position: center; overflow: hidden; }
.site.pro .pro-hero.has-bg::before { content: ""; position: absolute; inset: 0; background: rgba(0,0,0, calc(var(--overlay, .2) + .3)); }
.site.pro .pro-hero.has-bg > * { position: relative; }
.site.pro .pro-hero.has-bg h1, .site.pro .pro-hero.has-bg p { color: #fff; }
.site.pro .pro-hero h1 { font-size: clamp(32px, 4.6vw, 54px); max-width: 18ch; }
.site.pro .pro-hero p { font-size: 17px; color: var(--muted); margin-top: 16px; max-width: 58ch; }
.site.pro .pro-body { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 48px; padding: 44px 0; }
.site.pro .pro-body main { display: grid; gap: 26px; align-content: start; }
.site.pro aside { position: sticky; top: 80px; align-self: start; padding: 22px; border-radius: var(--r); background: var(--card-bg); border: var(--border) var(--border-style) var(--card-line); box-shadow: var(--card-shadow); backdrop-filter: var(--blur); display: grid; gap: 4px; }
.site.pro aside img { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; margin-bottom: 10px; }
.site.pro aside small { font-size: 10.5px; font-weight: 700; letter-spacing: .12em; color: var(--faint); margin-top: 10px; text-transform: uppercase; }
.site.pro aside strong { font-size: 14.5px; }
.site.pro aside .cta { margin-top: 16px; justify-content: center; }

/* Canvas format */
.site.canvas .canvas-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; padding: 34px 0 20px; flex-wrap: wrap; }
.site.canvas .canvas-head h1 { font-size: clamp(30px, 4vw, 46px); }
.site.canvas .canvas-head p { color: var(--muted); margin-top: 8px; font-size: 16px; }
.board {
  position: relative; height: 620px; border-radius: var(--r); border: 1px solid var(--line); overflow: hidden;
  background-color: var(--surface-2);
  background-image: radial-gradient(color-mix(in srgb, var(--ink) 16%, transparent) 1px, transparent 1px); background-size: 22px 22px;
}
.board svg.links { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.board svg.links path { fill: none; stroke: color-mix(in srgb, var(--accent) 60%, transparent); stroke-width: 2; stroke-dasharray: 6 6; }
.node { position: absolute; width: 220px; padding: 12px 14px; border-radius: calc(var(--r) * .8); background: var(--card-bg); border: var(--border) var(--border-style) var(--card-line); box-shadow: var(--card-shadow); backdrop-filter: var(--blur); touch-action: none; user-select: none; }
.node.editable { cursor: grab; }
.node.dragging { cursor: grabbing; box-shadow: var(--shadow-lg); z-index: 5; border-color: var(--accent); }
.node header { display: flex; align-items: center; gap: 8px; }
.node header::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); flex: none; }
.node strong { font: 700 14px var(--font-head); flex: 1; }
.node p { font-size: 13px; color: var(--muted); margin-top: 6px; white-space: pre-wrap; }
.node button { border: 0; background: none; color: var(--faint); width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center; }
.node button:hover { background: var(--surface-2); color: var(--ink); }
.node button .ico { width: 14px; height: 14px; }
.board-hint { font-size: 12.5px; color: var(--muted); margin-top: 10px; }

/* File item page */
.item-page { width: min(860px, calc(100% - 40px)); margin: 40px auto 60px; }
.item-head { display: flex; gap: 18px; align-items: center; margin-bottom: 22px; }
.item-head .ficon { width: 58px; height: 58px; font-size: 12px; border-radius: 14px; }
.item-head h1 { font-size: clamp(24px, 3vw, 32px); word-break: break-word; }
.item-head p { color: var(--muted); }
.item-body { display: grid; gap: 16px; }
.item-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-radius: var(--r); background: var(--card-bg); border: var(--border) var(--border-style) var(--card-line); box-shadow: var(--card-shadow); backdrop-filter: var(--blur); flex-wrap: wrap; }
.item-foot span { color: var(--muted); font-size: 13px; }

/* ==========================================================================
   Page designer
   ========================================================================== */
.builder { display: grid; grid-template-columns: minmax(0, 1fr) clamp(300px, 32vw, 380px); height: calc(100vh - 58px); }
.builder-stage { overflow: auto; background: var(--surface-2); padding: 18px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.stage-bar { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.stage-bar .live { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; font-size: 11px; color: var(--accent-ink); }
.stage-bar .live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.stage-bar .seg { margin-left: auto; }
.stage-frame { border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--line); margin: 0 auto; width: 100%; transition: max-width .25s ease; background: var(--bg); }
.stage-frame.mobile { max-width: 400px; }
.stage-frame .site-hero { min-height: 300px; }
.inspector { background: var(--surface); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.tabs { display: flex; gap: 2px; padding: 10px 12px 0; border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; border: 0; background: none; padding: 10px 6px; font-size: 13px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--accent-ink); border-bottom-color: var(--accent); }
.inspector-body { overflow-y: auto; padding: 18px; display: grid; gap: 16px; align-content: start; flex: 1; }
.inspector-body h3 { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); margin-top: 6px; }
.inspector .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.inspector .three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.inspector .theme-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
.inspector .swatch { height: 70px; }
.inspector .swatch .sw-main b { font-size: 15px; }
.inspector .swatch .sw-card { height: 24px; }
.inspector .theme-opt { font-size: 11px; }
.block-list { display: grid; gap: 10px; }
.bed { border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); padding: 10px; display: grid; gap: 10px; }
.bed.drag-over { border-color: var(--accent); box-shadow: 0 0 0 2px var(--soft); }
.bed.dragging { opacity: .45; }
.bed header { display: flex; align-items: center; gap: 8px; }
.bed header .grip { cursor: grab; color: var(--faint); display: grid; place-items: center; }
.bed header .grip .ico { width: 16px; height: 16px; }
.bed header strong { flex: 1; font-size: 13px; }
.bed header button { border: 0; background: none; width: 26px; height: 26px; border-radius: 6px; color: var(--muted); display: grid; place-items: center; }
.bed header button:hover:not(:disabled) { background: var(--surface); color: var(--ink); }
.bed header button:disabled { opacity: .3; cursor: default; }
.bed header .ico { width: 14px; height: 14px; }
.bed .field { font-size: 12px; }
.bed textarea { min-height: 70px !important; }
.bed textarea.codearea { min-height: 200px !important; font: 12px/1.5 ui-monospace, 'JetBrains Mono', Consolas, monospace !important; }
.add-row { display: flex; gap: 8px; }
.add-row select { flex: 1; }
.block-palette { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.block-palette button { display: grid; justify-items: center; gap: 4px; padding: 10px 4px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); font-size: 11.5px; font-weight: 600; color: var(--muted); }
.block-palette button:hover { border-color: var(--accent); color: var(--accent-ink); background: var(--soft); }
.block-palette .ico { width: 18px; height: 18px; }
.ai-status { font-size: 12.5px; color: var(--muted); min-height: 18px; }
.ai-status.err { color: var(--danger); }
.callout { font-size: 12.5px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; }

/* ==========================================================================
   Theme personalities
   Each theme overrides style tokens (layer 3) and may add a few decorations.
   [data-theme] is set on <html> (workspace), on .site (project pages) and on
   .swatch (theme picker previews), so one block styles all three.
   To add a theme: add it to THEMES in app.js, then add a block here.
   ========================================================================== */

/* Open Sky — airy and soft: borderless cards floating on blue-tinted shadows, pill controls. */
[data-theme="sky"] {
  --border: 0px; --btn-r: 99px; --pill-r: 99px;
  --card-shadow: 0 1px 2px color-mix(in srgb, var(--accent) 10%, transparent), 0 12px 32px -16px color-mix(in srgb, var(--accent) 40%, transparent);
  --card-shadow-hover: 0 2px 4px color-mix(in srgb, var(--accent) 12%, transparent), 0 22px 44px -18px color-mix(in srgb, var(--accent) 50%, transparent);
  --texture: radial-gradient(55% 45% at 12% -8%, color-mix(in srgb, var(--accent) 20%, transparent), transparent 70%), radial-gradient(35% 30% at 85% -5%, color-mix(in srgb, #ffffff 70%, transparent), transparent 70%);
  --hero-bg: linear-gradient(165deg, color-mix(in srgb, var(--accent) 34%, var(--surface)), var(--surface) 72%);
  --chrome-bg: color-mix(in srgb, var(--surface) 92%, var(--bg));
}
[data-theme="sky"][data-mode="dark"] { --texture: radial-gradient(55% 45% at 12% -8%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%); }

/* Deep Forest — earthy serif headings, thin mossy borders, topographic contour lines. */
[data-theme="forest"] {
  --head-weight: 600; --head-tracking: -.01em; --btn-r: 6px; --pill-r: 6px; --cta-r: 6px;
  --card-line: color-mix(in srgb, var(--accent) 24%, var(--surface)); --card-line-hover: var(--accent);
  --card-shadow: 0 1px 0 color-mix(in srgb, var(--ink) 8%, transparent); --card-shadow-hover: 0 10px 24px -16px color-mix(in srgb, var(--ink) 45%, transparent);
  --eyebrow-font: var(--font-head); --eyebrow-case: none; --eyebrow-style: italic; --eyebrow-tracking: 0;
  --chrome-bg: color-mix(in srgb, var(--accent) 7%, var(--surface));
  --texture: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260' viewBox='0 0 260 260'%3E%3Cg fill='none' stroke='%233d6b47' stroke-opacity='.11' stroke-width='1.1'%3E%3Cpath d='M130 28c56 6 92 44 86 98s-48 92-98 86-88-48-82-98 38-92 94-86z'/%3E%3Cpath d='M131 56c38 4 64 32 60 70s-34 64-70 60-62-34-58-70 30-64 68-60z'/%3E%3Cpath d='M132 86c22 2 38 18 36 40s-20 38-40 36-36-20-34-40 16-38 38-36z'/%3E%3Cpath d='M-10 228c44-22 88 10 140-6s96-42 140-12'/%3E%3Cpath d='M-10 250c44-22 88 10 140-6s96-42 140-12'/%3E%3C/g%3E%3C/svg%3E");
  --texture-size: 260px 260px;
  --hero-bg: linear-gradient(135deg, color-mix(in srgb, var(--accent) 16%, var(--surface)), var(--surface) 60%);
}
[data-theme="forest"][data-mode="dark"] { --texture: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260' viewBox='0 0 260 260'%3E%3Cg fill='none' stroke='%2386cf95' stroke-opacity='.07' stroke-width='1.1'%3E%3Cpath d='M130 28c56 6 92 44 86 98s-48 92-98 86-88-48-82-98 38-92 94-86z'/%3E%3Cpath d='M131 56c38 4 64 32 60 70s-34 64-70 60-62-34-58-70 30-64 68-60z'/%3E%3Cpath d='M132 86c22 2 38 18 36 40s-20 38-40 36-36-20-34-40 16-38 38-36z'/%3E%3Cpath d='M-10 228c44-22 88 10 140-6s96-42 140-12'/%3E%3Cpath d='M-10 250c44-22 88 10 140-6s96-42 140-12'/%3E%3C/g%3E%3C/svg%3E"); }
[data-theme="forest"] :is(.panel, .stat) { border-top: 3px solid var(--accent); }

/* Solar Bloom — heavy display type, sunset gradients, warm glowing shadows. */
[data-theme="sunset"] {
  --border: 0px; --btn-r: 99px; --head-weight: 800; --head-tracking: -.035em;
  --primary-bg: linear-gradient(120deg, var(--accent), color-mix(in srgb, var(--accent) 45%, #ffb347)); --primary-ink: #fff;
  --primary-shadow: 0 10px 24px -10px color-mix(in srgb, var(--accent) 85%, transparent);
  --card-shadow: 0 14px 34px -20px color-mix(in srgb, var(--accent) 65%, transparent); --card-shadow-hover: 0 22px 44px -20px color-mix(in srgb, var(--accent) 75%, transparent);
  --texture: radial-gradient(45% 55% at 100% 0%, color-mix(in srgb, #ffb347 32%, transparent), transparent 70%), radial-gradient(45% 45% at 0% 100%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 70%);
  --hero-bg: radial-gradient(120% 150% at 100% 0%, color-mix(in srgb, #ffb347 55%, var(--surface)), color-mix(in srgb, var(--accent) 22%, var(--surface)) 45%, var(--surface) 82%);
}
[data-theme="sunset"][data-mode="dark"] { --primary-ink: #1b0f0c; }
[data-theme="sunset"] :is(.page-head h1, .hero-card h1) { font-size: clamp(30px, 3.8vw, 44px); }

/* Abyssal Ocean — translucent layered surfaces over a deepening gradient, smooth curves. */
[data-theme="ocean"] {
  --btn-r: 12px; --head-weight: 700; --head-tracking: -.02em;
  --card-bg: color-mix(in srgb, var(--surface) 86%, transparent); --blur: blur(10px);
  --card-line: color-mix(in srgb, var(--accent) 18%, var(--surface));
  --card-shadow: 0 18px 40px -28px color-mix(in srgb, var(--accent) 70%, transparent);
  --texture: linear-gradient(180deg, transparent 10%, color-mix(in srgb, var(--accent) 22%, transparent) 100%), radial-gradient(70% 40% at 50% 110%, color-mix(in srgb, var(--accent) 30%, transparent), transparent 70%);
  --hero-bg: linear-gradient(200deg, var(--surface) 30%, color-mix(in srgb, var(--accent) 28%, var(--surface)));
  --primary-bg: linear-gradient(180deg, color-mix(in srgb, var(--accent) 80%, #ffffff), var(--accent));
}
[data-theme="ocean"] .hero-card::after { width: 140%; height: 120px; right: -20%; top: auto; bottom: -70px; border-radius: 50%; background: color-mix(in srgb, var(--accent) 16%, transparent); }

/* Lavender Studio — plush, chunky, pastel: thick soft borders and bouncy offset shadows. */
[data-theme="lavender"] {
  --border: 2px; --btn-r: 99px; --pill-r: 99px; --head-weight: 900; --head-tracking: -.02em;
  --card-line: color-mix(in srgb, var(--accent) 16%, var(--surface)); --card-line-hover: color-mix(in srgb, var(--accent) 40%, var(--surface));
  --card-shadow: 0 6px 0 color-mix(in srgb, var(--accent) 14%, transparent); --card-shadow-hover: 0 10px 0 color-mix(in srgb, var(--accent) 22%, transparent);
  --primary-shadow: 0 4px 0 color-mix(in srgb, var(--accent) 55%, var(--ink));
  --texture: radial-gradient(color-mix(in srgb, var(--accent) 16%, transparent) 1.6px, transparent 1.8px); --texture-size: 22px 22px;
  --hero-bg: linear-gradient(120deg, color-mix(in srgb, var(--accent) 18%, var(--surface)), color-mix(in srgb, #ff9ccf 14%, var(--surface)));
  --btn-weight: 800;
}
[data-theme="lavender"] .btn.primary:active { transform: translateY(3px); box-shadow: 0 1px 0 color-mix(in srgb, var(--accent) 55%, var(--ink)); }

/* Terminal Green — all monospace, square, scanlines, lowercase headings with a blinking cursor. */
[data-theme="terminal"] {
  --btn-r: 0; --pill-r: 0; --cta-r: 0; --btn-case: uppercase; --btn-tracking: .06em; --btn-size: 12.5px;
  --head-weight: 700; --head-tracking: -.03em; --head-case: lowercase;
  --card-line: color-mix(in srgb, var(--accent) 38%, var(--surface)); --card-line-hover: var(--accent);
  --card-shadow: none; --card-shadow-hover: 0 0 0 1px var(--accent); --lift: none; --primary-shadow: none;
  --eyebrow-font: var(--font-head);
  --texture: repeating-linear-gradient(0deg, color-mix(in srgb, var(--ink) 5%, transparent) 0 1px, transparent 1px 3px);
  --hero-bg: var(--surface);
}
[data-theme="terminal"][data-mode="dark"] { --primary-shadow: 0 0 18px -3px var(--accent); --card-shadow-hover: 0 0 0 1px var(--accent), 0 0 26px -8px var(--accent); }
[data-theme="terminal"] :is(.page-head h1, .hero-card h1, .site h1)::after { content: "_"; color: var(--accent); margin-left: .06em; animation: es-blink 1.1s steps(1) infinite; }
[data-theme="terminal"] :is(.eyebrow, .kicker)::before { content: "> "; }
[data-theme="terminal"] .hero-card::after { display: none; }
@keyframes es-blink { 50% { opacity: 0; } }

/* Field Journal — ruled notebook paper, italic serif headings with red-pen underlines, taped cards. */
[data-theme="paper"] {
  --btn-r: 3px; --pill-r: 3px; --cta-r: 3px; --head-weight: 700; --head-style: italic; --head-tracking: -.01em;
  --card-line: color-mix(in srgb, var(--ink) 20%, var(--surface));
  --card-shadow: 2px 3px 0 color-mix(in srgb, var(--ink) 10%, transparent); --card-shadow-hover: 4px 7px 0 color-mix(in srgb, var(--ink) 12%, transparent);
  --eyebrow-font: var(--font-head); --eyebrow-case: none; --eyebrow-style: italic; --eyebrow-tracking: 0;
  --texture: repeating-linear-gradient(180deg, transparent 0 27px, color-mix(in srgb, #3a6fb0 10%, transparent) 27px 28px); --texture-size: auto;
  --hero-bg: var(--surface); --primary-shadow: 2px 2px 0 color-mix(in srgb, var(--ink) 25%, transparent);
}
[data-theme="paper"] :is(.page-head h1, .hero-card h1, .canvas-head h1, .pro-hero:not(.has-bg) h1, .blk-heading h2) {
  text-decoration: underline wavy color-mix(in srgb, var(--accent) 75%, transparent); text-decoration-thickness: 2px; text-underline-offset: .22em; text-decoration-skip-ink: none;
}
[data-theme="paper"] .pcard::before { content: ""; position: absolute; z-index: 4; top: 8px; left: 50%; width: 74px; height: 20px; transform: translateX(-50%) rotate(-3deg); background: color-mix(in srgb, #f6e7a8 75%, transparent); box-shadow: 0 1px 2px rgba(0,0,0,.08); pointer-events: none; }
[data-theme="paper"] .hero-card { border-left: 4px double color-mix(in srgb, var(--accent) 60%, transparent); }
[data-theme="paper"] .hero-card::after { display: none; }

/* Midnight Blue — starfield, glowing accent controls, cards with a lit top edge. */
[data-theme="midnight"] {
  --btn-r: 10px; --head-weight: 600; --head-tracking: -.02em;
  --card-shadow: inset 0 1px 0 color-mix(in srgb, #fff 70%, transparent), 0 12px 32px -20px color-mix(in srgb, var(--accent) 70%, transparent);
  --card-shadow-hover: inset 0 1px 0 color-mix(in srgb, #fff 70%, transparent), 0 18px 40px -18px color-mix(in srgb, var(--accent) 80%, transparent);
  --primary-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 60%, transparent), 0 8px 26px -8px var(--accent);
  --star: color-mix(in srgb, var(--accent) 45%, transparent);
  --texture: radial-gradient(1.4px 1.4px at 12% 18%, var(--star) 50%, transparent 55%), radial-gradient(1px 1px at 68% 42%, var(--star) 50%, transparent 55%), radial-gradient(1.6px 1.6px at 38% 76%, var(--star) 50%, transparent 55%), radial-gradient(1px 1px at 86% 88%, var(--star) 50%, transparent 55%), radial-gradient(1.2px 1.2px at 52% 8%, var(--star) 50%, transparent 55%), radial-gradient(1px 1px at 92% 30%, var(--star) 50%, transparent 55%);
  --texture-size: 280px 280px;
  --hero-bg: radial-gradient(90% 120% at 85% 10%, color-mix(in srgb, var(--accent) 30%, var(--surface)), var(--surface) 70%);
}
[data-theme="midnight"][data-mode="dark"] {
  --star: color-mix(in srgb, #ffffff 55%, transparent);
  --card-bg: linear-gradient(180deg, color-mix(in srgb, var(--surface) 92%, #8ea2ff), var(--surface) 60%);
  --card-shadow: inset 0 1px 0 color-mix(in srgb, #fff 9%, transparent), 0 14px 40px -22px color-mix(in srgb, var(--accent) 80%, transparent);
  --card-shadow-hover: inset 0 1px 0 color-mix(in srgb, #fff 12%, transparent), 0 20px 50px -20px var(--accent);
}

/* Concrete Brutalist — thick ink borders, hard offset shadows, all caps, raw orange. */
[data-theme="brutalist"] {
  --border: 3px; --card-line: var(--ink); --card-line-hover: var(--ink);
  --card-shadow: 6px 6px 0 var(--ink); --card-shadow-hover: 10px 10px 0 var(--ink); --lift: translate(-3px, -3px);
  --btn-r: 0; --btn-border: 2px; --btn-case: uppercase; --btn-tracking: .04em; --btn-weight: 800; --pill-r: 0; --cta-r: 0;
  --primary-shadow: 4px 4px 0 var(--ink); --primary-ink: var(--ink);
  --head-weight: 400; --head-case: uppercase; --head-tracking: -.01em;
  --eyebrow-font: var(--font-head); --eyebrow-tracking: .06em; --chrome-border: 3px;
  --hero-bg: var(--accent);
  --texture: radial-gradient(color-mix(in srgb, var(--ink) 9%, transparent) 1px, transparent 1.4px); --texture-size: 7px 7px;
}
[data-theme="brutalist"] .btn { border-color: var(--ink); }
[data-theme="brutalist"] .btn.primary { border-color: var(--ink); }
[data-theme="brutalist"] .btn:active { transform: translate(3px, 3px); box-shadow: none; }
[data-theme="brutalist"] .tag { border: 2px solid var(--ink); }
[data-theme="brutalist"] .nav-item.active { background: var(--ink); color: var(--bg); }
[data-theme="brutalist"] .nav-item.active .count { color: var(--bg); }
[data-theme="brutalist"] .hero-card :is(.eyebrow, .sub, h1) { color: var(--ink); }
[data-theme="brutalist"] .hero-card .btn.primary { background: var(--ink); color: var(--bg); box-shadow: 4px 4px 0 var(--surface); }
[data-theme="brutalist"] .hero-card::after { display: none; }
[data-theme="brutalist"] :is(.page-head h1, .hero-card h1) { font-size: clamp(30px, 4vw, 48px); line-height: 1; }

/* Aurora Glass — frosted translucent panels over drifting colour light, gradient headings. */
[data-theme="aurora"] {
  --btn-r: 99px; --pill-r: 99px; --head-weight: 700; --head-tracking: -.03em;
  --card-bg: color-mix(in srgb, var(--surface) 58%, transparent); --blur: blur(18px) saturate(1.5);
  --card-line: color-mix(in srgb, #ffffff 65%, transparent); --card-line-hover: #ffffff;
  --card-shadow: 0 8px 32px -14px color-mix(in srgb, var(--ink) 28%, transparent);
  --chrome-bg: color-mix(in srgb, var(--surface) 50%, transparent);
  --primary-bg: linear-gradient(120deg, var(--accent), #7b6cff); --primary-ink: #ffffff;
  --primary-shadow: 0 10px 26px -10px color-mix(in srgb, #7b6cff 70%, transparent);
  --texture: radial-gradient(42% 48% at 8% 10%, color-mix(in srgb, var(--accent) 42%, transparent), transparent 70%), radial-gradient(38% 44% at 92% 16%, color-mix(in srgb, #8b6cff 36%, transparent), transparent 70%), radial-gradient(46% 46% at 60% 100%, color-mix(in srgb, #ff7ac6 26%, transparent), transparent 70%);
  --hero-bg: color-mix(in srgb, var(--surface) 45%, transparent);
}
[data-theme="aurora"][data-mode="dark"] { --card-line: color-mix(in srgb, #ffffff 12%, transparent); --card-line-hover: color-mix(in srgb, #ffffff 30%, transparent); --card-bg: color-mix(in srgb, var(--surface) 52%, transparent); --primary-ink: #06141b; --primary-bg: linear-gradient(120deg, var(--accent), #a99bff); }
:is([data-theme="aurora"] :is(.page-head h1, .hero-card h1, .canvas-head h1, .pro-hero:not(.has-bg) h1), .swatch[data-theme="aurora"] b) {
  background: linear-gradient(100deg, var(--ink) 25%, var(--accent) 65%, #8b6cff); -webkit-background-clip: text; background-clip: text; color: transparent;
}
[data-theme="aurora"] .hero-card::after { display: none; }

/* Blueprint Grid — drafting grid, dashed technical frames, mono uppercase labels. */
[data-theme="blueprint"] {
  --border-style: dashed; --card-line: color-mix(in srgb, var(--accent) 50%, var(--surface)); --card-line-hover: var(--accent);
  --card-shadow: 0 0 0 4px var(--bg), 0 0 0 5px color-mix(in srgb, var(--accent) 25%, transparent);
  --card-shadow-hover: 0 0 0 4px var(--bg), 0 0 0 5px var(--accent); --lift: none;
  --btn-r: 0; --pill-r: 0; --cta-r: 0; --btn-case: uppercase; --btn-tracking: .08em; --btn-font: var(--font-head); --btn-size: 12px;
  --head-case: uppercase; --head-weight: 600; --head-tracking: .01em; --eyebrow-font: var(--font-head);
  --primary-shadow: none;
  --grid: color-mix(in srgb, var(--accent) 18%, transparent); --grid-fine: color-mix(in srgb, var(--accent) 8%, transparent);
  --texture: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px), linear-gradient(var(--grid-fine) 1px, transparent 1px), linear-gradient(90deg, var(--grid-fine) 1px, transparent 1px);
  --texture-size: 100px 100px, 100px 100px, 20px 20px, 20px 20px;
  --hero-bg: var(--surface);
}
[data-theme="blueprint"][data-mode="dark"] { --grid: color-mix(in srgb, #ffffff 16%, transparent); --grid-fine: color-mix(in srgb, #ffffff 6%, transparent); --card-line: color-mix(in srgb, #ffffff 45%, transparent); }
[data-theme="blueprint"] .hero-card::after { display: none; }
[data-theme="blueprint"] :is(.page-head h1, .hero-card h1) { font-size: clamp(24px, 2.8vw, 32px); }

/* Noir Editorial — magazine layout: huge italic serif, hairlines, no shadows, ink buttons, gold accents. */
[data-theme="noir"] {
  --card-line: color-mix(in srgb, var(--ink) 18%, var(--surface)); --card-line-hover: var(--ink);
  --card-shadow: none; --card-shadow-hover: none; --lift: none;
  --btn-r: 0; --pill-r: 0; --cta-r: 0; --btn-case: uppercase; --btn-tracking: .16em; --btn-size: 11.5px;
  --primary-bg: var(--ink); --primary-ink: var(--bg); --primary-shadow: none;
  --head-weight: 600; --head-style: italic; --head-tracking: -.02em; --eyebrow-tracking: .32em;
  --hero-bg: transparent; --chrome-bg: var(--bg);
}
[data-theme="noir"] .hero-card { border-width: 0 0 1px; border-radius: 0; padding: 18px 0 34px; box-shadow: none; }
[data-theme="noir"] .hero-card::after { display: none; }
[data-theme="noir"] :is(.page-head h1, .hero-card h1) { font-size: clamp(36px, 4.6vw, 58px); line-height: 1.02; }
[data-theme="noir"] .pcard-art { filter: grayscale(.85) contrast(1.05); transition: filter .3s; }
[data-theme="noir"] .pcard:hover .pcard-art { filter: none; }
[data-theme="noir"] .section-head { border-bottom: 1px solid var(--ink); padding-bottom: 8px; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .two-col, .detail { grid-template-columns: 1fr; }
  .site.pro .pro-body { grid-template-columns: 1fr; }
  .site.pro aside { position: static; }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; z-index: 25; background: rgba(0,0,0,.3); }
  .main { margin-left: 0; }
  .icon-btn.menu-toggle { display: inline-grid; }
  .topbar { padding: 0 16px; gap: 8px; }
  .search { width: auto; flex: 1; min-width: 0; }
  .top-actions { flex: 1; min-width: 0; margin-left: 0; }
  .search kbd { display: none; }
  .crumbs { display: none; }
  .page { padding: 22px 16px 48px; }
  .hero-card { padding: 24px 20px; }
  .settings, .form-grid { grid-template-columns: 1fr; }
  .site-hero .copy { padding: 28px 22px; }
  .site-hero { min-height: 300px; }
  .site-nav nav a:not(.cta) { display: none; }
  .site.pro .pro-hero { grid-template-columns: 1fr; padding: 40px 0; }
  .site.pro .pro-hero.has-bg { padding: 40px 22px; }
  .project-grid.list .pcard-art { width: 96px; }
  .file-row { grid-template-columns: 40px minmax(0, 1fr) auto; }
  .file-row .vis { display: none; }
  .board { height: 520px; }
  .node { width: 170px; }
  .top-actions .btn span { display: none; }
  .builder { grid-template-columns: 1fr; height: auto !important; }
  .builder-stage { max-height: 70vh; }
  .inspector { border-left: 0; border-top: 1px solid var(--line); }
  .preview-bar .seg button { padding: 0 9px; }
}
@media (max-width: 520px) {
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat strong { font-size: 24px; }
  .page-head .actions, .hero-card .actions { width: 100%; }
  .preview-bar .actions { margin-left: 0; width: 100%; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
