* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #111318;
  color: #e8eaed;
  height: 100vh;
}
.hidden { display: none !important; }

#join-screen {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.join-box {
  background: #1b1e26;
  padding: 2.5rem;
  border-radius: 12px;
  width: 320px;
  text-align: center;
}
.join-box h1 { margin: 0 0 0.25rem; }
.subtitle { color: #9aa0a6; margin-top: 0; margin-bottom: 1.5rem; font-size: 0.9rem; }
.hint { color: #9aa0a6; font-size: 0.75rem; text-align: left; margin: -0.5rem 0 0.75rem; }
.join-box input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.75rem;
  border-radius: 6px;
  border: 1px solid #3c4043;
  background: #111318;
  color: #e8eaed;
}
.join-box button, .room-header button, .player-controls button {
  cursor: pointer;
  border: none;
  border-radius: 6px;
  padding: 0.6rem 1rem;
  background: #4c8bf5;
  color: white;
  font-weight: 600;
}
.join-box button { width: 100%; }
.error { color: #f28b82; min-height: 1.2em; font-size: 0.85rem; }

.room-header {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  background: #1b1e26;
  border-bottom: 1px solid #2a2d34;
}
.header-controls { display: flex; gap: 0.5rem; }
.header-controls button { background: #2a2d34; }
#leave-btn { background: #c5372f !important; }

.room-main {
  display: flex;
  height: calc(100vh - 56px);
}
.video-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1rem;
}
.player-controls {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.player-controls input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  border: 1px solid #3c4043;
  background: #111318;
  color: #e8eaed;
}
.video-volume {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: 0 0 auto;
  padding: 0 0.5rem;
}
.video-volume input[type="range"] {
  width: 90px;
}
.player-area {
  position: relative;
  flex: 1;
  min-height: 0;
}
.player-area > * {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
#shared-video {
  background: black;
  border-radius: 8px;
}
#youtube-player-wrapper {
  border-radius: 8px;
  overflow: hidden;
}
.screen-share-overlay {
  z-index: 5;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.screen-share-overlay video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
.screen-share-label {
  position: absolute;
  bottom: 8px;
  left: 8px;
  font-size: 0.8rem;
  background: rgba(0,0,0,0.6);
  padding: 4px 8px;
  border-radius: 4px;
}
#youtube-player, #youtube-player iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.side-pane {
  width: 280px;
  border-left: 1px solid #2a2d34;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow-y: auto;
}
.participants {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.tile {
  background: #1b1e26;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  border: 2px solid transparent;
  transition: border-color 0.15s ease;
}
.tile.speaking {
  border-color: #34a853;
}
.tile .video-container {
  aspect-ratio: 16/9;
  background: #26292f;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tile video {
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
  object-fit: cover;
}
.tile .avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #3c4043;
  color: #c9cdd3;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 700;
}
.tile .label {
  position: absolute;
  bottom: 4px;
  left: 6px;
  font-size: 0.75rem;
  background: rgba(0,0,0,0.55);
  padding: 2px 6px;
  border-radius: 4px;
}
.tile .volume-control {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.5rem;
  font-size: 0.8rem;
}
.tile .volume-control input[type="range"] {
  flex: 1;
}

.chat-panel {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  border-top: 1px solid #2a2d34;
  padding-top: 0.75rem;
}
.chat-messages {
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.chat-message {
  font-size: 0.8rem;
  background: #1b1e26;
  border-radius: 6px;
  padding: 0.4rem 0.55rem;
  word-break: break-word;
}
.chat-message .chat-author {
  font-weight: 600;
  color: #8ab4f8;
  margin-right: 0.3rem;
}
.chat-message.own .chat-author {
  color: #81c995;
}
.chat-form {
  display: flex;
  gap: 0.4rem;
}
.chat-form input {
  flex: 1;
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  border: 1px solid #3c4043;
  background: #111318;
  color: #e8eaed;
  font-size: 0.85rem;
}
.chat-form button {
  cursor: pointer;
  border: none;
  border-radius: 6px;
  padding: 0.45rem 0.7rem;
  background: #4c8bf5;
  color: white;
  font-weight: 600;
}

.toasts {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.toast {
  background: #2a2d34;
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  font-size: 0.8rem;
  color: #c9cdd3;
  animation: fade 4s ease forwards;
}
@keyframes fade {
  0% { opacity: 1; }
  80% { opacity: 1; }
  100% { opacity: 0; }
}
