/* ==========================================================================
   YAYAMOVIE — Ultra-Clean Netflix-Inspired Cinema Design System
   ========================================================================== */

:root {
  --bg-main: #08090d;
  --bg-surface: #0f1118;
  --bg-card: #151822;
  --bg-card-hover: #1c202d;
  --bg-glass: rgba(15, 17, 24, 0.88);
  
  --border: rgba(255, 255, 255, 0.08);
  --border-light: rgba(255, 255, 255, 0.14);
  --border-brand: rgba(229, 9, 20, 0.5);

  --text: #f9fafb;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;

  --brand: #e50914;
  --brand-hover: #f40612;
  --brand-glow: rgba(229, 9, 20, 0.35);

  --accent: #6366f1;
  --accent-glow: rgba(99, 102, 241, 0.3);
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;

  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;

  --header-h: 60px;
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  min-height: 100vh;
  background-color: var(--bg-main);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.16);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.28);
}

/* Base Elements */
h1, h2, h3, h4 {
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
}

a {
  color: inherit;
  text-decoration: none;
}

button, input, select, textarea {
  font-family: inherit;
}

/* ==========================================================================
   APP HEADER
   ========================================================================== */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  display: flex;
  align-items: center;
}

.header-inner {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.brand-badge {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-xs);
  background: linear-gradient(135deg, var(--brand), #991b1b);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
  box-shadow: 0 4px 12px var(--brand-glow);
}

.brand-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #fff;
}
.brand-title span {
  color: var(--brand);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.room-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(229, 9, 20, 0.12);
  border: 1px solid rgba(229, 9, 20, 0.35);
  color: #fca5a5;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}
.room-status-pill:hover {
  background: rgba(229, 9, 20, 0.2);
  border-color: var(--brand);
}

.live-dot {
  color: var(--brand);
  font-size: 8px;
  animation: pulseLive 1.5s infinite;
}
@keyframes pulseLive {
  0% { opacity: 0.4; }
  50% { opacity: 1; transform: scale(1.1); }
  100% { opacity: 0.4; }
}

.profile-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.profile-pill:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
}

/* ==========================================================================
   BUTTONS & FORM CONTROLS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}
.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 4px 16px var(--brand-glow);
}
.btn-primary:hover {
  background: var(--brand-hover);
  box-shadow: 0 6px 20px var(--brand-glow);
}

.btn-secondary {
  background: var(--bg-card);
  border-color: var(--border);
  color: var(--text);
}
.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.btn-danger {
  background: #dc2626;
  color: #fff;
  border-color: #b91c1c;
}
.btn-danger:hover {
  background: #ef4444;
  box-shadow: 0 4px 16px rgba(220, 38, 38, 0.4);
}

.btn-block {
  width: 100%;
}
.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: var(--radius-xs);
}
.btn-lg {
  padding: 12px 24px;
  font-size: 14px;
  border-radius: var(--radius-sm);
}

/* Form Inputs */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.input-with-action {
  display: flex;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color 0.2s ease;
}
.input-with-action:focus-within {
  border-color: var(--brand);
}

.text-input {
  flex: 1;
  background: transparent;
  border: none;
  padding: 12px 14px;
  color: #fff;
  font-size: 13px;
  outline: none;
}
.text-input::placeholder {
  color: var(--text-dim);
}

.input-action-btn {
  background: transparent;
  border: none;
  padding: 0 14px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  transition: color 0.2s ease;
}
.input-action-btn:hover {
  color: #fff;
}

/* ==========================================================================
   APP MAIN & LOBBY VIEW
   ========================================================================== */
