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

:root {
  --bg: #0f1115;
  --bg-elevated: #161920;
  --line: rgba(255, 255, 255, 0.08); /* Soft borders */
  --primary: #4f46e5; /* Indigo 500 */
  --primary-hover: #4338ca; /* Indigo 600 */
  --secondary: #94a3b8;
  --accent-coral: #f43f5e;
  --stop-pastel: #3f181f;
  --stop-pastel-hover: #4c1d25;
  --stop-pastel-text: #fda4af;
  --server-msg-bubble-bg: rgba(69, 10, 10, 0.4);
  --server-msg-bubble-border: rgba(244, 63, 94, 0.2);
  --server-msg-text: #e2e8f0;
  --success: #10b981;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --radius: 12px;
  --radius-lg: 16px;
  --content-pad-x: clamp(1rem, 3vw, 2.5rem);
  --chat-panel-bg: #14171d;
  --chat-panel-border: rgba(255, 255, 255, 0.05);
  --chat-panel-split: rgba(255, 255, 255, 0.05);
  --chat-panel-radius: 16px;
  --chat-well-bg: rgba(0, 0, 0, 0.2);
  --settings-surface: rgba(22, 25, 32, 0.95);
  --settings-card-edge: rgba(255, 255, 255, 0.1);
}

html {
  height: 100%;
  overflow: hidden;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  line-height: 1.45;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.app {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-height: 0;
  min-width: 0;
}

.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0.85rem 0 0;
  overflow: hidden;
}

/* --- Social: account strip (bottom of friends column only) --- */
.app-user-bar {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.2rem 0;
  border-radius: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

.app-user-bar__identity {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  font: inherit;
  color: inherit;
  text-align: left;
  border-radius: 8px;
  outline: none;
}

.app-user-bar__identity:hover {
  background: var(--bg-elevated);
}

.app-user-bar__identity:focus-visible {
  outline: 2px solid rgba(167, 199, 231, 0.55);
  outline-offset: 1px;
}

.app-user-bar__avatar-wrap {
  position: relative;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
}

.app-user-bar__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(167, 199, 231, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  overflow: hidden;
}

.app-user-bar__avatar img,
.app-user-bar__avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.app-user-bar__status {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid rgba(14, 12, 22, 0.98);
  box-sizing: border-box;
}

.app-user-bar__status--online {
  background: #3ba55d;
}

.app-user-bar__status--idle {
  background: #f0b132;
}

.app-user-bar__status--dnd {
  background: #ed4245;
}

.app-user-bar__text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.app-user-bar__name {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-user-bar__activity {
  font-size: 0.68rem;
  color: rgba(234, 234, 234, 0.45);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-user-bar__settings {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.12s ease;
}

.app-user-bar__settings:hover {
  background: rgba(167, 199, 231, 0.12);
  color: var(--primary);
}

.app-user-bar__settings:active {
  transform: scale(0.96);
}

body.settings-modal-open,
body.auth-gate-open {
  overflow: hidden;
}

/* --- Auth gate (log in / sign up popup) — neutral dimmer, no blue wash --- */
.auth-gate-modal {
  position: fixed;
  inset: 0;
  z-index: 2100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right))
    max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  /* auto: dimmer + panel + close must receive clicks (none broke hit-testing in some browsers) */
  pointer-events: auto;
}

.auth-gate-modal[hidden] {
  display: none !important;
}

.auth-gate-modal__backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  /* Flat dimmer only — no backdrop-filter (stays sharp behind the popup). */
  background: rgba(4, 4, 6, 0.72);
  pointer-events: auto;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-gate-modal.auth-gate-modal--open .auth-gate-modal__backdrop {
  opacity: 1;
}

.auth-gate-modal__panel {
  position: relative;
  z-index: 2;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  width: min(440px, 100%);
  max-height: min(90vh, 720px);
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: #1e1e22;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.5),
    0 28px 90px rgba(0, 0, 0, 0.65),
    0 12px 36px rgba(0, 0, 0, 0.35);
  padding: 0;
  opacity: 0;
  transform: translate3d(0, 14px, 0) scale(0.96);
  transform-origin: 50% 50%;
  transition:
    opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.48s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-gate-modal__panel-inner {
  overflow-y: auto;
  padding: 2.85rem 1.35rem 1.25rem;
  flex: 1;
  min-height: 0;
}

.auth-gate-modal.auth-gate-modal--open .auth-gate-modal__panel {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
}

/* Close is last in DOM, painted above scroll; absolute so it always receives clicks */
.auth-gate-modal__close {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  z-index: 1000;
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background 0.15s ease, color 0.15s ease;
}

.auth-gate-modal__close:hover {
  background: rgba(255, 173, 173, 0.15);
  color: var(--accent-coral);
}

.auth-gate-modal__notice {
  margin: 0 0 1rem;
  font-size: 0.88rem;
  line-height: 1.45;
  color: rgba(234, 234, 234, 0.62);
}

.auth-gate-panel .auth-page--gate {
  padding: 0;
  margin: 0;
}

.auth-gate-panel .auth-page__head {
  margin-bottom: 1.25rem;
}

.auth-link-button {
  display: inline;
  padding: 0;
  margin: 0;
  border: none;
  background: none;
  font: inherit;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.auth-link-button:hover {
  color: #c5ddf5;
}

@media (prefers-reduced-motion: reduce) {
  .auth-gate-modal__backdrop,
  .auth-gate-modal__panel,
  .settings-modal__backdrop,
  .settings-modal__panel {
    transition-duration: 0.01ms !important;
  }
}

/* --- Floating settings --- */
.settings-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right))
    max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  pointer-events: none;
}

.settings-modal[hidden] {
  display: none !important;
}

.settings-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 6, 8, 0.75);
  backdrop-filter: blur(12px) saturate(0.65) brightness(0.92);
  -webkit-backdrop-filter: blur(12px) saturate(0.65) brightness(0.92);
  pointer-events: auto;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.32s ease;
}

.settings-modal.settings-modal--open .settings-modal__backdrop {
  opacity: 1;
}

