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

:root {
  --bg-primary: #08000e;
  color-scheme: dark;
  --bg-secondary: rgba(145, 0, 141, 0.06);
  --bg-surface: rgba(145, 0, 141, 0.10);
  --bg-input: rgba(145, 0, 141, 0.04);
  --text-primary: #f0eaf0;
  --text-secondary: #b8a8b8;
  --text-muted: rgba(184, 168, 184, 0.5);
  --accent: #00e0ba;
  --accent-hover: #10ecc8;
  --accent-dim: rgba(0, 224, 186, 0.15);
  --accent-cyan: #00e0ba;
  --accent-cyan-dim: rgba(0, 224, 186, 0.15);
  --accent-indigo: #91008d;
  --danger: #ff3483;
  --danger-dim: rgba(255, 52, 131, 0.15);
  --success: #00e0ba;
  --success-dim: rgba(0, 224, 186, 0.15);
  --warning: #ffcf00;
  --warning-dim: rgba(255, 207, 0, 0.15);
  --border-color: rgba(240, 234, 240, 0.06);
  --radius: 14px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --header-h: 52px;
  --controls-h: 60px;
  --side-w: 320px;
}

html { transition: background 0.3s ease; scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  transition: background 0.3s ease, color 0.3s ease;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

input, button, select, textarea { font-family: inherit; outline: none; }
input::placeholder { color: var(--text-muted); }
textarea { resize: vertical; font-family: inherit; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

::selection { background: var(--accent-dim); color: var(--accent); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: inherit;
  position: relative;
  overflow: hidden;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--ripple-x, 50%) var(--ripple-y, 50%), rgba(255,255,255,0.15) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.btn:active::after { opacity: 1; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-indigo) 100%);
  color: #f0eaf0;
}
.btn-primary:hover { filter: brightness(1.1); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(0, 224, 186, 0.3); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}
.btn-secondary:hover { background: var(--bg-input); color: var(--text-primary); border-color: var(--accent-dim); }

.btn-danger {
  background: var(--danger-dim);
  color: var(--danger);
  border: 1px solid rgba(255, 52, 131, 0.2);
}
.btn-danger:hover { background: rgba(255, 52, 131, 0.25); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--bg-surface); color: var(--text-primary); }

.btn-icon {
  padding: 8px;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn-loading::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid var(--text-primary);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.input {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: var(--text-primary);
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.input.error { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-dim); }

.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 32px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}
.badge-accent { background: var(--accent-dim); color: var(--accent); }
.badge-cyan { background: var(--accent-cyan-dim); color: var(--accent-cyan); }
.badge-success { background: var(--success-dim); color: var(--success); }

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.dot-connecting { background: var(--warning); animation: pulse-dot 1s infinite; }
.dot-connected { background: var(--success); }
.dot-idle { background: var(--text-muted); }
.dot-error { background: var(--danger); }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes btnGlow {
  0%, 100% { box-shadow: 0 4px 20px rgba(0, 224, 186, 0.2), 0 0 0 rgba(145, 0, 141, 0); }
  50% { box-shadow: 0 4px 30px rgba(0, 224, 186, 0.3), 0 0 20px rgba(145, 0, 141, 0.1); }
}

