/*
  Palette lifted from drive.ridewolf.com's dark theme so the two surfaces read
  as one product. Coral is the brand accent and stays reserved for chrome and
  emphasis — never for state, because a status board that spends its accent
  colour on decoration has nothing left to say when something breaks.
*/
:root {
  --background: #0a0a0a;
  --foreground: #ffffff;
  --card: #171717;
  --muted: #1f1f1f;
  --muted-foreground: #ffffff8c;
  --ink-1: #ffffffcc;
  --ink-2: #ffffffb3;
  --ink-3: #ffffff9e;
  --primary: #ff6b57;
  --success: #34d399;
  --warning: #fbbf24;
  --destructive: #f87171;
  --info: #60a5fa;
  --border: #ffffff17;
  --radius: 1.375rem;
  --curve: cubic-bezier(0.33, 0.03, 0.2, 1);
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  background: var(--background);
  color: var(--ink-1);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ---------- backdrop ---------- */

.grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(90deg, #ffffff0a 1px, transparent 1px),
    linear-gradient(#ffffff0a 1px, transparent 1px);
  background-size: 60px 60px;
  -webkit-mask-image: radial-gradient(#000 0%, transparent 72%);
  mask-image: radial-gradient(#000 0%, transparent 72%);
  z-index: 0;
}

.glow {
  position: fixed;
  pointer-events: none;
  border-radius: 9999px;
  filter: blur(80px);
  z-index: 0;
  background: radial-gradient(circle, color-mix(in oklab, var(--primary) 45%, transparent) 0%, transparent 70%);
}
.glow--a { top: -8rem; left: -10rem; width: 34rem; height: 34rem; opacity: 0.34; }
.glow--b { bottom: -12rem; right: -8rem; width: 30rem; height: 30rem; opacity: 0.2; }

/* A CRT hint, not a costume: 1px lines at 4% alpha read as texture, not stripes. */
.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  background: repeating-linear-gradient(180deg, #ffffff08 0 1px, transparent 1px 3px);
  opacity: 0.5;
}

/* ---------- shell ---------- */

.shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 68rem;
  margin-inline: auto;
  padding: clamp(1rem, 4vw, 3.5rem) clamp(0.75rem, 3vw, 2rem);
}

.window {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #12121299 0%, #0c0c0ccc 100%);
  backdrop-filter: blur(12px);
  box-shadow: 0 40px 120px -40px #000, inset 0 1px 0 #ffffff0d;
  overflow: hidden;
}

.titlebar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.125rem;
  border-bottom: 1px solid var(--border);
  background: #ffffff05;
  font-size: 11px;
  color: var(--muted-foreground);
}
.titlebar__spacer { flex: 1; }
.titlebar__path { color: var(--ink-3); }
.titlebar__edge { color: var(--primary); letter-spacing: 0.04em; }

.lamps { display: inline-flex; gap: 0.4rem; }
.lamps i { width: 9px; height: 9px; border-radius: 9999px; background: #ffffff1f; }
.lamps i:first-child { background: color-mix(in oklab, var(--destructive) 70%, transparent); }
.lamps i:nth-child(2) { background: color-mix(in oklab, var(--warning) 60%, transparent); }
.lamps i:last-child { background: color-mix(in oklab, var(--success) 60%, transparent); }

.viewport { padding: clamp(1rem, 3vw, 1.75rem); }

.banner {
  margin: 0;
  font-size: clamp(6px, 1.5vw, 10px);
  line-height: 1.15;
  color: var(--primary);
  opacity: 0.85;
  overflow-x: auto;
}

.tagline {
  margin: 0.9rem 0 1.4rem;
  color: var(--ink-2);
  font-size: 12px;
}
.tagline code { color: var(--primary); }

.dim { color: var(--muted-foreground); }
.mono-accent { color: var(--ink-1); }
.sep { color: #ffffff1f; margin-inline: 0.5rem; }

/* ---------- boot log ---------- */

.log { display: grid; gap: 0.15rem; }

.log-line {
  display: flex;
  gap: 0.6rem;
  align-items: baseline;
  animation: rise 0.28s var(--curve) both;
  font-size: 12px;
}
.log-line__t { color: #ffffff42; flex: none; }
.log-line__tag { flex: none; font-weight: 700; letter-spacing: 0.03em; }
.log-line__msg { color: var(--ink-2); min-width: 0; overflow-wrap: anywhere; }

.tag-ok { color: var(--success); }
.tag-info { color: var(--info); }
.tag-warn { color: var(--warning); }
.tag-fail { color: var(--destructive); }
.tag-run { color: var(--primary); }

@keyframes rise {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* ---------- prompt ---------- */

.prompt-line { margin-top: 1.1rem; font-size: 13px; }
.prompt { color: var(--success); }
.cwd { color: var(--info); }
.cmd { color: var(--foreground); margin-left: 0.45rem; }

.caret {
  color: var(--primary);
  animation: blink 1.05s steps(1, end) infinite;
}
.caret[hidden] { display: none; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- board ---------- */

.board { margin-top: 1.6rem; display: grid; gap: 1.25rem; }
.board[hidden] { display: none; }

.rw-eyebrow {
  font-family: var(--font-sans);
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.1125rem;
  text-transform: uppercase;
  color: var(--muted-foreground);
}

.gauge {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.35rem 1.25rem;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: #ffffff05;
}
.gauge__figure {
  grid-row: span 2;
  font-family: var(--font-sans);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
}
.gauge__value { font-size: clamp(2.25rem, 7vw, 3.25rem); }
.gauge__unit { font-size: 1.25rem; color: var(--muted-foreground); margin-left: 0.15rem; }
.gauge__meta { display: flex; flex-direction: column; gap: 0.1rem; }
.gauge__counts { color: var(--ink-2); font-size: 12px; }
.gauge__bar {
  grid-column: 2;
  height: 6px;
  border-radius: 9999px;
  background: #ffffff12;
  overflow: hidden;
}
.gauge__bar > span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--success), color-mix(in oklab, var(--success) 55%, var(--info)));
  transition: width 0.7s var(--curve), background 0.4s linear;
}
.gauge__refresh {
  grid-column: 2;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.35rem;
  font-size: 11.5px;
  flex-wrap: wrap;
}

.btn {
  margin-left: auto;
  font: inherit;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--primary);
  background: color-mix(in oklab, var(--primary) 12%, transparent);
  border: 1px solid color-mix(in oklab, var(--primary) 35%, transparent);
  border-radius: 9999px;
  padding: 0.3rem 0.85rem;
  cursor: pointer;
  transition: background 0.2s var(--curve), transform 0.2s var(--curve);
}
.btn:hover { background: color-mix(in oklab, var(--primary) 22%, transparent); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.45; cursor: progress; }

/* ---------- table ---------- */

.table {
  border: 1px solid var(--border);
  border-radius: 1rem;
  overflow: hidden;
}

.tr {
  display: grid;
  grid-template-columns: minmax(9rem, 1.1fr) minmax(10rem, 1.7fr) 4.5rem 6rem 7rem;
  gap: 0.75rem;
  align-items: center;
  padding: 0.7rem 1rem;
  border-top: 1px solid var(--border);
  font-size: 12px;
}
.tr--head {
  border-top: 0;
  background: #ffffff05;
  color: var(--muted-foreground);
  font-size: 10px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}
.ta-r { text-align: right; }

.row { cursor: pointer; transition: background 0.18s var(--curve); }
.row:hover { background: #ffffff08; }
.row[aria-selected="true"] { background: #ffffff0d; box-shadow: inset 3px 0 0 var(--primary); }
.row__name { display: flex; align-items: center; gap: 0.55rem; min-width: 0; }
.row__id { color: var(--foreground); font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.row__host { color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row__host span { color: var(--muted-foreground); }
.row__code { text-align: right; color: var(--ink-2); }
.row__ms { text-align: right; }

.dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  background: var(--c);
  box-shadow: 0 0 0 0 color-mix(in oklab, var(--c) 70%, transparent);
  animation: pulse 2.4s var(--curve) infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in oklab, var(--c) 60%, transparent); }
  70%, 100% { box-shadow: 0 0 0 7px transparent; }
}

.state { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 500; color: var(--c); }

.row--up { --c: var(--success); }
.row--degraded { --c: var(--warning); }
.row--down { --c: var(--destructive); }
.row--pending { --c: #ffffff3d; }

.lat { display: flex; align-items: center; justify-content: flex-end; gap: 0.4rem; }
.lat__bar { width: 2.5rem; height: 4px; border-radius: 9999px; background: #ffffff14; overflow: hidden; flex: none; }
.lat__bar > i { display: block; height: 100%; background: var(--c); transition: width 0.6s var(--curve); }

.detail {
  padding: 0 1rem 0.95rem 1rem;
  border-top: 1px dashed var(--border);
  background: #00000042;
}
.detail dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.15rem 1rem;
  margin: 0.85rem 0 0;
  font-size: 11.5px;
}
.detail dt { color: var(--muted-foreground); }
.detail dd { margin: 0; color: var(--ink-2); overflow-wrap: anywhere; }
.detail pre {
  margin: 0.7rem 0 0;
  padding: 0.7rem 0.85rem;
  border-radius: 0.6rem;
  background: #ffffff08;
  color: var(--ink-2);
  font-size: 11px;
  overflow-x: auto;
}
.detail__note { color: var(--warning); }

.board__foot {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--ink-3);
}
.board__foot a { color: var(--primary); text-decoration: none; border-bottom: 1px solid #ff6b5759; }
.board__foot a:hover { border-bottom-color: var(--primary); }

kbd {
  font: inherit;
  font-size: 10px;
  padding: 0.05rem 0.35rem;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 0.35rem;
  background: #ffffff08;
  color: var(--ink-2);
}

/*
  On a phone the width goes to the message. The timestamp column is the first
  thing to go — it costs 9 characters of a 40-character line and every entry
  already arrives in order.
*/
@media (max-width: 560px) {
  body { font-size: 11.5px; }
  .log-line { font-size: 11px; }
  .log-line__t { display: none; }
  .tagline { font-size: 11px; }
  .prompt-line { font-size: 11.5px; }
  .row__id { font-size: 11.5px; }
  .board__foot { font-size: 10px; }
}

@media (max-width: 720px) {
  .tr { grid-template-columns: 1fr 4rem 5rem; }
  .tr > :nth-child(2) { display: none; }
  .tr--head > :nth-child(5) { display: none; }
  .row > :nth-child(5) { display: none; }
  .gauge { grid-template-columns: 1fr; }
  .gauge__figure { grid-row: auto; }
  .gauge__bar, .gauge__refresh { grid-column: 1; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001s !important; transition-duration: 0.001s !important; }
  .scanlines { display: none; }
}
