/* Design system.
   Colours, radius and body font come ONLY from the brand tokens in /brand.css (served from the deployment config):
   --brand --brand-ink --brand-soft --accent --bg --surface --surface-2 --ink --ink-2 --line --ok --warn --danger --radius --font
   This file adds a spacing scale, the heading font and layout. Never hard-code a brand colour here. */

@font-face {
  font-family: 'Space Grotesk';
  src: url('../fonts/space-grotesk-latin-wght-normal.woff2') format('woff2');
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Fraunces';
  src: url('../fonts/fraunces-latin-wght-normal.woff2') format('woff2');
  font-weight: 300 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --s7: 48px;
  --font-display: 'Fraunces', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --tap: 48px;
  --tabbar-h: 64px;
  --rail-w: 232px;
  --pill: 999px;
  --ease: 160ms ease-out;
  --shadow: 0 1px 2px color-mix(in srgb, var(--ink) 6%, transparent), 0 8px 24px color-mix(in srgb, var(--ink) 8%, transparent);
  color-scheme: light dark;
}

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

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif);
  font-size: 16px;
  line-height: 1.5;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 var(--s3);
  letter-spacing: -0.01em;
}
h1 {
  font-size: 1.75rem;
}
h2 {
  font-size: 1.3rem;
}
h3 {
  font-size: 1.1rem;
}
p {
  margin: 0 0 var(--s3);
}
a {
  color: var(--brand-text);
}
img {
  max-width: 100%;
}
.muted {
  color: var(--ink-2);
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

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

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  min-height: var(--tap);
  padding: 0 var(--s5);
  border: 1px solid transparent;
  border-radius: var(--pill);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--ease), border-color var(--ease), transform var(--ease);
}
.btn:active:not(:disabled) {
  transform: scale(0.98);
}
.btn:disabled {
  opacity: 0.55;
  cursor: default;
}
.btn-block {
  display: flex;
  width: 100%;
}
.btn-primary {
  background: var(--brand);
  color: var(--brand-ink);
}
.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}
.btn-ghost {
  background: transparent;
  color: var(--ink);
}
.btn-ghost:hover:not(:disabled),
.btn-secondary:hover:not(:disabled) {
  background: var(--surface-2);
}
.btn-danger {
  background: transparent;
  color: var(--danger-text);
  border-color: var(--line);
}
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: var(--pill);
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
}
.icon-btn:hover {
  background: var(--surface-2);
}

/* ---------- Spinner ---------- */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.page-loading {
  display: grid;
  place-items: center;
  min-height: 60dvh;
  color: var(--ink-2);
}

/* ---------- Forms ---------- */
.form {
  display: grid;
  gap: var(--s4);
}
.field {
  display: grid;
  gap: var(--s1);
}
.field label {
  font-size: 0.9rem;
  font-weight: 600;
}
.field input,
.field textarea,
.select {
  min-height: var(--tap);
  padding: 0 var(--s4);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}
.field textarea {
  padding: var(--s3) var(--s4);
  resize: vertical;
}
.field input:focus,
.field textarea:focus,
.select:focus {
  border-color: var(--brand);
  outline: none;
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.field-msg {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink-2);
}
.field-error input {
  border-color: var(--danger);
}
.field-error .field-msg,
.form-error {
  color: var(--danger-text);
}
.form-error {
  margin: 0;
}
.field .check,
.check {
  display: flex;
  gap: var(--s3);
  align-items: center;
  min-height: 44px;
  font-size: 0.95rem;
  font-weight: 400;
  cursor: pointer;
}
.check input {
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--brand);
  flex: none;
}

/* ---------- Cards, lists ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--s5);
}
.list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.list-item {
  display: flex;
  align-items: center;
  gap: var(--s3);
  width: 100%;
  min-height: 56px;
  padding: var(--s3) var(--s4);
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.list-item:last-child {
  border-bottom: 0;
}
.list-item:hover {
  background: var(--surface-2);
}
.list-item .grow {
  flex: 1;
}
.list-item.danger {
  color: var(--danger-text);
}
.section-title {
  margin: var(--s5) 0 var(--s2);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
}

/* ---------- Avatar ---------- */
.avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  overflow: hidden;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-text);
  font-family: var(--font-display);
  font-weight: 600;
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---------- Empty state ---------- */
.empty {
  display: grid;
  justify-items: center;
  gap: var(--s2);
  max-width: 360px;
  margin: var(--s7) auto;
  padding: 0 var(--s4);
  text-align: center;
}
.empty p {
  color: var(--ink-2);
}
.empty-icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin-bottom: var(--s2);
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-text);
}
.empty-actions {
  margin-top: var(--s2);
}

