/* Aether panel
   Dark glass over a soft aurora. Built to stay light on the graphics card next to a game:
   - no backdrop-filter anywhere: the aurora behind the panels is already soft, so see-through panels look frosted
     without the browser re-blurring anything;
   - the aurora is one fixed layer, painted once; the page scrolls as a whole (the cheapest kind of scroll);
   - motion only moves or fades things (transform / opacity), runs once, and never loops;
   - Low power mode drops the aurora and every transition. */

:root {
  color-scheme: dark;
  --bg: #07080f;
  --bg-solid: #0e1020;
  --surface: rgba(255, 255, 255, .035);
  --surface-2: rgba(255, 255, 255, .06);
  --surface-3: rgba(255, 255, 255, .095);
  --well: rgba(0, 0, 0, .3);
  --line: rgba(255, 255, 255, .07);
  --line-2: rgba(255, 255, 255, .11);
  --line-3: rgba(255, 255, 255, .2);
  --text: #f2f3fa;
  --text-2: #a9aec8;
  --muted: #6c7291;

  --accent: #8f7dff;
  --accent-2: #bcb1ff;
  --accent-grad: linear-gradient(135deg, #a690ff 0%, #7f84ff 55%, #5e8eff 100%);
  --accent-bg: rgba(143, 125, 255, .13);
  --accent-line: rgba(143, 125, 255, .38);
  --green: #3ddc97;
  --green-bg: rgba(61, 220, 151, .12);
  --green-line: rgba(61, 220, 151, .32);
  --amber: #fbbf24;
  --amber-bg: rgba(251, 191, 36, .12);
  --amber-line: rgba(251, 191, 36, .32);
  --red: #f87171;
  --red-bg: rgba(248, 113, 113, .12);
  --red-line: rgba(248, 113, 113, .34);
  --blue: #60a5fa;
  --blue-bg: rgba(96, 165, 250, .12);
  --blue-line: rgba(96, 165, 250, .32);

  --card: linear-gradient(180deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, .022));
  --card-shadow: inset 0 1px 0 rgba(255, 255, 255, .055), 0 1px 1px rgba(0, 0, 0, .25), 0 18px 40px -22px rgba(0, 0, 0, .75);
  --pop-shadow: 0 30px 70px -18px rgba(0, 0, 0, .8), 0 0 0 1px rgba(255, 255, 255, .05);
  --r-lg: 16px;
  --r: 12px;
  --r-sm: 9px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --t-fast: 120ms;
  --t: 200ms;

  --font: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: Outfit, Inter, system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --slot: 40px;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0; min-height: 100vh;
  background: transparent; color: var(--text); /* html paints the base colour; a body background would cover the aurora */
  font: 13.5px/1.5 var(--font);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: rgba(143, 125, 255, .35); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); }
