/* MEGA website - one stylesheet for every page.
   Plex for text, Plex Mono for every number (so live figures do not shift as they change), a pixel
   face for the wordmark only. The aqua-to-purple gradient is MEGA's brand from the game: it appears
   in the logo strip and the charts, and nowhere as decoration. */
:root {
  --bg: #0d0e11;
  --bg-2: #121318;
  --card: #15171c;
  --card-2: #1b1e25;
  --line: #24272f;
  --line-2: #30343e;
  --text: #e6e7ea;
  --muted: #9097a3;
  --dim: #646a76;
  --aqua: #00d4ff;
  --purple: #8b5cf6;
  --good: #4ade80;
  --warn: #fbbf24;
  --bad: #f87171;
  --brand: linear-gradient(90deg, #00d4ff, #7b2ff7);
  --radius: 6px;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--aqua); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img { display: block; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; font-weight: 700; }
h1 { font-size: clamp(26px, 3.4vw, 34px); letter-spacing: -.015em; }
h2 { font-size: 19px; }
h3 { font: 600 11px/1.4 var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .12em; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.grad-text { color: var(--text); }        /* kept for old markup: gradients belong to the brand strip */
code, .num, .kv dd, td.val, td.rank, .stat .v { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- layout */
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
main.wrap { padding-top: 30px; padding-bottom: 64px; }
.grid { display: grid; gap: 12px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spread { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.section { margin-top: 40px; }
.section > .spread { margin-bottom: 10px; }

/* ---------------------------------------------------------------- header */
header.site { position: sticky; top: 0; z-index: 10; background: rgba(13, 14, 17, .94);
  border-bottom: 1px solid var(--line); }
header.site::before { content: ""; display: block; height: 3px; background: var(--brand); }
header.site .wrap { display: flex; align-items: center; gap: 20px; height: 58px; }
.logo { font: 400 22px/1 "Silkscreen", var(--mono); letter-spacing: .02em; }
/* The wordmark is the one place the brand gradient is text, as it is in game. */
.logo span, .wordmark { background: var(--brand); -webkit-background-clip: text; background-clip: text;
  color: transparent; -webkit-text-fill-color: transparent; }
.logo:hover { text-decoration: none; filter: brightness(1.2); }
.wordmark { display: inline-block; font: 400 clamp(44px, 7vw, 72px)/1 "Silkscreen", var(--mono); letter-spacing: .02em;
  margin: 0 0 .3em; }
nav.main { display: flex; gap: 2px; }
nav.main a { color: var(--muted); padding: 6px 10px; border-radius: 4px; font-weight: 500; }
nav.main a:hover { color: var(--text); background: var(--card); text-decoration: none; }
nav.main a.on { color: var(--text); box-shadow: inset 0 -2px 0 var(--aqua); border-radius: 0; }
.search { position: relative; margin-left: auto; }
.search input { width: 210px; background: var(--bg-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 4px; padding: 7px 10px; font: inherit; font-size: 14px; }
.search input:focus { outline: none; border-color: var(--aqua); }
.search .results { position: absolute; top: 40px; right: 0; width: 260px; background: var(--card-2);
  border: 1px solid var(--line-2); border-radius: var(--radius); overflow: hidden; display: none; }
.search .results.open { display: block; }
.search .results a { display: flex; align-items: center; gap: 10px; padding: 8px 12px; color: var(--text); }
.search .results a:hover, .search .results a.sel { background: var(--card); text-decoration: none; }
.search .results img { image-rendering: pixelated; }
.account img { width: 32px; height: 32px; border-radius: 4px; image-rendering: pixelated; }
.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid transparent; cursor: pointer; font: inherit;
  font-weight: 600; font-size: 14px; padding: 8px 14px; border-radius: 4px; background: var(--aqua); color: #04141a; }
.btn:hover { text-decoration: none; background: #33ddff; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line-2); }
.btn.ghost:hover { border-color: var(--muted); background: transparent; }
.btn:disabled { opacity: .5; cursor: default; }
@media (max-width: 720px) {
  header.site .wrap { gap: 10px; }
  nav.main a { padding: 6px 6px; }
  .search input { width: 120px; }
}
@media (max-width: 600px) {
  .wrap { padding: 0 16px; }
  header.site .wrap { flex-wrap: wrap; height: auto; padding-top: 10px; padding-bottom: 10px; row-gap: 8px; }
  nav.main a[href="/"] { display: none; }   /* the wordmark is the way home */
  .account { margin-left: auto; }
  .search { order: 3; width: 100%; margin-left: 0; }
  .search input { width: 100%; }
  .search .results { width: 100%; }
  .players .bar { display: none; }
}

/* ---------------------------------------------------------------- cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
a.card { display: block; color: inherit; }
a.card:hover { text-decoration: none; border-color: var(--line-2); background: var(--card-2); }
.stat .v { font-size: 24px; font-weight: 600; letter-spacing: -.02em; }
.stat .l { color: var(--muted); font-size: 13px; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; padding: 2px 8px;
  border-radius: 3px; background: var(--card-2); color: var(--muted); border: 1px solid var(--line); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); display: inline-block; flex: none; }
.dot.on { background: var(--good); }
.dot.off { background: var(--bad); }
.bar { height: 4px; border-radius: 2px; background: var(--card-2); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--aqua); transition: width .6s ease; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 5px 16px; font-size: 14px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; }

/* ---------------------------------------------------------------- server list (status) */
.servers { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--card); }
.server-row { display: grid; grid-template-columns: 18px minmax(110px, 1.2fr) 1.4fr 70px 80px 90px 150px; align-items: center;
  gap: 14px; padding: 12px 16px; border-top: 1px solid var(--line); color: var(--text); }
.server-row:first-child { border-top: 0; }
a.server-row:hover { background: var(--card-2); text-decoration: none; }
.server-row .name { font-weight: 600; }
.server-row .num { text-align: right; font-size: 14px; }
.server-row .cap { color: var(--dim); font-size: 11px; font-family: var(--mono); text-transform: uppercase; letter-spacing: .08em; }
.server-head, .server-head .num { color: var(--dim); font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: .1em; background: var(--bg-2); }
a.server-row.off .name, .server-row.off .num { color: var(--muted); }
.players { display: flex; align-items: center; gap: 10px; min-width: 0; }
.players .num { text-align: left; min-width: 72px; }
.players .bar { flex: 1; }
.servers.compact .server-row { grid-template-columns: 18px 1fr auto; padding: 9px 14px; gap: 10px; }
.t-good { color: var(--good); } .t-warn { color: var(--warn); } .t-bad { color: var(--bad); }
@media (max-width: 820px) {
  .server-row { grid-template-columns: 18px 1fr 1fr 56px; }
  .server-row .hide-sm { display: none; }
}

/* a strip of figures: one box split by hairlines, rather than a row of identical cards */
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin: 10px 0 26px; }
.figures > div { background: var(--card); padding: 13px 16px; }
.figures .v { font: 600 22px/1.3 var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.figures .l { color: var(--muted); font-size: 13px; }

/* home */
.intro { padding: 10px 0 6px; max-width: 660px; }
.intro p { color: var(--muted); margin: 0 0 18px; }
.intro .now { margin-top: 14px; color: var(--muted); font-size: 14px; }
.intro .now b { color: var(--text); font-family: var(--mono); font-weight: 600; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 32px; align-items: start; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- tables */
table.board { width: 100%; border-collapse: collapse; }
table.board td { padding: 9px 12px; border-top: 1px solid var(--line); vertical-align: middle; }
table.board tr:first-child td { border-top: 0; }
table.board td.rank { width: 52px; color: var(--dim); }
table.board td.val { text-align: right; font-weight: 500; }
table.board tr.top1 td.rank { color: #e8c15a; }
table.board tr.top2 td.rank { color: #c9ced8; }
table.board tr.top3 td.rank { color: #c98e5b; }
.who { display: flex; align-items: center; gap: 10px; color: var(--text); }
.who img { width: 26px; height: 26px; border-radius: 3px; image-rendering: pixelated; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips a { padding: 4px 10px; border-radius: 3px; border: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.chips a:hover { color: var(--text); border-color: var(--line-2); text-decoration: none; }
.chips a.on { color: var(--text); border-color: var(--aqua); }

/* ---------------------------------------------------------------- profile */
.banner { height: 130px; border-radius: var(--radius) var(--radius) 0 0; background: var(--card-2); }
.profile-head { margin-top: -46px; padding: 0 20px 16px; display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; }
.profile-head img.face { width: 96px; height: 96px; border-radius: 6px; border: 3px solid var(--card); image-rendering: pixelated; background: var(--card-2); }
.mcname { font-weight: 700; }
.links a { margin-right: 14px; }
.empty { text-align: center; color: var(--muted); padding: 36px 10px; }

/* ---------------------------------------------------------------- forms */
label.field { display: block; margin: 14px 0 6px; font-weight: 600; font-size: 14px; }
.hint { color: var(--dim); font-size: 13px; margin-top: 4px; }
input.text, textarea { width: 100%; background: var(--bg-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 4px; padding: 9px 11px; font: inherit; }
textarea { min-height: 100px; resize: vertical; }
input.text:focus, textarea:focus { outline: none; border-color: var(--aqua); }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatches button { width: 34px; height: 34px; border-radius: 4px; border: 2px solid transparent; cursor: pointer; }
.swatches button.wide { width: 68px; }
.swatches button.on { border-color: var(--text); }
.error { color: var(--bad); font-size: 13px; margin-top: 4px; }
.notice { padding: 11px 14px; border-radius: 4px; background: var(--card); border: 1px solid var(--line-2); border-left: 3px solid var(--aqua); }
.notice.bad { border-left-color: var(--bad); }
.code-input { font: 600 32px var(--mono); letter-spacing: .35em; text-align: center; }

/* ---------------------------------------------------------------- the address block (home) */
.address { display: flex; align-items: stretch; border: 1px solid var(--line-2); border-radius: 4px; overflow: hidden; width: fit-content; max-width: 100%; }
.address code { padding: 10px 14px; font-size: 17px; background: var(--bg-2); }
.address button { border: 0; border-left: 1px solid var(--line-2); background: var(--card-2); color: var(--text); font: inherit; font-size: 13px; padding: 0 14px; cursor: pointer; }
.address button:hover { background: var(--line); }

/* ---------------------------------------------------------------- charts */
.chart { width: 100%; height: 160px; display: block; }
.chart.small { height: 34px; }
.chart path.area { fill: url(#megaFill); opacity: .25; }
.chart path.line { fill: none; stroke: url(#megaLine); stroke-width: 1.6; }
.chart text { fill: var(--dim); font: 10px var(--mono); }
.toggle a { padding: 3px 9px; border-radius: 3px; color: var(--muted); font: 500 12px var(--mono); }
.toggle a.on { background: var(--card-2); color: var(--text); }
.live { font: 500 11px var(--mono); color: var(--dim); letter-spacing: .06em; text-transform: uppercase; }
.live::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--good); margin-right: 6px; vertical-align: 1px; }
.live.stale::before { background: var(--warn); }

footer.site { border-top: 1px solid var(--line); padding: 20px 0 40px; color: var(--dim); font-size: 13px; }
.skeleton { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); min-height: 80px; }