.settings-modal__panel {
  position: relative;
  pointer-events: auto;
  width: min(920px, 100%);
  max-height: min(88vh, 900px);
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: #1e1e22;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.48),
    0 28px 88px rgba(0, 0, 0, 0.62),
    0 12px 40px rgba(0, 0, 0, 0.32);
  overflow: hidden;
  opacity: 0;
  transform: translateY(22px) scale(0.97);
  transform-origin: 50% 40%;
  transition:
    opacity 0.34s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.settings-modal.settings-modal--open .settings-modal__panel {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.settings-modal__head {
  position: relative;
  padding: 1.15rem 3rem 1rem 1.35rem;
  border-bottom: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.2);
}

.settings-modal__title {
  margin: 0;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.settings-modal__lede {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  color: rgba(234, 234, 234, 0.45);
  line-height: 1.4;
}

.settings-modal__close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.settings-modal__close:hover {
  background: rgba(255, 173, 173, 0.15);
  color: var(--accent-coral);
}

.settings-modal__body {
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.settings-layout--modal {
  flex: 1 1 0;
  min-height: 0;
  grid-template-columns: minmax(160px, 200px) minmax(0, 1fr);
}

.settings-layout--modal .settings-main {
  padding: 1rem var(--content-pad-x) max(1.25rem, env(safe-area-inset-bottom));
}

@media (max-width: 760px) {
  .settings-modal__panel {
    max-height: 92vh;
    border-radius: 14px 14px 0 0;
    align-self: flex-end;
    width: 100%;
  }

  .settings-layout--modal {
    grid-template-columns: 1fr;
  }

  .settings-layout--modal .settings-nav {
    display: none;
  }
}

/* --- App shell: Video / Social views --- */
.view-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.view-panel[hidden] {
  display: none !important;
}

.view-panel--video .video-workspace {
  flex: 1 1 0;
  min-height: 0;
}

/* Video tab: full-height panel, workspace content sits on the bottom edge */
#view-video.view-panel--video {
  flex: 1 1 0;
  min-height: 0;
  background-color: var(--bg);
}

#view-video .video-workspace {
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  background-color: transparent;
  align-items: stretch;
}

body[data-view='social'] .pill-video-only,
body[data-view='settings'] .pill-video-only,
body[data-view='signup'] .pill-video-only,
body[data-view='login'] .pill-video-only {
  display: none;
}

/* Video tab: narrow left = stranger + you stacked; wide right = chat (Umingle-style) */
.video-workspace {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  gap: 0;
}

.video-workspace__left {
  display: flex;
  flex-direction: column;
  /* Left column: fixed share of width so videos stay “up/down” in one strip */
  flex: 0 1 52%;
  max-width: min(620px, 54vw);
  min-width: min(260px, 100%);
  min-height: 0;
  align-self: stretch;
  padding-right: 0.35rem;
  box-sizing: border-box;
}

/* Must be a flex column so the video row can grow and fill 100% height */
.video-workspace__left .stage-column {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  overflow: hidden;
}

.video-workspace__left .video-slot {
  border-radius: 8px;
}

.video-workspace__chat.bottom-bar {
  flex: 1 1 48%;
  min-width: 0;
  max-width: none;
  width: auto;
  align-self: stretch;
  min-height: 0;
  flex-direction: column;
  justify-content: flex-start;
  border-top: none;
  border-left: 1px solid var(--line);
  padding: 0.5rem 0.75rem 0.55rem 0.85rem;
}

@media (min-width: 641px) {
  /* Stacked (default): wider stranger column, slight overlap into chat */
  #view-video[data-video-layout='stacked'] .video-workspace__left {
    flex: 0 1 58%;
    max-width: min(680px, 58vw);
    margin-right: -0.85rem;
    padding-right: 0.15rem;
    position: relative;
    z-index: 2;
  }

  #view-video[data-video-layout='stacked'] .video-workspace__chat.bottom-bar {
    flex: 1 1 42%;
    position: relative;
    z-index: 1;
  }

  /* Side: classic layout — full-width stranger | you on top, messages + Start/input below */
  #view-video[data-video-layout='side'] .video-workspace {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-end;
  }

  #view-video[data-video-layout='side'] .video-workspace__left {
    /* ~63% height vs chat — bigger video row, slightly smaller messages strip */
    flex: 1.85 1 0;
    max-width: none;
    min-width: 0;
    width: 100%;
    padding-right: 0;
    min-height: 0;
  }

  #view-video[data-video-layout='side'] .video-workspace__chat.bottom-bar {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-height: 0;
    min-width: 0;
    width: 100%;
    max-width: none;
    border-left: none;
    border-top: 1px solid var(--line);
    padding: 0.55rem var(--content-pad-x) 0.65rem;
  }
}

.video-workspace__chat.bottom-bar .chat-section {
  flex: 1 1 0;
  min-height: 0;
  max-height: none;
  display: flex;
  flex-direction: column;
}

/* Start / Stop beside the message field (right column) */
.video-workspace__chat.bottom-bar .chat-compose--video {
  flex: 0 0 auto;
  width: 100%;
  flex-direction: row;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.video-workspace__chat.bottom-bar .chat-compose--video .bottom-bar-controls {
  flex: 0 0 auto;
  align-self: center;
}

.video-workspace__chat.bottom-bar .chat-compose--video .input-wrap {
  flex: 1 1 0;
  min-width: min(140px, 100%);
  width: auto;
}

/* Messages + composer — no panel chrome; sits on bar backdrop */
.bottom-bar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex: 0 0 auto;
  width: 100%;
  border-top: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(12px);
  padding: 0.4rem var(--content-pad-x) max(0.55rem, env(safe-area-inset-bottom))
    max(0.55rem, env(safe-area-inset-left));
  gap: 0.45rem;
}

.chat-compose {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.5rem;
  width: 100%;
  flex-shrink: 0;
  box-sizing: border-box;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.bottom-bar-controls {
  flex: 0 0 auto;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: stretch;
  gap: 0.55rem;
  padding: 0;
  margin: 0;
  min-height: 0;
  width: auto;
  min-width: min(8.35rem, 90vw);
  max-width: min(9.25rem, 94vw);
  box-sizing: border-box;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

/* Start / Stop / Next — side by side, slightly larger squares */
.bottom-bar-controls .btn-main-action {
  flex: 1 1 0;
  box-sizing: border-box;
  width: auto;
  min-width: min(3.75rem, 21vw);
  max-width: min(4.35rem, 24vw);
  aspect-ratio: 1;
  height: auto;
  min-height: 0;
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  padding: 0.22rem;
  text-align: center;
  font-size: clamp(0.72rem, 2.65vmin, 0.9rem);
  line-height: 1;
}

.bottom-bar-controls .btn-main-action.btn-modern {
  position: relative;
  padding: 0.28rem;
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: clamp(0.7rem, 2.7vmin, 0.88rem);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-radius: 10px;
  border: 1px solid rgba(30, 30, 35, 0.35);
  color: #1a1f26;
  text-shadow: none;
  background: var(--primary);
  box-shadow: none;
  transition: background 0.15s ease, filter 0.15s ease, border-color 0.15s ease;
}

.bottom-bar-controls .btn-main-action.btn-modern.btn-start {
  background: var(--primary);
}

.bottom-bar-controls .btn-main-action.btn-modern.btn-stop {
  color: var(--stop-pastel-text);
  text-shadow: none;
  border-color: rgba(90, 40, 40, 0.35);
  background: var(--stop-pastel);
}

/* Connected: wide Next + square Stop */
.bottom-bar-controls:has(.btn-main-action.btn-skip) .btn-main-action.btn-modern.btn-stop {
  flex: 0 0 auto;
  width: min(3.75rem, 21vw);
  min-width: min(3.75rem, 21vw);
  max-width: min(4.35rem, 24vw);
  align-self: center;
}

/* Searching: Start becomes Next (disabled until someone connects) */
.bottom-bar-controls .btn-main-action.btn-modern.btn-next-wait:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.15);
  background: rgba(167, 199, 231, 0.42);
  color: rgba(26, 31, 38, 0.72);
  border-color: rgba(30, 30, 35, 0.28);
}

.bottom-bar-controls .btn-main-action.btn-modern:hover:not(:disabled) {
  filter: brightness(1.06);
  transform: none;
  border-color: rgba(30, 30, 35, 0.45);
  box-shadow: none;
}

.bottom-bar-controls .btn-main-action.btn-modern:active:not(:disabled) {
  transform: none;
  filter: brightness(0.94);
  box-shadow: none;
}

.bottom-bar-controls .btn-main-action.btn-modern:focus-visible {
  outline: 2px solid rgba(167, 199, 231, 0.85);
  outline-offset: 2px;
}

.bottom-bar-controls .btn-main-action.btn-modern.btn-stop:focus-visible {
  outline-color: rgba(200, 120, 120, 0.95);
}

/* Connected: Next / Really? + Stop beside */
.bottom-bar-controls .btn-main-action.btn-skip {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  max-width: none;
  aspect-ratio: auto;
  min-height: 3.15rem;
  padding: 0.55rem 0.95rem;
  font-size: 0.95rem;
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  letter-spacing: 0.04em;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(30, 30, 35, 0.35);
  color: #1a1f26;
  text-shadow: none;
  background: var(--primary);
  box-shadow: none;
  transition: filter 0.15s ease, background 0.15s ease;
}

.bottom-bar-controls .btn-main-action.btn-skip:hover:not(:disabled):not(.btn-skip-really) {
  filter: brightness(1.06);
  transform: none;
  box-shadow: none;
}

.bottom-bar-controls .btn-main-action.btn-skip.btn-skip-really {
  color: #1a1f26 !important;
  text-shadow: none;
  border-color: rgba(30, 30, 35, 0.35) !important;
  background: var(--accent-coral) !important;
  box-shadow: none !important;
}

.bottom-bar-controls .btn-ghost {
  flex: 0 0 auto;
  width: 100%;
  margin: 0;
  padding: 0.38rem 12px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.88rem;
}

/* Equal side columns keep Video / Social visually centered */
.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  column-gap: 12px;
  row-gap: 8px;
  flex-shrink: 0;
  margin-bottom: 0.5rem;
  padding: 0 var(--content-pad-x) 0.55rem;
  border-bottom: 1px solid var(--line);
}

