/* Backroom: paper, ink and a rubber stamp. */

:root {
  --bg: #f3eee4;
  --surface: #fcfaf5;
  --surface-2: #f7f2e9;
  --ink: #1d1a16;
  --ink-2: #4a443b;
  --muted: #6c6458;
  --line: #e2dacb;
  --line-strong: #cdc3b1;
  --accent: #c63f26;
  --accent-hover: #ab3520;
  --on-accent: #fffaf3;
  --accent-tint: rgb(198 63 38 / 0.1);
  --own-bg: #1d1a16;
  --own-ink: #f6f1e7;
  --ok: #2b7347;
  --warn: #9a5f0c;
  --danger: #b3261e;
  --nick-s: 58%;
  --nick-l: 36%;
  --shadow: 0 1px 0 rgb(60 45 20 / 0.04), 0 14px 34px -20px rgb(60 45 20 / 0.4);
  --shadow-sm: 0 1px 2px rgb(60 45 20 / 0.06);
  --grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='g'><feTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.24  0 0 0 0 0.19  0 0 0 0 0.1  0 0 0 0.11 0'/></filter><rect width='180' height='180' filter='url(%23g)'/></svg>");

  --radius: 14px;
  --font-display: "Young Serif", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-body: "Atkinson Hyperlegible", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15130f;
    --surface: #211d18;
    --surface-2: #1b1814;
    --ink: #efe8db;
    --ink-2: #cfc6b6;
    --muted: #9d9486;
    --line: #322d26;
    --line-strong: #4a4237;
    --accent: #ff6e52;
    --accent-hover: #ff876d;
    --on-accent: #1c0d08;
    --accent-tint: rgb(255 110 82 / 0.14);
    --own-bg: #efe8db;
    --own-ink: #1b1814;
    --ok: #74d29c;
    --warn: #f2b45a;
    --danger: #ff7a70;
    --nick-s: 72%;
    --nick-l: 72%;
    --shadow: 0 1px 0 rgb(255 255 255 / 0.03), 0 16px 40px -18px rgb(0 0 0 / 0.8);
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.3);
    --grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='g'><feTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 0.95  0 0 0 0 0.85  0 0 0 0.05 0'/></filter><rect width='180' height='180' filter='url(%23g)'/></svg>");
    color-scheme: dark;
  }
}

/* ---------- base */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--grain), var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }
code, .mono { font-family: var(--font-mono); font-size: 0.9em; }
code { background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; overflow-wrap: anywhere; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent-tint); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.copy-buffer { position: fixed; top: 0; left: 0; opacity: 0; pointer-events: none; }

