
:root { --accent: #35d07f; color-scheme: dark; }
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: #050505; color: #f5f5f5; font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; line-height: 1.5; }
body.browser-page { height: 100vh; overflow: hidden; }
body.has-cart main { padding-bottom: 0; }
.asset-loading { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: #050505; color: #d8d8d8; font-weight: 750; }
.assets-ready .asset-loading { display: none; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
.topbar { display: flex; justify-content: space-between; align-items: center; min-height: 82px; padding: 10px clamp(18px, 4vw, 48px); border-bottom: 1px solid #202020; position: sticky; top: 0; z-index: 30; background: rgba(5,5,5,.92); backdrop-filter: blur(12px); }
.brand { color: var(--accent); font-weight: 800; font-size: 1.1rem; display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.brand img { width: 180px; height: 54px; object-fit: contain; display: block; flex: 0 0 180px; }
.topnav { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.topnav a { padding: 9px 11px; border-radius: 6px; color: #d9d9d9; font-weight: 750; }
.topnav a:hover { background: #111; color: var(--accent); }
.menu-toggle, .menu-close { width: 42px; height: 42px; padding: 0; border-radius: 6px; background: #151515; color: #f5f5f5; border: 1px solid #303030; display: inline-grid; place-items: center; }
.menu-toggle span { width: 18px; height: 2px; background: currentColor; display: block; }
.menu-toggle { gap: 4px; }
.menu-close { font-size: 1.65rem; line-height: 1; }
.menu-overlay { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 40; background: rgba(3,3,3,.72); opacity: 0; pointer-events: none; transition: opacity .22s ease; backdrop-filter: blur(5px); }
.side-menu { position: fixed; top: 0; right: 0; z-index: 50; width: min(360px, calc(100vw - 28px)); height: 100vh; padding: 18px; background: #0b0b0b; border-left: 1px solid #2a2a2a; box-shadow: -18px 0 60px rgba(0,0,0,.62); transform: translateX(100%); transition: transform .24s ease; display: grid; align-content: start; gap: 8px; color: #e8e8e8; }
.side-menu-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-bottom: 16px; margin-bottom: 8px; border-bottom: 1px solid #202020; color: #bdbdbd; font-weight: 750; }
.side-menu a { border: 1px solid transparent; border-radius: 6px; padding: 12px 10px; font-weight: 750; }
.side-menu a:hover { border-color: #2a2a2a; background: #101010; }
.nav-open { overflow: hidden; }
.nav-open .menu-overlay { opacity: 1; pointer-events: auto; }
.nav-open .side-menu { transform: translateX(0); }
main { width: min(1220px, calc(100% - 28px)); margin: 0 auto; padding: 42px 0 72px; }
.browser-page main { height: calc(100vh - 82px); padding: 14px 0; overflow: hidden; }
.browser-shell { height: 100%; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 12px; }
.browser-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding-bottom: 12px; border-bottom: 1px solid #1c1c1c; }
.browser-toolbar h1 { margin: 0; font-size: clamp(1.45rem, 2.8vw, 2.35rem); line-height: 1; letter-spacing: 0; }
.browser-toolbar p { color: #bdbdbd; margin: 6px 0 0; max-width: 640px; }
.showcase-hero { min-height: calc(100vh - 180px); display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 480px); gap: clamp(28px, 5vw, 72px); align-items: center; padding: clamp(28px, 7vw, 86px) 0; }
.showcase-copy { max-width: 720px; }
.eyebrow { margin: 0 0 14px; color: var(--accent); font-weight: 800; text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; }
.showcase-copy h1 { margin: 0 0 18px; font-size: clamp(4rem, 13vw, 10rem); line-height: .86; letter-spacing: 0; }
.showcase-copy p:not(.eyebrow) { color: #d0d0d0; font-size: clamp(1.05rem, 2vw, 1.35rem); max-width: 640px; margin: 0; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.showcase-panel { max-height: 520px; border: 1px solid #242424; border-radius: 8px; background: #0b0b0b; overflow: hidden; display: grid; grid-template-rows: auto minmax(0, 1fr); box-shadow: 0 24px 80px rgba(0,0,0,.34); }
.panel-head { display: flex; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid #202020; color: #bdbdbd; font-weight: 800; }
.panel-head a { color: var(--accent); }
.featured-trait { min-height: 0; overflow: auto; padding: 20px; }
.featured-trait h2 { margin: 8px 0 14px; font-size: clamp(1.35rem, 2.2vw, 2rem); line-height: 1.1; }
.featured-doc { max-height: 250px; overflow: hidden; color: #d7d7d7; margin-bottom: 18px; position: relative; }
.featured-doc::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 64px; background: linear-gradient(transparent, #0b0b0b); pointer-events: none; }
.featured-doc h1 { display: none; }
.featured-doc h2 { font-size: 1.05rem; margin: 18px 0 8px; }
.featured-doc p, .featured-doc li { color: #d7d7d7; }
.featured-doc pre { max-height: 150px; overflow: hidden; padding: 14px; background: #101010; border: 1px solid #242424; border-radius: 8px; }
.showcase-band { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; padding: 28px 0 6px; border-top: 1px solid #202020; }
.showcase-band article { min-width: 0; }
.showcase-band h2 { margin: 0 0 8px; font-size: 1.08rem; }
.showcase-band p { margin: 0; color: #bdbdbd; }
.hero { padding: 24px 0 22px; border-bottom: 1px solid #1c1c1c; margin-bottom: 24px; }
.hero h1, .section-head h1 { font-size: clamp(2rem, 5vw, 4.5rem); line-height: 1; margin: 0 0 14px; letter-spacing: 0; max-width: 850px; }
.hero p, .section-head p { color: #bdbdbd; margin: 0; max-width: 680px; }
.controls-link { display: inline-flex; color: var(--accent); font-weight: 750; white-space: nowrap; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; max-height: 84px; overflow: auto; }
.tag { border: 1px solid #2a2a2a; color: #d7d7d7; padding: 7px 10px; border-radius: 6px; }
.tag.active { border-color: var(--accent); color: var(--accent); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.card, .row { border: 1px solid #202020; border-radius: 8px; background: #0b0b0b; }
.card { padding: 18px; min-height: 140px; }
.trait-card { display: grid; grid-template-rows: auto 1fr; gap: 22px; }
.card h2, .row h2 { margin: 8px 0 0; font-size: 1.25rem; line-height: 1.2; }
.meta { color: var(--accent); font-size: .85rem; overflow-wrap: anywhere; }
.trait-browser { min-height: 0; display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 18px; align-items: stretch; }
.library-panel { min-height: 0; overflow: hidden; display: grid; grid-template-rows: auto auto minmax(0, 1fr); padding-right: 4px; }
.search { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; margin-bottom: 8px; }
.search label { min-width: 0; }
.trait-list { min-height: 0; overflow: auto; display: grid; align-content: start; gap: 10px; padding-right: 4px; }
.trait-list-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 12px; border: 1px solid #202020; border-radius: 8px; background: #0b0b0b; cursor: pointer; }
.trait-list-item.active { border-color: var(--accent); background: #0f1411; }
.trait-list-item.selected { border-color: rgba(54, 215, 131, .7); background: #102017; box-shadow: inset 3px 0 0 var(--accent); }
.trait-list-item[hidden] { display: none; }
.trait-link { display: grid; gap: 4px; min-width: 0; }
.trait-link strong { font-size: .98rem; line-height: 1.2; overflow-wrap: anywhere; }
.icon-button { background: #161616; color: #f5f5f5; border: 1px solid #303030; padding: 8px 10px; font-size: .85rem; }
.doc { max-width: none; min-width: 0; }
.reader-panel { min-height: 0; overflow: auto; border-left: 1px solid #202020; padding-left: 22px; padding-right: 6px; }
.reader-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; position: sticky; top: 0; z-index: 2; padding: 0 0 12px; background: #050505; }
.reader-actions > div { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.back-link { color: #bdbdbd; font-weight: 750; }
.doc h1 { font-size: clamp(1.75rem, 3vw, 2.75rem); line-height: 1.05; }
.doc h2 { margin-top: 26px; }
.doc p, .doc li { color: #dddddd; }
.doc pre { overflow: auto; padding: 16px; background: #101010; border: 1px solid #242424; border-radius: 8px; }
.doc code { color: #f2f2f2; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.controls-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.controls-grid article { display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 14px; align-items: center; padding: 14px; border: 1px solid #202020; border-radius: 8px; background: #0b0b0b; }
.controls-grid kbd { width: 54px; min-height: 42px; display: grid; place-items: center; border-radius: 6px; border: 1px solid #333; background: #151515; color: var(--accent); font: 800 1rem ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.controls-grid strong, .controls-grid span { display: block; }
.controls-grid span { color: #bdbdbd; font-size: .92rem; }
.button, button { background: var(--accent); color: #031006; border: 0; border-radius: 6px; padding: 10px 14px; font-weight: 750; cursor: pointer; font: inherit; }
.button:disabled, button:disabled { cursor: not-allowed; opacity: .5; }
.secondary { background: #1a1a1a; color: #f5f5f5; border: 1px solid #303030; }
.danger { background: #ff4d4d; color: #160000; }
.select-toggle[aria-pressed="true"] { border-color: rgba(54, 215, 131, .8); background: var(--accent-soft); color: var(--accent); }
.cart-bar { position: fixed; left: 50%; bottom: 18px; z-index: 20; width: min(720px, calc(100% - 36px)); transform: translate(-50%, 120%); opacity: 0; pointer-events: none; transition: transform .18s ease, opacity .18s ease; display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid #252525; border-radius: 8px; background: rgba(11,11,11,.96); box-shadow: 0 18px 50px rgba(0,0,0,.48); backdrop-filter: blur(12px); }
.has-cart .cart-bar { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.cart-bar div { color: #e8e8e8; min-width: 92px; }
.cart-bar strong { color: var(--accent); }
.cart-bar p { min-height: 1.5em; flex: 1; margin: 0; color: #bdbdbd; font-size: .9rem; }
.list { display: grid; gap: 12px; }
.row { padding: 16px; display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.actions { display: flex; align-items: center; gap: 10px; }
.actions form { margin: 0; }
.editor, .login { display: grid; gap: 16px; max-width: 820px; }
.login { max-width: 380px; margin: 8vh auto 0; border: 1px solid #222; border-radius: 8px; background: #0b0b0b; padding: 22px; }
.login-logo { width: 96px; height: 64px; object-fit: contain; display: block; margin-bottom: 2px; }
label { display: grid; gap: 7px; color: #d8d8d8; }
input, textarea { width: 100%; background: #101010; color: #fff; border: 1px solid #303030; border-radius: 6px; padding: 11px 12px; font: inherit; }
textarea { resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.error { color: #ff8f8f; }
.empty { color: #a8a8a8; }
@media (max-width: 680px) {
  .topbar { min-height: 76px; }
  .brand img { width: 150px; height: 44px; flex-basis: 150px; }
  .topnav { gap: 2px; }
  .topnav a { padding: 7px 8px; font-size: .92rem; }
  .topnav a[href="/logout"] { display: none; }
  .section-head, .row { align-items: flex-start; flex-direction: column; }
  main { width: min(100% - 28px, 1120px); padding-top: 24px; }
  .showcase-hero { min-height: auto; grid-template-columns: 1fr; padding: 34px 0; }
  .showcase-copy h1 { font-size: 4.6rem; }
  .showcase-panel { min-height: 340px; }
  .showcase-band { grid-template-columns: 1fr; gap: 20px; }
  .browser-page main { height: calc(100vh - 76px); padding: 10px 0; }
  .browser-shell { gap: 10px; }
  .browser-toolbar { align-items: flex-start; }
  .browser-toolbar h1 { font-size: 1.5rem; }
  .browser-toolbar p { display: none; }
  .trait-browser { grid-template-columns: 1fr; grid-template-rows: minmax(190px, 36%) minmax(0, 1fr); gap: 12px; }
  .library-panel { min-height: 0; overflow: hidden; padding-right: 0; }
  .tags { max-height: 42px; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; }
  .search { grid-template-columns: 1fr; }
  .reader-panel { border-left: 0; border-top: 1px solid #202020; padding: 12px 0 0; }
  .reader-actions { align-items: flex-start; flex-direction: column; position: static; }
  .trait-list-item { grid-template-columns: minmax(0, 1fr); }
  .trait-list-item .icon-button { justify-self: start; }
  .actions { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
  .cart-bar { align-items: stretch; flex-wrap: wrap; }
  .cart-bar p { flex-basis: 100%; order: 4; }
}

:root {
  --bg: #090a0b;
  --surface-1: #0f1113;
  --surface-2: #15181b;
  --surface-3: #1b1f23;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text-primary: #f4f5f6;
  --text-secondary: #b4bac2;
  --text-muted: #747b84;
  --accent: #35d07f;
  --accent-hover: #48e493;
  --accent-soft: rgba(54, 215, 131, 0.12);
  --danger: #ff5d67;
  --danger-hover: #ff7079;
  --danger-soft: rgba(255, 93, 103, 0.12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-card: 0 20px 50px rgba(0, 0, 0, 0.28);
  --content-max: 1440px;
  --reading-max: 800px;
  color-scheme: dark;
}

html { background: var(--bg); }
body {
  background: var(--bg);
  color: var(--text-primary);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.65;
}

body.browser-page { overflow: hidden; }
.asset-loading { background: var(--bg); color: var(--text-secondary); }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

a, button, input, textarea, select, summary { transition: background-color .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease, transform .18s ease; }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.topbar {
  min-height: 72px;
  width: 100%;
  max-width: none;
  padding: 0 max(16px, calc((100vw - var(--content-max)) / 2 + 32px));
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(9, 10, 11, .9);
}
.brand img { width: 166px; height: 48px; flex-basis: 166px; }
.topnav { gap: 4px; }
.topnav a {
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  font-size: .9rem;
  font-weight: 700;
}
.topnav a:hover { background: var(--surface-2); color: var(--text-primary); }
.menu-toggle { display: none; }
.side-menu { background: var(--surface-1); border-left-color: var(--border-subtle); }
.side-menu-head { border-bottom-color: var(--border-subtle); color: var(--text-secondary); }
.side-menu a:hover { background: var(--surface-2); border-color: var(--border-subtle); }

main {
  width: min(var(--content-max), calc(100% - 64px));
  padding: 48px 0 72px;
}
.browser-page main {
  width: 100%;
  height: calc(100vh - 72px);
  padding: 0;
}

.button, button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #06100a;
  border: 1px solid transparent;
  padding: 10px 18px;
  font-weight: 760;
  line-height: 1;
}
.button:hover, button:hover { background: var(--accent-hover); color: #06100a; transform: translateY(-1px); }
.secondary {
  background: var(--surface-2);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}
.secondary:hover { background: var(--surface-3); color: var(--text-primary); border-color: var(--border-strong); }
.danger {
  background: transparent;
  color: var(--danger);
  border-color: transparent;
}
.danger:hover { background: var(--danger-soft); color: var(--danger-hover); }
.icon-button {
  width: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  font-size: .72rem;
}
.icon-button:hover { background: var(--surface-3); color: var(--text-primary); }

label { color: var(--text-secondary); font-size: .86rem; font-weight: 650; }
input, textarea, select {
  min-height: 46px;
  background: var(--surface-1);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { line-height: 1.55; }

.eyebrow {
  color: var(--accent);
  font-size: .76rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-weight: 800;
}
.text-link, .controls-link, .panel-head a, .filter-head a {
  color: var(--accent);
  font-weight: 750;
}
.empty { color: var(--text-muted); }
.error {
  color: var(--danger-hover);
  background: var(--danger-soft);
  border-radius: var(--radius-sm);
  margin: 0;
  padding: 10px 12px;
}

.showcase-hero {
  min-height: auto;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, 560px);
  gap: clamp(32px, 6vw, 88px);
  padding: 96px 0 56px;
}
.showcase-copy { max-width: 650px; }
.showcase-copy h1 {
  margin: 0 0 20px;
  max-width: 760px;
  font-size: clamp(3.25rem, 7vw, 6rem);
  line-height: .94;
  font-weight: 820;
}
.showcase-copy p:not(.eyebrow) {
  max-width: 560px;
  color: var(--text-secondary);
  font-size: 1.1rem;
}
.hero-actions { align-items: center; gap: 18px; margin-top: 32px; }
.showcase-panel {
  max-width: 640px;
  max-height: none;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--surface-2), var(--surface-1));
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.panel-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.featured-trait { padding: 30px; overflow: visible; }
.featured-trait h2 {
  margin: 18px 0 12px;
  font-size: clamp(1.65rem, 3vw, 2.35rem);
  line-height: 1.08;
}
.featured-trait p { color: var(--text-secondary); margin: 0 0 18px; }
.featured-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
  color: var(--text-muted);
  font-size: .82rem;
}
.featured-meta span {
  border-radius: 999px;
  background: var(--surface-3);
  padding: 5px 9px;
}
.showcase-band {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  border-top: 0;
  padding: 8px 0 28px;
}
.showcase-band article {
  min-height: 188px;
  padding: 22px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--surface-1);
}
.feature-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 850;
  margin-bottom: 18px;
}
.showcase-band h2 { color: var(--text-primary); font-size: 1.12rem; }
.showcase-band p { color: var(--text-secondary); line-height: 1.55; }

.browser-shell {
  height: 100%;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 0;
}
.browser-toolbar {
  min-height: 86px;
  align-items: center;
  padding: 16px max(16px, calc((100vw - var(--content-max)) / 2 + 32px));
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg);
}
.browser-toolbar .eyebrow { margin-bottom: 4px; }
.browser-toolbar h1 { font-size: clamp(1.7rem, 3vw, 2.55rem); }
.browser-toolbar p:not(.eyebrow) { color: var(--text-secondary); margin-top: 2px; }
.trait-browser {
  min-height: 0;
  grid-template-columns: minmax(240px, 280px) minmax(360px, 430px) minmax(0, 1fr);
  gap: 0;
}
.library-panel, .results-panel, .reader-panel {
  min-height: 0;
  overflow: auto;
  border-right: 1px solid var(--border-subtle);
}
.library-panel {
  display: block;
  padding: 20px;
  background: var(--surface-1);
}
.sidebar-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.sidebar-head h2 { margin: 0; font-size: 1.15rem; line-height: 1.2; }
.sidebar-head span, .filter-head, .list-toolbar {
  color: var(--text-muted);
  font-size: .82rem;
  font-weight: 700;
}
.search {
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 0 0 20px;
}
.filter-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.tags {
  gap: 8px;
  margin: 0;
  max-height: min(42vh, 440px);
  overflow: auto;
  align-content: start;
}
.tag {
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--surface-2);
  color: var(--text-secondary);
  padding: 7px 10px;
  font-size: .85rem;
  line-height: 1;
}
.tag:hover { border-color: var(--border-strong); background: var(--surface-3); color: var(--text-primary); }
.tag.active {
  border-color: rgba(54, 215, 131, .35);
  background: var(--accent-soft);
  color: var(--accent);
}
.results-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: #0c0d0f;
}
.list-toolbar {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
}
.bulk-actions {
  display: none;
  align-items: center;
  gap: 8px;
}
.has-cart .bulk-actions { display: flex; }
.bulk-actions .button, .bulk-actions button { min-height: 36px; padding: 8px 11px; font-size: .82rem; }
.trait-list {
  gap: 10px;
  padding: 16px;
}
.trait-list-item {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--surface-1);
  cursor: pointer;
}
.trait-list-item:hover { background: var(--surface-2); transform: translateY(-1px); }
.trait-list-item.active {
  border-color: rgba(54, 215, 131, .4);
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
}
.trait-list-item.selected {
  border-color: rgba(54, 215, 131, .72);
  background: rgba(54, 215, 131, .12);
  box-shadow: inset 3px 0 0 var(--accent);
}
.trait-link strong {
  color: var(--text-primary);
  font-size: 1rem;
  line-height: 1.28;
}
.content-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.content-tag {
  border-radius: 999px;
  background: rgba(255, 255, 255, .045);
  color: #90d9b1;
  padding: 4px 7px;
  font-size: .75rem;
  line-height: 1;
}
.select-toggle[aria-pressed="true"] {
  border-color: rgba(54, 215, 131, .8);
  background: var(--accent-soft);
  color: var(--accent);
}
.reader-panel {
  border-right: 0;
  border-left: 0;
  padding: 0;
  background: var(--bg);
}
.reader-head {
  max-width: var(--reading-max);
  margin: 0 auto;
  padding: 36px 32px 24px;
  border-bottom: 1px solid var(--border-subtle);
}
.reader-head h1 {
  margin: 14px 0 14px;
  font-size: clamp(1.9rem, 3.4vw, 2.85rem);
  line-height: 1.04;
}
.reader-head > div:last-child {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}
.back-link {
  display: inline-flex;
  color: var(--text-secondary);
  font-size: .86rem;
}
.article-body {
  max-width: var(--reading-max);
  margin: 0 auto;
  padding: 30px 32px 80px;
}
.article-body > h1:first-child { display: none; }
.doc h1, .doc h2, .doc h3 { color: var(--text-primary); line-height: 1.18; }
.doc h2 { margin: 34px 0 12px; font-size: 1.55rem; }
.doc h3 { margin: 26px 0 10px; font-size: 1.18rem; }
.doc p, .doc li { color: var(--text-secondary); }
.doc p { margin: 0 0 18px; }
.doc ul, .doc ol { padding-left: 24px; margin: 0 0 20px; }
.doc li + li { margin-top: 8px; }
.doc pre {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}
.doc code {
  border-radius: 5px;
  background: var(--surface-2);
  padding: 2px 5px;
}
.doc pre code { background: transparent; padding: 0; }
.cart-bar {
  width: min(620px, calc(100% - 32px));
  padding: 10px 14px;
  border-color: var(--border-subtle);
  border-radius: var(--radius-md);
  background: rgba(15, 17, 19, .96);
}

.section-head {
  align-items: center;
  margin-bottom: 28px;
}
.section-head h1 {
  margin: 0 0 8px;
  font-size: clamp(2rem, 4vw, 3.25rem);
  line-height: 1.05;
}
.section-head p { color: var(--text-secondary); }
.admin-head, .edit-head, .admin-toolbar, .admin-filters, .admin-list, .editor {
  max-width: 1180px;
  margin-left: auto;
  margin-right: auto;
}
.admin-head-actions { display: flex; align-items: center; gap: 10px; }
.import-menu { position: relative; }
.import-menu > summary { list-style: none; cursor: pointer; }
.import-menu > summary::-webkit-details-marker { display: none; }
.import-panel {
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  right: 0;
  width: min(420px, calc(100vw - 32px));
  padding: 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  box-shadow: 0 18px 48px rgba(0, 0, 0, .42);
}
.import-panel form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 10px; }
.import-panel form + form { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border-subtle); }
.import-panel input[type="file"] { display: block; width: 100%; margin-top: 6px; color: var(--text-secondary); }
.import-panel p { margin: 12px 0 0; color: var(--text-muted); font-size: .8rem; }
.notice { margin: 0 auto 18px; padding: 12px 14px; border: 1px solid rgba(54, 215, 131, .35); border-radius: var(--radius-md); background: var(--accent-soft); color: var(--text-primary); }
.workspace-context, .workspace-links { margin: 0 16px 16px; padding: 12px; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--surface-2); }
.workspace-context p { margin: 6px 0 10px; color: var(--text-secondary); white-space: pre-wrap; }
.workspace-links > span { display: block; margin-bottom: 8px; color: var(--text-muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; }
.workspace-links a { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0; color: var(--text-primary); }
.workspace-links small { color: var(--text-muted); }
.workspace-categories { margin: 0 16px 16px; padding: 12px; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); }
.workspace-categories > span { display: block; margin-bottom: 8px; color: var(--text-muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; }
.workspace-categories a { display: inline-block; margin: 0 6px 6px 0; padding: 5px 9px; border-radius: 999px; background: var(--surface-2); color: var(--text-secondary); font-size: .8rem; }
.workspace-categories a.active { background: var(--accent); color: #07140d; }
.category-label { display: inline-block; margin: 5px 0; color: var(--accent); font-size: .78rem; font-weight: 700; letter-spacing: .03em; }
.workspace-admin-head { display: flex; align-items: center; justify-content: space-between; margin: 20px 0 10px; }
.workspace-admin-head h2 { margin: 0; }
.workspace-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; margin-bottom: 24px; }
.workspace-card { padding: 16px; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--surface-1); color: var(--text-primary); }
.workspace-card:hover { border-color: var(--border-strong); background: var(--surface-2); }
.workspace-card strong { font-size: 1.05rem; }
.workspace-card p { min-height: 2.5em; margin: 8px 0; color: var(--text-secondary); white-space: pre-wrap; }
.workspace-card span { color: var(--text-muted); font-size: .82rem; }
.admin-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 520px) 1fr;
  align-items: end;
  gap: 18px;
  margin-bottom: 14px;
}
.admin-toolbar > span {
  justify-self: end;
  color: var(--text-muted);
  font-weight: 700;
}
.admin-filters {
  margin-bottom: 18px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--surface-1);
}
.admin-filters summary {
  cursor: pointer;
  padding: 12px 14px;
  color: var(--text-secondary);
  font-weight: 750;
}
.admin-filters .tags { padding: 0 14px 14px; max-height: 128px; }
.admin-list {
  display: grid;
  gap: 0;
  overflow: visible;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--surface-1);
}
.admin-row {
  min-height: 72px;
  display: grid;
  grid-template-columns: minmax(240px, 1.4fr) minmax(180px, 1fr) 130px 160px;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
}
.admin-row:last-child { border-bottom: 0; }
.admin-row[hidden] { display: none; }
.admin-row-head {
  min-height: 44px;
  color: var(--text-muted);
  font-size: .76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  background: var(--surface-2);
}
.admin-title h2 { margin: 0 0 3px; font-size: 1rem; line-height: 1.25; }
.admin-title span, .admin-row time { color: var(--text-muted); font-size: .82rem; }
.actions { justify-content: flex-end; }
.actions .button, .actions button { min-height: 38px; padding: 8px 12px; font-size: .86rem; }
.danger-menu { position: relative; }
.danger-menu summary {
  list-style: none;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-sm);
  color: var(--danger);
  padding: 8px 10px;
  cursor: pointer;
}
.danger-menu summary::-webkit-details-marker { display: none; }
.danger-menu summary:hover { background: var(--danger-soft); }
.danger-menu form {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 10;
  width: 280px;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  box-shadow: var(--shadow-card);
}
.danger-menu p { margin: 0 0 12px; color: var(--text-secondary); font-size: .9rem; }
.danger-menu .danger {
  width: 100%;
  background: var(--danger);
  color: #190305;
}
.editor {
  max-width: 760px;
  gap: 18px;
  padding: 28px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--surface-1);
}
.editor textarea { min-height: 540px; }
.form-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 14px;
  background: var(--surface-1);
}

.login-shell {
  min-height: calc(100vh - 72px - 96px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 460px;
  align-items: center;
  gap: clamp(32px, 7vw, 96px);
  max-width: 1040px;
  margin: 0 auto;
}
.login-note h1 {
  margin: 0 0 16px;
  font-size: clamp(2.3rem, 4.6vw, 4.2rem);
  line-height: .98;
}
.login-note p:not(.eyebrow) {
  max-width: 520px;
  color: var(--text-secondary);
  font-size: 1.05rem;
}
.login {
  width: 100%;
  max-width: 460px;
  margin: 0;
  gap: 16px;
  padding: 40px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--surface-1);
  box-shadow: var(--shadow-card);
}
.login-logo {
  width: 158px;
  height: 88px;
  object-fit: contain;
  margin-bottom: 4px;
}
.login h2 {
  margin: 0;
  font-size: 2rem;
  line-height: 1.1;
}
.login > p { margin: 0; color: var(--text-secondary); }
.login .button { width: 100%; margin-top: 4px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 1199px) {
  .trait-browser { grid-template-columns: minmax(260px, 330px) minmax(0, 1fr); }
  .library-panel { display: none; }
  .browser-toolbar { padding-left: 24px; padding-right: 24px; }
  .reader-head, .article-body { padding-left: 28px; padding-right: 28px; }
  .admin-row { grid-template-columns: minmax(220px, 1.4fr) minmax(170px, 1fr) 120px 150px; }
}

@media (max-width: 767px) {
  body.browser-page { overflow: auto; }
  .topbar {
    min-height: 68px;
    padding-left: 16px;
    padding-right: 16px;
  }
  .brand img { width: 142px; height: 42px; flex-basis: 142px; }
  .topnav { display: none; }
  .menu-toggle { display: inline-grid; }
  main { width: min(100% - 32px, var(--content-max)); padding: 32px 0 56px; }
  .browser-page main { height: auto; min-height: calc(100vh - 68px); }
  .showcase-hero {
    grid-template-columns: 1fr;
    padding: 64px 0 36px;
  }
  .showcase-copy h1 { font-size: clamp(2.8rem, 14vw, 4.4rem); }
  .showcase-band { grid-template-columns: 1fr; }
  .showcase-band article { min-height: auto; }
  .browser-toolbar {
    min-height: auto;
    align-items: flex-start;
    padding: 16px;
  }
  .browser-toolbar p:not(.eyebrow) { display: none; }
  .trait-browser {
    display: block;
    min-height: auto;
  }
  .results-panel, .reader-panel {
    border-right: 0;
    min-height: auto;
    overflow: visible;
  }
  .results-panel { display: block; }
  .list-toolbar { position: sticky; top: 68px; z-index: 5; background: #0c0d0f; }
  .trait-list { padding: 12px 16px 20px; }
  .trait-list-item { grid-template-columns: minmax(0, 1fr) auto; }
  .detail-page .results-panel { display: none; }
  .reader-head, .article-body {
    max-width: 100%;
    padding-left: 18px;
    padding-right: 18px;
  }
  .reader-head h1 { font-size: 2rem; }
  body:not(.detail-page) .reader-panel { display: none; }
  .bulk-actions {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 20;
    justify-content: center;
    padding: 10px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: rgba(15, 17, 19, .96);
    box-shadow: var(--shadow-card);
  }
  .admin-head, .section-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .admin-toolbar { grid-template-columns: 1fr; }
  .admin-toolbar > span { justify-self: start; }
  .admin-row-head { display: none; }
  .admin-list {
    gap: 10px;
    border: 0;
    background: transparent;
  }
  .admin-row {
    grid-template-columns: 1fr;
    min-height: 0;
    gap: 12px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: var(--surface-1);
  }
  .actions { justify-content: flex-start; flex-wrap: wrap; }
  .danger-menu form { left: 0; right: auto; width: min(280px, calc(100vw - 48px)); }
  .editor { padding: 20px; }
  .form-actions { flex-direction: column-reverse; }
  .form-actions .button, .form-actions button { width: 100%; }
  .login-shell {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .login-note h1 { font-size: 2.45rem; }
  .login { padding: 28px; }
}

/* Responsive landing-page layout */
:root {
  --page-max-width: 1440px;
  --header-height: 104px;
  --page-gutter: clamp(24px, 4vw, 48px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  overflow-x: clip;
}

.page-container {
  width: min(calc(100% - (var(--page-gutter) * 2)), var(--page-max-width));
  margin-inline: auto;
}

.site-header {
  min-height: var(--header-height);
  padding: 0;
}

.site-header-inner {
  min-height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}

.site-logo,
.site-nav {
  min-width: 0;
}

.showcase-page main {
  width: min(calc(100% - (var(--page-gutter) * 2)), var(--page-max-width));
  max-width: 100%;
  margin-inline: auto;
  padding: 0 0 72px;
}

.showcase-page .hero {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(420px, 2fr);
  gap: clamp(48px, 7vw, 112px);
  align-items: center;
  min-height: calc(100svh - var(--header-height));
  padding-block: clamp(64px, 9vw, 132px);
  margin: 0;
  border: 0;
}

.hero-copy,
.featured-trait-card,
.featured-trait-body {
  min-width: 0;
  max-width: 100%;
}

.showcase-copy.hero-copy {
  max-width: none;
}

.showcase-copy .hero-title {
  margin: 24px 0 28px;
  max-width: 10ch;
  font-size: clamp(4rem, 6vw, 6rem);
  line-height: .92;
  letter-spacing: -.055em;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.showcase-copy p.hero-description {
  max-width: 34rem;
  margin: 0 0 40px;
  color: var(--text-secondary);
  font-size: clamp(1.1rem, 1.5vw, 1.45rem);
  line-height: 1.65;
}

.hero-actions {
  margin-top: 0;
}

.showcase-panel.featured-trait-card {
  width: 100%;
  max-width: 860px;
  max-height: none;
  justify-self: end;
  border-color: rgba(255, 255, 255, .07);
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(24, 28, 31, .92), rgba(15, 17, 19, .98));
  overflow: hidden;
}

.featured-trait-header {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.featured-trait.featured-trait-body {
  padding: clamp(28px, 4vw, 52px);
  overflow: visible;
}

.featured-trait .featured-trait-title {
  font-size: clamp(2rem, 3vw, 3rem);
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.featured-trait-body .content-tags,
.featured-trait-body .featured-meta {
  display: flex;
  flex-wrap: wrap;
}

@media (max-width: 1150px) and (min-width: 1101px) {
  .showcase-copy .hero-title {
    font-size: clamp(3.75rem, 8vw, 6rem);
    max-width: 10ch;
  }
}

@media (max-width: 1100px) {
  .showcase-page .hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 56px;
    align-items: start;
    min-height: auto;
    padding-block: 64px 96px;
  }

  .showcase-copy.hero-copy {
    max-width: 760px;
  }

  .showcase-copy .hero-title {
    max-width: 10ch;
    font-size: clamp(3.75rem, 8vw, 6rem);
  }

  .showcase-panel.featured-trait-card {
    width: 100%;
    max-width: none;
    justify-self: stretch;
  }
}

@media (max-width: 700px) {
  :root {
    --header-height: 80px;
    --page-gutter: 16px;
  }

  .site-header,
  .site-header-inner {
    min-height: var(--header-height);
  }

  .site-header-inner {
    gap: 20px;
  }

  .site-logo {
    max-width: 160px;
  }

  .site-logo img {
    max-width: 100%;
  }

  .showcase-page .hero {
    gap: 40px;
    padding-block: 48px 72px;
  }

  .showcase-copy .hero-title {
    max-width: 100%;
    font-size: clamp(3rem, 15vw, 4.75rem);
    line-height: .96;
  }

  .showcase-copy p.hero-description {
    font-size: 1.05rem;
    line-height: 1.6;
  }

  .featured-trait.featured-trait-body {
    padding: 28px 22px;
  }
}

@media (max-width: 480px) {
  .site-logo {
    max-width: 142px;
  }

  .site-nav {
    display: none;
  }

  .menu-toggle {
    display: inline-grid;
    flex: 0 0 auto;
  }

  .hero-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .hero-actions .button,
  .hero-actions .text-link,
  .featured-trait-body > .button {
    width: 100%;
    text-align: center;
    justify-content: center;
  }

  .featured-trait-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }
}
