/* Self-hosted so the strict CSP (font-src 'self', no CDN) never has to
   change; see clients/web/fonts/quicksand/OFL.txt for license terms. A
   rounder, friendlier letterform than a plain system-UI stack without
   tipping into anything cutesy — used everywhere, not just headings. */
@font-face {
  font-family: "Quicksand";
  src: url("/fonts/quicksand/Quicksand-Variable.ttf") format("truetype");
  font-weight: 300 700;
  font-display: swap;
}

/* Theme tokens are injected by app.js from /v1/themes (see themes.json).
   Defaults below mirror the "rose" theme (the app default) so the shell
   renders in the right colors before JS applies the fetched theme. */
:root {
  --c-background: #FCE4EC;
  --c-surface: #FFFFFF;
  --c-text: #3D1F2A;
  --c-muted: #9A6B78;
  --c-accent: #E8567A;
  --c-accent-text: #FFFFFF;
  --c-border: #F4D6DE;
  --c-success: #12A594;
  --c-danger: #D6455D;

  --radius: 14px;
  --gap: 16px;
  --maxw: 640px;
  font-family: Quicksand, ui-rounded, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* Roomier on big screens: the main column grows and everything breathes.
   ~720-900px content width is the standard readable band for a simple app. */
@media (min-width: 900px) {
  :root { --maxw: 760px; --gap: 24px; }
}
@media (min-width: 1280px) {
  :root { --maxw: 860px; }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--c-background);
  color: var(--c-text);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0);
}

/* Topbar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--c-border);
  background: var(--c-surface);
  position: sticky; top: 0; z-index: 5;
  padding-top: max(14px, env(safe-area-inset-top));
}
.brand { font-weight: 800; font-size: 1.3rem; letter-spacing: -0.02em; }
.brand-u { color: var(--c-accent); }
.topbar-actions { display: flex; gap: 10px; align-items: center; }

/* Layout */
.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: var(--gap);
  display: flex; flex-direction: column; gap: var(--gap);
}
.view { display: flex; flex-direction: column; gap: var(--gap); }

.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 18px;
}

.section-title { margin: 0 0 12px; font-size: 1.05rem; }
.muted { color: var(--c-muted); }
.small { font-size: 0.88rem; }
.hint { color: var(--c-muted); font-size: 0.85rem; margin: 10px 0 0; }
#missu-hint { min-height: 1.4em; margin: 10px 0 0; }
#missu-hint[hidden] { display: block; visibility: hidden; }

/* Forms */
.input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--c-border);
  border-radius: 10px;
  background: var(--c-background);
  color: var(--c-text);
  font-size: 1rem;
}
.input:focus { outline: 2px solid var(--c-accent); outline-offset: 1px; }
.row { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.row .input { flex: 1 1 auto; }

/* A personal API token, shown exactly once — monospace so it's easy to eyeball-verify a copy. */
.token-value { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.85rem; }
.api-token-reveal {
  margin-top: 12px;
  padding: 12px;
  border: 1px dashed var(--c-accent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--c-accent) 8%, transparent);
}
.api-token-reveal .hint { margin-top: 0; }

.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 11px 16px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: filter .12s ease, background .12s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--c-accent); color: var(--c-accent-text); }
.btn-primary:hover { filter: brightness(1.05); }
.btn-ghost { background: transparent; color: var(--c-text); border-color: var(--c-border); }
.btn-ghost:hover { background: var(--c-background); }
.btn-sm { padding: 7px 12px; font-size: 0.85rem; }

.form-msg { margin: 12px 0 0; min-height: 1.2em; font-size: 0.9rem; }
.form-msg.error { color: var(--c-danger); }
.form-msg.ok { color: var(--c-success); }

.auth-card { text-align: center; margin-top: 6vh; }
.auth-title { font-size: 1.5rem; margin: 0 0 6px; letter-spacing: -0.02em; }
.auth-card form { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; text-align: left; }
.btn-block { width: 100%; }
.auth-forgot { text-align: right; margin-top: -4px; }
.auth-forgot .link-quiet, .auth-alt .link-quiet { margin-top: 0; }
.auth-alt { margin: 14px 0 0; }
.theme-picker select {
  padding: 8px 10px; border-radius: 10px;
  border: 1px solid var(--c-border);
  background: var(--c-background); color: var(--c-text);
}
.toggle-row {
  display: flex; align-items: center; gap: 8px; margin-top: 12px;
  font-size: 0.95rem; cursor: pointer;
}
.toggle-row input { width: 18px; height: 18px; accent-color: var(--c-accent); }

