* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #f7f7f8; --surface: #ffffff; --border: #e7e7ea; --ink: #16161a;
  --dim: #74747e; --faint: #a5a5ad; --danger: #dc2626; --ok: #16a34a;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.04);
}
html { font-size: 15px; }
body { background: var(--bg); color: var(--ink); font-family: "Inter", system-ui, sans-serif; line-height: 1.5; min-height: 100vh; }
button { font-family: inherit; }

/* ---------- buttons ---------- */
.btn { display: inline-block; background: var(--ink); color: #fff; border: 0; font-weight: 600; font-size: .95rem; padding: 10px 22px; border-radius: 8px; cursor: pointer; text-decoration: none; text-align: center; }
.btn:hover { background: #000; }
.btn:disabled { background: var(--border); color: var(--faint); cursor: default; }
.btn-lg { padding: 12px 30px; font-size: 1rem; }
.btn-block { width: 100%; margin-top: 6px; }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 26px; padding: 24px; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); padding: 56px 64px; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; max-width: 460px; }
.auth-logo { width: 112px; height: 112px; object-fit: contain; margin-bottom: 6px; }
.auth-card h1 { font-size: 1.45rem; font-weight: 800; letter-spacing: -.01em; }
.auth-card p { color: var(--dim); font-size: .92rem; margin-bottom: 8px; }
.auth-discord { display: flex; align-items: center; gap: 8px; color: var(--dim); font-size: .88rem; font-weight: 500; text-decoration: none; margin-top: 4px; }
.auth-discord:hover { color: var(--ink); }
.auth-foot { color: var(--faint); font-size: .82rem; font-family: ui-monospace, monospace; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #5865F2; display: inline-block; animation: dotpulse 2.4s ease-in-out infinite; }
@keyframes dotpulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* ---------- topbar ---------- */
.topbar { height: 60px; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 24px; padding: 0 22px; position: sticky; top: 0; z-index: 40; }
.ident { display: flex; align-items: center; gap: 11px; min-width: 210px; }
.mark { width: 34px; height: 34px; object-fit: contain; }
.ident-txt { display: flex; flex-direction: column; line-height: 1.15; }
.ident-name { font-weight: 700; font-size: .95rem; letter-spacing: -.01em; }
.ident-sub { font-size: .72rem; color: var(--dim); font-weight: 500; }
.topbar-mid { flex: 1; display: flex; justify-content: center; }
#search { width: min(420px, 100%); background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 9px 14px; font: inherit; font-size: .9rem; outline: none; }
#search:focus { border-color: var(--faint); background: var(--surface); }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.discord-link { display: flex; align-items: center; gap: 7px; color: var(--dim); font-size: .85rem; font-weight: 600; text-decoration: none; padding: 7px 12px; border: 1px solid var(--border); border-radius: 8px; }
.discord-link:hover { color: var(--ink); border-color: var(--faint); }
.user-chip { display: flex; align-items: center; gap: 8px; font-size: .85rem; font-weight: 600; }
.user-chip img { width: 26px; height: 26px; border-radius: 50%; }
.quiet-link { color: var(--faint); font-size: .82rem; text-decoration: none; }
.quiet-link:hover { color: var(--danger); }

/* ---------- shell / sidebar ---------- */
.shell { display: flex; min-height: calc(100vh - 60px); }
.side { width: 230px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border); padding: 18px 0 40px; overflow-y: auto; position: sticky; top: 60px; height: calc(100vh - 60px); }
.side-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: var(--faint); font-weight: 700; padding: 14px 22px 6px; }
.side-item { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 7px 22px; font-size: .89rem; color: var(--dim); cursor: pointer; font-weight: 500; border-left: 2px solid transparent; }
.side-item:hover { color: var(--ink); }
.side-item.active { color: var(--ink); font-weight: 600; border-left-color: var(--ink); background: var(--bg); }
.side-item.sub { padding-left: 34px; font-size: .85rem; }

