/* y.willanything.com — design system v0.7
 *
 * Architecture
 *   • App shell (header / main / nav) sized to the viewport with safe-area insets.
 *   • Pages are absolute-positioned siblings inside <main>. One visible at a time.
 *     This means the user never scrolls the document — only inside a page card.
 *   • Mobile-first (≤ 599px): bottom nav, single-column.
 *   • Desktop (≥ 600px): left nav rail, content centered.
 *   • Dark glass aesthetic. Cyan + violet accents. Motion via CSS transitions
 *     (no animation library — keeps the bundle small and respects motion-reduce).
 */

/* ── Tokens ─────────────────────────────────────────────── */
:root {
  --bg-0: #05070b;
  --bg-1: #0a0f18;
  --bg-2: #0e1622;
  --fg-0: #e8f5ff;
  --fg-1: rgba(232, 245, 255, 0.74);
  --fg-2: rgba(232, 245, 255, 0.46);
  --fg-3: rgba(232, 245, 255, 0.30);
  --accent: #7af7ff;
  --accent-2: #b896ff;
  --warn: #ffb45a;
  --err: #ff7a94;
  --ok: #58e89a;
  --ring: rgba(0, 255, 255, 0.28);
  --glass: rgba(14, 16, 22, 0.62);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --r-lg: 22px;
  --r-md: 14px;
  --r-sm: 10px;
  --r-xs: 6px;

  --header-h: 52px;
  --nav-h: 64px;          /* mobile bottom nav */
  --nav-w: 220px;         /* desktop side nav */

  /* iOS-safe area */
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
}

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

/* CRITICAL: any custom `display:` rule (e.g. .lock { display:flex }) silently
 * overrides the user-agent's `[hidden] { display: none }`. Without this, our
 * .lock / .shell / .lock-step / .call-banner / .call-stage / .call-chat all
 * stay visible even with `hidden=true`, stacking screens on top of each other.
 * Force-hide. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg-0);
  color: var(--fg-0);
  font: 14.5px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;            /* document never scrolls */
  overscroll-behavior: none;
  text-rendering: optimizeLegibility;
}
body {
  background:
    radial-gradient(1200px 800px at 20% 10%, rgba(0, 200, 220, 0.14), transparent 60%),
    radial-gradient(900px 700px at 90% 80%, rgba(184, 150, 255, 0.10), transparent 60%),
    var(--bg-0);
}
::selection { background: rgba(122, 247, 255, 0.25); color: var(--fg-0); }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
input, textarea { caret-color: var(--accent); }