/* Profile / avatar */
.profile-card { display: flex; gap: 16px; align-items: center; }
.avatar-wrap { flex: 0 0 auto; position: relative; }
.profile-card .avatar-wrap { width: 64px; height: 64px; flex: 0 0 64px; position: relative; border-radius: 50%; }
.avatar {
  width: 64px; height: 64px; border-radius: 50%;
  object-fit: cover; border: 2px solid var(--c-border);
  display: grid; place-items: center; font-size: 1.8rem;
  background: var(--c-background);
}
.profile-card .avatar { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
.avatar-placeholder { color: var(--c-muted); }
/* .avatar sets display:grid, which would otherwise override the `hidden`
   attribute's display:none — so the img and placeholder both showed as two
   stacked circles. This makes hiding the <img hidden> actually work. */
.avatar[hidden] { display: none; }
.profile-meta { flex: 1 1 auto; min-width: 0; }
.profile-email { font-weight: 700; word-break: break-all; }
.profile-controls { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }

/* Lists */
.list { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.list-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border: 1px solid var(--c-border); border-radius: 10px;
}
.list-item .email { word-break: break-all; }
.email-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.badge {
  font-size: 0.72rem; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.badge-connected { background: color-mix(in srgb, var(--c-success) 18%, transparent); color: var(--c-success); }
.badge-pending { background: color-mix(in srgb, var(--c-muted) 16%, transparent); color: var(--c-muted); }
.link-danger { background: none; border: none; color: var(--c-danger); cursor: pointer; font-size: 0.85rem; }
/* A quiet inline-link button: the auth mode toggle, "Forgot password?" —
   anything secondary enough that it shouldn't compete with a real .btn. */
.link-quiet {
  background: none; border: none; color: var(--c-muted); cursor: pointer;
  font-size: 0.85rem; text-decoration: underline; margin-top: 12px; display: inline-block;
}
.link-quiet:hover { color: var(--c-text); }

/* Connections */
.connections { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 6px; }
.conn-card {
  border: 1px solid var(--c-border); border-radius: var(--radius);
  padding: 14px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.conn-card .avatar { width: 72px; height: 72px; }
.conn-email { font-size: 0.85rem; word-break: break-all; color: var(--c-muted); }
.missu-btn {
  background: var(--c-accent); color: var(--c-accent-text);
  border: none; border-radius: 999px; padding: 10px 18px; font-weight: 700; cursor: pointer; width: 100%;
}
.missu-btn:hover { filter: brightness(1.05); }
.missu-btn:disabled { opacity: .6; cursor: default; }

/* The one person + green-light status */
.person { margin-top: 16px; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.status-row { display: flex; align-items: center; gap: 10px; }
.light {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--c-muted);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--c-muted) 16%, transparent);
  transition: background .2s ease, box-shadow .2s ease;
}
.light.on {
  background: var(--c-success);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--c-success) 28%, transparent);
}
.person .avatar { width: 88px; height: 88px; }
.missu-btn-lg { width: auto; padding: 14px 28px; font-size: 1.05rem; }

/* Icon button (settings gear, dialog close) */
.icon-btn {
  background: transparent; border: 1px solid var(--c-border);
  border-radius: 10px; padding: 8px 11px; font-size: 1.05rem;
  line-height: 1; cursor: pointer; color: var(--c-text);
  position: relative;
}
.icon-btn:hover { background: var(--c-background); }

/* Inbox badge on the messages icon */
.inbox-badge {
  position: absolute; top: -5px; right: -5px;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--c-accent); color: var(--c-accent-text);
  font-size: 0.65rem; font-weight: 700; line-height: 18px; text-align: center;
}

/* Focused main stage: their face, status, one big button */
.stage {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 20px; text-align: center;
  min-height: calc(100dvh - 140px);
}
.person-card, .empty-state {
  display: flex; flex-direction: column; align-items: center; gap: 18px; width: 100%;
}

/* Opt-in mirror: "their view" is a picture-in-picture chip pinned to the
   card's top-right corner — the video-call self-view pattern — so it reads
   as clearly secondary to your view instead of a competing second card. */