/* ---------- content ---------- */
.content { flex: 1; padding: 24px 28px 60px; max-width: 1280px; }
.content-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 16px; flex-wrap: wrap; }
.content-head h2 { font-size: 1.15rem; font-weight: 700; letter-spacing: -.01em; }

.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 2px; }
.seg.hidden { display: none; }
.seg-b { border: 0; background: none; padding: 6px 14px; font-size: .82rem; font-weight: 600; color: var(--dim); border-radius: 6px; cursor: pointer; }
.seg-b.active { background: var(--ink); color: #fff; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 12px 12px; cursor: pointer; text-align: center; position: relative; box-shadow: var(--shadow); transition: border-color .12s, transform .12s; }
.card:hover { border-color: var(--faint); transform: translateY(-2px); }
.card img { width: 100%; height: 84px; object-fit: contain; }
.card .noimg { height: 84px; display: flex; align-items: center; justify-content: center; color: var(--faint); font-size: 26px; }
.card .cname { margin-top: 10px; font-size: .8rem; color: var(--ink); font-weight: 500; min-height: 32px; }
.card .eq { position: absolute; top: 8px; left: 8px; font-size: .64rem; font-weight: 700; letter-spacing: .04em; color: var(--ok); background: #f0fdf4; border: 1px solid #bbf7d0; padding: 1px 7px; border-radius: 20px; }
.empty { color: var(--faint); padding: 60px 0; text-align: center; grid-column: 1/-1; }

/* ---------- drawer ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(20,20,26,.28); z-index: 60; }
.backdrop.hidden { display: none; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 400px; max-width: 94vw; background: var(--surface); border-left: 1px solid var(--border); z-index: 70; display: flex; flex-direction: column; overflow-y: auto; box-shadow: -12px 0 32px rgba(0,0,0,.08); }
.drawer.hidden { display: none; }
.drawer-x { position: absolute; top: 12px; right: 14px; background: none; border: 0; font-size: 26px; color: var(--faint); cursor: pointer; line-height: 1; }
.drawer-x:hover { color: var(--ink); }
.drawer-media { background: var(--bg); border-bottom: 1px solid var(--border); padding: 34px 24px; display: flex; justify-content: center; }
.drawer-media img { width: 260px; height: 160px; object-fit: contain; }
.drawer-body { padding: 20px 24px 32px; display: flex; flex-direction: column; gap: 16px; }
.drawer-body h3 { font-size: 1.02rem; font-weight: 700; letter-spacing: -.01em; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field.hidden { display: none; }
.field-label { font-size: .78rem; font-weight: 600; color: var(--dim); }
.field-label em { font-style: normal; color: var(--ink); font-family: ui-monospace, monospace; }
input[type=range] { width: 100%; accent-color: var(--ink); }
.presets { display: flex; gap: 6px; }
.presets button { flex: 1; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 5px 0; font-size: .74rem; font-weight: 600; color: var(--dim); cursor: pointer; }
.presets button:hover { color: var(--ink); border-color: var(--faint); }
.row-2 { flex-direction: row; gap: 18px; align-items: center; }
.mini { font-size: .82rem; color: var(--dim); font-weight: 500; display: flex; align-items: center; gap: 8px; }
.mini input[type=number] { width: 84px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; font: inherit; font-size: .85rem; outline: none; }
.mini input[type=checkbox] { accent-color: var(--ink); width: 15px; height: 15px; }
.drawer-msg { font-size: .82rem; min-height: 18px; }
.drawer-msg.good { color: var(--ok); }
.drawer-msg.bad { color: var(--danger); }

@media (max-width: 860px) {
  .side { position: fixed; left: 0; bottom: 0; top: auto; height: auto; width: 100%; display: flex; overflow-x: auto; border-top: 1px solid var(--border); border-right: 0; padding: 6px; z-index: 45; }
  .side-label { display: none; }
  .side-item { border-left: 0; white-space: nowrap; width: auto; }
  .content { padding-bottom: 120px; }
  .topbar { gap: 12px; }
  .ident-txt { display: none; }
}