@keyframes boardSlideUp {
  from { opacity: 0; transform: translateY(30px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(100%); }
}

.animate-in { animation: fadeIn 0.3s ease; }
.animate-slide-up { animation: slideUp 0.3s ease; }
.animate-slide-right { animation: slideInRight 0.3s ease; }

.hidden { display: none !important; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-cyan { color: var(--accent-cyan); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }

.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mr-8 { margin-right: 8px; }
.ml-8 { margin-left: 8px; }

.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-col { display: flex; flex-direction: column; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.flex-1 { flex: 1; min-width: 0; min-height: 0; }
.flex-shrink-0 { flex-shrink: 0; }

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-surface); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== SKELETON LOADING ===== */
.skeleton {
  background: linear-gradient(90deg, var(--bg-surface) 25%, var(--bg-input) 50%, var(--bg-surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}
.skeleton-text { height: 12px; margin-bottom: 8px; width: 80%; }
.skeleton-text.short { width: 50%; }
.skeleton-avatar { width: 40px; height: 40px; border-radius: 50%; }
.skeleton-video { width: 100%; aspect-ratio: 16/9; border-radius: var(--radius-sm); }

/* ===== TOAST CONTAINER ===== */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-size: 13px;
  color: var(--text-primary);
  box-shadow: var(--shadow);
  animation: toastIn 0.25s ease;
  pointer-events: auto;
  max-width: 360px;
  backdrop-filter: blur(12px);
}
.toast-item.removing { animation: toastOut 0.2s ease forwards; }
.toast-item.toast-error { border-color: var(--danger); background: var(--danger-dim); }
.toast-item.toast-success { border-color: var(--accent); background: var(--accent-dim); }

/* ===== OVERLAY ===== */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 0, 14, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: overlayIn 0.25s ease;
}

@keyframes overlayIn {
  from { opacity: 0; backdrop-filter: blur(0px); -webkit-backdrop-filter: blur(0px); }
  to { opacity: 1; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
}

/* ===== MOBILE RESPONSIVE OVERRIDES ===== */
@media (max-width: 800px) {
  :root {
    --radius: 10px;
    --header-h: 48px;
    --controls-h: 56px;
    --side-w: 100vw;
  }
}

/* ===== PIN TO FULLSCREEN ===== */
.video-grid.has-pinned { position: relative; }
.video-grid.has-pinned .video-wrapper.pinned {
  grid-column: 1;
  grid-row: 1;
  z-index: 2;
}
.video-grid.has-pinned .video-wrapper.thumb {
  position: absolute;
  bottom: 12px;
  right: 12px;
  width: 160px;
  height: 100px;
  z-index: 3;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid var(--border-color);
}
.video-grid.has-pinned .video-wrapper.thumb:hover {
  transform: scale(1.05);
  border-color: var(--accent-dim);
}
.video-grid.has-pinned .video-wrapper.thumb .video-label { font-size: 10px; padding: 2px 6px; }
.video-grid.has-pinned .video-wrapper.thumb .avatar-large { width: 32px; height: 32px; font-size: 14px; }
@media (max-width: 800px) {
  .video-grid.has-pinned .video-wrapper.thumb { width: 100px; height: 70px; bottom: 8px; right: 8px; }
}
.video-wrapper .pin-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  transition: 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
}
.video-wrapper .pin-btn:hover { opacity: 1; color: var(--accent); background: var(--accent-dim); }
.video-wrapper.pinned .pin-btn { opacity: 1; color: var(--accent); }
.video-wrapper .label-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

/* ===== CAMERA ROTATE ===== */
.camera-rotate-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  transition: 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}
.camera-rotate-btn:hover { color: var(--accent); background: var(--accent-dim); }
@media (min-width: 801px) { .camera-rotate-btn { display: none; } }

/* ===== POLL SYSTEM ===== */
.poll-panel { display: flex; flex-direction: column; gap: 12px; flex: 1; min-height: 0; }
.poll-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.poll-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 14px;
  animation: fadeIn 0.3s ease;
}
.poll-card .poll-q { font-weight: 600; font-size: 14px; margin-bottom: 8px; }
.poll-card .poll-creator { font-size: 11px; color: var(--text-muted); margin-bottom: 10px; }
.poll-card .poll-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  margin-bottom: 4px;
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: 0.2s;
  position: relative;
  overflow: hidden;
}
.poll-card .poll-option:hover { border-color: var(--accent-dim); background: var(--accent-dim); }
.poll-card .poll-option.voted { border-color: var(--accent); background: rgba(0,224,186,0.08); }
.poll-card .poll-option .opt-bar {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent));
  opacity: 0.25;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 8px;
  z-index: 0;
}
.poll-card .poll-option .opt-text { position: relative; z-index: 1; font-size: 13px; flex: 1; }
.poll-card .poll-option .opt-pct { position: relative; z-index: 1; font-size: 12px; color: var(--text-muted); font-weight: 600; white-space: nowrap; }
.poll-card .poll-option .opt-check { position: relative; z-index: 1; color: var(--accent); font-size: 14px; }
.poll-card .poll-status { font-size: 11px; color: var(--text-muted); margin-top: 6px; display: flex; justify-content: space-between; }
.poll-card.closed { opacity: 0.6; }
.poll-card.closed .poll-option { cursor: default; }
.poll-card.closed .poll-option:hover { border-color: var(--border-color); background: transparent; }