.app-main {
  padding-top: var(--header-h);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.lobby-section {
  position: relative;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 40px 20px 80px;
  display: flex;
  flex-direction: column;
  gap: 36px;
}

/* Ambient Background Lights */
.ambient-glow {
  position: absolute;
  pointer-events: none;
  filter: blur(80px);
  opacity: 0.25;
  border-radius: 50%;
  z-index: 0;
}
.glow-top {
  top: 20px;
  left: 20%;
  width: 400px;
  height: 250px;
  background: radial-gradient(circle, var(--brand), transparent 70%);
}
.glow-bottom {
  top: 280px;
  right: 15%;
  width: 350px;
  height: 250px;
  background: radial-gradient(circle, var(--accent), transparent 70%);
}

/* Hero Header */
.lobby-hero {
  position: relative;
  z-index: 1;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.hero-heading {
  font-size: clamp(28px, 5vw, 42px);
  font-weight: 800;
  line-height: 1.18;
}
.gradient-text {
  background: linear-gradient(90deg, #fff 0%, #fca5a5 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subheading {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 580px;
  line-height: 1.6;
}

/* Control Deck Card */
.control-deck-card {
  position: relative;
  z-index: 2;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.deck-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
}

.deck-tab {
  flex: 1;
  padding: 14px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.deck-tab:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.02);
}
.deck-tab.active {
  color: #fff;
  border-bottom-color: var(--brand);
  background: rgba(229, 9, 20, 0.05);
}

.deck-panel {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Source Selection Pills */
.source-pills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.source-pill {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.source-pill input[type="radio"] {
  display: none;
}
.source-pill:hover {
  border-color: var(--border-light);
  background: var(--bg-card);
}
.source-pill.active {
  background: rgba(229, 9, 20, 0.08);
  border-color: var(--brand);
}

.pill-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.pill-icon.yt { background: rgba(229, 9, 20, 0.15); color: var(--brand); }
.pill-icon.direct { background: rgba(99, 102, 241, 0.15); color: var(--accent); }
.pill-icon.local { background: rgba(16, 185, 129, 0.15); color: var(--success); }

.pill-text {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.pill-text strong {
  font-size: 13px;
  color: #fff;
}
.pill-text span {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Local File Drop Zone */
.file-drop-zone {
  border: 2px dashed var(--border-light);
  border-radius: var(--radius-sm);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  cursor: pointer;
  background: var(--bg-surface);
  transition: all 0.2s ease;
}
.file-drop-zone:hover {
  border-color: var(--brand);
  background: rgba(229, 9, 20, 0.04);
}
.drop-zone-text strong {
  font-size: 13px;
  color: #fff;
}
.drop-zone-text span {
  font-size: 11px;
  color: var(--text-dim);
}

.file-input-compact {
  width: 100%;
  font-size: 12px;
  color: var(--text-muted);
}

/* Recent Rooms List */
.recent-rooms-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
}
.recent-room-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  transition: all 0.2s ease;
}
.recent-room-item:hover {
  border-color: var(--border-light);
  background: var(--bg-card);
}
.recent-room-code {
  font-weight: 700;
  color: #fff;
}
.recent-room-time {
  font-size: 11px;
  color: var(--text-dim);
}

/* Features Pillars */
.features-pillars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  position: relative;
  z-index: 1;
}

.pillar-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pillar-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-xs);
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand);
  font-size: 16px;
}
.pillar-card h3 {
  font-size: 14px;
  font-weight: 700;
}
.pillar-card p {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ==========================================================================
   VIEW 2: CINEMA THEATER ROOM
   ========================================================================== */
.room-section {
  flex: 1;
  width: 100%;
  height: calc(100vh - var(--header-h));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.theater-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  height: 100%;
  width: 100%;
  overflow: hidden;
}

/* Left Stage */
.theater-stage {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #000;
  overflow-y: auto;
}

.player-screen-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 75vh;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.ambient-screen-glow {
  position: absolute;
  inset: -15%;
  width: 130%;
  height: 130%;
  background: radial-gradient(circle at center, rgba(229, 9, 20, 0.25) 0%, transparent 60%);
  filter: blur(60px);
  pointer-events: none;
  z-index: 1;
  opacity: 0.4;
}

.video-engine-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
}

#html5Video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

/* Local Peer File Picker Overlay */
.local-peer-prompt-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 8;
  padding: 20px;
}

.local-peer-prompt-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 16px 40px rgba(0,0,0,0.6);
  animation: popIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Autoplay Policy Guard Overlay */
.autoplay-guard-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 15;
  cursor: pointer;
  padding: 16px;
}

