:root {
  --bg: #141514;
  --bg-2: #171816;
  --panel: #1b1c1a;
  --panel-2: #20211f;
  --line: #2b2d29;
  --line-2: #363833;
  --text: #ecebe6;
  --muted: #9a9b94;
  --faint: #6c6e67;
  --accent: #e8743a;
  --accent-2: #ef8f5e;
  --accent-bg: #3a241b;
  --green: #7fb35a;
  --green-2: #5c8a3c;
  --green-bg: #1e2a18;
  --red: #e0624f;
  --red-bg: #3a1d19;
  --yellow: #d9b64a;
  --blue: #6fa8dc;
  --radius: 6px;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  --display: "Bahnschrift", "Segoe UI Variable Display", "Segoe UI", sans-serif;
  --mono: "Cascadia Mono", Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 13px/1.45 var(--font); }
svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-2); text-decoration: none; cursor: pointer; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-2); }
::-webkit-scrollbar-thumb { background: #3b3d38; border-radius: 6px; border: 2px solid var(--bg-2); }
::selection { background: var(--accent); color: #111; }

.shell { display: grid; grid-template-columns: 228px 1fr; height: 100vh; }

/* ---------- sidebar ---------- */
.sidebar { background: var(--bg-2); border-right: 1px solid var(--line); padding: 26px 20px 14px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; }
.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.brand-logo { width: 38px; height: 38px; border-radius: 6px; }
.brand-name { font: 700 22px/1 var(--display); letter-spacing: -.01em; }
.brand-sub { font-size: 8.5px; letter-spacing: .25em; color: var(--muted); margin-top: 5px; }
.server-cards { display: flex; flex-direction: column; gap: 8px; }
.server-card { border: 1px solid var(--line-2); background: var(--panel); border-radius: var(--radius); padding: 12px 12px 10px; cursor: pointer; display: grid; grid-template-columns: 22px 1fr 10px; gap: 4px 10px; align-items: center; transition: border-color .15s; }
.server-card:hover { border-color: #4a4c46; }
.server-card.active { border-color: var(--green-2); }
.server-card .sc-icon { grid-row: span 3; color: var(--muted); }
.server-card .sc-name { font-weight: 700; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.server-card .sc-addr { color: var(--muted); font-size: 10.5px; }
.server-card .sc-state { font-size: 11px; font-weight: 600; color: var(--faint); }
.server-card.active .sc-state.on { color: var(--green); }
.server-card .dot { grid-row: 1 / span 2; grid-column: 3; }
.add-card { border: 1px dashed var(--line-2); border-radius: var(--radius); height: 42px; display: flex; align-items: center; justify-content: center; color: var(--muted); cursor: pointer; background: transparent; font-size: 20px; width: 100%; }
.add-card:hover { color: var(--text); border-color: #55574f; }
.add-card.demo { font-size: 12px; gap: 8px; color: var(--accent-2); border-color: #5a3a2a; }
.nav-title { font-size: 10px; letter-spacing: .2em; color: var(--muted); margin: 18px 0 2px 14px; text-transform: uppercase; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: var(--radius); color: var(--text); font-size: 13px; }
.nav a svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.nav a:hover { background: var(--panel-2); }
.nav a.active { background: var(--accent-bg); color: var(--accent-2); }
.nav a.active svg { color: var(--accent-2); }
.badge { margin-left: auto; font-size: 10px; background: #2c2e2a; color: var(--muted); padding: 1px 7px; border-radius: 4px; font-weight: 600; }
.badge:empty { display: none; }
.side-lang { display: flex; gap: 8px; margin-top: 18px; padding-top: 4px; }
.side-privacy { display: flex; gap: 10px; align-items: flex-start; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 16px 4px; margin-top: 8px; font-size: 11px; color: var(--muted); }
.side-privacy svg { width: 16px; height: 16px; flex: none; margin-top: 10px; }
.side-privacy small { color: var(--faint); font-size: 10px; }
.side-foot { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); padding: 6px 4px 0; margin-top: auto; }
.side-foot span:last-child { font-family: var(--mono); font-size: 10px; color: var(--faint); }

/* ---------- main ---------- */
.main { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.topbar { height: 50px; flex: none; display: flex; align-items: center; justify-content: space-between; padding: 0 36px; border-bottom: 1px solid var(--line); }
.crumbs { color: var(--muted); display: flex; gap: 14px; }
.crumbs b { color: var(--text); font-weight: 500; }
.crumbs .sep { color: var(--faint); }
.top-actions { display: flex; align-items: center; gap: 14px; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px; border-radius: 4px; border: 1px solid var(--line-2); font-size: 11px; color: var(--muted); }
.pill.on { border-color: #36502a; background: var(--green-bg); color: var(--green); }
.pill.busy { border-color: #5a4a20; color: var(--yellow); }
.pill.bad { border-color: #5a2a22; background: var(--red-bg); color: var(--red); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); display: inline-block; flex: none; }
.dot.on, .pill.on .dot { background: var(--green); box-shadow: 0 0 0 3px #7fb35a22; }
.pill.busy .dot { background: var(--yellow); animation: pulse 1s infinite; }
.pill.bad .dot { background: var(--red); }
.dot.orange { background: var(--accent); }
@keyframes pulse { 50% { opacity: .3; } }

.content { flex: 1; overflow-y: auto; padding: 34px 36px 40px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 30px; gap: 20px; }
.kicker { font-size: 10px; letter-spacing: .22em; color: var(--muted); margin-bottom: 12px; }
h1 { font: 700 30px/1.1 var(--display); margin: 0 0 8px; letter-spacing: -.02em; }
h1 .dot-accent { color: var(--accent); }
.lead { color: var(--muted); margin: 0; }
.updated { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 8px; white-space: nowrap; }
h2 { font-size: 14px; margin: 0; font-weight: 700; }
.sub { font-size: 11px; color: var(--muted); margin-top: 3px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.card-pad { padding: 22px 20px; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 22px 20px 0; }

/* stat cards */
.stats-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-bottom: 22px; }
.stat { padding: 22px 20px 20px; min-height: 168px; display: flex; flex-direction: column; }
.stat-top { display: flex; justify-content: space-between; color: var(--text); font-size: 12px; }
.stat-top svg { width: 17px; height: 17px; color: var(--muted); }
.stat-val { font: 600 40px/1 var(--display); margin-top: 26px; letter-spacing: -.02em; display: flex; align-items: baseline; gap: 6px; }
.stat-val small { font: 400 13px var(--font); color: var(--muted); }
.stat-hint { font-size: 10.5px; color: var(--muted); margin-top: 12px; display: flex; align-items: center; gap: 6px; }
.stat-foot { margin-top: auto; padding-top: 10px; }
.bar { height: 2px; background: var(--line-2); border-radius: 2px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); transition: width .4s; }
.spark { width: 100%; height: 24px; display: block; }
.spark path { stroke: #8a9c76; stroke-width: 1.3; }
.segs { display: flex; gap: 4px; }
.segs i { flex: 1; height: 12px; background: #2d3a24; border-radius: 1px; }
.segs i.ok { background: var(--green-2); }
.segs i.bad { background: var(--red); }

.grid-main { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 22px; align-items: start; }
.col { display: flex; flex-direction: column; gap: 22px; min-width: 0; }

.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 26px 18px 0; }
.mini { border: 1px solid var(--line-2); border-radius: 4px; padding: 14px 10px 12px; background: var(--bg-2); }
.mini label { font-size: 10px; color: var(--text); }
.mini div { font: 600 22px/1 var(--display); margin-top: 16px; }
.chart-wrap { padding: 30px 18px 6px 40px; position: relative; }
.chart { width: 100%; height: 230px; display: block; overflow: visible; }
.chart text { fill: var(--muted); font-size: 11px; stroke: none; font-family: var(--font); }
.chart .grid { stroke: #34362f; stroke-dasharray: 3 4; stroke-width: 1; }
.chart rect.b { fill: var(--accent-2); }
.chart rect.b:hover { fill: #ffab80; }
.chart rect.nodata { fill: #3a3c36; }
.chart-tip { position: absolute; pointer-events: none; background: #0e0f0e; border: 1px solid var(--line-2); padding: 6px 9px; border-radius: 4px; font-size: 11px; white-space: nowrap; display: none; z-index: 5; }
.card-note { font-size: 11px; color: var(--text); padding: 14px 20px 22px; }
.card-foot { border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; font-size: 10.5px; color: var(--muted); }

.info-card .icons { display: flex; gap: 12px; color: var(--muted); }
.info-card .icons svg { width: 18px; height: 18px; cursor: pointer; }
.info-card .icons svg:hover { color: var(--text); }
.map-thumb { margin: 16px 20px 18px; height: 96px; border: 1px solid #3a4630; border-radius: 3px; position: relative; overflow: hidden; cursor: pointer; background: #1f2a1b; }
.map-thumb svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.map-thumb .lbl { position: absolute; left: 12px; top: 10px; font: 600 8px var(--mono); letter-spacing: .15em; color: #c9d6b6; }
.map-thumb .lnk { position: absolute; right: 10px; bottom: 8px; font: 600 7.5px var(--mono); letter-spacing: .15em; color: #c9d6b6; }
.kv { padding: 0 20px 16px; }
.kv > div { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 11px; }
.kv > div span:first-child { color: var(--muted); }
.kv > div span:last-child { text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kv > div:last-child { border-bottom: 0; }
.section-title { padding: 6px 20px 6px; font-weight: 700; font-size: 13px; border-top: 1px solid var(--line); padding-top: 18px; margin: 0 0 4px; }
.ok-text { color: var(--green); }
.warn-text { color: var(--accent-2); }
.quick { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; padding: 0 20px 20px; }

/* forms / buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 4px; padding: 7px 16px; cursor: pointer; font-size: 12px; white-space: nowrap; }
.btn svg { width: 14px; height: 14px; }
.btn:hover { background: #2a2c28; border-color: #494b45; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #1a120d; font-weight: 600; }
.btn.primary:hover { background: var(--accent-2); }
.btn.danger { background: var(--red-bg); border-color: #6a2c22; color: #ff9a85; }
.btn.danger:hover { background: #4a231d; }
.btn.ghost { background: transparent; }
.btn.xs { padding: 3px 8px; font-size: 11px; }
.icon-btn { background: transparent; border: 0; color: var(--muted); cursor: pointer; padding: 6px; border-radius: 4px; display: inline-flex; }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { color: var(--text); background: var(--panel-2); }
.icon-btn.spin svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.input, .select, textarea.input { background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 4px; padding: 8px 10px; outline: none; min-width: 0; }
.input:focus, .select:focus { border-color: var(--accent); }
.select { padding: 7px 8px; }
.select.sm { padding: 5px 6px; font-size: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 11px; color: var(--muted); }
.check { display: flex; align-items: center; gap: 8px; font-size: 12px; cursor: pointer; }
.check input { accent-color: var(--accent); width: 15px; height: 15px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }

/* tables */
.table-wrap { overflow: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
.tbl th { text-align: left; font-weight: 500; color: var(--muted); font-size: 11px; padding: 12px 14px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); cursor: pointer; user-select: none; white-space: nowrap; }
.tbl th.sorted::after { content: " ▾"; color: var(--accent); }
.tbl th.sorted.asc::after { content: " ▴"; }
.tbl td { padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl tr:hover td { background: #1f201d; }
.tbl .mono { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.tbl .actions { display: flex; gap: 6px; justify-content: flex-end; }
.tbl td.r, .tbl th.r { text-align: right; }
.empty { padding: 40px; text-align: center; color: var(--muted); }
.ping-good { color: var(--green); } .ping-mid { color: var(--yellow); } .ping-bad { color: var(--red); }
.hp { display: inline-block; width: 50px; height: 4px; background: var(--line-2); border-radius: 2px; vertical-align: middle; margin-right: 6px; overflow: hidden; }
.hp i { display: block; height: 100%; background: var(--green); }

/* console */
.console { height: calc(100vh - 290px); min-height: 260px; overflow-y: auto; font: 12px/1.55 var(--mono); padding: 14px 16px; background: #10110f; border-radius: var(--radius) var(--radius) 0 0; border: 1px solid var(--line); white-space: pre-wrap; word-break: break-word; }
.console .ln { display: flex; gap: 12px; }
.console .ts { color: var(--faint); flex: none; }
.console .Warning { color: var(--yellow); }
.console .Error { color: var(--red); }
.console .cmd { color: var(--accent-2); }
.console .reply { color: #c8d3bd; }
.console .chatln { color: var(--blue); }
.cmdbar { display: flex; gap: 8px; border: 1px solid var(--line); border-top: 0; padding: 10px; background: var(--panel); border-radius: 0 0 var(--radius) var(--radius); }
.cmdbar .input { flex: 1; font-family: var(--mono); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.chip { background: var(--panel); border: 1px solid var(--line-2); border-radius: 12px; padding: 3px 10px; font: 11px var(--mono); cursor: pointer; color: var(--muted); }
.chip:hover { color: var(--text); border-color: var(--accent); }

/* chat */
.chat-list { height: calc(100vh - 270px); min-height: 260px; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; border: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; background: var(--panel); }
.msg { display: grid; grid-template-columns: 52px 1fr; gap: 10px; }
.msg .time { color: var(--faint); font-size: 11px; font-family: var(--mono); padding-top: 1px; }
.msg .who { font-weight: 600; margin-right: 6px; }
.msg .tag { font-size: 9px; padding: 1px 5px; border-radius: 3px; background: #24351c; color: var(--green); margin-right: 6px; letter-spacing: .08em; }
.msg .tag.srv { background: var(--accent-bg); color: var(--accent-2); }

/* map */
.map-layout { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 22px; }
.map-box { position: relative; aspect-ratio: 1; width: min(100%, calc(100vh - 230px)); margin: 0 auto; background: #1a2a33; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.map-box svg { width: 100%; height: 100%; display: block; }
.map-box text { stroke: none; font-family: var(--font); }
.map-list { max-height: calc(100vh - 230px); overflow-y: auto; }
.map-list div { display: flex; justify-content: space-between; padding: 8px 14px; border-bottom: 1px solid var(--line); font-size: 12px; cursor: pointer; }
.map-list div:hover, .map-list div.hl { background: var(--accent-bg); }
.map-list span:last-child { color: var(--muted); font-family: var(--mono); font-size: 11px; }

/* settings */
.settings-grid { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 22px; align-items: start; }
.srv-list a { display: flex; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--text); }
.srv-list a.sel { background: var(--accent-bg); color: var(--accent-2); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.help { font-size: 11px; color: var(--muted); background: var(--bg-2); border: 1px solid var(--line); border-radius: 4px; padding: 10px 12px; }
.help code { font-family: var(--mono); color: var(--accent-2); }

/* not connected */
.hero-empty { text-align: center; padding: 70px 30px; }
.hero-empty svg { width: 46px; height: 46px; color: var(--accent); }
.hero-empty h2 { font-size: 18px; margin: 14px 0 8px; }
.hero-empty p { color: var(--muted); max-width: 460px; margin: 0 auto 22px; }

/* modal / toasts */
.modal-back { position: fixed; inset: 0; background: #000a; display: flex; align-items: center; justify-content: center; z-index: 50; animation: fade .12s; }
.modal { width: min(460px, calc(100vw - 32px)); background: var(--panel); border: 1px solid var(--line-2); border-radius: 8px; padding: 22px; box-shadow: 0 20px 60px #000c; }
.modal h3 { margin: 0 0 14px; font: 700 17px var(--display); }
.modal p { color: var(--muted); margin: 0 0 14px; }
.modal .body { display: flex; flex-direction: column; gap: 12px; }
.modal .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
@keyframes fade { from { opacity: 0; } }
#toasts { position: fixed; right: 22px; bottom: 22px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: #0f100e; border: 1px solid var(--line-2); border-left: 3px solid var(--green); padding: 10px 14px; border-radius: 4px; font-size: 12px; max-width: 360px; animation: fade .2s; }
.toast.err { border-left-color: var(--red); }
.ctx { position: fixed; z-index: 70; background: #121311; border: 1px solid var(--line-2); border-radius: 6px; padding: 4px; min-width: 190px; box-shadow: 0 10px 30px #000a; }
.ctx button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 7px 12px; border-radius: 4px; cursor: pointer; font-size: 12px; }
.ctx button:hover { background: var(--accent-bg); color: var(--accent-2); }
.ctx hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.ctx button.danger { color: #ff9a85; }

@media (max-width: 1250px) {
  .stats-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: 1fr; }
  .map-layout { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .content, .topbar { padding-left: 16px; padding-right: 16px; }
  .stats-row { grid-template-columns: 1fr; }
  .settings-grid, .form-grid { grid-template-columns: 1fr; }
}
.map-status { margin-top: 10px; font-size: 12px; line-height: 1.9; }
.map-status .btn { margin-left: 6px; }

.pname { display: flex; align-items: center; gap: 10px; }
.pname b { font-size: 12.5px; }
.avatar { width: 30px; height: 30px; border-radius: 4px; flex: none; object-fit: cover; background: #2a2c28; }
.avatar.ini { display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #f0e9e0; }
.cc { display: inline-flex; align-items: center; gap: 6px; font: 600 11px var(--mono); }
.cc img { border-radius: 2px; box-shadow: 0 0 0 1px #0006; }
.cc.lan { font-weight: 500; color: var(--muted); border: 1px solid var(--line-2); padding: 0 5px; border-radius: 3px; }
.muted { color: var(--faint); }
.tbl tr.off td { opacity: .6; }
.tbl tr.off td:last-child { opacity: 1; }
.btn.toggle.on { background: var(--accent-bg); border-color: #6a3a26; color: var(--accent-2); }

.layer-bar { display: flex; flex-wrap: wrap; gap: 8px; margin: -14px 0 14px; align-items: center; }
.layer { display: inline-flex; align-items: center; gap: 7px; background: var(--panel); border: 1px solid var(--line-2); color: var(--muted); border-radius: 14px; padding: 5px 12px; cursor: pointer; font-size: 12px; }
.layer small { color: var(--faint); font-size: 10.5px; }
.layer:hover:not(:disabled) { border-color: #55574f; color: var(--text); }
.layer.on { background: var(--accent-bg); border-color: #6a3a26; color: var(--accent-2); }
.layer:disabled { opacity: .4; cursor: not-allowed; }
.sw { width: 10px; height: 10px; border-radius: 50%; display: inline-block; background: var(--faint); }
.sw-sleepers { background: #8b8f86; } .sw-tc { background: #b4733f; border-radius: 2px; } .sw-events { background: #ff5a4a; }
.sw-loot { background: #f2c94c; transform: rotate(45deg); border-radius: 1px; } .sw-monuments { background: #fff; transform: rotate(45deg); border-radius: 1px; }
.sw-names { background: transparent; border: 1px solid currentColor; border-radius: 2px; }
.plugin-hint { flex-basis: 100%; font-size: 11.5px; color: var(--muted); background: var(--bg-2); border: 1px dashed var(--line-2); border-radius: 4px; padding: 8px 12px; }
.map-list div.sel { background: var(--accent-bg); box-shadow: inset 3px 0 0 var(--accent); }
.map-list .pn { display: flex; align-items: center; gap: 9px; min-width: 0; }
.map-list .pn > span { display: flex; flex-direction: column; min-width: 0; }
.map-list .pn b { font-weight: 500; font-size: 12px; color: var(--text); font-family: var(--font); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-list .pn small { font: 10px var(--mono); color: var(--faint); }
.map-list .grid-ref { align-self: center; font: 600 11px var(--mono); color: var(--accent-2) !important; }
.map-list .avatar { width: 22px; height: 22px; }
.map-list .avatar.ini { font-size: 9px; }
@keyframes ring { 0% { opacity: 1; } 100% { opacity: .2; } }
.pulse { animation: ring 1s ease-in-out infinite alternate; }

.map-box text { font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif; }
.map-box .lbl { pointer-events: none; }

/* ---------- about ---------- */
.modal.about { width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 48px); display: flex; flex-direction: column; padding: 0; overflow: hidden; background: linear-gradient(180deg, #1c211d, var(--panel) 260px); }
.about-scroll { overflow-y: auto; padding: 26px 30px 8px; }
.about-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; }
.about-brand { display: flex; gap: 14px; align-items: center; }
.about-brand img { width: 46px; height: 46px; border-radius: 8px; }
.about-brand h2 { font: 700 30px/1 var(--display); margin: 0; letter-spacing: -.02em; }
.about-brand span { color: var(--muted); font-size: 12px; }
.about-version { font: 600 12px var(--mono); color: var(--accent-2); border: 1px solid #6a3a26; background: var(--accent-bg); padding: 4px 10px; border-radius: 12px; }
.about-duo { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: center; }
.person { margin: 0; display: flex; gap: 14px; align-items: center; background: #0e110f88; border: 1px solid var(--line-2); border-radius: 12px; padding: 12px; cursor: pointer; transition: border-color .15s, transform .15s; }
.person:hover { border-color: #6a3a26; transform: translateY(-2px); }
.person img { width: 92px; height: 115px; object-fit: cover; border-radius: 10px; border: 1px solid #3b4a3f; flex: none; }
.person figcaption { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.person b { font: 700 20px var(--display); }
.person .role { color: var(--accent-2); font-size: 12px; font-weight: 600; }
.person small { color: var(--muted); font-size: 11px; line-height: 1.4; }
.amp { font: 700 30px var(--display); color: var(--accent); opacity: .8; }
.quip { min-height: 0; height: 0; overflow: hidden; margin: 0; font-size: 12.5px; transition: all .2s; text-align: center; color: var(--text); }
.quip.show { height: auto; min-height: 20px; margin: 14px 0 0; padding: 8px 12px; border-radius: 8px; background: var(--bg-2); border: 1px dashed var(--line-2); }
.quip.claude { border-color: #6a3a26; }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-2deg); } 75% { transform: rotate(2deg); } }
.person.wiggle { animation: wiggle .35s ease-in-out; }
.about-story { margin-top: 18px; font-size: 13.5px; line-height: 1.6; }
.about-story p { margin: 0 0 10px; }
.about-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 6px; }
.about-facts div { background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.about-facts span { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.about-facts b { font-size: 13px; }
.facts-note { font-size: 10.5px; color: var(--faint); margin: 6px 0 18px; text-align: right; }
.about-legal, .about-privacy { border: 1px solid var(--line-2); background: #0f120fcc; border-radius: 10px; padding: 14px 18px; margin-bottom: 14px; font-size: 11.5px; line-height: 1.6; color: #c9cbc3; }
.about-legal h3, .about-privacy h3 { font: 700 13px var(--font); color: var(--text); margin: 0 0 8px; }
.about-legal ol { margin: 0; padding-left: 18px; }
.about-legal li { margin-bottom: 6px; }
.about-privacy p { margin: 0 0 8px; }
.about-privacy .mono { font: 11px var(--mono); color: var(--faint); }
.modal.about .foot { margin: 0; padding: 14px 30px; border-top: 1px solid var(--line); align-items: center; }
.about-sign { margin-right: auto; font: 11px var(--mono); color: var(--muted); }
@media (max-width: 640px) { .about-duo { grid-template-columns: 1fr; } .amp { text-align: center; } .about-facts { grid-template-columns: 1fr; } }

/* ---------- floating windows / logs / rules ---------- */
.float-win { position: fixed; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line-2); border-radius: 8px; box-shadow: 0 24px 70px #000c; resize: both; overflow: hidden; }
.fw-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 8px 14px; background: var(--panel-2); border-bottom: 1px solid var(--line); cursor: move; user-select: none; touch-action: none; }
.fw-title { font-weight: 700; font-size: 13px; }
.fw-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.lv-bar { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.lv-bar select { max-width: 280px; }
.lv-search { flex: 1; min-width: 120px; }
.lv-note { font-size: 11px; color: var(--yellow); padding: 6px 12px 0; }
.lv-out { flex: 1; min-height: 0; overflow: auto; font: 12px/1.55 var(--mono); padding: 10px 14px; background: #10110f; white-space: pre-wrap; word-break: break-word; }
.lv-out .ln { display: flex; gap: 10px; }
.lv-out .ts { color: var(--faint); flex: none; }
.lv-out mark { background: #e8743a55; color: inherit; border-radius: 2px; }
.rw-scroll { overflow: auto; padding: 14px 16px 18px; flex: 1; }
.rw-lead { margin: 0 0 12px; line-height: 1.5; }
.rw-rule { display: grid; grid-template-columns: auto auto 1fr auto auto auto; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 6px; background: var(--bg-2); }
.rw-rule.off { opacity: .5; }
.rw-type { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 2px 7px; border-radius: 3px; background: #2c2e2a; color: var(--muted); }
.rw-type.highlight { background: var(--accent-bg); color: var(--accent-2); }
.rw-text { font: 12px var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rw-tabs { display: flex; gap: 4px; }
.rw-tabs i { font-style: normal; font-size: 10px; color: var(--muted); border: 1px solid var(--line-2); border-radius: 3px; padding: 0 5px; }
.rw-form { margin-top: 14px; border: 1px solid #6a3a26; border-radius: 8px; padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; background: #1f1a17; }
.rw-form h3 { margin: 0; font-size: 14px; }
.rw-row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.rw-row.dim { opacity: .45; }
.rw-radio { display: flex; gap: 6px; align-items: center; font-weight: 600; cursor: pointer; }
.rw-radio input { accent-color: var(--accent); }
.swatch { width: 20px; height: 20px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; }
.swatch.on { border-color: #fff; box-shadow: 0 0 0 2px var(--accent); }
#rwColorPick { width: 30px; height: 24px; border: 0; background: none; padding: 0; cursor: pointer; }
.rw-preview { font: 11.5px var(--mono); background: #10110f; border-radius: 4px; padding: 8px 10px; }
.rw-preview:empty { display: none; }
.rw-preview .ln { display: flex; gap: 10px; }
.rw-preview .ts { color: var(--faint); }

.portrait-ph { width: 92px; height: 115px; border-radius: 10px; border: 1px solid #3b4a3f; flex: none; display: flex; align-items: center; justify-content: center; font: 700 34px var(--display); color: var(--accent-2); background: var(--bg-2); }

/* ---------- bans / country guard ---------- */
.bn-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.bn-stat { padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; }
.bn-stat span { font-size: 11px; color: var(--muted); }
.bn-stat b { font: 600 24px/1 var(--display); }
.bn-card { margin-bottom: 18px; }
.bn-card .card-head { padding-bottom: 14px; }
.count-badge { display: inline-block; font: 600 11px var(--mono); background: var(--green-bg); color: var(--green); border: 1px solid #36502a; border-radius: 4px; padding: 0 7px; margin-left: 6px; vertical-align: 2px; }
.bn-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 46px; }
.bn-empty svg { width: 30px; height: 30px; color: var(--muted); }
.perm { color: var(--red); font-weight: 600; }
.cg-hint { margin: 0 20px 20px; padding: 12px 14px; border: 1px dashed var(--line-2); border-radius: 6px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.cg-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 28px; padding: 4px 20px 20px; }
.cg-col { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.cg-label { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-top: 8px; }
.cg-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cg-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 6px 6px 8px; border-radius: 8px; background: var(--red-bg); border: 1px solid #6a2c22; cursor: pointer; transition: border-color .15s; }
.cg-chip:hover { border-color: #b3483a; }
.cg-chip b { font: 700 12px var(--mono); color: #ffb3a6; }
.cg-chip span { font-size: 12px; color: #f0d2cc; }
.cg-chip .flag, .cg-tag .flag { border-radius: 2px; box-shadow: 0 0 0 1px #0007; }
.cg-own { font-style: normal; font-size: 11px; color: var(--accent-2); }
.cg-x { background: none; border: 0; color: #ff9a85; cursor: pointer; font-size: 11px; padding: 2px 5px; border-radius: 4px; }
.cg-x:hover { background: #0004; color: #fff; }
.cg-add { max-width: 220px; }
.cg-reason { display: flex; gap: 8px; }
.cg-reason .input { flex: 1; }
.cg-toggles { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 10px; }
.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 12.5px; }
.switch input { display: none; }
.switch span { width: 34px; height: 19px; border-radius: 10px; background: #3a3c36; position: relative; transition: background .15s; flex: none; }
.switch span::after { content: ""; position: absolute; left: 2px; top: 2px; width: 15px; height: 15px; border-radius: 50%; background: #ddd; transition: transform .15s; }
.switch input:checked + span { background: var(--green-2); }
.switch input:checked + span::after { transform: translateX(15px); }
.cg-result { font-size: 12px; min-height: 18px; }
.cg-exc { display: flex; flex-wrap: wrap; gap: 6px; }
.cg-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; background: var(--green-bg); border: 1px solid #36502a; border-radius: 6px; padding: 3px 4px 3px 8px; color: var(--green); }
.cg-tag b { color: var(--text); font-weight: 500; }
.ip-tbl .ip-cell { color: var(--text); font-weight: 600; }
.ip-reason { max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.src { font-size: 10.5px; padding: 1px 7px; border-radius: 3px; background: #2c2e2a; color: var(--muted); }
.src-auto { background: var(--red-bg); color: #ff9a85; }
.src-manual { background: #2a2540; color: #c3b0ff; }
.src-online { background: var(--accent-bg); color: var(--accent-2); }
@media (max-width: 1100px) { .bn-stats { grid-template-columns: repeat(2, 1fr); } .cg-grid { grid-template-columns: 1fr; } }

/* ---------- plugins ---------- */
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 4px; overflow: hidden; }
.seg button { background: var(--panel); border: 0; border-right: 1px solid var(--line-2); padding: 7px 12px; cursor: pointer; font-size: 12px; color: var(--muted); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--accent-bg); color: var(--accent-2); }
.plg-counts { margin: -16px 0 12px; }
.plg-state { display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--faint); }
.plg-state.on { color: var(--green); }
.tbl tr.plg-off td:not(:last-child) { opacity: .55; }

/* ---------- setup guides ---------- */
.guide { border: 1px solid #5a4a20; background: linear-gradient(180deg, #2a2414, #1f1c14); border-radius: 8px; padding: 14px 18px; margin: -6px 0 16px; font-size: 12.5px; line-height: 1.6; }
.guide[hidden] { display: none; }
.guide-head { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; color: var(--yellow); }
.guide-head svg { width: 18px; height: 18px; flex: none; }
.guide-head b { font-size: 13.5px; }
.guide-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; }
.guide-step h4 { margin: 4px 0 2px; font-size: 12.5px; color: var(--text); }
.guide-step p { margin: 0 0 6px; }
.guide-step ol { margin: 4px 0 0; padding-left: 20px; }
.guide-step li { margin-bottom: 5px; }
.guide .btn.xs { margin-left: 4px; }

/* ======================================================================
   PHONE (html.mobile) – portrait: tabs on top · landscape: icon rail left
   ====================================================================== */
html.mobile, html.mobile body { height: 100%; overflow: hidden; -webkit-tap-highlight-color: transparent; }
html.mobile .shell { display: block; height: 100%; }
html.mobile .main { height: 100%; }
html.mobile .m-tabs, html.mobile .m-burger, html.mobile .m-shade { display: flex; }
.m-tabs, .m-burger, .m-shade { display: none; }

/* sidebar = slide-out drawer */
html.mobile .sidebar { position: fixed; z-index: 40; top: 0; bottom: 0; left: 0; width: min(310px, 86vw); transform: translateX(-105%); transition: transform .22s ease; box-shadow: 10px 0 40px #000a; padding-top: calc(18px + env(safe-area-inset-top)); }
html.mobile.drawer-open .sidebar { transform: none; }
html.mobile .m-shade { position: fixed; inset: 0; z-index: 39; background: #0008; opacity: 0; pointer-events: none; transition: opacity .2s; }
html.mobile.drawer-open .m-shade { opacity: 1; pointer-events: auto; }

/* top bar */
html.mobile .topbar { height: 52px; padding: 0 10px 0 6px; gap: 6px; }
html.mobile .m-burger { align-items: center; gap: 6px; padding: 6px; }
html.mobile .m-burger img { width: 26px; height: 26px; border-radius: 5px; }
html.mobile .m-burger svg { width: 18px; height: 18px; }
html.mobile .crumbs { font-size: 14px; gap: 8px; margin-right: auto; min-width: 0; }
html.mobile .crumbs > span:first-child, html.mobile .crumbs .sep { display: none; }
html.mobile .crumbs b { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html.mobile .top-actions { gap: 6px; }
html.mobile #connPill { padding: 4px 8px; }
html.mobile #connBtn { padding: 7px 10px; }
html.mobile #connBtnText { display: none; }

/* tab bar */
.m-tabs { gap: 2px; overflow-x: auto; scrollbar-width: none; background: var(--bg-2); border-bottom: 1px solid var(--line); padding: 4px 6px; flex: none; }
.m-tabs::-webkit-scrollbar { display: none; }
.m-tabs a { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 64px; padding: 6px 6px 5px; border-radius: 8px; color: var(--muted); font-size: 10.5px; white-space: nowrap; }
.m-tabs a svg { width: 21px; height: 21px; }
.m-tabs a.active { background: var(--accent-bg); color: var(--accent-2); }
.m-badge { position: absolute; top: 2px; right: 8px; font-size: 9.5px; background: var(--accent); color: #1a120d; border-radius: 8px; padding: 0 5px; line-height: 15px; }
.m-badge:empty { display: none; }

/* content */
html.mobile .content { padding: 14px 12px 28px; -webkit-overflow-scrolling: touch; }
html.mobile .page-head { flex-direction: column; align-items: stretch; gap: 12px; margin-bottom: 16px; }
html.mobile h1 { font-size: 24px; }
html.mobile .kicker { margin-bottom: 6px; }
html.mobile .toolbar { gap: 8px; }
html.mobile .toolbar .input { width: 100% !important; flex: 1 1 100%; }
html.mobile .btn { min-height: 36px; }
html.mobile .btn.xs { min-height: 30px; padding: 4px 10px; }
html.mobile .stats-row { grid-template-columns: 1fr 1fr; gap: 10px; }
html.mobile .stat { min-height: 0; padding: 14px; }
html.mobile .stat-val { font-size: 30px; margin-top: 14px; }
html.mobile .grid-main, html.mobile .map-layout, html.mobile .settings-grid, html.mobile .form-grid, html.mobile .cg-grid { grid-template-columns: 1fr; }
html.mobile .mini-stats { grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 16px 12px 0; }
html.mobile .mini div { font-size: 18px; }
html.mobile .chart-wrap { padding: 20px 8px 4px 30px; }
html.mobile .chart { height: 180px; }
html.mobile .card-head { flex-wrap: wrap; padding: 16px 14px 0; }
html.mobile .tbl th, html.mobile .tbl td { padding: 9px 10px; }
html.mobile .console { height: calc(100vh - 330px); min-height: 220px; font-size: 11px; }
html.mobile .chat-list { height: calc(100vh - 300px); min-height: 220px; }
html.mobile .chips { flex-wrap: nowrap; overflow-x: auto; }
html.mobile .map-box { width: 100%; max-height: none; }
html.mobile .map-list { max-height: 40vh; }
html.mobile .layer-bar { flex-wrap: nowrap; overflow-x: auto; margin-top: 0; padding-bottom: 4px; }
html.mobile .layer { flex: none; }
html.mobile .bn-stats { grid-template-columns: 1fr 1fr; }
html.mobile .modal { padding: 18px; }
html.mobile .float-win { left: 0 !important; top: 0 !important; width: 100vw !important; height: 100% !important; min-width: 0 !important; border-radius: 0; resize: none; }
html.mobile .fw-head { padding-top: calc(8px + env(safe-area-inset-top)); }
html.mobile .lv-bar { flex-wrap: wrap; }
html.mobile #toasts { left: 12px; right: 12px; bottom: 16px; }
html.mobile .toast { max-width: none; }
html.mobile .modal.about .about-duo { grid-template-columns: 1fr; }
html.mobile .modal.about .amp { text-align: center; }
html.mobile .about-facts { grid-template-columns: 1fr; }

/* landscape phone: icon rail on the left instead of tabs on top */
@media (orientation: landscape) and (max-height: 560px) {
  html.mobile .main { display: grid; grid-template-columns: 74px 1fr; grid-template-rows: 46px 1fr; }
  html.mobile .topbar { grid-column: 1 / -1; height: 46px; }
  html.mobile .m-tabs { grid-row: 2; flex-direction: column; overflow-y: auto; overflow-x: hidden; border-bottom: 0; border-right: 1px solid var(--line); padding: 6px 4px; }
  html.mobile .m-tabs a { min-width: 0; font-size: 9.5px; padding: 7px 2px; }
  html.mobile .content { grid-row: 2; grid-column: 2; }
  html.mobile .map-layout { grid-template-columns: minmax(0, 1fr) 220px; }
  html.mobile .map-box { width: min(100%, calc(100vh - 150px)); }
  html.mobile .map-list { max-height: calc(100vh - 170px); }
  html.mobile .stats-row { grid-template-columns: repeat(4, 1fr); }
  html.mobile .console { height: calc(100vh - 250px); }
  html.mobile .chat-list { height: calc(100vh - 220px); }
}
html.mobile .sidebar { display: flex; }
@media (orientation: landscape) and (max-height: 560px) {
  html.mobile .page-head .lead, html.mobile .page-head .kicker { display: none; }
  html.mobile h1 { font-size: 20px; margin-bottom: 0; }
  html.mobile .page-head { flex-direction: row; align-items: center; margin-bottom: 10px; }
}

/* long server names scroll back and forth in the server card */
.server-card .sc-name { text-overflow: clip; }
.server-card .sc-scroll { display: inline-block; white-space: nowrap; }
.server-card .sc-name.marquee { -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 6px, #000 calc(100% - 10px), transparent); mask-image: linear-gradient(90deg, transparent 0, #000 6px, #000 calc(100% - 10px), transparent); }
.server-card .sc-name.marquee .sc-scroll { animation: sc-marquee var(--dur, 8s) ease-in-out infinite; padding-left: 4px; }
@keyframes sc-marquee { 0%, 18% { transform: translateX(0); } 50%, 68% { transform: translateX(var(--shift)); } 100% { transform: translateX(0); } }
@media (prefers-reduced-motion: reduce) { .server-card .sc-name.marquee .sc-scroll { animation: none; } }

/* web version: account line in the sidebar */
.web-account { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11px; color: var(--muted); padding: 10px 4px 0; border-top: 1px solid var(--line); }
.web-account a, .web-account span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
