/* ==========================================================================
   VidPlaza — Main Stylesheet
   Zero-dependency SPA | Pure black dark theme
   ========================================================================== */

/* --------------------------------------------------------------------------
   CSS Custom Properties
   -------------------------------------------------------------------------- */
:root {
  --bg-color: #000000;
  --text-color: #e8e8e8;
  --text-muted: #8a8a8a;
  --accent-cyan: #00e5ff;
  --accent-cyan-dim: rgba(0, 229, 255, 0.18);
  --accent-amber: #ffc107;
  --accent-blue: #2196f3;
  --border-grey: #333333;
  --border-subtle: #222222;
  --modal-bg: #111111;
  --card-bg: #0d0d0d;
  --surface-dark: #0a0a0a;
  --surface-raised: #141414;
  --nav-bg: #0a0a0a;
  --footer-height: 2rem;
  --sidebar-width: 13.75rem;
  --main-frame-size: min(52vw, 22rem);
  --peer-frame-size: min(18vw, 7.5rem);
}

/* --------------------------------------------------------------------------
   Reset & Base
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  overflow-x: hidden;
}

/* --------------------------------------------------------------------------
   8. ANIMATIONS & KEYFRAMES
   -------------------------------------------------------------------------- */

/* --- 8.3 / 8.4  fadeIn — views (200ms) and Video_Cards (250ms) ----------- */
/* Usage:
     Views:       animation: fadeIn 200ms ease forwards;
     Video_Cards: animation: fadeIn 250ms ease forwards;
*/
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* --- 8.2  borderHighlight — node connected state at 300ms ---------------- */
/* Applied via .animate-connected on a Peer_Node or My_Video_Node border
   overlay element. Opacity 0 + scale 0.8 → opacity 1 + scale 1.0. */
@keyframes borderHighlight {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1.0);
  }
}

/* --- 8.5  pulse — pulsing ring on My_Video_Node (1000ms infinite) -------- */
/* Applied via .pulsing-ring child element inside #my-video-node. */
@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 0.8;
  }
  50% {
    transform: scale(1.12);
    opacity: 0.3;
  }
  100% {
    transform: scale(1);
    opacity: 0.8;
  }
}

/* --- 8.6  spin — 360° rotation for Approval_Modal spinner (1s infinite) -- */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* --- 8.1  drawLine — SVG line draw-on via stroke-dasharray/dashoffset ----- */
/* The JS sets stroke-dasharray and stroke-dashoffset to the line length,
   then adds .animate-draw which animates dashoffset → 0 over 600ms.      */
@keyframes drawLine {
  from {
    stroke-dashoffset: var(--line-length, 1000);
  }
  to {
    stroke-dashoffset: 0;
  }
}

/* --------------------------------------------------------------------------
   Animation Helper Classes
   -------------------------------------------------------------------------- */

/* View fade-in (200ms) — added by NavigationModule.showView() */
.view-enter {
  animation: fadeIn 200ms ease forwards;
}

/* Video_Card fade-in (250ms) — added when a card is inserted into the feed */
.card-enter {
  animation: fadeIn 250ms ease forwards;
}

/* Connected border highlight (300ms, fires once) */
.animate-connected {
  animation: borderHighlight 300ms ease forwards;
}

/* Pulsing ring on My_Video_Node — continuous 1000ms cycle */
.pulsing-ring {
  position: absolute;
  inset: -6px;
  border-radius: inherit;
  border: 3px solid var(--accent-cyan);
  pointer-events: none;
  animation: pulse 1000ms ease-in-out infinite;
}

/* Approval_Modal spinner — 1s linear infinite */
.spinner {
  width: 36px;
  height: 36px;
  border: 4px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 16px auto;
}

/* SVG connection line — draw-on animation (600ms, fires once) */
.connection-line {
  stroke: var(--accent-cyan);
  stroke-width: 2;
  fill: none;
  /* JS sets stroke-dasharray and stroke-dashoffset to the computed line length */
}

.connection-line.animate-draw {
  animation: drawLine 600ms ease forwards;
}

/* --------------------------------------------------------------------------
   Layout — Top Navigation Bar (logo · spaces · settings/logout)
   -------------------------------------------------------------------------- */
#nav-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--nav-bg);
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--border-grey);
  position: sticky;
  top: 0;
  z-index: 200;
  min-height: 3.25rem;
  overflow: visible;
}

#nav-bar .nav-brand {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent-cyan);
  flex: 0 0 auto;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.spaces-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: 1 1 auto;
  min-width: 0;
}

