:root {
  --bg: #f6f4ef;
  --fg: #1c1b19;
  --muted: #6a665e;
  --line: #d9d4c8;
  --panel: #fffdf8;
  --accent: #0b5d4e;
  --accent-fg: #ffffff;
  --warn-bg: #fff3cd;
  --warn-fg: #5c4400;
  --err-bg: #fde2e0;
  --err-fg: #7a1410;
  --ok: #0b5d4e;
  --meter: #0b5d4e;
  --meter-hot: #b3261e;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151614;
    --fg: #ecebe6;
    --muted: #a09c92;
    --line: #34352f;
    --panel: #1d1e1b;
    --accent: #6fd3bd;
    --accent-fg: #0c1a17;
    --warn-bg: #3d3310;
    --warn-fg: #f3dc8f;
    --err-bg: #47191a;
    --err-fg: #ffb4ab;
    --ok: #6fd3bd;
    --meter: #6fd3bd;
    --meter-hot: #ff8a80;
  }
}
* { box-sizing: border-box; }
html { font-size: 17px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.45;
}
main {
  max-width: 38rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
}
h1 { font-size: 1.6rem; margin: 0 0 0.25rem; letter-spacing: -0.01em; }
h2 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0 0 0.5rem; font-weight: 600; }
.lead { margin: 0 0 1.25rem; color: var(--muted); }
section { margin: 0 0 1.5rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

button {
  font: inherit;
  padding: 0.55rem 1.1rem;
  border-radius: 0.5rem;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--fg);
  cursor: pointer;
}
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); font-weight: 600; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

textarea {
  display: block;
  width: 100%;
  font: inherit;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.95rem;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--panel);
  color: var(--fg);
  resize: vertical;
}
.row { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin: 0.5rem 0; }
.small { font-size: 0.85rem; color: var(--muted); }
.row.small { justify-content: space-between; margin: 0.3rem 0 0.6rem; }
.status { margin: 0.5rem 0; min-height: 1.45em; }
.status.ok { color: var(--ok); font-weight: 600; }
.notice { padding: 0.6rem 0.8rem; border-radius: 0.5rem; border: 1px solid var(--line); font-size: 0.9rem; color: var(--muted); margin: 0.75rem 0; }
.notice.warning { background: var(--warn-bg); color: var(--warn-fg); border-color: transparent; }
.notice.error { background: var(--err-bg); color: var(--err-fg); border-color: transparent; }

.meter { position: relative; height: 0.9rem; background: var(--panel); border: 1px solid var(--line); border-radius: 0.45rem; overflow: hidden; }
.meter-bar { position: absolute; inset: 0 auto 0 0; width: 0%; background: var(--meter); transition: width 60ms linear; }
.meter-bar.hot { background: var(--meter-hot); }
.meter-peak { position: absolute; top: 0; bottom: 0; width: 2px; left: 0%; background: var(--fg); opacity: 0.6; }
.meter-text { margin: 0.35rem 0 0; font-size: 0.85rem; color: var(--muted); font-variant-numeric: tabular-nums; }

progress { display: block; width: 100%; height: 0.6rem; accent-color: var(--accent); }
pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 0.5rem 0;
}
#received { padding: 0.7rem 0.8rem; background: var(--panel); border: 1px solid var(--line); border-radius: 0.5rem; }
details { margin-top: 2rem; border-top: 1px solid var(--line); padding-top: 0.75rem; }
summary { cursor: pointer; color: var(--muted); font-size: 0.9rem; }
#log { font-size: 0.75rem; max-height: 22rem; overflow: auto; color: var(--muted); }