/* ── Buttons ───────────────────────────────────────────── */
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--fg-0);
  font-weight: 600;
  letter-spacing: 0.2px;
  font-size: 13.5px;
  transition: transform 0.12s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease;
  user-select: none;
  white-space: nowrap;
}
.btn:hover:not(:disabled)  { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled              { opacity: 0.4; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

.btn.primary {
  background: linear-gradient(180deg, rgba(0,255,255,0.18), rgba(0,255,255,0.06));
  border-color: rgba(0, 255, 255, 0.32);
  color: var(--accent);
}
.btn.primary:hover:not(:disabled) { box-shadow: 0 0 22px rgba(0, 255, 255, 0.25); }
.btn.ghost   { background: transparent; color: var(--fg-1); }
.btn.ghost:hover:not(:disabled) { background: rgba(255, 255, 255, 0.05); color: var(--fg-0); }
.btn.danger  { color: var(--err); border-color: rgba(255, 90, 120, 0.32); background: rgba(255, 90, 120, 0.06); }
.btn.danger:hover:not(:disabled) { background: rgba(255, 90, 120, 0.10); }
.btn.big     { padding: 14px 18px; font-size: 14.5px; min-height: 48px; }

.btn-icon {
  appearance: none; background: transparent; color: var(--fg-1); border: 0;
  width: 32px; height: 32px; border-radius: 8px;
  font-size: 18px; line-height: 1; display: grid; place-items: center; cursor: pointer;
}
.btn-icon:hover { background: rgba(255,255,255,0.06); color: var(--fg-0); }

/* ── App Shell layout ──────────────────────────────────── */
.shell {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-rows: var(--header-h) 1fr var(--nav-h);
  grid-template-columns: 1fr;
  padding-top: var(--sat);
  padding-bottom: var(--sab);
}

.shell-header {
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(5, 7, 11, 0.6);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}
.shell-brand { display: flex; align-items: center; gap: 8px; }
.shell-mark {
  width: 28px; height: 28px;
  border-radius: 8px;
  display: grid; place-items: center;
  background: radial-gradient(circle at 30% 30%, rgba(122, 247, 255, 0.45), rgba(10, 15, 24, 0.2) 70%);
  border: 1px solid var(--ring);
  font-weight: 700; color: var(--accent);
  box-shadow: 0 0 14px rgba(0, 255, 255, 0.25), inset 0 0 8px rgba(0, 255, 255, 0.15);
}
.shell-name {
  font-size: 12px;
  letter-spacing: 0.2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 600;
}
.shell-title {
  margin: 0;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: 0.3px;
  flex: 1;
  text-align: center;
}
.shell-pill {
  appearance: none;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--fg-2);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 10.5px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  cursor: pointer;
}
/* Composite states emitted by YOffline (Phase 11.0). Legacy raw-status
   selectors retained below for the fallback-paint path in boot.js when
   y_offline.js fails to load. */
.shell-pill[data-state="online"]          { color: var(--ok);    border-color: rgba(88, 232, 154, 0.32); }
.shell-pill[data-state="reconnecting"]    { color: var(--warn);  border-color: rgba(255, 180, 90, 0.32); }
.shell-pill[data-state="offline"]         { color: var(--fg-2);  border-color: rgba(255, 255, 255, 0.16); background: rgba(255, 255, 255, 0.02); }
.shell-pill[data-state="manual-offline"]  { color: var(--warn);  border-color: rgba(255, 180, 90, 0.45); background: rgba(255, 180, 90, 0.08); }
/* Legacy raw socket states (fallback when y_offline.js unavailable). */
.shell-pill[data-state="connecting"], .shell-pill[data-state="authenticating"] { color: var(--warn); border-color: rgba(255, 180, 90, 0.32); }
.shell-pill[data-state="error"], .shell-pill[data-state="auth-failed"] { color: var(--err);  border-color: rgba(255, 90, 120, 0.32); }

.shell-main {
  grid-row: 2;
  position: relative;
  overflow: hidden;
}

/* ── Mobile bottom nav ─────────────────────────────────── */
.shell-nav {
  grid-row: 3;
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  border-top: 1px solid var(--border);
  background: rgba(5, 7, 11, 0.86);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  padding-left: var(--sal);
  padding-right: var(--sar);
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-decoration: none;
  color: var(--fg-2);
  font-size: 10.5px;
  letter-spacing: 0.3px;
  padding: 6px 4px 8px;
  transition: color 0.15s ease;
}
.nav-i { font-size: 18px; line-height: 1; }
.nav-l { font-size: 10.5px; }
.nav-item:hover { color: var(--fg-0); }
.nav-item.active { color: var(--accent); }
.nav-item.active .nav-i { filter: drop-shadow(0 0 8px rgba(0, 255, 255, 0.6)); }

/* ── Desktop layout ────────────────────────────────────── */
@media (min-width: 600px) {
  .shell {
    grid-template-rows: var(--header-h) 1fr;
    grid-template-columns: var(--nav-w) 1fr;
  }
  .shell-header     { grid-row: 1; grid-column: 1 / -1; }
  .shell-main       { grid-row: 2; grid-column: 2; }
  .shell-nav {
    grid-row: 2; grid-column: 1;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    border-top: 0;
    border-right: 1px solid var(--border);
    padding: 12px 8px;
    gap: 4px;
  }
  .nav-item {
    flex: 0 0 auto;
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 10px;
  }
  .nav-i { font-size: 16px; width: 24px; text-align: center; }
  .nav-l { font-size: 13px; }
  .nav-item.active { background: rgba(0, 255, 255, 0.08); }
}

/* ── Page surface — one visible at a time ──────────────── */
.page {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px max(14px, var(--sal)) 14px max(14px, var(--sar));
  overflow-y: auto;
  overscroll-behavior: contain;
  /* Page transitions */
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.22s ease, transform 0.22s ease;
  pointer-events: none;
}
.page.is-active {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
@media (min-width: 600px) {
  .page { padding: 22px max(22px, var(--sal)) 22px max(22px, var(--sar)); }
}
@media (prefers-reduced-motion: reduce) {
  .page { transition: opacity 0.05s linear; transform: none; }
}

/* ── Card primitive ────────────────────────────────────── */
.card {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px;
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.card.mini   { padding: 12px 14px; }
.card-title  { margin: 0 0 4px; font-size: 16.5px; letter-spacing: 0.2px; font-weight: 600; }
.card-sub    { margin: 0 0 12px; color: var(--fg-1); font-size: 13px; }

/* ── Helpers ───────────────────────────────────────────── */
.muted-tiny  { color: var(--fg-2); font-size: 11px; }
.addr-mono   { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace; font-size: 11px; color: var(--fg-2); margin-top: 4px; word-break: break-all; }
.row { display: flex; flex-direction: column; gap: 0; padding: 0; overflow: hidden; }
.row-btn {
  appearance: none;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  background: transparent; border: 0; border-bottom: 1px solid var(--border);
  color: var(--fg-0);
  text-align: left;
  width: 100%;
  cursor: pointer;
  transition: background 0.15s ease;
}
.row-btn:last-child { border-bottom: 0; }
.row-btn:hover { background: rgba(255, 255, 255, 0.03); }
.row-btn .row-i { font-size: 22px; width: 32px; text-align: center; }
.row-btn .row-l { flex: 1; display: flex; flex-direction: column; gap: 2px; line-height: 1.3; }
.row-btn .row-l small { color: var(--fg-2); font-size: 11.5px; }
.row-btn .row-go { color: var(--fg-3); font-size: 22px; }

.banner {
  border-radius: var(--r-md);
  border: 1px solid rgba(122, 247, 255, 0.35);
  background: linear-gradient(90deg, rgba(122, 247, 255, 0.14), rgba(184, 150, 255, 0.14));
  padding: 12px 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  animation: banner-pulse 1.6s ease-in-out infinite;
}
.banner-actions { display: flex; gap: 8px; }
@keyframes banner-pulse {
  0%, 100% { box-shadow: 0 0 18px rgba(122, 247, 255, 0.18); }
  50%      { box-shadow: 0 0 34px rgba(122, 247, 255, 0.45); }
}

/* ── Status pill ──────────────────────────────────────── */
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 255, 255, 0.08);
  border: 1px solid rgba(0, 255, 255, 0.22);
  color: var(--accent);
  font-size: 10.5px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; animation: dot 1.6s ease-in-out infinite; }
@keyframes dot { 0%, 100% { opacity: 0.6; } 50% { opacity: 1; } }
.status.warn { background: rgba(255, 180, 90, 0.10); border-color: rgba(255, 180, 90, 0.28); color: var(--warn); }
.status.err  { background: rgba(255, 90, 120, 0.10); border-color: rgba(255, 90, 120, 0.28); color: var(--err); }

/* ── Lock screen ───────────────────────────────────────── */
.lock {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px max(20px, var(--sal)) 20px max(20px, var(--sar));
  padding-top: max(20px, var(--sat));
  padding-bottom: max(20px, var(--sab));
  background:
    radial-gradient(800px 700px at 50% 30%, rgba(122, 247, 255, 0.10), transparent 60%),
    radial-gradient(700px 600px at 50% 90%, rgba(184, 150, 255, 0.10), transparent 60%),
    var(--bg-0);
  overflow-y: auto;
}
.lock-stage {
  width: 100%;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}
.lock-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
  animation: lock-in 0.32s ease;
}
@keyframes lock-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.lock-mark {
  width: 64px; height: 64px;
  border-radius: 18px;
  display: grid; place-items: center;
  font-size: 26px; font-weight: 700; color: var(--accent);
  background: radial-gradient(circle at 30% 30%, rgba(122, 247, 255, 0.45), rgba(10, 15, 24, 0.2) 70%);
  border: 1px solid var(--ring);
  box-shadow: 0 0 28px rgba(0, 255, 255, 0.32), inset 0 0 18px rgba(0, 255, 255, 0.18);
  margin-bottom: 4px;
}
.lock-mark.sm { width: 44px; height: 44px; font-size: 18px; border-radius: 14px; }
.lock-title {
  margin: 0;
  font-size: 26px;
  letter-spacing: -0.2px;
  font-weight: 700;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.lock-sub  { margin: 0; color: var(--fg-1); font-size: 14px; max-width: 380px; }
.lock-mini { margin: 4px 0; color: var(--fg-2); font-size: 12px; max-width: 380px; }

.lock-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  margin-top: 6px;
}
@media (min-width: 460px) {
  .lock-actions { flex-direction: row; justify-content: center; }
}
.lock-actions .btn { flex: 1 1 0; min-width: 0; }
.lock-input {
  width: 100%;
  padding: 14px 16px;
  font-size: 16px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-strong);
  background: rgba(10, 14, 22, 0.6);
  color: var(--fg-0);
  outline: none;
  text-align: center;
}
.lock-input:focus { border-color: rgba(0, 255, 255, 0.45); box-shadow: 0 0 0 3px rgba(0, 255, 255, 0.10); }

