:root {
  --bg: #f6f7f9;
  --fg: #1d2433;
  --muted: #5d6677;
  --card: #ffffff;
  --line: #dde1e8;
  --accent: #2f5bd3;
  --warn: #a24b00;
  --error: #b3261e;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161f;
    --fg: #e7eaf0;
    --muted: #9aa3b4;
    --card: #1b2130;
    --line: #2c3446;
    --accent: #8aa8ff;
    --warn: #ffb066;
    --error: #ff8a80;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.bar {
  position: sticky;
  top: 0;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}

.brand { color: var(--fg); font-weight: 700; text-decoration: none; }

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 16px calc(env(safe-area-inset-bottom) + 32px);
}

h1 { font-size: 1.4rem; line-height: 1.25; margin: 8px 0 12px; }

a { color: var(--accent); }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
}

.muted, .meta { color: var(--muted); }
.error { color: var(--error); }

form { display: grid; gap: 14px; max-width: 360px; }

label { display: grid; gap: 4px; font-weight: 600; }

input {
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--fg);
}

#pair-code { font-family: ui-monospace, Menlo, monospace; letter-spacing: 0.1em; text-transform: uppercase; }

button {
  font: inherit;
  font-weight: 600;
  padding: 10px 18px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

button.secondary { background: transparent; color: var(--accent); border: 1px solid var(--line); }
button:disabled { opacity: 0.5; cursor: default; }

.actions { display: flex; flex-wrap: wrap; gap: 12px; }

.fingerprint {
  font: 600 1.35rem/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.08em;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  word-spacing: 0.3em;
}

.messages { list-style: none; margin: 0; padding: 0; }

.messages li {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 10px;
}

.messages a {
  display: grid;
  gap: 2px;
  padding: 12px 14px;
  color: inherit;
  text-decoration: none;
}

.messages .body { color: var(--muted); overflow-wrap: anywhere; }
.messages time { color: var(--muted); font-size: 0.85rem; }
.messages li[data-kind="alert"] { border-left: 4px solid var(--accent); }
.messages li.unverified strong, #message-title.unverified { color: var(--warn); }

.kind {
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.lead { font-size: 1.05rem; }

.content { overflow-wrap: anywhere; }
.content pre { overflow-x: auto; padding: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; }
.content table { border-collapse: collapse; display: block; overflow-x: auto; }
.content th, .content td { border: 1px solid var(--line); padding: 4px 8px; text-align: left; }
.content blockquote { margin: 0; padding-left: 12px; border-left: 3px solid var(--line); color: var(--muted); }
.content .link-domain { color: var(--muted); font-size: 0.85em; }
