/* Dark, high-contrast, one-hand mobile layout: this thing gets read at arm's
   length on a handlebar mount, so type is large and status is colour-coded. */
:root {
  --bg: #101418;
  --card: #191f26;
  --line: #2a333d;
  --fg: #e8edf2;
  --muted: #8b98a5;
  --ok: #35c46a;
  --warn: #e8b13a;
  --err: #e5484d;
  --accent: #4a9eff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0 16px calc(24px + env(safe-area-inset-bottom));
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: calc(14px + env(safe-area-inset-top)) 0 10px;
}
h1 { margin: 0; font-size: 19px; letter-spacing: .5px; }
.device {
  font: 600 15px ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--accent);
}

h2 {
  margin: 0 0 10px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--muted);
}

.hidden { display: none !important; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
}

/* --- status badges ------------------------------------------------------ */
.badges { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  min-width: 0;
}
.badge b { display: block; font-size: 13px; }
.badge small { display: block; color: var(--muted); font-size: 12px; }
.badge div { min-width: 0; }
.badge small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--muted);
  flex: 0 0 auto;
}
.badge.ok   .dot { background: var(--ok);   box-shadow: 0 0 10px var(--ok); }
.badge.warn .dot { background: var(--warn); animation: pulse 1.2s ease-in-out infinite; }
.badge.err  .dot { background: var(--err);  box-shadow: 0 0 10px var(--err); }
@keyframes pulse { 50% { opacity: .3; } }

/* --- primary action ----------------------------------------------------- */
button.primary {
  width: 100%;
  padding: 16px;
  margin-bottom: 12px;
  font: 600 17px inherit;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
button.primary.on { background: var(--err); }
button.primary:active { filter: brightness(.85); }

/* --- data layout -------------------------------------------------------- */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 10px; }
.grid small, .rows small { display: block; color: var(--muted); font-size: 11px; margin-bottom: 2px; }
.grid b { font: 600 18px ui-monospace, SFMono-Regular, Menlo, monospace; }

.rows { display: grid; gap: 10px; }
.rows > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.rows small { margin: 0; }
.rows b { font: 600 15px ui-monospace, SFMono-Regular, Menlo, monospace; text-align: right; min-width: 0; overflow-wrap: anywhere; }
.small-txt { font-size: 12px !important; font-weight: 400 !important; color: var(--muted); }

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
pre.mono {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--muted);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 220px;
  overflow-y: auto;
}
#log { max-height: 180px; }

.muted { color: var(--muted); font-size: 13px; }
code.url {
  display: block;
  padding: 10px;
  margin: 10px 0;
  background: var(--bg);
  border-radius: 8px;
  font-size: 13px;
  overflow-wrap: anywhere;
}
.warn {
  color: var(--muted);
  font-size: 12.5px;
  border-left: 3px solid var(--warn);
  padding-left: 10px;
  margin: 16px 0 0;
}