.lock-id-card {
  width: 100%;
  background: rgba(10, 14, 22, 0.55);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
  font-size: 11.5px;
  color: var(--fg-1);
  text-align: left;
  word-break: break-all;
}
.lock-id-card .lock-id-row { display: flex; gap: 8px; margin: 2px 0; }
.lock-id-card .lock-id-key { color: var(--fg-2); min-width: 80px; text-transform: uppercase; font-size: 10px; letter-spacing: 0.4px; padding-top: 2px; }

/* ── Phase 10b — install pitch on the intro lock-step ── */
.lock-install-card {
  width: 100%;
  margin: 18px 0 6px;
  padding: 16px 16px 14px;
  border-radius: var(--r-md, 14px);
  background: linear-gradient(180deg, rgba(122, 247, 255, 0.10), rgba(122, 247, 255, 0.04));
  border: 1px solid rgba(122, 247, 255, 0.45);
  text-align: left;
}
.lock-install-card.installed {
  background: linear-gradient(180deg, rgba(120, 255, 170, 0.12), rgba(120, 255, 170, 0.04));
  border-color: rgba(120, 255, 170, 0.5);
}
.lock-install-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 8px;
  font-size: 15px;
  color: var(--fg-0);
}
.lock-install-icon { font-size: 20px; line-height: 1; }
.lock-install-pitch {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--fg-1);
}
.lock-install-compare {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr;
  margin: 0 0 14px;
}
@media (min-width: 540px) {
  .lock-install-compare { grid-template-columns: 1fr 1fr; }
}
.lock-install-without, .lock-install-with {
  background: rgba(10, 14, 22, 0.55);
  border: 1px solid var(--border);
  border-radius: var(--r-sm, 10px);
  padding: 10px 12px;
}
.lock-install-without { border-color: rgba(255, 100, 100, 0.35); }
.lock-install-with    { border-color: rgba(120, 255, 170, 0.35); }
.lock-install-col-h {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--fg-2);
  margin-bottom: 6px;
  font-weight: 600;
}
.lock-install-without .lock-install-col-h { color: #ffb3a6; }
.lock-install-with    .lock-install-col-h { color: #a4ffd0; }
.lock-install-without ul, .lock-install-with ul {
  margin: 0; padding-left: 18px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--fg-1);
}
.lock-install-without li, .lock-install-with li { margin: 2px 0; }
.lock-install-without li::marker { color: rgba(255, 120, 120, 0.7); }
.lock-install-with li::marker    { color: rgba(120, 255, 170, 0.8); }
#lock-install-platform-hint {
  margin: 8px 0 0;
  font-size: 11.5px;
  color: var(--fg-2);
  text-align: center;
  line-height: 1.4;
}
.lock-id-actions {
  margin-top: 10px;
  opacity: 0.95;
}

.lock-explain {
  width: 100%;
  border-top: 1px solid var(--border);
  padding-top: 10px;
  text-align: left;
  font-size: 12.5px;
}
.lock-explain summary {
  cursor: pointer;
  color: var(--fg-1);
  list-style: none;
  display: flex; align-items: center; gap: 6px;
  padding: 4px 0;
}
.lock-explain summary::-webkit-details-marker { display: none; }
.lock-explain summary::before {
  content: '›';
  display: inline-block;
  transition: transform 0.2s ease;
  color: var(--fg-2);
  font-size: 16px;
}
.lock-explain[open] summary::before { transform: rotate(90deg); }
.lock-explain p { margin: 6px 0; color: var(--fg-2); }

.lock-drop {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 32px 18px;
  border-radius: var(--r-md);
  border: 2px dashed rgba(122, 247, 255, 0.32);
  background: rgba(10, 14, 22, 0.4);
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
}
.lock-drop.dragging, .lock-drop:hover {
  border-color: rgba(122, 247, 255, 0.6);
  background: rgba(122, 247, 255, 0.04);
}
.lock-drop-icon {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: rgba(122, 247, 255, 0.10);
  border: 1px solid var(--ring);
  display: grid; place-items: center;
  color: var(--accent);
  font-size: 22px;
}