.topbar-left {
  grid-column: 1;
  justify-self: start;
  min-width: 0;
}

.logo-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

.logo-img {
  width: clamp(1.5rem, 4.2vw, 1.75rem);
  height: auto;
  flex-shrink: 0;
  display: block;
  object-fit: contain;
}

.logo-link:hover .logo-text,
.logo-link:hover .logo-img {
  opacity: 0.92;
}

/* Navbar: white text, no pill; blue underline animates */
.app-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  justify-self: center;
  grid-column: 2;
  min-width: 0;
}

.app-nav__tab {
  position: relative;
  display: inline-block;
  padding: 0.4rem 0.85rem 0.5rem;
  border: none;
  background: transparent;
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.22s ease;
}

.app-nav__tab::after {
  content: '';
  position: absolute;
  left: 0.5rem;
  right: 0.5rem;
  bottom: 0.08rem;
  height: 2px;
  border-radius: 2px;
  background: var(--primary);
  transform: scaleX(0);
  transform-origin: center;
  opacity: 0.85;
  transition:
    transform 0.42s cubic-bezier(0.34, 1.25, 0.64, 1),
    opacity 0.25s ease;
}

.app-nav__tab:hover,
.app-nav__tab:focus-visible {
  color: #fff;
}

.app-nav__tab:hover::after,
.app-nav__tab:focus-visible::after {
  transform: scaleX(0.42);
  opacity: 0.65;
}

.app-nav__tab.is-active,
.app-nav__tab[aria-current='page'] {
  color: #fff;
}

.app-nav__tab.is-active::after,
.app-nav__tab[aria-current='page']::after {
  transform: scaleX(1);
  opacity: 1;
}

.app-nav__tab:focus-visible {
  outline: 2px solid rgba(167, 199, 231, 0.45);
  outline-offset: 3px;
  border-radius: 6px;
}

/* `hidden` must win over .app-nav__tab { display: inline-block } (otherwise Social shows when logged out). */
.app-nav__tab[hidden] {
  display: none !important;
}

.topbar-left .logo-text {
  font-size: clamp(1rem, 2.5vw, 1.15rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--text);
}

.logo-text span {
  color: var(--primary);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: clamp(8px, 2vw, 14px);
  flex-wrap: wrap;
  justify-content: flex-end;
  justify-self: end;
  min-width: 0;
  grid-column: 3;
}

.topbar-auth {
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: var(--primary);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
  transition:
    color 0.18s ease,
    border-color 0.18s ease;
}

.topbar-auth:hover,
.topbar-auth:focus-visible {
  color: #fff;
  border-bottom-color: rgba(167, 199, 231, 0.55);
}

.topbar-auth:focus-visible {
  outline: 2px solid rgba(167, 199, 231, 0.45);
  outline-offset: 4px;
  border-radius: 4px;
}

.topbar-auth--logout {
  color: var(--text-muted);
}

.topbar-auth--logout:hover,
.topbar-auth--logout:focus-visible {
  color: var(--text);
  border-bottom-color: rgba(255, 255, 255, 0.12);
}

/* Public mode (AUTH_REQUIRED off): no signup/logout flash before JS runs */
body[data-auth-required='0'] #topbar-auth-cta,
body[data-auth-required='0'] #topbar-auth-logout {
  display: none !important;
}

/* Video tab: stacked vs side-by-side layout toggle (cookie) */
.video-layout-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0;
  padding: 2px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.2);
}

.layout-toggle-btn {
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.32rem 0.5rem;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition:
    background 0.28s ease,
    color 0.28s ease,
    box-shadow 0.28s ease;
}

.layout-toggle-btn.is-active {
  color: #0d0d10;
  background: var(--primary);
  box-shadow: none;
}

.layout-toggle-btn:hover:not(.is-active) {
  color: var(--text);
}

.layout-toggle-btn:focus-visible {
  outline: 2px solid rgba(167, 199, 231, 0.55);
  outline-offset: 2px;
}

/* Sign up / Log in — centered, no panel/box behind content */
.view-panel--auth {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: clamp(1rem, 4vh, 2rem) var(--content-pad-x);
}

.auth-page {
  width: 100%;
  max-width: 420px;
  margin: auto;
  flex-shrink: 0;
  padding: clamp(0.5rem, 2vw, 1rem) 0;
  border: none;
  background: none;
  box-shadow: none;
  border-radius: 0;
}

.auth-page__head {
  margin-bottom: clamp(1.5rem, 3vw, 1.95rem);
  text-align: center;
}

.auth-page__title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: clamp(1.55rem, 4vw, 1.95rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  color: #f2f2f4;
  margin: 0 0 0.55rem;
  line-height: 1.2;
}

.auth-page__lede {
  margin: 0 auto;
  max-width: 34ch;
  font-size: 1.02rem;
  line-height: 1.55;
  color: rgba(234, 234, 234, 0.78);
}

.auth-form {
  margin: 0;
  padding: 0;
  text-align: left;
}

.auth-field {
  display: block;
  margin-bottom: 1.45rem;
}

.auth-field__label {
  display: block;
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
  color: rgba(234, 234, 234, 0.82);
}

.auth-input {
  display: block;
  width: 100%;
  margin-top: 0.45rem;
  padding: 0.65rem 0.15rem 0.65rem 0;
  border: none;
  border-bottom: 2px solid rgba(234, 234, 234, 0.2);
  border-radius: 0;
  background: transparent;
  color: #f5f5f7;
  font: inherit;
  font-size: 1.06rem;
  font-weight: 500;
  outline: none;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.auth-input::placeholder {
  color: rgba(234, 234, 234, 0.38);
}

.auth-input:hover {
  border-bottom-color: rgba(234, 234, 234, 0.28);
}

.auth-input:focus {
  border-bottom-color: var(--primary);
  box-shadow: 0 1px 0 0 rgba(167, 199, 231, 0.55);
}

.auth-error {
  margin: -0.25rem 0 1rem;
  font-size: 0.92rem;
  font-weight: 500;
  color: #ffb4b4;
}

.auth-submit {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.82rem 1.2rem;
  border-radius: 12px;
  border: none;
  font-weight: 600;
  font-size: 1.02rem;
  letter-spacing: 0.02em;
  cursor: pointer;
  background: var(--primary);
  color: #0d0d10;
  box-shadow: none;
  transition:
    filter 0.15s ease,
    transform 0.12s ease;
}

.auth-submit:hover {
  filter: brightness(1.07);
}

.auth-submit:active {
  transform: scale(0.992);
}

.auth-switch {
  margin: 1.65rem 0 0;
  text-align: center;
  font-size: 0.98rem;
  line-height: 1.5;
  color: rgba(234, 234, 234, 0.72);
}

.auth-link {
  color: #c8ddf2;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid rgba(167, 199, 231, 0.45);
  transition: color 0.15s ease, border-color 0.15s ease;
}

.auth-link:hover {
  color: #fff;
  border-bottom-color: rgba(255, 255, 255, 0.45);
}

.pill {
  font-size: 0.76rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--text-muted);
  white-space: nowrap;
}

.pill-quiet {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pill .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}

#online-num {
  color: var(--text);
  font-weight: 600;
}

#status {
  transition: color 0.25s;
  max-width: min(52vw, 20rem);
  overflow: hidden;
  text-overflow: ellipsis;
}

#status.status-success {
  color: var(--success);
}

#status.status-warn {
  color: var(--accent-coral);
}

#status.status-muted {
  color: var(--text-muted);
}

/* ═══ Video tab — match page bg, bottom-aligned, no messages “card” ═══ */
body[data-view='video'],
body[data-view='video'] .app,
body[data-view='video'] .content {
  background-color: var(--bg);
}

/* Navbar fixed to viewport; reserve space so content doesn’t sit underneath */
body[data-view='video'] {
  --video-topbar-h: 4.75rem;
}

@media (max-width: 640px) {
  body[data-view='video'] {
    --video-topbar-h: 8.75rem;
  }
}