.spaces-scroll {
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.spaces-scroll::-webkit-scrollbar {
  display: none;
}

.spaces-list {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  list-style: none;
  padding: 0.15rem 0.1rem;
  margin: 0;
  white-space: nowrap;
}

.space-item {
  display: inline-flex;
  align-items: center;
  gap: 0;
  position: relative;
  flex: 0 0 auto;
}

.space-pill {
  padding: 0.4rem 0.85rem;
  background: var(--surface-raised);
  border: 1px solid var(--border-grey);
  border-radius: 999px;
  color: var(--text-color);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s, box-shadow 0.15s;
  min-height: 2.25rem;
  min-width: auto;
}

.space-pill:hover:not(:disabled) {
  border-color: rgba(0, 229, 255, 0.45);
  color: var(--accent-cyan);
}

.space-pill.active {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  background: rgba(0, 229, 255, 0.1);
  box-shadow: 0 0 12px var(--accent-cyan-dim);
  font-weight: 600;
}

.space-pill.space-opted-out {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Friend search (nav) */
.friend-search-wrap {
  position: relative;
  flex: 0 1 220px;
  min-width: 140px;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.friend-search-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.4rem 0.7rem;
  background: var(--surface-raised);
  border: 1px solid var(--border-grey);
  border-radius: 999px;
  color: var(--text-color);
  font-size: 0.8rem;
  min-height: 2.25rem;
}

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

.friend-search-input:focus {
  outline: none;
  border-color: rgba(0, 229, 255, 0.5);
  box-shadow: 0 0 0 2px var(--accent-cyan-dim);
}

.friend-requests-btn {
  position: relative;
  flex: 0 0 auto;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  background: var(--surface-raised);
  border: 1px solid var(--border-grey);
  border-radius: 999px;
  color: var(--text-color);
  font-size: 0.95rem;
  cursor: pointer;
  line-height: 1;
}

.friend-requests-btn:hover,
.friend-requests-btn[aria-expanded="true"] {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.friend-requests-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 1.1rem;
  height: 1.1rem;
  padding: 0 4px;
  background: #ff5252;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.friend-search-results,
.friend-requests-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: min(320px, 92vw);
  max-height: 360px;
  overflow-y: auto;
  background: var(--modal-bg);
  border: 1px solid var(--border-grey);
  border-radius: 10px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.55);
  z-index: 10001;
  padding: 0.5rem;
}

.friend-search-result,
.friend-request-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.45rem;
  border-radius: 6px;
}

.friend-search-result:hover,
.friend-request-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

.friend-search-info,
.friend-request-info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.friend-search-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-color);
}

.friend-search-id {
  font-size: 0.75rem;
  color: var(--accent-cyan);
}

.friend-search-actions {
  display: flex;
  gap: 0.3rem;
  flex-shrink: 0;
}

.friend-search-block {
  flex: 0 0 auto;
  padding: 0.35rem 0.55rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 2rem;
  border: 1px solid var(--border-grey);
  background: #1a1a1a;
  color: var(--text-muted);
}

.friend-search-block:hover {
  border-color: #ff5252;
  color: #ff5252;
}

.friend-search-action,
.friend-request-accept,
.friend-request-decline {
  flex: 0 0 auto;
  padding: 0.35rem 0.65rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 2rem;
  border: 1px solid var(--border-grey);
  background: #1a1a1a;
  color: var(--text-color);
}

.friend-search-action:hover:not(:disabled),
.friend-request-accept:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.friend-search-action:disabled {
  opacity: 0.5;
  cursor: default;
}

.friend-request-accept {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.friend-request-decline:hover {
  border-color: #ff5252;
  color: #ff5252;
}

.friend-request-actions {
  display: flex;
  gap: 0.35rem;
}

.friend-requests-section {
  padding: 0.35rem 0.15rem;
}

.friend-requests-section + .friend-requests-section {
  border-top: 1px solid var(--border-grey);
  margin-top: 0.35rem;
  padding-top: 0.65rem;
}

.friend-requests-heading {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 0.35rem 0.35rem;
}

.friend-panel-empty {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 0.35rem;
  margin: 0;
}

.friend-toast {
  position: fixed;
  bottom: calc(var(--footer-height, 36px) + 1rem);
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: rgba(20, 20, 20, 0.95);
  border: 1px solid var(--accent-cyan);
  color: var(--text-color);
  padding: 0.65rem 1.1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  z-index: 10002;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}

.friend-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.space-pill-create {
  flex: 0 0 auto;
  border-style: dashed;
  color: var(--accent-cyan);
  background: transparent;
}

.space-pill-create:hover {
  background: var(--accent-cyan-dim);
}

.space-pill-future {
  flex: 0 0 auto;
  opacity: 0.45;
  cursor: not-allowed;
  border-style: dashed;
}

.space-menu-btn {
  margin-left: -0.2rem;
  padding: 0.15rem 0.4rem;
  min-width: 1.65rem;
  min-height: 1.65rem;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.05em;
  cursor: pointer;
  line-height: 1;
}

.space-menu-btn:hover,
.space-menu-btn[aria-expanded="true"] {
  color: var(--accent-cyan);
  background: rgba(0, 229, 255, 0.1);
}

.space-dropdown {
  min-width: 14.5rem;
  max-width: 17rem;
  background: var(--modal-bg);
  border: 1px solid var(--border-grey);
  border-radius: 10px;
  padding: 0.45rem;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
}

.space-dropdown[hidden] {
  display: none !important;
}

.space-dropdown-section {
  padding: 0.35rem 0.25rem 0.5rem;
}

.space-dropdown-section + .space-dropdown-section {
  border-top: 1px solid var(--border-subtle);
  margin-top: 0.2rem;
  padding-top: 0.55rem;
}

.space-dropdown-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.45rem;
}