/* ── Page: Home ────────────────────────────────────────── */
.page-home .hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 22px 18px; }
.hero-orb {
  position: relative;
  width: 72px; height: 72px;
  margin-bottom: 6px;
}
.hero-orb-core, .hero-orb-pulse {
  position: absolute; inset: 0; border-radius: 50%;
}
.hero-orb-core {
  inset: 8px;
  background: radial-gradient(circle at 30% 28%, var(--accent-2) 0%, var(--accent) 35%, var(--bg-2) 75%, var(--bg-0) 100%);
  box-shadow: 0 0 24px rgba(184, 150, 255, 0.4), inset 0 0 18px rgba(122, 247, 255, 0.32);
}
.hero-orb-pulse {
  border: 1px solid rgba(184, 150, 255, 0.5);
  animation: hero-pulse 2.4s ease-in-out infinite;
}
@keyframes hero-pulse {
  0%, 100% { transform: scale(1);    opacity: 0.55; }
  50%      { transform: scale(1.18); opacity: 0;    }
}
#home-greeting { margin: 0; font-size: 22px; font-weight: 700; }
#home-status   { margin: 0; color: var(--fg-1); font-size: 13px; }
#home-id-mini { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#home-id-mini .lab { color: var(--fg-2); font-size: 10.5px; letter-spacing: 0.5px; text-transform: uppercase; }
#home-id-mini .val { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace; font-size: 11px; color: var(--fg-1); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Page: Call ────────────────────────────────────────── */
.page-call .call-idle .call-compose {
  display: flex; gap: 8px; align-items: stretch;
  margin-top: 8px;
}
#call-target {
  flex: 1;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-strong);
  background: rgba(10, 14, 22, 0.55);
  color: var(--fg-0);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
  font-size: 12.5px;
  outline: none;
}
#call-target:focus { border-color: rgba(0, 255, 255, 0.45); box-shadow: 0 0 0 3px rgba(0, 255, 255, 0.08); }
.call-state {
  margin-top: 10px;
  font-size: 11px;
  color: var(--fg-2);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* Call stage — fills the page when active */
.call-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
}
.call-grid {
  position: relative;
  flex: 1;
  min-height: 240px;
  border-radius: var(--r-md);
  overflow: hidden;
  background: #000;
  border: 1px solid var(--border);
  box-shadow: inset 0 0 50px rgba(0, 255, 255, 0.04);
}
.call-remote { width: 100%; height: 100%; object-fit: cover; background: #000; }
.call-self {
  position: absolute;
  right: 10px; bottom: 10px;
  width: 28%; max-width: 180px;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 12px;
  border: 1.5px solid rgba(0, 255, 255, 0.4);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5), 0 0 14px rgba(0, 255, 255, 0.22);
  background: #111;
  transform: scaleX(-1);   /* mirror self-view */
}
.call-screen-tag {
  position: absolute; left: 10px; top: 10px;
  padding: 4px 10px; border-radius: 999px;
  background: rgba(0, 0, 0, 0.6); border: 1px solid rgba(255, 180, 90, 0.5);
  color: var(--warn); font-size: 11px; letter-spacing: 0.4px; text-transform: uppercase;
}

/* Action bar — round buttons centered */
.call-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  padding: 6px 4px;
}
.round-btn {
  appearance: none;
  width: 52px; height: 52px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--fg-0);
  font-size: 20px;
  display: grid; place-items: center;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.18s ease;
  position: relative;
}
.round-btn:hover { background: rgba(255, 255, 255, 0.10); transform: translateY(-1px); }
.round-btn.is-on { background: rgba(0, 255, 255, 0.16); border-color: rgba(0, 255, 255, 0.4); color: var(--accent); }
.round-btn.danger { background: rgba(255, 90, 120, 0.16); border-color: rgba(255, 90, 120, 0.5); color: var(--err); }
.round-btn.danger:hover { background: rgba(255, 90, 120, 0.30); }
.round-btn.has-badge[data-badge]:not([data-badge=""])::after {
  content: attr(data-badge);
  position: absolute; top: -3px; right: -3px;
  background: var(--accent-2); color: var(--bg-0);
  font-size: 10px; font-weight: 700;
  padding: 1px 5px; border-radius: 999px;
  border: 2px solid var(--bg-0);
}

/* In-call chat overlay */
.call-chat {
  position: absolute;
  right: 8px; bottom: 78px;
  left: 8px;
  max-width: 380px; margin-left: auto;
  display: flex; flex-direction: column;
  background: rgba(14, 16, 22, 0.92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6);
  max-height: 60vh;
  overflow: hidden;
  animation: chat-in 0.22s ease;
}
@keyframes chat-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.call-chat-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px; font-size: 11px; color: var(--fg-2); letter-spacing: 0.4px; text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}
.call-chat-log {
  flex: 1; overflow-y: auto; padding: 8px;
  display: flex; flex-direction: column; gap: 6px;
}
.call-chat-row {
  max-width: 85%;
  padding: 7px 10px;
  border-radius: 12px;
  font-size: 13px; line-height: 1.4;
  word-wrap: break-word;
}
.call-chat-row.me  { align-self: flex-end;   background: rgba(0, 255, 255, 0.10); border: 1px solid rgba(0, 255, 255, 0.24); }
.call-chat-row.you { align-self: flex-start; background: rgba(184, 150, 255, 0.08); border: 1px solid rgba(184, 150, 255, 0.20); }
.call-chat-compose { display: flex; gap: 6px; padding: 8px; border-top: 1px solid var(--border); }
.call-chat-compose input {
  flex: 1; padding: 8px 10px;
  border-radius: 8px; border: 1px solid var(--border-strong);
  background: rgba(10, 14, 22, 0.6); color: var(--fg-0); outline: none;
  font-size: 13px;
}