.views { display: flex; justify-content: center; gap: 28px; width: 100%; flex-wrap: wrap; }
.person-card { position: relative; }
.person-card.mirrored {
  flex: 0 1 500px; max-width: 500px;
  border: 1px solid var(--c-border); border-radius: var(--radius);
  background: var(--c-surface); padding: 22px 16px;
}
.mirror-card {
  position: absolute; top: -14px; right: -14px; z-index: 1;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  width: 176px; max-width: 100%; box-sizing: border-box; padding: 10px 10px 12px;
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: 14px; box-shadow: 0 8px 22px rgba(0,0,0,0.16);
}
.mirror-card .view-label { font-size: 0.6rem; }
.mirror-card .avatar-wrap { width: 54px; height: 54px; flex: 0 0 54px; position: relative; border-radius: 50%; }
.mirror-card .avatar { position: absolute; top: 0; left: 0; width: 100%; height: 100%; font-size: 1.5rem; border-width: 2px; }
.mirror-card .their-name { font-size: 0.85rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mirror-card .last-lines { gap: 1px; min-height: 0; max-width: 100%; min-width: 0; }
/* One line each, ellipsized by default — keeps the chip from ever growing
   past its own bounds. .mirror-card.expanded (toggled by #mirror-expand)
   lets the text wrap instead, which can only grow the chip's height, never
   its width, since width stays capped above. */
.mirror-card .last-line {
  font-size: 0.64rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 100%; min-width: 0;
}
.mirror-card.expanded .last-line { overflow: visible; text-overflow: unset; white-space: normal; }
.mirror-expand {
  background: none; border: none; padding: 2px 4px; margin-top: -2px;
  color: var(--c-accent); font-size: 0.62rem; font-weight: 700; cursor: pointer;
}
.mirror-expand:hover { text-decoration: underline; }
/* Show/hide lives on the chip itself (never in a menu): a ✕ on the chip,
   and a quiet pill in the same corner to bring it back. */
.mirror-hide {
  position: absolute; top: 3px; right: 5px;
  background: none; border: none; padding: 3px; cursor: pointer;
  color: var(--c-muted); font-size: 0.8rem; line-height: 1;
}
.mirror-hide:hover { color: var(--c-text); }
.mirror-show {
  position: absolute; top: 0; right: 0; z-index: 1;
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--c-muted);
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: 999px; padding: 7px 13px; cursor: pointer;
}
.mirror-show:hover { color: var(--c-text); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
/* Narrow screens: no free corner to pin to — dock the chip in-flow as a
   compact strip above the card content instead. */
@media (max-width: 560px) {
  /* relative, not static: keeps the ✕ anchored to the chip while it's in flow */
  .mirror-card {
    position: relative; top: auto; right: auto; align-self: center;
    /* width:auto with min-width:0 lets this flex item shrink to the card's
       content box instead of being forced wide by nowrap text below it —
       without min-width:0 a flex item's default min-width is its content's
       min-content size, which for white-space:nowrap text is the full
       unwrapped line, and that's what was pushing the chip past the card. */
    width: 100%; min-width: 0; max-width: 100%;
    padding: 8px 22px 10px; box-shadow: none;
    background: var(--c-background);
  }
  .mirror-show { position: static; align-self: center; order: -1; }
}
.view-label {
  font-size: 0.72rem; font-weight: 700; color: var(--c-muted);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.avatar-wrap.avatar-xl { width: 148px; height: 148px; flex: 0 0 148px; border-radius: 50%; position: relative; }
.avatar-xl .avatar {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  font-size: 3.6rem; border-width: 3px;
}
@media (min-width: 900px) {
  .avatar-wrap.avatar-xl { width: 180px; height: 180px; flex: 0 0 180px; }
  .avatar-xl .avatar { font-size: 4.4rem; }
  .stage { gap: 26px; }
  .person-card, .empty-state { gap: 22px; }
}
.their-name { font-size: 1.35rem; font-weight: 700; letter-spacing: -0.01em; word-break: break-word; min-height: 1.4em; }
.their-email { font-size: 1.05rem; color: var(--c-muted); word-break: break-all; min-height: 1.2em; }
.their-email:empty { visibility: hidden; }

/* Scoreboard: "U Missed" count | avatar | "Missed U" count (toggle in Settings) */
.avatar-row {
  display: flex; align-items: center; justify-content: center; gap: 22px;
  min-height: 148px;
}
@media (min-width: 900px) {
  .avatar-row { min-height: 180px; }
}
/* max-width + word-break keep a long counterpart name from ever widening
   this column past what the avatar-row has to give it — it wraps to extra
   lines instead of pushing the row wider than the card. */
.score { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 74px; max-width: 100px; }
.score-num { font-size: 1.9rem; font-weight: 800; color: var(--c-accent); line-height: 1; }
.score-label {
  font-size: 0.7rem; font-weight: 700; color: var(--c-muted);
  text-transform: uppercase; letter-spacing: 0.05em; word-break: break-word;
}
.score-name { text-transform: none; }
/* The crown floats above the number it's crowning rather than sitting in
   the label text — margin-top reserves room for it so it never clips into
   whatever's above the scoreboard. */
.score-num-wrap { position: relative; display: inline-block; margin-top: 15px; }
.score-crown {
  position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%) rotate(-8deg);
  font-size: 1.05rem; line-height: 1; margin-bottom: -6px;
}
/* Smaller, italic, and lighter than the label above it — a quiet detail,
   not competing with the count for attention. */
.score-time {
  display: block; font-size: 0.62rem; font-style: italic; color: var(--c-muted);
  opacity: 0.75; margin-top: 1px; min-height: 1.2em;
}
.score-time[hidden] { display: block; visibility: hidden; }

/* Always-visible "Casey missed u 10 minutes ago" lines */
.last-lines { display: flex; flex-direction: column; justify-content: center; gap: 4px; min-height: 2.85em; }
.last-line { margin: 0; font-size: 0.95rem; color: var(--c-muted); }
.last-line:first-child { color: var(--c-text); font-weight: 600; }
.missu-huge {
  background: var(--c-accent); color: var(--c-accent-text); border: none;
  border-radius: 26px; padding: 30px 24px; font-size: 1.7rem; font-weight: 800;
  width: 100%; max-width: 440px; cursor: pointer;
  box-shadow: 0 12px 34px rgba(0,0,0,0.18);
  transition: filter .12s ease, transform .06s ease;
}
.missu-huge:hover { filter: brightness(1.05); }
.missu-huge:active { transform: translateY(2px); }
.missu-huge:disabled { opacity: .5; cursor: default; box-shadow: none; }

/* Settings dialog: everything that isn't the button */
.settings-dialog {
  border: none; border-radius: 16px; padding: 0;
  width: min(560px, 94vw); max-height: 90dvh; overflow: auto;
  background: var(--c-surface); color: var(--c-text);
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  margin-top: 20px;
  margin-bottom: auto;
}
.settings-dialog::backdrop { background: rgba(0,0,0,0.5); }
.settings-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid var(--c-border);
  position: sticky; top: 0; background: var(--c-surface);
  z-index: 1;
}

