/* Cipher. Two mirrored panels: Write (lock, blue) and Read (unlock, green). */

@font-face {
  font-family: "Spectral";
  src: url("../fonts/spectral-500-latin.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* ----------------------------------------------------------------- tokens */

:root {
  color-scheme: dark;
  --bg: #0a1220;
  --surface: #111c2e;
  --surface-2: #17243a;
  --field: #0c1626;
  --line: #22344d;
  --line-strong: #36507a;
  --text: #eaf1fb;
  --muted: #9aaecb;
  --faint: #6c809e;

  --lock: #7eb8ff; /* Write */
  --lock-ink: #06111f;
  --lock-soft: rgb(126 184 255 / 13%);
  --open: #74d6a5; /* Read */
  --open-ink: #04140c;
  --open-soft: rgb(116 214 165 / 12%);

  --warn: #f2c47a;
  --bad: #ff9a9a;
  --bad-soft: rgb(255 154 154 / 10%);
  --shadow: 0 24px 60px -32px rgb(0 0 0 / 70%);

  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --font-display: "Spectral", Georgia, "Times New Roman", serif;

  --radius-lg: 20px;
  --radius: 14px;
  --radius-sm: 10px;
  --page: 1120px;
  --gutter: 3rem;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #eef2f7;
  --field: #f8fafc;
  --line: #dbe2ec;
  --line-strong: #b6c3d5;
  --text: #0e1a2c;
  --muted: #50637e;
  --faint: #7d8ea6;

  --lock: #1d5bd6;
  --lock-ink: #ffffff;
  --lock-soft: rgb(29 91 214 / 9%);
  --open: #157a4b;
  --open-ink: #ffffff;
  --open-soft: rgb(21 122 75 / 9%);

  --warn: #9a5b00;
  --bad: #b42318;
  --bad-soft: rgb(180 35 24 / 7%);
  --shadow: 0 20px 44px -30px rgb(20 30 50 / 35%);
}

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

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-wrap: break-word;
}

h1,
h2,
h3,
p,
ol,
ul,
dl,
dd {
  margin: 0;
}

ol,
ul {
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

::selection {
  background: var(--lock-soft);
}

:focus-visible {
  outline: 2px solid var(--lock);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

kbd {
  display: inline-block;
  padding: 0 0.38em;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--muted);
  font-family: var(--font);
  font-size: 0.78em;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

.icon {
  width: 1.15rem;
  height: 1.15rem;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* The lock glyph: the shackle lifts when open and drops shut with a little spring. */
.lock {
  width: 1.2rem;
  height: 1.2rem;
  flex: none;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lock-shackle {
  transition: transform 320ms var(--spring);
}

.lock.is-open .lock-shackle {
  transform: translateY(-2.6px);
}

/* ----------------------------------------------------------------- topbar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid transparent;
  background: color-mix(in oklab, var(--bg) 84%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  transition: border-color 200ms ease;
}

.topbar.is-scrolled {
  border-bottom-color: var(--line);
}

.topbar-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: min(var(--page), calc(100% - var(--gutter)));
  min-height: 4rem;
  margin-inline: auto;
}

.wordmark {
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.015em;
  text-decoration: none;
}

.topbar-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  justify-self: start;
  min-height: 2.5rem;
  padding: 0.4rem 0.8rem;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 500;
  text-decoration: none;
  transition:
    color 150ms ease,
    background-color 150ms ease,
    border-color 150ms ease;
}

.topbar-id {
  justify-self: end;
  border-color: var(--line);
  color: var(--text);
}

@media (hover: hover) {
  .topbar-link:hover {
    background: var(--surface);
    color: var(--text);
  }

  .topbar-id:hover {
    border-color: var(--line-strong);
  }
}

/* ------------------------------------------------------------------- page */

.page {
  flex: 1;
  width: min(var(--page), calc(100% - var(--gutter)));
  margin-inline: auto;
  padding: 2rem 0 4rem;
}

.intro {
  max-width: 36rem;
  margin: 0.5rem auto 2rem;
  text-align: center;
}

.intro h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.5vw, 2.75rem);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.intro p {
  margin-top: 0.75rem;
  color: var(--muted);
  font-size: 1.05rem;
  text-wrap: balance;
}

/* Returning users don't need the pitch. */
.has-people .intro {
  display: none;
}

/* ------------------------------------------------------------------- desk */

.desk {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "write" "read" "rule" "thread";
  gap: 1rem;
}

.panel-write {
  grid-area: write;
}

.panel-read {
  grid-area: read;
}

.session-rule {
  grid-area: rule;
}

.thread {
  grid-area: thread;
  justify-self: center;
  width: min(46rem, 100%);
  min-width: 0;
}

@media (min-width: 860px) {
  .desk {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas: "write read" "rule rule" "thread thread";
    gap: 1.5rem;
    align-items: start;
  }

  /* The two panels match in height, like facing pages, except while the
     Write drawer is open, when Read would otherwise become a huge empty tray. */
  .panel-write,
  .panel-read {
    align-self: stretch;
  }

  .panel-write:not(.is-collapsed) ~ .panel-read {
    align-self: start;
  }
}

/* ------------------------------------------------------------------ panel */

.panel {
  --tone: var(--lock);
  --tone-soft: var(--lock-soft);
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel-read {
  --tone: var(--open);
  --tone-soft: var(--open-soft);
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1.15rem 1.25rem 1rem;
}

.panel-badge {
  display: grid;
  width: 2.6rem;
  height: 2.6rem;
  flex: none;
  place-items: center;
  border-radius: 50%;
  background: var(--tone-soft);
  color: var(--tone);
}

.panel-badge .lock {
  width: 1.3rem;
  height: 1.3rem;
}

.panel-title {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.panel-sub {
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.9rem;
}

/* The "To" line (Write) and its mirror, the "As" line (Read). */

.to-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 3.4rem;
  padding: 0.45rem 0.75rem 0.45rem 1.25rem;
  border-block: 1px solid var(--line);
}

.to-label {
  width: 1.6rem;
  flex: none;
  color: var(--faint);
  font-size: 0.9rem;
  font-weight: 500;
}

.to-button {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
  min-height: 2.5rem;
  padding: 0.3rem 0.55rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  text-align: left;
  transition:
    background-color 150ms ease,
    border-color 150ms ease;
}

@media (hover: hover) {
  .to-button:hover {
    background: var(--surface-2);
  }
}

.to-button[aria-expanded="true"] {
  border-color: var(--line);
  background: var(--surface-2);
}

.to-avatars {
  display: inline-flex;
}

.to-avatars:empty {
  display: none;
}

.to-avatars .avatar {
  margin-left: -0.45rem;
  box-shadow: 0 0 0 2px var(--surface);
}

.to-avatars .avatar:first-child {
  margin-left: 0;
}

.to-value {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.to-button.is-empty .to-value {
  color: var(--warn);
  font-weight: 500;
}

.to-change {
  color: var(--lock);
  font-size: 0.88rem;
  font-weight: 500;
}

.to-button[aria-expanded="true"] .to-change {
  display: none;
}

.chevron {
  width: 0.85rem;
  height: 0.85rem;
  flex: none;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 220ms var(--ease);
}

.to-button[aria-expanded="true"] .chevron {
  transform: rotate(180deg);
}

.to-row-read {
  padding-right: 1.25rem;
}

.as-me {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  min-width: 0;
  padding-left: 0.55rem;
}

.as-name {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.as-safety {
  flex: none;
  font-size: 1.05rem;
  letter-spacing: 0.08em;
}

/* Bodies: a writing field on the left, a catching tray on the right. */

.panel-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 1rem 1rem 0;
}

.message-input {
  display: block;
  flex: 1;
  width: 100%;
  min-height: 11rem;
  max-height: 55vh;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--field);
  font-size: 1.08rem;
  line-height: 1.55;
  resize: none;
  field-sizing: content;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.message-input::placeholder {
  color: var(--faint);
}

.message-input:focus {
  outline: none;
  border-color: color-mix(in oklab, var(--lock) 65%, var(--line));
  box-shadow: 0 0 0 4px var(--lock-soft);
}

.message-input.is-cipher {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  word-break: break-all;
}

.catch {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  width: 100%;
  min-height: 11rem;
  padding: 1.25rem;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--field);
  color: var(--text);
  text-align: center;
  transition:
    border-color 160ms ease,
    background-color 160ms ease,
    transform 200ms var(--ease);
}

.catch strong {
  color: var(--text);
  font-weight: 600;
}

.catch-drop {
  margin-top: 0.35rem;
  color: var(--faint);
  font-size: 0.8rem;
}

.catch.is-over {
  border-style: solid;
  border-color: var(--open);
  background: var(--open-soft);
  transform: scale(0.99);
}

.catch-art {
  display: grid;
  width: 3.25rem;
  height: 3.25rem;
  margin-bottom: 0.35rem;
  place-items: center;
  border-radius: 50%;
  background: var(--open-soft);
  color: var(--open);
  transition: transform 220ms var(--ease);
}

.catch-art svg {
  width: 1.9rem;
  height: 1.9rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.catch-title {
  font-weight: 600;
}

.catch-sub {
  max-width: 19rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

/* The message you just opened, shown where you pasted it. */
.latest {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 11rem;
  padding: 0.85rem 1rem 1rem;
  border: 1.5px solid color-mix(in oklab, var(--open) 45%, var(--line));
  border-radius: var(--radius);
  background: color-mix(in oklab, var(--open) 5%, var(--field));
  animation: latest-in 320ms var(--ease);
}

@keyframes latest-in {
  from {
    opacity: 0;
    transform: scale(0.985);
  }
}

.latest.is-flash {
  animation: latest-flash 900ms var(--ease);
}

@keyframes latest-flash {
  0% {
    box-shadow: 0 0 0 0 var(--open-soft);
  }
  35% {
    box-shadow: 0 0 0 8px var(--open-soft);
  }
  100% {
    box-shadow: 0 0 0 0 transparent;
  }
}

.latest.is-error {
  border-color: color-mix(in oklab, var(--bad) 50%, var(--line));
  background: color-mix(in oklab, var(--bad) 4%, var(--field));
}

.latest-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: -0.2rem 0 0.4rem;
}

.latest-close {
  font-size: 0.86rem;
}

.latest-label {
  color: var(--open);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.latest.is-error .latest-label {
  color: var(--bad);
}

.latest-body {
  display: grid;
  gap: 0.65rem;
  align-content: start;
}

.latest-body .entry-text {
  font-size: 1.15rem;
}

.latest-more {
  color: var(--muted);
  font-size: 0.85rem;
}

@media (max-width: 560px) {
  .latest {
    min-height: 8.5rem;
  }
}

/* Bars and feet mirror each other exactly. */

.panel-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 3rem;
  padding: 0.35rem 1.25rem 0.35rem 0.6rem;
}

.bar-button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.4rem;
  padding: 0.3rem 0.6rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 500;
  white-space: nowrap;
  transition:
    color 150ms ease,
    background-color 150ms ease;
}

@media (hover: hover) {
  .bar-button:hover {
    background: var(--surface-2);
    color: var(--text);
  }
}

.label-short,
.on-touch {
  display: none;
}

/* Phones and tablets: tap instructions instead of keyboard shortcuts. */
@media (hover: none) and (pointer: coarse) {
  .on-desktop {
    display: none;
  }

  .on-touch {
    display: inline;
  }
}

.as-link {
  padding: 0.3rem 0.1rem;
  border: 0;
  background: transparent;
}

.people-hint {
  margin: 0 0 0.6rem;
}

.id-buttons-hint {
  margin: 0 0 0.4rem;
  text-align: center;
}

.status {
  min-width: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
  text-align: right;
  text-wrap: balance;
}

.status[data-tone="warn"] {
  color: var(--warn);
}

.status[data-tone="decrypt"] {
  color: var(--open);
}

.status[data-tone="busy"]::before {
  content: "";
  display: inline-block;
  width: 0.45rem;
  height: 0.45rem;
  margin-right: 0.45rem;
  border-radius: 50%;
  background: var(--lock);
  vertical-align: 0.08em;
  animation: pulse 900ms ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.25;
  }
}

.panel-foot {
  padding: 0 1rem 1rem;
}

/* --------------------------------------------------------------- drawer */

.drawer {
  padding: 1rem 1.25rem 1.1rem;
  border-bottom: 1px solid var(--line);
  background: color-mix(in oklab, var(--surface-2) 45%, var(--surface));
  animation: drawer-in 240ms var(--ease);
}

@keyframes drawer-in {
  from {
    opacity: 0;
    transform: translateY(-0.35rem);
  }
}

.panel.is-collapsed .drawer {
  display: none;
}

.drawer-done {
  display: block;
  width: 100%;
  min-height: 2.6rem;
  margin-top: 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-weight: 600;
}

@media (hover: hover) {
  .drawer-done:hover {
    border-color: var(--line-strong);
  }
}

.onboard {
  margin-bottom: 0.9rem;
}

.onboard-title {
  font-weight: 600;
}

.steps {
  display: grid;
  gap: 0.85rem;
  margin-top: 0.85rem;
}

.steps li {
  display: flex;
  gap: 0.8rem;
}

.step-num {
  display: grid;
  width: 1.65rem;
  height: 1.65rem;
  flex: none;
  place-items: center;
  border-radius: 50%;
  background: var(--lock-soft);
  color: var(--lock);
  font-size: 0.85rem;
  font-weight: 700;
}

.step-body {
  display: grid;
  flex: 1;
  justify-items: start;
  gap: 0.35rem;
  min-width: 0;
}

.step-title {
  font-weight: 600;
  line-height: 1.65rem;
}

.step-body .hint {
  margin: 0;
}

/* People */

.people {
  display: grid;
  gap: 0.4rem;
  margin-bottom: 0.6rem;
}

.people:empty {
  display: none;
}

.person {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--field);
  transition:
    border-color 150ms ease,
    background-color 150ms ease;
}

.person.is-selected {
  border-color: var(--lock);
  background: var(--lock-soft);
}

.person-pick {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  min-height: 3rem;
  padding: 0.4rem 0.55rem 0.4rem 0.75rem;
  border: 0;
  background: transparent;
  text-align: left;
}

.person-check {
  position: relative;
  width: 1.15rem;
  height: 1.15rem;
  flex: none;
  border: 1.5px solid var(--line-strong);
  border-radius: 5px;
  transition:
    background-color 150ms ease,
    border-color 150ms ease;
}

.person.is-selected .person-check {
  border-color: var(--lock);
  background: var(--lock);
}

.person.is-selected .person-check::after {
  content: "";
  position: absolute;
  top: 0.12rem;
  left: 0.34rem;
  width: 0.3rem;
  height: 0.6rem;
  border: solid var(--lock-ink);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  animation: tick 220ms var(--spring);
}

@keyframes tick {
  from {
    transform: rotate(45deg) scale(0.4);
  }
}

.person-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.person-safety {
  padding: 0 0.6rem;
  border: 0;
  border-left: 1px solid var(--line);
  background: transparent;
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

@media (hover: hover) {
  .person-safety:hover {
    background: var(--surface-2);
  }
}

.person-remove {
  min-width: 2.75rem;
  border: 0;
  border-left: 1px solid var(--line);
  background: transparent;
  color: var(--faint);
  font-size: 1.15rem;
  line-height: 1;
}

@media (hover: hover) {
  .person-remove:hover {
    color: var(--bad);
  }

  .person:not(.is-selected):hover {
    border-color: var(--line-strong);
  }
}

.add-form {
  display: grid;
  gap: 0.45rem;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.add-form .label:not(:first-child) {
  margin-top: 0.35rem;
}

/* ------------------------------------------------------------ form parts */

.label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.88rem;
  font-weight: 600;
}

.add-form .label {
  margin-bottom: 0;
}

.label-optional {
  margin-left: 0.25rem;
  color: var(--faint);
  font-weight: 400;
}

.input {
  display: block;
  width: 100%;
  min-height: 2.75rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--field);
  font-size: 1rem;
  line-height: 1.35;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease;
}

textarea.input {
  resize: vertical;
}

.input::placeholder {
  color: var(--faint);
}

.input:focus {
  outline: none;
  border-color: var(--lock);
  box-shadow: 0 0 0 3px var(--lock-soft);
}

.input.is-invalid {
  border-color: var(--bad);
}

.input-mono {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  word-break: break-all;
}

.hint {
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.hint[data-tone="bad"] {
  color: var(--bad);
}

.hint[data-tone="warn"] {
  color: var(--warn);
}

.hint[data-tone="good"] {
  color: var(--open);
}

.note {
  margin-bottom: 0.8rem;
  padding: 0.65rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}

.note-warn {
  background: color-mix(in oklab, var(--warn) 12%, transparent);
  color: var(--warn);
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.7rem;
}

.row-even > * {
  flex: 1;
}

.row-fill {
  flex-wrap: nowrap;
}

.row-fill .input {
  flex: 1;
  min-width: 0;
}

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 2.75rem;
  padding: 0.5rem 1.1rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  transition:
    background-color 150ms ease,
    border-color 150ms ease,
    color 150ms ease,
    box-shadow 200ms ease,
    transform 150ms var(--ease),
    opacity 150ms ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  cursor: default;
  opacity: 0.7;
}

.btn-large {
  min-height: 3.35rem;
  border-radius: var(--radius);
  font-size: 1.02rem;
}

.btn-block {
  width: 100%;
}

.btn-small {
  min-height: 2.4rem;
  padding: 0.35rem 0.85rem;
  font-size: 0.9rem;
}

.btn-primary {
  background: var(--lock);
  color: var(--lock-ink);
}

.btn-open {
  background: var(--open);
  color: var(--open-ink);
}

@media (hover: hover) {
  .btn-primary:not(:disabled):hover,
  .btn-open:not(:disabled):hover {
    background: color-mix(in oklab, var(--tone, var(--lock)) 86%, var(--text));
    box-shadow: 0 10px 24px -14px var(--tone, var(--lock));
  }

  .btn-open:not(:disabled):hover {
    background: color-mix(in oklab, var(--open) 86%, var(--text));
    box-shadow: 0 10px 24px -14px var(--open);
  }
}

.btn-secondary {
  border-color: var(--line);
  background: var(--surface-2);
  color: var(--text);
}

@media (hover: hover) {
  .btn-secondary:not(:disabled):hover {
    border-color: var(--line-strong);
  }
}

.btn-ghost {
  border-color: var(--line);
  background: transparent;
  color: var(--text);
}

@media (hover: hover) {
  .btn-ghost:hover {
    background: var(--surface-2);
  }
}

.btn-danger {
  border-color: color-mix(in oklab, var(--bad) 45%, transparent);
  background: var(--bad-soft);
  color: var(--bad);
}

@media (hover: hover) {
  .btn-danger:hover {
    border-color: var(--bad);
  }
}

.btn-secondary.is-done,
.btn-ghost.is-done {
  border-color: color-mix(in oklab, var(--open) 45%, transparent);
  background: var(--open-soft);
  color: var(--open);
}

.btn.is-busy .btn-label::after {
  content: "";
  display: inline-block;
  width: 0.85em;
  height: 0.85em;
  margin-left: 0.55em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: -0.12em;
  animation: spin 700ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.btn-kbd {
  border-color: color-mix(in oklab, currentColor 28%, transparent);
  background: transparent;
  color: inherit;
  opacity: 0.7;
}

@media (hover: none) and (pointer: coarse) {
  .btn-kbd {
    display: none !important;
  }
}

.link-button {
  padding: 0.35rem 0;
  border: 0;
  background: transparent;
  color: var(--lock);
  font-size: 0.92rem;
  font-weight: 600;
}

@media (hover: hover) {
  .link-button:hover {
    text-decoration: underline;
    text-underline-offset: 0.2em;
  }
}

.icon-button {
  display: inline-grid;
  width: 2.5rem;
  height: 2.5rem;
  place-items: center;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
}

@media (hover: hover) {
  .icon-button:hover {
    background: var(--surface-2);
    color: var(--text);
  }
}

/* Small buttons made by app.js */
.chip-button {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2.2rem;
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.86rem;
  font-weight: 500;
  white-space: nowrap;
  transition:
    border-color 150ms ease,
    background-color 150ms ease,
    color 150ms ease;
}

@media (hover: hover) {
  .chip-button:hover {
    border-color: var(--line-strong);
    background: var(--surface-2);
  }
}

.chip-button.is-done {
  border-color: color-mix(in oklab, var(--open) 50%, transparent);
  color: var(--open);
}

.chip-reply {
  border-color: color-mix(in oklab, var(--lock) 45%, var(--line));
  color: var(--lock);
}

.chip-accent {
  border-color: color-mix(in oklab, var(--lock) 55%, var(--line));
  color: var(--lock);
}

/* ------------------------------------------------------------------ lists */

.session-rule {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  color: var(--faint);
  font-size: 0.82rem;
  text-align: center;
}

.session-rule span {
  max-width: 34rem;
}

.session-rule::before,
.session-rule::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.session-rule .link-button {
  font-size: 0.82rem;
}

.list {
  min-width: 0;
}

.list-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0.25rem 0.75rem;
  font-size: 1rem;
  font-weight: 650;
}

.list-count {
  min-width: 1.5rem;
  padding: 0 0.45rem;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.6;
  text-align: center;
}

.list-count:empty {
  display: none;
}

.feed-list {
  display: grid;
  gap: 0.65rem;
}

.entry {
  display: grid;
  gap: 0.55rem;
  min-width: 0;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  animation: entry-in 300ms var(--ease);
}

@keyframes entry-in {
  from {
    opacity: 0;
    transform: translateY(-0.4rem) scale(0.99);
  }
}

/* The conversation reads like a chat: theirs on the left, yours on the right,
   and notices (errors, progress) centred between them. */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.timeline > .entry {
  width: fit-content;
  max-width: min(88%, 36rem);
}

.entry--in {
  align-self: flex-start;
  border-color: color-mix(in oklab, var(--open) 32%, var(--line));
  border-radius: 20px 20px 20px 6px;
  background: color-mix(in oklab, var(--open) 6%, var(--surface));
}

.entry--out {
  align-self: flex-end;
  border-color: color-mix(in oklab, var(--lock) 32%, var(--line));
  border-radius: 20px 20px 6px 20px;
  background: color-mix(in oklab, var(--lock) 7%, var(--surface));
}

.timeline > .entry--error,
.timeline > .entry--busy {
  align-self: center;
  width: min(30rem, 100%);
  border-style: dashed;
  border-radius: var(--radius);
  background: transparent;
}

.entry--error {
  border-color: color-mix(in oklab, var(--bad) 45%, var(--line));
}

.entry--out .entry-head {
  justify-content: flex-end;
}

.entry--out .entry-actions {
  justify-content: flex-end;
}

.entry-sent-note {
  color: var(--faint);
  font-size: 0.8rem;
  text-align: right;
}

.entry-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}

.entry-who {
  display: inline-flex;
  flex: 1;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}

.entry-label {
  overflow: hidden;
  font-size: 0.92rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-time {
  flex: none;
  margin-left: auto;
  color: var(--faint);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.55rem;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
}

.meta-pill[data-tone="bad"] {
  background: color-mix(in oklab, var(--bad) 14%, transparent);
  color: var(--bad);
}

.entry-text {
  font-size: 1.06rem;
  line-height: 1.55;
  white-space: pre-wrap;
}

.entry--out .entry-text {
  text-align: left;
}

.entry--error .entry-text {
  font-size: 0.95rem;
}

/* Opening: text decodes from cipher characters into the real message. */
.entry-text.is-decoding {
  color: color-mix(in oklab, var(--open) 70%, var(--text));
}

.entry-cipher {
  display: block;
  overflow: hidden;
  color: var(--faint);
  font-size: 0.75rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.entry-actions-extra {
  display: contents;
}

.entry-note:empty {
  display: none;
}

.entry .hint {
  margin-top: 0;
}

.entry-file {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.file-badge {
  display: grid;
  width: 2.6rem;
  height: 2.6rem;
  flex: none;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.file-info {
  display: grid;
  min-width: 0;
}

.file-name {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-sub {
  color: var(--muted);
  font-size: 0.82rem;
}

.entry-preview {
  max-width: 100%;
  max-height: 22rem;
  justify-self: start;
  border-radius: var(--radius-sm);
  background: var(--field);
}

.entry-audio {
  width: 100%;
}

.entry-preview-text {
  max-height: 16rem;
  margin: 0;
  overflow: auto;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--field);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  white-space: pre-wrap;
}

.progress {
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}

.progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--lock);
  transition: width 120ms linear;
}

/* Avatars */

.avatar {
  display: inline-grid;
  width: 1.75rem;
  height: 1.75rem;
  flex: none;
  place-items: center;
  border-radius: 50%;
  background: var(--av-bg, var(--surface-2));
  color: var(--av-ink, var(--muted));
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1;
}

.avatar[data-hue="0"] { --av-bg: color-mix(in oklab, #4f8cff 24%, var(--surface)); --av-ink: color-mix(in oklab, #4f8cff 75%, var(--text)); }
.avatar[data-hue="1"] { --av-bg: color-mix(in oklab, #2fb67c 24%, var(--surface)); --av-ink: color-mix(in oklab, #2fb67c 75%, var(--text)); }
.avatar[data-hue="2"] { --av-bg: color-mix(in oklab, #e0883a 26%, var(--surface)); --av-ink: color-mix(in oklab, #e0883a 78%, var(--text)); }
.avatar[data-hue="3"] { --av-bg: color-mix(in oklab, #c25bd6 24%, var(--surface)); --av-ink: color-mix(in oklab, #c25bd6 75%, var(--text)); }
.avatar[data-hue="4"] { --av-bg: color-mix(in oklab, #e05a6b 24%, var(--surface)); --av-ink: color-mix(in oklab, #e05a6b 75%, var(--text)); }
.avatar[data-hue="5"] { --av-bg: color-mix(in oklab, #2bb3c0 24%, var(--surface)); --av-ink: color-mix(in oklab, #2bb3c0 75%, var(--text)); }

.avatar-you {
  width: auto;
  padding: 0 0.55rem;
  border-radius: 999px;
  background: var(--lock-soft);
  color: var(--lock);
  font-size: 0.72rem;
}

.person-pick .avatar {
  width: 1.6rem;
  height: 1.6rem;
  font-size: 0.75rem;
}

/* Filter chips: appear once Opened holds messages from two or more people */

.filters {
  display: flex;
  justify-content: safe center;
  gap: 0.4rem;
  margin: 0 0 1rem;
  padding-bottom: 0.2rem;
  overflow-x: auto;
  scrollbar-width: thin;
}

.filter {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.35rem;
  padding: 0.25rem 0.75rem 0.25rem 0.3rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.88rem;
  font-weight: 500;
  white-space: nowrap;
  transition:
    border-color 150ms ease,
    background-color 150ms ease;
}

.filter:first-child {
  padding-left: 0.85rem;
}

.filter .avatar {
  width: 1.6rem;
  height: 1.6rem;
  font-size: 0.72rem;
}

.filter[aria-pressed="true"] {
  border-color: var(--open);
  background: var(--open-soft);
  font-weight: 600;
}

@media (hover: hover) {
  .filter[aria-pressed="false"]:hover {
    border-color: var(--line-strong);
  }
}

.filter-count {
  min-width: 1.35rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
}

/* ------------------------------------------------------------ how it works */

.how {
  margin-top: 4rem;
  padding-top: 2.5rem;
  border-top: 1px solid var(--line);
  scroll-margin-top: 4.5rem;
}

.how > h2 {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 500;
  text-align: center;
}

.how-steps {
  display: grid;
  gap: 1.5rem;
  margin-top: 1.75rem;
}

.how-steps li {
  display: grid;
  justify-items: center;
  gap: 0.45rem;
  text-align: center;
}

.how-steps .step-num {
  width: 2.2rem;
  height: 2.2rem;
  font-size: 0.95rem;
}

.how-steps h3 {
  font-size: 1.02rem;
  font-weight: 650;
}

.how-steps p {
  max-width: 22rem;
  color: var(--muted);
}

.how-note {
  max-width: 40rem;
  margin: 1.75rem auto 0;
  color: var(--muted);
  text-align: center;
}

.how-details {
  display: grid;
  gap: 0.9rem;
  margin-top: 2rem;
}

.details {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 3.2rem;
  padding: 0.6rem 1.1rem;
  font-weight: 600;
  list-style: none;
  cursor: pointer;
}

.details > summary::-webkit-details-marker {
  display: none;
}

.details > summary::after {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  margin-left: 1rem;
  border: solid var(--muted);
  border-width: 0 1.6px 1.6px 0;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 220ms var(--ease);
}

.details[open] > summary::after {
  transform: rotate(-135deg) translateY(-2px);
}

.details > :not(summary) {
  margin-inline: 1.1rem;
}

.details > :last-child {
  margin-bottom: 1.1rem;
}

.defs {
  display: grid;
  gap: 0.75rem;
}

.defs > div {
  display: grid;
  gap: 0.1rem;
}

.defs dt {
  font-weight: 600;
}

.defs dd,
.bullets li {
  color: var(--muted);
}

.bullets {
  display: grid;
  gap: 0.5rem;
  padding-left: 1.1rem;
  list-style: disc;
}

.bullets-small {
  margin-bottom: 0.75rem;
  font-size: 0.88rem;
}

@media (min-width: 860px) {
  .how-steps,
  .how-details {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: start;
  }
}

/* ----------------------------------------------------------------- footer */

.footer {
  border-top: 1px solid var(--line);
}

.footer-inner {
  display: grid;
  justify-items: center;
  gap: 0.75rem;
  width: min(var(--page), calc(100% - var(--gutter)));
  margin-inline: auto;
  padding: 1.5rem 0 calc(1.5rem + env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: 0.86rem;
}

.footer-line {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

.footer a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 0.2em;
}

@media (hover: hover) {
  .footer a:hover {
    text-decoration-color: currentColor;
  }
}

.theme-switch {
  display: inline-flex;
  padding: 0.15rem;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.theme-option {
  min-height: 1.9rem;
  padding: 0.1rem 0.8rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.theme-option[aria-pressed="true"] {
  background: var(--surface-2);
  color: var(--text);
}

/* ----------------------------------------------------------------- dialog */

.dialog {
  width: min(30rem, calc(100% - 2rem));
  max-height: calc(100dvh - 2rem);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 30px 80px -20px rgb(0 0 0 / 55%);
  color: var(--text);
}

.dialog::backdrop {
  background: rgb(4 8 16 / 55%);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.dialog[open] {
  animation: dialog-in 240ms var(--ease);
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(0.5rem) scale(0.98);
  }
}

.dialog-card {
  display: grid;
  gap: 0.25rem;
  padding: 1.15rem 1.3rem 1.3rem;
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-right: -0.5rem;
}

.dialog-head h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 500;
}

.dialog-lede {
  margin-bottom: 0.75rem;
  color: var(--muted);
  font-size: 0.95rem;
}

/* The ID itself is long (it carries a post-quantum key); show a short preview. */
.id-box {
  display: block;
  max-height: 4.6em;
  overflow: hidden;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--field);
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.5;
  word-break: break-all;
  user-select: all;
  -webkit-mask-image: linear-gradient(#000 45%, transparent);
  mask-image: linear-gradient(#000 45%, transparent);
}

.dialog .row {
  margin-bottom: 0.4rem;
}

.dialog .details {
  margin-top: 0.9rem;
  background: var(--field);
}

.dialog .details .hint {
  margin-top: 0;
  margin-bottom: 0.6rem;
}

.transfer-form {
  margin-top: 0.9rem;
}

/* Safety emoji */

.safety-block {
  margin: 0.6rem 0 1rem;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--field);
}

.safety-title {
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
}

.safety-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.55rem 0.35rem;
  margin: 0.7rem 0 0.2rem;
}

.safety-item {
  display: grid;
  justify-items: center;
  gap: 0.15rem;
  min-width: 0;
  text-align: center;
}

.safety-emoji {
  font-size: 1.8rem;
  line-height: 1.1;
}

/* No clipping: descenders (g, y) and slightly wide names must show in full.
   Long names ("statue of liberty") wrap onto a second line instead. */
.safety-name {
  max-width: 100%;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
  overflow-wrap: break-word;
  text-wrap: balance;
}

.safety-block .hint {
  margin-top: 0.55rem;
  text-align: center;
}

/* ------------------------------------------------------------------- tour */

.how-cta {
  margin-top: 0.85rem;
  text-align: center;
}

.onboard-title .link-button {
  margin-left: 0.35rem;
  font-size: inherit;
}

.tour {
  width: min(34rem, calc(100% - 2rem));
  overflow: hidden;
}

/* The top row and the Back / Next row stay put; only the step scrolls if the screen is short. */
.tour-card {
  display: flex;
  flex-direction: column;
  min-height: min(33rem, calc(100dvh - 2rem));
  max-height: calc(100dvh - 2rem);
  padding: 1rem 1.4rem 1.2rem;
}

.tour-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 2rem;
}

.tour-count {
  color: var(--faint);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.tour-skip {
  color: var(--muted);
  font-weight: 500;
}

.tour-step {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  margin-inline: -0.25rem;
  padding-inline: 0.25rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  animation: step-in 300ms var(--ease);
}

.tour-step.is-back {
  animation-name: step-back;
}

@keyframes step-in {
  from {
    opacity: 0;
    transform: translateX(1.25rem);
  }
}

@keyframes step-back {
  from {
    opacity: 0;
    transform: translateX(-1.25rem);
  }
}

.tour-visual {
  display: grid;
  min-height: 9rem;
  margin: 0.4rem 0 1rem;
  padding: 1.1rem;
  place-items: center;
  border-radius: var(--radius);
  background:
    radial-gradient(120% 90% at 50% 0%, var(--lock-soft), transparent 70%),
    var(--field);
  border: 1px solid var(--line);
}

.tour-title {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.01em;
  text-align: center;
  text-wrap: balance;
}

.tour-text {
  margin: 0.5rem auto 0.85rem;
  max-width: 28rem;
  color: var(--muted);
  text-align: center;
  text-wrap: pretty;
}

.tour-text strong {
  color: var(--text);
  font-weight: 600;
}

.tour-fine {
  margin-top: auto;
  padding-top: 0.75rem;
  color: var(--faint);
  font-size: 0.84rem;
  text-align: center;
}

.tour-step .label {
  margin-top: 0.25rem;
}

.tour-step .input + .label {
  margin-top: 0.75rem;
}

.tour-step .row {
  margin-top: 0.75rem;
}

.tour-nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.tour-nav #tour-back {
  justify-self: start;
}

.tour-nav #tour-next {
  justify-self: end;
  min-width: 7.5rem;
}

.tour-nav #tour-back[disabled] {
  visibility: hidden;
}

.tour-dots {
  display: flex;
  gap: 0.4rem;
}

.tour-dots li {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 999px;
  background: var(--line-strong);
  transition:
    width 260ms var(--ease),
    background-color 200ms ease;
}

.tour-dots li.is-on {
  width: 1.35rem;
  background: var(--lock);
}

.tour-dots li.is-done {
  background: color-mix(in oklab, var(--lock) 55%, var(--line-strong));
}

.tour-dots li.is-skipped {
  opacity: 0.35;
}

/* 1. Flow: what each side sees */

.flow {
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1.15fr) auto minmax(0, 1fr);
  gap: 0.5rem;
  align-items: end;
  align-content: center;
  width: 100%;
}

.flow-arrow {
  width: 1.4rem;
  height: 0.75rem;
  margin-bottom: 0.85rem;
  fill: none;
  stroke: var(--line-strong);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.flow-side,
.flow-mid {
  display: grid;
  justify-items: center;
  gap: 0.45rem;
  min-width: 0;
  text-align: center;
}

.flow-who {
  color: var(--faint);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.bubble {
  max-width: 100%;
  padding: 0.55rem 0.75rem;
  border-radius: 16px;
  font-size: 0.88rem;
  line-height: 1.35;
}

.bubble-plain {
  border-bottom-left-radius: 5px;
  background: var(--lock);
  color: var(--lock-ink);
  font-weight: 500;
}

.bubble-them {
  border-bottom-left-radius: 16px;
  border-bottom-right-radius: 5px;
  background: var(--open);
  color: var(--open-ink);
}

.bubble-cipher {
  overflow: hidden;
  width: 100%;
  border: 1px dashed var(--line-strong);
  background: var(--surface);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  white-space: nowrap;
  text-overflow: clip;
}

/* 2. Address card */

.address-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: min(21rem, 100%);
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  transform: rotate(-1.5deg);
}

.address-lines {
  display: grid;
  min-width: 0;
  gap: 0.2rem;
}

.address-name {
  overflow: hidden;
  font-family: var(--font-display);
  font-size: 1.2rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.address-id {
  overflow: hidden;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.address-stamp {
  position: absolute;
  top: -0.7rem;
  right: 0.8rem;
  padding: 0.15rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--field);
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  transform: rotate(4deg);
}

.avatar-lg {
  width: 2.75rem;
  height: 2.75rem;
  font-size: 1.1rem;
}

.avatar-me {
  background: var(--lock-soft);
  color: var(--lock);
}

/* 3. Swap */

.swap {
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.75rem;
  width: 100%;
}

.swap-card {
  display: grid;
  justify-items: center;
  gap: 0.35rem;
  width: 5.5rem;
}

.swap-name {
  font-size: 0.85rem;
  font-weight: 600;
}

.swap-arrows {
  display: grid;
  justify-items: center;
  gap: 0.25rem;
  color: var(--faint);
  font-size: 0.75rem;
}

.swap-arrows svg {
  width: min(8rem, 100%);
  fill: none;
  stroke: var(--line-strong);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* 4. Compare */

.compare {
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 0.75rem;
  width: 100%;
}

.compare-side {
  display: grid;
  justify-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.compare-label {
  overflow: hidden;
  max-width: 100%;
  color: var(--faint);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.compare-emoji {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.2rem 0.35rem;
  font-size: 1.35rem;
  line-height: 1.2;
}

.compare-eq {
  color: var(--faint);
  font-size: 1.3rem;
}

/* 5. Twin cards */

.twin {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  width: 100%;
}

.twin-card {
  display: grid;
  justify-items: center;
  gap: 0.3rem;
  padding: 0.9rem 0.5rem;
  border: 1px solid var(--line);
  border-top: 3px solid var(--lock);
  border-radius: var(--radius-sm);
  background: var(--surface);
  text-align: center;
}

.twin-read {
  border-top-color: var(--open);
}

.twin-card .lock {
  width: 1.5rem;
  height: 1.5rem;
  color: var(--lock);
}

.twin-read .lock {
  color: var(--open);
}

.twin-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
}

.twin-step {
  color: var(--muted);
  font-size: 0.82rem;
}

@media (max-width: 560px) {
  .tour {
    width: 100%;
    max-width: none;
    height: 100dvh;
    max-height: none;
    margin: 0;
    border: 0;
    border-radius: 0;
  }

  .tour-card {
    min-height: 100dvh;
    max-height: 100dvh;
    padding: calc(0.75rem + env(safe-area-inset-top)) 1.1rem calc(1rem + env(safe-area-inset-bottom));
  }

  .tour-visual {
    min-height: 9rem;
    padding: 0.85rem;
  }

  .tour-title {
    font-size: 1.45rem;
  }

  .flow {
    gap: 0.3rem;
  }

  .flow-arrow {
    width: 0.9rem;
  }

  .bubble {
    padding: 0.45rem 0.55rem;
    font-size: 0.8rem;
  }

  .compare-emoji {
    font-size: 1.1rem;
  }
}

/* ---------------------------------------------------------- drop + toast */

.dropzone {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: color-mix(in oklab, var(--bg) 78%, transparent);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  pointer-events: none;
  animation: fade-in 160ms ease;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

.dropzone-inner {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: min(34rem, 100%);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.dropzone-half {
  display: grid;
  justify-items: center;
  gap: 0.3rem;
  padding: 2.25rem 1.25rem;
  border: 2px dashed var(--lock);
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  color: var(--muted);
  text-align: center;
}

.dropzone-half + .dropzone-half {
  border-color: var(--open);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  border-left-width: 0;
}

.dropzone-half .lock {
  width: 2rem;
  height: 2rem;
  margin-bottom: 0.4rem;
  color: var(--lock);
}

.dropzone-half + .dropzone-half .lock {
  color: var(--open);
}

.dropzone-title {
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 650;
}

.toast {
  position: fixed;
  /* Undo the browser's default popover box (centred, bordered, scrolling). */
  inset: auto auto calc(1.25rem + env(safe-area-inset-bottom)) 50%;
  width: max-content;
  height: auto;
  margin: 0;
  border: 0;
  overflow: visible;
  z-index: 110;
  max-width: calc(100% - 2rem);
  padding: 0.65rem 1.15rem;
  border-radius: 999px;
  background: var(--text);
  box-shadow: var(--shadow);
  color: var(--bg);
  font-size: 0.92rem;
  font-weight: 600;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 0.6rem);
  transition:
    opacity 180ms ease,
    transform 260ms var(--spring);
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast[data-tone="bad"] {
  background: var(--bad);
  color: #1a0505;
}

/* ------------------------------------------------------------------ phone */

@media (max-width: 560px) {
  :root {
    --gutter: 1.5rem;
  }

  .page {
    padding-top: 1rem;
  }

  .topbar-inner {
    min-height: 3.5rem;
  }

  .topbar-link:not(.topbar-id) .topbar-label,
  .label-long {
    display: none;
  }

  .label-short {
    display: inline;
  }

  .topbar-link:not(.topbar-id) {
    width: 2.5rem;
    justify-content: center;
    padding: 0;
  }

  .topbar-id {
    padding: 0.35rem 0.75rem;
  }

  .wordmark {
    font-size: 1.65rem;
  }

  .intro {
    margin-bottom: 1.25rem;
  }

  .intro h1 {
    font-size: 1.75rem;
  }

  .intro p {
    font-size: 0.98rem;
  }

  .panel-head {
    padding: 1rem 1rem 0.85rem;
  }

  .to-row {
    padding-left: 1rem;
  }

  .to-row-read {
    padding-right: 1rem;
  }

  .drawer {
    padding: 0.9rem 1rem 1rem;
  }

  .panel-body {
    padding: 0.85rem 0.85rem 0;
  }

  .message-input,
  .catch {
    min-height: 8.5rem;
  }

  .panel-bar {
    padding-right: 1rem;
  }

  .panel-foot {
    padding: 0 0.85rem 0.85rem;
  }

  .catch-art {
    width: 2.75rem;
    height: 2.75rem;
  }

  .catch-art svg {
    width: 1.6rem;
    height: 1.6rem;
  }

  .dropzone-inner {
    grid-template-columns: minmax(0, 1fr);
  }

  .timeline > .entry {
    max-width: 94%;
  }

  .session-rule {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.15rem 0.6rem;
    text-align: center;
  }

  .session-rule::before,
  .session-rule::after {
    display: none;
  }

  .dropzone-half,
  .dropzone-half + .dropzone-half {
    border-width: 2px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  .dropzone-half + .dropzone-half {
    border-top-width: 0;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}