/* ── Page: Sphere 1 ────────────────────────────────────── */
.sphere1-card { display: flex; flex-direction: column; gap: 10px; }
.sphere1-head { display: flex; align-items: center; gap: 12px; }
.sphere1-meta { flex: 1; min-width: 0; }
.sphere1-orb { position: relative; width: 56px; height: 56px; flex: 0 0 56px; }
.sphere1-orb-core, .sphere1-orb-pulse { position: absolute; inset: 0; border-radius: 50%; }
.sphere1-orb-core {
  inset: 8px;
  background: radial-gradient(circle at 30% 28%, var(--accent-2) 0%, var(--accent) 35%, var(--bg-2) 75%, var(--bg-0) 100%);
  box-shadow: 0 0 22px rgba(184, 150, 255, 0.45), inset 0 0 16px rgba(122, 247, 255, 0.35);
}
.sphere1-orb-pulse {
  border: 1px solid rgba(184, 150, 255, 0.5);
  animation: hero-pulse 2.4s ease-in-out infinite;
}
.page-sphere1 .sphere1-card.is-listening .sphere1-orb-core { animation: s1-listen 1.8s ease-in-out infinite; }
.page-sphere1 .sphere1-card.is-thinking  .sphere1-orb-core { animation: s1-think  1.4s ease-in-out infinite; }
.page-sphere1 .sphere1-card.is-speaking  .sphere1-orb-core { animation: s1-speak  0.55s ease-in-out infinite; }
@keyframes s1-listen { 0%,100%{box-shadow:0 0 22px rgba(122,247,255,.45),inset 0 0 16px rgba(122,247,255,.35);} 50%{box-shadow:0 0 38px rgba(122,247,255,.85),inset 0 0 24px rgba(122,247,255,.55);} }
@keyframes s1-think  { 0%,100%{box-shadow:0 0 22px rgba(184,150,255,.4);} 50%{box-shadow:0 0 38px rgba(184,150,255,.85);} }
@keyframes s1-speak  { 0%,100%{transform:scale(1);} 50%{transform:scale(1.06); box-shadow:0 0 30px rgba(255,220,100,.55), inset 0 0 22px rgba(255,220,100,.3);} }

.sphere1-log {
  display: flex; flex-direction: column; gap: 8px;
  max-height: 280px; overflow-y: auto;
  padding: 6px 4px;
  border-radius: var(--r-sm);
  background: rgba(8, 11, 18, 0.5);
  border: 1px solid var(--border);
}
.sphere1-log:empty { display: none; }
.sphere1-row { display: flex; flex-direction: column; gap: 2px; padding: 0 8px; }
.sphere1-row .who    { font-size: 10px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--fg-2); }
.sphere1-row .bubble {
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 13.5px; line-height: 1.5;
  white-space: pre-wrap; word-wrap: break-word;
  border: 1px solid var(--border);
}
.sphere1-row.user .bubble { background: rgba(122, 247, 255, 0.06); border-color: rgba(122, 247, 255, 0.22); align-self: flex-end;   max-width: 85%; }
.sphere1-row.ai .bubble   { background: rgba(184, 150, 255, 0.06); border-color: rgba(184, 150, 255, 0.20); align-self: flex-start; max-width: 92%; }
.sphere1-row.interim .bubble { background: rgba(255,255,255,0.03); border-style: dashed; color: var(--fg-2); font-style: italic; }

.sphere1-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ── Page: Twin ────────────────────────────────────────── */
.twin-card { display: flex; flex-direction: column; gap: 10px; }
.twin-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.twin-compose { display: flex; flex-direction: column; gap: 8px; }
#twin-label, #twin-body {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-strong);
  background: rgba(10, 14, 22, 0.55);
  color: var(--fg-0);
  outline: none;
  font: inherit;
}
#twin-body { resize: vertical; min-height: 56px; line-height: 1.45; }
#twin-label { font-size: 12.5px; }
#twin-label:focus, #twin-body:focus { border-color: rgba(184, 150, 255, 0.4); box-shadow: 0 0 0 3px rgba(184, 150, 255, 0.10); }
.twin-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.twin-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  font-size: 12px;
  color: var(--fg-2);
  /* Make the whole label a 44px-min tap target on mobile */
  min-height: 44px;
  padding: 4px 6px 4px 4px;
  cursor: pointer;
}
.twin-toggle input {
  accent-color: var(--accent-2);
  /* Larger checkbox so the tap target is comfortable */
  width: 22px;
  height: 22px;
  cursor: pointer;
  margin: 0;
}
.twin-toggle label { cursor: pointer; line-height: 1.3; }

.twin-list {
  display: flex; flex-direction: column; gap: 6px;
  max-height: 360px; overflow-y: auto; padding: 4px;
}
.twin-list:empty { padding: 0; }
.twin-list-empty { color: var(--fg-2); font-size: 12.5px; font-style: italic; padding: 6px; }
.twin-entry {
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: rgba(10, 14, 22, 0.45);
  padding: 8px 10px;
}
.twin-entry.corrupt { background: rgba(255, 180, 90, 0.06); border-color: rgba(255, 180, 90, 0.28); }
.twin-entry-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; margin-bottom: 4px;
}
.twin-entry-type   { text-transform: uppercase; letter-spacing: 0.5px; color: var(--accent-2); font-weight: 600; }
.twin-entry-label  { color: var(--fg-1); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.twin-entry-ts     { color: var(--fg-2); font-size: 10.5px; }
.twin-entry-del    {
  background: transparent; border: 1px solid var(--border);
  border-radius: 6px; width: 22px; height: 22px;
  color: var(--fg-2); cursor: pointer; font-size: 14px; line-height: 1;
  padding: 0; display: grid; place-items: center;
}
.twin-entry-del:hover { border-color: rgba(255, 90, 120, 0.4); color: var(--err); }
.twin-entry-body { font-size: 12.5px; color: var(--fg-0); white-space: pre-wrap; word-wrap: break-word; line-height: 1.45; }

/* ── Page: Settings ────────────────────────────────────── */
.settings-id {
  background: rgba(10, 14, 22, 0.55);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 14px;
  margin: 8px 0 12px;
}
.settings-id-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 2px 0; }
.settings-id-key { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--fg-2); }
.settings-id-val {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
  font-size: 11px; color: var(--fg-0);
  text-align: right; max-width: 60%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.settings-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.settings-toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; color: var(--fg-1); font-size: 13.5px; }