.poll-create-form {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.poll-create-form input, .poll-create-form textarea {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  width: 100%;
}
.poll-create-form input:focus, .poll-create-form textarea:focus { border-color: var(--accent); }
.poll-create-form .poll-opt-row { display: flex; gap: 6px; align-items: center; }
.poll-create-form .poll-opt-row input { flex: 1; }
.poll-create-form .poll-opt-row .remove-opt {
  background: transparent; border: none; color: var(--danger); cursor: pointer; font-size: 16px; padding: 4px; border-radius: 4px;
}
.poll-create-form .poll-opt-row .remove-opt:hover { background: var(--danger-dim); }
.poll-create-form .add-opt-btn {
  background: transparent; border: 1px dashed var(--border-color); color: var(--text-muted); cursor: pointer; padding: 6px; border-radius: 6px; font-size: 12px; transition: 0.2s;
}
.poll-create-form .add-opt-btn:hover { border-color: var(--accent-dim); color: var(--accent); }
.poll-create-form .create-poll-btn {
  background: var(--accent); color: #fff; border: none; padding: 8px; border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: 500; transition: 0.2s;
}
.poll-create-form .create-poll-btn:hover { background: var(--accent-hover); }
.poll-create-form .create-poll-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.poll-empty { text-align: center; color: var(--text-muted); padding: 20px; font-size: 13px; }
.poll-empty i { font-size: 32px; opacity: 0.3; margin-bottom: 8px; display: block; }

/* ===== THEME SELECTOR ===== */
.theme-overlay-content {
  max-width: 700px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 24px;
}
.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
  margin-top: 16px;
}
.theme-preset {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  border-radius: 10px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg-surface);
}
.theme-preset:hover { border-color: var(--accent-dim); transform: translateY(-2px); }
.theme-preset.active { border-color: var(--accent); }
.theme-preset .swatch-row {
  display: flex;
  gap: 3px;
  align-items: center;
}
.theme-preset .swatch {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
}
.theme-preset .swatch-bg {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
}
.theme-preset .theme-name {
  font-size: 10px;
  color: var(--text-secondary);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.theme-custom-section {
  margin-top: 16px;
  padding: 16px;
  background: var(--bg-surface);
  border-radius: 10px;
  border: 1px solid var(--border-color);
}
.theme-custom-section h3 { font-size: 14px; margin-bottom: 12px; }
.theme-custom-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.theme-custom-row label { font-size: 12px; color: var(--text-secondary); min-width: 70px; }
.theme-custom-row input[type="color"] {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  background: none;
  padding: 0;
}
.theme-custom-row input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
.theme-custom-row input[type="color"]::-webkit-color-swatch { border: 1px solid var(--border-color); border-radius: 4px; }
.theme-custom-row select {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-primary);
  padding: 6px 8px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
}
.theme-search { width: 100%; padding: 10px 14px; border-radius: 8px; background: var(--bg-input); border: 1px solid var(--border-color); color: var(--text-primary); font-size: 13px; margin-bottom: 8px; }
.theme-search:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.theme-type-filter {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.theme-type-filter button {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 11px;
  cursor: pointer;
  transition: 0.2s;
}
.theme-type-filter button:hover { border-color: var(--accent-dim); color: var(--text-primary); }
.theme-type-filter button.active { background: var(--accent-dim); color: var(--accent); border-color: var(--accent-dim); }

/* ===== SETTINGS PANEL ===== */
.settings-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 92%;
  max-width: 680px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: boardSlideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow);
}
.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}
.settings-header h2 { font-size: 18px; font-weight: 600; }
.settings-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-primary);
  flex-shrink: 0;
  padding: 0 12px;
}
.settings-tabs button {
  flex: 1;
  background: transparent;
  border: none;
  padding: 10px 0;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border-bottom: 2px solid transparent;
  font-family: inherit;
}
.settings-tabs button i { margin-right: 4px; }
.settings-tabs button.active { color: var(--text-primary); border-bottom-color: var(--accent); }
.settings-tabs button:hover { color: var(--text-secondary); background: var(--bg-surface); }
.settings-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  min-height: 200px;
}
.settings-tab-panel { display: none; animation: fadeIn 0.2s ease; }
.settings-tab-panel.active { display: block; }
.settings-section {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}
.settings-section:last-child { border-bottom: none; margin-bottom: 0; }
.settings-section h3 { font-size: 14px; font-weight: 600; margin-bottom: 10px; color: var(--text-primary); }
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  gap: 12px;
}
@media (max-width: 800px) {
  .settings-panel { width: 100%; max-width: 100%; height: 100%; max-height: 100%; border-radius: 0; }
  .settings-body { padding: 12px 16px; }
  .settings-header { padding: 12px 16px 10px; }
}