.autoplay-guard-pill {
  background: rgba(14, 19, 31, 0.95);
  border: 1px solid var(--brand);
  box-shadow: 0 8px 32px var(--brand-glow), 0 0 20px rgba(229, 9, 20, 0.3);
  color: #fff;
  padding: 14px 24px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: pulseLive 2s infinite;
  transition: transform 0.2s ease;
}
.autoplay-guard-pill:hover {
  transform: scale(1.05);
}

/* Floating Reactions */
.floating-reactions-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  overflow: hidden;
}

.floating-emoji {
  position: absolute;
  bottom: 20px;
  font-size: 32px;
  user-select: none;
  animation: floatEmoji 2.2s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes floatEmoji {
  0% { transform: translateY(0) scale(0.5); opacity: 0; }
  15% { transform: translateY(-15px) scale(1.15); opacity: 1; }
  85% { opacity: 0.9; }
  100% { transform: translateY(-220px) scale(0.8); opacity: 0; }
}

/* Sync Pill */
.sync-notification-pill {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
  background: rgba(15, 17, 24, 0.9);
  border: 1px solid var(--border-light);
  backdrop-filter: blur(12px);
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  z-index: 15;
  pointer-events: none;
  opacity: 0;
  transition: all 0.2s ease;
}
.sync-notification-pill.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Toolbar under video */
.theater-toolbar {
  padding: 14px 20px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toolbar-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.media-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
}

.media-type-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--brand);
  color: #fff;
  text-transform: uppercase;
  flex-shrink: 0;
}

.current-media-title {
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Reactions Bar */
.reactions-strip {
  display: flex;
  align-items: center;
  gap: 10px;
}
.reactions-strip-lbl {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 4px;
}

.reaction-buttons-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.reaction-bubble-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.reaction-bubble-btn:hover {
  background: var(--bg-card-hover);
  transform: scale(1.2);
}
.reaction-bubble-btn:active {
  transform: scale(0.9);
}

/* Right Social Sidebar */
.theater-sidebar {
  height: 100%;
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.sidebar-tab-header {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--bg-main);
}

.sidebar-tab-nav {
  flex: 1;
  padding: 12px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.sidebar-tab-nav:hover { color: #fff; }
.sidebar-tab-nav.active {
  color: #fff;
  border-bottom-color: var(--brand);
  background: rgba(255, 255, 255, 0.02);
}

.sidebar-content-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Chat Stream */
.chat-stream-box {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-bubble {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 90%;
}
.chat-bubble.mine {
  align-self: flex-end;
}
.chat-bubble.system {
  align-self: center;
  font-size: 11px;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.04);
  padding: 3px 10px;
  border-radius: 10px;
}

.chat-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-dim);
}
.chat-meta .crown-icon {
  color: var(--warning);
  font-size: 9px;
}

.chat-text {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 7px 11px;
  border-radius: 10px;
  font-size: 13px;
  color: var(--text);
  word-break: break-word;
}
.chat-bubble.mine .chat-text {
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  border-color: rgba(99, 102, 241, 0.4);
  color: #fff;
}

.chat-form-box {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  background: var(--bg-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-text-input {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  color: #fff;
  outline: none;
}
.chat-text-input:focus {
  border-color: var(--brand);
}

.chat-send-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease;
}
.chat-send-btn:active { transform: scale(0.92); }

/* Participants Box */
.participants-box {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.participant-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: var(--radius-xs);
  background: var(--bg-card);
  border: 1px solid var(--border);
}
.p-info {
  display: flex;
  align-items: center;
  gap: 8px;
}
.p-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
}

/* Room Settings Box */
.room-settings-box {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.setting-title { font-size: 13px; font-weight: 600; }
.setting-desc { font-size: 11px; color: var(--text-dim); }

/* ==========================================================================
   MODALS
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
}
.modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.modal-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.6);
  transform: scale(0.96);
  transition: transform 0.2s ease;
}
.modal-backdrop.active .modal-card {
  transform: scale(1);
}

.modal-card-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-card-head h3 {
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
}
.modal-close-btn:hover { color: #fff; }

.modal-card-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-card-foot {
  padding: 12px 20px;
  background: var(--bg-main);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.avatar-picker-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.avatar-choice-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 8px;
  font-size: 20px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.avatar-choice-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--brand);
  transform: scale(1.1);
}

/* Toast Notifications */
.toast-stack {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast-msg {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  color: #fff;
  padding: 9px 16px;
  border-radius: var(--radius-xs);
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
  pointer-events: auto;
  animation: slideToast 0.25s ease;
}
.toast-msg.success { border-left: 3px solid var(--success); }
.toast-msg.error { border-left: 3px solid var(--danger); }
.toast-msg.info { border-left: 3px solid var(--accent); }

@keyframes slideToast {
  from { transform: translateY(50%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Google Profile & Avatars */
.profile-avatar-img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.chat-avatar-img {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.participant-avatar-img {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.google-auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.google-auth-left {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
}

.google-auth-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--brand);
}

.google-user-name {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}

.google-user-email {
  font-size: 11px;
  color: var(--text-dim);
}

.google-connected-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  color: var(--success);
  margin-top: 2px;
}

.violation-tag {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Public Live Rooms Section */
.public-rooms-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  z-index: 1;
}

.public-rooms-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.public-rooms-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.public-rooms-title h2 {
  font-size: 18px;
  font-weight: 800;
}

.live-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 12px var(--brand);
  animation: pulseLive 1.4s infinite;
}

.public-rooms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.public-room-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}
.public-room-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-light);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
}

.public-room-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--bg-surface);
  position: relative;
  overflow: hidden;
}
.public-room-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}
.public-room-card:hover .public-room-thumb img {
  transform: scale(1.05);
}