.space-dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.48rem 0.6rem;
  background: none;
  border: none;
  border-radius: 6px;
  color: var(--text-color);
  font-size: 0.84rem;
  cursor: pointer;
  min-height: 2.1rem;
  min-width: auto;
}

.space-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--accent-cyan);
}

.space-dropdown-item.active {
  color: var(--accent-cyan);
  background: var(--accent-cyan-dim);
  font-weight: 600;
}

.space-dropdown-item.active::before {
  content: '✓ ';
  opacity: 0.85;
}

.space-dropdown-danger {
  color: #ff8a80;
}

.space-dropdown-danger:hover {
  color: #ff5252;
  background: rgba(255, 82, 82, 0.1);
}

.space-dropdown-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 0.35rem 0.15rem;
}

.space-rename-row {
  display: flex;
  gap: 0.35rem;
}

.space-rename-input {
  flex: 1;
  min-width: 0;
  padding: 0.45rem 0.55rem;
  background: var(--surface-raised);
  border: 1px solid var(--border-grey);
  border-radius: 6px;
  color: var(--text-color);
  font-size: 0.84rem;
  min-height: 2.1rem;
}

.space-rename-input:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 2px var(--accent-cyan-dim);
}

.space-rename-save {
  flex: 0 0 auto;
  padding: 0.4rem 0.65rem;
  background: var(--accent-cyan-dim);
  border: 1px solid rgba(0, 229, 255, 0.35);
  border-radius: 6px;
  color: var(--accent-cyan);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  min-width: auto;
  min-height: 2.1rem;
}

.space-rename-save:hover {
  background: rgba(0, 229, 255, 0.22);
}

.space-toggle-row {
  display: flex;
  gap: 0.35rem;
}

.space-toggle-btn {
  flex: 1;
  padding: 0.42rem 0.5rem;
  background: var(--surface-raised);
  border: 1px solid var(--border-grey);
  border-radius: 6px;
  color: var(--text-color);
  font-size: 0.8rem;
  cursor: pointer;
  min-width: auto;
  min-height: 2.1rem;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.space-toggle-btn:hover {
  border-color: rgba(0, 229, 255, 0.4);
  color: var(--accent-cyan);
}

.space-toggle-btn.active {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  background: var(--accent-cyan-dim);
  font-weight: 600;
}

.spaces-scroll-btn {
  flex: 0 0 auto;
  width: 1.75rem;
  height: 1.75rem;
  min-width: 1.75rem;
  min-height: 1.75rem;
  padding: 0;
  background: var(--surface-raised);
  border: 1px solid var(--border-grey);
  border-radius: 50%;
  color: var(--text-color);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.spaces-scroll-btn:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.spaces-scroll-btn[hidden] {
  display: none;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 0 0 auto;
  margin-left: auto;
}

.nav-action-btn {
  background: none;
  border: 1px solid transparent;
  color: var(--text-color);
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.88rem;
  transition: border-color 0.15s, color 0.15s;
  min-width: auto;
}

.nav-action-btn:hover,
.nav-action-btn.nav-active {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

#btn-logout {
  background: none;
  border: 1px solid var(--border-grey);
  color: var(--text-color);
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.88rem;
  transition: border-color 0.15s, color 0.15s;
  min-width: auto;
}

#btn-logout:hover {
  border-color: #ff5252;
  color: #ff5252;
}

/* Legacy nav links (feeds view etc.) */
.nav-link {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-color);
  font-size: 0.95rem;
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  transition: color 0.15s, background 0.15s;
}

.nav-link.nav-active {
  color: var(--accent-cyan);
  border-bottom: 2px solid var(--accent-cyan);
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   Layout — Main App Shell
   -------------------------------------------------------------------------- */
#app-shell {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--footer-height) - 50px);
  padding-bottom: var(--footer-height);
}

/* --------------------------------------------------------------------------
   Layout — Feeds View (sidebar + feed-area)
   -------------------------------------------------------------------------- */
#view-feeds {
  display: none;
  flex-direction: row;
  height: 100%;
  position: relative;
}