body[data-view='video'] .content {
  padding-top: calc(env(safe-area-inset-top, 0px) + var(--video-topbar-h));
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

/* One full viewport for the live UI; scroll down for About / SEO body */
body[data-view='video'] #view-video.view-panel--video {
  flex: 0 0 auto;
  min-height: calc(100vh - env(safe-area-inset-top, 0px) - var(--video-topbar-h) - 0.35rem);
  min-height: calc(100dvh - env(safe-area-inset-top, 0px) - var(--video-topbar-h) - 0.35rem);
}

body[data-view='video'] .video-page-about {
  flex-shrink: 0;
}

/* ── About randum.chat (below the fold on /video; indexed for SEO) ── */
.video-page-about {
  padding: 2.5rem var(--content-pad-x) 3.5rem;
  padding-bottom: max(3.5rem, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(79, 70, 229, 0.07) 0%, transparent 45%),
    var(--bg);
}

.video-page-about[hidden] {
  display: none !important;
}

.video-page-about__inner {
  max-width: 52rem;
  margin: 0 auto;
}

.video-page-about__header {
  margin-bottom: 2rem;
}

.video-page-about__title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: clamp(1.5rem, 4vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 0 0 0.85rem;
}

.video-page-about__lede {
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--text-muted);
  max-width: 48em;
}

.video-page-about__lede strong {
  color: var(--text);
  font-weight: 600;
}

.video-page-about__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.video-page-about__card {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.35rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.video-page-about__h3 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.65rem;
  letter-spacing: -0.01em;
}

.video-page-about__card p,
.video-page-about__rules p,
.video-page-about__safety p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.65;
  color: rgba(234, 234, 234, 0.88);
}

.video-page-about__rules,
.video-page-about__safety {
  margin-bottom: 1.5rem;
  padding: 1.25rem 1.35rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
}

.video-page-about__rules {
  background: rgba(79, 70, 229, 0.08);
  border-color: rgba(79, 70, 229, 0.22);
}

.video-page-about__safety {
  background: rgba(244, 63, 94, 0.06);
  border-color: rgba(244, 63, 94, 0.15);
}

.video-page-about__foot {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.video-page-about__meta {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: 0;
}

.video-page-about__meta a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.video-page-about__meta a:hover {
  color: #a5b4fc;
}

.video-page-about__section-h2 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: clamp(1.12rem, 3vw, 1.32rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 0 0 0.75rem;
}

.video-page-about__block {
  margin-bottom: 2rem;
}

.video-page-about__block p {
  margin: 0 0 1rem;
  font-size: 0.95rem;
  line-height: 1.65;
  color: rgba(234, 234, 234, 0.88);
}

.video-page-about__block p:last-child {
  margin-bottom: 0;
}

.video-page-about__nav {
  margin-bottom: 2rem;
  padding: 1.25rem 1.35rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}

.video-page-about__linklist {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
  color: rgba(234, 234, 234, 0.88);
  font-size: 0.95rem;
  line-height: 1.75;
}

.video-page-about__linklist a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.video-page-about__linklist a:hover {
  color: #a5b4fc;
}

.video-about-brand {
  font-weight: 600;
  color: var(--text);
}

body[data-view='video'] .topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  box-sizing: border-box;
  z-index: 100;
  margin: 0;
  padding-top: max(0.6rem, env(safe-area-inset-top, 0px));
  padding-left: var(--content-pad-x);
  padding-right: var(--content-pad-x);
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--line);
  background-color: rgba(15, 17, 21, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

#view-video .video-workspace__left .video-slot {
  border-radius: 16px;
}

#view-video .video-row.is-dual {
  gap: 12px;
}

/* Stranger (remote): primary-accent frame + depth */
#view-video .video-slot.slot-remote {
  background: var(--bg-elevated);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    0 10px 40px rgba(0, 0, 0, 0.3),
    0 0 40px rgba(79, 70, 229, 0.05); /* Soft primary glow */
}

/* You (local): softer frame, still crisp */
#view-video .video-slot.slot-local {
  background: var(--bg-elevated);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.05),
    0 8px 32px rgba(0, 0, 0, 0.25);
}

#view-video .video-workspace__chat.bottom-bar {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
  padding: 0.65rem 1rem 0.85rem 1.05rem;
  background: transparent;
  border-left: 1px solid var(--line);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

#view-video[data-video-layout='side'] .video-workspace__chat.bottom-bar {
  border-left: none;
  border-top: 1px solid var(--line);
}

/* Fill space above composer; scroll lives in #messages */
#view-video .video-workspace__chat.bottom-bar .chat-section {
  flex: 1 1 0;
  min-height: 0 !important;
  max-height: none !important;
  padding: 0;
  margin-bottom: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  overflow: hidden;
  box-shadow: none;
}

#view-video .video-workspace__chat.bottom-bar .chat-heading {
  font-size: 0.55rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(234, 234, 234, 0.38);
  margin: 0 0 0.35rem;
  padding: 0;
  padding-left: 0.02rem;
  border: none;
  background: transparent;
  flex-shrink: 0;
}

#view-video .video-chat-body {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  overflow: hidden;
}

#view-video .video-chat-body .messages {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  padding: 0.15rem 0.1rem 0.2rem 0;
}

#view-video .video-workspace__chat.bottom-bar .chat-compose--video {
  flex: 0 0 auto;
  flex-shrink: 0;
  margin-top: 0.65rem;
  gap: 0.75rem;
  align-items: flex-end;
  flex-wrap: nowrap;
}

#view-video .video-workspace__chat.bottom-bar .chat-compose--video .input-wrap {
  flex: 1 1 0;
  min-width: 0;
}

/* Server notice — brand mark + pastel-blue bubble (site theme) */
.chat-server-msg {
  flex-shrink: 0;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 0.65rem;
  margin: 0 0 1rem;
}

.chat-server-msg__icon {
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 0.15rem 0 0;
  margin: 0;
  border: none;
  background: transparent;
  box-shadow: none;
}

.chat-server-msg__logo {
  width: 24px;
  height: 24px;
  object-fit: contain;
  display: block;
  opacity: 0.8;
}

.chat-server-msg__bubble {
  position: relative;
  flex: 0 1 auto;
  width: fit-content;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  background: var(--server-msg-bubble-bg);
  border: 1px solid var(--server-msg-bubble-border);
  border-radius: 12px 12px 12px 4px;
  padding: 0.65rem 0.85rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* No tail needed for text-only */
.chat-server-msg__bubble::before {
  display: none;
  content: none;
}

.chat-server-msg__text {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--server-msg-text);
  letter-spacing: 0.01em;
}

.chat-server-msg__safety {
  margin: 0.55rem 0 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--server-msg-text);
}

.chat-server-msg__warn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--primary);
  opacity: 0.92;
}

.chat-server-msg__warn svg {
  display: block;
}

/* Theme links: darker blue from same hue as --primary on pastel bubble */
.chat-server-msg__link {
  color: #2d4f66;
  text-decoration: underline;
  text-decoration-color: rgba(167, 199, 231, 0.65);
  text-underline-offset: 3px;
  font-weight: 600;
}

.chat-server-msg__link:hover {
  color: #1e3a4d;
  text-decoration-color: var(--primary);
}

.chat-server-msg__link:focus-visible {
  outline: 2px solid rgba(167, 199, 231, 0.55);
  outline-offset: 2px;
  border-radius: 2px;
}

#view-video .input-wrap #input {
  min-height: 3.5rem;
  padding: 0.75rem 1.25rem;
  font-size: 0.95rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(20, 20, 20, 0.4);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15), inset 0 1px 1px rgba(255, 255, 255, 0.02);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#view-video .input-wrap #input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2), inset 0 1px 1px rgba(255, 255, 255, 0.02);
  outline: none;
}

#view-video .btn-send-icon {
  display: none !important;
}

#view-video .btn-send-icon:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.05);
}

#view-video .btn-send-icon svg {
  width: 17px;
  height: 17px;
}

/* Primary call controls — fixed identical size for Start / Stop / Next (video tab only; never shrink) */
#view-video .bottom-bar-controls {
  --video-btn-w: 7.25rem;
  --video-btn-h: 3.5rem;
  flex: 0 0 auto;
  flex-shrink: 0;
  align-items: center;
  min-width: 0;
  max-width: none;
  width: auto;
  gap: 0.75rem;
}