.public-live-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(229, 9, 20, 0.9);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.public-viewers-badge {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.public-room-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  justify-content: space-between;
}

.public-room-title {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.public-room-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: 4px;
}

.public-room-host {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
}
.public-host-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
}
.public-host-name {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 110px;
}

/* ==========================================================================
   RESPONSIVE LAYOUTS (MOBILE & TABLET)
   ========================================================================== */
@media (max-width: 860px) {
  .theater-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  .theater-stage {
    max-height: none;
  }
  .theater-sidebar {
    height: 380px;
  }
  .source-pills-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .app-header {
    padding: 0 12px;
    height: 54px;
  }
  .header-inner {
    gap: 8px;
  }
  .brand-title {
    font-size: 15px;
  }
  .header-actions {
    gap: 6px;
  }
  .room-status-pill {
    padding: 4px 8px;
    font-size: 11px;
    gap: 4px;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .profile-pill {
    padding: 4px 8px;
    gap: 6px;
  }
  .profile-pill #userProfileName {
    display: none; /* Hide profile name text on mobile to avoid squishing */
  }
  .profile-pill .fa-chevron-down {
    display: none;
  }
  .theater-toolbar {
    padding: 10px 12px;
    gap: 10px;
  }
  .toolbar-info-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .media-title-group {
    width: 100%;
    justify-content: flex-start;
  }
  .current-media-title {
    font-size: 13px;
    max-width: calc(100vw - 120px);
  }
  .toolbar-actions {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
  }
  .toolbar-actions .btn {
    flex: 1;
    padding: 8px 4px;
    font-size: 12px;
    gap: 4px;
    justify-content: center;
  }
  .toolbar-actions .btn.btn-ghost {
    flex: 0 0 34px;
    padding: 8px 0;
  }
  .toolbar-btn-text {
    display: none; /* Icon-only buttons on small mobile screens for clean toolbar */
  }
  .lobby-section {
    padding: 24px 14px 60px;
  }
  .deck-panel {
    padding: 16px;
  }
  .hero-heading {
    font-size: 24px;
  }
  .features-pillars {
    grid-template-columns: 1fr;
  }
}

/* Native Fullscreen & Mobile Landscape Cinema Mode */
.player-screen-wrap:fullscreen,
.player-screen-wrap:-webkit-full-screen {
  width: 100vw !important;
  height: 100vh !important;
  max-height: 100vh !important;
  aspect-ratio: auto !important;
  background: #000 !important;
}

.player-screen-wrap:fullscreen .video-engine-frame,
.player-screen-wrap:-webkit-full-screen .video-engine-frame {
  width: 100vw;
  height: 100vh;
}
