:root{--bg:#f5f7fb;--panel:#fff;--text:#172033;--muted:#697386;--line:#e5e9f2;--brand:#5b4ee8;--brand2:#4137c7;--green:#178754;--amber:#b66a00;--red:#c0392b;--shadow:0 12px 30px rgba(28,39,60,.08);--radius:16px}*{box-sizing:border-box}html{scroll-behavior:smooth}body{margin:0;background:var(--bg);color:var(--text);font:15px/1.6 Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}a{color:inherit;text-decoration:none}a:hover{color:var(--brand)}button,input,textarea,select{font:inherit}.shell{width:min(1180px,calc(100% - 32px));margin:0 auto}.site-header{background:rgba(255,255,255,.96);border-bottom:1px solid var(--line);position:sticky;top:0;z-index:20;backdrop-filter:blur(14px)}.header-inner{min-height:68px;display:flex;align-items:center;gap:22px}.brand{display:flex;align-items:center;gap:9px;font-weight:800;font-size:18px;white-space:nowrap}.brand-mark{width:32px;height:32px;border-radius:9px;background:linear-gradient(135deg,var(--brand),#8f7cff);display:grid;place-items:center;color:#fff;box-shadow:0 7px 18px rgba(91,78,232,.25)}.primary-nav{display:flex;gap:4px}.primary-nav a{padding:8px 9px;border-radius:8px;color:#49536a;font-weight:600}.primary-nav a.active,.primary-nav a:hover{background:#f0efff;color:var(--brand)}.nav-search{margin-left:auto;display:flex;width:min(330px,29vw)}.nav-search input{min-width:0;flex:1;border:1px solid var(--line);border-right:0;border-radius:9px 0 0 9px;padding:9px 11px;background:#fafbfe}.nav-search button{border:1px solid var(--line);background:#fff;border-radius:0 9px 9px 0;padding:8px 11px;cursor:pointer}.account-nav{display:flex;align-items:center;gap:9px;white-space:nowrap}.button{display:inline-flex;align-items:center;justify-content:center;border:1px solid #d7dce8;background:#fff;color:#263147;padding:9px 14px;border-radius:9px;font-weight:700;cursor:pointer}.button:hover{border-color:#bbb6ff;color:var(--brand)}.button.primary{background:var(--brand);border-color:var(--brand);color:#fff}.button.primary:hover{background:var(--brand2);color:#fff}.button.subtle{background:#f5f4ff;border-color:#e4e1ff;color:var(--brand)}.button.large{padding:12px 18px}.account-menu{position:relative}.account-menu summary{list-style:none;cursor:pointer;font-weight:700;padding:8px}.account-menu summary::-webkit-details-marker{display:none}.account-dropdown{position:absolute;right:0;top:44px;width:170px;background:#fff;border:1px solid var(--line);box-shadow:var(--shadow);border-radius:12px;padding:7px}.account-dropdown a{display:block;padding:8px 10px;border-radius:7px}.account-dropdown a:hover{background:#f5f4ff}.page-shell{min-height:70vh;padding:34px 0 50px}.flash{margin-top:18px;padding:11px 14px;border-radius:10px;border:1px solid}.flash.success{background:#ecfbf3;border-color:#bcebd2;color:#176c47}.flash.error{background:#fff0ef;border-color:#f1cbc6;color:#922c22}.flash ul{margin:4px 0 0}.content-grid{display:grid;grid-template-columns:minmax(0,1fr) 295px;gap:30px}.narrow{max-width:760px;margin:0 auto}.narrow-wide{max-width:960px;margin:0 auto}.page-heading{display:flex;align-items:flex-end;justify-content:space-between;gap:24px;margin-bottom:22px}.page-heading h1{font-size:32px;line-height:1.15;margin:4px 0 7px;letter-spacing:-.03em}.page-heading p{margin:0;color:var(--muted);max-width:720px}.eyebrow{text-transform:uppercase;font-size:11px;letter-spacing:.15em;color:var(--brand);font-weight:800}.feed-tabs{display:flex;gap:7px;margin:0 0 14px}.feed-tabs a{padding:7px 12px;border-radius:999px;color:var(--muted);font-weight:700}.feed-tabs a.active{background:#e9e6ff;color:var(--brand)}.story-card{background:var(--panel);border:1px solid var(--line);border-radius:var(--radius);display:grid;grid-template-columns:68px 1fr;margin-bottom:13px;overflow:hidden;box-shadow:0 2px 0 rgba(0,0,0,.01);transition:.15s}.story-card:hover{border-color:#d4d0ff;transform:translateY(-1px)}.vote-box{border-right:1px solid var(--line);background:#fafbfe;display:flex;flex-direction:column;align-items:center;padding:14px 6px;gap:1px}.vote-box form{margin:0}.vote-arrow{border:0;background:transparent;color:#8b94a7;cursor:pointer;font-size:15px;padding:1px 8px}.vote-arrow:hover{color:var(--brand)}.vote-arrow.down:hover{color:var(--red)}.vote-arrow.muted{opacity:.35}.vote-box strong{font-size:21px;line-height:1.1}.vote-box small{font-size:10px;text-transform:uppercase;color:#8992a5;letter-spacing:.08em}.story-main{padding:15px 17px}.story-kicker{display:flex;gap:8px;align-items:center;color:var(--brand);font-weight:700;font-size:12px}.pill{display:inline-block;border:1px solid #dfe3ea;background:#f5f7fa;color:#667085;padding:2px 7px;border-radius:99px;font-size:10px;text-transform:uppercase;letter-spacing:.05em;font-weight:800}.pill.success{background:#eaf8f0;border-color:#c8ebd7;color:var(--green)}.pill.warning{background:#fff6e8;border-color:#f3dfb9;color:var(--amber)}.story-card h2{font-size:19px;line-height:1.3;margin:5px 0 2px;letter-spacing:-.015em}.story-card p{margin:8px 0;color:#4f5b70}.source-url{font-size:12px;color:#788398}.story-meta{display:flex;flex-wrap:wrap;gap:6px 13px;color:#7a8496;font-size:12px}.story-meta a{font-weight:700;color:#556079}.story-meta .karma{color:#6b62c8}.tag-row{display:flex;gap:7px;flex-wrap:wrap;margin-top:8px}.tag-row a{font-size:12px;background:#f3f2ff;color:#655bd2;padding:2px 8px;border-radius:999px}.sidebar{display:flex;flex-direction:column;gap:14px}.side-card{background:#fff;border:1px solid var(--line);border-radius:14px;padding:17px}.side-card.highlight{border-color:#d9d4ff;background:#f9f8ff}.side-card h3{margin:0 0 8px;font-size:15px}.side-card p{color:var(--muted);font-size:13px}.category-list,.stack-links{display:flex;flex-direction:column}.category-list a,.stack-links a{display:flex;justify-content:space-between;gap:12px;padding:8px 0;border-top:1px solid #eef1f6}.category-list a:first-child,.stack-links a:first-child{border-top:0}.category-list small{color:#969eae}.empty-state{padding:38px;background:#fff;border:1px dashed #cfd5e2;border-radius:var(--radius);text-align:center;color:var(--muted)}.empty-state.compact{padding:20px}.pagination{display:flex;align-items:center;justify-content:space-between;margin:18px 0;color:var(--muted)}.pagination a,.pagination span{background:#fff;border:1px solid var(--line);padding:7px 11px;border-radius:8px}.pagination span:nth-child(2){border:0;background:transparent}.pagination .disabled{opacity:.45}.form-card{background:#fff;border:1px solid var(--line);border-radius:var(--radius);padding:23px;display:flex;flex-direction:column;gap:16px;box-shadow:var(--shadow)}label{display:flex;flex-direction:column;gap:6px;font-weight:700;color:#374257}label span{font-weight:400;color:#8b94a6;font-size:12px}input,textarea,select{width:100%;border:1px solid #d9deea;background:#fff;padding:10px 11px;border-radius:8px;color:var(--text);outline:none}input:focus,textarea:focus,select:focus{border-color:#9e96f4;box-shadow:0 0 0 3px #efedff}.form-row{display:grid;grid-template-columns:1fr 1fr;gap:15px}.callout{background:#f7f6ff;border:1px solid #e3e0ff;border-radius:10px;padding:12px 14px;color:#55508b}.honeypot{position:absolute!important;left:-10000px!important;width:1px!important;height:1px!important;opacity:0!important}.story-page{align-items:start}.story-detail{background:#fff;border:1px solid var(--line);border-radius:var(--radius);padding:24px}.story-detail-top{display:grid;grid-template-columns:58px 1fr;gap:16px}.big-vote{display:flex;flex-direction:column;align-items:center;border-right:1px solid var(--line);padding-right:14px}.big-vote form{margin:0}.big-vote button{border:0;background:transparent;font-size:20px;color:#818aa0;cursor:pointer}.big-vote button:hover{color:var(--brand)}.big-vote button.down:hover{color:var(--red)}.big-vote strong{font-size:26px}.big-vote small{font-size:10px;color:var(--muted);text-transform:uppercase}.story-detail h1{font-size:32px;line-height:1.2;letter-spacing:-.03em;margin:6px 0 9px}.source-panel{display:grid;grid-template-columns:auto 1fr auto;gap:10px;align-items:center;border:1px solid #e6e3ff;background:#f8f7ff;border-radius:11px;padding:10px 13px;margin:20px 0;color:#655bd2}.source-panel strong{overflow:hidden;text-overflow:ellipsis}.story-body{font-size:16px;color:#343f53;line-height:1.82;margin:18px 0}.story-toolbar{display:flex;align-items:center;gap:13px;border-top:1px solid var(--line);margin-top:18px;padding-top:13px;color:var(--muted)}.story-toolbar button,.comment-actions button,.share-row button,.inline-form button{border:0;background:transparent;color:#626d82;font-weight:700;cursor:pointer;padding:0}.story-toolbar form{margin:0}.story-toolbar details{position:relative}.inline-form{display:flex;flex-direction:column;gap:8px;margin-top:8px}.inline-form.compact{min-width:260px}.story-toolbar .inline-form{position:absolute;z-index:5;background:#fff;border:1px solid var(--line);padding:12px;border-radius:10px;box-shadow:var(--shadow)}.progress{height:7px;background:#e6e7ef;border-radius:999px;overflow:hidden}.progress span{display:block;height:100%;background:linear-gradient(90deg,var(--brand),#8b7df6)}.share-row{display:flex;justify-content:space-between;border-top:1px solid #eef1f6;padding:8px 0}.user-mini{display:flex;gap:10px;align-items:center}.user-mini>span,.user-mini img{width:38px;height:38px;border-radius:50%;display:grid;place-items:center;background:#e8e5ff;color:var(--brand);font-weight:800;object-fit:cover}.user-mini div{display:flex;flex-direction:column}.user-mini small{color:var(--muted)}.comments-section{margin-top:24px}.section-title,.section-heading{display:flex;align-items:center;gap:12px}.section-title{justify-content:space-between}.section-title h2,.section-heading{font-size:20px;margin:0 0 13px}.section-title span{color:var(--muted)}.comment-compose{background:#fff;border:1px solid var(--line);padding:14px;border-radius:13px;margin-bottom:15px}.comment-compose textarea{margin-bottom:8px}.comment{background:#fff;border:1px solid var(--line);border-radius:12px;padding:13px 14px;margin-bottom:9px}.comment-head{display:flex;flex-wrap:wrap;gap:8px;color:#8690a2;font-size:11px}.comment-head strong a{color:#4f59a8}.comment-body{margin:7px 0 8px;color:#313b4d}.comment-actions{display:flex;gap:10px;align-items:flex-start;font-size:12px;color:#7b8497}.comment-actions form{margin:0}.comment-actions details summary{cursor:pointer}.comment-actions .inline-form{padding:9px;background:#f8f9fc;border-radius:8px;min-width:280px}.comment-children{margin-left:25px;margin-top:12px;border-left:2px solid #eceef5;padding-left:12px}.search-hero{display:flex;gap:9px;background:#fff;border:1px solid var(--line);border-radius:14px;padding:12px;margin-bottom:26px}.user-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}.user-card{background:#fff;border:1px solid var(--line);padding:13px;border-radius:11px;display:flex;flex-direction:column}.user-card span{color:var(--muted)}.activity-list{background:#fff;border:1px solid var(--line);border-radius:var(--radius);overflow:hidden}.activity-row{display:grid;grid-template-columns:20px 1fr;gap:7px;padding:12px 16px;border-top:1px solid #eef1f6}.activity-row:first-child{border-top:0}.activity-dot{width:8px;height:8px;border-radius:50%;background:var(--brand);margin-top:8px}.activity-row span{color:#697386}.activity-row em{font-style:normal;color:#3e4a5f}.activity-row small{display:block;color:#9ba3b2}.profile-hero,.group-hero{background:#fff;border:1px solid var(--line);border-radius:var(--radius);padding:24px;margin-bottom:25px;display:grid;grid-template-columns:auto 1fr auto;gap:19px;align-items:center}.profile-avatar{width:78px;height:78px;border-radius:50%;background:linear-gradient(135deg,#e5e1ff,#c6dcff);display:grid;place-items:center;color:var(--brand);font-size:30px;font-weight:900;overflow:hidden}.profile-avatar img{width:100%;height:100%;object-fit:cover}.profile-main h1{font-size:27px;margin:2px 0}.profile-main h1 small{font-size:15px;color:#8d96a6;font-weight:500}.profile-main p{margin:4px 0 10px;color:var(--muted)}.profile-stats{display:flex;gap:22px}.profile-stats span{display:flex;flex-direction:column;font-size:11px;color:var(--muted);text-transform:uppercase}.profile-stats strong{font-size:18px;color:var(--text)}.ledger>div{display:grid;grid-template-columns:1fr auto;gap:1px 10px;padding:8px 0;border-top:1px solid #eef1f6}.ledger>div:first-child{border-top:0}.ledger small{grid-column:1/3;color:#9aa2b1}.positive{color:var(--green)}.negative{color:var(--red)}.leaderboard{background:#fff;border:1px solid var(--line);border-radius:var(--radius);overflow:hidden}.leaderboard a{display:grid;grid-template-columns:52px minmax(180px,1fr) 120px 120px 130px;align-items:center;gap:10px;padding:13px 16px;border-top:1px solid #eef1f6}.leaderboard a:first-child{border-top:0}.leaderboard a:hover{background:#faf9ff}.leaderboard .rank{font-weight:900;color:#9ba3b2}.leaderboard div{display:flex;flex-direction:column}.leaderboard small,.leaderboard> a > span{color:var(--muted)}.leaderboard b{text-align:right;color:var(--brand)}.group-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:13px}.group-card{background:#fff;border:1px solid var(--line);border-radius:14px;padding:17px;display:grid;grid-template-columns:48px 1fr;gap:13px}.group-card:hover{border-color:#d8d3ff}.group-icon{width:48px;height:48px;border-radius:12px;background:#ece9ff;color:var(--brand);display:grid;place-items:center;font-weight:900}.group-icon.large{width:74px;height:74px;font-size:26px;border-radius:18px}.group-card-top{display:flex;align-items:center;justify-content:space-between}.group-card h3{margin:0}.group-card p{margin:4px 0 10px;color:var(--muted)}.group-hero h1{margin:3px 0}.group-hero p{color:var(--muted);margin:4px 0 9px}.hero-actions{display:flex;gap:7px;align-items:center}.table-card{background:#fff;border:1px solid var(--line);border-radius:14px;overflow:auto}.table-card table{border-collapse:collapse;width:100%}.table-card th,.table-card td{padding:11px 13px;text-align:left;border-top:1px solid #eef1f6}.table-card thead th{border-top:0;background:#fafbfc;color:#6c7689;font-size:12px;text-transform:uppercase}.actions{display:flex;gap:10px}.actions form{margin:0}.actions button{border:0;background:transparent;cursor:pointer;color:var(--brand)}.danger-link{color:var(--red)!important}.messages-layout{display:grid;grid-template-columns:minmax(0,1fr) 320px;gap:28px}.message-list{display:flex;flex-direction:column;gap:9px}.message{background:#fff;border:1px solid var(--line);border-radius:13px;padding:13px 15px}.message.sent{margin-left:55px;background:#f8f7ff;border-color:#e1defe}.message.received{margin-right:55px}.message-meta{display:flex;justify-content:space-between;color:#7c8597;font-size:12px}.message p{margin:7px 0}.sticky{position:sticky;top:90px}.prose-page{background:#fff;border:1px solid var(--line);border-radius:var(--radius);padding:32px}.site-footer{background:#fff;border-top:1px solid var(--line);margin-top:20px}.footer-inner{min-height:100px;display:flex;justify-content:space-between;align-items:center;color:var(--muted)}.footer-inner>div{display:flex;flex-direction:column}.footer-inner nav{display:flex;gap:16px}.footer-inner strong{color:var(--text)}
@media(max-width:980px){.header-inner{flex-wrap:wrap;padding:10px 0}.nav-search{order:3;width:100%;margin:0}.primary-nav{overflow:auto}.content-grid,.messages-layout{grid-template-columns:1fr}.sidebar{display:grid;grid-template-columns:repeat(2,1fr)}.leaderboard a{grid-template-columns:40px 1fr auto}.leaderboard a>span:nth-of-type(n+2){display:none}.story-page .sidebar{display:flex}.sticky{position:static}}
@media(max-width:680px){.shell{width:min(100% - 20px,1180px)}.site-header{position:relative}.header-inner{gap:10px}.primary-nav{order:3;width:100%}.nav-search{order:4}.account-nav{margin-left:auto}.account-nav>.button.subtle{display:none}.page-shell{padding-top:20px}.page-heading{align-items:flex-start;flex-direction:column}.page-heading h1{font-size:27px}.story-card{grid-template-columns:52px 1fr}.vote-box{padding:12px 3px}.story-main{padding:12px}.story-detail{padding:16px}.story-detail-top{grid-template-columns:46px 1fr}.story-detail h1{font-size:25px}.form-row,.group-grid,.user-grid,.sidebar{grid-template-columns:1fr}.profile-hero,.group-hero{grid-template-columns:auto 1fr}.profile-hero>div:last-child,.group-hero>.hero-actions{grid-column:1/3}.profile-stats{gap:12px;flex-wrap:wrap}.comment-children{margin-left:9px;padding-left:8px}.messages-layout{display:block}.message.sent,.message.received{margin-left:0;margin-right:0}.footer-inner{padding:24px 0;align-items:flex-start;gap:18px;flex-direction:column}.footer-inner nav{flex-wrap:wrap}}
.search-advanced{margin-bottom:24px}.search-filter-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:12px}.search-main input{font-size:17px}.compact-card{margin-bottom:26px}.compact-card h2{margin:0}.section-heading.spaced{margin-top:28px}.table-ledger{background:#fff;border:1px solid var(--line);border-radius:14px;padding:4px 16px}.profile-tabs{margin-bottom:16px}@media(max-width:760px){.search-filter-grid{grid-template-columns:1fr 1fr}}@media(max-width:520px){.search-filter-grid{grid-template-columns:1fr}}
.role-form select{padding:5px 7px;min-width:105px}

/* Markdown rendering + live preview */
.markdown p { margin: 0 0 .6em; }
.markdown ul, .markdown ol { margin: 0 0 .6em 1.4em; }
.markdown a { text-decoration: underline; }
.markdown.profile-bio p { margin: 0; }
.markdown-preview { border: 1px dashed var(--border, #d4d8e0); border-radius: 8px; padding: .8em 1em; margin-top: .5em; background: rgba(0,0,0,.02); font-size: .95em; }
.markdown-preview:empty, .markdown-preview[hidden] { display: none; }
.markdown-preview::before { content: "Preview"; display: block; font-size: .72em; text-transform: uppercase; letter-spacing: .08em; color: #8a90a0; margin-bottom: .35em; }
.field-status { display: block; font-size: .8em; color: #8a90a0; min-height: 1.1em; margin-top: .25em; }
.field-status.ok { color: #1a8f5c; }
.field-status.error { color: #c0392b; }

/* Avatars: letter fallback + gravatar/upload image overlay */
.avatar{position:relative;display:inline-grid;place-items:center;width:38px;height:38px;border-radius:50%;background:#e8e5ff;color:var(--brand);font-weight:800;overflow:hidden;flex:0 0 auto}
.avatar::before{content:attr(data-letter)}
.avatar img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;border-radius:50%}
.profile-avatar .avatar{width:100%;height:100%;font-size:inherit}

.avatar-edit{display:flex;gap:12px;align-items:center;margin-bottom:.5em}
.avatar-edit .avatar{width:56px;height:56px}
.avatar-edit small{color:var(--muted, #8a90a0)}