/* Override generic .bottom-bar-controls flex/aspect so connected state matches waiting */
#view-video .bottom-bar-controls .btn-main-action {
  flex: 0 0 var(--video-btn-w);
  flex-shrink: 0;
  width: var(--video-btn-w);
  min-width: var(--video-btn-w);
  max-width: var(--video-btn-w);
  height: var(--video-btn-h);
  min-height: var(--video-btn-h);
  max-height: var(--video-btn-h);
  aspect-ratio: auto;
  align-self: center;
  box-sizing: border-box;
}

#view-video .bottom-bar-controls .btn-main-action.btn-modern {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.03em;
  text-transform: none;
  line-height: 1.15;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.35);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  box-sizing: border-box;
  padding: 0.62rem 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#view-video .bottom-bar-controls .btn-main-action.btn-modern.btn-start {
  background: var(--primary);
  color: #141820;
}

#view-video .bottom-bar-controls .btn-main-action.btn-modern.btn-stop {
  background: var(--stop-pastel);
  color: var(--stop-pastel-text);
  border-color: rgba(90, 40, 40, 0.35);
}

#view-video .bottom-bar-controls .btn-main-action.btn-modern.btn-stop:hover:not(:disabled) {
  background: var(--stop-pastel-hover);
}

#view-video .bottom-bar-controls .btn-main-action.btn-modern.btn-next-wait:disabled {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(234, 234, 234, 0.5);
  border-color: rgba(255, 255, 255, 0.08);
}

#view-video .bottom-bar-controls .btn-main-action.btn-skip {
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.3);
  background: var(--primary);
  color: #141820;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

#view-video .bottom-bar-controls .btn-main-action.btn-skip.btn-skip-really {
  background: var(--primary) !important;
  color: #141820 !important;
  border-color: rgba(0, 0, 0, 0.28) !important;
}

#view-video .bottom-bar-controls .btn-main-action.btn-modern:hover:not(:disabled) {
  filter: brightness(1.04);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.38);
}

#view-video .bottom-bar-controls .btn-main-action.btn-modern:active:not(:disabled) {
  filter: brightness(0.97);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

#view-video .video-label {
  display: none !important;
}

/* ── Video row: stacked vs side-by-side (see #view-video[data-video-layout]) ── */
.video-row.is-dual {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  align-items: stretch;
  gap: 6px;
  width: 100%;
  padding: 0;
  transition: gap 0.38s cubic-bezier(0.22, 1, 0.36, 1);
}

#view-video[data-video-layout='stacked'] .video-row.is-dual {
  flex-direction: column;
}

#view-video[data-video-layout='side'] .video-row.is-dual {
  flex-direction: row;
}

.video-row.is-dual .video-slot {
  flex: 1 1 0;
  min-height: 0;
  min-width: 0;
  transition:
    opacity 0.3s ease,
    box-shadow 0.35s ease,
    border-radius 0.35s ease;
}

@supports (view-transition-name: none) {
  #view-video .video-workspace {
    view-transition-name: video-workspace;
  }
  #view-video .video-workspace__left {
    view-transition-name: video-stage;
  }
}

.video-slot {
  position: relative;
  min-height: 0;
  flex: 1 1 0;
  min-width: 0;
  border-radius: 0;
  overflow: hidden;
  background: #0a0a0b;
  box-shadow:
    inset 0 0 0 1px rgba(234, 234, 234, 0.07),
    0 8px 32px rgba(0, 0, 0, 0.22);
}

/* Searching: no static — calm empty frame */
.slot-remote.searching-wait {
  background: #121214;
}

.slot-remote.searching-wait::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(167, 199, 231, 0.04);
  pointer-events: none;
  z-index: 1;
}

.video-slot video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.35s ease;
}

/* TV static + scanlines */
.static-canvas {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  pointer-events: none;
  image-rendering: pixelated;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.static-canvas.is-on {
  display: block;
  opacity: 0.5;
}

.scanlines {
  display: none !important;
}

.slot-remote.tv-on .scanlines {
  display: none !important;
}

.video-label {
  display: none !important;
}

/* Bottom-right watermark only — no giant center logo */
.video-watermark {
  position: absolute;
  bottom: 0.42rem;
  right: 0.48rem;
  z-index: 8;
  display: inline-flex !important;
  align-items: center;
  gap: 0.32rem;
  padding: 0.22rem 0.5rem;
  border-radius: 8px;
  background: rgba(8, 10, 14, 0.55);
  letter-spacing: 0.02em;
  pointer-events: none;
  user-select: none;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: clamp(0.68rem, 2.4vmin, 0.92rem);
  font-weight: 700;
  line-height: 1;
  opacity: 0.78;
  mix-blend-mode: normal;
  backdrop-filter: blur(8px);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

.video-watermark__mark {
  width: auto;
  height: 1.05em;
  flex-shrink: 0;
  display: block;
  object-fit: contain;
  opacity: 0.92;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45));
}

.video-watermark__text {
  display: inline-flex;
  align-items: baseline;
  white-space: nowrap;
}

.slot-local .video-watermark {
  opacity: 0.72;
  font-size: clamp(0.68rem, 2.4vmin, 0.92rem);
}

.slot-local .wm-r {
  color: rgba(245, 245, 247, 0.92);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.slot-local .wm-c {
  color: var(--primary);
  text-shadow: 0 0 10px rgba(167, 199, 231, 0.3);
}

.slot-remote.searching-wait .video-watermark,
.slot-remote.tv-on .video-watermark,
.slot-remote.is-in-call .video-watermark {
  opacity: 0.8;
}

.slot-remote.is-in-call .video-watermark {
  bottom: 2.85rem;
}

.slot-remote.searching-wait .wm-r,
.slot-remote.tv-on .wm-r,
.slot-remote.is-in-call .wm-r {
  color: rgba(255, 255, 255, 0.94);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.slot-remote.searching-wait .wm-c,
.slot-remote.tv-on .wm-c,
.slot-remote.is-in-call .wm-c {
  color: rgba(200, 225, 255, 0.98);
  text-shadow: 0 0 14px rgba(167, 199, 231, 0.35);
}

/* Stranger tile: mute / mic controls on hover while in call */
.remote-slot-hover {
  position: absolute;
  inset: 0;
  z-index: 9;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: min(18%, 5.5rem);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease;
}

#remote-slot.is-in-call:hover .remote-slot-hover {
  opacity: 1;
  pointer-events: auto;
}

.remote-slot-hover__inner {
  display: inline-flex;
  gap: 0.45rem;
  padding: 0.35rem 0.5rem;
  border-radius: 999px;
  background: rgba(6, 8, 12, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(10px);
}

.remote-hover-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(240, 242, 248, 0.92);
  cursor: pointer;
  transition:
    background 0.15s ease,
    color 0.15s ease,
    transform 0.12s ease;
}

.remote-hover-btn:hover {
  background: rgba(167, 199, 231, 0.22);
  color: #fff;
}

.remote-hover-btn[aria-pressed='true'] {
  background: rgba(255, 120, 120, 0.28);
  color: #ffd4d4;
}

@media (hover: none) and (pointer: coarse) {
  #remote-slot.is-in-call .remote-slot-hover {
    opacity: 0.95;
    pointer-events: auto;
    padding-top: min(12%, 4rem);
  }
}

.wm-r {
  color: rgba(234, 234, 234, 0.95);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.wm-c {
  color: var(--primary);
  font-weight: 700;
  text-shadow:
    0 0 16px rgba(167, 199, 231, 0.22),
    0 1px 2px rgba(0, 0, 0, 0.45);
}

.btn {
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 10px 22px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, transform 0.12s, box-shadow 0.2s, border-color 0.2s;
}

.btn:not(.btn-modern):active:not(:disabled) {
  transform: scale(0.985);
}

.btn-main-action {
  width: auto;
  min-width: 8.5rem;
  padding: 14px 26px;
  font-size: 1rem;
  letter-spacing: 0.02em;
}

/* Cartoon bubble Start / Stop (pill by default; .bottom-bar-controls uses rounded box) */
.btn-main-action.btn-modern {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  padding: 14px 28px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2), inset 0 1px 1px rgba(255, 255, 255, 0.1);
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
}

