/* osu!somtum status: dark page, osu!-pink accent. Colours are tokens here; app.js reads the
   series colours from these same custom properties so the charts and the keys always match. */
:root {
  color-scheme: dark;
  --bg: #131118;
  --surface: #1b1821;
  --surface-2: #231f2b;
  --border: #2f2a39;
  --grid: rgba(255, 255, 255, 0.06);
  --text: #f2eff6;
  --text-2: #bdb6c9;
  --muted: #8a8398;
  --accent: #ff66aa;

  /* series (validated together on --surface: CVD and normal-vision separation, 3:1 contrast) */
  --series-stable: #e2559a;
  --series-lazer: #3f8fe8;
  --series-irc: #c98500;
  --series-total: #c9c4d4;

  /* status: reserved for up/down, always shown with a word or number */
  --good: #3fb950;
  --warn: #e3b341;
  --bad: #f85149;
  --none: #3a3445;

  --radius: 12px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Thai", sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h2 { font-size: 17px; margin: 0; font-weight: 650; }
h3 { font-size: 13px; margin: 18px 0 8px; font-weight: 600; color: var(--text-2); }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* header */
.top {
  position: sticky; top: 0; z-index: 5;
  background: rgba(19, 17, 24, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.top-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 60px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 18px; }
.brand:hover { text-decoration: none; }
.brand b { color: var(--accent); font-weight: 700; }
.brand-dot {
  width: 22px; height: 22px; border-radius: 50%;
  border: 4px solid var(--accent); background: transparent;
}

.range { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 3px; }
.range button {
  font: inherit; font-size: 13px; color: var(--text-2);
  background: transparent; border: 0; border-radius: 999px;
  padding: 6px 12px; cursor: pointer; min-height: 32px;
}
.range button:hover { color: var(--text); }
.range button[aria-pressed="true"] { background: var(--accent); color: #1b0f16; font-weight: 600; }
.range button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

main.wrap { padding-top: 20px; padding-bottom: 8px; }

/* overall banner */
.banner {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  border-left: 4px solid var(--none); margin-bottom: 16px;
}
.banner-icon { width: 14px; height: 14px; border-radius: 50%; background: var(--none); flex: none; }
.banner-title { font-size: 17px; font-weight: 650; }
.banner-sub { font-size: 13px; color: var(--muted); }
.banner-ok { border-left-color: var(--good); }
.banner-ok .banner-icon { background: var(--good); box-shadow: 0 0 0 4px rgba(63, 185, 80, 0.18); }
.banner-warn { border-left-color: var(--warn); }
.banner-warn .banner-icon { background: var(--warn); }
.banner-bad { border-left-color: var(--bad); }
.banner-bad .banner-icon { background: var(--bad); }

/* cards */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; margin-bottom: 16px; min-width: 0;
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-2 > .card { margin-bottom: 0; }
main > .grid-2 { margin-bottom: 16px; }
.grid-2.tight { gap: 20px; }

/* services */
.svc-group + .svc-group { margin-top: 14px; }
.svc-group-name { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 0 0 4px; }
.svc {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 14px;
  padding: 9px 0; border-top: 1px solid var(--border);
}
.svc-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.svc-name span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.svc-uptime { font-variant-numeric: tabular-nums; color: var(--text-2); font-size: 13px; min-width: 64px; text-align: right; }
.bars { display: flex; gap: 2px; height: 22px; align-items: stretch; }
.bars i { width: 5px; border-radius: 2px; background: var(--none); }
.bars i.b-good { background: var(--good); }
.bars i.b-warn { background: var(--warn); }
.bars i.b-bad { background: var(--bad); }

.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--none); flex: none; display: inline-block; }
.dot.up { background: var(--good); }
.dot.down { background: var(--bad); }
.dot.warn { background: var(--warn); }

/* stats */
.stats { display: grid; gap: 10px; margin-bottom: 14px; }
.stats-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stats-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stats-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat {
  background: var(--surface-2); border-radius: 10px; padding: 10px 12px;
  display: flex; flex-direction: column; min-width: 0;
}
.stat-label { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-value { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.25; overflow-wrap: anywhere; }
.stat-total .stat-value { color: var(--accent); }
.stat-sub { font-size: 12px; color: var(--text-2); }
.na { color: var(--muted); font-weight: 500; }

.key { width: 10px; height: 3px; border-radius: 2px; display: inline-block; flex: none; }
.key-stable, .key-out, .key-mem { background: var(--series-stable); }
.key-lazer, .key-in, .key-cpu { background: var(--series-lazer); }
.key-irc { background: var(--series-irc); }
.key-total { background: repeating-linear-gradient(90deg, var(--series-total) 0 3px, transparent 3px 5px); }

.meter { height: 4px; background: var(--border); border-radius: 2px; margin-top: 8px; overflow: hidden; }
.meter span { display: block; height: 100%; width: 0; background: var(--text-2); border-radius: 2px; transition: width 0.4s; }
.meter span.hot { background: var(--warn); }
.meter span.full { background: var(--bad); }

/* charts */
.chart { position: relative; height: 220px; }

/* tables */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 4px 0; border-bottom: 1px solid var(--border); }
.table th.num { text-align: right; }
.table td { padding: 7px 0; border-bottom: 1px solid var(--border); }
.table tr:last-child td { border-bottom: 0; }

/* databases */
.dbs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.db { background: var(--surface-2); border-radius: 10px; padding: 12px 14px; min-width: 0; }
.db-head { display: flex; align-items: center; gap: 8px; }
.db-head h3 { margin: 0; color: var(--text); font-size: 15px; display: flex; align-items: center; gap: 6px; }
.db dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 10px 0 0; font-size: 14px; }
.db dt { color: var(--muted); }
.db dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.es-green { color: var(--good); }
.es-yellow { color: var(--warn); }
.es-red { color: var(--bad); }

.foot { display: flex; flex-wrap: wrap; gap: 6px 18px; padding-top: 4px; padding-bottom: 32px; }

/* phones */
@media (max-width: 860px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .dbs { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .card { padding: 14px; }
  .stats-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-3 { grid-template-columns: minmax(0, 1fr); }
  .stat-value { font-size: 22px; }
  .chart { height: 190px; }
  .svc { grid-template-columns: minmax(0, 1fr) auto; }
  .svc .bars { grid-column: 1 / -1; grid-row: 2; }
  .bars i { flex: 1; width: auto; }
  .brand { font-size: 16px; }
  .range button { padding: 6px 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .meter span { transition: none; }
}
