:root {
  color-scheme: dark;
  --bg: #08090a; --side: #0c0d0e; --panel: #111314; --raise: #17191b; --hover: #1d2022;
  --line: #1c1f21; --line2: #272b2e;
  --text: #f3f5f4; --muted: #949a97; --faint: #5d6361;
  --accent: #3ec482; --accent-ink: #04140c; --accent-soft: rgba(62, 196, 130, .12);
  --warn: #e5b454; --warn-soft: rgba(229, 180, 84, .12);
  --bad: #ff7a8a; --bad-soft: rgba(255, 122, 138, .12);
  --discord: #5865f2;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Inter", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --r: 12px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--bg); }
body { color: var(--text); font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
.i { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* gate */
.gate { min-height: 100svh; display: grid; place-items: center; padding: 24px 16px; text-align: center; }
.gate .box { width: 100%; max-width: 340px; display: grid; gap: 14px; justify-items: center; }
.gate img { width: 48px; height: 48px; }
.gate h1 { font-size: 22px; font-weight: 650; letter-spacing: -.02em; }
.gate p { color: var(--muted); }
.gate .btn { width: 100%; min-height: 44px; font-size: 14px; }
.gate .logins { width: 100%; display: grid; gap: 10px; margin-top: 6px; }
.gate .btn .i { width: 18px; height: 18px; }
.btn.gg { background: #fff; border-color: transparent; color: #1f1f1f; }
.btn.gg:hover { background: #ececec; }
.gate .fine, .fine { color: var(--faint); font-size: 12.5px; }
.gate .acctbox { width: 100%; display: grid; gap: 8px; justify-items: start; padding: 14px; margin-top: 4px; border-radius: var(--r); border: 1px solid var(--line2); background: var(--panel); text-align: left; }
.acct { display: flex; align-items: center; gap: 11px; min-width: 0; }
.acct .av { width: 36px; height: 36px; }
.acct b { display: block; font-weight: 600; }
.acct small { display: block; color: var(--muted); overflow-wrap: anywhere; }

/* controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line2); background: var(--raise); font-weight: 600; font-size: 13px; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--hover); }
.btn.go { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.btn.go:hover { filter: brightness(1.08); }
.btn.dc { background: var(--discord); border-color: transparent; color: #fff; }
.btn.ghost { background: none; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--raise); color: var(--text); }
.btn.bad { color: var(--bad); }
.btn.sm { min-height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: default; }
.input, textarea, select { width: 100%; min-height: 38px; padding: 8px 11px; border-radius: 10px; border: 1px solid var(--line2); background: #0b0c0d; color: var(--text); font: inherit; outline: none; }
.input:focus, textarea:focus, select:focus { border-color: #3a4a42; }
textarea { resize: vertical; min-height: 84px; }
textarea.code { font: 12.5px/1.55 var(--mono); min-height: 420px; white-space: pre; tab-size: 2; overflow: auto; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.err { color: var(--bad); font-size: 13px; min-height: 18px; }

/* shell */
.app { display: grid; grid-template-columns: 224px minmax(0, 1fr); min-height: 100svh; }
.side { position: sticky; top: 0; height: 100svh; display: flex; flex-direction: column; gap: 22px; padding: 18px 12px; background: var(--side); border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.brand img { width: 28px; height: 28px; }
.brand b { display: block; font-size: 14px; font-weight: 650; }
.brand small { display: block; color: var(--faint); font-size: 11.5px; }
nav { display: grid; gap: 2px; }
nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; color: var(--muted); text-decoration: none; font-weight: 500; }
nav a:hover { background: var(--raise); color: var(--text); }
nav a[aria-current="page"] { background: var(--raise); color: var(--text); }
nav a[aria-current="page"] .i { color: var(--accent); }
nav em { margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font: 600 11.5px/20px var(--font); text-align: center; font-style: normal; }
.me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 0 4px 0 8px; min-width: 0; }
.me b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.av { width: 28px; height: 28px; flex: none; border-radius: 50%; background: var(--raise); object-fit: cover; }
main { min-width: 0; padding: 32px 36px 60px; max-width: 1080px; }
.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.top h2 { font-size: 22px; font-weight: 650; letter-spacing: -.02em; }
.top p { color: var(--muted); margin-top: 3px; }
.back { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 14px; color: var(--muted); font-weight: 500; text-decoration: none; }
.back:hover { color: var(--text); }

/* lists */
.pills { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.pills button { padding: 5px 12px; border-radius: 99px; border: 1px solid var(--line2); color: var(--muted); font-size: 12.5px; font-weight: 500; }
.pills button[aria-pressed="true"] { background: var(--raise); color: var(--text); border-color: #343a3d; }
.list { display: grid; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); overflow: hidden; }
.row { display: flex; align-items: center; gap: 14px; padding: 13px 16px; min-width: 0; }
.row + .row { border-top: 1px solid var(--line); }
.row.link { cursor: pointer; }
.row.link:hover { background: var(--raise); }
.row .t { flex: 1; min-width: 0; }
.row .t b { display: block; font-weight: 600; overflow-wrap: anywhere; }
.row .t small { display: block; margin-top: 2px; color: var(--muted); overflow-wrap: anywhere; }
.row .t p { margin-top: 6px; color: #c9cecb; white-space: pre-wrap; overflow-wrap: anywhere; }
.row .acts { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; flex: none; }
.row select { width: 160px; min-height: 32px; padding: 4px 9px; font-size: 13px; }
.chip { flex: none; display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 99px; background: var(--raise); color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap; }
.chip.good { background: var(--accent-soft); color: var(--accent); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--faint); }
.dot.on { background: var(--accent); }
.empty { padding: 44px 20px; text-align: center; color: var(--faint); border: 1px dashed var(--line2); border-radius: var(--r); }
.section { margin: 26px 0 10px; color: var(--faint); font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.section:first-of-type { margin-top: 0; }
.note { padding: 11px 14px; margin-bottom: 14px; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line); color: var(--muted); }
.card { padding: 18px; border-radius: var(--r); border: 1px solid var(--line); background: var(--panel); display: grid; gap: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.bar .sp { flex: 1; }
.loader { display: flex; gap: 8px; align-items: center; padding: 8px 8px 8px 12px; border-radius: 10px; background: #0b0c0d; border: 1px solid var(--line2); font: 12px var(--mono); color: var(--muted); min-width: 0; }
.loader span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pts { margin-top: 6px; display: grid; gap: 2px; color: #c9cecb; font-size: 13px; }
.pts .add::before { content: "+ "; color: var(--accent); }
.pts .rem::before { content: "- "; color: var(--bad); }
.pts .oth::before { content: "* "; color: var(--faint); }

/* modal */
.modal { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 16px; overflow: auto; background: rgba(0, 0, 0, .7); }
.modal form { width: 100%; max-width: 500px; display: grid; gap: 14px; padding: 22px; border-radius: 16px; border: 1px solid var(--line2); background: var(--panel); }
.modal h3 { font-size: 17px; font-weight: 650; }
.mb { display: flex; justify-content: flex-end; gap: 8px; }
.mb .sp { flex: 1; }

/* chat */
.chat { display: flex; flex-direction: column; height: calc(100svh - 150px); min-height: 380px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); }
.log { flex: 1; overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.msg { display: flex; gap: 10px; min-width: 0; }
.msg .t { min-width: 0; flex: 1; }
.msg b { font-weight: 600; }
.msg small { margin-left: 6px; color: var(--faint); font-size: 12px; }
.msg p { margin-top: 1px; color: #d6dbd8; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg .pic { display: block; margin-top: 6px; max-width: min(360px, 100%); max-height: 280px; border-radius: 10px; border: 1px solid var(--line2); }
.msg .file { display: inline-flex; margin-top: 6px; }
.msg .upd { margin-top: 6px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line2); background: var(--raise); }
.compose { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); align-items: flex-end; }
.compose textarea { min-height: 38px; height: 38px; max-height: 160px; resize: none; }
.compose .att { display: flex; align-items: center; gap: 6px; padding: 0 10px 8px; color: var(--muted); font-size: 12.5px; }

.toast { position: fixed; left: 50%; bottom: 22px; z-index: 20; transform: translateX(-50%); padding: 9px 14px; border-radius: 10px; background: var(--raise); border: 1px solid var(--line2); font-weight: 500; }

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 5; inset: auto 0 0 0; height: auto; flex-direction: row; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); }
  .brand, .me { display: none; }
  nav { flex: 1; display: flex; justify-content: space-around; }
  nav a { position: relative; flex-direction: column; gap: 3px; padding: 6px 12px; font-size: 11px; }
  nav em { position: absolute; top: 2px; left: calc(50% + 6px); margin: 0; min-width: 16px; padding: 0 4px; font-size: 10px; line-height: 16px; }
  main { padding: 22px 16px 96px; }
  .top { flex-direction: column; align-items: stretch; }
  .row { flex-wrap: wrap; }
  .row .acts { width: 100%; justify-content: flex-start; }
  .row select { width: 100%; }
  .grid2 { grid-template-columns: 1fr; }
  .chat { height: calc(100svh - 190px); }
}