.btn-stop.btn-modern {
  background: var(--stop-pastel);
  color: var(--stop-pastel-text);
  border-color: rgba(255, 255, 255, 0.05);
}

.btn-stop.btn-modern:hover:not(:disabled) {
  background: var(--stop-pastel-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), inset 0 1px 1px rgba(255, 255, 255, 0.1);
}

.btn-stop.btn-modern:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Flat Start — same blue as Stop, no faux-3D */
.btn-start.btn-modern {
  background: var(--primary);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.08);
}

.btn-start.btn-modern:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3), inset 0 1px 1px rgba(255, 255, 255, 0.2);
}

.btn-start.btn-modern:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: 0 1px 2px rgba(79, 70, 229, 0.2);
}

.btn-start:not(.btn-modern) {
  background: var(--primary);
  color: #1a1f26;
  box-shadow: none;
}

.btn-start:not(.btn-modern):hover:not(:disabled) {
  background: #b8d4ee;
  box-shadow: none;
}

.btn-stop:not(.btn-modern) {
  background: var(--stop-pastel);
  color: var(--stop-pastel-text);
  box-shadow: none;
}

.btn-stop:not(.btn-modern):hover:not(:disabled) {
  background: var(--stop-pastel-hover);
  box-shadow: none;
}

.btn-skip {
  background: var(--primary);
  color: #151518;
  box-shadow: none;
}

.btn-skip:hover:not(:disabled):not(.btn-skip-really) {
  background: #b8d4ee;
}

.btn-skip-really {
  background: var(--primary) !important;
  color: #1a1010 !important;
  box-shadow: none !important;
}

.btn-ghost {
  flex-shrink: 0;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid rgba(234, 234, 234, 0.14);
  padding: 12px 18px;
  font-size: 0.82rem;
}

.btn-ghost:hover:not(:disabled) {
  color: var(--accent-coral);
  border-color: rgba(255, 173, 173, 0.4);
  background: rgba(255, 173, 173, 0.06);
}

.btn-primary {
  background: var(--primary);
  color: #1a1a1e;
  box-shadow: 0 2px 12px rgba(167, 199, 231, 0.22);
}

.btn-primary:hover:not(:disabled) {
  background: var(--secondary);
  color: #1a1a1e;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

.chat-section {
  flex: 0 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: min(22vh, 200px);
  max-height: min(28vh, 220px);
  padding: 0.15rem 0 0.2rem;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.chat-heading {
  font-size: 0.55rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(234, 234, 234, 0.38);
  margin-bottom: 0.25rem;
  flex-shrink: 0;
  line-height: 1.2;
  padding-left: 0.02rem;
}

.messages {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  padding: 0.2rem 0.1rem 0.25rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(234, 234, 234, 0.2) transparent;
  background: transparent;
  border-radius: 0;
  border: none;
  box-shadow: none;
}

.msg {
  font-size: 0.8125rem;
  line-height: 1.4;
  padding: 0.55rem 0.85rem;
  word-break: break-word;
  max-width: 85%;
  border-radius: 12px;
}

.msg-stranger {
  color: var(--text);
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.08);
  border-bottom-left-radius: 4px;
}

.msg-you {
  color: #fff;
  align-self: flex-end;
  text-align: left;
  background: var(--primary);
  border-bottom-right-radius: 4px;
}

.msg-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  max-width: 100%;
}

.msg-wrap--stranger {
  align-self: flex-start;
  align-items: flex-start;
}

.msg-wrap--you {
  align-self: flex-end;
  align-items: flex-end;
}

.msg-votes {
  display: inline-flex !important;
  align-items: center;
  gap: 0.22rem;
  flex-shrink: 0;
  user-select: none;
  margin-top: 0.18rem;
  padding: 0.18rem 0.28rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.msg-score {
  font-size: 0.65rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  min-width: 1.35rem;
  text-align: center;
  color: rgba(234, 234, 234, 0.55);
  line-height: 1;
}

.msg-vote {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(234, 234, 234, 0.72);
  cursor: pointer;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}

.msg-vote:hover {
  background: rgba(255, 255, 255, 0.11);
  color: rgba(234, 234, 234, 0.92);
}

.msg-vote:focus-visible {
  outline: 2px solid rgba(167, 199, 231, 0.55);
  outline-offset: 1px;
}

.msg-vote--up[aria-pressed='true'] {
  color: var(--primary);
  background: rgba(167, 199, 231, 0.14);
}

.msg-vote--down[aria-pressed='true'] {
  color: var(--accent-coral);
  background: rgba(255, 173, 173, 0.12);
}

.input-wrap {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
}

.input-wrap:focus-within {
  outline: none;
}

#input {
  width: 100%;
  min-width: 0;
  padding: 8px 12px;
  font-size: 0.9rem;
  font-family: inherit;
  background: rgba(0, 0, 0, 0.35) !important;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-shadow: none;
}

#input:focus {
  border-color: rgba(167, 199, 231, 0.45);
  box-shadow: 0 0 0 3px rgba(167, 199, 231, 0.12);
}

#input::placeholder {
  color: var(--text-muted);
}

#input:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}


.btn-send-icon {
  display: none !important;
}

@media (max-width: 640px) {
  body {
    overflow: hidden;
    height: 100%;
    max-height: 100%;
  }

  .content {
    flex: 1;
    min-height: 0;
    padding-bottom: 0;
    overflow: hidden;
  }

  .video-workspace {
    flex-direction: column;
    align-items: stretch;
  }

  #view-video .video-workspace {
    justify-content: flex-end;
    align-items: stretch;
  }

  .video-workspace__left {
    flex: 1 1 0;
    min-height: 0;
    max-width: none;
    min-width: 0;
    width: 100%;
    padding-right: 0;
  }

  .video-workspace__left .stage-column {
    min-height: 0;
  }

  .video-row.is-dual {
    flex: 1 1 0;
    min-height: 0;
    gap: 6px;
  }

  .video-row.is-dual .video-slot {
    flex: 1 1 0;
    min-height: 0;
    width: 100%;
    border-radius: 8px;
  }

  .video-workspace__chat.bottom-bar .chat-compose--video {
    flex-direction: row;
    align-items: flex-end;
    flex-wrap: nowrap;
    gap: 0.5rem;
  }

  .video-workspace__chat.bottom-bar .chat-compose--video .bottom-bar-controls {
    justify-content: flex-start;
    width: auto;
    flex: 0 0 auto;
  }

  .video-workspace__chat.bottom-bar .chat-compose--video .input-wrap {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
  }

  .video-workspace__chat.bottom-bar {
    flex: 0 1 auto;
    min-width: 0;
    max-width: none;
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--line);
    align-self: stretch;
    min-height: min(22vh, 200px);
    max-height: min(34vh, 280px);
  }

  #view-video .video-workspace__chat.bottom-bar {
    flex: 1 1 0;
    min-height: 0;
    max-height: none;
    display: flex;
    flex-direction: column;
  }

  #view-video .video-workspace__chat.bottom-bar .chat-section {
    min-height: 0 !important;
    max-height: none !important;
    flex: 1 1 0;
  }

  .video-workspace__chat.bottom-bar .chat-section {
    min-height: min(12vh, 120px);
    padding: 0.12rem 0 0.15rem;
  }

  .chat-compose {
    padding: 0;
    gap: 0.45rem;
  }

  .bottom-bar-controls {
    flex-direction: row;
    justify-content: center;
    align-items: stretch;
    width: auto;
    min-width: min(8.35rem, 92vw);
    max-width: min(9.5rem, 96vw);
    gap: 0.5rem;
  }

  .bottom-bar-controls .btn-main-action:not(.btn-skip) {
    flex: 1 1 0;
    min-width: min(3.75rem, 22vw);
    max-width: min(4.35rem, 28vw);
    aspect-ratio: 1;
  }

  #view-video .bottom-bar-controls {
    --video-btn-w: min(6.85rem, 31vw);
    --video-btn-h: 3.35rem;
    gap: 0.65rem;
  }

  .messages {
    flex: 1 1 0;
    min-height: 0;
  }

  .topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem var(--content-pad-x);
    border-bottom: 1px solid var(--line);
    margin-bottom: 0.25rem;
    gap: 0.75rem;
  }

  .topbar-left {
    flex: 0 0 auto;
  }

  .topbar-right {
    flex: 0 0 auto;
    width: auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
  }

  .app-nav {
    order: 3;
    flex: 1 1 100%;
    display: flex;
    justify-content: center;
    padding: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 0.5rem;
    margin-top: 0.25rem;
  }

  .video-layout-toggle {
    flex-shrink: 0;
  }

  .layout-toggle-btn {
    font-size: 0.62rem;
    padding: 0.28rem 0.42rem;
  }

  #status {
    width: 100%;
    text-align: center;
    order: 10;
    max-width: none;
    margin-top: 0.25rem;
    font-size: 0.8rem;
  }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --- Social tab: full-width friends | chat --- */
