:root {
  --ink: #121011;
  --surface: #1a1616;
  --raised: #231e1d;
  --line: #2f2927;
  --line-2: #3b3431;
  --text: #f3ede8;
  --muted: #a1958e;
  --faint: #6f6560;
  --orange: #f07a2e;
  --orange-2: #ff8e45;
  --online: #3ba55d;
  --gold: #f2c14e;
  --display: 'Bricolage Grotesque', system-ui, sans-serif;
  --body: 'DM Sans', system-ui, sans-serif;
  --wrap: 1200px;
  --r-lg: 18px;
  --r-md: 12px;
  --r-sm: 8px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--ink); color: var(--text); font: 400 1rem/1.55 var(--body); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; border-radius: 6px; }
.wrap { width: min(var(--wrap), 100% - 32px); margin-inline: auto; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--orange); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 50; }
.skip:focus { left: 16px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- top bar ---------- */
.top { position: sticky; top: 0; z-index: 30; background: rgb(18 16 17 / .9); backdrop-filter: saturate(140%) blur(12px); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; gap: 26px; height: 64px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; font: 700 1.08rem var(--display); letter-spacing: -.01em; }
.logo img { width: 34px; height: 34px; border-radius: 9px; }
.top nav { display: flex; gap: 4px; }
.top nav a { text-decoration: none; color: var(--muted); padding: 8px 12px; border-radius: 8px; font-weight: 500; font-size: .95rem; }
.top nav a:hover, .top nav a[aria-current] { color: var(--text); background: var(--raised); }
.top .right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.me { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 999px; background: var(--raised); border: 1px solid var(--line); text-decoration: none; font-size: .92rem; }
.me img { width: 28px; height: 28px; border-radius: 50%; }
.menu-btn { display: none; background: none; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border-radius: 10px; font-weight: 600; font-size: .95rem; text-decoration: none; border: 1px solid transparent; cursor: pointer; transition: background .15s, border-color .15s; white-space: nowrap; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-primary { background: var(--orange); color: #fff; }
.btn-primary:hover { background: var(--orange-2); }
.btn-soft { background: var(--raised); border-color: var(--line); }
.btn-soft:hover { border-color: var(--line-2); background: #2a2423; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.btn-ghost:hover { color: var(--text); border-color: var(--line-2); }
.btn-danger { background: transparent; border-color: #5a2a26; color: #f08b80; }
.btn-danger:hover { background: #2a1615; }
.btn-lg { padding: 13px 20px; font-size: 1rem; border-radius: 12px; }
.btn[disabled] { opacity: .55; cursor: default; }

/* ---------- hero ---------- */
.hero { position: relative; padding: 72px 0 56px; overflow: hidden; border-bottom: 1px solid var(--line); }
.hero-bg { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; transform: rotate(-6deg) scale(1.25); opacity: .16; pointer-events: none; filter: saturate(.9); }
.hero-bg div { aspect-ratio: 16 / 9; border-radius: 12px; background: var(--raised) center / cover; }
.hero::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgb(18 16 17 / .55), var(--ink) 92%), radial-gradient(70% 90% at 15% 30%, rgb(18 16 17 / .2), var(--ink)); pointer-events: none; }
.hero .wrap { position: relative; z-index: 1; max-width: 860px; margin-left: max(16px, calc((100% - var(--wrap)) / 2)); }
.hero h1 { font: 800 clamp(2.5rem, 5.6vw, 4.4rem)/1 var(--display); letter-spacing: -.035em; margin: 0 0 16px; }
.hero p { color: var(--muted); font-size: 1.15rem; margin: 0 0 28px; max-width: 52ch; }
.search { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 14px; padding: 6px 6px 6px 16px; max-width: 640px; box-shadow: 0 20px 50px -25px #000; }
.search svg { width: 20px; height: 20px; color: var(--faint); flex: none; }
.search input { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; font-size: 1.05rem; padding: 10px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.chip { border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 999px; padding: 6px 14px; font-size: .9rem; cursor: pointer; text-decoration: none; }
.chip:hover { color: var(--text); border-color: var(--line-2); }
.chip[aria-pressed="true"] { background: var(--text); color: var(--ink); border-color: var(--text); }
.stats { display: flex; gap: 28px; margin-top: 30px; color: var(--muted); font-size: .95rem; }
.stats b { color: var(--text); font: 700 1.25rem var(--display); margin-right: 6px; }

/* ---------- sections ---------- */
.sec { padding: 56px 0; }
.sec-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.sec-head h2 { font: 700 1.7rem/1.1 var(--display); letter-spacing: -.02em; margin: 0; }
.sec-head p { margin: 6px 0 0; color: var(--muted); }
.sec-head .ctrls { display: flex; gap: 8px; }
.icon-btn { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
.icon-btn:hover { border-color: var(--line-2); }
.icon-btn svg { width: 18px; height: 18px; }

/* featured row */
.row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(300px, 360px); gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 8px; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.row > * { scroll-snap-align: start; }

/* ---------- server card ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
.card { position: relative; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; text-decoration: none; transition: border-color .15s, transform .15s; }
.card:hover { border-color: var(--line-2); transform: translateY(-2px); }
.card-banner { position: relative; aspect-ratio: 16 / 7; background: var(--raised); overflow: hidden; }
.card-banner img { width: 100%; height: 100%; object-fit: cover; }
.card-banner .blur { position: absolute; inset: -20%; background: center / cover; filter: blur(28px) saturate(1.3); opacity: .75; transform: scale(1.1); }
.card-body { position: relative; padding: 0 16px 16px; display: flex; flex-direction: column; flex: 1; }
.card-icon { width: 64px; height: 64px; border-radius: 18px; border: 4px solid var(--surface); background: var(--raised); margin-top: -32px; object-fit: cover; }
.card-icon.ph { display: grid; place-items: center; font: 800 1.3rem var(--display); color: var(--muted); }
.card h3 { margin: 10px 0 2px; font: 700 1.12rem/1.2 var(--display); letter-spacing: -.01em; display: flex; align-items: center; gap: 6px; }
.card h3 .verified { width: 18px; height: 18px; color: var(--orange); flex: none; }
.meta { display: flex; flex-wrap: wrap; gap: 12px; color: var(--muted); font-size: .86rem; }
.meta span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--online); }
.dot.grey { background: var(--faint); }
.card p.desc { color: #cfc4bd; font-size: .92rem; margin: 10px 0 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.9em; }
.card .foot { margin-top: auto; display: flex; align-items: center; gap: 8px; }
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: .78rem; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--raised); border: 1px solid var(--line); color: var(--muted); }
.tag.aff { color: #ffd2b3; background: rgb(240 122 46 / .14); border-color: rgb(240 122 46 / .35); }
.tag.tier-Bronze { color: #e1a171; } .tag.tier-Silver { color: #d4dae3; } .tag.tier-Gold { color: var(--gold); } .tag.tier-Diamond { color: #8fdcfa; }
.card .join { margin-left: auto; }
.card.featured { border-color: rgb(240 122 46 / .45); }

.empty { border: 1px dashed var(--line-2); border-radius: var(--r-lg); padding: 40px 24px; text-align: center; color: var(--muted); }
.empty h3 { color: var(--text); font: 700 1.2rem var(--display); margin: 0 0 6px; }
.empty .btn { margin-top: 16px; }
.skeleton { background: linear-gradient(90deg, var(--surface), var(--raised), var(--surface)); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--r-lg); height: 290px; border: 1px solid var(--line); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* call to action band */
.band { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.band > div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 28px; display: flex; flex-direction: column; align-items: flex-start; }
.band h3 { font: 700 1.4rem var(--display); margin: 0 0 6px; letter-spacing: -.01em; }
.band p { color: var(--muted); margin: 0 0 20px; }
.band > div:first-child { background: linear-gradient(135deg, #2a1a12, var(--surface) 60%); border-color: #4a2f20; }

/* ---------- server page ---------- */
.sv-banner { height: clamp(180px, 28vw, 320px); background: var(--raised) center / cover; position: relative; }
.sv-banner::after { content: ''; position: absolute; inset: 0; background: linear-gradient(transparent 40%, var(--ink)); }
.sv-head { display: flex; align-items: flex-end; gap: 20px; margin-top: -64px; position: relative; z-index: 1; flex-wrap: wrap; }
.sv-head .card-icon { width: 120px; height: 120px; border-radius: 30px; border-width: 6px; border-color: var(--ink); margin: 0; }
.sv-head h1 { font: 800 clamp(1.9rem, 4vw, 2.8rem)/1.05 var(--display); letter-spacing: -.025em; margin: 0 0 8px; display: flex; align-items: center; gap: 10px; }
.sv-head .actions { margin-left: auto; display: flex; gap: 10px; padding-bottom: 6px; }
.sv-body { display: grid; grid-template-columns: 1fr 320px; gap: 28px; padding: 32px 0 72px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px; }
.panel h2 { font: 700 1.15rem var(--display); margin: 0 0 12px; }
.panel .text { white-space: pre-wrap; color: #ddd2cb; }
.facts { display: grid; gap: 12px; margin: 0; }
.facts div { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.facts div:last-child { border: 0; padding: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; text-align: right; }

/* ---------- forms ---------- */
.page-head { padding: 48px 0 8px; }
.page-head h1 { font: 800 clamp(2rem, 4.5vw, 3rem)/1.05 var(--display); letter-spacing: -.03em; margin: 0 0 10px; }
.page-head p { color: var(--muted); margin: 0; max-width: 60ch; font-size: 1.05rem; }
.form { display: grid; gap: 22px; max-width: 720px; padding: 28px 0 80px; }
.field label, .field .lbl { display: block; font-weight: 600; margin-bottom: 8px; }
.field .hint { color: var(--muted); font-size: .88rem; margin-top: 6px; }
.input, select.input, textarea.input { width: 100%; background: var(--surface); border: 1px solid var(--line-2); border-radius: 10px; padding: 12px 14px; outline: 0; }
.input:focus { border-color: var(--orange); }
textarea.input { min-height: 120px; resize: vertical; }
.count { float: right; color: var(--faint); font-weight: 400; font-size: .85rem; }
.pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.pick label { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; margin: 0; font-weight: 500; }
.pick label:hover { border-color: var(--line-2); }
.pick input { position: absolute; opacity: 0; pointer-events: none; }
.pick input:checked + label { border-color: var(--orange); background: rgb(240 122 46 / .1); }
.pick input:focus-visible + label { outline: 2px solid var(--orange); }
.pick input:disabled + label { opacity: .5; cursor: default; }
.pick img, .pick .ph { width: 38px; height: 38px; border-radius: 10px; flex: none; background: var(--raised); display: grid; place-items: center; font-weight: 700; color: var(--muted); }
.pick small { display: block; color: var(--muted); font-weight: 400; font-size: .8rem; }
.notice { border-radius: 12px; padding: 14px 16px; border: 1px solid var(--line); background: var(--surface); }
.notice.err { border-color: #5a2a26; background: #221312; color: #f6b3ab; }
.notice.ok { border-color: #234a31; background: #12201a; color: #a8e2bc; }
.login-box { max-width: 520px; margin: 40px 0 100px; }

/* ---------- admin ---------- */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin: 24px 0; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 12px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--text); border-color: var(--orange); }
.tabs .n { background: var(--orange); color: #fff; border-radius: 999px; padding: 0 7px; font-size: .78rem; margin-left: 6px; }
.list { display: grid; gap: 12px; padding-bottom: 80px; }
.item { display: grid; grid-template-columns: 56px 1fr auto; gap: 16px; align-items: start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; }
.item img, .item .ph { width: 56px; height: 56px; border-radius: 14px; background: var(--raised); display: grid; place-items: center; font-weight: 800; color: var(--muted); }
.item h3 { margin: 0 0 4px; font: 700 1.1rem var(--display); }
.item .q { margin: 10px 0 0; color: #d6cbc4; font-size: .93rem; }
.item .q b { display: block; color: var(--muted); font-weight: 600; font-size: .8rem; margin-bottom: 2px; }
.item .acts { display: flex; flex-direction: column; gap: 8px; min-width: 150px; }
.item .acts input { padding: 8px 10px; font-size: .88rem; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--ink); padding: 12px 18px; border-radius: 12px; font-weight: 600; box-shadow: 0 10px 40px #000a; z-index: 60; max-width: calc(100% - 32px); }

/* ---------- legal ---------- */
.legal { padding: 48px 0 96px; }
.legal .wrap { max-width: 760px; }
.legal h1 { font: 800 clamp(2.2rem, 5vw, 3.2rem)/1 var(--display); letter-spacing: -.03em; margin: 0 0 10px; }
.legal .updated { color: var(--muted); margin: 0 0 36px; }
.legal h2 { font: 700 1.35rem var(--display); margin: 36px 0 8px; }
.legal p, .legal li { color: #dccfc5; }
.legal ul { padding-left: 22px; }
.legal li { margin-bottom: 6px; }
.legal a { color: var(--orange-2); }

/* ---------- footer ---------- */
footer { border-top: 1px solid var(--line); padding: 36px 0 48px; color: var(--muted); font-size: .92rem; }
footer .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 18px 32px; }
footer nav { display: flex; flex-wrap: wrap; gap: 20px; margin-left: auto; }
footer a { text-decoration: none; }
footer a:hover { color: var(--text); }

@media (max-width: 900px) {
  .sv-body { grid-template-columns: 1fr; }
  .band { grid-template-columns: 1fr; }
  .hero-bg { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 760px) {
  .top nav { display: none; position: absolute; top: 64px; left: 0; right: 0; background: var(--ink); border-bottom: 1px solid var(--line); padding: 8px 16px 14px; flex-direction: column; }
  .top nav.open { display: flex; }
  .menu-btn { display: block; }
  .top .right .btn-add { display: none; }
  .item { grid-template-columns: 44px 1fr; }
  .item img, .item .ph { width: 44px; height: 44px; }
  .item .acts { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; }
  .sv-head .actions { margin-left: 0; width: 100%; }
  .stats { gap: 18px; flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
#me-slot { display: flex; align-items: center; gap: 10px; }
.card-banner.tint { background: radial-gradient(120% 140% at 0% 0%, hsl(var(--h) 55% 30%), transparent 60%), radial-gradient(120% 140% at 100% 100%, hsl(calc(var(--h) + 40) 45% 22%), var(--raised)); }
.card-icon.ph { background: hsl(var(--h, 20) 35% 22%); color: hsl(var(--h, 20) 70% 82%); }
@media (max-width: 760px) {
  .me span { display: none; }
  .me { padding: 3px; }
  .top .wrap { gap: 12px; }
  #me-slot .btn { padding: 8px 10px; }
}

/* ---------- dashboard ---------- */
.dash-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.dash-item { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface); text-decoration: none; }
.dash-item:hover { border-color: var(--line-2); }
.dash-item img, .dash-item .ph { width: 52px; height: 52px; border-radius: 14px; flex: none; background: var(--raised); display: grid; place-items: center; font-weight: 800; color: var(--muted); }
.dash-item b { display: block; font: 700 1.05rem var(--display); }
.dash-item small { color: var(--muted); }
.dash-item .btn { margin-left: auto; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--faint); vertical-align: middle; }
.status-dot.ok { background: var(--online); }
.status-dot.warn { background: var(--gold); }
.ds-head { display: flex; align-items: center; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.ds-head img, .ds-head .ph { width: 72px; height: 72px; border-radius: 20px; background: var(--raised); display: grid; place-items: center; font: 800 1.4rem var(--display); color: var(--muted); }
.ds-head h1 { font: 800 clamp(1.8rem, 4vw, 2.6rem)/1.05 var(--display); letter-spacing: -.025em; margin: 0 0 4px; }
.ds-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 28px; align-items: start; }
.ds-grid .form { padding: 0; max-width: none; }
.preview { position: sticky; top: 84px; }
.preview .lbl { color: var(--muted); font-size: .85rem; margin-bottom: 8px; }
.dmsg { background: #313338; border-radius: 12px; padding: 16px; color: #dbdee1; font-size: .92rem; }
.dmsg .who { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.dmsg .who img { width: 36px; height: 36px; border-radius: 50%; }
.dmsg .who b { color: #f28c28; }
.dmsg .app { background: #5865f2; color: #fff; font-size: .68rem; font-weight: 700; padding: 1px 5px; border-radius: 4px; }
.dmsg h4 { font: 700 1.2rem var(--body); color: #f2f3f5; margin: 6px 0; }
.dmsg blockquote { margin: 0; border-left: 4px solid #4e5058; padding-left: 10px; white-space: pre-wrap; word-break: break-word; }
.dmsg .inv { margin-top: 10px; background: #2b2d31; border-radius: 8px; padding: 12px; }
.dmsg .inv span { display: block; color: #949ba4; font-size: .8rem; }
.dmsg .inv .go { margin-top: 10px; background: #248046; color: #fff; text-align: center; padding: 8px; border-radius: 4px; font-weight: 600; }
@media (max-width: 960px) { .ds-grid { grid-template-columns: 1fr; } .preview { position: static; } }
.dash-item > span:not(.btn) { min-width: 0; flex: 1; }
.dash-item b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-item .btn { flex: none; }