/* ---------- Bottom sheet ---------- */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: color-mix(in srgb, var(--ink) 40%, transparent);
}
.sheet {
  width: 100%;
  max-height: 85dvh;
  overflow: auto;
  padding: var(--s2) var(--s5) calc(var(--s5) + env(safe-area-inset-bottom));
  border-radius: calc(var(--radius) * 1.5) calc(var(--radius) * 1.5) 0 0;
  background: var(--surface);
  transition: transform 200ms ease-out;
}
.sheet::before {
  content: '';
  display: block;
  width: 40px;
  height: 4px;
  margin: 0 auto var(--s2);
  border-radius: var(--pill);
  background: var(--line);
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sheet-head h2 {
  margin: 0;
}
.sheet-enter-active,
.sheet-leave-active {
  transition: opacity 200ms ease-out;
}
.sheet-enter-from,
.sheet-leave-to {
  opacity: 0;
}
.sheet-enter-from .sheet,
.sheet-leave-to .sheet {
  transform: translateY(24px);
}
@media (min-width: 640px) {
  .sheet-backdrop {
    align-items: center;
  }
  .sheet {
    max-width: 440px;
    border-radius: calc(var(--radius) * 1.5);
    padding-bottom: var(--s5);
  }
  .sheet::before {
    display: none;
  }
}

/* ---------- Toasts ---------- */
.toasts {
  position: fixed;
  top: calc(var(--s3) + env(safe-area-inset-top));
  left: 50%;
  z-index: 60;
  display: grid;
  gap: var(--s2);
  width: min(92vw, 420px);
  transform: translateX(-50%);
}
.toast {
  padding: var(--s3) var(--s4);
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--bg);
  box-shadow: var(--shadow);
  cursor: pointer;
}
.toast-ok {
  background: var(--ok);
  color: var(--brand-ink);
}
.toast-danger {
  background: var(--danger);
  color: var(--brand-ink);
}
.toast-enter-active,
.toast-leave-active {
  transition: opacity var(--ease), transform var(--ease);
}
.toast-enter-from,
.toast-leave-to {
  opacity: 0;
  transform: translateY(-8px);
}

/* ---------- Shell: bottom tab bar (phone) / left rail (desktop) ---------- */
.shell-main {
  min-height: 100dvh;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
}
.page {
  max-width: 720px;
  margin: 0 auto;
  padding: calc(var(--s4) + env(safe-area-inset-top)) var(--s4) var(--s6);
}
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  min-height: 48px;
  margin-bottom: var(--s4);
}
.page-head h1 {
  margin: 0;
}
.nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 40;
  display: flex;
  justify-content: space-around;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.nav-brand,
.nav-foot {
  display: none;
}
.nav-item {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 44px;
  color: var(--ink-2);
  font-size: 0.72rem;
  font-weight: 600;
  text-decoration: none;
}
.nav-item.active {
  color: var(--brand-text);
}

@media (min-width: 900px) {
  .shell-main {
    margin-left: var(--rail-w);
    padding-bottom: 0;
  }
  .nav {
    top: 0;
    right: auto;
    width: var(--rail-w);
    height: 100dvh;
    flex-direction: column;
    justify-content: flex-start;
    gap: var(--s1);
    padding: var(--s5) var(--s3);
    border-top: 0;
    border-right: 1px solid var(--line);
  }
  .nav-brand {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: var(--s2);
    min-height: 48px;
    margin-bottom: var(--s4);
    padding: 0 var(--s3);
  }
  .nav-foot {
    display: block;
    margin-top: auto;
  }
  .nav-item {
    flex: none;
    flex-direction: row;
    justify-content: flex-start;
    gap: var(--s3);
    min-height: 48px;
    padding: 0 var(--s3);
    border-radius: var(--pill);
    font-size: 1rem;
    transition: background var(--ease);
  }
  .nav-item:hover {
    background: var(--surface-2);
    color: var(--ink);
  }
  .nav-item.active {
    background: var(--brand-soft);
  }
  .page {
    padding-top: var(--s6);
  }
}