#view-feeds.primary-view {
  /* When shown, display is set to flex by JS or override below */
}

/* --------------------------------------------------------------------------
   Layout — Sidebar (inside Feeds View)
   -------------------------------------------------------------------------- */
#sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--nav-bg);
  border-right: 1px solid var(--border-grey);
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.sidebar-heading {
  margin-bottom: 8px;
  color: #aaa;
  font-size: 0.85rem;
}

#sidebar label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.95rem;
  user-select: none;
}

#sidebar input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--accent-cyan);
}

/* --------------------------------------------------------------------------
   Layout — Main Content Area
   -------------------------------------------------------------------------- */
#main-content {
  flex: 1;
  padding: 1.5rem;
  position: relative;
  overflow: auto;
}

/* --------------------------------------------------------------------------
   Views — toggled by NavigationModule (only one visible at a time)
   -------------------------------------------------------------------------- */
.primary-view {
  display: none;
}

/* --------------------------------------------------------------------------
   Auth View
   -------------------------------------------------------------------------- */
#view-auth {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--footer-height));
}

.auth-container {
  background: var(--modal-bg);
  border: 1px solid var(--border-grey);
  border-radius: 10px;
  padding: 36px 40px;
  width: 100%;
  max-width: 420px;
}

.welcome-title {
  text-align: center;
  font-size: 1.6rem;
  margin-bottom: 24px;
  color: var(--text-color);
  font-weight: 600;
}

.auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}

.auth-tab-btn {
  flex: 1;
  padding: 8px;
  background: none;
  border: 1px solid var(--border-grey);
  border-radius: 4px;
  color: var(--text-color);
  cursor: pointer;
  font-size: 0.95rem;
  transition: border-color 0.15s, color 0.15s;
}

.auth-tab-btn.active {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-form input[type="text"],
.auth-form input[type="url"] {
  width: 100%;
  padding: 10px 12px;
  background: #1a1a1a;
  border: 1px solid var(--border-grey);
  border-radius: 4px;
  color: var(--text-color);
  font-size: 0.95rem;
  transition: border-color 0.15s;
}

.auth-form input:focus {
  outline: none;
  border-color: var(--accent-cyan);
}

.error-msg {
  color: #ff5252;
  font-size: 0.82rem;
  display: none;
}

.error-msg.visible {
  display: block;
}

.auth-form button[type="submit"] {
  padding: 11px;
  background: var(--accent-cyan);
  border: none;
  border-radius: 4px;
  color: #000;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: opacity 0.15s;
}

.auth-form button[type="submit"]:hover {
  opacity: 0.85;
}

/* --------------------------------------------------------------------------
   Polygon Frames
   -------------------------------------------------------------------------- */
.polygon-frame {
  position: relative;
  overflow: hidden;
  background: #1a1a1a;
}

.shape-hexagon { clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%); }
.shape-square   { clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%); }
.shape-circle   { clip-path: circle(50% at 50% 50%); }
.shape-pentagon { clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%); }
.shape-triangle { clip-path: polygon(50% 0%, 100% 100%, 0% 100%); }

/* --------------------------------------------------------------------------
   Video Call Screen — Live session layout
   -------------------------------------------------------------------------- */
.video-call-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: calc(100vh - 8rem);
  padding-bottom: 1rem;
}

.video-call-layout {
  width: 100%;
  max-width: 56rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.current-space-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0 0.75rem;
}

.current-space-prefix {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.current-space-label {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-color);
  margin: 0;
}

.no-space-message {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  max-width: 22rem;
  margin: 2rem auto;
  line-height: 1.5;
  padding: 1rem 1.25rem;
  border: 1px dashed var(--border-grey);
  border-radius: 8px;
  background: var(--surface-raised);
}

.session-badge {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-cyan);
  background: var(--accent-cyan-dim);
  border: 1px solid rgba(0, 229, 255, 0.25);
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  max-width: 90vw;
  text-align: center;
}

.session-badge-square {
  color: var(--accent-cyan);
}

.session-badge-group {
  color: #8ee4ff;
}

.session-badge-muted {
  color: var(--text-muted);
  border-color: var(--border-grey);
  background: var(--surface-raised);
}

.main-video-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