/* Settings workspace: sidebar-nav pattern on wide screens. The nav is hidden
   on mobile, where the sections simply stack and scroll as before. */
.settings-nav { display: none; }

@media (min-width: 880px) {
  .settings-workspace[open] {
    width: min(1040px, 94vw);
    height: min(86dvh, 900px);
    display: flex; flex-direction: column;
    overflow: hidden; /* the content pane scrolls, not the dialog */
    margin-top: 4dvh;
  }
  .settings-workspace .settings-head { position: static; flex: none; }
  .settings-body { display: flex; flex: 1; min-height: 0; }
  .settings-nav {
    display: flex; flex-direction: column; gap: 2px;
    flex: none; width: 220px;
    padding: 18px 12px;
    border-right: 1px solid var(--c-border);
    overflow-y: auto;
  }
  .settings-nav-link {
    display: block; padding: 9px 12px;
    border-radius: 8px;
    color: var(--c-muted); text-decoration: none;
    font-size: 0.92rem; font-weight: 600;
  }
  .settings-nav-link:hover { background: var(--c-background); color: var(--c-text); }
  .settings-nav-link.active { background: var(--c-background); color: var(--c-accent); }
  .settings-content { flex: 1; min-width: 0; overflow-y: auto; scroll-behavior: smooth; }
  .settings-workspace .settings-section { padding: 24px 28px; }
  .settings-workspace .settings-foot { padding: 24px 28px; }
}
.settings-head h2 { margin: 0; font-size: 1.15rem; }
.settings-section { padding: 16px 18px; border-bottom: 1px solid var(--c-border); }
.settings-section h3 {
  margin: 0 0 12px; font-size: 0.8rem; color: var(--c-muted);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.settings-section .link-danger { margin-top: 10px; }
.settings-foot { padding: 16px 18px; }

/* Message inbox */
.inbox-head-actions { display: flex; gap: 8px; align-items: center; }
.inbox-empty { padding: 32px 18px; text-align: center; }
.inbox-list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 10px;
  padding: 16px 18px;
}
.inbox-item {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px; border: 1px solid var(--c-border); border-radius: var(--radius);
  background: var(--c-surface); text-align: left;
}
.inbox-item.unread {
  border-left: 4px solid var(--c-accent);
  background: color-mix(in srgb, var(--c-accent) 5%, var(--c-surface));
}
.inbox-item.read { opacity: 0.75; }
.inbox-item.sent { border-right: 4px solid var(--c-border); }
.inbox-item.received { border-left: 1px solid var(--c-border); }
.inbox-body { flex: 1 1 auto; min-width: 0; }
.inbox-message { margin: 0 0 6px; line-height: 1.5; word-break: break-word; }
.inbox-item.unread .inbox-message { font-weight: 600; }
.inbox-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.inbox-from { font-size: 0.8rem; font-weight: 600; color: var(--c-accent); }
.inbox-time { color: var(--c-muted); font-size: 0.8rem; }
.inbox-dismiss { flex: none; margin-top: 2px; }

