/* === 暖色暗色主题 — 情侣观影 === */

:root {
  --bg-deep: #0d0d0d;
  --bg-surface: #181614;
  --bg-raised: #221f1c;
  --bg-card: #2a2622;
  --border: #3a3430;
  --text-primary: #f0e8e0;
  --text-secondary: #a69c94;
  --text-muted: #736b64;
  --accent: #d4a373;
  --accent-light: #e8c4a0;
  --accent-dim: #b8895e;
  --coral: #e07a5f;
  --coral-light: #f09880;
  --green: #81b29a;
  --glow: rgba(212, 163, 115, 0.15);
  --shadow-card: 0 4px 24px rgba(0,0,0,0.4);
  --radius: 14px;
  --radius-sm: 8px;
  --radius-full: 9999px;
  --transition: 0.25s cubic-bezier(0.4,0,0.2,1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* === Layout === */

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* === Brand === */

.brand {
  text-align: center;
  padding: 40px 0 20px;
}

.brand-icon {
  font-size: 40px;
  display: block;
  margin-bottom: 8px;
}

.brand h1 {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 2px;
  background: linear-gradient(135deg, var(--accent-light), var(--coral-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 4px;
  letter-spacing: 1px;
}

/* === Cards === */

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 28px;
  box-shadow: var(--shadow-card);
  transition: border-color var(--transition);
}

.card:hover {
  border-color: rgba(212, 163, 115, 0.2);
}

/* === Buttons === */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: var(--radius-full);
  border: none;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  user-select: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  color: #0d0d0d;
  box-shadow: 0 4px 16px var(--glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(212, 163, 115, 0.25);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--bg-raised);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

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

.btn-coral {
  background: linear-gradient(135deg, var(--coral), #c96a50);
  color: #0d0d0d;
}

.btn-coral:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(224, 122, 95, 0.25);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 16px;
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.05);
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  font-size: 18px;
  flex-shrink: 0;
  aspect-ratio: 1;
}

/* === Inputs === */

.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-group label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.input {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: var(--text-primary);
  font-size: 15px;
  transition: border-color var(--transition);
  outline: none;
}

.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--glow);
}

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

/* === Player Area === */

.player-area {
  position: relative;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
}

.player-area video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* 隐藏 Android 原生播放图标覆盖层 */
.player-area video::-webkit-media-controls { display: none !important; }
.player-area video::-webkit-media-controls-start-playback-button { display: none !important; }

.player-placeholder {
  text-align: center;
  color: var(--text-muted);
}

.player-placeholder .icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.player-placeholder p {
  font-size: 14px;
}

.player-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 60px 16px 12px;
  background: linear-gradient(transparent, rgba(0,0,0,0.88));
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.player-overlay .controls {
  pointer-events: auto;
}

.player-overlay .btn-secondary {
  background: rgba(34, 31, 28, 0.85);
  border-color: rgba(58, 52, 48, 0.6);
  backdrop-filter: blur(4px);
}

.player-overlay .btn-secondary:hover {
  background: rgba(42, 38, 34, 0.9);
  border-color: var(--accent-dim);
}

.player-overlay .time-display {
  color: rgba(240, 232, 224, 0.8);
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

.player-overlay .seek-bar {
  background: rgba(58, 52, 48, 0.6);
}

.player-area:hover .player-overlay,
.player-area.fullscreen .player-overlay {
  opacity: 1;
}

/* === Controls Bar === */

.controls {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
}

.controls-center {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
}

.seek-bar {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.seek-bar::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 8px var(--glow);
}

.seek-bar::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
}

.time-display {
  font-size: 12px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  min-width: 80px;
  text-align: center;
}

/* === Volume Slider === */

.volume-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.volume-slider {
  width: 80px;
  height: 3px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

.volume-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
}

/* === Room Info === */

.room-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.room-code {
  display: flex;
  align-items: center;
  gap: 8px;
}

.room-code .code {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--accent-light);
  font-variant-numeric: tabular-nums;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
}

.badge-active {
  background: rgba(129, 178, 154, 0.15);
  color: var(--green);
}

.badge-waiting {
  background: rgba(212, 163, 115, 0.15);
  color: var(--accent);
}

/* === Status Bar === */

.status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg-raised);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}

.status-dot.active {
  background: var(--green);
  box-shadow: 0 0 6px rgba(129, 178, 154, 0.5);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* === Mic Button === */

.mic-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.mic-btn.active {
  background: rgba(129, 178, 154, 0.15);
  border-color: var(--green);
  color: var(--green);
}

.mic-btn.muted {
  background: rgba(224, 122, 95, 0.15);
  border-color: var(--coral);
  color: var(--coral);
}

.mic-btn:hover {
  transform: scale(1.05);
}

/* === File Upload === */

.file-upload {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
}

.file-upload:hover {
  border-color: var(--accent-dim);
  background: rgba(212, 163, 115, 0.03);
}

.file-upload .icon {
  font-size: 36px;
  margin-bottom: 8px;
  opacity: 0.6;
}

.file-upload p {
  color: var(--text-secondary);
  font-size: 14px;
}

.file-upload .hint {
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 4px;
}

/* === Participant List === */

.participants {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.participant {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-raised);
  border-radius: var(--radius-sm);
}

.participant-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  position: relative;
}

.avatar-mic {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--bg-deep);
  border: 2px solid var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  color: var(--green);
  transition: all var(--transition);
}

.avatar-mic.muted {
  border-color: var(--coral);
  color: var(--coral);
}