/* Brand mark (logo or name in the heading font) */
.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 650;
  text-decoration: none;
  letter-spacing: -0.02em;
}
.brand-mark img {
  height: 32px;
  width: auto;
}

/* ---------- Two-pane (chats) ---------- */
.split-detail {
  display: none;
}
@media (min-width: 900px) {
  .split {
    display: grid;
    grid-template-columns: minmax(280px, 360px) 1fr;
    min-height: 100dvh;
  }
  .split-list {
    border-right: 1px solid var(--line);
  }
  .split-list .page {
    max-width: none;
  }
  .split-detail {
    display: grid;
    place-items: center;
    background: var(--surface-2);
  }
}

/* ---------- Public pages (landing, auth) ---------- */
.public-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1080px;
  margin: 0 auto;
  padding: calc(var(--s4) + env(safe-area-inset-top)) var(--s4) var(--s4);
}
.auth {
  max-width: 420px;
  margin: 0 auto;
  padding: var(--s4) var(--s4) var(--s7);
}
.auth h1 {
  margin-bottom: var(--s2);
}
.auth-alt {
  margin-top: var(--s5);
  text-align: center;
  color: var(--ink-2);
}

.hero {
  display: grid;
  gap: var(--s6);
  max-width: 1080px;
  margin: 0 auto;
  padding: var(--s5) var(--s4) var(--s7);
}
.hero h1 {
  font-size: clamp(2.2rem, 7vw, 3.6rem);
  font-weight: 560;
}
.hero-lead {
  max-width: 34ch;
  font-size: 1.15rem;
  color: var(--ink-2);
}
.hero-actions {
  display: grid;
  gap: var(--s3);
  max-width: 360px;
}
.hero-art {
  position: relative;
  min-height: 260px;
  border-radius: calc(var(--radius) * 2);
  background:
    radial-gradient(circle at 30% 35%, var(--brand-soft) 0 34%, transparent 35%),
    radial-gradient(circle at 68% 62%, color-mix(in srgb, var(--accent) 30%, transparent) 0 30%, transparent 31%),
    var(--surface-2);
  overflow: hidden;
}
.bubble {
  position: absolute;
  max-width: 70%;
  padding: var(--s3) var(--s4);
  border-radius: calc(var(--radius) * 1.4);
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 0.95rem;
}
.bubble-a {
  top: 18%;
  left: 8%;
  border-bottom-left-radius: 4px;
}
.bubble-b {
  right: 8%;
  bottom: 18%;
  border-bottom-right-radius: 4px;
  background: var(--brand);
  color: var(--brand-ink);
}
.features {
  display: grid;
  gap: var(--s4);
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 var(--s4) var(--s7);
}
.feature h3 {
  margin-bottom: var(--s1);
}
.feature p {
  margin: 0;
  color: var(--ink-2);
}
.public-foot {
  padding: var(--s5) var(--s4) calc(var(--s5) + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  text-align: center;
  color: var(--ink-2);
  font-size: 0.9rem;
}
@media (min-width: 900px) {
  .hero {
    grid-template-columns: 1.1fr 1fr;
    align-items: center;
    padding-top: var(--s7);
  }
  .hero-art {
    min-height: 380px;
  }
  .hero-actions {
    display: flex;
    flex-wrap: wrap;
    max-width: none;
  }
  .features {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ---------- Moderation app: desktop-first ---------- */
.mod .nav-item.active {
  color: var(--ink);
}
.nav-foot .nav-item {
  width: 100%;
  border: 0;
  background: transparent;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
@media (min-width: 900px) {
  .mod .nav-item.active {
    background: var(--surface-2);
  }
}
.mod .page {
  max-width: 1100px;
}
.mod-user {
  padding: 0 var(--s3) var(--s2);
  font-size: 0.9rem;
  color: var(--ink-2);
}
@media (max-width: 899px) {
  /* On phones the 8 sections scroll sideways in the tab bar. */
  .mod .nav {
    justify-content: flex-start;
    overflow-x: auto;
  }
  .mod .nav-item {
    flex: none;
    min-width: 76px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0ms !important;
    animation-duration: 0ms !important;
  }
  .spinner {
    animation: spin 1.6s linear infinite !important;
  }
}

/* Me */
.me-card {
  display: flex;
  align-items: center;
  gap: var(--s4);
}
.me-card h2,
.me-card p {
  margin: 0;
}

/* ---------- Small shared pieces ---------- */
.btn-small {
  min-height: 36px;
  padding: 0 var(--s4);
  font-size: 0.9rem;
}
.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--danger-text);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}
.badge {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: var(--pill);
  background: var(--brand);
  color: var(--brand-ink);
  font-size: 0.75rem;
  font-weight: 700;
}
.pill {
  flex: none;
  padding: 2px 8px;
  border-radius: var(--pill);
  background: var(--brand-soft);
  color: var(--brand-text);
  font-size: 0.72rem;
  font-weight: 700;
}
.pill-muted {
  background: var(--surface-2);
  color: var(--ink-2);
}
.nav-icon {
  position: relative;
  display: inline-flex;
}
.nav-badge {
  position: absolute;
  top: -5px;
  right: -9px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border: 2px solid var(--surface);
  border-radius: var(--pill);
  background: var(--brand);
  color: var(--brand-ink);
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 14px;
  text-align: center;
}
.confirm {
  display: grid;
  gap: var(--s3);
}

/* Billing (user app) */
.narrow { max-width: 480px; margin-inline: auto; }
.demo-banner { padding: var(--s2) var(--s4); border-radius: var(--radius); background: var(--surface-2); color: var(--warn-text); font-size: 0.9rem; text-align: center; }
.segmented { display: inline-flex; padding: 3px; margin: var(--s3) 0 var(--s4); border-radius: 999px; background: var(--surface-2); }
.segmented button { min-height: 36px; padding: 0 var(--s4); border: 0; border-radius: 999px; background: none; color: var(--ink-2); font: inherit; cursor: pointer; }
.segmented button[aria-checked='true'] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgb(0 0 0 / 0.08); }
.plans { display: grid; gap: var(--s4); grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin-bottom: var(--s5); }
.plan { display: flex; flex-direction: column; gap: var(--s2); position: relative; }
.plan h2 { margin: 0; }
.plan.featured { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.plan-tag { position: absolute; top: calc(-1 * var(--s3)); right: var(--s4); margin: 0; padding: 2px 10px; border-radius: 999px; background: var(--brand); color: var(--brand-ink); font-size: 0.75rem; font-weight: 600; }
.plan-price { margin: 0; font-size: 1.1rem; }
.plan-price strong { font-size: 1.6rem; }
.compare { width: 100%; border-collapse: collapse; margin-bottom: var(--s3); font-size: 0.92rem; }
.compare th, .compare td { padding: var(--s2) var(--s2); border-bottom: 1px solid var(--line); text-align: center; }
.compare th[scope='row'] { text-align: left; font-weight: 400; }
.compare thead th { font-weight: 600; }
.packs { display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.pack { display: flex; flex-direction: column; gap: var(--s1); align-items: center; font: inherit; color: inherit; cursor: pointer; }
.pack:hover { border-color: var(--brand); }
.legal { max-width: 720px; }
.legal h2 { margin-top: var(--s5); font-size: 1.15rem; }
.legal p { line-height: 1.6; }
/* Chat-only app (/chat/) */
.chat-app-top { display: flex; align-items: center; justify-content: space-between; padding: var(--s2) var(--s4); border-bottom: 1px solid var(--line); background: var(--surface); }
.chat-app .shell-main { padding-bottom: 0; margin-left: 0; }

/* ---------- Group settings (#40; member app and moderation app) ---------- */
.gs-head {
  display: flex;
  align-items: center;
  gap: var(--s2);
}
.gs-head h1 {
  margin: 0;
}
.gs-note {
  margin: 0 0 var(--s3);
}
.gs-tabs {
  display: flex;
  gap: var(--s1);
  margin-bottom: var(--s4);
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
}
.gs-tab {
  flex: none;
  min-height: 44px;
  padding: 0 var(--s3);
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--ink-2);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.gs-tab[aria-selected='true'] {
  border-bottom-color: var(--brand);
  color: var(--ink);
}
.gs-list {
  margin: 0 0 var(--s4);
  padding: 0;
  list-style: none;
}
.gs-row {
  display: flex;
  align-items: center;
  gap: var(--s2);
  min-height: 52px;
  border-bottom: 1px solid var(--line);
}
.gs .grow {
  flex: 1;
  min-width: 0;
}
.gs-form {
  display: grid;
  gap: var(--s2);
  max-width: 420px;
}
.rot-up {
  transform: rotate(90deg);
}
.rot-down {
  transform: rotate(-90deg);
}
.role-dot {
  flex: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--line);
}
.role-chips {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-left: var(--s1);
}
.role-chip {
  padding: 1px var(--s2);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.8rem;
}
.gs-perms {
  display: grid;
  gap: var(--s1);
  margin: 0;
  padding: 0;
  border: 0;
}
.gs-perms legend {
  margin-bottom: var(--s1);
  font-weight: 600;
}
.gs-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.gs-table {
  border-collapse: collapse;
  font-size: 0.9rem;
}
.gs-table th,
.gs-table td {
  padding: var(--s1) var(--s2);
  border-bottom: 1px solid var(--line);
  text-align: center;
  white-space: nowrap;
}
.gs-table th[scope='row'] {
  position: sticky;
  left: 0;
  background: var(--surface);
  font-weight: 500;
  text-align: left;
}
.ow {
  width: 40px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink-2);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.ow.allow {
  border-color: var(--ok);
  color: var(--ok-text);
}
.ow.deny {
  border-color: var(--danger);
  color: var(--danger-text);
}
.ow:disabled {
  cursor: default;
  opacity: 0.6;
}
.gs-legend {
  margin-top: var(--s2);
}
.gs.embedded {
  max-width: none;
  margin: 0;
  padding: 0;
}
.gs-card {
  margin-top: var(--s4);
}
.field input[type='color'] {
  width: 64px;
  height: 44px;
  padding: 2px;
  cursor: pointer;
}

/* Photo viewer (shared/ui/gallery.js): the one way photos open in every app. */
.gallery-open,
.gallery-open body {
  overflow: hidden;
}
.gallery {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: calc(var(--s5) + env(safe-area-inset-top)) var(--s3) calc(var(--s5) + env(safe-area-inset-bottom));
  background: color-mix(in srgb, #000 92%, transparent);
  touch-action: pan-y;
  user-select: none;
}
.gallery-stage {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  margin: 0;
}
.gallery-stage img {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius);
  object-fit: contain;
}
.gallery-video {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius);
  background: #000;
}
.gallery-blurred {
  min-width: min(80vw, 420px);
  filter: saturate(1.1);
}
.gallery-lock {
  position: absolute;
  display: grid;
  gap: var(--s2);
  justify-items: center;
  max-width: 320px;
  padding: var(--s4);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  text-align: center;
}
.gallery-lock p {
  margin: 0;
}
.gallery-caption {
  position: absolute;
  bottom: calc(-1 * var(--s5) + var(--s1));
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: var(--s3);
  color: #fff;
  font-size: 0.9rem;
  text-align: center;
}
.gallery-count {
  opacity: 0.8;
  font-variant-numeric: tabular-nums;
}
.gallery .icon-btn {
  position: absolute;
  background: color-mix(in srgb, #fff 90%, transparent);
  color: #111;
}
.gallery-close {
  top: calc(var(--s3) + env(safe-area-inset-top));
  right: var(--s3);
}
.gallery-prev,
.gallery-next {
  top: 50%;
  transform: translateY(-50%);
}
.gallery-prev {
  left: var(--s2);
}
.gallery-next {
  right: var(--s2);
}