/* ===== THEME TOGGLE (day/night switch) ===== */
.theme-switch {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.theme-input { position:absolute; opacity:0; width:0; height:0; }
.theme-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 52px;
  height: 26px;
  border-radius: 13px;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  cursor: pointer;
  position: relative;
  transition: background 0.5s ease;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.3);
  padding: 0 6px;
  overflow: hidden;
}
.theme-label .icon-sun,
.theme-label .icon-moon {
  font-size: 11px;
  position: relative;
  z-index: 2;
  transition: all 0.4s ease;
}
.theme-label .icon-sun { color: #f5d76e; opacity: 0; transform: scale(0.3) rotate(-90deg); }
.theme-label .icon-moon { color: #a29bfe; opacity: 1; transform: scale(1) rotate(0deg); }
.theme-input:checked + .theme-label { background: linear-gradient(135deg, #f5af19 0%, #f12711 100%); }
.theme-input:checked + .theme-label .icon-sun { opacity: 1; transform: scale(1) rotate(0deg); }
.theme-input:checked + .theme-label .icon-moon { opacity: 0; transform: scale(0.3) rotate(90deg); }
.theme-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55);
  z-index: 3;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}
.theme-input:checked + .theme-label .theme-thumb { transform: translateX(26px); }
.theme-stars { position:absolute; inset:0; pointer-events:none; z-index:1; }
.theme-stars span {
  position:absolute;
  width:3px; height:3px;
  border-radius:50%;
  background:#fff;
  transition:all 0.4s;
}
.theme-stars span:nth-child(1) { top:20%; left:20%; opacity:1; }
.theme-stars span:nth-child(2) { top:30%; left:55%; opacity:0.7; width:2px; height:2px; }
.theme-stars span:nth-child(3) { top:60%; left:40%; opacity:0.5; width:2px; height:2px; }
.theme-input:checked + .theme-label .theme-stars span { opacity:0 !important; transform:scale(0); }
.theme-clouds { position:absolute; inset:0; pointer-events:none; z-index:1; }
.theme-clouds span {
  position:absolute;
  background:rgba(255,255,255,0.3);
  border-radius:10px;
  transition:all 0.4s;
  opacity:0;
}
.theme-clouds span:nth-child(1) { width:12px; height:4px; top:35%; left:18%; }
.theme-clouds span:nth-child(2) { width:8px; height:3px; top:50%; left:50%; }
.theme-input:checked + .theme-label .theme-clouds span { opacity:1; }

/* ===== LIGHT THEME ===== */
[data-theme="light"] {
  --bg-primary: #f8f4f8;
  color-scheme: light;
  --bg-secondary: #ffffff;
  --bg-surface: #f0ecf0;
  --bg-input: #f4f0f4;
  --text-primary: #1a0a1a;
  --text-secondary: #6a5a6a;
  --text-muted: rgba(106, 90, 106, 0.5);
  --accent: #00897b;
  --accent-hover: #009688;
  --accent-dim: rgba(0, 137, 123, 0.12);
  --accent-cyan: #00897b;
  --accent-cyan-dim: rgba(0, 137, 123, 0.12);
  --accent-indigo: #7b1fa2;
  --danger: #c62828;
  --danger-dim: rgba(198, 40, 40, 0.10);
  --success: #00897b;
  --success-dim: rgba(0, 137, 123, 0.12);
  --warning: #f9a825;
  --warning-dim: rgba(249, 168, 37, 0.12);
  --border-color: rgba(26, 10, 26, 0.08);
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
  background: var(--bg-primary);
}
[data-theme="light"] .landing-card,
[data-theme="light"] .overlay-card,
[data-theme="light"] .board-container { backdrop-filter: none; }
[data-theme="light"] .btn-primary { color: #fff; }
[data-theme="light"] .header-center .conn-quality { color: var(--success); }
[data-theme="light"] .chat-message .sender { color: var(--accent); }
[data-theme="light"] .video-wrapper .video-label { background: rgba(255,255,255,0.85); border-color: var(--border-color); color: var(--text-primary); }

/* ===== EMOJI REACTIONS ===== */
.emoji-reaction {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  font-size: 36px;
  animation: emojiFloat 2s ease-out forwards;
}
@keyframes emojiFloat {
  0% { opacity: 1; transform: translateY(0) scale(0.5) rotate(0deg); }
  20% { opacity: 1; transform: translateY(-40px) scale(1.2) rotate(10deg); }
  60% { opacity: 0.7; transform: translateY(-120px) scale(1) rotate(-5deg); }
  100% { opacity: 0; transform: translateY(-200px) scale(0.8) rotate(10deg); }
}
.reactions-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 0 4px;
}
.reactions-bar .reaction-btn {
  background: transparent;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  transition: all 0.2s;
  line-height: 1;
}
.reactions-bar .reaction-btn:hover {
  background: var(--bg-surface);
  transform: scale(1.2);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== EMOJI PICKER ===== */
.emoji-picker {
  position: absolute;
  bottom: 100%;
  left: 0;
  margin-bottom: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  box-shadow: var(--shadow);
  z-index: 100;
  animation: fadeIn 0.15s ease;
}
.emoji-picker button {
  background: transparent;
  border: none;
  font-size: 22px;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: 0.15s;
  line-height: 1;
}
.emoji-picker button:hover { background: var(--bg-surface); transform: scale(1.15); }

/* ===== DYNAMIC VIDEO WRAPPER ===== */
@keyframes wrapperGlow {
  0%, 100% { box-shadow: 0 0 4px rgba(0, 224, 186, 0.05); }
  50% { box-shadow: 0 0 12px rgba(0, 224, 186, 0.1); }
}
.video-wrapper {
  animation: wrapperGlow 3s ease-in-out infinite;
}
.video-wrapper.speaking {
  animation: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim), 0 0 25px rgba(0, 224, 186, 0.2);
  transition: box-shadow 0.15s ease;
}
[data-theme="light"] .video-wrapper.speaking {
  box-shadow: 0 0 0 2px var(--accent-dim), 0 0 20px rgba(0, 137, 123, 0.15);
}
.video-wrapper .avatar-large {
  animation: avatarPulse 4s ease-in-out infinite;
}
@keyframes avatarPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 224, 186, 0.1); }
  50% { box-shadow: 0 0 0 8px rgba(0, 224, 186, 0); }
}
.video-wrapper.join-anim {
  animation: joinPop 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}
