/* Shared navigation and surfaces */
:root {
  --rail-width:76px; --page:1280px; --gutter:clamp(16px,3.3vw,50px);
  --bg:#101113; --sidebar:#151618; --surface:#18191c; --raised:#222428;
  --strong:#f3f3f4; --muted:#b0b1b7; --faint:#999ba3; --line:#34363b;
  --hair:#2e3035; --accent:#eeeeef; --accent-text:#151518; --accent-ink:#ececee;
  --selected:#303237; --chip:#222327; --mono:ui-monospace,Consolas,monospace;
}
:root[data-theme=light] {
  --bg:#f7f7f8; --sidebar:#f2f2f4; --surface:#fff; --raised:#f1f1f3;
  --strong:#202124; --muted:#575960; --faint:#656770; --line:#d4d5da;
  --hair:#dedfe3; --accent:#26272b; --accent-text:#fff; --accent-ink:#25262a;
  --selected:#e3e4e8; --chip:#eeeef0;
}
body { min-height:100vh; display:flex; flex-direction:column; padding-inline-start:var(--rail-width); }
.ico { width:18px; height:18px; }
.site-main,.site-footer { width:min(100%, calc(var(--page) + 2 * var(--gutter))); margin-inline:auto; padding-inline:var(--gutter); }
.wordmark { display:inline-flex; align-items:center; font-weight:790; font-size:24px; letter-spacing:-1.45px; white-space:nowrap; }
.wordmark .brandmark { margin-right:8px; width:31px; height:31px; }
.app-rail {
  position:fixed; inset:0 auto 0 0; z-index:8; width:var(--rail-width);
  display:flex; flex-direction:column; align-items:center; gap:12px;
  padding:12px 0 max(10px,env(safe-area-inset-bottom)); background:#15191e;
  border-right:1px solid #2d333b; color:#b8c1cd;
}
.rail-brand,.rail-btn {
  display:grid; place-items:center; flex:none; width:44px; height:44px;
  border-radius:11px; padding:0; color:inherit;
}
.rail-brand img { display:block; width:30px; height:30px; }
.rail-links,.rail-account { display:flex; flex-direction:column; align-items:center; gap:5px; width:100%; }
.rail-links { flex:1; min-height:0; padding:3px 0; overflow-y:auto; scrollbar-width:thin; }
.rail-account { padding-top:5px; }
.rail-links hr,.rail-account::before { width:25px; height:1px; flex:none; border:0; margin:6px 0; background:#343941; }
.rail-account::before { content:""; }
.rail-btn .ico { width:21px; height:21px; stroke-width:1.7; }
.rail-btn:hover,.rail-btn:focus-visible,.rail-btn[aria-expanded=true] { color:#fff; background:#282e36; }
.rail-btn[aria-current],.rail-selected,.rail-links:has(:popover-open) #open-products { background:#2d3930; color:#c3f879; }
.rail-compose,.rail-compose:hover { background:#c3f879; color:#1b2c14; }
.rail-account .user-pill { background:#334733; color:#d8f4c2; font-weight:700; }
.topic-flyout {
  position:fixed; inset:clamp(8px,18dvh,152px) auto auto calc(var(--rail-width) + 8px);
  width:min(310px,calc(100vw - var(--rail-width) - 16px)); max-height:75dvh;
  padding:15px; margin:0; overflow:auto; background:var(--surface); color:var(--strong);
  border:1px solid var(--line); border-radius:12px; box-shadow:0 12px 40px #060c142e;
}
.topic-flyout h2 { font-size:15px; margin:0 0 10px; }
.topic-shortcuts { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:4px; }
.topic-shortcuts a { display:flex; flex-direction:column; align-items:center; gap:7px; padding:9px 3px; text-align:center; font-size:11px; border-radius:7px; }
.topic-shortcuts a:hover,.topic-shortcuts a:focus-visible,.drawer nav a:hover { background:var(--selected); }
.drawer nav a,.drawer nav form button { width:100%; display:flex; gap:11px; align-items:center; padding:10px 12px; font-size:13px; font-weight:550; border-radius:6px; text-align:left; }
.drawer nav .ico { color:var(--muted); width:17px; }
.primary,.secondary,.filter-btn { transition:background-color .16s,border-color .16s,transform .16s; }
.primary:active,.secondary:active { transform:translateY(1px); }
dialog { background:var(--surface); color:var(--strong); border:1px solid var(--line); border-radius:14px; padding:18px; box-shadow:0 24px 70px #06130c40; }
dialog::backdrop { background:#08130d80; }
body:has(dialog[open]) { overflow:hidden; }
.drawer { inset:8px auto auto calc(var(--rail-width) + 8px); margin:0; width:min(316px,calc(100% - var(--rail-width) - 16px)); max-height:calc(100dvh - 16px); }
.drawer-head { display:flex; justify-content:space-between; align-items:center; margin-bottom:10px; gap:8px; }
.drawer nav h2 { margin:14px 12px 4px; color:var(--muted); font:600 11px var(--mono); letter-spacing:.06em; text-transform:uppercase; }
.search-dialog { width:min(510px,calc(100% - 24px)); margin:clamp(30px,15vh,140px) auto auto; }
.search-form { display:flex; align-items:center; gap:10px; }
.search-form input { flex:1; }
.site-main { flex:1; padding-top:26px; padding-bottom:60px; }
.site-footer { display:flex; gap:18px; align-items:center; justify-content:space-between; padding-block:24px; color:var(--muted); border-top:1px solid var(--line); }
.site-footer .wordmark { font-size:17px; color:var(--strong); letter-spacing:-.75px; }
.site-footer .brandmark { width:21px; height:21px; }
.site-footer nav { display:flex; flex-wrap:wrap; gap:18px; font-size:12px; }

/* App header */
.mast { border-bottom:1px solid var(--line); background:var(--bg); }
.mast-inner { display:flex; align-items:center; justify-content:space-between; gap:12px; width:min(100%,calc(var(--page) + 2 * var(--gutter))); margin:auto; padding:12px var(--gutter); }
.mast-path,.mast-search { display:flex; align-items:center; gap:10px; color:var(--muted); font-size:13px; }
.mast-path { min-width:0; }
.mast-path span:last-child { white-space:nowrap; text-overflow:ellipsis; overflow:hidden; }
.mast-name { color:var(--strong); font-weight:740; font-size:18px; letter-spacing:-.06em; }
.mast-search { flex:none; padding:6px 10px; border:1px solid var(--line); border-radius:7px; background:var(--surface); font-size:12px; }
.mast-search:hover { border-color:var(--muted); }
.mast-search .ico { width:15px; height:15px; }
.mast-search kbd { padding:0 4px; border:1px solid var(--line); border-radius:4px; font-size:10px; }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
@keyframes drop-in { from { opacity:0; transform:translateY(-4px); } to { opacity:1; transform:translateY(0); } }

/* Product directory */
.directory-layout { display:grid; grid-template-columns:minmax(0,1fr) minmax(245px,29%); gap:clamp(18px,2vw,30px); align-items:start; }
.results { min-width:0; scroll-margin-top:16px; }
.catalog-head { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:14px; }
.catalog-head h1,.catalog-head h2 { margin:0; font-size:clamp(24px,2.15vw,32px); letter-spacing:-.045em; line-height:1.22; }
.catalog-head p,.rail-desc { font-size:13px; color:var(--muted); margin-top:5px; }
.category-tabs { gap:6px; padding:1px 0 14px; scrollbar-width:thin; }
.category-tabs > a { padding:6px 10px; border-radius:7px; font-size:12px; gap:6px; }
.category-tabs .ico { width:14px; height:14px; }
.category-tabs .chip-on { color:var(--accent-ink); border-color:var(--accent-ink); background:var(--selected); }
.catalog-box,.rail-panel,.profile-list { background:var(--surface); border:1px solid var(--line); border-radius:13px; overflow:hidden; }
.catalog-box .toolbar { padding:0 16px; min-height:45px; background:var(--surface); }
.catalog-box .tabs { gap:18px; }
.catalog-box .tabs > a,.catalog-box .tabs > span { font-size:12px; padding:12px 0; }
.catalog-box .tabs .chosen { border-color:var(--accent-ink); color:var(--accent-ink); }
.catalog-box .filter-btn { margin:0; min-height:28px; border-color:transparent; padding:3px 7px; }
.filter-panel { border-width:0 0 1px; background:var(--raised); }
.card.listing { display:grid; grid-template-columns:auto minmax(0,1fr) auto; gap:14px; align-items:center; padding:17px 18px; border:0; border-radius:0; background:var(--surface); transition:background-color .16s; }
.listing + .listing { border-top:1px solid var(--hair); }
.card.listing:hover,.card.listing:focus-within { background:color-mix(in srgb,var(--selected) 28%,var(--surface)); }
.mark-link { display:block; align-self:center; }
.product-mark { width:54px; height:54px; display:grid; place-items:center; border-radius:13px; flex:none; background:#d9efd1; color:#21371e; font-weight:740; font-size:20px; box-shadow:inset 0 0 0 1px #14261712; }
.product-mark img { max-width:68%; max-height:68%; object-fit:contain; }
.product-mark .ico { width:27px; height:27px; }
.mark-agent { background:#e8ddfa; color:#59398a; }.mark-design { background:#f4dce8; color:#763651; }
.mark-tools { background:#d8e9f5; color:#22566a; }.mark-game { background:#f6e3c9; color:#63432a; }
.mark-flowise { background:#e7dfff; }.mark-penpot { background:#252c29; }.mark-mindustry { background:#292c32; }
.mark-ollama { background:#f4f3f0; }.mark-zed { background:#e8ebf2; }.mark-godot { background:#dceef9; }
.listing-title,.listing-meta,.listing-tools { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.listing-title h2 { font-size:19px; letter-spacing:-.035em; line-height:1.3; margin:0; overflow-wrap:anywhere; }
.listing-title a:hover,.listing-meta a:hover,.site-footer nav a:hover { text-decoration:underline; text-underline-offset:3px; }
.listing-copy { min-width:0; }
.listing-copy p { margin:3px 0 7px; color:var(--muted); line-height:1.46; font-size:13px; display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2; overflow:hidden; overflow-wrap:anywhere; }
.listing-meta { color:var(--muted); gap:5px 9px; font-size:11px; }
.listing-meta > span + span:not(.topic-tag)::before { content:"·"; margin-right:8px; color:var(--faint); }
.listing-meta .topic-tag { border-radius:4px; padding:1px 7px; }
[data-theme=light] .t-agent { background:#f0e9fa; color:#624682; }
[data-theme=light] .t-code { background:#e4f1e7; color:#356242; }
[data-theme=light] .t-tools { background:#e5eff9; color:#365a80; }
[data-theme=light] .t-design { background:#fae8ef; color:#87425c; }
[data-theme=light] .t-game { background:#fcf0dc; color:#785628; }
.listing-actions { display:grid; justify-items:center; gap:3px; }
.vote-count .action { min-width:52px; min-height:31px; justify-content:center; border:1px solid var(--line); border-radius:7px; font-weight:700; font-variant-numeric:tabular-nums; color:var(--strong); }
.vote-count .is-on { color:var(--accent-ink); border-color:currentColor; }
.listing-tools { gap:1px; }
.listing-tools .action { min-height:24px; padding:3px; font-size:10px; gap:2px; }
.listing-tools .ico { width:14px; height:14px; }
.catalog-rail { display:grid; gap:15px; min-width:0; }
.rail-panel { padding:19px; }
.needs-panel header { display:flex; align-items:center; gap:9px; }
.rail-icon { display:grid; place-items:center; width:30px; height:30px; border-radius:8px; background:var(--selected); color:var(--accent-ink); }
.rail-panel h2,.work-filter label { font-weight:680; font-size:17px; line-height:1.3; letter-spacing:-.04em; }
.rail-desc { margin:8px 0 12px; }
.need-link { display:grid; gap:4px; padding:12px 0; border-top:1px solid var(--hair); }
.need-link strong { font-size:14px; line-height:1.4; letter-spacing:-.018em; font-weight:600; }
.need-link:hover strong { text-decoration:underline; text-underline-offset:3px; }
.need-topic { color:var(--muted); font-size:11px; }
.rail-more { padding-top:10px; display:flex; align-items:center; justify-content:space-between; gap:8px; border-top:1px solid var(--hair); color:var(--accent-ink); font-size:12px; font-weight:640; }
.rail-more .ico,.work-filter .ico { width:15px; }
.work-filter { display:flex; align-items:center; margin:0 0 16px; }
.catalog-rail .work-filter { display:grid; gap:11px; padding:18px; margin:0; }
.catalog-rail .work-filter select { max-width:none; width:100%; font-size:13px; }
.catalog-rail .work-filter button { justify-content:space-between; }
.catalog-box .empty { border:0; }
.profile-list { display:block; }

/* Detail pages, forms and community tools */
.site-main > .reading,.site-main > .authbox { margin-top:8px; }
.reading { max-width:880px; }
.reading h1,.site-main > h1 { letter-spacing:-.045em; }
.product-profile { display:grid; grid-template-columns:auto minmax(0,1fr); gap:15px 18px; align-items:center; padding:clamp(18px,3vw,36px); background:var(--surface); border:1px solid var(--line); border-radius:15px; }
.product-profile .product-mark { width:72px; height:72px; border-radius:18px; }
.profile-title p { color:var(--muted); margin-top:4px; font-size:15px; }
.product-profile .facts { grid-column:1/-1; padding-top:14px; border-top:1px solid var(--hair); }
.facts > form:has(.primary) { margin-left:auto; }
.detail-page .byline { padding-inline:2px; }
.detail-page .detail-art { margin-bottom:12px; }
.block,.panel,.authbox,.detail-art { border-radius:14px; }
.block,.panel,.authbox { padding:clamp(18px,2.5vw,30px); }
.authbox { border-top:3px solid var(--accent-ink); }
.auth-mark { display:block; }
.stack input:not([type=hidden]),.stack select,.stack textarea { background:var(--surface); }
.metric-scroll th { background:var(--raised); }
.drawer[open],.search-dialog[open] { animation:drop-in .16s ease-out; }
@media(max-width:970px) {
  :root { --rail-width:58px; }
  .directory-layout { grid-template-columns:minmax(0,1fr) minmax(206px,29%); gap:14px; }
  .rail-panel { padding:14px; }.catalog-box .toolbar { padding-inline:11px; }
  
  .wordmark { font-size:22px; }.wordmark .brandmark { width:28px; height:28px; }
}
@media(max-width:790px) {
  .directory-layout { grid-template-columns:minmax(0,1fr); }.catalog-rail { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media(max-width:636px) {
  :root { --rail-width:48px; --gutter:10px; }
  .app-rail { padding-top:6px; gap:6px; }
  .rail-btn,.rail-brand { width:40px; height:40px; border-radius:9px; }
  .rail-links { gap:4px; }
  .rail-brand img { width:27px; height:27px; }
  .rail-btn .ico { width:19px; height:19px; }
  
  .catalog-head { margin-bottom:10px; }.catalog-head h1,.catalog-head h2 { font-size:24px; }
  .category-tabs { margin:0; padding:2px 0 12px; }.category-tabs > a { font-size:11px; }
  .catalog-box .tabs { gap:12px; }.catalog-box .tabs > a { font-size:11px; }
  .card.listing { padding:13px 11px; gap:9px; align-items:start; }
  .product-mark { width:39px; height:39px; border-radius:10px; font-size:15px; }.mark-link { align-self:start; }
  .listing-title h2 { font-size:16px; }.listing-copy p { font-size:12px; }.listing-meta { font-size:10px; gap:4px 6px; }
  .listing-meta > span + span:not(.topic-tag)::before { margin-right:4px; }
  .listing-actions { gap:4px; }.vote-count .action { min-width:39px; padding:2px 4px; gap:2px; }
  .listing-tools .action { min-height:26px; }
  .catalog-rail { grid-template-columns:minmax(0,1fr); }.catalog-box .filter-panel { padding:12px; }
  .site-footer { flex-wrap:wrap; }.site-footer nav { gap:10px; }.site-footer .wordmark { font-size:16px; }
  .product-profile { gap:10px; }.product-profile .product-mark { width:52px; height:52px; border-radius:13px; }
  .profile-title p { font-size:13px; }.facts > form:has(.primary) { margin-left:0; }
}
@media(max-width:365px) {
  .catalog-box .tabs { gap:9px; }.catalog-box .toolbar { padding-inline:7px; }
}
@media(prefers-reduced-motion:reduce) {
  *,*::before,*::after { animation:none !important; transition:none !important; scroll-behavior:auto !important; }
}
/* Shared controls */
:focus-visible { outline:2px solid var(--strong); outline-offset:2px; }
button:focus-visible,a:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible,summary:focus-visible { outline-color:var(--strong); }
.app-rail { color:var(--muted); background:var(--sidebar); border-color:var(--line); gap:6px; padding-top:8px; }
.rail-links { gap:2px; }
.rail-links hr,.rail-account::before { background:var(--line); margin:4px 0; }
.rail-btn { width:calc(var(--rail-width) - 12px); height:47px; gap:3px; display:flex; flex-direction:column; align-items:center; justify-content:center; border-radius:7px; }
.rail-btn small { font:540 10px/1.15 Inter,sans-serif; white-space:nowrap; }
.rail-btn .ico { width:18px; height:18px; }
.rail-btn:hover,.rail-btn:focus-visible,.rail-btn[aria-expanded=true],.rail-account .user-pill { color:var(--strong); background:var(--raised); }
.rail-btn[aria-current],.rail-selected,.rail-links:has(:popover-open) #open-products { background:var(--selected); color:var(--strong); box-shadow:inset 2px 0 var(--strong); }
.rail-compose,.rail-compose:hover { background:var(--accent); color:var(--accent-text); }
.primary:hover { background:color-mix(in srgb,var(--accent) 88%,var(--muted)); }
.rail-account .user-pill b { font-size:14px; line-height:1; }
.topic-shortcuts { grid-template-columns:repeat(2,minmax(0,1fr)); }
.topic-shortcuts a { flex-direction:row; text-align:left; justify-content:start; padding:10px 6px; font-size:12px; }
.catalog-head p,.rail-desc { line-height:1.5; }
.catalog-head h1,.catalog-head h2 { font-size:clamp(23px,2vw,30px); font-weight:680; }
.chips .chip-on,.category-tabs .chip-on { color:var(--accent-text); background:var(--accent); border-color:var(--accent); }
.catalog-box .tabs .chosen .ico { color:currentColor; }
.catalog-box .filter-btn { border-color:var(--line); }
.rail-panel,.catalog-box,.block,.panel,.authbox { border-radius:10px; }
.message { border-left-color:var(--muted); }
dialog::backdrop { background:#08090c8f; }
.detailactions .is-on { background:var(--selected); color:var(--strong); }
.rail-more:hover { text-decoration:underline; }
.product-profile .facts { align-items:center; }
@media(max-width:970px) {
  :root { --rail-width:65px; }
  .rail-btn { width:calc(var(--rail-width) - 8px); }
  .directory-layout { grid-template-columns:minmax(0,1fr) minmax(190px,27%); }
}
@media(max-width:790px) {
  .directory-layout { grid-template-columns:minmax(0,1fr); }
}
@media(max-width:636px) {
  :root { --rail-width:53px; }
  .rail-btn small { font-size:8.5px; }
  .rail-btn { height:41px; }
  .mast-inner { padding-block:9px; }
  .mast-path { gap:6px; font-size:11px; }
  .mast-search { font-size:0; padding:6px; gap:0; }
  .mast-search kbd { display:none; }
  .site-main { padding-top:12px; }
  .category-tabs { flex-wrap:wrap; }
  .catalog-box .toolbar { flex-wrap:wrap; gap:2px 6px; padding-block:3px; }
  .catalog-box .filter-btn { padding-inline:5px; }
  .catalog-head { flex-wrap:wrap; }
  .product-profile .facts .primary { white-space:normal; }
}
@media(max-height:620px) {
  .app-rail { gap:2px; padding-block:4px; }
  .rail-account { flex-direction:row; flex-wrap:wrap; justify-content:center; gap:0; padding:0; }
  .rail-account::before { display:none; }
}