.grow { flex: 1; min-width: 0; }
[hidden] { display: none !important; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

[data-icon] svg { width: 16px; height: 16px; display: block; }

/* ---------- backgrounds ----------
   The page background is one fixed layer, painted once and never again: no animation, no live blur.
   Settings → Appearance picks one (data-bg); its previews use the same .bg-art classes.
   Sizes are in % so the same art fits the screen and the small previews. */
.backdrop { position: fixed; inset: 0; z-index: -1; pointer-events: none; transform: translateZ(0); }
.bg-art { overflow: hidden; background-color: var(--bg); }
.bg-art::before, .bg-art::after { content: ''; position: absolute; inset: 0; pointer-events: none; }
/* film grain on every background: stops the gradients from banding */
.bg-art::after {
  opacity: .045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .9 0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Nebula (default): deep space, a violet cloud and a field of still stars */
.bg-art, .bg-art[data-bg="nebula"] {
  background:
    radial-gradient(34% 42% at 80% 20%, rgba(168, 110, 255, .34), transparent 70%),
    radial-gradient(22% 26% at 92% 6%, rgba(255, 120, 220, .2), transparent 70%),
    radial-gradient(26% 30% at 66% 34%, rgba(110, 120, 255, .16), transparent 70%),
    radial-gradient(42% 48% at 8% 92%, rgba(60, 120, 255, .22), transparent 70%),
    radial-gradient(70% 60% at 50% 50%, rgba(20, 16, 50, .5), transparent 80%),
    #04050b;
}
.bg-art::before {
  opacity: .85;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cg fill='%23fff'%3E%3Ccircle cx='12' cy='30' r='.7' opacity='.7'/%3E%3Ccircle cx='68' cy='12' r='.5' opacity='.5'/%3E%3Ccircle cx='121' cy='58' r='.9' opacity='.8'/%3E%3Ccircle cx='190' cy='22' r='.6' opacity='.55'/%3E%3Ccircle cx='238' cy='84' r='.7' opacity='.6'/%3E%3Ccircle cx='40' cy='120' r='.5' opacity='.45'/%3E%3Ccircle cx='96' cy='170' r='.8' opacity='.7'/%3E%3Ccircle cx='160' cy='132' r='.5' opacity='.5'/%3E%3Ccircle cx='214' cy='196' r='.9' opacity='.75'/%3E%3Ccircle cx='22' cy='222' r='.6' opacity='.55'/%3E%3Ccircle cx='140' cy='238' r='.5' opacity='.45'/%3E%3Ccircle cx='250' cy='150' r='.4' opacity='.4'/%3E%3C/g%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='410' height='410'%3E%3Cg fill='%23dcd6ff'%3E%3Ccircle cx='60' cy='80' r='1.3' opacity='.9'/%3E%3Ccircle cx='300' cy='40' r='1.1' opacity='.75'/%3E%3Ccircle cx='210' cy='260' r='1.4' opacity='.85'/%3E%3Ccircle cx='370' cy='330' r='1' opacity='.7'/%3E%3Ccircle cx='110' cy='360' r='1.2' opacity='.8'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 260px 260px, 410px 410px;
}

/* Northern Lights: aurora over a pine forest. A drawn picture (public/bg/northern.svg, made by
   tools/make-backgrounds.js) under a dark tint that keeps text readable. */
.bg-art[data-bg="northern"] {
  background:
    linear-gradient(180deg, rgba(7, 8, 15, .1), rgba(7, 8, 15, .3)),
    url('/bg/northern.svg') center / cover no-repeat,
    var(--bg);
}
.bg-art[data-bg="northern"]::before { content: none; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; z-index: 5;
  display: flex; flex-direction: column; min-height: 0;
  background: linear-gradient(180deg, rgba(14, 15, 30, .72), rgba(9, 10, 20, .6));
  border-right: 1px solid var(--line);
}
.main { min-width: 0; }
.view { padding: 22px 28px 40px; max-width: 1480px; margin: 0 auto; }

/* ---------- sidebar ---------- */
.brand { display: flex; align-items: center; gap: 11px; padding: 20px 18px 18px; }
.brand-logo { width: 34px; height: 34px; border-radius: 10px; filter: drop-shadow(0 6px 16px rgba(143, 125, 255, .4)); }
.brand-name { font: 600 18px/1 var(--display); letter-spacing: .01em; }
.brand-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

.side-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 12px 6px 20px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600;
}
.acct-list { flex: 1; overflow-y: auto; padding: 2px 10px 12px; overscroll-behavior: contain; }
.acct-group-block { margin-bottom: 4px; }
.acct-group {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 12px 8px 6px 10px; font-size: 11px; color: var(--muted); font-weight: 600;
}
.acct-group-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-group-count { font: 600 10.5px/1 var(--font); font-variant-numeric: tabular-nums; padding: 3px 7px; border-radius: 99px; background: var(--surface-2); color: var(--text-2); }
.acct-rows { display: grid; gap: 2px; position: relative; }

.acct {
  position: relative;
  display: grid; grid-template-columns: 10px 34px minmax(0, 1fr) auto; gap: 10px; align-items: center;
  padding: 8px 8px 8px 4px; border-radius: 11px; cursor: pointer; border: 1px solid transparent;
  transition: background var(--t-fast), border-color var(--t-fast);
  touch-action: pan-y; user-select: none; -webkit-user-select: none;
}
.acct:hover { background: var(--surface-2); }
.acct.active { background: linear-gradient(90deg, rgba(143, 125, 255, .16), rgba(143, 125, 255, .06)); border-color: rgba(143, 125, 255, .28); }
.acct.active::before { content: ''; position: absolute; left: -10px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent-grad); }
.acct-grip { color: var(--muted); opacity: 0; cursor: grab; display: grid; place-items: center; transition: opacity var(--t-fast); }
.acct-grip svg { width: 11px; height: 11px; }
.acct:hover .acct-grip { opacity: .7; }
.acct-av img { display: block; width: 34px; height: 34px; border-radius: 9px; image-rendering: pixelated; background: var(--surface-2); }
.acct-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acct-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.acct-actions { display: flex; align-items: center; gap: 2px; }
.acct .icon-btn { opacity: .55; transition: opacity var(--t-fast), background var(--t-fast), color var(--t-fast); }
.acct:hover .icon-btn, .acct .icon-btn:focus-visible { opacity: 1; }
/* drag to reorder: rows glide out of the way (transform only) */
.acct-rows.reordering .acct { transition: transform 180ms var(--ease); }
.acct-rows.reordering .acct:not(.dragging) { pointer-events: none; }
.acct.dragging { z-index: 3; cursor: grabbing; transition: none; background: #17192f; border-color: var(--accent-line); box-shadow: var(--pop-shadow); }
.acct.dragging .acct-grip { opacity: 1; }
.acct.dragging.settling { transition: transform 180ms var(--ease); }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; margin: 0 4px; }
.dot.online { background: var(--green); box-shadow: 0 0 0 3px var(--green-bg), 0 0 10px rgba(61, 220, 151, .5); }
.dot.connecting, .dot.joining, .dot.reconnecting { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-bg); }
.dot.auth { background: var(--blue); box-shadow: 0 0 0 3px var(--blue-bg); }
.tag { font-size: 9.5px; letter-spacing: .04em; padding: 1px 6px; border-radius: 5px; background: var(--accent-bg); color: var(--accent-2); font-weight: 700; }