@keyframes joinPop {
  0% { opacity: 0; transform: scale(0.8); }
  60% { transform: scale(1.03); }
  100% { opacity: 1; transform: scale(1); }
}
.video-wrapper .video-placeholder .avatar-large i {
  font-size: 22px;
  opacity: 0.6;
}
.video-wrapper .video-label .reaction-badge {
  font-size: 14px;
  animation: reactionPop 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}
@keyframes reactionPop {
  0% { transform: scale(0); }
  60% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* ===== CHAT ENHANCEMENTS ===== */
.chat-message .time { font-size: 10px; color: var(--text-muted); margin-left: 6px; }
.chat-message .msg-text { word-break: break-word; }
.chat-message .msg-emoji { font-size: 24px; display: block; text-align: center; padding: 4px 0; }
.chat-input-row { position: relative; }
.chat-input-row .emoji-trigger {
  position: absolute;
  right: 52px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent !important;
  border: none !important;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px !important;
  transition: 0.2s;
  z-index: 2;
  width: auto !important;
  height: auto !important;
}
.chat-input-row .emoji-trigger:hover { color: var(--accent) !important; background: transparent !important; }

/* ===== YOUTUBE EMBEDS ===== */
.yt-embed { margin: 6px 0; }
.yt-embed iframe { width: 100%; aspect-ratio: 16/9; border-radius: 8px; max-width: 400px; }
.yt-embed a { display: block; font-size: 11px; margin-top: 2px; color: var(--text-muted); }

/* ===== CAPTIONS BAR ===== */
.captions-bar {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(8px);
  color: #fff;
  padding: 8px 20px;
  border-radius: 12px;
  font-size: 15px;
  max-width: 80%;
  text-align: center;
  border: 1px solid rgba(255,255,255,0.1);
  pointer-events: none;
  transition: opacity 0.3s;
}
.captions-bar.hidden { opacity: 0; pointer-events: none; }

/* ===== VAD INDICATOR ===== */
.vad-indicator {
  position: fixed;
  bottom: 80px;
  right: 16px;
  z-index: 500;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  border: 2px solid var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 14px;
  transition: all 0.3s;
}
.vad-indicator.speaking { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 12px rgba(0,224,186,0.3); }

/* ===== STATS OVERLAY ===== */
.stats-overlay {
  position: fixed;
  top: 60px;
  right: 12px;
  z-index: 500;
  background: rgba(8,0,14,0.92);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px;
  min-width: 220px;
  font-size: 12px;
  animation: fadeIn 0.2s ease;
}
.stats-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--accent);
  font-size: 13px;
}
.stats-body { display: flex; flex-direction: column; gap: 4px; }
.stat-row { display: flex; justify-content: space-between; color: var(--text-secondary); padding: 2px 0; }
.stat-row span:last-child { font-family: 'JetBrains Mono', monospace; color: var(--text-primary); }
.stat-total { border-top: 1px solid var(--border-color); padding-top: 4px; margin-top: 4px; }

