:root {
  --bg: #0b0c0e;
  --panel: #15171a;
  --line: #24272c;
  --text: #e6e7e9;
  --muted: #8a8f98;
  --mine: #2b3a55;
  --theirs: #1c1f24;
  --accent: #6b8afd;
  --ok: #3ecf8e;
  --warn: #e5a54b;
  --bad: #ef5a5a;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

[hidden] { display: none !important; }

.screen { height: 100dvh; display: flex; flex-direction: column; max-width: 720px; margin: 0 auto; }

.center { margin: auto; padding: 24px 16px; text-align: center; max-width: 420px; }
h1 { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 8px; }
.muted { color: var(--muted); margin: 0 0 24px; }
.error { color: var(--bad); margin-top: 16px; }

button, .button {
  font: inherit;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 16px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button:disabled { opacity: 0.4; cursor: default; }
.primary { background: var(--accent); border-color: var(--accent); color: #0b0c0e; font-weight: 600; }
.ghost { background: none; border-color: transparent; color: var(--muted); padding: 6px 10px; }
.ghost:hover { color: var(--bad); }

header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  padding-top: max(12px, env(safe-area-inset-top));
}
#status { flex: 1; color: var(--muted); font-size: 14px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }

#share { padding: 16px; border-bottom: 1px solid var(--line); }
#share p { margin: 0 0 10px; color: var(--muted); font-size: 14px; }
.share-row { display: flex; gap: 8px; }
#link {
  flex: 1;
  min-width: 0;
  font: 13px ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}

#log {
  flex: 1;
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
#log li {
  max-width: 80%;
  padding: 8px 12px;
  border-radius: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
#log .mine { align-self: flex-end; background: var(--mine); border-bottom-right-radius: 4px; }
#log .theirs { align-self: flex-start; background: var(--theirs); border-bottom-left-radius: 4px; }
#log .sys { align-self: center; background: none; color: var(--muted); font-size: 13px; padding: 4px; }

#compose {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}
#input {
  flex: 1;
  resize: none;
  font: inherit;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  max-height: 160px;
}
#input:focus, #link:focus { outline: 1px solid var(--accent); }