.settings-toggle input[type="checkbox"] { accent-color: var(--accent, #7af7ff); width: 16px; height: 16px; }

.select-input {
  appearance: none;
  -webkit-appearance: none;
  padding: 9px 32px 9px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-strong);
  background: rgba(10, 14, 22, 0.6);
  color: var(--fg-0);
  font: inherit;
  font-size: 13px;
  outline: none;
  cursor: pointer;
  /* Caret arrow */
  background-image: linear-gradient(45deg, transparent 50%, rgba(122, 247, 255, 0.6) 50%),
                    linear-gradient(135deg, rgba(122, 247, 255, 0.6) 50%, transparent 50%);
  background-position: calc(100% - 14px) center, calc(100% - 9px) center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  flex: 1;
  min-width: 200px;
}
.select-input:focus { border-color: rgba(122, 247, 255, 0.4); box-shadow: 0 0 0 3px rgba(122, 247, 255, 0.10); }
.select-input optgroup { color: var(--fg-2); font-style: normal; }
.select-input option   { color: var(--fg-0); background: var(--bg-1); }

#settings-voice-rate {
  flex: 1; max-width: 220px;
  height: 32px;            /* taller hit area than the default 16px */
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
}
#settings-voice-rate::-webkit-slider-runnable-track {
  height: 6px; border-radius: 3px;
  background: linear-gradient(90deg, rgba(122,247,255,0.40), rgba(184,150,255,0.40));
}
#settings-voice-rate::-moz-range-track { height: 6px; border-radius: 3px; background: rgba(122,247,255,0.30); }
#settings-voice-rate::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent);
  border: 2px solid #05070b;
  margin-top: -8px;        /* center on track */
  cursor: pointer;
  box-shadow: 0 0 8px rgba(122,247,255,0.5);
}
#settings-voice-rate::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); border: 2px solid #05070b; cursor: pointer;
  box-shadow: 0 0 8px rgba(122,247,255,0.5);
}
#settings-voice-rate-val { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace; font-size: 11px; color: var(--fg-2); min-width: 48px; }

.call-chat-row.err {
  background: rgba(255, 90, 120, 0.10) !important;
  border-color: rgba(255, 90, 120, 0.32) !important;
  color: #ff9bb0;
}
.call-chat-row[data-queued="1"] { opacity: 0.6; }

/* ── Contacts ──────────────────────────────────────────── */
.page-contacts { padding-bottom: 18px; }
.contacts-list { display: flex; flex-direction: column; gap: 4px; }

.contact-row {
  appearance: none;
  display: grid;
  grid-template-columns: 36px 1fr auto 14px;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-align: left;
  cursor: pointer;
  color: var(--fg-0);
  transition: background 0.15s ease, border-color 0.15s ease;
}
.contact-row:hover  { background: rgba(122, 247, 255, 0.05); border-color: rgba(122, 247, 255, 0.22); }
.contact-row-orb {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700; color: rgba(0, 0, 0, 0.7);
  font-size: 16px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  flex-shrink: 0;
}
.contact-row-info { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.contact-row-info strong { font-size: 13.5px; }
.contact-row-info small {
  font-size: 10.5px;
  color: var(--fg-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.contact-row-when { font-size: 10.5px; color: var(--fg-2); white-space: nowrap; }
.contact-row-go   { font-size: 18px; color: var(--fg-3); }

/* Detail */
.contact-detail { display: flex; flex-direction: column; gap: 12px; }
.contact-head {
  display: grid;
  grid-template-columns: 32px 56px 1fr;
  gap: 12px;
  align-items: center;
}
.contact-orb {
  width: 56px; height: 56px; border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700; color: rgba(0, 0, 0, 0.78);
  font-size: 24px;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 14px rgba(0, 255, 255, 0.16);
}
.contact-meta { min-width: 0; }
.contact-name { margin: 0; font-size: 18px; font-weight: 600; }
.contact-addr { margin-top: 2px; }
.contact-back {
  width: 32px; height: 32px; border-radius: 8px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border);
  color: var(--fg-1); font-size: 18px;
}
.contact-edit-nick, .contact-notes {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-strong);
  background: rgba(10, 14, 22, 0.55);
  color: var(--fg-0);
  font: inherit;
  outline: none;
}
.contact-notes { resize: vertical; min-height: 60px; }
.contact-edit-nick:focus, .contact-notes:focus, .contact-chat-cap:focus {
  border-color: rgba(122, 247, 255, 0.45);
  box-shadow: 0 0 0 3px rgba(122, 247, 255, 0.10);
}

.contact-ringtone-upload-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 9px 14px;
  cursor: pointer;
}

.contact-chat-log {
  display: flex; flex-direction: column; gap: 6px;
  max-height: 240px; overflow-y: auto;
  padding: 6px;
  background: rgba(8, 11, 18, 0.45);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
}
.contact-chat-log:empty { display: none; }
.contact-chat-msg {
  padding: 7px 10px; border-radius: 10px; font-size: 13px;
  border: 1px solid var(--border);
  max-width: 85%;
}
.contact-chat-msg small { display: block; font-size: 9.5px; color: var(--fg-2); margin-bottom: 2px; }
.contact-chat-msg.me   { background: rgba(122, 247, 255, 0.07); border-color: rgba(122, 247, 255, 0.22); align-self: flex-end; }
.contact-chat-msg.them { background: rgba(184, 150, 255, 0.06); border-color: rgba(184, 150, 255, 0.20); align-self: flex-start; }

/* ── Install guide modal ──────────────────────────────── */
.ig-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(2, 4, 8, 0.78);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: max(20px, env(safe-area-inset-top, 0px)) 16px max(20px, env(safe-area-inset-bottom, 0px));
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
  overflow-y: auto;
}
.ig-overlay.is-open { opacity: 1; pointer-events: auto; }

.ig-modal {
  position: relative;
  width: min(560px, 100%);
  margin: auto;
  background: linear-gradient(180deg, rgba(14, 22, 34, 0.96), rgba(10, 14, 22, 0.96));
  border: 1px solid var(--border-strong);
  border-radius: 22px;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.6), 0 0 60px rgba(0, 255, 255, 0.10);
  padding: 22px 22px 18px;
  transform: translateY(12px);
  transition: transform 0.28s cubic-bezier(0.2, 0.9, 0.25, 1);
}
.ig-overlay.is-open .ig-modal { transform: translateY(0); }

.ig-close {
  position: absolute;
  top: 10px; right: 10px;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--fg-1);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: grid; place-items: center;
}
.ig-close:hover { background: rgba(255, 255, 255, 0.10); color: var(--fg-0); }

