* { box-sizing: border-box; margin: 0; }
:root {
  --bg: #0a1219; --panel: rgba(20, 34, 46, .72); --panel2: #0e1a24; --line: #22404d;
  --text: #e9f3f1; --muted: #8ba6ad;
  --accent: #3ddfb0; --accent2: #f4b942; --ok: #46d99a; --warn: #f4b942; --err: #ff6b6b;
}
html, body { height: 100%; }
body {
  background:
    radial-gradient(1100px 500px at 85% -10%, #1d4a4633 0%, transparent 60%),
    radial-gradient(900px 500px at -10% 30%, #27476e33 0%, transparent 60%),
    linear-gradient(180deg, #0a1219 0%, #0c1a20 55%, #0a1219 100%);
  background-color: var(--bg);
  color: var(--text); font-family: "Segoe UI", system-ui, -apple-system, sans-serif; font-size: 14px;
}
a { color: var(--accent); text-decoration: none; }

/* ---------- Sky blobs ---------- */
.sky { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.blob {
  position: absolute; border-radius: 50%; filter: blur(90px); opacity: .3;
  animation: drift 26s ease-in-out infinite alternate;
}
.blob.b1 { width: 480px; height: 480px; top: -160px; right: -100px; background: #3ddfb044; }
.blob.b2 { width: 380px; height: 380px; bottom: -140px; left: 30%; background: #f4b9422e; animation-delay: -10s; }
@keyframes drift { from { transform: translate(0,0) scale(1); } to { transform: translate(40px,30px) scale(1.12); } }

.app { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: 236px; background: rgba(12, 22, 30, .82); backdrop-filter: blur(14px);
  border-right: 1px solid var(--line); padding: 16px 0 0;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-size: 1.08rem; font-weight: 800; color: var(--text);
  padding: 6px 18px 16px; letter-spacing: .02em;
}
.brand .logo { width: 30px; height: 30px; flex: none; }
.brand small { display: block; font-size: .68rem; color: var(--muted); font-weight: 400; }
nav { flex: 1; overflow-y: auto; padding-bottom: 8px; }
.nav-h {
  font-size: .66rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent2); padding: 14px 20px 5px;
}
nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 14px 7px 17px; margin: 1px 8px;
  color: var(--muted); border-radius: 9px; font-weight: 500; font-size: .88rem;
  transition: all .15s;
}
nav a svg { width: 17px; height: 17px; flex: none; opacity: .85; }
nav a:hover { color: var(--accent); background: rgba(61, 223, 176, .07); }
nav a.active {
  color: var(--accent); background: rgba(61, 223, 176, .12);
  box-shadow: inset 0 0 0 1px rgba(61, 223, 176, .25);
}
.sidebar-foot {
  padding: 14px 18px; border-top: 1px solid var(--line);
  font-size: .78rem; color: var(--muted);
  display: flex; flex-direction: column; gap: 10px; flex: none;
}
.backlink {
  display: inline-block; color: var(--accent); font-weight: 700;
  font-size: .85rem;
}
.backlink:hover { text-decoration: underline; }
.foot-status { display: flex; flex-direction: column; gap: 2px; line-height: 1.45; }
.sidebar-foot button { width: 100%; padding: 8px 0; }

/* ---------- Main ---------- */
main { flex: 1; padding: 26px 30px; max-width: 1220px; min-width: 0; }
.page { display: none; animation: fadein .25s ease; }
.page.active { display: block; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
h1 {
  color: var(--text); font-size: 1.5rem; margin-bottom: 4px; font-weight: 800;
  background: linear-gradient(120deg, #eafff7 30%, var(--accent) 80%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
h2 { color: var(--text); font-size: 1.05rem; margin: 26px 0 10px; }
.sub { color: var(--muted); margin-bottom: 18px; }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px; margin-bottom: 10px; backdrop-filter: blur(8px);
  box-shadow: 0 8px 30px #0004;
}
.card.transparent { background: transparent; padding: 0; border: 0; box-shadow: none; backdrop-filter: none; }

.statgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 10px; }
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 10px; text-align: center; backdrop-filter: blur(8px);
  transition: transform .15s, border-color .15s;
}
.stat:hover { transform: translateY(-2px); border-color: rgba(61,223,176,.4); }
.stat b { display: block; font-size: 1.5rem; color: var(--accent); }
.stat span { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }

.badges { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.badge { border-radius: 999px; padding: 3px 11px; font-size: .75rem; font-weight: 600; background: rgba(255,255,255,.05); border: 1px solid var(--line); color: var(--muted); }
.badge.on { background: rgba(70,217,154,.12); color: var(--ok); border-color: rgba(70,217,154,.4); }
.badge.off { background: rgba(255,107,107,.12); color: var(--err); border-color: rgba(255,107,107,.4); }
.badge.warn { background: rgba(244,185,66,.12); color: var(--warn); border-color: rgba(244,185,66,.4); }

.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
label { display: block; font-size: .72rem; color: var(--accent2); margin: 10px 0 4px; text-transform: uppercase; letter-spacing: .5px; font-weight: 700; }
input, select, textarea {
  width: 100%; background: var(--panel2); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
input[type=checkbox] { width: auto; transform: scale(1.25); margin-right: 6px; accent-color: var(--accent); }
.checkline { display: flex; align-items: center; margin-top: 12px; font-size: .9rem; }
.checkline label { margin: 0; text-transform: none; letter-spacing: 0; font-size: .9rem; color: var(--text); }

button {
  background: linear-gradient(135deg, var(--accent), #2bb892); color: #06231a;
  border: 0; border-radius: 8px; padding: 9px 16px; cursor: pointer;
  font: inherit; font-weight: 700; transition: all .15s;
}
button:hover { filter: brightness(1.12); transform: translateY(-1px); }
button.small { padding: 4px 10px; font-size: .78rem; border-radius: 6px; }
button.red { background: linear-gradient(135deg, var(--err), #d34a4a); color: #2b0a0a; }
button.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); font-weight: 600; }
button.ghost:hover { border-color: var(--accent); color: var(--accent); }
.flex { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 120px; }

table { width: 100%; border-collapse: collapse; }
td, th { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: .88rem; vertical-align: middle; }
th { color: var(--accent2); font-size: .7rem; text-transform: uppercase; letter-spacing: .5px; }
tr:hover td { background: rgba(61,223,176,.04); }
tr.clickable { cursor: pointer; }

pre {
  background: #060d12; border: 1px solid var(--line); border-radius: 8px;
  padding: 14px; white-space: pre-wrap; word-break: break-all;
  max-height: 340px; overflow: auto; font-size: .82rem; line-height: 1.5;
}

#d-chart { width: 100%; height: 240px; }
.chart-legend { display: flex; gap: 16px; font-size: .78rem; color: var(--muted); margin-top: 6px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

/* ---------- Drawer ---------- */
#drawer {
  position: fixed; top: 0; right: -480px; width: 460px; max-width: 92vw; height: 100vh;
  background: rgba(14, 26, 36, .96); backdrop-filter: blur(16px);
  border-left: 1px solid var(--line); box-shadow: -12px 0 40px rgba(0,0,0,.5);
  transition: right .25s; z-index: 50; display: flex; flex-direction: column;
}
#drawer.open { right: 0; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.drawer-head h3 { color: var(--text); }
.drawer-body { padding: 16px 18px; overflow-y: auto; flex: 1; }
.drawer-body pre { max-height: 240px; }
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 40; display: none; }
.overlay.show { display: block; }

/* ---------- Toasts ---------- */
#toasts { position: fixed; bottom: 18px; right: 18px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--panel2); border: 1px solid var(--line);
  border-left: 4px solid var(--accent); border-radius: 8px;
  padding: 10px 16px; min-width: 240px; box-shadow: 0 6px 20px rgba(0,0,0,.4);
  animation: slidein .2s;
}
.toast.ok { border-left-color: var(--ok); } .toast.err { border-left-color: var(--err); }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } }

/* ---------- Login ---------- */
#loginwrap {
  display: none; position: fixed; inset: 0;
  background: radial-gradient(700px 400px at 50% 20%, #1d4a4640, transparent), var(--bg);
  z-index: 90; align-items: center; justify-content: center;
}
#loginwrap.show { display: flex; }
#loginwrap .card { box-shadow: 0 12px 48px rgba(0,0,0,.55); }

.guildblock { border-bottom: 1px solid var(--line); padding: 10px 0; }
.guildblock:last-child { border-bottom: 0; }
.memberchip {
  display: inline-block; background: var(--panel2); border: 1px solid var(--line);
  border-radius: 999px; padding: 2px 10px; margin: 2px 4px 2px 0; font-size: .78rem;
}

/* ---------- RCON Konsole ---------- */
.console { background: #060d12; border: 1px solid var(--line); border-radius: 8px; padding: 14px; height: 340px; overflow-y: auto; font-family: ui-monospace, monospace; font-size: .85rem; }
.console .in { color: var(--accent); } .console .err { color: var(--err); }
.console-line { white-space: pre-wrap; word-break: break-all; margin-bottom: 4px; }

.tabs { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.tabs button { background: var(--panel2); color: var(--muted); border: 1px solid var(--line); padding: 5px 12px; border-radius: 999px; }
.tabs button.active { background: rgba(61,223,176,.14); border-color: var(--accent); color: var(--accent); }

@media (max-width: 800px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  nav { display: flex; flex-wrap: wrap; }
  nav a { border-radius: 8px; }
  .nav-h { width: 100%; }
}
