/* v9 — phone and tablet layout, group calls, private rooms. (v12 gives phones the Likemind dock and arch avatars.) */

/* ── calls: grid of people, add-people panel ───────────── */
.call-inner.is-grid { width: min(100%, 760px); height: 100%; gap: 12px; grid-template-rows: auto minmax(0, 1fr) auto auto; align-items: center; }
.call-inner.is-grid .call-grid { max-height: 100%; overflow-y: auto; align-content: center; padding: 2px; scrollbar-width: none; }
.call-grid.n-5 .call-tile, .call-grid.n-6 .call-tile, .call-grid.n-7 .call-tile, .call-grid.n-8 .call-tile, .call-grid.n-9 .call-tile { aspect-ratio: 1; }
@media (max-width: 720px) { .call-grid.n-7, .call-grid.n-8, .call-grid.n-9 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .call-grid.n-7 .avatar-xl, .call-grid.n-8 .avatar-xl, .call-grid.n-9 .avatar-xl { width: 56px; height: 56px; font-size: 1.1rem; } }
.call-top { display: grid; justify-items: center; gap: 4px; }
.call-inner.is-grid .call-name { font-size: 1.5rem; }
.call-grid { width: 100%; display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.call-grid.n-1, .call-grid.n-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 721px) { .call-grid.n-5, .call-grid.n-6, .call-grid.n-7, .call-grid.n-8, .call-grid.n-9 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.call-tile { position: relative; aspect-ratio: 4 / 5; max-height: 34vh; width: 100%; border-radius: 18px; overflow: hidden; display: grid; place-items: center; background: linear-gradient(160deg, #1d2a3d, #16201f); border: 1px solid rgb(255 255 255 / 0.08); animation: arrive 360ms var(--ease) both; }
.call-grid.n-1 .call-tile, .call-grid.n-2 .call-tile { aspect-ratio: 3 / 4; max-height: 52vh; }
.call-tile.is-you { background: linear-gradient(160deg, #1f2a5c, #16201f); }
.call-tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.tile-av { position: relative; display: grid; place-items: center; }
.call-tile .avatar-xl { width: 84px; height: 84px; font-size: 1.7rem; box-shadow: none; position: relative; z-index: 1; }
.tile-rings span { position: absolute; inset: 0; margin: auto; width: 84px; height: 84px; border-radius: 50%; border: 2px solid rgb(255 255 255 / 0.3); animation: ring-out 2.2s ease-out infinite; }
.tile-rings span:last-child { animation-delay: 1.1s; border-color: rgb(229 162 35 / 0.5); }
.tile-name { position: absolute; left: 10px; bottom: 8px; z-index: 2; display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: var(--r-pill); background: rgb(0 0 0 / 0.45); color: #fff; font-size: var(--t-xs); font-weight: 600; }
.tile-state { position: absolute; top: 10px; right: 10px; z-index: 2; padding: 2px 8px; border-radius: var(--r-pill); background: rgb(255 255 255 / 0.12); color: #e6ecea; font-size: 0.6875rem; }
.call-tile.is-ringing .avatar-xl { opacity: 0.75; }
.call-tile.is-no-answer { opacity: 0.55; }
.call-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.call-inner.is-grid .call-controls { margin-top: 8px; gap: 10px; }
.call-inner.is-grid .call-btn { width: 62px; }
.call-inner.is-grid .call-btn > svg { width: 54px; height: 54px; padding: 15px; }
.call-add { position: absolute; inset: 0; z-index: 3; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; gap: 12px; width: min(100%, 460px); margin-inline: auto;
  padding: max(16px, env(safe-area-inset-top, 0px)) 16px max(16px, env(safe-area-inset-bottom, 0px)); background: #0f1716; animation: arrive 260ms var(--ease) both; }
.call-add-head { display: flex; align-items: center; gap: 10px; color: #fff; }
.call-add-head strong { flex: 1; font-size: 1.1rem; }
.call-add-head .tiny { color: #9fb0aa; }
.call-icon { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%; background: rgb(255 255 255 / 0.1); color: #fff; cursor: pointer; }
.call-search { width: 100%; min-height: 44px; padding: 0 14px; border-radius: var(--r-pill); border: 1px solid rgb(255 255 255 / 0.15); background: rgb(255 255 255 / 0.06); color: #fff; }
.call-search::placeholder { color: #9fb0aa; }
.call-pick { overflow-y: auto; display: grid; align-content: start; gap: 2px; }
.call-pick-row { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 14px; color: #fff; cursor: pointer; }
.call-pick-row:hover { background: rgb(255 255 255 / 0.06); }
.call-pick-row > span:not(.avatar) { display: grid; flex: 1; min-width: 0; text-align: left; }
.call-pick-row .tiny { color: #9fb0aa; }
.call-pick-row input { width: 22px; height: 22px; accent-color: #6fcb9e; }
.call-empty { color: #9fb0aa; padding: 12px; }

/* ── rooms: public / private ───────────────────────────── */
.lock-pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: var(--r-pill); background: var(--ink); color: var(--paper); font-size: var(--t-xs); font-weight: 600; }
.seg-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip-filter { display: inline-flex; align-items: center; gap: 5px; padding: 7px 14px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font: inherit; font-size: var(--t-s); font-weight: 600; cursor: pointer; }
.chip-filter.is-on { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.vis-choice { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.vis-opt { position: relative; cursor: pointer; }
.vis-opt input { position: absolute; opacity: 0; pointer-events: none; }
.vis-opt > span { display: grid; gap: 2px; padding: 12px; border-radius: var(--r-m); border: 1px solid var(--line); background: var(--surface); transition: border-color var(--dur), background var(--dur); }
.vis-opt svg { color: var(--ink-3); margin-bottom: 2px; }
.vis-opt input:checked + span { border-color: var(--cobalt); background: var(--cobalt-soft); }
.vis-opt input:checked + span svg { color: var(--cobalt); }
.vis-opt input:focus-visible + span { box-shadow: var(--focus); }
@media (max-width: 420px) { .vis-choice { grid-template-columns: minmax(0, 1fr); } }
.room-locked { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 34px 22px; }
.lock-badge { display: grid; place-items: center; width: 74px; height: 74px; border-radius: 24px; background: var(--ink); color: var(--paper); margin-bottom: 4px; }
.lock-form { width: min(100%, 340px); text-align: left; margin-top: 8px; }
.room-locked.is-shake .lock-badge { animation: shake 420ms var(--ease); }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* ── the new mark in the phone top bar ─────────────────── */
.topbar-me, .topbar-mark { display: none; }
.demo-banner .db-short { display: none; }
.stories { display: none; }

/* ── phones and tablets: composer stays one line until you tap it ── */
@media (max-width: 1000px) {
  .composer.is-collapsed { padding-block: 10px; }
  .composer.is-collapsed .post-types, .composer.is-collapsed .composer-tags, .composer.is-collapsed .composer-foot,
  .composer.is-collapsed .composer-note, .composer.is-collapsed [data-extra], .composer.is-collapsed [data-attach], .composer.is-collapsed [data-poll-box] { display: none; }
  .composer.is-collapsed .composer-row { align-items: center; }
  .composer.is-collapsed textarea { min-height: 0; height: 44px; resize: none; padding-block: 10px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .composer:not(.is-collapsed) { animation: arrive 260ms var(--ease) both; }
}

/* ── phones ────────────────────────────────────────────── */
@media (max-width: 720px) {
  /* demo banner: one line */
  .demo-banner { padding-block: 5px; font-size: 0.6875rem; }
  .demo-banner .db-long { display: none; }
  .demo-banner .db-short { display: inline; }
  .demo-banner svg { width: 14px; height: 14px; }

  /* top bar: avatar · mark · tools; slides away while you scroll down */
  .topbar { display: grid; grid-template-columns: 1fr auto 1fr; height: 54px; transition: transform 260ms var(--ease); border-bottom-color: transparent; }
  :root.bars-hidden .topbar { transform: translateY(-110%); }
  .topbar > .brand { display: none; }
  .topbar-me { display: inline-grid; justify-self: start; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; }
  .topbar-me .avatar { width: 34px; height: 34px; }
  .topbar-mark { display: inline-grid; place-items: center; }
  .topbar-tools { justify-self: end; gap: 0; }
  .topbar-live { position: relative; }
  .topbar-live .live-dot { position: absolute; top: 8px; right: 8px; width: 7px; height: 7px; margin: 0; box-shadow: 0 0 0 2px var(--paper); }

  /* tab bar: icons only, frosted, an active dot in the brand colours */
  .tabbar { grid-template-columns: repeat(5, 1fr); height: calc(58px + env(safe-area-inset-bottom, 0px));
    background: color-mix(in oklab, var(--surface) 82%, transparent); backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4); }
  .tab { position: relative; padding: 0; height: 58px; place-items: center; color: var(--ink-3); }
  .tab.is-active { color: var(--ink); }
  .tab.is-active .nav-icon svg { stroke-width: 2.3; }
  .tab.is-active::after { content: ""; position: absolute; bottom: 8px; left: 50%; width: 18px; height: 3px; margin-left: -9px; border-radius: 3px; background: var(--grad-brand); }
  .tab .nav-icon { position: relative; display: inline-grid; }
  .tab .nav-badge { top: -5px; right: -10px; }
  .tab-compose { width: 46px; height: 38px; border-radius: 14px; background: var(--grad-brand); color: #fff; box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--cobalt) 70%, transparent); }
  .tab-compose:active { transform: scale(0.94); }
  .main { padding-top: 6px; padding-bottom: calc(58px + 28px + env(safe-area-inset-bottom, 0px)); }
  .toasts { bottom: calc(58px + 14px + env(safe-area-inset-bottom, 0px)); }

  /* side drawer instead of a bottom sheet */
  .sheet.drawer { top: 0; bottom: 0; left: 0; right: auto; width: min(84vw, 330px); max-height: none; height: 100dvh; border-radius: 0 22px 22px 0;
    align-content: start; gap: 6px; padding: max(18px, env(safe-area-inset-top, 0px)) 18px max(18px, env(safe-area-inset-bottom, 0px)); animation: drawer-in 280ms var(--ease) both; }
  @keyframes drawer-in { from { transform: translateX(-100%); } to { transform: none; } }
  .drawer-head { display: flex; align-items: flex-start; justify-content: space-between; }
  .drawer-me { display: grid; gap: 2px; color: var(--ink); text-decoration: none; }
  .drawer-me .avatar { margin-bottom: 8px; }
  .drawer-me strong { font-size: 1.1rem; }
  .drawer-me > span:last-child { color: var(--ink-3); font-size: var(--t-s); }
  .drawer-counts { font-size: var(--t-s); color: var(--ink-3); margin-bottom: 8px; }
  .drawer-counts a { color: inherit; text-decoration: none; }
  .drawer-counts strong { color: var(--ink); }
  .drawer-nav { display: grid; gap: 2px; padding-block: 8px; border-block: 1px solid var(--line-soft); }
  .drawer-link { display: flex; align-items: center; gap: 16px; padding: 12px 6px; border-radius: 12px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 1.05rem; }
  .drawer-link:hover, .drawer-link.is-active { background: var(--sunk); }
  .drawer-link .live-dot { margin-left: auto; }
  .drawer-tools { display: flex; align-items: center; gap: 6px; padding: 8px 0; }
  .drawer-tools .tiny { flex: 1; }
  .drawer .foot-links { font-size: 0.6875rem; }

  /* feed: no big title; sticky tabs; posts edge to edge */
  .feed-head { display: none; }
  .intro-strip[href="#/intros"] { display: none; }
  .stories { display: flex; gap: 14px; overflow-x: auto; scrollbar-width: none; margin: 4px -16px 12px; padding: 4px 16px 6px; scroll-snap-type: x proximity; scroll-padding-inline: 16px; }
  .stories::-webkit-scrollbar { display: none; }
  .story { display: grid; justify-items: center; gap: 5px; flex: none; width: 70px; color: var(--ink); text-decoration: none; scroll-snap-align: start; }
  .story-ring { position: relative; display: grid; place-items: center; width: 68px; height: 68px; border-radius: 50%; padding: 3px; background: var(--grad-brand); }
  .story-ring .avatar { width: 60px; height: 60px; box-shadow: 0 0 0 3px var(--paper); }
  .story-live .story-ring { background: linear-gradient(135deg, var(--live), var(--marigold)); }
  .story-tag { position: absolute; bottom: -4px; left: 50%; transform: translateX(-50%); padding: 1px 7px; border-radius: 6px; background: var(--live); color: #fff; font-size: 0.625rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; box-shadow: 0 0 0 2px var(--paper); }
  .story-icon .story-ring { background: var(--sunk); color: var(--ink-2); box-shadow: inset 0 0 0 1.5px var(--line); }
  .story-name { max-width: 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.72rem; font-weight: 500; }
  .composer { margin-bottom: 4px; }
  .main > .tabs, .view .main > .tabs { position: sticky; top: calc(54px + env(safe-area-inset-top, 0px)); z-index: 20; margin-inline: -16px; padding-inline: 8px; margin-bottom: 0;
    background: color-mix(in oklab, var(--paper) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); transition: top 260ms var(--ease); }
  :root.bars-hidden .main > .tabs { top: env(safe-area-inset-top, 0px); }
  .post-list { gap: 0; margin-inline: -16px; }
  .post-list > .post { border-radius: 0; border-left: 0; border-right: 0; border-top: 0; padding-inline: 16px; }
  .post-list > .post:first-child { border-top: 1px solid var(--line-soft); }
  .post-list > .empty, .post-list > .intro-strip { margin: 12px 16px; }
  .post.is-pinned { border-color: var(--line-soft); }

  /* headings and spacing calmer */
  .h1 { font-size: 1.6rem; }
  .page-head { margin-bottom: 14px; }
  .page-head .muted { font-size: var(--t-s); }
  .page-bar { margin-bottom: 8px; }
  .section-title { margin: 20px 0 10px; }

  /* messages: list edge to edge; an open chat fills the screen */
  .dm { border: 0; border-radius: 0; margin-inline: -16px; background: transparent; height: auto; min-height: 0; }
  .dm.has-thread { position: fixed; inset: 0; z-index: 45; height: 100dvh; margin: 0; background: var(--surface); padding-top: env(safe-area-inset-top, 0px); }
  :root:has(.dm.has-thread) .tabbar, :root:has(.dm.has-thread) .topbar, :root:has(.dm.has-thread) .demo-banner { display: none; }
}

/* ── tablets (portrait iPad): icon rail with tooltips, roomier content ── */
@media (min-width: 721px) and (max-width: 1000px) {
  .rail-link { position: relative; }
  .rail-link:hover::after { content: attr(data-label); position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%); white-space: nowrap;
    padding: 5px 10px; border-radius: 8px; background: var(--ink); color: var(--paper); font-size: var(--t-xs); font-weight: 600; z-index: 60; pointer-events: none; }
  .rail .brand { padding: 4px; }
  .post-list > .post { border-radius: 18px; }
}
