:root {
  --bg: #0f1115;
  --card: #1a1d24;
  --accent: #5b8cff;
  --text: #e7e9ee;
  --muted: #8a90a0;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--accent); }
.wrap { max-width: 520px; margin: 6vh auto; padding: 0 16px; text-align: center; }
h1 { font-size: 2.4rem; margin-bottom: 4px; }
.tagline { color: var(--muted); margin-top: 0; }
.card { background: var(--card); border-radius: 14px; padding: 20px; margin-top: 20px; text-align: left; }
.hidden { display: none !important; }
.tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.tabs button { flex: 1; background: transparent; color: var(--muted); border: 1px solid #2a2e38; padding: 8px; border-radius: 8px; cursor: pointer; }
.tabs button.active { color: var(--text); border-color: var(--accent); }
.pane { display: none; flex-direction: column; gap: 10px; }
.pane.active { display: flex; }
input, button { font-size: 0.95rem; }
input { background: #11141a; border: 1px solid #2a2e38; color: var(--text); padding: 10px 12px; border-radius: 8px; width: 100%; }
form button[type=submit], #create-room button, #join-room button, #load-media {
  background: var(--accent); color: #fff; border: none; padding: 10px 14px; border-radius: 8px; cursor: pointer;
}
.muted { color: var(--muted); font-size: 0.85rem; }
.msg { color: var(--muted); font-size: 0.9rem; min-height: 1.2em; }
h3 { margin: 18px 0 8px; }
#create-room, #join-room { display: flex; flex-direction: column; gap: 8px; }

/* Room layout */
.room { height: 100vh; display: flex; flex-direction: column; }
.room-head { display: flex; align-items: center; gap: 16px; padding: 10px 16px; background: var(--card); flex-wrap: wrap; }
.room-head .room-id { color: var(--muted); font-size: 0.85rem; }
.room-head code { color: var(--text); }
#copy-id { background: transparent; border: 1px solid #2a2e38; color: var(--muted); border-radius: 6px; cursor: pointer; }
.room-main { flex: 1; display: flex; min-height: 0; }
.player-col { flex: 1; display: flex; flex-direction: column; padding: 16px; gap: 12px; min-width: 0; }
.player-wrap { position: relative; background: #000; border-radius: 12px; overflow: hidden; flex: 1; min-height: 0; }
video { width: 100%; height: 100%; display: block; background: #000; }
#reactions-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.owner-bar { display: flex; gap: 8px; }
.reactions { display: flex; gap: 8px; }
.reactions button { font-size: 1.6rem; background: var(--card); border: 1px solid #2a2e38; border-radius: 10px; padding: 6px 12px; cursor: pointer; }
.reactions button:hover { border-color: var(--accent); }

.side-col { width: 320px; border-left: 1px solid #2a2e38; display: flex; flex-direction: column; }
.members { padding: 12px 16px; border-bottom: 1px solid #2a2e38; }
.members h4 { margin: 0 0 8px; }
.members ul { margin: 0; padding-left: 18px; color: var(--muted); }
.chat { flex: 1; display: flex; flex-direction: column; min-height: 0; }
#messages { flex: 1; overflow-y: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 6px; }
.msg-line { font-size: 0.92rem; }
.msg-line.mine { color: #cfe0ff; }
.msg-sys { color: var(--muted); font-size: 0.8rem; font-style: italic; }
#chat-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid #2a2e38; }
#chat-form button { background: var(--accent); color: #fff; border: none; border-radius: 8px; padding: 0 16px; cursor: pointer; }

.react-fly {
  position: absolute; bottom: 10%; font-size: 2.4rem;
  animation: fly 2.4s ease-out forwards;
}
@keyframes fly {
  0% { transform: translateY(0) scale(0.6); opacity: 0; }
  15% { opacity: 1; transform: translateY(-20px) scale(1.1); }
  100% { transform: translateY(-260px) scale(1); opacity: 0; }
}

@media (max-width: 760px) {
  .room-main { flex-direction: column; }
  .side-col { width: 100%; border-left: none; border-top: 1px solid #2a2e38; height: 40vh; }
}
