/* ── watching-together.valorcore.top ── */
* { box-sizing: border-box; }

:root {
  --bg-main: #090a0f;
  --bg-card: #12141d;
  --bg-elevated: #1a1d2b;
  --border-color: #262a3d;
  --text-main: #f1f3f9;
  --text-muted: #8b92a5;
  --accent-gray: #94a3b8;
  --accent-white: #ffffff;
  --sync-ok: #10b981;
  --sync-bad: #ef4444;
  --btn-bg: #1e2235;
  --btn-hover: #2a2f47;
  --primary-bg: #e2e8f0;
  --primary-text: #0f172a;
}

body {
  margin: 0;
  background: var(--bg-main);
  color: var(--text-main);
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  user-select: text;
}

/* Selection rules: allow text selection in chat/content, disable on controls */
.btn, .primary, .control, .tabBtn, .select-styled, header,
.box-header, .playlist-header, .controls, .sync, .badge {
  user-select: none;
}

.brand-prefix { color: var(--accent-gray); font-weight: 500; }
.brand-domain { color: var(--accent-white); font-weight: 700; }

/* ── Header ── */
.top {
  height: 60px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 14px;
}
.brand { font-size: 18px; letter-spacing: -0.3px; }
.spacer { flex: 1; }

.badge, .sync {
  border: 1px solid var(--border-color);
  background: var(--bg-elevated);
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 500;
}
.sync { color: var(--sync-ok); border-color: rgba(16,185,129,0.3); }
.sync.bad { color: var(--sync-bad); border-color: rgba(239,68,68,0.3); }