.view-panel--social {
  min-height: 0;
  flex: 1;
}

.social-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
  padding: 0;
  background: var(--bg);
}

.social-app {
  display: grid;
  grid-template-columns: minmax(260px, 300px) minmax(0, 1fr);
  flex: 1;
  min-height: 0;
  margin: 0;
  border: none;
  border-radius: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
  background: transparent;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.social-sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  border-right: 1px solid var(--line);
  background: var(--bg);
}

.social-sidebar__account {
  flex-shrink: 0;
  margin-top: auto;
  padding: 0.5rem 0.65rem 0.65rem;
  border-top: 1px solid var(--line);
  background: var(--bg);
}

.social-sidebar__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1rem 1rem 0.65rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  flex-shrink: 0;
  gap: 0.75rem;
}

.social-sidebar__head-text {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.social-sidebar__eyebrow {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(234, 234, 234, 0.38);
}

.social-sidebar__title {
  margin: 0;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.03em;
}

.social-sidebar__add {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.38rem 0.75rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  cursor: not-allowed;
  flex-shrink: 0;
}

.social-search-wrap {
  padding: 0.5rem 0.85rem 0.75rem;
  flex-shrink: 0;
}

.social-search {
  width: 100%;
  padding: 0.52rem 0.75rem 0.52rem 2.15rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.35) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23eaeaea55' stroke-width='1.5' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath stroke-linecap='round' d='M21 21l-4.2-4.2'/%3E%3C/svg%3E") 0.65rem 50% / 16px 16px no-repeat;
  color: var(--text);
  font-size: 0.86rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.social-search::placeholder {
  color: var(--text-muted);
}

.social-search:focus {
  border-color: rgba(167, 199, 231, 0.45);
  box-shadow: 0 0 0 3px rgba(167, 199, 231, 0.12);
}

.social-friend-list {
  list-style: none;
  margin: 0;
  padding: 0.25rem 0.65rem 1rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}

.social-friend-list li {
  margin-bottom: 0.2rem;
}

.social-friend-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.6rem 0.55rem;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.18s ease, box-shadow 0.18s ease;
  position: relative;
}

.social-friend-row::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 0;
  border-radius: 0 3px 3px 0;
  background: var(--primary);
  opacity: 0;
  transition: height 0.2s ease, opacity 0.2s ease;
}

.social-friend-row:hover {
  background: rgba(255, 255, 255, 0.045);
}

.social-friend-row.is-active {
  background: rgba(167, 199, 231, 0.08);
  box-shadow: inset 0 0 0 1px rgba(167, 199, 231, 0.14);
}

.social-friend-row.is-active::before {
  height: 60%;
  opacity: 1;
}

.social-friend-list li.is-hidden {
  display: none;
}

.social-avatar--list {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.84rem;
  font-weight: 700;
  flex-shrink: 0;
  background: rgba(167, 199, 231, 0.35);
  color: #fff;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.social-friend-row__text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.social-friend-row__name {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text);
}

.social-friend-row__preview {
  font-size: 0.76rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.social-friend-row__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
  font-size: 0.68rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.social-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.social-dot--on {
  background: var(--success);
  box-shadow: 0 0 0 2px rgba(181, 234, 215, 0.2);
}

.social-dot--away {
  background: #e8c547;
}

.social-dot--off {
  background: rgba(234, 234, 234, 0.25);
}

.social-chat {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: none;
  background: var(--bg);
}

.social-chat__pfp-btn {
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 50%;
  line-height: 0;
}

.social-chat__pfp-btn:focus-visible {
  outline: 2px solid rgba(167, 199, 231, 0.65);
  outline-offset: 2px;
}

.social-chat__head {
  padding: 0.85rem 1.15rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.03);
}

.social-chat__peer {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.social-avatar--lg {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  background: rgba(167, 199, 231, 0.35);
  color: #fff;
}

.social-chat__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  font-family: 'Plus Jakarta Sans', sans-serif;
  letter-spacing: -0.02em;
}

.social-chat__status {
  margin: 0.15rem 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.social-chat__messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1rem 1.15rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.social-msg-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.35rem 0 0.5rem;
  flex-shrink: 0;
}

.social-msg-divider::before,
.social-msg-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.12);
}

.social-msg-divider span {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(234, 234, 234, 0.38);
}

.social-msg {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 0.5rem;
  max-width: min(92%, 720px);
}

.social-msg--them {
  align-self: flex-start;
}

.social-msg--you {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.social-msg__pfp {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s ease, box-shadow 0.12s ease, color 0.12s ease;
}

.social-msg__pfp:hover {
  transform: scale(1.04);
  box-shadow: 0 0 0 2px rgba(167, 199, 231, 0.45);
  color: var(--text);
}

.social-msg__pfp img {
  border-radius: 50%;
}

.social-msg__pfp:focus-visible {
  outline: 2px solid rgba(167, 199, 231, 0.65);
  outline-offset: 2px;
}

.social-msg--you .social-msg__pfp {
  background: transparent;
  color: var(--primary);
}

.social-msg__body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.social-msg__bubble {
  padding: 0.58rem 0.85rem;
  font-size: 0.9rem;
  line-height: 1.45;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
}

.social-msg--them .social-msg__bubble {
  border-radius: 4px 16px 16px 16px;
  background: rgba(167, 199, 231, 0.1);
  border: 1px solid rgba(167, 199, 231, 0.18);
  color: var(--text);
}

.social-msg--you .social-msg__bubble {
  border-radius: 16px 4px 16px 16px;
  background: rgba(167, 199, 231, 0.12);
  border: 1px solid rgba(167, 199, 231, 0.22);
  color: var(--text);
}

.social-msg__time {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.social-chat__footer {
  padding: 0.85rem 1.15rem max(1rem, env(safe-area-inset-bottom));
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.22);
}

.social-chat__hint {
  font-size: 0.68rem;
  color: rgba(234, 234, 234, 0.42);
  margin: 0.65rem 0 0;
  text-align: center;
  letter-spacing: 0.02em;
}

.social-chat__composer {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
  padding: 0.2rem;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.social-chat__input {
  flex: 1;
  min-width: 0;
  padding: 0.55rem 0.85rem;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 0.9rem;
}

.social-chat__input::placeholder {
  color: rgba(234, 234, 234, 0.35);
}

.social-chat__send {
  padding: 0.55rem 1.1rem;
  border-radius: 10px;
  border: 1px solid rgba(167, 199, 231, 0.35);
  background: rgba(167, 199, 231, 0.12);
  color: rgba(234, 234, 234, 0.45);
  font-weight: 600;
  font-size: 0.82rem;
  cursor: not-allowed;
  flex-shrink: 0;
}

.social-profile__form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.social-profile__avatar-block {
  margin-bottom: 0.25rem;
}

.social-profile__avatar-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
}

.social-avatar--xl {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  background: rgba(167, 199, 231, 0.32);
  color: #fff;
  overflow: hidden;
}

.social-avatar--xl img.social-avatar--photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.social-profile__avatar-btn {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--primary);
  cursor: pointer;
}

.social-profile__avatar-btn:hover {
  background: rgba(167, 199, 231, 0.1);
}

.social-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.social-field__label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.social-field__input {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.2);
  color: var(--text);
  font-size: 0.88rem;
  font-family: inherit;
  outline: none;
}

.social-field__input:focus {
  border-color: rgba(167, 199, 231, 0.45);
}

.social-field__input--area {
  resize: vertical;
  min-height: 4rem;
}

