:root {
  color-scheme: light;
  --bg: #fff7ef;
  --card: rgba(255, 255, 255, 0.9);
  --text: #111827;
  --muted: #667085;
  --line: rgba(124, 29, 18, 0.12);
  --accent: #ff6b00;
  --accent-2: #ffb02e;
  --danger: #b42318;
  --shadow: 0 24px 70px rgba(124, 29, 18, 0.14);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(255, 176, 46, 0.28), transparent 34rem),
    linear-gradient(135deg, #fffaf5, var(--bg));
  color: var(--text);
}

button, input, textarea {
  font: inherit;
}

button {
  min-height: 48px;
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
}

input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--text);
  outline: none;
}

textarea {
  min-height: 110px;
  resize: vertical;
}

label {
  display: grid;
  gap: 8px;
  font-weight: 800;
}

.hidden { display: none !important; }

.app-shell {
  width: min(100%, 980px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: 18px 16px 110px;
}

.auth-screen {
  display: grid;
  align-content: center;
  gap: 18px;
  min-height: 100dvh;
}

.main-screen {
  display: grid;
  gap: 18px;
}

.brand-card,
.hero-card,
.card,
.topbar,
.list-card {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.brand-card,
.hero-card,
.card {
  padding: 22px;
}

.topbar {
  position: sticky;
  top: 12px;
  z-index: 10;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 14px;
  backdrop-filter: blur(18px);
}

.hero-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.action-card {
  display: grid;
  gap: 8px;
  min-height: 132px;
  padding: 22px;
  border-radius: 24px;
  background: linear-gradient(145deg, #ffffff, #fff5eb);
  box-shadow: 0 18px 48px rgba(17, 24, 39, 0.08);
  color: var(--text);
  text-align: left;
}

.action-card span,
.muted,
.status-line,
.global-status,
.empty {
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 4px;
  color: #d9480f;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1, h2, h3, p {
  margin-top: 0;
}

h1 { margin-bottom: 4px; font-size: clamp(1.8rem, 4vw, 3rem); }
h2 { margin-bottom: 8px; font-size: clamp(1.45rem, 3vw, 2.25rem); }
h3 { margin-bottom: 6px; font-size: 1.15rem; }

.logo-orb,
.avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 20%, #fff8d6 0 12%, #ff8a00 38%, #ff4d00 100%);
  color: #fff;
  font-weight: 950;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.28), 0 18px 38px rgba(255, 107, 0, 0.28);
  overflow: hidden;
}

.logo-orb,
.avatar-xl { width: 86px; height: 86px; font-size: 1.8rem; }
.avatar-xxl { width: 128px; height: 128px; font-size: 2.4rem; }
.small-avatar { width: 54px; height: 54px; font-size: 1rem; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.avatar.online-ring {
  box-shadow:
    0 0 0 3px #16a34a,
    0 0 0 8px rgba(34, 197, 94, 0.18),
    inset 0 0 0 2px rgba(255, 255, 255, 0.28),
    0 18px 38px rgba(255, 107, 0, 0.28);
}

.avatar-button {
  position: relative;
  width: max-content;
  padding: 0;
  background: transparent;
}

.avatar-button.center {
  justify-self: center;
}

.camera-badge {
  position: absolute;
  right: -4px;
  bottom: -4px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: #111827;
  color: #fff;
  border: 3px solid #fff;
}

.primary-button,
.ghost-button,
.danger-button,
.google-button,
.pill-button {
  border-radius: 18px;
  padding: 12px 16px;
  font-weight: 900;
}

.primary-button {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 14px 28px rgba(255, 107, 0, 0.25);
}

.ghost-button {
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  border: 1px solid var(--line);
}

.danger-button {
  width: 100%;
  background: rgba(180, 35, 24, 0.1);
  color: var(--danger);
}

.google-button {
  display: grid;
  place-items: center;
  width: 100%;
  background: #fff;
  color: #202124;
  border: 1px solid rgba(60, 64, 67, 0.22);
  box-shadow: 0 12px 28px rgba(60, 64, 67, 0.08);
}

.auth-mode {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 6px;
  border-radius: 22px;
  background: rgba(255, 107, 0, 0.08);
}

.pill-button {
  min-height: 44px;
  background: transparent;
  color: var(--muted);
}

.pill-button.active {
  background: #fff;
  color: var(--accent);
  box-shadow: 0 10px 24px rgba(255, 107, 0, 0.13);
}

.microcopy {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.small {
  min-height: 42px;
  padding: 9px 12px;
  border-radius: 14px;
}

.view {
  display: none;
  gap: 18px;
}

.view.active {
  display: grid;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-head.inline {
  margin-bottom: 12px;
}

.form-card,
.friend-form {
  display: grid;
  gap: 14px;
}

.friend-form,
.chat-composer {
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.list-card {
  display: grid;
  gap: 10px;
  min-height: 90px;
  padding: 12px;
}

.list-card.compact {
  box-shadow: none;
  border-radius: 20px;
}

.person-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 66px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.76);
  text-align: left;
}

.person-row.compact-contact {
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.person-row.compact-contact:hover,
.person-row.compact-contact:focus-visible {
  transform: translateY(-1px);
  background: #fff;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.08);
}

.person-row span {
  display: block;
  color: var(--muted);
  font-size: 0.92rem;
}

.person-row small {
  display: block;
  margin-top: 3px;
  color: #475467;
  font-size: 0.86rem;
  line-height: 1.3;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.contact-badges {
  display: grid;
  justify-items: end;
  gap: 4px;
}

.contact-badge {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  min-height: 22px;
  padding: 2px 7px;
  border-radius: 999px;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 950;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
}

.contact-badge.message { background: linear-gradient(135deg, #2563eb, #7c3aed); }
.contact-badge.missed { background: linear-gradient(135deg, #ef4444, #f97316); }
.contact-badge.self { background: linear-gradient(135deg, #16a34a, #22c55e); }

.contact-modal {
  width: min(92vw, 460px);
}

.contact-sheet-profile {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding: 8px 2px 16px;
}

.contact-sheet-profile h2 {
  margin: 0;
  font-size: clamp(1.5rem, 6vw, 2.2rem);
}

.contact-about {
  margin: 8px 0 0;
  color: #475467;
  line-height: 1.35;
}

.contact-sheet-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.contact-sheet-actions button {
  min-height: 56px;
}

.search-result {
  min-height: 24px;
  color: var(--muted);
}

.qr-code,
.qr-large {
  display: grid;
  place-items: center;
  padding: 16px;
  border-radius: 24px;
  background: #fff;
  overflow: visible;
}

.qr-code canvas,
.qr-large canvas {
  max-width: 100%;
  height: auto !important;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 50;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: min(94vw, 640px);
  transform: translateX(-50%);
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 18px 50px rgba(17, 24, 39, 0.14);
  backdrop-filter: blur(18px);
}

.bottom-nav + .bottom-nav,
.app-nav,
.sidebar .app-nav,
.nav-rail,
.legacy-bottom-nav,
[data-fline-legacy-nav="true"] {
  display: none !important;
}

.tab {
  display: grid;
  place-items: center;
  gap: 2px;
  border-radius: 22px;
  background: transparent;
  color: var(--text);
  font-weight: 900;
}

.tab.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
}

.modal-card {
  width: min(92vw, 560px);
  max-height: 88dvh;
  border: 0;
  border-radius: 28px;
  padding: 18px;
  background: #fffaf5;
  box-shadow: 0 34px 90px rgba(15, 23, 42, 0.35);
}

.modal-card::backdrop {
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(10px);
}

.modal-close-row {
  display: flex;
  justify-content: flex-end;
}

.chat-log {
  display: grid;
  gap: 8px;
  align-content: start;
  min-height: 180px;
  max-height: min(48dvh, 440px);
  overflow: auto;
  padding: 12px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.52), rgba(255, 251, 246, 0.72));
}

.chat-log p {
  width: fit-content;
  max-width: 78%;
  margin: 0;
  min-height: 0;
  padding: 9px 12px;
  border-radius: 18px;
  background: #fff;
  line-height: 1.32;
  overflow-wrap: anywhere;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.055);
}

.chat-log p.mine {
  justify-self: end;
  background: linear-gradient(135deg, #ffd99f, #ffe8c9);
}

.chat-log p.queued {
  opacity: 0.74;
  border: 1px dashed rgba(255, 107, 0, 0.42);
}

.chat-log p.attachment-line {
  display: grid;
  gap: 4px;
}

.chat-log p.attachment-line small {
  color: #475467;
}

.attachment-preview {
  margin: 8px 0;
  padding: 10px 12px;
  border-radius: 18px;
  color: #0f172a;
  background: rgba(255, 255, 255, 0.78);
  border: 1px dashed rgba(255, 107, 0, 0.45);
}

.chat-composer {
  position: sticky;
  bottom: 0;
  display: grid;
  align-items: center;
  padding-top: 8px;
  background: linear-gradient(180deg, rgba(255, 250, 245, 0), #fffaf5 34%);
}

.chat-menu {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 8px 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
}

.chat-menu[hidden] {
  display: none;
}

.chat-settings-modal {
  width: min(92vw, 520px);
}

.health-modal {
  width: min(94vw, 720px);
}

.audio-route-modal {
  width: min(92vw, 480px);
}

.health-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 12px 0 18px;
}

.health-tile,
.setting-row {
  display: grid;
  gap: 5px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.84);
  color: var(--text);
  text-align: left;
}

.health-tile b,
.setting-row b {
  font-size: 0.95rem;
}

.health-tile span,
.setting-row span {
  color: var(--muted);
  font-size: 0.9rem;
}

.setting-row.is-selected {
  border-color: rgba(255, 107, 0, 0.55);
  box-shadow: 0 0 0 2px rgba(255, 107, 0, 0.12);
  background: linear-gradient(135deg, rgba(255, 107, 0, 0.12), rgba(255, 255, 255, 0.96));
}

.health-tile.good {
  border-color: rgba(22, 163, 74, 0.28);
  background: linear-gradient(145deg, rgba(240, 253, 244, 0.94), rgba(255, 255, 255, 0.9));
}

.health-tile.warn {
  border-color: rgba(245, 158, 11, 0.32);
  background: linear-gradient(145deg, rgba(255, 251, 235, 0.96), rgba(255, 255, 255, 0.9));
}

.health-tile.bad {
  border-color: rgba(220, 38, 38, 0.32);
  background: linear-gradient(145deg, rgba(254, 242, 242, 0.96), rgba(255, 255, 255, 0.9));
}

.settings-list {
  display: grid;
  gap: 10px;
}

.diagnostic-report {
  max-height: 320px;
  overflow: auto;
  padding: 14px;
  border-radius: 18px;
  background: #111827;
  color: #e5e7eb;
  white-space: pre-wrap;
}

.settings-grid.compact {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.settings-grid.compact .danger-button,
.settings-grid.compact .ghost-button {
  min-height: 48px;
  justify-content: center;
}

.chat-composer input {
  min-height: 52px;
}

.chat-composer .ghost-button,
.chat-composer .primary-button {
  min-height: 52px;
  padding-inline: 18px;
}

.notes-card {
  display: grid;
  gap: 16px;
}

.notes-list {
  display: grid;
  gap: 10px;
  max-height: 50vh;
  overflow: auto;
}

.note-row {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(135deg, #fff, #fff7ed);
}

.note-row p {
  margin: 0;
  white-space: pre-wrap;
}

.note-row small {
  color: var(--muted);
}

.notes-composer {
  grid-template-columns: 1fr auto;
}

.call-modal {
  position: fixed;
  inset: 0;
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #05070d;
  color: #fff;
  overflow: hidden;
}

.call-modal[open] {
  display: block;
}

.call-modal::backdrop {
  background: #000;
}

.call-stage {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  min-height: 100dvh;
  overflow: hidden;
  border-radius: 0;
  background: radial-gradient(circle at 50% 20%, #1f2937, #000 72%);
}

.call-stage::before,
.call-stage::after {
  content: "";
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  pointer-events: none;
}

.call-stage::before {
  top: 0;
  height: 34%;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.6), transparent 78%);
}

.call-stage::after {
  bottom: 0;
  height: 38%;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.64), transparent 82%);
}

.remote-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
  filter: brightness(1.42) contrast(1.16) saturate(1.22);
  transform: translateZ(0);
  will-change: transform, filter;
}

.remote-video.self-preview {
  transform: scaleX(-1);
}

.local-video {
  position: absolute;
  z-index: 4;
  top: max(92px, calc(env(safe-area-inset-top) + 82px));
  right: max(14px, env(safe-area-inset-right));
  width: clamp(96px, 24vw, 176px);
  aspect-ratio: 9 / 16;
  object-fit: cover;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  border-radius: 20px;
  background: #111827;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  transform: scaleX(-1);
  touch-action: none;
  cursor: grab;
  overflow: hidden;
}

.local-video.dragging {
  cursor: grabbing;
  box-shadow: 0 22px 50px rgba(255, 107, 0, 0.36);
}

.call-avatar {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  width: clamp(138px, 30vw, 190px);
  height: clamp(138px, 30vw, 190px);
  border-radius: 999px;
  background: #52758a;
  color: #fff;
  font-size: 3rem;
  font-weight: 950;
}

.call-modal.video-ready .call-avatar,
.call-modal.video-call .call-avatar {
  display: none;
}

.call-copy {
  position: fixed;
  z-index: 5;
  top: 0;
  left: 0;
  right: 0;
  display: grid;
  gap: 2px;
  min-height: max(86px, calc(env(safe-area-inset-top) + 76px));
  padding: max(14px, calc(env(safe-area-inset-top) + 10px)) 92px 14px 64px;
  background: linear-gradient(180deg, rgba(5, 7, 13, 0.78), rgba(5, 7, 13, 0.38) 72%, transparent);
  backdrop-filter: blur(10px);
}

.call-quality-badge {
  position: fixed;
  top: max(24px, calc(env(safe-area-inset-top) + 20px));
  right: max(20px, env(safe-area-inset-right));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 76px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, #16a34a, #059669);
  box-shadow: 0 12px 28px rgba(5, 150, 105, 0.32);
  font-size: 0.78rem;
  font-weight: 950;
  letter-spacing: 0.04em;
}

.call-copy::before {
  content: "‹";
  position: fixed;
  left: max(18px, env(safe-area-inset-left));
  top: max(20px, calc(env(safe-area-inset-top) + 16px));
  font-size: 3rem;
  line-height: 1;
  color: #fff;
  opacity: 0.95;
}

.call-copy h2 {
  margin: 0;
  font-size: clamp(1.35rem, 5vw, 2rem);
  color: #fff;
}

.call-copy .status-line {
  color: rgba(255, 255, 255, 0.74);
  margin: 0;
}

.call-actions {
  position: fixed;
  z-index: 5;
  left: 50%;
  bottom: max(14px, calc(env(safe-area-inset-bottom) + 14px));
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  width: min(94vw, 540px);
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 28px;
  background: rgba(18, 24, 38, 0.75);
  box-shadow: 0 20px 56px rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.call-control {
  position: relative;
  min-width: 0;
  min-height: 70px;
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 7px;
  padding: 0;
  border: 0;
  border-radius: 20px;
  background: transparent;
  color: #fff;
  font: inherit;
  font-weight: 850;
  cursor: pointer;
  transition: transform 150ms ease, opacity 150ms ease, filter 150ms ease;
}

.call-control:hover {
  transform: translateY(-1px);
}

.call-control:active,
.call-control.pressed {
  transform: scale(0.92);
}

.call-control:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.call-control-icon {
  position: relative;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  background: rgba(255, 255, 255, 0.10);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 10px 24px rgba(0, 0, 0, 0.20);
  transition: background 180ms ease, box-shadow 180ms ease, color 180ms ease, transform 180ms ease;
}

.call-control-icon svg {
  width: 27px;
  height: 27px;
  stroke: currentColor;
  stroke-width: 2.35;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.call-control-label {
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.72rem;
  line-height: 1;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.36);
}

.call-control.is-active .call-control-icon,
.call-control.muted .call-control-icon {
  background: #ff6b00;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.16), 0 14px 28px rgba(255, 107, 0, 0.32);
}

.call-control.quality-active .call-control-icon {
  box-shadow: 0 0 0 2px #ffc107, 0 0 22px rgba(255, 193, 7, 0.44), inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.call-control.recording .call-control-icon {
  background: rgba(239, 68, 68, 0.22);
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.72), 0 0 22px rgba(239, 68, 68, 0.38);
}

.call-control.recording .call-control-icon::after {
  content: "";
  position: absolute;
  right: 9px;
  top: 9px;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #ff3b30;
  box-shadow: 0 0 12px rgba(255, 59, 48, 0.8);
}

.call-unread-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #fff;
  background: #ff3b30;
  border: 2px solid rgba(18, 24, 38, 0.92);
  font-size: 0.66rem;
  font-weight: 950;
}

.call-modal.privacy-mode .remote-video {
  filter: brightness(1.24) contrast(1.10) saturate(1.10) blur(1.2px);
}

.call-modal.virtual-background .call-stage {
  background:
    radial-gradient(circle at 18% 20%, rgba(255, 107, 0, 0.38), transparent 28%),
    radial-gradient(circle at 86% 28%, rgba(34, 197, 94, 0.30), transparent 30%),
    linear-gradient(135deg, #05070d, #101827 58%, #030712);
}

.call-control-end .call-control-icon {
  background: #ff3b30;
  box-shadow: 0 14px 30px rgba(255, 59, 48, 0.38);
}

.call-control-wide {
  min-height: 58px;
  align-content: center;
  padding-inline: 18px;
  border-radius: 999px;
  color: #fff;
  font-weight: 950;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
}

.call-control-answer {
  background: linear-gradient(135deg, #ff7a00, #ffb21a);
}

.call-control-decline {
  background: #ff3b30;
}

.native-android-shell .call-control-answer,
.native-android-shell .call-control-decline {
  display: none !important;
}

.participants-modal {
  width: min(92vw, 520px);
}

.participant-row {
  grid-template-columns: auto auto minmax(0, 1fr);
}

.participant-row input {
  inline-size: 22px;
  block-size: 22px;
  accent-color: #ff6b00;
}

.secondary-call-control {
  display: none;
}

.call-modal.secondary-open .secondary-call-control {
  display: grid;
}

.call-modal.secondary-open .call-actions {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  width: min(94vw, 560px);
  border-radius: 28px;
  background: rgba(18, 24, 38, 0.78);
}

.call-modal.controls-hidden .call-copy,
.call-modal.controls-hidden .call-actions {
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
}

.call-copy,
.call-actions {
  transition: opacity 180ms ease, transform 180ms ease;
}

.call-modal.incoming .call-stage {
  min-height: 100dvh;
}

.call-modal.incoming .call-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

body.fline-call-active .bottom-nav {
  display: none;
}

@media (min-width: 760px) {
  .call-actions {
    bottom: max(22px, calc(env(safe-area-inset-bottom) + 22px));
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .local-video {
    top: max(96px, calc(env(safe-area-inset-top) + 92px));
    right: max(24px, env(safe-area-inset-right));
    width: clamp(132px, 15vw, 220px);
  }
}

.toast-stack {
  position: fixed;
  z-index: 120;
  right: max(14px, env(safe-area-inset-right));
  bottom: calc(max(92px, env(safe-area-inset-bottom)) + 28px);
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 28px));
  pointer-events: none;
}

.toast-card {
  pointer-events: auto;
  display: grid;
  gap: 5px;
  min-height: 64px;
  padding: 14px 16px;
  border-radius: 22px;
  text-align: left;
  color: #fff;
  background: linear-gradient(135deg, #111827, #334155);
  box-shadow: 0 20px 44px rgba(15, 23, 42, 0.24);
  animation: toast-in 220ms ease-out;
}

.toast-card span {
  color: rgba(255, 255, 255, 0.86);
  font-size: 0.92rem;
}

.toast-card.message {
  background: linear-gradient(135deg, #2563eb, #7c3aed);
}

.toast-card.call {
  background: linear-gradient(135deg, #ff6b00, #dc2626);
}

.toast-card.success {
  background: linear-gradient(135deg, #16a34a, #0f766e);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 760px) {
  .app-shell { padding-inline: 10px; }
  .topbar { grid-template-columns: auto minmax(0, 1fr); }
  .topbar .ghost-button { grid-column: 1 / -1; }
  .hero-card,
  .action-grid,
  .friend-form {
    grid-template-columns: 1fr;
  }
  #chat-dialog.modal-card {
    width: min(92vw, 520px);
    max-height: 90dvh;
    padding: 18px;
  }
  .chat-log {
    min-height: 280px;
    max-height: 52dvh;
  }
  .chat-log p {
    max-width: 82%;
    padding: 8px 11px;
  }
  .chat-composer {
    grid-template-columns: minmax(0, 1fr) 48px minmax(78px, auto);
    gap: 8px;
  }
  .chat-composer .ghost-button {
    width: 48px;
    padding-inline: 0;
  }
  .chat-composer .primary-button {
    min-width: 78px;
    padding-inline: 12px;
  }
  .chat-menu {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .health-grid {
    grid-template-columns: 1fr;
  }

  .settings-grid.compact {
    grid-template-columns: 1fr;
  }
  .person-row {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }
  .row-actions { justify-content: stretch; }
  .row-actions button { flex: 1 1 30%; }
  .toast-stack {
    left: 12px;
    right: 12px;
    width: auto;
  }
  .call-actions {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    width: min(94vw, 500px);
    padding: 12px;
    gap: 8px;
  }
  .call-control {
    min-height: 64px;
  }
  .call-control-icon {
    width: 44px;
    height: 44px;
  }
  .call-control-icon svg {
    width: 25px;
    height: 25px;
  }
  .local-video {
    width: 126px;
  }
}

@media (min-width: 900px) {
  .app-shell {
    width: min(100%, 860px);
  }

  .auth-screen {
    grid-template-columns: minmax(0, 1fr) minmax(360px, 0.82fr);
    align-items: center;
  }

  .bottom-nav {
    width: min(88vw, 720px);
  }
}