.btn, .primary, .control {
  border: 1px solid var(--border-color);
  background: var(--btn-bg);
  color: var(--text-main);
  border-radius: 8px;
  padding: 7px 13px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover, .control:hover { background: var(--btn-hover); border-color: #3b4260; }
.primary { background: var(--primary-bg); color: var(--primary-text); border-color: #fff; font-weight: 600; }
.primary:hover { background: #fff; }
.hidden { display: none !important; }

/* ── Main ── */
main { max-width: 1600px; margin: 0 auto; padding: 20px 24px; }

.home { min-height: 75vh; display: flex; align-items: center; justify-content: center; }
.home-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 36px;
  max-width: 520px;
  width: 100%;
  text-align: center;
  box-shadow: 0 16px 40px rgba(0,0,0,0.4);
}
.home-card h1 { font-size: 30px; margin: 0 0 10px; }
.home-card p { color: var(--text-muted); font-size: 14px; line-height: 1.5; margin: 0 0 20px; }

.name-prompt { text-align: left; margin-bottom: 20px; }
.name-prompt label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 5px; font-weight: 500; }
.name-prompt input {
  width: 100%; background: var(--bg-main); border: 1px solid var(--border-color);
  border-radius: 8px; padding: 9px 12px; color: var(--text-main); font-size: 14px; outline: none;
}
.name-prompt input:focus { border-color: #6366f1; }
.large-btn { width: 100%; padding: 11px; font-size: 15px; }

/* ── Room Grid ── */
.room {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 20px;
  align-items: start;
}
.main-column { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

/* Room header */
.room-header-bar {
  background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 10px;
  padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.room-title { display: flex; align-items: center; gap: 8px; overflow: hidden; }
.video-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.provider-badge { background: #312e81; color: #c7d2fe; font-size: 10px; padding: 2px 7px; border-radius: 5px; font-weight: 600; text-transform: uppercase; }
.room-settings { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.settings-label { font-size: 12px; color: var(--text-muted); }
.select-styled { background: var(--bg-elevated); border: 1px solid var(--border-color); color: var(--text-main); border-radius: 6px; padding: 5px 8px; font-size: 12px; outline: none; }

/* Video input bar */
.video-input-bar { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 10px; padding: 10px 16px; }
.input-tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.tabBtn { background: var(--bg-elevated); border: 1px solid var(--border-color); color: var(--text-muted); border-radius: 6px; padding: 5px 10px; font-size: 12px; cursor: pointer; }
.tabBtn.active { background: var(--btn-bg); border-color: #6366f1; color: var(--text-main); font-weight: 500; }
.inputbar { display: flex; gap: 8px; align-items: center; }
.inputbar input[type=text], .inputbar input[type=file] {
  flex: 1; background: var(--bg-main); border: 1px solid var(--border-color);
  border-radius: 8px; padding: 8px 12px; color: var(--text-main); font-size: 13px; outline: none; min-width: 0;
}
.inputbar input:focus { border-color: #6366f1; }
.muted { color: var(--text-muted); font-size: 11px; }

/* ═══════════════════════════════════════════════════════════════════
 * PLAYER CONTAINER — holds REAL players (Video.js, YouTube iframe, etc)
 * ═══════════════════════════════════════════════════════════════════ */
.player-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
}

/* Mount points for real players — fill the container */
.player-mount {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100%;
  height: 100%;
}

/* Video.js overrides — make it fill the container */
.player-mount .video-js {
  width: 100% !important;
  height: 100% !important;
  background: #000;
}
.player-mount .video-js .vjs-tech {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
}
/* Hide Video.js default controls — we use our own that call real VJS API */
.player-mount .video-js .vjs-control-bar { display: none !important; }
.player-mount .video-js .vjs-big-play-button { display: none !important; }
.player-mount .video-js .vjs-loading-spinner { z-index: 5; }

/* YouTube / Twitch / Vimeo / DM iframes fill the container */
.player-mount iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* Empty state */
.player-empty-state {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  z-index: 2;
}
.empty-content { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--text-muted); text-align: center; padding: 20px; }
.emptyIcon { width: 48px; height: 48px; border: 2px solid var(--border-color); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 18px; color: var(--accent-gray); }

/* Notice overlay */
.player-notice {
  position: absolute;
  bottom: 10px; left: 10px; right: 10px;
  background: rgba(15,23,42,0.92);
  backdrop-filter: blur(6px);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 12px;
  color: var(--text-main);
  z-index: 10;
}

/* ── Controls ── */
.controls {
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: 10px; padding: 8px 14px;
  display: flex; align-items: center; gap: 10px;
}
.time-display { font-size: 12px; font-family: 'Inter', monospace; color: var(--text-muted); flex-shrink: 0; }
.seek-slider { flex: 1; accent-color: #6366f1; cursor: pointer; }
.volume-slider { width: 70px; accent-color: #6366f1; cursor: pointer; }

/* ── Playlist ── */
.playlist-section { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 10px; padding: 12px 16px; }
.playlist-header { display: flex; justify-content: space-between; align-items: center; font-weight: 600; font-size: 13px; margin-bottom: 10px; }
.playlist-items { display: flex; flex-direction: column; gap: 6px; max-height: 200px; overflow-y: auto; }
.playlist-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--bg-elevated); border: 1px solid var(--border-color); border-radius: 7px; padding: 7px 10px; font-size: 12px;
}
.playlist-item.active { border-color: #6366f1; background: #1e1b4b; }
.playlist-item-info { display: flex; align-items: center; gap: 8px; overflow: hidden; }
.playlist-item-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.playlist-item-actions { display: flex; gap: 3px; flex-shrink: 0; }
.btn-icon { background: transparent; border: none; color: var(--text-muted); cursor: pointer; padding: 3px 5px; border-radius: 4px; font-size: 12px; }
.btn-icon:hover { color: var(--text-main); background: rgba(255,255,255,0.1); }
.playlist-empty { color: var(--text-muted); font-size: 12px; text-align: center; padding: 14px; }

/* ── Side Column ── */
.side-column {
  display: flex; flex-direction: column; gap: 14px;
  height: calc(100vh - 100px); position: sticky; top: 72px;
}
.box-header {
  background: var(--bg-elevated); border-bottom: 1px solid var(--border-color);
  padding: 9px 12px; font-weight: 600; font-size: 12px; color: var(--text-main);
  display: flex; align-items: center; justify-content: space-between;
}

/* Participants */
.participants-box {
  background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 10px;
  overflow: hidden; max-height: 200px; display: flex; flex-direction: column;
}
.participant-list { padding: 6px 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.participant-item { display: flex; align-items: center; justify-content: space-between; font-size: 12px; padding: 3px 5px; border-radius: 5px; }
.participant-info { display: flex; align-items: center; gap: 7px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--sync-ok); flex-shrink: 0; }
.role-badge { font-size: 10px; background: #312e81; color: #c7d2fe; padding: 2px 5px; border-radius: 3px; font-weight: 600; }

/* Chat */
.chat-box {
  background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 10px;
  overflow: hidden; flex: 1; display: flex; flex-direction: column; min-height: 0;
}
.messages { flex: 1; padding: 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; user-select: text; }
.msg { background: var(--bg-elevated); border: 1px solid rgba(255,255,255,0.04); border-radius: 7px; padding: 7px 9px; font-size: 12px; word-break: break-word; }
.msg-header { display: flex; justify-content: space-between; margin-bottom: 3px; font-size: 10px; }
.msg-author { font-weight: 600; color: #818cf8; }
.msg-time { color: var(--text-muted); }
.msg-body { line-height: 1.4; }

.chat-form {
  display: flex; gap: 6px; padding: 8px;
  border-top: 1px solid var(--border-color); background: var(--bg-card);
}
.chat-form input {
  flex: 1; background: var(--bg-main); border: 1px solid var(--border-color);
  border-radius: 7px; padding: 7px 10px; color: var(--text-main); font-size: 12px; outline: none; user-select: text;
}
.chat-form input:focus { border-color: #6366f1; }
.chat-form button { background: #4f46e5; color: white; border: none; border-radius: 7px; padding: 7px 12px; font-weight: 500; cursor: pointer; font-size: 12px; }
.chat-form button:hover { background: #4338ca; }

/* ── Responsive ── */
@media (max-width: 1024px) {
  .room { grid-template-columns: 1fr; }
  .side-column { height: 420px; position: static; }
}
@media (max-width: 640px) {
  main { padding: 10px; }
  .top { padding: 0 10px; }
  .room-header-bar { flex-direction: column; align-items: flex-start; }
  .inputbar { flex-wrap: wrap; }
  .controls { flex-wrap: wrap; }
}