#my-video-node,
.main-video-frame {
  width: var(--main-frame-size);
  aspect-ratio: 1;
  margin: 0 auto;
  position: relative;
  background: var(--surface-raised);
  border: 2px solid var(--border-grey);
  box-shadow: 0 0 0 1px var(--border-subtle), 0 12px 40px rgba(0, 0, 0, 0.55);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.main-video-frame.main-swap-flash {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 24px var(--accent-cyan-dim), 0 12px 40px rgba(0, 0, 0, 0.55);
}

.frame-media {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.frame-media video,
.frame-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.frame-label {
  position: absolute;
  bottom: -1.75rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
  pointer-events: none;
}

.video-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: linear-gradient(160deg, #1a1a1a 0%, #0f0f0f 100%);
  color: var(--text-muted);
  text-align: center;
  padding: 0.75rem;
}

.video-placeholder .placeholder-icon {
  font-size: 1.4rem;
  color: var(--accent-cyan);
  opacity: 0.7;
  line-height: 1;
}

.video-placeholder .placeholder-text {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.self-placeholder p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
}

.self-placeholder button {
  padding: 8px 16px;
  background: var(--accent-cyan);
  border: none;
  border-radius: 6px;
  color: #000;
  font-weight: 600;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
}

/* Call controls — Mute / Camera Off */
.call-controls {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: nowrap;
}

.call-control-btn {
  padding: 0.65rem 1.5rem;
  min-width: 7.5rem;
  background: var(--surface-raised);
  border: 1px solid var(--border-grey);
  border-radius: 8px;
  color: var(--text-color);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: border-color 0.15s, color 0.15s, background 0.15s, box-shadow 0.15s;
}

.call-control-btn:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  box-shadow: 0 0 12px var(--accent-cyan-dim);
}

.call-control-btn[aria-pressed="true"] {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  background: rgba(0, 229, 255, 0.08);
}

#video-controls {
  margin-bottom: 0;
}

/* --------------------------------------------------------------------------
   Connection_Map SVG (hidden in call UI)
   -------------------------------------------------------------------------- */
#connection-map {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
  opacity: 0;
  visibility: hidden;
}

/* --------------------------------------------------------------------------
   Peer strip — bottom row of 4 frames
   -------------------------------------------------------------------------- */
.peer-strip {
  width: 100%;
  padding: 1.25rem 1rem 0.5rem;
  border-top: 1px solid var(--border-subtle);
  background: linear-gradient(180deg, transparent 0%, rgba(10, 10, 10, 0.6) 100%);
}

.peer-strip-label {
  text-align: center;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

#peer-nodes-grid {
  display: flex;
  flex-wrap: nowrap;
  gap: 1rem;
  justify-content: center;
  align-items: flex-start;
  position: relative;
  margin-top: 0;
}

.peer-node {
  width: var(--peer-frame-size);
  height: var(--peer-frame-size);
  cursor: pointer;
  position: relative;
  flex: 0 0 auto;
  background: var(--surface-raised);
  border: 2px solid var(--border-grey);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  padding-bottom: 1.25rem;
}

.peer-node:hover {
  transform: translateY(-2px);
  border-color: rgba(0, 229, 255, 0.35);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4), 0 0 10px var(--accent-cyan-dim);
}

.peer-node:active {
  transform: scale(0.97);
  border-color: var(--accent-cyan);
}

.peer-node.peer-slot-active {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 14px var(--accent-cyan-dim);
}

.peer-node.peer-swap-flash {
  border-color: var(--accent-cyan);
}

.peer-name {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
  pointer-events: none;
}

/* Four visually distinct peer states (Req 3.10) */
.state-unconnected    { border: 3px solid var(--border-grey); box-shadow: none; }
.state-pending-sent   { border: 3px dashed var(--accent-amber); box-shadow: 0 0 8px rgba(255,193,7,0.4); }
.state-pending-received { border: 3px solid var(--accent-blue); box-shadow: 0 0 8px rgba(33,150,243,0.5); animation: pulse 1000ms ease-in-out infinite; }
.state-connected      { border: 3px solid var(--accent-cyan); box-shadow: 0 0 14px rgba(0,229,255,0.6); }

/* Peer states via data-state attribute (ConnectionModule) — Req 3.4, 3.6 */
.peer-node[data-state="unconnected"] { border: 3px solid var(--border-grey); box-shadow: none; }
.peer-node[data-state="pending"]     { border: 3px dashed var(--accent-amber); box-shadow: 0 0 8px rgba(255,193,7,0.4); }
.peer-node[data-state="connected"]   { border: 3px solid var(--accent-cyan); box-shadow: 0 0 14px rgba(0,229,255,0.6); }

.settings-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  line-height: 1.45;
}

/* Peer info overlay */
.peer-overlay {
  position: absolute;
  z-index: 20;
  background: rgba(0, 0, 0, 0.85);
  border: 1px solid var(--border-grey);
  border-radius: 8px;
  padding: 14px 18px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  min-width: 140px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
}

#peer-overlay-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#btn-connect {
  padding: 8px 18px;
  background: var(--accent-cyan);
  border: none;
  border-radius: 4px;
  color: #000;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.9rem;
  min-width: 44px;
  min-height: 44px;
  transition: opacity 0.15s;
}

#btn-connect:hover {
  opacity: 0.85;
}

