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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0f0f0f;
  color: #fff;
  min-height: 100vh;
}

.screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hidden {
  display: none !important;
}

/* Join Screen */
.join-container {
  text-align: center;
  padding: 2rem;
}

.back-link {
  display: inline-block;
  color: #94a3b8;
  text-decoration: none;
  margin-bottom: 2rem;
  font-size: 0.9rem;
}

.back-link:hover {
  color: #fff;
}

.logo {
  font-size: 4rem;
  margin-bottom: 1rem;
}

h1 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.subtitle {
  color: #94a3b8;
  margin-bottom: 2rem;
}

.join-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 300px;
  margin: 0 auto;
}

input[type="text"],
input[type="url"] {
  padding: 1rem;
  font-size: 1.5rem;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.3em;
  border: 2px solid #333;
  border-radius: 12px;
  background: #1a1a1a;
  color: #fff;
  outline: none;
  transition: border-color 0.3s;
}

input[type="url"] {
  font-size: 1rem;
  text-transform: none;
  letter-spacing: normal;
  text-align: left;
}

input:focus {
  border-color: #3b82f6;
}

.btn {
  padding: 1rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s;
}

.btn.primary {
  background: #3b82f6;
  color: #fff;
}

.btn.primary:hover {
  background: #2563eb;
  transform: translateY(-2px);
}

.btn.primary:disabled {
  background: #334155;
  cursor: not-allowed;
  transform: none;
}

.error-message {
  color: #ef4444;
  padding: 1rem;
  background: rgba(239, 68, 68, 0.1);
  border-radius: 8px;
  margin-top: 1rem;
}

/* Setup Screen */
.setup-container {
  text-align: center;
  padding: 2rem;
  max-width: 600px;
}

.camera-preview {
  width: 100%;
  max-width: 480px;
  aspect-ratio: 4/3;
  background: #1a1a1a;
  border-radius: 16px;
  overflow: hidden;
  margin: 2rem auto;
  position: relative;
}

.camera-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #64748b;
}

.placeholder span {
  font-size: 3rem;
  margin-bottom: 1rem;
}

#start-section {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid #333;
}

.video-info {
  color: #94a3b8;
  margin-bottom: 1.5rem;
  font-size: 1.1rem;
}

.video-info span {
  color: #3b82f6;
  font-weight: 600;
}

.btn.large {
  padding: 1.25rem 3rem;
  font-size: 1.2rem;
}

/* Watch Screen */
.watch-layout {
  width: 100%;
  height: 100vh;
  position: relative;
  background: #000;
}

.video-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#youtube-player {
  width: 100%;
  height: 100%;
}

.webcam-preview {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 180px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  z-index: 100;
}

.webcam-preview video {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  transform: scaleX(-1);
}

.webcam-label {
  background: rgba(0, 0, 0, 0.7);
  color: #94a3b8;
  font-size: 0.7rem;
  padding: 0.5rem;
  text-align: center;
}

.session-info {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100;
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.video-progress {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.7);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.85rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fbbf24;
  animation: pulse 2s infinite;
}

.connection-status.connected .status-dot {
  background: #22c55e;
  animation: none;
}

.connection-status.error .status-dot {
  background: #ef4444;
  animation: none;
}

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

/* Intervention Overlay */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.intervention-popup {
  background: #1a1a2e;
  border-radius: 20px;
  padding: 3rem;
  text-align: center;
  max-width: 400px;
  animation: popIn 0.4s ease;
  border: 1px solid #333;
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.intervention-icon {
  font-size: 4rem;
  margin-bottom: 1.5rem;
}

.intervention-message {
  font-size: 1.3rem;
  line-height: 1.6;
  margin-bottom: 2rem;
  color: #e2e8f0;
}

/* Question Popup Overlay */
.question-popup {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 20px;
  padding: 2rem;
  max-width: 500px;
  width: 90%;
  animation: popIn 0.4s ease;
}

.question-header-popup {
  margin-bottom: 1rem;
}

.question-badge {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.question-text {
  font-size: 1.2rem;
  color: #e2e8f0;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.question-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.question-option {
  display: flex;
  align-items: center;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.question-option:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.question-option.selected {
  background: rgba(59, 130, 246, 0.15);
  border-color: #3b82f6;
}

.option-radio {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  margin-right: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.question-option.selected .option-radio {
  border-color: #3b82f6;
}

.question-option.selected .option-radio::after {
  content: '';
  width: 10px;
  height: 10px;
  background: #3b82f6;
  border-radius: 50%;
}

.option-text {
  color: #e2e8f0;
  font-size: 1rem;
}

.question-option.selected .option-text {
  color: #fff;
}

/* Complete Popup */
.complete-popup {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: 20px;
  padding: 3rem;
  text-align: center;
  max-width: 400px;
  animation: popIn 0.4s ease;
}

.complete-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.complete-popup h2 {
  color: #22c55e;
  margin-bottom: 1rem;
}

.complete-message {
  font-size: 1.2rem;
  color: #e2e8f0;
  margin-bottom: 0.5rem;
}

.complete-info {
  font-size: 0.9rem;
  color: #64748b;
}

/* Responsive */
@media (max-width: 768px) {
  .webcam-preview {
    width: 120px;
    bottom: 10px;
    right: 10px;
  }

  .join-form {
    padding: 0 1rem;
  }

  .url-input-group {
    flex-direction: column;
  }

  .url-input-group input {
    min-width: auto;
    width: 100%;
  }
}