.ig-head { padding-right: 40px; margin-bottom: 18px; }
.ig-platform {
  display: inline-block;
  font-size: 10.5px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(122, 247, 255, 0.08);
  border: 1px solid rgba(122, 247, 255, 0.22);
  padding: 3px 8px;
  border-radius: 999px;
  margin-bottom: 8px;
}
.ig-title {
  margin: 0 0 8px;
  font-size: 22px;
  letter-spacing: -0.2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.ig-tip {
  margin: 6px 0 10px;
  font-size: 12.5px;
  color: var(--warn);
  background: rgba(255, 180, 90, 0.07);
  border: 1px solid rgba(255, 180, 90, 0.22);
  padding: 8px 10px;
  border-radius: 10px;
}
.ig-why {
  margin: 4px 0 0;
  color: var(--fg-1);
  font-size: 13px;
}
.ig-why strong { color: var(--fg-0); }

.ig-steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ig-step {
  display: grid;
  grid-template-columns: 36px 1fr;
  grid-template-areas: "num text" "illust illust";
  gap: 10px 12px;
  padding: 12px;
  background: rgba(8, 11, 18, 0.55);
  border: 1px solid var(--border);
  border-radius: 14px;
  align-items: start;
}
.ig-step-num {
  grid-area: num;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(122, 247, 255, 0.18), rgba(122, 247, 255, 0.04));
  border: 1px solid rgba(122, 247, 255, 0.32);
  color: var(--accent);
  font-weight: 700;
  display: grid; place-items: center;
}
.ig-step-text { grid-area: text; min-width: 0; }
.ig-step-text h4 { margin: 4px 0 4px; font-size: 14.5px; font-weight: 600; }
.ig-step-text p  { margin: 0; color: var(--fg-1); font-size: 13px; line-height: 1.5; }
.ig-step-text .btn { margin-top: 10px; }

.ig-step-illust {
  grid-area: illust;
  display: grid;
  place-items: center;
  padding: 8px 6px 4px;
}

/* SVG illustrations */
.ig-svg.ig-iphone {
  width: 200px;
  max-width: 80%;
  height: auto;
}
.ig-svg.ig-browser {
  width: 320px;
  max-width: 100%;
  height: auto;
}

/* Step-specific SVG element visibility */
.ig-svg .ig-arrow,
.ig-svg .ig-sheet { opacity: 0; transition: opacity 0.2s ease; }
.ig-svg-step-share .ig-svg .ig-arrow-share { opacity: 1; }
.ig-svg-step-share .ig-svg .ig-share-bg     { fill: rgba(122, 247, 255, 0.18); animation: ig-tint 1.6s ease-in-out infinite; }
.ig-svg-step-add   .ig-svg .ig-sheet         { opacity: 1; }

/* Pulsing rings */
.ig-svg .ig-pulse {
  fill: rgba(122, 247, 255, 0.18);
  stroke: rgba(122, 247, 255, 0.5);
  stroke-width: 1.5;
  transform-origin: center;
  animation: ig-ring 1.6s ease-out infinite;
}
.ig-svg .ig-pulse-add {
  fill: none;
  stroke: rgba(122, 247, 255, 0.6);
  stroke-width: 2;
  transform-origin: center;
  animation: ig-ring 1.6s ease-out infinite;
}
@keyframes ig-ring {
  0%   { transform: scale(0.6); opacity: 0.85; }
  100% { transform: scale(1.6); opacity: 0;    }
}
@keyframes ig-tint {
  0%, 100% { opacity: 0.55; }
  50%      { opacity: 1;    }
}

/* Reduced motion: keep things visible but stop the kinetics */
@media (prefers-reduced-motion: reduce) {
  .ig-svg .ig-pulse, .ig-svg .ig-pulse-add { animation: none; }
  .ig-svg .ig-share-bg { animation: none; }
}

/* ── Info button + Home install banner ────────────────── */
.btn-info {
  appearance: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(122, 247, 255, 0.08);
  border: 1px solid rgba(122, 247, 255, 0.32);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  font-style: italic;
  font-family: serif;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  line-height: 1;
  padding: 0;
  vertical-align: middle;
  margin-left: 6px;
}
.btn-info:hover { background: rgba(122, 247, 255, 0.16); }

.install-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: linear-gradient(90deg, rgba(122, 247, 255, 0.08), rgba(184, 150, 255, 0.06));
  border: 1px solid rgba(122, 247, 255, 0.28);
}
.install-banner .ib-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: rgba(122, 247, 255, 0.15);
  border: 1px solid rgba(122, 247, 255, 0.32);
  display: grid; place-items: center;
  flex: 0 0 32px;
  font-size: 16px;
}
.install-banner .ib-text { flex: 1; min-width: 0; }
.install-banner .ib-text strong { display: block; font-size: 13px; }
.install-banner .ib-text small  { display: block; font-size: 11.5px; color: var(--fg-2); margin-top: 2px; }
.install-banner .ib-actions { display: flex; gap: 6px; flex-shrink: 0; }
.install-banner .btn { padding: 7px 11px; font-size: 12px; }

/* Lock screen install hint */
.lock-explain .lock-install-link {
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
}

/* ── Reachability banner (Phase 10) ────────────────────── */
.reachability-banner {
  background: linear-gradient(90deg, rgba(255,180,90,0.18), rgba(255,180,90,0.08));
  border-bottom: 1px solid rgba(255,180,90,0.45);
  color: #ffd6a2;
  padding: 9px 14px;
  font-size: 12.5px;
  line-height: 1.45;
  text-align: center;
}
.reachability-banner a {
  color: #fff;
  text-decoration: underline;
  margin-left: 6px;
  cursor: pointer;
  font-weight: 600;
}