.peer-node .peer-name {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-color);
  background: rgba(0, 0, 0, 0.7);
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   App Modals (approval, Square join warning, etc.)
   -------------------------------------------------------------------------- */
.app-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

#square-join-modal {
  z-index: 1001;
}

.app-modal .modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: -1;
}

.app-modal .modal-content {
  background: var(--modal-bg);
  border: 1px solid var(--border-grey);
  border-radius: 10px;
  padding: 32px 36px;
  min-width: 300px;
  max-width: 420px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  z-index: 1;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
}

.app-modal h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-color);
  margin: 0;
}

.app-modal p {
  font-size: 0.92rem;
  color: #aaa;
  margin: 0;
  line-height: 1.5;
}

.app-modal .modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.app-modal .btn-primary {
  padding: 10px 24px;
  background: var(--accent-cyan);
  color: #000;
  border: none;
  border-radius: 4px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  transition: opacity 0.15s;
}

.app-modal .btn-primary:hover {
  opacity: 0.85;
}

.app-modal .btn-secondary {
  padding: 10px 24px;
  background: #333;
  color: var(--text-color);
  border: 1px solid var(--border-grey);
  border-radius: 4px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.app-modal .btn-secondary:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.app-modal .btn-danger {
  padding: 10px 24px;
  background: #ff5252;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  transition: opacity 0.15s;
}

.app-modal .btn-danger:hover {
  opacity: 0.88;
}

.modal-content-warning h3 {
  color: #ff8a80;
}

#groups-delete-modal {
  z-index: 1001;
}

#square-join-modal .modal-content {
  text-align: left;
  align-items: stretch;
}

#square-join-modal #square-join-title {
  color: var(--accent-cyan);
}

#square-join-modal #square-join-message {
  color: var(--text-muted);
}

#square-join-modal .modal-actions {
  justify-content: flex-end;
}

/* Camera-off thumbnail in main frame and peer tiles */
.camera-off-thumbnail {
  position: relative;
  z-index: 2;
}

.self-participant-node {
  border: 3px solid var(--accent-cyan);
  box-shadow: 0 0 14px rgba(0, 229, 255, 0.45);
  cursor: default;
}

.self-participant-node:hover,
.self-participant-node:active {
  transform: none;
  box-shadow: 0 0 14px rgba(0, 229, 255, 0.45);
}

/* --------------------------------------------------------------------------
   Feed Area
   -------------------------------------------------------------------------- */
#feed-area {
  flex: 1;
  position: relative;
  min-height: 400px;
  padding: 16px;
}

.feed-empty-state {
  text-align: center;
  color: #666;
  padding: 60px 20px;
  font-size: 1rem;
}

/* Category group connector */
.category-group-border {
  position: absolute;
  border: 1px dashed rgba(0, 229, 255, 0.25);
  border-radius: 8px;
  pointer-events: none;
  z-index: 1;
}

/* --------------------------------------------------------------------------
   Video Cards
   -------------------------------------------------------------------------- */
.video-card {
  position: absolute;
  width: 280px;
  background: var(--card-bg);
  border: 1px solid var(--border-grey);
  border-radius: 8px;
  overflow: hidden;
  z-index: 2;
}

.video-card video,
.video-card iframe {
  width: 100%;
  aspect-ratio: 16/9;
  display: block;
  background: #000;
  border: none;
}

.card-meta {
  padding: 8px 10px 4px;
  font-size: 0.8rem;
  color: #888;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.card-share {
  display: flex;
  gap: 6px;
  padding: 4px 10px 10px;
  flex-wrap: wrap;
}

.card-share button {
  padding: 5px 10px;
  background: #1a1a1a;
  border: 1px solid var(--border-grey);
  border-radius: 4px;
  color: var(--text-color);
  font-size: 0.78rem;
  cursor: pointer;
  min-height: 44px;
  transition: border-color 0.15s;
}

.card-share button:hover {
  border-color: var(--accent-cyan);
}

/* Copy-link tooltip */
.copy-tooltip {
  position: fixed;
  bottom: 50px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent-cyan);
  color: #000;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 0.88rem;
  font-weight: 600;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 500;
}

.copy-tooltip.visible {
  opacity: 1;
}

/* Copy-link fallback input */
.copy-fallback-input {
  padding: 6px 8px;
  background: #1a1a1a;
  border: 1px solid var(--border-grey);
  border-radius: 4px;
  color: var(--text-color);
  font-size: 0.8rem;
}

/* --------------------------------------------------------------------------
   Uploads View
   -------------------------------------------------------------------------- */
#view-uploads {
  max-width: 700px;
  margin: 0 auto;
}

.upload-section {
  background: var(--card-bg);
  border: 1px solid var(--border-grey);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 24px;
}

.upload-section h2 {
  margin-bottom: 16px;
  font-size: 1.1rem;
  color: var(--accent-cyan);
}

