:root {
  --bg: #f6f4ef;
  --fg: #1d1c1a;
  --muted: #6b675f;
  --line: #d9d4c8;
  --panel: #fffdf8;
  --accent: #b4431f;
  --yes: #2f6b3a;
  --no: #a3271d;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171614;
    --fg: #ece8df;
    --muted: #a09a8e;
    --line: #38352f;
    --panel: #1f1e1b;
    --accent: #f08a5d;
    --yes: #7ec78a;
    --no: #f08a80;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0 auto;
  max-width: 44rem;
  padding: 0 1rem 3rem;
  background: var(--bg);
  color: var(--fg);
  font: 1rem/1.5 system-ui, sans-serif;
}
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--fg); text-decoration: none; }
#who { display: flex; gap: 0.75rem; align-items: center; color: var(--muted); font-size: 0.9rem; min-width: 0; }
#who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
h1 { font-size: 1.6rem; line-height: 1.2; margin: 1.5rem 0 0.5rem; text-wrap: balance; }
h2 { font-size: 1rem; margin: 0; }
a { color: var(--accent); }
form { display: flex; gap: 0.5rem; align-items: end; margin: 1.25rem 0 0.5rem; }
label { flex: 1; display: grid; gap: 0.25rem; font-size: 0.85rem; color: var(--muted); }
input {
  font: inherit;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  color: var(--fg);
  min-width: 0;
}
button {
  font: inherit;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: var(--accent);
  color: var(--bg);
  cursor: pointer;
}
button.quiet { background: none; color: var(--muted); border-color: var(--line); padding: 0.25rem 0.6rem; font-size: 0.85rem; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hint, .meta { color: var(--muted); font-size: 0.9rem; }
.error { color: var(--no); min-height: 1.5rem; margin: 0.25rem 0; }
.back { font-size: 0.9rem; display: inline-block; margin-top: 1rem; }
.back + h1 { margin-top: 0.25rem; }
.uri { font: 0.75rem/1.4 ui-monospace, monospace; color: var(--muted); overflow-wrap: anywhere; margin: 0; }
ul { list-style: none; padding: 0; }
.rooms li, .messages li {
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--line);
}
.rooms li { justify-content: space-between; }
.messages .meta { flex: 0 0 9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status { padding: 0.6rem 0.8rem; border-left: 3px solid; background: var(--panel); margin: 1rem 0; }
.status.open { border-color: var(--yes); }
.status.shut { border-color: var(--no); }
.ad {
  display: grid;
  gap: 0.4rem;
  justify-items: center;
  text-align: center;
  padding: 2.5rem 1rem;
  margin: 1rem 0;
  background: var(--accent);
  color: var(--bg);
  border-radius: 6px;
}
.ad strong { font-size: 2.2rem; line-height: 1.1; }
.adlabel { font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; opacity: 0.8; }
.skip { font-size: 0.85rem; margin-top: 1rem; font-variant-numeric: tabular-nums; }
#wire { margin-top: 2.5rem; padding: 1rem; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; }
#wire .hint { margin: 0.1rem 0 0.75rem; }
#trace { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.6rem; }
#trace li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0 0.75rem;
  padding-left: 0.6rem;
  border-left: 3px solid var(--line);
  font-size: 0.85rem;
}
#trace li.in { border-color: var(--accent); }
#trace .route { color: var(--muted); grid-column: 1 / -1; overflow-wrap: anywhere; }
#trace code { font: 0.8rem ui-monospace, monospace; overflow-wrap: anywhere; }
#trace b { font-weight: 600; white-space: nowrap; }
#trace .gloss { grid-column: 1 / -1; color: var(--muted); }
#trace .tag { grid-column: 1 / -1; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.yes { color: var(--yes); }
.no { color: var(--no); }
footer { margin-top: 2.5rem; color: var(--muted); font-size: 0.85rem; }
@media (max-width: 30rem) {
  .messages li { flex-direction: column; gap: 0; }
  .messages .meta { flex: none; }
}