.side-foot { border-top: 1px solid var(--line); padding: 10px; }
.side-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px; border-radius: 10px;
  background: none; border: 0; cursor: pointer; color: var(--text-2); text-align: left; font-weight: 500;
  transition: background var(--t-fast), color var(--t-fast);
}
.side-btn:hover { background: var(--surface-2); color: var(--text); }
.side-btn .side-chev { color: var(--muted); transition: transform var(--t) var(--ease); }
.side-btn:hover .side-chev { transform: translateX(2px); }
.side-btn .side-chev svg { width: 14px; height: 14px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 15px; border-radius: 10px; cursor: pointer; font-weight: 600; font-size: 13px;
  background: var(--surface-2); border: 1px solid var(--line-2); color: var(--text);
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast) var(--ease), opacity var(--t-fast);
  white-space: nowrap; user-select: none;
}
.btn:hover { background: var(--surface-3); border-color: var(--line-3); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.primary {
  background: var(--accent-grad); border-color: transparent; color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 8px 22px -8px rgba(124, 108, 255, .75);
}
.btn.primary:hover { background: linear-gradient(135deg, #b29fff 0%, #8d91ff 55%, #6e99ff 100%); }
.btn.success { background: linear-gradient(135deg, #4be3a4, #22c07f); border-color: transparent; color: #03130b; }
.btn.danger { background: var(--red-bg); color: var(--red); border-color: var(--red-line); }
.btn.danger:hover { background: rgba(248, 113, 113, .2); }
.btn.danger.solid { background: linear-gradient(135deg, #fb8a8a, #e35b5b); color: #fff; border-color: transparent; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 8px 22px -8px rgba(227, 91, 91, .7); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { height: 30px; padding: 0 11px; font-size: 12px; border-radius: 8px; }
.btn.wide { width: 100%; }
.icon-btn {
  width: 30px; height: 30px; display: inline-grid; place-items: center; border-radius: 8px; flex: none;
  background: transparent; border: 1px solid transparent; color: var(--text-2); cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--line-2); color: var(--text); }
.icon-btn.sm { width: 26px; height: 26px; }
.icon-btn.sm svg { width: 14px; height: 14px; }
.icon-btn.play { color: var(--green); }
.icon-btn.stop { color: var(--red); }
.icon-btn.del:hover { color: var(--red); }

/* ---------- inputs ---------- */
input, select, textarea {
  width: 100%; height: 36px; padding: 0 12px; border-radius: 10px;
  background: var(--well); border: 1px solid var(--line-2); outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
input::placeholder, textarea::placeholder { color: #565b78; }
input:hover, select:hover, textarea:hover { border-color: var(--line-3); }
textarea { height: auto; min-height: 72px; padding: 9px 12px; resize: vertical; font-family: var(--mono); font-size: 12px; line-height: 1.55; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
input:disabled, select:disabled { opacity: .5; cursor: not-allowed; }
select {
  appearance: none; cursor: pointer; padding-right: 32px;
  background: var(--well) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a90b0' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 11px center;
}
select option { background: var(--bg-solid); }

.form { display: grid; gap: 12px; }
.form.compact { gap: 11px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field > span { font-size: 12px; color: var(--text-2); font-weight: 500; }
.row { display: flex; gap: 10px; align-items: flex-end; }
.row.between { justify-content: space-between; align-items: center; }
.port { width: 96px; flex: none; }

/* switch: the checkbox stays focusable (keyboard), the track is drawn by <i> */
.toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; position: relative; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.toggle i {
  width: 36px; height: 20px; border-radius: 20px; background: rgba(255, 255, 255, .13); position: relative; flex: none;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .35);
  transition: background var(--t) var(--ease);
}
.toggle i::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: #d9dcec; box-shadow: 0 1px 3px rgba(0, 0, 0, .4);
  transition: transform var(--t) var(--ease), background var(--t);
}
.toggle input:checked + i { background: var(--accent-grad); }
.toggle input:checked + i::after { transform: translateX(16px); background: #fff; }
.toggle input:focus-visible + i { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.toggle span { font-size: 13px; color: var(--text-2); }
.toggle.sm i { width: 30px; height: 17px; }
.toggle.sm i::after { width: 13px; height: 13px; }
.toggle.sm input:checked + i::after { transform: translateX(13px); }

.seg { display: flex; flex-wrap: wrap; gap: 3px; padding: 3px; background: var(--well); border: 1px solid var(--line); border-radius: 10px; }
.seg button {
  flex: 1; border: 0; background: none; padding: 6px 10px; border-radius: 7px; cursor: pointer; color: var(--text-2);
  font-size: 12px; font-weight: 600; white-space: nowrap;
  transition: background var(--t-fast), color var(--t-fast);
}
.seg button:hover { color: var(--text); background: var(--surface); }
.seg button.on { background: var(--surface-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2), 0 1px 2px rgba(0, 0, 0, .3); }
/* look direction: 7 options in two even rows */
#ctLook { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
#ctLook button { padding: 6px 4px; }

/* ---------- topbar ---------- */
.topbar { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.top-avatar-wrap { position: relative; flex: none; }
.top-avatar { display: block; width: 52px; height: 52px; border-radius: 14px; image-rendering: pixelated; background: var(--surface-2); box-shadow: 0 0 0 1px var(--line-2), 0 10px 24px -10px rgba(0, 0, 0, .8); }
.top-dot { position: absolute; right: -3px; bottom: -3px; width: 14px; height: 14px; border-radius: 50%; background: var(--muted); border: 3px solid var(--bg); }
.top-dot.online { background: var(--green); }
.top-dot.connecting, .top-dot.joining, .top-dot.reconnecting { background: var(--amber); }
.top-dot.auth { background: var(--blue); }
.top-title { min-width: 0; }
.top-name { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; font: 600 23px/1.2 var(--display); letter-spacing: -.005em; }
.top-server { font: 500 13px var(--font); color: var(--muted); }
.top-sub { display: flex; align-items: center; gap: 10px; margin-top: 5px; font-size: 12.5px; color: var(--text-2); min-width: 0; }
.top-status { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.pill {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  font-size: 11.5px; font-weight: 600; padding: 3px 10px 3px 8px; border-radius: 99px;
  background: var(--surface-2); color: var(--text-2); box-shadow: inset 0 0 0 1px var(--line);
}
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.online { background: var(--green-bg); color: var(--green); box-shadow: inset 0 0 0 1px var(--green-line); }
.pill.connecting, .pill.joining, .pill.reconnecting { background: var(--amber-bg); color: var(--amber); box-shadow: inset 0 0 0 1px var(--amber-line); }
.pill.auth { background: var(--blue-bg); color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue-line); }

.chip {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 13px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--line); font-size: 12.5px; font-weight: 600; color: var(--text-2);
  white-space: nowrap; font-variant-numeric: tabular-nums; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
}
.chip [data-icon] svg { width: 14px; height: 14px; }
.chip.ping.good { color: var(--green); }
.chip.ping.ok { color: var(--amber); }
.chip.ping.bad { color: var(--red); }
/* a still dot with a soft glow (an animated one would repaint every frame) */
.pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 0 3px var(--accent-bg), 0 0 10px rgba(143, 125, 255, .8); }

.banner {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r); margin-bottom: 14px;
  border: 1px solid; font-size: 13px;
}
.banner.warn { background: var(--blue-bg); border-color: var(--blue-line); }
.banner.warn > [data-icon] { color: var(--blue); }
.banner.info { background: var(--amber-bg); border-color: var(--amber-line); }
.banner.info > [data-icon] { color: var(--amber); }
.banner-body { flex: 1; }
.code {
  font-family: var(--mono); font-weight: 700; font-size: 14px; letter-spacing: .12em;
  padding: 3px 10px; margin-left: 4px; border-radius: 7px; border: 1px dashed var(--blue); background: rgba(0, 0, 0, .25); color: var(--text); cursor: pointer;
}

/* ---------- key numbers ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(270px, 1.45fr); gap: 14px; margin-bottom: 14px; }
.kpi {
  display: grid; gap: 8px; align-content: start; min-width: 0;
  padding: 16px 18px 17px; border-radius: var(--r-lg);
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--card-shadow);
  contain: layout paint;
}
.kpi-label { display: flex; align-items: center; gap: 7px; min-height: 22px; font-size: 12px; font-weight: 500; color: var(--text-2); }
.kpi-label > [data-icon] { color: var(--muted); }
.kpi-label > [data-icon] svg { width: 14px; height: 14px; }
.kpi-val { font: 600 27px/1.1 var(--display); letter-spacing: -.01em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-reset { margin-left: auto; opacity: .55; }
.kpi:hover .kpi-reset, .kpi-reset:focus-visible { opacity: 1; }
.kpi-main {
  background: radial-gradient(120% 140% at 0% 0%, rgba(61, 220, 151, .14), transparent 55%), var(--card);
  border-color: rgba(61, 220, 151, .2);
}
.kpi-main .kpi-label > [data-icon] { color: var(--green); }
.kpi-main .kpi-val { color: var(--green); }

.sellaxe-cta {
  display: flex; align-items: center; gap: 14px;
  background: radial-gradient(120% 160% at 0% 0%, rgba(143, 125, 255, .2), transparent 60%), var(--card);
  border-color: var(--accent-line);
}
.sellaxe-cta .kpi-label > [data-icon] { color: var(--accent-2); }
.cta-state { font-size: 13px; font-weight: 600; color: var(--text); margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sellaxe-cta .btn { height: 40px; padding: 0 20px; }
.sellaxe-cta.running { background: radial-gradient(120% 160% at 0% 0%, rgba(61, 220, 151, .18), transparent 60%), var(--card); border-color: var(--green-line); }
.sellaxe-cta.running .kpi-label > [data-icon] { color: var(--green); }

/* ---------- cards ---------- */
.grid { display: grid; gap: 14px; margin-bottom: 14px; }
.top-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.mid-grid { grid-template-columns: auto minmax(0, 1fr); }
.card {
  min-width: 0; padding: 18px; border-radius: var(--r-lg);
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--card-shadow);
  contain: layout paint;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; min-height: 28px; }
.card-head h3 { margin: 0; display: flex; align-items: center; gap: 10px; font: 600 14.5px var(--display); letter-spacing: .01em; color: var(--text); }
.card-head h3 [data-icon] {
  width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px;
  background: var(--accent-bg); color: var(--accent-2); box-shadow: inset 0 0 0 1px rgba(143, 125, 255, .22);
}
.card-head h3 [data-icon] svg { width: 15px; height: 15px; }

/* player */
.vitals { display: grid; gap: 14px; }
.vital-label { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; color: var(--text-2); margin-bottom: 7px; }
.vital-label b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; font-size: 12.5px; }
.vital-label .sat { font-style: normal; font-size: 11px; color: var(--muted); margin-left: 6px; }
.bar { height: 7px; border-radius: 99px; background: var(--well); overflow: hidden; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .04); }
.bar.thin { height: 5px; }
.bar i { display: block; height: 100%; width: 0; border-radius: 99px; transition: width .5s var(--ease); }
.bar i.hp { background: linear-gradient(90deg, #ff5a8c, #c56bff); }
.bar i.food { background: linear-gradient(90deg, #ffc94d, #f59441); }
.bar i.xp { background: linear-gradient(90deg, #4fdc8f, #b4f36a); }
.bar i.hp.hit { animation: hit .6s ease-out; }
@keyframes hit { 0% { opacity: .35; } 100% { opacity: 1; } }
.kv { display: grid; gap: 9px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.kv > div { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 12.5px; }
.kv-val { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; min-width: 0; }
.kv-val.mono { font-size: 12px; }
.kv-val img { width: 18px; height: 18px; image-rendering: pixelated; }

/* controls */
.controls { display: grid; }
.control { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.control:first-child { padding-top: 0; }
.control:last-child { border-bottom: 0; padding-bottom: 0; }
.control.col { flex-direction: column; align-items: stretch; gap: 10px; }
.c-title { font-weight: 600; font-size: 13.5px; }
.c-desc { font-size: 12px; color: var(--muted); }

/* ---------- inventory ---------- */
.inv-wrap { display: flex; gap: 14px; align-items: flex-start; overflow-x: auto; padding-bottom: 2px; }
.inv-side { display: flex; flex-direction: column; gap: 10px; }
.slot-col { display: grid; gap: 4px; }
.inv-main { display: grid; gap: 10px; }
.slots { display: grid; grid-template-columns: repeat(9, var(--slot)); gap: 4px; }
.slot {
  width: var(--slot); height: var(--slot); position: relative; border-radius: 8px;
  background: rgba(0, 0, 0, .28); border: 1px solid var(--line); display: grid; place-items: center; cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.slot:hover { border-color: var(--line-3); background: var(--surface-2); }
.slot.held { border-color: var(--accent); background: rgba(143, 125, 255, .1); box-shadow: 0 0 0 2px var(--accent-bg); }
.slot.sel { border-color: var(--amber); box-shadow: 0 0 0 2px var(--amber-bg); }
.slot.ph::before { content: attr(data-ph); font-size: 8.5px; color: #3d4260; font-weight: 700; letter-spacing: .05em; }
.slot img { width: 30px; height: 30px; image-rendering: pixelated; pointer-events: none; }
.slot .fallback { font-size: 10px; font-weight: 700; color: var(--text-2); text-align: center; line-height: 1.05; padding: 2px; pointer-events: none; word-break: break-all; }
.slot .count { position: absolute; right: 3px; bottom: 1px; font: 700 11px/1 var(--mono); color: #fff; text-shadow: 1px 1px 0 #000, -1px 0 0 #000; pointer-events: none; }
.slot .num { position: absolute; left: 4px; top: 3px; font: 600 8.5px/1 var(--mono); color: #4a5070; pointer-events: none; }
.slot .dura { position: absolute; left: 5px; right: 5px; bottom: 4px; height: 3px; background: #000; border-radius: 2px; pointer-events: none; }
.slot .dura i { display: block; height: 100%; border-radius: 2px; }
.slot.glint img { filter: drop-shadow(0 0 3px rgba(190, 120, 255, .9)); }
.hotbar { padding-top: 10px; border-top: 1px dashed var(--line-2); }
.inv-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; padding: 10px 12px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); flex-wrap: wrap; }
.inv-actions .row { gap: 6px; flex-wrap: wrap; }
.hint { font-size: 11.5px; color: var(--muted); margin-top: 12px; }

/* balance & scoreboard */
.me { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); margin-bottom: 10px; }
.me img { width: 38px; height: 38px; border-radius: 9px; image-rendering: pixelated; flex: none; }
.me-name { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-bal { font: 600 21px var(--display); color: var(--green); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sb {
  padding: 12px 14px; border-radius: var(--r); background: var(--well); border: 1px solid var(--line);
  font-family: var(--mono); font-size: 12px; line-height: 1.75; min-height: 64px; max-height: 300px; overflow-y: auto;
}
.sb-title { text-align: center; font-weight: 700; margin-bottom: 4px; }
.sb:empty::before { content: 'No scoreboard'; color: var(--muted); font-family: var(--font); }

/* ---------- tabs ---------- */
.tabs-card { padding: 0; }
.tabs { position: relative; display: flex; gap: 2px; padding: 6px 10px 0; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  display: inline-flex; align-items: center; gap: 8px; padding: 13px 14px 12px; border: 0; background: none; cursor: pointer;
  color: var(--muted); font-weight: 600; font-size: 13px; white-space: nowrap;
  transition: color var(--t-fast);
}
.tabs button [data-icon] svg { width: 15px; height: 15px; }
.tabs button:hover { color: var(--text-2); }
.tabs button.active { color: var(--text); }
.tabs button.active [data-icon] { color: var(--accent-2); }
.tabs em { font-style: normal; font-size: 10.5px; font-variant-numeric: tabular-nums; padding: 1px 7px; border-radius: 99px; background: var(--surface-2); color: var(--text-2); }
.tabs em:empty { display: none; }
.tab-ink {
  position: absolute; left: 0; bottom: -1px; height: 2px; width: 0; border-radius: 2px;
  background: var(--accent-grad); box-shadow: 0 0 12px rgba(143, 125, 255, .7);
  transition: transform 260ms var(--ease), width 260ms var(--ease);
}
.tab { display: none; padding: 18px; }
.tab.active { display: block; animation: rise 200ms var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } }

/* chat */
.chat-layout { display: block; }
.chat-main { min-width: 0; display: flex; flex-direction: column; }
.chat-tools { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 10px; }
.search { position: relative; width: 240px; }
.search [data-icon] { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search [data-icon] svg { width: 14px; height: 14px; }
.search input { padding-left: 33px; height: 34px; }
.chat-log {
  height: 440px; overflow-y: auto; padding: 10px 12px; border-radius: var(--r); background: var(--well); border: 1px solid var(--line);
  font-family: var(--mono); font-size: 12.5px; line-height: 1.65; overscroll-behavior: contain;
  contain: strict;
}
.chat-line { white-space: pre-wrap; word-break: break-word; padding: 1px 6px; border-radius: 5px; }
.chat-line:hover { background: rgba(255, 255, 255, .03); }
.chat-line .ts { color: #474d6b; margin-right: 10px; font-size: 11px; }
.chat-line.gain { background: rgba(61, 220, 151, .07); box-shadow: inset 2px 0 0 var(--green); }
.chat-line.self { color: var(--accent-2); }
.obf { filter: blur(2px); }
.actionbar { min-height: 24px; text-align: center; font-family: var(--mono); font-size: 12.5px; padding: 5px; }
.chat-input {
  display: flex; gap: 8px; align-items: center; padding: 4px 4px 4px 14px;
  background: var(--well); border: 1px solid var(--line-2); border-radius: var(--r);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.chat-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.chat-input input { border: 0; background: none; box-shadow: none !important; padding: 0; height: 36px; font-family: var(--mono); font-size: 13px; }
.chat-input .prompt { color: var(--accent-2); font-weight: 700; font-family: var(--mono); }
.chat-input .btn { height: 36px; width: 44px; padding: 0; }
.quick { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.quick button {
  border: 1px solid var(--line-2); background: var(--surface); color: var(--text-2); border-radius: 99px; padding: 4px 11px;
  font: 500 12px var(--mono); cursor: pointer; transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast);
}
.quick button:hover { color: var(--text); border-color: var(--accent-line); background: var(--accent-bg); }

/* sell axe tab */
.axe-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 22px; }
.axe-form { display: grid; }
.opt { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 16px; align-items: center; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.opt.sub { padding-left: 22px; position: relative; }
.opt.sub::before { content: ''; position: absolute; left: 8px; top: 0; bottom: 0; width: 1px; background: var(--line-2); }
.opt-title { font-weight: 600; font-size: 13.5px; }
.opt-desc { font-size: 12px; color: var(--muted); }
.opt-ctl { display: flex; justify-content: flex-end; }
.opt-ctl input, .opt-ctl select { max-width: 220px; }
.opt-section { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--accent-2); font-weight: 700; padding: 20px 4px 6px; }
.opt-section:first-child { padding-top: 2px; }
.axe-side { display: flex; flex-direction: column; gap: 12px; }
.axe-status { padding: 16px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); display: grid; gap: 10px; }
.axe-state { font: 600 16px var(--display); }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat { padding: 10px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); min-width: 0; }
.stat .s-l { font-size: 11px; color: var(--muted); }
.stat .s-v { font-weight: 600; font-size: 14px; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* players */
.players { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; max-height: 480px; overflow-y: auto; }
.player { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); }
.player img { width: 24px; height: 24px; border-radius: 6px; image-rendering: pixelated; }
.player .pn { flex: 1; font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player .pp { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }

/* events */
.ev-tools { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.ev-filter { flex: 0 1 auto; }
.ev-filter button { flex: 0 0 auto; }
.ev-list { max-height: 480px; overflow-y: auto; display: grid; gap: 5px; align-content: start; }
.ev-day { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 12px 2px 4px; }
.ev-day:first-child { padding-top: 0; }
.ev { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 12px; align-items: center; padding: 9px 12px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); }
.ev-ico { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); }
.ev-ico svg { width: 15px; height: 15px; }
.ev-msg { font-size: 13px; word-break: break-word; }
.ev-meta { display: flex; gap: 10px; font-size: 11.5px; color: var(--muted); }
.ev-kind { font-weight: 600; }
.ev-join .ev-ico { background: var(--green-bg); color: var(--green); }
.ev-disconnect .ev-ico, .ev-death .ev-ico { background: var(--red-bg); color: var(--red); }
.ev-disconnect.lv-info .ev-ico { background: var(--surface-2); color: var(--text-2); }
.ev-buy .ev-ico { background: var(--accent-bg); color: var(--accent-2); }
.ev-buy.lv-success .ev-ico { background: var(--green-bg); color: var(--green); }
.ev-buy.lv-warn .ev-ico, .ev-teleport.lv-warn .ev-ico, .ev-kill .ev-ico { background: var(--amber-bg); color: var(--amber); }
.ev-teleport .ev-ico { background: var(--blue-bg); color: var(--blue); }
.ev-empty { display: grid; justify-items: center; gap: 6px; text-align: center; padding: 40px 16px; color: var(--text-2); }
.ev-empty > [data-icon] { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: var(--accent-bg); color: var(--accent-2); margin-bottom: 4px; }
.ev-empty > [data-icon] svg { width: 20px; height: 20px; }
.ev-empty .small { max-width: 420px; }
.ev.new, .log-line.new { animation: rise 220ms var(--ease); }

/* activity log */
.log { max-height: 480px; overflow-y: auto; font-family: var(--mono); font-size: 12.5px; display: grid; gap: 2px; align-content: start; }
.log-line { display: grid; grid-template-columns: 92px 64px minmax(0, 1fr); gap: 10px; padding: 5px 8px; border-radius: 7px; }
.log-line:hover { background: rgba(255, 255, 255, .025); }
.log-line .lt { color: var(--muted); }
.log-line .lm { word-break: break-word; }
.lv { font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 2px 6px; border-radius: 5px; text-align: center; align-self: start; font-family: var(--font); }
.lv.info { background: var(--blue-bg); color: var(--blue); }
.lv.warn { background: var(--amber-bg); color: var(--amber); }
.lv.error { background: var(--red-bg); color: var(--red); }
.lv.success { background: var(--green-bg); color: var(--green); }
.empty-row { padding: 22px; text-align: center; color: var(--muted); font-family: var(--font); }
.log-tools { display: flex; justify-content: space-between; gap: 10px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.log-tools .seg { flex: 0 1 auto; }
.log-tools .seg button { flex: 0 0 auto; }
.log-files { margin-top: 14px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); padding: 2px 14px; }
.log-files summary { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 10px 0; font-weight: 600; list-style: none; }
.log-files summary::-webkit-details-marker { display: none; }
.log-files summary .btn { margin-left: auto; }
.logs-list { display: grid; gap: 14px; max-height: 40vh; overflow-y: auto; padding-bottom: 12px; }
.logs-group h4 { margin: 0 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--accent-2); }
.log-file { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 12px; align-items: center; padding: 8px 10px; border-radius: 9px; background: var(--surface); border: 1px solid var(--line); font-size: 12.5px; margin-bottom: 4px; }
.log-file .lf-name { font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-file a { color: var(--accent-2); font-weight: 600; }
code { font-family: var(--mono); font-size: 12px; background: var(--surface-2); padding: 1px 6px; border-radius: 5px; }

/* developer settings */
.settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }
.set-card { padding: 16px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); display: grid; gap: 12px; align-content: start; }
.set-card h4 { margin: 0; font: 600 14px var(--display); }
.set-card .help { font-size: 12px; color: var(--muted); margin-top: -6px; }
.set-card.danger { border-color: var(--red-line); background: linear-gradient(180deg, rgba(248, 113, 113, .06), transparent); }

/* ---------- windows ---------- */
.modal {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px;
  background: rgba(3, 4, 10, .72);
  animation: fade-in 160ms var(--ease);
}
.modal.closing { animation: fade-out 140ms var(--ease) forwards; pointer-events: none; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
.modal-card, .dialog-card, .window-card {
  position: relative; max-width: 100%; max-height: calc(100vh - 32px); overflow-y: auto;
  background: linear-gradient(180deg, #15172b, #0f1121);
  border: 1px solid var(--line-2); border-radius: 18px; box-shadow: var(--pop-shadow), inset 0 1px 0 rgba(255, 255, 255, .06);
  animation: pop-in 220ms var(--ease);
}
.modal.closing .modal-card, .modal.closing .dialog-card, .modal.closing .window-card { animation: pop-out 140ms var(--ease) forwards; }
@keyframes pop-in { from { opacity: 0; transform: translateY(10px) scale(.975); } }
@keyframes pop-out { to { opacity: 0; transform: translateY(6px) scale(.985); } }
.modal-card { width: 480px; padding: 20px; }
.modal-card.wide { width: min(860px, calc(100vw - 32px)); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-head h3 { margin: 0; font: 600 17px var(--display); }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; align-items: center; margin-top: 6px; }

/* Settings window: menu on the left, the chosen section on the right */
.modal-card.set-window { width: min(1060px, calc(100vw - 32px)); height: min(740px, calc(100vh - 32px)); padding: 0; overflow: hidden; display: grid; grid-template-columns: 216px minmax(0, 1fr); }
.set-nav { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 20px 10px 12px; border-right: 1px solid var(--line); background: rgba(0, 0, 0, .18); }
.set-nav-title { font: 600 15px var(--display); padding: 0 10px 14px; }
.set-nav button {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 10px;
  background: none; color: var(--text-2); font-weight: 600; font-size: 13px; cursor: pointer; text-align: left;
  transition: color var(--t-fast), background var(--t-fast);
}
.set-nav button:hover { color: var(--text); background: var(--surface); }
.set-nav button.on { color: var(--text); background: none; }
.set-nav button.on [data-icon] { color: var(--accent-2); }
.set-nav-ink {
  position: absolute; left: 10px; right: 10px; top: 0; height: 0; border-radius: 10px; pointer-events: none;
  background: var(--accent-bg); box-shadow: inset 0 0 0 1px rgba(143, 125, 255, .3);
  transition: transform 240ms var(--ease);
}
.set-lowpower { padding: 8px 10px; }
.set-logout { color: var(--text-2); }
.set-logout:hover { color: var(--red) !important; }
.set-body { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.set-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 20px 24px 14px; border-bottom: 1px solid var(--line); }
.set-head h3 { margin: 0 0 3px; font: 600 18px var(--display); }
.set-sec { display: none; flex: 1; min-height: 0; overflow-y: auto; padding: 18px 24px 24px; }
.set-sec.on { display: block; animation: rise 180ms var(--ease); }
.set-sec .proxy-list { max-height: none; }
.set-sec .log { max-height: 46vh; }
.dev-host { min-width: 0; }

.proxy-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 20px; }
.proxy-list-wrap { display: flex; flex-direction: column; gap: 8px; }
.proxy-list { display: grid; gap: 6px; max-height: 420px; overflow-y: auto; }
.proxy-item { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; transition: border-color var(--t-fast), background var(--t-fast); }
.proxy-item:hover { border-color: var(--line-3); }
.proxy-item.active { border-color: var(--accent-line); background: var(--accent-bg); }
.proxy-item .pi-name { font-weight: 600; display: flex; justify-content: space-between; gap: 8px; }
.proxy-item .pi-sub { font-size: 11.5px; color: var(--muted); font-family: var(--mono); }
.proxy-empty { padding: 24px 12px; text-align: center; color: var(--muted); font-size: 12.5px; border: 1px dashed var(--line-2); border-radius: 10px; }

/* Settings → Appearance: background picker */
.bg-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.bg-opt {
  display: grid; gap: 10px; padding: 8px 8px 12px; border-radius: 14px; cursor: pointer; text-align: left; color: var(--text);
  background: var(--surface); border: 1px solid var(--line);
  transition: border-color var(--t-fast), background var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast) var(--ease);
}
.bg-opt:hover { border-color: var(--line-3); background: var(--surface-2); }
.bg-opt:active { transform: scale(.98); }
.bg-opt.on { border-color: var(--accent); background: var(--accent-bg); box-shadow: 0 0 0 3px var(--accent-bg); }
.bg-opt .bg-art { position: relative; display: block; aspect-ratio: 16 / 10; border-radius: 9px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06); }
/* tiny glass panels, to show how the dashboard sits on each background */
.bg-opt .bg-art i { position: absolute; z-index: 1; border-radius: 5px; background: var(--card); border: 1px solid var(--line-2); }
.bg-opt .bg-art i:nth-child(1) { left: 0; top: 0; bottom: 0; width: 22%; border-radius: 0; border-width: 0 1px 0 0; background: rgba(12, 13, 26, .6); }
.bg-opt .bg-art i:nth-child(2) { left: 28%; right: 6%; top: 12%; height: 22%; }
.bg-opt .bg-art i:nth-child(3) { left: 28%; width: 30%; top: 42%; bottom: 12%; }
.bg-opt .bg-art i:nth-child(4) { left: 62%; right: 6%; top: 42%; bottom: 12%; }
.bg-name { display: flex; align-items: center; gap: 8px; padding: 0 4px; }
.bg-name b { display: block; font-weight: 600; font-size: 13px; }
.bg-name small { display: block; font-size: 11.5px; color: var(--muted); }
.bg-name [data-icon] { margin-left: auto; color: var(--accent-2); opacity: 0; transform: scale(.6); transition: opacity var(--t) var(--ease), transform var(--t) var(--ease); }
.bg-opt.on .bg-name [data-icon] { opacity: 1; transform: none; }
.bg-note { margin: 16px 0 0; }
.ap-head { margin: 0 0 10px; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
#bgSection { margin-top: 22px; }

/* chunks */
.chunk-table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-bottom: 14px; }
.chunk-table th, .chunk-table td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.chunk-table th { color: var(--muted); font-weight: 600; font-size: 11.5px; }
.chunk-bots { overflow-x: auto; }
.chunk-farm { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 12px; }
.chunk-farm .grow { flex: 1; min-width: 180px; padding-bottom: 8px; }
.chunk-farm .row { gap: 6px; align-items: center; padding-bottom: 8px; }
.chunk-form { display: grid; grid-template-columns: 1.2fr 1fr 1fr 1fr 1fr auto; gap: 8px; align-items: end; margin-bottom: 12px; }
.chunk-verdict { padding: 10px 12px; border-radius: 10px; font-size: 13px; border: 1px solid var(--line-2); }
.chunk-verdict.ok { background: var(--green-bg); border-color: var(--green-line); }
.chunk-verdict.warn { background: var(--amber-bg); border-color: var(--amber-line); }
.chunk-verdict.bad { background: var(--red-bg); border-color: var(--red-line); }
.chunk-map-wrap { display: grid; gap: 6px; margin-top: 8px; }
.chunk-map { width: 100%; max-height: 520px; background: var(--well); border-radius: 10px; }
.chunk-map .cm-grid { stroke: rgba(255, 255, 255, .06); stroke-width: 1; }
.chunk-map .cm-area { fill: rgba(255, 159, 67, .3); stroke: #ff9f43; stroke-width: 2; }
.chunk-map .cm-label { fill: var(--text); font-size: 11px; font-weight: 600; paint-order: stroke; stroke: rgba(0, 0, 0, .6); stroke-width: 3px; }

/* Minecraft dialogs and container windows */
.dialog-card { width: 560px; padding: 24px 22px 18px; text-align: center; }
.dialog-x { position: absolute; right: 10px; top: 10px; }
.dialog-title { font-size: 17px; font-weight: 700; margin: 0 30px 14px; font-family: var(--mono); }
.dialog-body { display: grid; gap: 8px; margin-bottom: 14px; font-family: var(--mono); font-size: 13px; }
.dialog-body .d-item { display: inline-flex; align-items: center; gap: 10px; justify-content: center; }
.dialog-body .d-item img { width: 32px; height: 32px; image-rendering: pixelated; }
.dialog-inputs { display: grid; gap: 10px; text-align: left; margin-bottom: 14px; }
.dialog-inputs:empty { display: none; }
.dialog-buttons { display: grid; gap: 8px; }
.mc-btn {
  min-height: 40px; padding: 8px 12px; border-radius: 10px; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--line-2); color: var(--text);
  font: 600 13px var(--mono); transition: border-color var(--t-fast), background var(--t-fast), transform var(--t-fast) var(--ease);
}
.mc-btn:hover { border-color: var(--accent-line); background: var(--accent-bg); }
.mc-btn:active { transform: scale(.98); }
.dialog-exit { margin-top: 10px; display: flex; justify-content: center; }
.dialog-exit:empty { display: none; }
.dialog-exit .mc-btn { min-width: 200px; }
.window-card { width: auto; padding: 20px 22px 18px; }
.window-head { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 14px; }
.window-title { font-family: var(--mono); font-weight: 700; font-size: 14px; }
.window-sep { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; margin: 14px 0 8px; }
.window-slots { --slot: 44px; }
.window-slots .slot img { width: 32px; height: 32px; }

/* item tooltip (Minecraft style) */
.tooltip {
  position: fixed; z-index: 100; pointer-events: none; max-width: 360px;
  background: rgba(16, 4, 20, .97); border: 2px solid #2b0f5c; outline: 1px solid #12041f; border-radius: 6px;
  padding: 7px 9px; font-family: var(--mono); font-size: 12px; line-height: 1.5; box-shadow: var(--pop-shadow);
}
.tooltip .tt-name { font-weight: 700; margin-bottom: 2px; }
.tooltip .tt-dim { color: #8b8b9b; }

/* toasts */
.toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 8px; z-index: 200; }
.toast {
  display: flex; gap: 10px; align-items: flex-start; max-width: 380px; padding: 12px 14px; border-radius: var(--r);
  background: linear-gradient(180deg, #181a30, #12142a); border: 1px solid var(--line-2); box-shadow: var(--pop-shadow);
  font-size: 13px; animation: toast-in 240ms var(--ease);
}
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.toast > [data-icon] { margin-top: 1px; }
.toast.ok > [data-icon] { color: var(--green); }
.toast.error, .toast.err { border-color: var(--red-line); }
.toast.error > [data-icon], .toast.err > [data-icon] { color: var(--red); }

/* empty state */
.empty { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.empty-card {
  text-align: center; max-width: 400px; padding: 36px 32px; border-radius: 22px;
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--card-shadow);
}
.empty-icon { width: 60px; height: 60px; margin: 0 auto 18px; display: grid; place-items: center; border-radius: 18px; background: var(--accent-bg); color: var(--accent-2); box-shadow: inset 0 0 0 1px rgba(143, 125, 255, .25); }
.empty-icon svg { width: 28px; height: 28px; }
.empty h2 { margin: 0 0 8px; font: 600 21px var(--display); }
.empty p { color: var(--text-2); margin: 0 0 20px; }

/* login page */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 380px; max-width: 100%; padding: 28px; border-radius: 20px; background: var(--card); border: 1px solid var(--line-2); box-shadow: var(--pop-shadow), inset 0 1px 0 rgba(255, 255, 255, .06); animation: pop-in 260ms var(--ease); }
.login-card .brand { padding: 0 0 20px; }
.err { color: var(--red); font-size: 12.5px; min-height: 18px; }

.scrim { display: none; }
.mobile-only { display: none; }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .14) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .12); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, .22); border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- responsive ---------- */
@media (max-width: 1360px) {
  .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .sellaxe-cta { grid-column: 1 / -1; }
}
@media (max-width: 1180px) {
  .top-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .top-grid > .card:last-child { grid-column: 1 / -1; }
  .mid-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: 284px; height: 100%; z-index: 40;
    background: #0c0d1a; box-shadow: var(--pop-shadow);
    transform: translateX(-102%); transition: transform 240ms var(--ease);
  }
  .sidebar.open { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 39; background: rgba(3, 4, 10, .6); opacity: 0; pointer-events: none; transition: opacity 240ms var(--ease); }
  .scrim.on { opacity: 1; pointer-events: auto; }
  .mobile-only { display: inline-grid; }
  .view { padding: 14px 16px 28px; }
  .topbar { gap: 12px; flex-wrap: wrap; }
  .top-avatar { width: 44px; height: 44px; border-radius: 12px; }
  .top-name { font-size: 19px; }
  .top-right { width: 100%; margin-left: 0; }
  .top-right .chip#activityChip { display: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 14px; }
  .kpi-val { font-size: 22px; }
  .grid { gap: 10px; margin-bottom: 10px; }
  .top-grid { grid-template-columns: minmax(0, 1fr); }
  .axe-layout, .proxy-layout { grid-template-columns: minmax(0, 1fr); }
  .opt { grid-template-columns: minmax(0, 1fr); }
  .opt-ctl { justify-content: flex-start; }
  :root { --slot: 32px; }
  .slot img { width: 24px; height: 24px; }
  .search { width: 160px; }
  .chat-log { height: 360px; }

  .modal-card.set-window { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); height: calc(100vh - 24px); }
  .set-nav { flex-direction: row; overflow-x: auto; padding: 8px; border-right: 0; border-bottom: 1px solid var(--line); }
  .set-nav-title, .set-nav .grow, .set-nav-ink { display: none; }
  .set-nav button { width: auto; flex: none; white-space: nowrap; padding: 7px 11px; }
  .set-nav button.on { background: var(--accent-bg); }
  .set-lowpower { flex: none; white-space: nowrap; }
  .set-head, .set-sec { padding-left: 14px; padding-right: 14px; }
  .ev-filter { width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .log-line { grid-template-columns: auto auto 1fr; row-gap: 3px; }
  .log-line .lm { grid-column: 1 / -1; }
  .log-tools .search { width: 100%; }
}
@media (max-width: 720px) { .chunk-form { grid-template-columns: 1fr 1fr; } }

/* ---------- motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}
/* Low power mode (Settings window): plain background, no motion at all */
body.lowpower .backdrop { background: var(--bg); }
body.lowpower .backdrop::before, body.lowpower .backdrop::after { display: none; }
body.lowpower *, body.lowpower *::before, body.lowpower *::after { animation: none !important; transition: none !important; }