/* Hide the native file input; use styled label instead */
.upload-section input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* File picker label styled as a button */
.file-picker-btn {
  display: inline-block;
  padding: 10px 20px;
  background: var(--accent-cyan);
  border: none;
  border-radius: 4px;
  color: #000;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  min-height: 44px;
  min-width: 44px;
  line-height: 24px;
  text-align: center;
  transition: opacity 0.15s;
  margin-bottom: 10px;
}

.file-picker-btn:hover {
  opacity: 0.85;
}

.file-picker-btn:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 2px;
}

.upload-section input[type="url"],
.upload-section input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  background: #1a1a1a;
  border: 1px solid var(--border-grey);
  border-radius: 4px;
  color: var(--text-color);
  font-size: 0.95rem;
  margin-bottom: 10px;
}

.upload-section input[type="text"]:focus,
.upload-section input[type="url"]:focus {
  outline: none;
  border-color: var(--accent-cyan);
}

.upload-section button {
  padding: 10px 20px;
  background: var(--accent-cyan);
  border: none;
  border-radius: 4px;
  color: #000;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  min-width: 44px;
  transition: opacity 0.15s;
}

.upload-section button:hover {
  opacity: 0.85;
}

/* Error messages in uploads view */
.upload-section .error-msg {
  display: none;
  color: #ff5252;
  font-size: 0.85rem;
  margin-bottom: 10px;
}

.upload-section .error-msg.visible {
  display: block;
}

/* Video cards container */
#video-cards-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Generic upload-error (used in Settings view) */
.upload-error {
  color: #ff5252;
  font-size: 0.85rem;
  margin-top: 6px;
  display: none;
}

.upload-error.visible {
  display: block;
}

/* --------------------------------------------------------------------------
   Settings View
   -------------------------------------------------------------------------- */
#view-settings {
  max-width: 600px;
  margin: 0 auto;
}

.settings-section {
  background: var(--card-bg);
  border: 1px solid var(--border-grey);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 24px;
}

.settings-section h2 {
  margin-bottom: 16px;
  font-size: 1.1rem;
  color: var(--accent-cyan);
}

.settings-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.settings-row label {
  font-size: 0.92rem;
  min-width: 120px;
}

#bg-color-picker {
  width: 48px;
  height: 36px;
  padding: 2px;
  border: 1px solid var(--border-grey);
  border-radius: 4px;
  background: #1a1a1a;
  cursor: pointer;
  min-height: 44px;
}

.bg-size-radios,
.wallpaper-size-radios {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.bg-size-radios label,
.wallpaper-size-radios label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  cursor: pointer;
  min-height: 44px;
}

#btn-remove-wallpaper {
  padding: 9px 18px;
  background: none;
  border: 1px solid #ff5252;
  border-radius: 4px;
  color: #ff5252;
  cursor: pointer;
  font-size: 0.9rem;
  display: none;
  min-height: 44px;
}

#btn-remove-wallpaper.visible {
  display: inline-block;
}

.thumbnail-preview-wrap {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

.thumbnail-preview {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border-grey);
  background: #1a1a1a;
}

#thumbnail-upload {
  font-size: 0.9rem;
  color: var(--text-color);
}

#btn-remove-thumbnail {
  padding: 9px 18px;
  background: none;
  border: 1px solid #ff5252;
  border-radius: 4px;
  color: #ff5252;
  cursor: pointer;
  font-size: 0.9rem;
  min-height: 44px;
}

#btn-remove-thumbnail:hover {
  background: rgba(255, 82, 82, 0.1);
}

.manage-groups-select-all-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
  cursor: pointer;
  min-height: 44px;
}

.manage-groups-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
  max-height: 280px;
  overflow-y: auto;
}

.manage-groups-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.5rem;
  border: 1px solid var(--border-grey);
  border-radius: 6px;
  background: #141414;
  cursor: pointer;
  min-height: 44px;
}

.manage-groups-row:hover {
  border-color: rgba(0, 229, 255, 0.35);
}

.manage-groups-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.manage-groups-name {
  font-size: 0.92rem;
  font-weight: 600;
}

.manage-groups-role {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.manage-groups-empty {
  margin-bottom: 0.5rem;
}

.btn-delete-groups {
  padding: 10px 20px;
  background: none;
  border: 1px solid #ff5252;
  border-radius: 4px;
  color: #ff5252;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
}

.btn-delete-groups:hover:not(:disabled) {
  background: rgba(255, 82, 82, 0.12);
}

.btn-delete-groups:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.settings-subheading {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 1rem 0 0.5rem;
}

.settings-subheading:first-of-type {
  margin-top: 0;
}

.blocked-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.blocked-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.5rem;
  border: 1px solid var(--border-grey);
  border-radius: 6px;
  background: #141414;
}