/* ── Reduced motion ────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .status::before, .hero-orb-pulse, .sphere1-orb-pulse, .banner { animation: none; }
}

/* ── Phase 9a — DM list + thread ───────────────────────── */
.page-chat { display: flex; flex-direction: column; gap: 10px; padding-bottom: 18px; }
.dm-list { display: flex; flex-direction: column; gap: 6px; }
.dm-list-row {
  display: block;
  width: 100%;
  text-align: left;
  background: rgba(10, 14, 22, 0.55);
  border: 1px solid var(--border, #1f2734);
  border-radius: var(--r-sm, 10px);
  padding: 10px 12px;
  color: var(--fg-0, #d8e2ee);
  cursor: pointer;
  position: relative;
  transition: background 120ms;
}
.dm-list-row:hover { background: rgba(20, 28, 42, 0.7); }
.dm-list-row.has-unread { border-color: var(--accent, #7af7ff); }
.dm-list-row-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.dm-list-row-name { font-weight: 600; }
.dm-list-row-kind {
  display: inline-block;
  margin-right: 6px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(122, 247, 255, 0.16);
  color: #a4ffd0;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.3px;
  vertical-align: middle;
}
.dm-list-row.is-room .dm-list-row-name { color: var(--fg-0); }
.dm-msg-sender {
  display: block;
  font-weight: 600;
  margin-bottom: 2px;
  opacity: 0.85;
  font-size: 11px;
}
.dm-list-row-when { white-space: nowrap; }
.dm-list-row-preview { color: var(--fg-2, #98a3b1); font-size: 12.5px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-list-row-badge {
  position: absolute; top: 8px; right: 10px;
  background: var(--accent, #7af7ff);
  color: #0a0e16;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  text-align: center;
}
.dm-thread-card { display: flex; flex-direction: column; flex: 1; min-height: 360px; }
.dm-thread-log {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 4px;
  min-height: 240px;
}
.dm-msg {
  max-width: 82%;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(20, 28, 42, 0.7);
  border: 1px solid var(--border, #1f2734);
  word-break: break-word;
}
.dm-msg.me {
  align-self: flex-end;
  background: rgba(122, 247, 255, 0.12);
  border-color: rgba(122, 247, 255, 0.35);
}
.dm-msg.them { align-self: flex-start; }
.dm-msg.deleted, .dm-msg.err { font-style: italic; color: var(--fg-2, #98a3b1); }
.dm-msg-text { white-space: pre-wrap; }
.dm-msg-meta { font-size: 10.5px; margin-top: 4px; opacity: 0.8; }
.dm-compose {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  align-items: flex-end;
}
.dm-attach-label {
  flex-shrink: 0;
  padding: 9px 12px;
  cursor: pointer;
  align-self: flex-end;
  font-size: 16px;
}
.dm-attach-label.busy { opacity: 0.6; pointer-events: none; }
.dm-msg-file { display: flex; flex-direction: column; gap: 8px; }
.dm-msg-file-meta { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.dm-msg-file-icon { font-size: 16px; }
.dm-msg-file-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 240px; }
.dm-msg-file-size { color: var(--fg-2, #98a3b1); }
.dm-msg-file-preview { display: flex; flex-direction: column; gap: 6px; }
.dm-msg-file-img { max-width: 100%; max-height: 320px; border-radius: 8px; display: block; }
.dm-msg.has-file { max-width: 90%; }
.dm-typing-pill {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(122, 247, 255, 0.16);
  color: #a4ffd0;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.3px;
  vertical-align: middle;
  animation: dm-typing-pulse 1.4s infinite ease-in-out;
}
@keyframes dm-typing-pulse { 0%,100% { opacity: 0.55; } 50% { opacity: 1; } }
.dm-compose textarea {
  flex: 1;
  resize: vertical;
  min-height: 40px;
  max-height: 200px;
  padding: 9px 12px;
  border-radius: var(--r-sm, 10px);
  border: 1px solid var(--border-strong, #2a3344);
  background: rgba(10, 14, 22, 0.6);
  color: var(--fg-0, #d8e2ee);
  font: inherit;
}
@media (min-width: 760px) {
  /* Desktop: list on the left (320px) + thread on the right (flex). */
  .page-chat { flex-direction: row; align-items: stretch; }
  .dm-list-card { width: 340px; flex-shrink: 0; max-height: calc(100vh - 120px); overflow-y: auto; }
  .dm-thread-card { flex: 1; }
}

/* ──────────── Multi-member room-create dialog (Phase 9c.1) ──────────── */
.y-dialog {
  border: 1px solid var(--border-strong);
  background: var(--bg-1);
  color: var(--fg-0);
  border-radius: var(--r-md);
  padding: 20px;
  max-width: 520px;
  width: calc(100% - 32px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
.y-dialog::backdrop { background: rgba(0,0,0,0.55); backdrop-filter: blur(2px); }
.y-dialog input[type="text"],
.y-dialog textarea {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-strong);
  background: rgba(10, 14, 22, 0.6);
  color: var(--fg-0);
  font: inherit;
  margin-top: 4px;
}
.y-dialog textarea { resize: vertical; min-height: 44px; max-height: 160px; }
.rcd-contacts, .rcd-pending {
  list-style: none; margin: 0; padding: 0;
  max-height: 160px; overflow-y: auto;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: rgba(10, 14, 22, 0.4);
}
.rcd-contacts li, .rcd-pending li {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.rcd-contacts li:last-child, .rcd-pending li:last-child { border-bottom: none; }
.rcd-contacts li .rcd-tick { width: 18px; }
.rcd-contacts li[data-picked="1"] { background: rgba(122, 247, 255, 0.08); }
.rcd-contacts li[data-picked="1"] .rcd-tick { color: var(--accent); }
.rcd-contacts li button.rcd-toggle {
  margin-left: auto;
  background: transparent; border: 1px solid var(--border-strong);
  color: var(--fg-1); padding: 4px 10px; border-radius: var(--r-xs);
  cursor: pointer; font-size: 12px;
}
.rcd-contacts li[data-picked="1"] button.rcd-toggle { color: var(--accent); border-color: var(--accent); }
.rcd-pending li .rcd-pending-addr { font-family: ui-monospace, monospace; font-size: 12px; color: var(--fg-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rcd-pending li button.rcd-remove {
  margin-left: auto;
  background: transparent; border: 1px solid var(--border-strong);
  color: var(--err); padding: 2px 8px; border-radius: var(--r-xs);
  cursor: pointer; font-size: 12px;
}
.rcd-pending:empty::before {
  content: "No members added yet — pick from contacts or paste an address.";
  display: block; padding: 10px; color: var(--fg-2); font-size: 12px; text-align: center;
}
