@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,500;12..96,700;12..96,800&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;600&display=swap');

:root {
  --bg: #0d0b0c;
  --bg-2: #151214;
  --panel: #1a1618;
  --panel-2: #221d20;
  --line: #2e272b;
  --line-2: #3d343a;
  --text: #f3eee9;
  --muted: #a49a95;
  --dim: #6f6662;
  --crimson: #a50c26;
  --crimson-hi: #d0213f;
  --gold: #c1912f;
  --gold-hi: #e3b456;
  --green: #22c55e;
  --red: #ef4444;
  --amber: #f59e0b;
  --radius: 14px;
  --display: 'Bricolage Grotesque', system-ui, sans-serif;
  --body: 'Inter', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--body);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--gold-hi); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
code, .mono { font-family: var(--mono); }
::selection { background: var(--crimson); color: #fff; }

/* ------------------------------------------------------------ buttons & inputs */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text);
  font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: #2b2428; border-color: #4a4046; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--crimson); border-color: var(--crimson-hi); color: #fff; }
.btn.primary:hover { background: var(--crimson-hi); }
.btn.gold { background: var(--gold); border-color: var(--gold-hi); color: #1b1305; }
.btn.gold:hover { background: var(--gold-hi); }
.btn.danger { color: #ffb4b4; border-color: #5b2a2f; }
.btn.danger:hover { background: #3a1a1e; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--panel-2); color: var(--text); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.btn.lg { height: 50px; padding: 0 22px; font-size: 16px; border-radius: 12px; }

.input, select.input, textarea.input {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 10px;
  background: var(--bg-2); border: 1px solid var(--line-2); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; padding: 10px 12px; resize: vertical; }
.input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(193,145,47,.18); }
label.field { display: block; }
label.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }

.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track { position: absolute; inset: 0; background: var(--line-2); border-radius: 99px; cursor: pointer; transition: background .15s; }
.switch .track::after { content: ''; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; background: #fff; border-radius: 50%; transition: transform .15s; }
.switch input:checked + .track { background: var(--green); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px rgba(193,145,47,.35); }

/* ------------------------------------------------------------ status bits */
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--dim); display: inline-block; flex: none; }
.dot.on { background: var(--green); box-shadow: 0 0 0 0 rgba(34,197,94,.6); animation: pulse 2s infinite; }
.dot.off { background: var(--red); }
.dot.warn { background: var(--amber); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(34,197,94,.55); } 70% { box-shadow: 0 0 0 8px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }

.pill { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--line-2); font-size: 13px; font-weight: 600; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }
.tag.gold { color: var(--gold-hi); border-color: #5a4419; background: #2a2010; }
.tag.red { color: #ffb4b4; border-color: #5b2a2f; background: #2c1316; }
.tag.green { color: #86efac; border-color: #1f4d30; background: #0f2418; }

.head { width: 32px; height: 32px; border-radius: 6px; image-rendering: pixelated; background: var(--panel-2); flex: none; }
.head.lg { width: 44px; height: 44px; border-radius: 8px; }

/* minecraft motd colors */
.mc-black { color: #000; } .mc-dark_blue { color: #0000aa; } .mc-dark_green { color: #00aa00; } .mc-dark_aqua { color: #00aaaa; }
.mc-dark_red { color: #aa0000; } .mc-dark_purple { color: #aa00aa; } .mc-gold { color: #ffaa00; } .mc-gray { color: #aaaaaa; }
.mc-dark_gray { color: #555555; } .mc-blue { color: #5555ff; } .mc-green { color: #55ff55; } .mc-aqua { color: #55ffff; }
.mc-red { color: #ff5555; } .mc-light_purple { color: #ff55ff; } .mc-yellow { color: #ffff55; } .mc-white { color: #ffffff; }
.mc-b { font-weight: 700; } .mc-i { font-style: italic; } .mc-u { text-decoration: underline; } .mc-s { text-decoration: line-through; }
.motd { font-family: var(--mono); font-size: 14px; white-space: pre-wrap; color: #aaaaaa; }

/* toast */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 100; max-width: min(420px, calc(100vw - 40px)); }
.toast { background: var(--panel-2); border: 1px solid var(--line-2); border-left: 3px solid var(--gold); border-radius: 10px; padding: 12px 14px; box-shadow: 0 10px 30px rgba(0,0,0,.45); font-size: 14px; animation: toastIn .2s ease-out; white-space: pre-wrap; word-break: break-word; }
.toast.error { border-left-color: var(--red); }
.toast.ok { border-left-color: var(--green); }
@keyframes toastIn { from { transform: translateY(8px); opacity: 0; } }

/* ============================================================ landing */
.landing { min-height: 100vh; display: flex; flex-direction: column; position: relative; overflow: hidden; }
.landing::before {
  content: ''; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(165,12,38,.35), transparent 60%),
    radial-gradient(700px 500px at 100% 10%, rgba(193,145,47,.16), transparent 60%);
}
.landing::after {
  content: ''; position: absolute; inset: 0; z-index: 0; pointer-events: none; opacity: .5;
  background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(to bottom, #000, transparent 70%);
}
.landing > * { position: relative; z-index: 1; }
.nav { display: flex; align-items: center; justify-content: space-between; padding: 22px clamp(20px, 5vw, 56px); }
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); font-family: var(--display); font-weight: 700; font-size: 18px; }
.brand:hover { text-decoration: none; }
.brand img { height: 34px; width: auto; }
.brand small { display: block; font-family: var(--body); font-weight: 500; color: var(--muted); font-size: 12px; letter-spacing: .04em; text-transform: uppercase; }

.hero { flex: 1; display: grid; grid-template-columns: 1.15fr .85fr; gap: clamp(28px, 5vw, 72px); align-items: center; padding: 30px clamp(20px, 5vw, 56px) 60px; max-width: 1240px; width: 100%; margin: 0 auto; }
.eyebrow { display: inline-flex; align-items: center; gap: 10px; color: var(--gold-hi); font-weight: 600; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; }
.hero h1 { font-family: var(--display); font-weight: 800; font-size: clamp(44px, 6.4vw, 84px); line-height: .98; letter-spacing: -.035em; margin: 18px 0 18px; }
.hero h1 em { font-style: normal; color: var(--gold-hi); }
.hero p.lede { font-size: 18px; color: var(--muted); max-width: 520px; margin: 0 0 30px; }

.address { display: flex; align-items: stretch; max-width: 520px; background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px; padding: 6px; gap: 6px; box-shadow: 0 20px 60px -20px rgba(165,12,38,.45); }
.address .addr { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 6px 12px; min-width: 0; }
.address .addr small { color: var(--dim); font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.address .addr code { font-size: 19px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero .meta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

.status-card { background: linear-gradient(180deg, var(--panel), var(--bg-2)); border: 1px solid var(--line-2); border-radius: 20px; padding: 24px; box-shadow: 0 30px 80px -30px rgba(0,0,0,.8); }
.status-card .top { display: flex; gap: 14px; align-items: center; }
.server-icon { width: 64px; height: 64px; border-radius: 12px; image-rendering: pixelated; background: var(--panel-2); border: 1px solid var(--line-2); object-fit: cover; flex: none; }
.status-card h3 { margin: 0; font-family: var(--display); font-size: 20px; }
.status-card .motd { margin-top: 18px; padding: 14px; background: #080707; border-radius: 10px; border: 1px solid var(--line); min-height: 52px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.stat { background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.stat small { display: block; color: var(--dim); font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; }
.stat b { display: block; font-family: var(--display); font-size: 22px; margin-top: 2px; }
.player-strip { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; min-height: 32px; align-items: center; }
.player-strip .empty { color: var(--dim); font-size: 14px; }
.player-chip { display: inline-flex; align-items: center; gap: 8px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; padding: 3px 10px 3px 3px; font-size: 13px; font-weight: 500; }
.player-chip img { width: 24px; height: 24px; border-radius: 5px; image-rendering: pixelated; }

.steps { max-width: 1240px; margin: 0 auto; width: 100%; padding: 0 clamp(20px, 5vw, 56px) 70px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.step { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.step .n { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: #2a1015; color: var(--crimson-hi); font-family: var(--display); font-weight: 800; margin-bottom: 12px; border: 1px solid #4a1820; }
.step h4 { margin: 0 0 6px; font-family: var(--display); font-size: 18px; }
.step p { margin: 0; color: var(--muted); font-size: 14px; }
.foot { text-align: center; color: var(--dim); font-size: 13px; padding: 0 20px 30px; }
.foot a { color: var(--muted); }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding-top: 10px; }
  .steps { grid-template-columns: 1fr; }
}

/* ============================================================ login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(700px 400px at 50% 0%, rgba(165,12,38,.28), transparent 70%), var(--bg); }
.login-card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line-2); border-radius: 20px; padding: 32px 28px 28px; box-shadow: 0 30px 80px -30px rgba(0,0,0,.8); }
.login-card .brand { justify-content: center; margin-bottom: 22px; }
.login-card h1 { font-family: var(--display); font-size: 26px; text-align: center; margin: 0 0 6px; letter-spacing: -.02em; }
.login-card p { text-align: center; color: var(--muted); margin: 0 0 22px; font-size: 14px; }
.login-card form { display: grid; gap: 14px; }
.login-card .err { color: #ff9b9b; font-size: 13px; min-height: 18px; text-align: center; }
.login-card .back { display: block; text-align: center; margin-top: 18px; font-size: 13px; color: var(--muted); }
.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* ============================================================ dashboard */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { background: var(--bg-2); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh; }
.sidebar .brand { padding: 4px 8px 20px; font-size: 16px; }
.sidebar .brand img { height: 30px; }
.navlink { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--muted); font-weight: 500; cursor: pointer; border: 0; background: none; width: 100%; text-align: left; }
.navlink svg { width: 18px; height: 18px; flex: none; }
.navlink:hover { background: var(--panel); color: var(--text); text-decoration: none; }
.navlink.active { background: var(--panel-2); color: var(--text); box-shadow: inset 2px 0 0 var(--crimson-hi); }
.sidebar .spacer { flex: 1; }
.sidebar .server-mini { padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); font-size: 13px; display: grid; gap: 4px; }
.sidebar .server-mini .row { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.sidebar .server-mini code { color: var(--muted); font-size: 12px; }

.main { min-width: 0; padding: 26px clamp(18px, 3vw, 40px) 60px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-family: var(--display); font-size: 30px; letter-spacing: -.02em; margin: 0; }
.page-head p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.grid { display: grid; gap: 16px; }
.grid.k4 { grid-template-columns: repeat(4, 1fr); }
.grid.k2 { grid-template-columns: 1fr 1fr; }
.grid.k32 { grid-template-columns: 1.6fr 1fr; }
@media (max-width: 1200px) { .grid.k4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 900px) { .grid.k2, .grid.k32 { grid-template-columns: 1fr; } }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; min-width: 0; }
.card > h2 { font-family: var(--display); font-size: 17px; margin: 0 0 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card > h2 .sub { font-family: var(--body); font-size: 13px; font-weight: 500; color: var(--muted); }
.kpi small { display: block; color: var(--dim); font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.kpi b { display: block; font-family: var(--display); font-size: 30px; line-height: 1.2; margin-top: 6px; letter-spacing: -.01em; }
.kpi .hint { color: var(--muted); font-size: 13px; margin-top: 2px; }
.bar { height: 6px; background: var(--bg-2); border-radius: 99px; overflow: hidden; margin-top: 10px; }
.bar > i { display: block; height: 100%; background: var(--gold); border-radius: 99px; width: 0; transition: width .4s; }
.bar > i.hot { background: var(--red); }
.bar > i.ok { background: var(--green); }

.list { display: flex; flex-direction: column; }
.list .row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); min-width: 0; }
.list .row:first-child { border-top: 0; }
.list .row .grow { flex: 1; min-width: 0; }
.list .row .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .row .sub { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .row .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.empty-state { color: var(--dim); font-size: 14px; padding: 14px 0; text-align: center; }

.inline-form { display: flex; gap: 8px; }
.inline-form .input { flex: 1; }

/* console */
.console { background: #070606; border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; height: calc(100vh - 170px); min-height: 380px; overflow: hidden; }
.console .out { flex: 1; overflow-y: auto; padding: 14px 16px; font: 12.5px/1.6 var(--mono); white-space: pre-wrap; word-break: break-word; color: #cfc8c3; }
.console .out .l-warn { color: #fcd34d; }
.console .out .l-error { color: #fca5a5; }
.console .out .l-chat { color: #e9e4df; }
.console .out .l-join { color: #86efac; }
.console .out .l-portal { color: var(--gold-hi); }
.console .out .l-resp { color: #93c5fd; }
.console .out .l-sys { color: var(--dim); font-style: italic; }
.console form { display: flex; gap: 8px; border-top: 1px solid var(--line); padding: 10px; background: var(--bg-2); }
.console form .prompt { display: grid; place-items: center; color: var(--gold-hi); font: 600 14px var(--mono); padding: 0 4px 0 6px; }
.console form .input { font-family: var(--mono); font-size: 13px; background: transparent; border-color: transparent; }
.console form .input:focus { box-shadow: none; border-color: transparent; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }

/* settings */
.settings-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 18px; }
@media (max-width: 900px) { .settings-grid { grid-template-columns: 1fr; } }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 14px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; }
.setting.changed { border-color: var(--gold); }
.setting .lbl { min-width: 0; }
.setting .lbl b { display: block; font-weight: 600; font-size: 14px; }
.setting .lbl small { display: block; color: var(--dim); font-size: 12px; font-family: var(--mono); }
.setting .ctl { flex: none; width: 200px; display: flex; justify-content: flex-end; }
.setting .ctl .input { height: 36px; }
.setting.wide { grid-column: 1 / -1; }
.setting.wide .ctl { width: min(520px, 60%); }
.savebar { position: sticky; bottom: 16px; margin-top: 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--panel-2); border: 1px solid var(--gold); border-radius: 12px; padding: 12px 16px; box-shadow: 0 10px 30px rgba(0,0,0,.5); }

/* table */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; color: var(--dim); font-weight: 600; font-size: 12px; letter-spacing: .05em; text-transform: uppercase; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px; border-bottom: 1px solid var(--line); }
.table tr:last-child td { border-bottom: 0; }
.table td.r, .table th.r { text-align: right; }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 90; padding: 20px; animation: fade .15s; }
.modal { width: 100%; max-width: 420px; background: var(--panel); border: 1px solid var(--line-2); border-radius: 16px; padding: 22px; box-shadow: 0 30px 80px rgba(0,0,0,.6); }
.modal h3 { margin: 0 0 8px; font-family: var(--display); font-size: 20px; }
.modal p { margin: 0 0 16px; color: var(--muted); font-size: 14px; }
.modal .btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
@keyframes fade { from { opacity: 0; } }

.menu { position: absolute; z-index: 80; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 5px; min-width: 190px; box-shadow: 0 16px 40px rgba(0,0,0,.55); }
.menu button { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 7px; border: 0; background: none; cursor: pointer; font-size: 14px; }
.menu button:hover { background: var(--line); }
.menu button.danger { color: #ffb4b4; }
.menu hr { border: 0; border-top: 1px solid var(--line-2); margin: 5px 0; }

.mobile-top { display: none; }
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; overflow-x: auto; padding: 10px; gap: 4px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar .brand, .sidebar .spacer, .sidebar .server-mini { display: none; }
  .navlink { width: auto; white-space: nowrap; }
  .navlink.active { box-shadow: inset 0 -2px 0 var(--crimson-hi); }
  .console { height: calc(100vh - 230px); }
}