/* ===== TRANSFER CONTAINER ===== */
.transfer-container {
  position: fixed;
  bottom: 80px;
  left: 12px;
  z-index: 500;
  background: rgba(8,0,14,0.92);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 8px;
  min-width: 200px;
  max-width: 300px;
  font-size: 12px;
  animation: fadeIn 0.2s ease;
}
.transfer-header { font-weight: 600; color: var(--accent); font-size: 12px; margin-bottom: 6px; }
.transfer-list { display: flex; flex-direction: column; gap: 4px; }
.transfer-item { display: flex; align-items: center; gap: 6px; padding: 4px 6px; background: var(--bg-surface); border-radius: 6px; }
.transfer-info { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.transfer-name { font-weight: 500; }
.transfer-size { color: var(--text-muted); font-size: 10px; margin-left: 4px; }
.transfer-bar-wrap { width: 60px; height: 4px; background: var(--bg-primary); border-radius: 4px; overflow: hidden; flex-shrink: 0; }
.transfer-bar { height: 100%; background: var(--accent); border-radius: 4px; transition: width 0.3s; width: 0%; }
.transfer-pct { font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--text-muted); min-width: 28px; text-align: right; }

/* ===== LAYOUT MODES ===== */
.video-grid.layout-sidebar .video-wrapper:first-child { grid-column: 1; grid-row: 1 / span 2; }
.video-grid.layout-sidebar .video-wrapper { min-height: 100px; }
.video-grid.layout-spotlight .video-wrapper:first-child video { object-fit: contain; }
.video-grid.layout-spotlight .video-wrapper { max-height: 100%; }