.kicker {
  margin: 0;
  font: 500 11px/1.3 var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.display {
  margin: 0;
  font: 400 clamp(2.1rem, 6vw, 3.6rem)/1.04 var(--font-display);
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.lede { margin: 0; font-size: 1.08rem; color: var(--ink-2); max-width: 34em; text-wrap: pretty; }
.hint { margin: 0; font-size: 0.875rem; color: var(--muted); text-wrap: pretty; }
.error { margin: 0; min-height: 1.4em; font-size: 0.875rem; color: var(--danger); }

/* ---------- controls */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45em;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font: 700 0.875rem/1 var(--font-body);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
}
.btn:hover { border-color: var(--ink-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-quiet { background: transparent; border-color: transparent; }
.btn-quiet:hover { background: var(--surface-2); border-color: var(--line); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); }
.btn-lg { min-height: 48px; padding: 0 20px; font-size: 1rem; border-radius: 12px; }
.btn-sm { min-height: 32px; padding: 0 10px; font-size: 0.8125rem; border-radius: 8px; }
.btn-icon { width: 40px; padding: 0; }

.input {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font: 1rem/1.3 var(--font-body);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input::placeholder { color: var(--muted); opacity: 0.8; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
select.input {
  appearance: none;
  padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 19px) 50%, calc(100% - 14px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}

/* The stamp: double-ruled, slightly crooked, inked in the accent color. */
.stamp {
  display: inline-block;
  padding: 3px 7px;
  border: 1.5px solid currentColor;
  border-radius: 4px;
  box-shadow: inset 0 0 0 1.5px var(--bg), inset 0 0 0 2.5px currentColor;
  color: var(--accent);
  font: 500 10px/1.3 var(--font-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  transform: rotate(-2.5deg);
}
.stamp.is-closed { color: var(--muted); }
.stamp-lg { padding: 6px 12px; font-size: 12px; transform: rotate(-4deg); }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  z-index: 60;
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-size: 0.875rem;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 0.2s, transform 0.2s;
  overflow-wrap: anywhere;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); color: #fff; }

.mark { display: inline-flex; flex: none; width: 32px; height: 32px; border-radius: 9px; }
.mark svg { width: 100%; height: 100%; }
.mark-bg { fill: var(--ink); }
.mark-fg { fill: var(--accent); }

/* ---------- motion */

@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes stamp-in { from { opacity: 0; transform: rotate(-12deg) scale(1.5); } }
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } }

.reveal > * { animation: rise 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.reveal > :nth-child(2) { animation-delay: 0.06s; }
.reveal > :nth-child(3) { animation-delay: 0.12s; }
.reveal > :nth-child(4) { animation-delay: 0.18s; }
.reveal > :nth-child(5) { animation-delay: 0.24s; }
.reveal > :nth-child(6) { animation-delay: 0.3s; }
.reveal > .stamp { animation: stamp-in 0.45s cubic-bezier(0.3, 1.4, 0.5, 1) 0.35s both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ================================================================ room page */

.room-page { overflow: hidden; }

.room-app {
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  padding-top: max(10px, env(safe-area-inset-top));
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  position: relative;
  z-index: 5;
}

.room-heading { flex: 1; min-width: 0; display: grid; gap: 3px; }
.room-heading h1 {
  margin: 0;
  font: 400 1.25rem/1.15 var(--font-display);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.room-sub { display: flex; align-items: center; gap: 10px; min-width: 0; }

.conn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: 500 11px/1 var(--font-mono);
  letter-spacing: 0.06em;
  color: var(--muted);
  white-space: nowrap;
}
.conn::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--warn);
}
.conn[data-state="live"]::before { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }

.top-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.people-toggle .count { font-family: var(--font-mono); font-weight: 500; }

.stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 0;
}

.chat {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 0;
  min-width: 0;
}

.log-wrap { position: relative; min-height: 0; display: grid; }

.log {
  overflow-y: auto;
  overscroll-behavior: contain;
  outline: none;
  container-type: inline-size;
}

.log-inner {
  position: relative;
  max-width: 800px;
  min-height: 100%;
  margin: 0 auto;
  padding: 20px 20px 16px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

/* Notebook margin rule, only when the chat column has room around it. */
@container (min-width: 860px) {
  .log-inner::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 1px;
    background: var(--accent);
    opacity: 0.25;
  }
}

.empty {
  margin: auto 0 24px;
  align-self: center;
  text-align: center;
  color: var(--muted);
  font: 400 1.35rem/1.3 var(--font-display);
}
.empty small { display: block; margin-top: 6px; font: 0.875rem/1.4 var(--font-body); }

.day {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 6px;
  font: 500 11px/1 var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.day::before, .day::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.msg {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-top: 14px;
  min-width: 0;
}
.msg.cont { margin-top: 3px; }
.msg.own { align-items: flex-end; }

.meta { display: flex; align-items: baseline; gap: 8px; margin: 0 4px 4px; }
.nick {
  font-weight: 700;
  font-size: 0.875rem;
  color: hsl(var(--hue, 15) var(--nick-s) var(--nick-l));
}
.meta time, .event time { font: 11px/1 var(--font-mono); color: var(--muted); }

.bubble {
  max-width: min(580px, 88%);
  padding: 8px 13px 9px;
  border: 1px solid var(--line);
  border-radius: 4px 16px 16px 16px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 1rem;
  line-height: 1.45;
}
.msg.own .bubble {
  background: var(--own-bg);
  border-color: var(--own-bg);
  color: var(--own-ink);
  border-radius: 16px 4px 16px 16px;
}
.bubble a { color: inherit; text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
.bubble.big {
  padding: 0 4px;
  border: 0;
  background: none !important;
  box-shadow: none;
  font-size: 2.6rem;
  line-height: 1.15;
}

.event {
  align-self: center;
  margin: 12px 0 2px;
  max-width: 100%;
  font: 12px/1.45 var(--font-mono);
  color: var(--muted);
  text-align: center;
  overflow-wrap: anywhere;
}
.event .nick { font: 700 12px/1 var(--font-mono); }
.event time { margin-left: 6px; opacity: 0.8; }

.fresh { animation: rise 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) both; }

.pill {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  min-height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font: 700 0.8125rem/1 var(--font-body);
  box-shadow: var(--shadow);
  cursor: pointer;
  animation: rise 0.2s ease-out both;
}

/* ---------- composer */

.composer-wrap {
  padding: 10px 16px;
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}

.composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 800px;
  margin: 0 auto;
  padding: 5px 5px 5px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.composer:focus-within { border-color: var(--ink-2); }

.composer textarea {
  flex: 1;
  min-width: 0;
  max-height: 160px;
  padding: 8px 0;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  color: inherit;
  font: 1rem/1.45 var(--font-body);
}
.composer textarea::placeholder { color: var(--muted); }

.send {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  cursor: pointer;
  transition: background-color 0.15s, transform 0.1s;
}
.send:hover { background: var(--accent-hover); }
.send:active { transform: scale(0.94); }
.send:disabled { opacity: 0.5; cursor: default; }
.send svg { width: 18px; height: 18px; }

.composer-note, .closed-note {
  max-width: 800px;
  margin: 6px auto 0;
  padding: 0 16px;
  font: 11px/1.4 var(--font-mono);
  color: var(--muted);
}
.composer-note:empty { display: none; }
.closed-note {
  margin: 0 auto;
  padding: 14px 16px;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  text-align: center;
  font: 0.9rem/1.4 var(--font-body);
}

/* ---------- people */

.people {
  display: none;
  flex-direction: column;
  min-height: 0;
  padding: 20px;
  border-left: 1px solid var(--line);
  overflow-y: auto;
}
.people-head { display: flex; align-items: center; justify-content: space-between; min-height: 32px; }
.people ul { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 2px; }
.people li { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 6px 0; }
.people .who { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people .you { margin-left: auto; font: 11px/1 var(--font-mono); color: var(--muted); }
.dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: hsl(var(--hue, 15) var(--nick-s) var(--nick-l));
}

.people-foot {
  display: grid;
  gap: 8px;
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.me-btn { justify-content: space-between; min-width: 0; }
.me-btn .name { overflow: hidden; text-overflow: ellipsis; }
.me-btn .hint { font: 500 11px/1 var(--font-mono); letter-spacing: 0.06em; }

.scrim { position: fixed; inset: 0; z-index: 19; background: rgb(0 0 0 / 0.35); }

@media (min-width: 960px) {
  .stage { grid-template-columns: minmax(0, 1fr) 260px; }
  .people { display: flex; }
  .people-toggle, .people-close, .scrim { display: none !important; }
}

@media (max-width: 959px) {
  .people.open {
    display: flex;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    width: min(300px, 86vw);
    padding-top: max(20px, env(safe-area-inset-top));
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    background: var(--surface);
    border-left: 1px solid var(--line);
    box-shadow: -24px 0 60px -24px rgb(0 0 0 / 0.5);
    animation: slide-in 0.2s ease-out both;
  }
}

@media (max-width: 520px) {
  .topbar { gap: 8px; padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
  .topbar .mark { display: none; }
  .invite-label { display: none; }
  #copyLink { width: 40px; padding: 0; }
  .room-heading h1 { font-size: 1.1rem; }
  .log-inner { padding-left: 14px; padding-right: 14px; }
  .bubble { max-width: 92%; }
  .composer-wrap { padding-left: max(10px, env(safe-area-inset-left)); padding-right: max(10px, env(safe-area-inset-right)); }
}

/* ---------- gate (join, rename, missing room) */

.gate {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  padding-top: max(24px, env(safe-area-inset-top));
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  background: var(--grain), var(--bg);
  overflow-y: auto;
}

.gate-card { width: min(440px, 100%); display: grid; gap: 14px; justify-items: start; }
.gate-card h1 { margin: 0; font: 400 clamp(2rem, 8vw, 3rem)/1.04 var(--font-display); letter-spacing: -0.015em; overflow-wrap: anywhere; text-wrap: balance; }
.gate-card form { width: 100%; display: grid; gap: 8px; margin-top: 12px; }
.gate-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.gate-actions .btn-primary { flex: 1; }
.gate-card .hint { margin-top: 4px; }

/* ================================================================ host panel + home */

.page {
  max-width: 940px;
  margin: 0 auto;
  padding: 0 16px 72px;
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}

.site-head { display: flex; align-items: center; gap: 12px; padding: 20px 0 8px; }
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font: 400 1.35rem/1 var(--font-display);
  text-decoration: none;
}
.site-head .spacer { flex: 1; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.key-gate { max-width: 520px; margin: 48px auto 0; padding: 28px; display: grid; gap: 14px; }
.key-gate form { display: grid; gap: 8px; margin-top: 6px; }

.hero { display: grid; gap: 14px; padding: 40px 0 28px; }

.create {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 200px auto;
  align-items: end;
  gap: 12px;
  padding: 18px;
}
.field { display: grid; gap: 6px; min-width: 0; }

.share-base {
  display: grid;
  grid-template-columns: auto minmax(0, 360px) minmax(0, 1fr);
  align-items: center;
  gap: 8px 14px;
  margin: 18px 2px 0;
}
.share-base .input { min-height: 40px; font-size: 0.8125rem; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 40px 2px 12px; }

.rooms { display: grid; gap: 14px; }
.empty-rooms { padding: 28px; text-align: center; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: 18px; }

.room-card { padding: 20px; display: grid; gap: 16px; }
.room-card.is-new { animation: rise 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both; border-color: var(--accent); }
.room-card.is-ended { background: var(--surface-2); box-shadow: none; }
.room-card.is-ended h3 { color: var(--ink-2); }

.rc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.rc-head h3 { margin: 0; font: 400 1.5rem/1.15 var(--font-display); overflow-wrap: anywhere; min-width: 0; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 7px;
  font: 500 11px/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
}
.badge.is-open { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); background: color-mix(in srgb, var(--ok) 8%, transparent); }
.badge.is-open::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.rc-link { display: flex; gap: 8px; }
.rc-link .input { min-height: 44px; font-family: var(--font-mono); font-size: 0.8125rem; background: var(--surface-2); }

.rc-stats { display: flex; flex-wrap: wrap; gap: 10px 28px; margin: 0; }
.rc-stats div { display: grid; gap: 4px; }
.rc-stats dt { font: 500 10px/1 var(--font-mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.rc-stats dd { margin: 0; font: 500 0.9375rem/1.2 var(--font-mono); }

.rc-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.rc-actions select.btn {
  appearance: none;
  padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
.rc-actions .push { margin-left: auto; }

.footnote { margin: 36px 2px 0; font-size: 0.8125rem; color: var(--muted); }

/* log viewer */
.log-dialog {
  width: min(780px, calc(100vw - 24px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 30px 80px -20px rgb(0 0 0 / 0.55);
}
.log-dialog[open] { display: grid; grid-template-rows: auto minmax(0, 1fr); }
.log-dialog::backdrop { background: rgb(20 16 10 / 0.45); backdrop-filter: blur(2px); }
.dlg-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 18px 14px 22px; border-bottom: 1px solid var(--line); }
.dlg-head h2 { margin: 4px 0 2px; font: 400 1.4rem/1.15 var(--font-display); overflow-wrap: anywhere; }
.dlg-actions { display: flex; gap: 6px; flex: none; }
.log-list { overflow-y: auto; padding: 8px 0 16px; }
.log-row {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 12px;
  padding: 7px 22px;
}
.log-row:hover { background: var(--surface-2); }
.log-row time { font: 11px/1.4 var(--font-mono); color: var(--muted); }
.log-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.9375rem; }
.log-row.is-event .log-text { font: 12px/1.4 var(--font-mono); color: var(--muted); }
.log-row.is-removed .log-text { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--danger); }
.tag { margin-left: 8px; padding: 2px 6px; border-radius: 5px; font: 500 10px/1 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--danger); border: 1px solid currentColor; text-decoration: none; display: inline-block; }

@media (max-width: 720px) {
  .create { grid-template-columns: 1fr; }
  .create .btn { width: 100%; }
  .share-base { grid-template-columns: 1fr; }
  .rc-link { flex-direction: column; }
  .rc-actions .push { margin-left: 0; }
  .log-row { grid-template-columns: minmax(0, 1fr) auto; padding: 8px 16px; }
  .log-row time { grid-column: 1 / -1; }
}

/* home */
.home-hero { display: grid; gap: 18px; justify-items: start; padding: 72px 0 40px; max-width: 680px; }
.home-hero .display { font-size: clamp(2.3rem, 7vw, 4.2rem); }
.home-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 8px 0 0; padding: 0; list-style: none; counter-reset: step; }
.home-steps li { padding: 18px; display: grid; gap: 6px; counter-increment: step; }
.home-steps li::before { content: "0" counter(step); font: 500 11px/1 var(--font-mono); letter-spacing: 0.14em; color: var(--accent); }
.home-steps strong { font: 400 1.15rem/1.2 var(--font-display); }
.home-steps span { color: var(--ink-2); font-size: 0.9375rem; }
@media (max-width: 720px) { .home-steps { grid-template-columns: 1fr; } .home-hero { padding-top: 40px; } }