.loading-overlay:not([open]) { display: none; }
.loading-overlay[open] {
  position: fixed;
  inset: 0;
  margin: 0;
  padding: 0;
  max-width: none;
  max-height: none;
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
}
.loading-overlay::backdrop {
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(2px);
}
.loading-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 28px 36px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  color: var(--c-text);
  font-size: 1rem;
}
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--c-border);
  border-top-color: var(--c-accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Collapsible chatbot-host rows on the landing page: one slim row per host so
   the length of the list reads at a glance; click to expand instructions. */
.host-list {
  display: flex; flex-direction: column;
  margin-top: 12px;
  border: 1px solid var(--c-border); border-radius: 10px;
  background: var(--c-surface);
  overflow: hidden;
}
.host-row { border-bottom: 1px solid var(--c-border); }
.host-row:last-child { border-bottom: none; }
.host-row summary {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  list-style: none;
  font-size: 0.9rem;
}
.host-row summary::-webkit-details-marker { display: none; }
.host-row summary::before {
  content: "▸"; flex: none; color: var(--c-muted);
  font-size: 0.7rem; transition: transform .12s ease;
}
.host-row[open] summary::before { transform: rotate(90deg); }
.host-row summary:hover { background: var(--c-background); }
.host-row summary strong { flex: none; }
.host-preview {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--c-muted); font-size: 0.82rem;
}
.host-row[open] .host-preview { visibility: hidden; }
.host-body {
  padding: 2px 12px 12px 32px;
  color: var(--c-muted); font-size: 0.9rem;
  overflow-wrap: anywhere;
}
.host-body code {
  background: var(--c-background);
  padding: 1px 5px; border-radius: 5px;
}
/* A full snippet inside a row: let the <pre> own the framing, not the inline
   code chip above, and keep long lines scrollable rather than squeezing. */
.host-body .code-block { margin: 6px 0 0; padding: 10px 12px; font-size: 0.82rem; }
.host-body .code-block code { background: none; padding: 0; }