.participant-avatar.host {
  background: rgba(212, 163, 115, 0.2);
  color: var(--accent);
}

.participant-avatar.guest {
  background: rgba(129, 178, 154, 0.15);
  color: var(--green);
}

.participant-info {
  flex: 1;
}

.participant-name {
  font-size: 14px;
  font-weight: 500;
}

.participant-role {
  font-size: 12px;
  color: var(--text-muted);
}

.participant-mic {
  font-size: 14px;
  color: var(--text-muted);
}

.participant-mic.speaking {
  color: var(--green);
}

/* === Landing Page Specific === */

.landing {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 32px;
  text-align: center;
}

.role-cards {
  display: flex;
  gap: 20px;
  width: 100%;
  max-width: 560px;
}

.role-card {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  color: inherit;
}

.role-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: 0 8px 32px rgba(212, 163, 115, 0.1);
}

.role-card .icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.role-card h2 {
  font-size: 18px;
  margin-bottom: 8px;
  font-weight: 600;
}

.role-card p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* === Viewer Controls Panel === */

.controls-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

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

.controls-row .label {
  font-size: 13px;
  color: var(--text-secondary);
  min-width: 70px;
}

/* === Join Room === */

.join-form {
  display: flex;
  gap: 12px;
  align-items: center;
}

.join-form .input {
  flex: 1;
  text-align: center;
  font-size: 18px;
  letter-spacing: 6px;
  font-weight: 600;
  text-transform: uppercase;
}

/* === Connecting / Waiting States === */

.waiting-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 60px 20px;
  text-align: center;
}

.waiting-state .spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.waiting-state h3 {
  font-size: 18px;
  color: var(--text-primary);
}

.waiting-state p {
  color: var(--text-secondary);
  font-size: 14px;
}

/* === Volume Group === */

.volume-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.volume-group .icon {
  font-size: 16px;
  color: var(--text-muted);
  min-width: 20px;
  text-align: center;
}

/* === Divider === */

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 8px 0;
}

/* === Compact Top Bar === */

.top-bar {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
}

.top-bar.visible {
  display: flex;
}

.top-bar .room-code .code {
  font-size: 16px;
  letter-spacing: 2px;
}

.top-bar .divider-vert {
  width: 1px;
  height: 24px;
  background: var(--border);
}

.top-bar .file-label {
  font-size: 13px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}

.top-bar .actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* === Watching Layout (two-column) === */

.watching-layout {
  display: none;
  gap: 16px;
  flex: 1;
}

.watching-layout.active {
  display: flex;
}

.player-column {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.player-column .player-area {
  flex: 1;
}

.sidebar {
  width: 290px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.sidebar-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 12px;
  letter-spacing: 1px;
}

.sidebar-participants {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-participant {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg-raised);
  border-radius: var(--radius-sm);
  cursor: default;
}

.sidebar-participant .avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  position: relative;
  flex-shrink: 0;
}

.sidebar-participant .avatar.host {
  background: rgba(212, 163, 115, 0.2);
}

.sidebar-participant .avatar.guest {
  background: rgba(129, 178, 154, 0.15);
}

.sidebar-participant .info {
  flex: 1;
  min-width: 0;
}

.sidebar-participant .name {
  font-size: 13px;
  font-weight: 500;
}

.sidebar-participant .role-label {
  font-size: 11px;
  color: var(--text-muted);
}

.sidebar-participant .mic-toggle {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}

.sidebar-participant .mic-toggle.active {
  background: rgba(129, 178, 154, 0.15);
  border-color: var(--green);
  color: var(--green);
}

.sidebar-participant .mic-toggle.muted {
  background: rgba(224, 122, 95, 0.15);
  border-color: var(--coral);
  color: var(--coral);
}

.sidebar-participant .mic-toggle:hover {
  transform: scale(1.05);
}

.sidebar-participant .mic-status {
  font-size: 13px;
  color: var(--text-muted);
}

/* Chat area in sidebar */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 120px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 4px;
}

.chat-messages:empty::after {
  content: '开始你们的对话吧 💕';
  display: block;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  padding: 24px 0;
}

.chat-msg {
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
  max-width: 90%;
  word-break: break-word;
}

.chat-msg.self {
  background: rgba(212, 163, 115, 0.15);
  color: var(--accent-light);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.chat-msg.other {
  background: var(--bg-raised);
  color: var(--text-primary);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.chat-msg .sender {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.chat-msg .time {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
  text-align: right;
}

.chat-input-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  padding-right: 12px;
}

.chat-input-row .input {
  flex: 1;
  padding: 8px 12px;
  font-size: 13px;
}

.chat-input-row .btn {
  padding: 8px 14px;
  font-size: 13px;
  flex-shrink: 0;
  margin-left: 5px;
}

.chat-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13px;
  padding: 20px 0;
}

/* Responsive: sidebar goes below on small screens */
@media (max-width: 768px) {
  .watching-layout.active {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
  }

  .controls-row {
    flex-wrap: wrap;
    gap: 8px;
  }

  .controls-row .label {
    min-width: auto;
    width: 100%;
  }
}

/* === Responsive === */

@media (max-width: 640px) {
  .container {
    padding: 16px 12px;
  }

  .role-cards {
    flex-direction: column;
  }

  .card {
    padding: 24px 16px;
  }

  .controls {
    flex-wrap: wrap;
  }

  .join-form {
    flex-direction: column;
  }

  .room-header {
    flex-direction: column;
    text-align: center;
  }
}

/* === Utility === */

.flex-1 { flex: 1; }
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.gap-12 { gap: 12px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
