:root {
  --bg: #120d14;
  --panel: #1b1420;
  --line: #2a2030;
  --text: #ece6ef;
  --muted: #9a8fa3;
  --gold: #d4a24c;
  --accent: #e0699a;
  --danger: #ff6b6b;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body { font: 14px/1.45 var(--mono); -webkit-text-size-adjust: 100%; }
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.app { display: flex; flex-direction: column; height: 100dvh; max-width: 1100px; margin: 0 auto; }
body[data-mode="embed"] .app { max-width: none; }

.top {
  display: flex; align-items: center; gap: 10px; padding: 8px 16px;
  border-bottom: 1px solid var(--line); background: var(--panel); min-height: 44px;
}
.brand { font: 600 15px var(--sans); color: var(--gold); white-space: nowrap; }
.tabs { display: flex; gap: 4px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  background: none; border: 0; border-bottom: 2px solid transparent; padding: 6px 8px; cursor: pointer;
  color: var(--muted); white-space: nowrap;
}
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.tab .unread { margin-left: 4px; font-size: 11px; background: var(--accent); color: #fff; border-radius: 8px; padding: 0 5px; }
.online { color: var(--muted); font-size: 12px; white-space: nowrap; }
.close { background: none; border: 0; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); padding: 0 4px; }

.banner { padding: 6px 16px; background: #3a2a10; color: #f5d9a0; font-size: 12px; border-bottom: 1px solid var(--line); }

.log { flex: 1; overflow-y: auto; padding: 8px 16px; overscroll-behavior: contain; }
.line { padding: 1px 0; word-wrap: break-word; overflow-wrap: anywhere; white-space: pre-wrap; position: relative; }
.line:hover { background: #ffffff08; }
.ts { color: #6d6275; margin-right: 6px; font-size: 12px; }
.badge {
  display: inline-block; font: 600 10px/1.6 var(--sans); padding: 0 4px; margin-right: 4px; border-radius: 3px;
  vertical-align: 1px; background: #33283a; color: var(--muted); letter-spacing: .03em;
}
.badge.b-TG { background: var(--gold); color: #1a1205; }
.badge.b-STAFF { background: #5b3f8f; color: #fff; }
.badge.b-BEN, .badge.b-TKL { background: #6d2a48; color: #ffd2e4; }
.badge.b-CON { background: #2c4a5a; color: #cfeaff; }
.badge.b-INS, .badge.b-CUR { background: #2f3a2a; color: #d5ecc8; }
.nick { font-weight: 600; }
.nick::before { content: "<"; color: #6d6275; font-weight: 400; }
.nick::after { content: ">"; color: #6d6275; font-weight: 400; margin-right: 6px; }
.line.action .nick::before { content: "* "; }
.line.action .nick::after { content: " "; margin-right: 0; }
.line.action .body { font-style: italic; }
.line.sys { color: var(--muted); font-style: italic; }
.line.pending .body { opacity: .6; }
.pending-tag { color: var(--gold); font-size: 11px; margin-left: 6px; }
.rep {
  position: absolute; right: 0; top: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 4px;
  font-size: 11px; padding: 0 6px; cursor: pointer; color: var(--muted); display: none;
}
.line:hover .rep, .line.sel .rep { display: block; }
@media (hover: none) { .line .rep { display: none; } .line.sel .rep { display: block; } }

.composer { display: flex; gap: 8px; padding: 8px 16px; border-top: 1px solid var(--line); background: var(--panel); }
.composer input {
  flex: 1; min-width: 0; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 9px 10px; font-size: 16px;
}
.composer input:focus { outline: none; border-color: var(--accent); }
.composer button, .overlay button.primary {
  background: var(--accent); color: #fff; border: 0; border-radius: 6px; padding: 8px 14px; cursor: pointer; font-family: var(--sans); font-weight: 600;
}
.composer button:disabled { opacity: .5; cursor: default; }
.status { min-height: 18px; padding: 0 16px 6px; font-size: 12px; color: var(--muted); background: var(--panel); }
.status.err { color: var(--danger); }

.overlay {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(10, 6, 12, .92); z-index: 10;
}
.card {
  width: 100%; max-width: 420px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 20px;
  font-family: var(--sans);
}
.card h2 { margin: 0 0 8px; font-size: 18px; color: var(--gold); }
.card p, .card li { color: var(--text); font-size: 14px; }
.card ol { padding-left: 20px; }
.card input { width: 100%; padding: 10px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); font-size: 16px; margin: 6px 0 4px; }
.card .help { color: var(--muted); font-size: 12px; }
.card .err { color: var(--danger); font-size: 13px; min-height: 18px; }
.card a.primary { display: inline-block; background: var(--accent); color: #fff; text-decoration: none; border-radius: 6px; padding: 9px 16px; font-weight: 600; }
.card .row { display: flex; justify-content: flex-end; margin-top: 12px; }

@media (max-width: 600px) {
  .top { padding: 6px 12px; gap: 6px; }
  .log, .composer, .status { padding-left: 12px; padding-right: 12px; }
  .ts { display: none; }
}

/* /mod */
.mod { max-width: 1100px; margin: 0 auto; padding: 16px; font-family: var(--sans); }
.mod h1 { color: var(--gold); font-size: 20px; margin: 0 0 12px; }
.mod h2 { font-size: 15px; margin: 20px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.mod .item { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }
.mod .item:target { border-color: var(--gold); }
.mod .meta { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.mod .text { font-family: var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; margin-bottom: 8px; }
.mod .acts { display: flex; flex-wrap: wrap; gap: 6px; }
.mod .acts button, .mod .bar button {
  background: #2a2030; border: 1px solid var(--line); border-radius: 5px; padding: 4px 9px; cursor: pointer; font-size: 12px;
}
.mod .acts button.ok { background: #1f3a26; }
.mod .acts button.bad { background: #4a1f25; }
.mod .bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.mod table { width: 100%; border-collapse: collapse; font-size: 12px; }
.mod td, .mod th { text-align: left; padding: 4px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.mod .tag { font-size: 11px; padding: 0 5px; border-radius: 3px; background: #3a2a10; color: #f5d9a0; margin-right: 4px; }
.mod .tag.minors { background: #5a1f1f; color: #ffd0d0; }
.mod .empty { color: var(--muted); }
.mod .scroll { overflow-x: auto; }