/* ===== RAISE HAND TOAST ===== */
.toast-hand {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  background: var(--warning-dim);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,207,0,0.3);
  color: var(--warning);
  padding: 8px 20px;
  border-radius: 30px;
  font-size: 13px;
  font-weight: 500;
  animation: fadeIn 0.3s ease;
  pointer-events: none;
}

/* ===== BOARD TEXT/STICKY TOOLBAR BUTTONS ===== */
.board-tool[data-tool="text"] i,
.board-tool[data-tool="sticky"] i { font-size: 14px; }

/* ===== PARTICIPANT ACTIONS ===== */
.participant-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px; background: var(--bg-surface); border: 1px solid transparent; transition: 0.2s; }
.participant-item:hover { border-color: var(--border-color); }
.p-actions { display: flex; gap: 4px; flex-shrink: 0; }
.p-mute-btn { width: 24px; height: 24px; border-radius: 4px; border: none; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 11px; display: flex; align-items: center; justify-content: center; transition: 0.2s; }
.p-mute-btn:hover { background: var(--danger-dim); color: var(--danger); }

/* ===== TOAST CONTAINER ===== */
#toastContainer {
  position: fixed;
  top: 70px;
  right: 12px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}
#toastContainer .toast-item {
  pointer-events: auto;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: fadeIn 0.2s ease;
  backdrop-filter: blur(8px);
  max-width: 300px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
#toastContainer .toast-item.toast-success { border-color: var(--success-dim); }
#toastContainer .toast-item.toast-error { border-color: var(--danger-dim); color: var(--danger); }
#toastContainer .toast-item.toast-info { border-color: var(--accent-dim); }
#toastContainer .toast-item .toast-close {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  padding: 0 4px;
  line-height: 1;
}

/* ===== OVERLAY SCROLL ===== */
.overlay { overflow-y: auto; }

/* ===== RESPONSIVE: hide extra feature buttons on mobile ===== */
@media (max-width: 800px) {
  .controls-bar .secondary-row .ctrl-btn.icon-btn:not(#ctrlChat):not(#ctrlParticipants):not(#ctrlBoard) {
    display: none !important;
  }
  .controls-bar .secondary-row.open .ctrl-btn.icon-btn:not(#ctrlChat):not(#ctrlParticipants):not(#ctrlBoard) {
    display: flex !important;
  }
  .stats-overlay { right: 4px; top: 50px; min-width: 160px; font-size: 11px; }
  .transfer-container { left: 4px; bottom: 70px; min-width: 160px; }
  .captions-bar { bottom: 70px; font-size: 13px; max-width: 90%; }
  .vad-indicator { bottom: 70px; right: 8px; width: 28px; height: 28px; font-size: 12px; }
}

/* ===== FEATURES PAGE ===== */
.features-page {
  max-width: 960px;
  margin: 0 auto;
  padding: 40px 20px;
}
.features-page h1 { font-size: 32px; margin-bottom: 8px; }
.features-page .subtitle { color: var(--text-secondary); font-size: 16px; margin-bottom: 40px; }
.features-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.feature-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 24px;
  transition: border-color 0.3s, transform 0.2s;
}
.feature-card:hover { border-color: var(--accent-dim); transform: translateY(-2px); }
.feature-card .fc-icon { font-size: 28px; margin-bottom: 12px; color: var(--accent); }
.feature-card h3 { font-size: 16px; margin-bottom: 6px; }
.feature-card p { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.feature-card .fc-badge {
  display: inline-block;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--accent-dim);
  color: var(--accent);
  margin-top: 8px;
}
.feature-card .fc-badge.new { background: var(--warning-dim); color: var(--warning); }
