:root {
  color-scheme: dark;
  --bg: #050605;
  --panel: #090d0a;
  --line: #2b3b31;
  --line-hot: #d8a84f;
  --text: #e9e2cc;
  --muted: #8c988b;
  --ok: #91d6a8;
  --warn: #d8a84f;
  --bad: #e36a55;
  --mono: "Consolas", "SFMono-Regular", "Cascadia Mono", "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--bg); }

body {
  min-height: 100vh;
  margin: 0;
  display: grid;
  place-items: center;
  padding: 24px 12px;
  color: var(--text);
  background:
    linear-gradient(rgba(145, 214, 168, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(145, 214, 168, 0.018) 1px, transparent 1px),
    var(--bg);
  background-size: 24px 24px;
  font-family: var(--mono);
}

button, input { font: inherit; }
button, a { color: inherit; }

.portal {
  width: min(620px, 100%);
  border: 1px solid var(--line);
  background: rgba(9, 13, 10, 0.96);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}

.header, .footer, .metric-row, .speedtest, .console { border-top: 1px solid var(--line); }

.header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  border-top: 0;
  padding: 16px;
}

h1 {
  margin: 0;
  color: var(--ok);
  font-size: 1rem;
  font-weight: 800;
  text-transform: lowercase;
}

#clockTime, #lastUpdated { color: var(--muted); font-size: 0.75rem; }

.link-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
  border-top: 1px solid var(--line);
}

.tile {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 14px;
  background: var(--panel);
  text-decoration: none;
  text-transform: uppercase;
  font-size: 0.82rem;
  font-weight: 800;
}

.tile.wide { grid-column: span 3; }

.tile:hover, .tile:focus-visible, button:hover, button:focus-visible {
  outline: 1px solid var(--line-hot);
  outline-offset: -1px;
  color: var(--line-hot);
}

.tile i {
  width: 9px;
  height: 9px;
  border: 1px solid var(--muted);
  background: transparent;
}

.tile[data-status="online"] i { border-color: var(--ok); background: var(--ok); }
.tile[data-status="degraded"] i, .tile[data-status="unknown"] i { border-color: var(--warn); background: transparent; }
.tile[data-status="offline"] i { border-color: var(--bad); background: var(--bad); }

.metric-row { display: grid; grid-template-columns: repeat(3, 1fr); }
.metric-row div { min-height: 72px; padding: 12px 14px; border-right: 1px solid var(--line); }
.metric-row div:last-child { border-right: 0; }

.metric-row span, .speed-values small {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
}

.metric-row strong {
  display: block;
  margin-top: 8px;
  color: var(--ok);
  font-size: 1.35rem;
}

.speedtest { padding: 14px; }

#speedStart, #consoleToggle {
  min-height: 38px;
  border: 1px solid var(--line);
  background: #060806;
  color: var(--text);
  cursor: pointer;
  text-transform: uppercase;
  font-weight: 800;
}

#speedStart { width: 100%; }

.speed-values {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  margin-top: 12px;
  background: var(--line);
}

.speed-values span { min-height: 58px; padding: 10px; background: var(--panel); }
.speed-values b { display: block; color: var(--ok); font-size: 1rem; font-weight: 800; }

progress { width: 100%; height: 9px; margin-top: 12px; accent-color: var(--ok); }

#speedStatus {
  min-height: 1.2em;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: lowercase;
}

.console { padding: 12px 14px 14px; }

.console-output {
  max-height: 220px;
  overflow: auto;
  margin-bottom: 10px;
  font-size: 0.78rem;
  line-height: 1.45;
}

.console-output p { margin: 0 0 6px; overflow-wrap: anywhere; }
.console-output .input { color: var(--line-hot); }
.console-output .error { color: var(--bad); }

.command-form {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  padding: 8px 10px;
}

.command-form label { color: var(--ok); }
.command-form input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); }

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
}

#consoleToggle { min-width: 92px; min-height: 32px; font-size: 0.72rem; }

@media (max-width: 560px) {
  body { place-items: start center; padding-top: 12px; }
  .link-grid, .metric-row, .speed-values { grid-template-columns: 1fr; }
  .tile.wide { grid-column: auto; }
  .metric-row div { border-right: 0; border-bottom: 1px solid var(--line); }
}