/* Toasts */
.toast-wrap {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 16px; padding-bottom: max(16px, env(safe-area-inset-bottom));
  pointer-events: none;
}
.toast {
  background: var(--c-surface); color: var(--c-text);
  border: 1px solid var(--c-border); border-left: 4px solid var(--c-accent);
  border-radius: 10px; padding: 12px 16px; max-width: var(--maxw); width: 100%;
  box-shadow: 0 8px 30px rgba(0,0,0,0.18);
  animation: toast-in .18s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
/* The self-update notice: persistent + actionable, so it needs pointer events
   (the wrap disables them for fire-and-forget toasts). */
.toast-update {
  pointer-events: auto;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.toast-action {
  flex: none; border: 0; background: none; cursor: pointer;
  color: var(--c-accent); font: inherit; font-weight: 600; padding: 4px 8px;
}

/* ---- Landing / sales page (signed out only) -------------------------------
   Same theme tokens as the app — a visitor who signs up should recognise the
   place they land in. The app view stays at --maxw; only this view widens,
   since marketing copy at 640px reads like a receipt. */
.landing { gap: 40px; }
.container:has(.landing:not(.hidden)) { max-width: 860px; }

.hero { text-align: center; padding-top: 4vh; }
.hero-title {
  font-size: clamp(2rem, 6vw, 3rem);
  line-height: 1.1; letter-spacing: -0.03em;
  margin: 0 0 16px;
}
.hero-sub {
  color: var(--c-muted);
  font-size: 1.1rem; line-height: 1.6;
  max-width: 34em; margin: 0 auto;
}
/* Inside the hero the auth card is the CTA, not a standalone screen. */
.landing .auth-card { margin: 28px auto 0; max-width: 420px; text-align: center; }
.landing .auth-title { font-size: 1.15rem; }

.landing-h2 {
  font-size: 1.35rem; letter-spacing: -0.02em;
  margin: 0 0 16px; text-align: center;
}

/* Numbered steps, used by both "How it works" and the MCP walkthrough. */
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.steps li {
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 16px;
  line-height: 1.5;
}
.steps li > div { color: var(--c-muted); }
.steps li strong { color: var(--c-text); }
/* Only the titled cards get a block heading; in the compact steps `strong`
   is mid-sentence emphasis and must stay inline. */
.steps:not(.steps-compact) li strong { display: block; margin-bottom: 2px; }
.step-n {
  flex: none;
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--c-accent); color: var(--c-accent-text);
  font-size: 0.85rem; font-weight: 700;
}
.steps-compact li { padding: 12px 16px; }

/* Platform availability. Status is stated honestly rather than linked to a
   store we aren't live on yet — swap a .pill for a real <a> as each ships. */
.platform-icon { flex: none; font-size: 1.5rem; line-height: 1; }
.host-row summary .platform-icon { font-size: 1.05rem; }
.pill {
  flex: none;
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 5px 10px; border-radius: 999px;
  border: 1px solid var(--c-border);
  color: var(--c-muted); background: var(--c-background);
  white-space: nowrap;
}
.pill-live {
  color: var(--c-success);
  border-color: color-mix(in srgb, var(--c-success) 40%, transparent);
  background: color-mix(in srgb, var(--c-success) 10%, transparent);
}
.pill-for-you {
  color: var(--c-accent);
  border-color: color-mix(in srgb, var(--c-accent) 40%, transparent);
  background: color-mix(in srgb, var(--c-accent) 10%, transparent);
}
.host-row.host-for-you summary strong { color: var(--c-accent); }

.code-block {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 14px 16px; margin: 14px 0 0;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem; line-height: 1.6;
}
.snippet-wrap { display: flex; gap: 10px; align-items: flex-start; margin-top: 14px; }
.snippet-wrap .code-block { flex: 1; margin: 0; }
.snippet-wrap .btn { white-space: nowrap; }
.landing code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85em;
  background: var(--c-background);
  border: 1px solid var(--c-border);
  border-radius: 5px; padding: 1px 5px;
}
.code-block code { background: none; border: 0; padding: 0; font-size: inherit; }

/* Screenshot gallery for the landing page and /screenshots/ index.
   Cards sit in a responsive grid; images keep their aspect ratio and don't
   blow past the card. */
.screenshot-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--gap);
  margin-top: 18px;
}
.shot {
  margin: 0;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.shot a { display: block; }
.shot img {
  width: 100%;
  height: auto;
  border-radius: 10px;
  display: block;
  background: var(--c-background);
}
.shot figcaption {
  font-size: 0.9rem;
  color: var(--c-muted);
  line-height: 1.45;
}
.shot figcaption strong {
  display: block;
  color: var(--c-text);
  margin-bottom: 2px;
}
.shot-meta {
  display: block;
  font-size: 0.8rem;
  color: var(--c-muted);
  margin-top: 4px;
}
.shot-group { margin-top: 8px; }
.shot-group .landing-h2 {
  text-align: left;
  font-size: 1.15rem;
  margin-bottom: 4px;
}
.shot-group .muted { margin: 0; }
.screenshot-gallery.gallery-watch {
  grid-template-columns: repeat(auto-fit, minmax(160px, 220px));
  justify-content: start;
}

/* Sits where a "Powered by …" line would, and only ever says Glimpsed. */
.glimpsed-banner {
  margin-top: 8px; padding: 28px 0 40px;
  border-top: 1px solid var(--c-border);
  text-align: center;
}
.glimpsed-mark {
  color: var(--c-muted); text-decoration: none;
  font-weight: 700; font-size: 0.95rem;
  letter-spacing: 0.14em; text-transform: uppercase;
  opacity: 0.75; transition: opacity .15s ease, color .15s ease;
}
.glimpsed-mark:hover, .glimpsed-mark:focus-visible { opacity: 1; color: var(--c-text); }


