:root {
  --bg: #32353b;
  --panel: #36393f;
  --panel-head: #2f3136;
  --line: #44474e;
  --in: #4b5059;
  --in-border: #5d636d;
  --text: #e3e5e8;
  --muted: #a3a6aa;
  --blue: #00a8fc;
  --blue-dark: #0a86c7;
  --green: #23a55a;
  --red: #f05a5a;
  --gray: #6b7380;
  --dc-bg: #313338;
  --dc-embed: #2b2d31;
  --dc-text: #dbdee1;
  --dc-muted: #949ba4;
  --dc-link: #00a8fc;
  --font: "gg sans", "Noto Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.4 var(--font); }
a { color: var(--blue); }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
h1, h2, h3 { margin: 0 0 12px; font-weight: 700; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.error { color: var(--red); }
.row { display: flex; align-items: center; }
.gap { gap: 10px; }
.spacer { flex: 1; }

/* buttons */
.btn { border: 0; border-radius: 3px; padding: 9px 14px; font: 500 14px var(--font); color: #fff; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-blue { background: var(--blue); }
.btn-blue:hover { background: var(--blue-dark); }
.btn-dim { background: #1b7db8; opacity: .8; }
.btn-green { background: var(--green); }
.btn-red { background: var(--red); }
.btn-gray { background: var(--gray); }
.btn-gray:hover { background: #7b8492; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--in-border); }
.btn-ghost:hover { background: #40444b; }
.btn-ghost.danger { color: var(--red); }
.btn-outline { background: transparent; color: var(--blue); border: 1px solid var(--blue); }
.btn-sm { padding: 4px 9px; font-size: 12px; }
.btn-wide { width: 100%; margin: 6px 0 2px; }
.btn-discord { background: #5865f2; padding: 12px 22px; font-size: 16px; }
.actions { margin-top: 16px; }

/* inputs */
.in { width: 100%; background: var(--in); color: var(--text); border: 1px solid var(--in-border); border-radius: 3px; padding: 9px 12px; font: 14px var(--font); min-width: 0; }
.in:focus { outline: 2px solid var(--blue); outline-offset: -1px; }
.ta { resize: vertical; min-height: 40px; }
select.in { cursor: pointer; }
.counter { font-size: 11px; color: var(--muted); margin: 3px 0 10px; }
.lbl { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.check { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); margin-top: 10px; cursor: pointer; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(ellipse at top, #3b3f47, #1e2024); }
.login-card { background: var(--panel); padding: 40px 48px; border-radius: 8px; text-align: center; width: min(420px, 92vw); box-shadow: 0 10px 40px #0008; }
.login-logo { width: 110px; height: 110px; border-radius: 50%; object-fit: cover; margin-bottom: 14px; }
.login-card .btn { margin-top: 12px; }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 10; height: 54px; display: flex; align-items: center; gap: 24px; padding: 0 20px; background: #202225; border-bottom: 1px solid #111; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; letter-spacing: .3px; }
.brand img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.tabs { display: flex; gap: 4px; }
.tab { background: none; border: 0; color: var(--muted); font: 500 14px var(--font); padding: 8px 12px; border-radius: 4px; cursor: pointer; }
.tab.active, .tab:hover { color: #fff; background: #36393f; }
.me { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.me img { width: 30px; height: 30px; border-radius: 50%; }

/* layout */
.view { padding: 20px; }
.grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 1100px) { .grid { grid-template-columns: 1fr; } }
.panel { background: var(--panel); border: 1px solid #2a2c31; border-radius: 4px; }
.panel.sticky { position: sticky; top: 74px; max-height: calc(100vh - 94px); overflow: auto; }
.panel.narrow { max-width: 760px; margin: 0 auto; }
.panel-head { background: var(--panel-head); padding: 12px 18px; border-bottom: 1px solid #2a2c31; font-weight: 500; }
.panel-body { padding: 18px 20px 22px; }
.edit-bar { margin-top: 14px; background: #2f3136; padding: 12px; border-radius: 4px; }
.json-row { margin-top: 18px; }
.json-row .in { flex: 1; }
.import-info { margin-top: 10px; background: #2f3136; padding: 10px 12px; border-radius: 4px; font-size: 13px; }

/* embed card */
.embed-card { border: 1px solid #2a2c31; border-left: 4px solid #1e1f22; background: #393c43; border-radius: 4px; padding: 16px 18px; margin-bottom: 14px; }
.embed-card-top { flex-wrap: wrap; }
.embed-no { font-weight: 700; margin-right: 4px; }
.color-in { width: 38px; height: 32px; padding: 0; border: 1px solid var(--in-border); border-radius: 3px; background: none; cursor: pointer; }
.hex-in { width: 96px; padding: 6px 8px; }
.row3 { display: grid; grid-template-columns: 1fr 2fr 1.2fr; gap: 10px; margin-bottom: 12px; }
.row2 { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; align-items: start; margin-bottom: 4px; }
.row2 + .row-footer, .row2:last-of-type { margin-top: 10px; }
.row-footer { display: grid; grid-template-columns: 1.2fr 1fr 1.6fr; gap: 10px; align-items: start; margin-top: 10px; }
.ts-wrap { display: flex; gap: 6px; }
.ts-wrap .in { flex: 1; color-scheme: dark; }
.field-row { display: grid; grid-template-columns: 1fr 1.6fr auto; gap: 8px; background: #2f3136; padding: 8px; border-radius: 4px; margin: 8px 0; align-items: start; }
.field-tools { display: flex; gap: 4px; align-items: center; }
.field-tools .check { margin: 0 4px 0 0; }
@media (max-width: 700px) { .row3, .row2, .row-footer, .field-row { grid-template-columns: 1fr; } }

/* toast */
.toast { position: fixed; right: 20px; bottom: 20px; max-width: 480px; z-index: 50; padding: 12px 16px; border-radius: 6px; background: #1e1f22; border-left: 4px solid var(--green); box-shadow: 0 6px 24px #000a; }
.toast.err { border-left-color: var(--red); }
.toast.warn { border-left-color: #f0b232; }
.toast a { margin-left: 6px; }

/* ---------- Discord preview ---------- */
.dc { background: var(--dc-bg); border-radius: 4px; padding: 14px 16px 16px 0; color: var(--dc-text); font-family: var(--font); font-size: 15px; line-height: 1.375; }
.dc a { color: var(--dc-link); text-decoration: none; }
.dc a:hover { text-decoration: underline; }
.dc-msg { display: flex; }
.dc-avatar { width: 40px; height: 40px; border-radius: 50%; margin: 2px 16px 0; flex: none; object-fit: cover; }
.dc-body { min-width: 0; flex: 1; }
.dc-head { display: flex; align-items: center; gap: 6px; }
.dc-name { color: #f2f3f5; font-weight: 500; font-size: 16px; }
.app-badge { background: #5865f2; color: #fff; font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 3px; line-height: 15px; }
.dc-time { color: var(--dc-muted); font-size: 12px; margin-left: 2px; }
.dc-content { margin-top: 2px; white-space: normal; word-wrap: break-word; }
.dc-empty { color: var(--dc-muted); font-style: italic; margin-top: 4px; }
.dc-embed { margin-top: 6px; max-width: 520px; background: var(--dc-embed); border-left: 4px solid #1e1f22; border-radius: 4px; }
.dc-embed-grid { display: grid; grid-template-columns: auto; padding: 8px 16px 16px 12px; }
.dc-embed-grid.has-thumb { grid-template-columns: minmax(0, 1fr) auto; }
.dc-embed-grid > * { grid-column: 1; min-width: 0; }
.dc-author { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 14px; font-weight: 600; color: #f2f3f5; }
.dc-author a { color: #f2f3f5; }
.dc-author img { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
.dc-title { margin-top: 8px; font-size: 16px; font-weight: 600; color: #f2f3f5; }
.dc-desc { margin-top: 8px; font-size: 14px; word-wrap: break-word; }
.dc-fields { display: grid; grid-template-columns: repeat(12, 1fr); gap: 8px; margin-top: 8px; }
.dc-fname { font-size: 14px; font-weight: 600; color: #f2f3f5; margin-bottom: 2px; }
.dc-fval { font-size: 14px; word-wrap: break-word; }
.dc-image { margin-top: 16px; }
.dc-image img { max-width: 100%; max-height: 300px; border-radius: 4px; display: block; }
.dc-thumb { grid-column: 2 !important; grid-row: 1 / 8; margin: 8px 0 0 16px; }
.dc-thumb img { width: 80px; height: 80px; object-fit: contain; border-radius: 4px; }
.dc-footer { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; color: var(--dc-muted); }
.dc-footer img { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; }
.md-code { background: #1e1f22; padding: 1px 4px; border-radius: 4px; font-family: Consolas, monospace; font-size: 85%; }
.md-pre { background: #1e1f22; border: 1px solid #1a1b1e; border-radius: 4px; padding: 8px; margin: 6px 0; white-space: pre-wrap; font-family: Consolas, monospace; font-size: 13px; }
.md-quote { border-left: 4px solid #4e5058; padding-left: 12px; margin: 2px 0; }
.md-list { margin: 2px 0; padding-left: 22px; }
.md-h1 { font-size: 24px; font-weight: 700; margin: 6px 0 2px; color: #f2f3f5; }
.md-h2 { font-size: 20px; font-weight: 700; margin: 6px 0 2px; color: #f2f3f5; }
.md-h3 { font-size: 16px; font-weight: 700; margin: 6px 0 2px; color: #f2f3f5; }
.md-sub { font-size: 12px; color: var(--dc-muted); }
.md-mention { background: #5865f24d; color: #c9cdfb; padding: 0 2px; border-radius: 3px; font-weight: 500; }
.md-ts { background: #ffffff14; padding: 0 2px; border-radius: 3px; }
.md-emoji { width: 1.375em; height: 1.375em; vertical-align: bottom; object-fit: contain; }
.md-spoiler { background: #1e1f22; color: transparent; border-radius: 3px; cursor: pointer; }
.md-spoiler.shown { background: #ffffff1a; color: inherit; }

/* bot profile */
.profile-card { position: relative; background: #232428; border-radius: 8px; overflow: hidden; margin-bottom: 20px; padding-bottom: 16px; max-width: 420px; }
.profile-banner { height: 150px; background: #5865f2 center / cover no-repeat; }
.profile-avatar { position: absolute; top: 96px; left: 16px; width: 92px; height: 92px; border-radius: 50%; border: 6px solid #232428; object-fit: cover; background: #232428; }
.profile-name { margin: 52px 16px 0; font-size: 20px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.pf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 700px) { .pf-grid { grid-template-columns: 1fr; } }

.with-up { display: flex; gap: 6px; }
.with-up .in { flex: 1; }
.up-row { grid-template-columns: 1fr 1fr; }