.social-field__input--tight {
  margin-top: 0.35rem;
}

.social-field-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.social-toggles {
  border: none;
  margin: 0;
  padding: 0.5rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.social-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.84rem;
  color: var(--text-muted);
  cursor: pointer;
}

.social-toggle input {
  accent-color: var(--primary);
}

.social-profile__actions {
  padding-top: 0.35rem;
}

.social-profile__save {
  width: 100%;
  padding: 0.55rem 1rem;
  border-radius: 10px;
  border: 1px solid rgba(167, 199, 231, 0.35);
  background: rgba(167, 199, 231, 0.08);
  color: var(--primary);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: not-allowed;
}

img.social-avatar--msg-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* --- Settings (modal + layout shared) --- */
.settings-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(180px, 220px) minmax(0, 1fr);
  width: 100%;
}

.settings-nav {
  padding: 1.5rem 0 1.5rem var(--content-pad-x);
  border-right: 1px solid var(--line);
  background: var(--bg);
}

.settings-nav__eyebrow {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(234, 234, 234, 0.35);
  margin: 0 0 1rem;
  padding-left: 0.65rem;
}

.settings-nav__list {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.settings-nav__link {
  display: block;
  padding: 0.5rem 0.65rem;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  color: rgba(234, 234, 234, 0.55);
  text-decoration: none;
  border: 1px solid transparent;
  transition:
    color 0.18s ease,
    background 0.18s ease,
    border-color 0.18s ease;
}

.settings-nav__link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.settings-nav__link.is-active {
  color: var(--text);
  background: rgba(167, 199, 231, 0.1);
  border-color: rgba(167, 199, 231, 0.22);
  box-shadow: 0 0 0 1px rgba(167, 199, 231, 0.08);
}

.settings-main {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.5rem var(--content-pad-x) max(2rem, env(safe-area-inset-bottom));
  scrollbar-gutter: stable;
}

.settings-hero {
  margin-bottom: 1.75rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  position: relative;
}

.settings-hero::before {
  content: '';
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 4rem;
  height: 2px;
  border-radius: 2px;
  background: var(--primary);
}

.settings-hero__title {
  margin: 0;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: clamp(1.5rem, 2.5vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
}

.settings-hero__sub {
  margin: 0.45rem 0 0;
  max-width: 42rem;
  font-size: 0.88rem;
  line-height: 1.55;
  color: rgba(234, 234, 234, 0.5);
}

.settings-section--card {
  padding: 1.35rem 1.4rem 1.5rem;
  margin-bottom: 1.25rem;
  border-radius: 14px;
  background: var(--settings-surface);
  border: 1px solid var(--settings-card-edge);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  scroll-margin-top: 1rem;
}

.settings-section__head {
  margin-bottom: 1.15rem;
}

.settings-section__title {
  margin: 0;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(234, 234, 234, 0.45);
}

.settings-section__lede {
  margin: 0.4rem 0 0;
  font-size: 0.84rem;
  line-height: 1.45;
  color: rgba(234, 234, 234, 0.42);
}

.settings-profile-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
  margin-bottom: 1rem;
}

.social-profile__avatar-wrap--settings {
  flex-direction: column;
  align-items: center;
  text-align: center;
}

@media (max-width: 640px) {
  .settings-profile-row {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .social-profile__avatar-wrap--settings {
    align-items: center;
  }
}

.settings-fields-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem 1.25rem;
  align-self: end;
}

@media (max-width: 560px) {
  .settings-fields-grid {
    grid-template-columns: 1fr;
  }
}

.settings-inline-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

@media (max-width: 560px) {
  .settings-inline-fields {
    grid-template-columns: 1fr;
  }
}

.settings-form-actions {
  margin-top: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  justify-content: flex-end;
}

.settings-form-actions .social-profile__save {
  width: 100%;
  max-width: 240px;
}

@media (max-width: 720px) {
  .settings-layout {
    grid-template-columns: 1fr;
  }

  .settings-nav {
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding: 1rem var(--content-pad-x);
  }

  .settings-nav__list {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.35rem;
  }

  .settings-nav__link {
    flex: 1 1 auto;
    text-align: center;
    min-width: 0;
  }
}

/* --- Profile popover: no dimming, no blur; click-through transparent backdrop --- */
.social-profile-popover-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: transparent;
  pointer-events: auto;
  cursor: default;
}

.social-profile-popover {
  position: fixed;
  z-index: 1210;
  width: min(320px, calc(100vw - 16px));
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #1e1e22;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.4),
    0 16px 48px rgba(0, 0, 0, 0.5),
    0 6px 20px rgba(0, 0, 0, 0.28);
  overflow: hidden;
  pointer-events: auto;
  opacity: 0;
  transform: scale(0.9) translateY(12px);
  transform-origin: center bottom;
  filter: blur(2px);
  transition:
    opacity 0.3s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.38s cubic-bezier(0.22, 1, 0.36, 1),
    filter 0.32s ease;
  will-change: transform, opacity;
}

.social-profile-popover.social-profile-popover--visible {
  opacity: 1;
  transform: scale(1) translateY(0);
  filter: blur(0);
}

@media (prefers-reduced-motion: reduce) {
  .social-profile-popover {
    transition: opacity 0.12s ease;
    filter: none !important;
  }

  .social-profile-popover:not(.social-profile-popover--visible) {
    transform: none;
  }

  .social-profile-popover.social-profile-popover--visible {
    transform: none;
  }
}

.social-profile-popover--self {
  width: min(360px, calc(100vw - 16px));
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #1e1e22;
}

.social-profile-popover--self .social-profile-popover__banner {
  height: 72px;
  background: #252528;
}

.social-profile-popover__banner {
  height: 56px;
  background: #2a2a30;
}

.social-profile-popover__body {
  padding: 0 1rem 1rem;
  margin-top: -28px;
}

.social-profile-popover--self .social-profile-popover__body {
  margin-top: -36px;
}

.social-profile-popover__avatar-wrap {
  position: relative;
  margin-bottom: 0.5rem;
  width: fit-content;
}

.social-profile-popover__avatar-status {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 3px solid var(--bg);
  box-sizing: border-box;
  pointer-events: none;
}

.social-profile-popover:not(.social-profile-popover--self) .social-profile-popover__avatar-status {
  display: none;
}

.social-profile-popover__avatar-status.app-user-bar__status--online {
  background: #3ba55d;
}

.social-profile-popover__avatar-status.app-user-bar__status--idle {
  background: #f0b132;
}

.social-profile-popover__avatar-status.app-user-bar__status--dnd {
  background: #ed4245;
}

.social-profile-popover--self .social-profile-popover__avatar-status {
  border-color: #26262c;
}

.social-profile-popover--self .social-avatar--popover {
  width: 72px;
  height: 72px;
  font-size: 1.5rem;
  border-width: 4px;
  border-color: #26262c;
}

.social-profile-popover__actions {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.social-profile-popover__action {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease;
}

.social-profile-popover__action:hover {
  background: rgba(255, 255, 255, 0.1);
}

.social-profile-popover__action-icon {
  font-size: 0.95rem;
  opacity: 0.85;
  width: 1.25rem;
  text-align: center;
}

.social-avatar--popover {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 700;
  border: 4px solid var(--bg);
  background: rgba(167, 199, 231, 0.35);
  color: #fff;
  overflow: hidden;
}

.social-avatar--popover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.social-profile-popover__name {
  margin: 0.25rem 0 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.social-profile-popover__handle {
  margin: 0.15rem 0 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.social-profile-popover__status {
  margin: 0.5rem 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.social-profile-popover__bio {
  margin: 0.65rem 0 0;
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--text);
}

.social-profile-popover__links {
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.social-profile-popover__link {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
}

.social-profile-popover__link:hover {
  text-decoration: underline;
}

.social-profile-popover__meta {
  font-size: 0.78rem;
  color: var(--text-muted);
}

body.social-popover-open {
  overflow: hidden;
}

@media (max-width: 900px) {
  .social-app {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(160px, 200px) minmax(0, 1fr);
    min-height: 0;
  }

  .social-app .social-sidebar {
    order: 1;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .social-app .social-chat {
    order: 2;
    min-height: 0;
  }
}

