:root {
  --bg: #0e1116;
  --side: #12161d;
  --card: #171c24;
  --card-2: #1d232d;
  --line: #262e3a;
  --text: #e7ecf3;
  --muted: #8e99a8;
  --accent: #2f81f7;
  --accent-2: #1f6feb;
  --ok: #3fb950;
  --warn: #d29922;
  --bad: #f85149;
  --radius: 10px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, textarea.code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.45rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; }
p { margin: .3rem 0 .8rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* layout */
.app { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side { background: var(--side); border-right: 1px solid var(--line); padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 16px; font-weight: 700; font-size: 1.05rem; }
.brand .dino { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, #f0883e, #db6d28); display: grid; place-items: center; color: #fff; font-size: .95rem; }
.side .server { margin: 0 6px 14px; padding: 10px 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.side .server .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { list-style: none; margin: 0; padding: 0; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px; color: var(--muted); font-weight: 500; }
.nav a:hover { background: var(--card); color: var(--text); text-decoration: none; }
.nav a.on { background: var(--card-2); color: var(--text); box-shadow: inset 3px 0 0 var(--accent); }
.nav .sub a { padding: 5px 12px 5px 40px; font-size: .9rem; font-weight: 400; }
.nav .sep { height: 1px; background: var(--line); margin: 10px 8px; }
.nav svg { width: 18px; height: 18px; flex: none; }
.nav form { margin: 0; }
.nav button.link { all: unset; display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px; color: var(--muted); cursor: pointer; width: calc(100% - 24px); font-weight: 500; }
.nav button.link:hover { background: var(--card); color: var(--text); }
.main { padding: 22px 28px 60px; max-width: 1180px; width: 100%; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.topbar .title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* pills */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .82rem; font-weight: 600; background: var(--card-2); color: var(--muted); border: 1px solid var(--line); }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill.online { color: var(--ok); }
.pill.starting, .pill.installing { color: var(--warn); }
.pill.crashed { color: var(--bad); }
.pill.stopped, .pill.not_installed { color: var(--muted); }
.tag { display: inline-block; padding: 1px 8px; border-radius: 6px; font-size: .78rem; background: var(--card-2); border: 1px solid var(--line); color: var(--muted); }
.tag.admin { color: #a5b4fc; } .tag.owner { color: #f0883e; } .tag.ok { color: var(--ok); } .tag.bad { color: var(--bad); }

/* cards and grids */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; }
.card > h2:first-child, .card > h3:first-child { margin-bottom: .8rem; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat { background: var(--card-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.stat .label { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 1.25rem; font-weight: 650; margin-top: 2px; }
.stat .value.sm { font-size: 1rem; }
.statusline { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.statusline .big { font-size: 1.6rem; font-weight: 700; }
progress { width: 100%; height: 10px; appearance: none; border: none; border-radius: 6px; background: var(--card-2); overflow: hidden; margin: 8px 0 4px; }
progress::-webkit-progress-bar { background: var(--card-2); }
progress::-webkit-progress-value { background: var(--accent); }
progress::-moz-progress-bar { background: var(--accent); }
.hidden { display: none !important; }

/* alerts */
.alert { padding: 11px 14px; border-radius: var(--radius); margin-bottom: 14px; border: 1px solid; }
.alert.ok { background: #12261a; border-color: #23573a; color: #9be9a8; }
.alert.err { background: #2a1416; border-color: #6e2a2e; color: #ffb4ae; }
.alert.info { background: #121d2f; border-color: #213a63; color: #b6d3ff; }
.alert.warn { background: #2a2112; border-color: #6a4e1a; color: #f2cc8f; }
.alert a { color: inherit; text-decoration: underline; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--card-2); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: #3b4656; text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }
.btn.primary:hover { background: var(--accent); }
.btn.good { background: #238636; border-color: #238636; color: #fff; }
.btn.danger { color: #ffb4ae; border-color: #6e2a2e; }
.btn.danger:hover { background: #2a1416; }
.btn.small { padding: 4px 10px; font-size: .85rem; }
.btn.ghost { background: transparent; }

/* forms */
form.inline { display: inline; }
label.field { display: block; margin-bottom: 16px; }
.field .name { display: block; font-weight: 600; margin-bottom: 4px; }
.field .help { display: block; color: var(--muted); font-size: .86rem; margin-top: 4px; }
input[type=text], input[type=password], input[type=number], input[type=time], select, textarea {
  width: 100%; padding: 9px 11px; border-radius: 8px; border: 1px solid var(--line); background: #0b0e13; color: var(--text); font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
textarea.code { min-height: 520px; font-size: .86rem; line-height: 1.45; white-space: pre; tab-size: 4; }
.row { display: flex; gap: 10px; align-items: center; }
.row > * { flex: 1; }
.row > .btn, .row > .shrink { flex: none; }
.setting { display: grid; grid-template-columns: minmax(0, 1fr) 210px; gap: 18px; align-items: center; padding: 13px 0; border-bottom: 1px solid var(--line); }
.setting:last-child { border-bottom: none; }
.setting .name { font-weight: 600; }
.setting .key { color: var(--muted); font-size: .76rem; font-family: ui-monospace, Menlo, Consolas, monospace; }
.setting .desc { color: var(--muted); font-size: .88rem; margin-top: 2px; }
.setting .control { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.setting.changed .name::after { content: "changed"; margin-left: 8px; font-size: .7rem; font-weight: 600; color: var(--accent); border: 1px solid #213a63; padding: 0 6px; border-radius: 5px; vertical-align: middle; }
.reset { color: var(--muted); font-size: .8rem; background: none; border: none; cursor: pointer; padding: 0; text-decoration: underline; }
.toggle { position: relative; width: 44px; height: 24px; flex: none; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle span { position: absolute; inset: 0; background: #2d3540; border-radius: 999px; transition: .15s; cursor: pointer; }
.toggle span::before { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .15s; }
.toggle input:checked + span { background: var(--accent-2); }
.toggle input:checked + span::before { transform: translateX(20px); }
.toggle input:focus-visible + span { outline: 2px solid var(--accent); }
.savebar { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 30%); padding: 18px 0 6px; display: flex; gap: 10px; justify-content: flex-end; }

/* maps picker */
.maps { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.mapopt { position: relative; }
.mapopt input { position: absolute; opacity: 0; }
.mapopt span { display: block; padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--card-2); cursor: pointer; min-height: 64px; }
.mapopt span b { display: block; }
.mapopt span small { color: var(--muted); }
.mapopt input:checked + span { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; background: #132034; }
.mapopt input:focus-visible + span { outline: 2px solid var(--accent); }

/* tables and lists */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
td .actions { justify-content: flex-end; }
.empty { color: var(--muted); padding: 14px 0; }
ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain li { padding: 7px 0; border-bottom: 1px solid var(--line); }
ul.plain li:last-child { border-bottom: none; }
.activity li { display: flex; justify-content: space-between; gap: 12px; font-size: .9rem; }

/* join box */
.joinbox { display: flex; align-items: center; gap: 10px; background: #0b0e13; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.05rem; }
.joinbox code { flex: 1; overflow-x: auto; white-space: nowrap; }
ol.steps { margin: 0; padding-left: 1.2rem; }
ol.steps li { margin-bottom: 8px; }

/* console */
pre.log { background: #0b0e13; border: 1px solid var(--line); border-radius: 8px; padding: 12px; height: 460px; overflow: auto; font-size: .8rem; line-height: 1.4; white-space: pre-wrap; word-break: break-word; margin: 0; }
.tabs { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.tabs a, .tabs button { padding: 6px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--card-2); color: var(--muted); font: inherit; cursor: pointer; }
.tabs .on { color: var(--text); border-color: var(--accent); }
.quick { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

/* login */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth .card { width: 100%; max-width: 400px; }
.auth .brand { justify-content: center; padding-bottom: 8px; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; padding: 12px; }
  .nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .nav .sub, .nav .sep { display: none; }
  .side .server { display: none; }
  .main { padding: 16px; }
  .grid.two, .grid.three, .grid.four { grid-template-columns: 1fr 1fr; }
  .setting { grid-template-columns: 1fr; gap: 8px; }
  .setting .control { justify-content: flex-start; }
}
@media (max-width: 520px) {
  .grid.two, .grid.three, .grid.four { grid-template-columns: 1fr; }
}

/* stats-per-level grid */
.levelgrid { overflow-x: auto; }
.levelgrid table { min-width: 720px; }
.levelgrid th small { display: block; font-weight: 400; text-transform: none; letter-spacing: 0; }
.levelgrid input { width: 100%; min-width: 80px; text-align: right; }
.levelgrid input:not(:placeholder-shown) { border-color: var(--accent); }