.blocked-item-info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.blocked-item-name {
  font-size: 0.9rem;
  font-weight: 600;
}

.blocked-item-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.blocked-list-empty {
  margin: 0 0 0.5rem;
}

.blocked-unblock-btn {
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--accent-cyan);
  border-radius: 4px;
  background: transparent;
  color: var(--accent-cyan);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 2rem;
}

.blocked-unblock-btn:hover {
  background: var(--accent-cyan-dim);
}

.blocked-add-group-row {
  margin-top: 0.5rem;
}

#block-group-select {
  flex: 1 1 auto;
  min-width: 140px;
  padding: 0.5rem 0.65rem;
  background: #1a1a1a;
  border: 1px solid var(--border-grey);
  border-radius: 4px;
  color: var(--text-color);
  font-size: 0.88rem;
  min-height: 44px;
}

.btn-block-group {
  padding: 0.5rem 1rem;
  background: none;
  border: 1px solid #ff5252;
  border-radius: 4px;
  color: #ff5252;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
}

.btn-block-group:hover {
  background: rgba(255, 82, 82, 0.1);
}

/* Settings Shape Selector */
#settings-shape-selector {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

#settings-shape-selector button {
  padding: 8px 16px;
  background: #1a1a1a;
  border: 1px solid var(--border-grey);
  border-radius: 4px;
  color: var(--text-color);
  cursor: pointer;
  font-size: 0.9rem;
  transition: border-color 0.15s, color 0.15s;
  min-width: 44px;
  min-height: 44px;
}

#settings-shape-selector button:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

#settings-shape-selector button.active {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  font-weight: 600;
}

/* Wallpaper file input in Settings */
#wallpaper-upload {
  font-size: 0.9rem;
  color: var(--text-color);
}

/* Wallpaper size controls */
#wallpaper-size-controls {
  margin-top: 10px;
  margin-bottom: 14px;
}

/* --------------------------------------------------------------------------
   Footer (Req 10)
   -------------------------------------------------------------------------- */
#app-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--footer-height);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  opacity: 0.6;
  background: rgba(0, 0, 0, 0.85);
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  z-index: 50;
  pointer-events: none;
  user-select: none;
}

/* --------------------------------------------------------------------------
   Tap Targets — all interactive controls ≥44×44px (Req 8.4)
   -------------------------------------------------------------------------- */
button,
input,
select,
textarea,
a[role="button"],
.nav-link,
[role="button"] {
  min-height: 44px;
  min-width: 44px;
}

/* --------------------------------------------------------------------------
   Responsive — ≤768px (Req 8)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  #app-shell {
    flex-direction: column;
  }

  /* Feeds view stacks vertically on mobile */
  #view-feeds {
    flex-direction: column;
  }

  /* 8.2 — sidebar hidden by default on mobile, overlaid when .sidebar-open */
  #sidebar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    z-index: 150;
    width: 75vw;
    max-width: 260px;
    padding-top: 60px;
  }

  #sidebar.sidebar-open {
    display: flex;
  }

  /* Hamburger button visible on mobile */
  .hamburger-btn {
    display: flex;
  }

  #hamburger-btn {
    display: flex;
  }

  :root {
    --main-frame-size: min(78vw, 20rem);
    --peer-frame-size: min(20vw, 5.5rem);
  }

  #peer-nodes-grid {
    gap: 0.5rem;
  }

  .call-control-btn {
    min-width: 6.5rem;
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
  }

  /* Nav links collapse — hamburger takes over navigation */
  #nav-bar {
    flex-wrap: wrap;
    padding: 0.5rem 0.65rem;
    gap: 0.5rem;
  }

  .spaces-nav {
    order: 3;
    width: 100%;
  }

  .friend-search-wrap {
    flex: 1 1 100%;
    order: 2;
    max-width: none;
  }

  .nav-actions {
    margin-left: 0;
  }

  .space-pill-future {
    display: none;
  }

  .peer-node {
    width: 30vw;
    height: 30vw;
    max-width: 120px;
    max-height: 120px;
  }

  .video-card {
    width: calc(100vw - 2.5rem);
    position: static;
    margin-bottom: 1.25rem;
  }

  #feed-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
  }

  /* Auth container fluid on mobile */
  .auth-container {
    padding: 1.5rem;
    max-width: 90vw;
  }

  /* Settings/Uploads fluid width */
  #view-settings,
  #view-uploads {
    max-width: 90vw;
  }
}

/* Feeds hamburger button — hidden on desktop, visible at ≤768px */
.hamburger-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-color);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 6px;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 160;
}

/* Nav hamburger hidden on desktop */
#hamburger-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-color);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 6px;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
}

/* Sidebar overlay backdrop */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 140;
}

.sidebar-backdrop.visible {
  display: block;
}
