* {
  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;
}

.hidden {
  display: none !important;
}

/* Join Screen */
.join-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

.back-link {
  position: absolute;
  top: 2rem;
  left: 2rem;
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.9rem;
}

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

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

h1 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  background: linear-gradient(90deg, #8b5cf6, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

/* Code Input */
.code-input-group {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.code-input {
  width: 200px;
  padding: 1rem 1.5rem;
  font-size: 1.5rem;
  font-weight: bold;
  letter-spacing: 0.2em;
  text-align: center;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  color: #fff;
  outline: none;
}

.code-input:focus {
  border-color: #8b5cf6;
}

.code-input::placeholder {
  font-size: 0.9rem;
  letter-spacing: normal;
  color: #64748b;
}

/* Buttons */
.btn {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s;
  text-decoration: none;
  display: inline-block;
}

.btn.large {
  padding: 1rem 2.5rem;
  font-size: 1.1rem;
  border-radius: 12px;
}

.btn.primary {
  background: #8b5cf6;
  color: #fff;
}

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

.btn.secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn.secondary:hover {
  background: rgba(255, 255, 255, 0.2);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* Error Message */
.error-message {
  color: #ef4444;
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

/* Setup Screen */
.setup-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

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

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

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

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

/* Start Section */
.start-section {
  margin-top: 2rem;
  text-align: center;
}

.test-info {
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 12px;
  padding: 1rem 2rem;
  margin-bottom: 1rem;
}

.test-info h3 {
  color: #a78bfa;
  margin-bottom: 0.25rem;
}

.test-info p {
  color: #94a3b8;
  font-size: 0.9rem;
}

.info-text {
  color: #64748b;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

/* Watch Screen */
.watch-layout {
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #000;
  position: relative;
}

.video-container {
  flex: 1;
  position: relative;
}

.video-container iframe,
#youtube-player,
#local-video-player {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.video-progress {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  z-index: 10;
}

/* Webcam Container */
.webcam-container {
  position: absolute;
  bottom: 20px;
  right: 20px;
  width: 180px;
  aspect-ratio: 4/3;
  background: #1a1a1a;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid #333;
  z-index: 20;
}

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

.recording-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(220, 38, 38, 0.9);
  color: #fff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
}

.rec-dot {
  width: 6px;
  height: 6px;
  background: #fff;
  border-radius: 50%;
  animation: rec-pulse 1s ease-in-out infinite;
}

@keyframes rec-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Intervention Overlay */
.intervention-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.intervention-popup {
  background: #1a1a2e;
  border-radius: 20px;
  padding: 2.5rem;
  text-align: center;
  max-width: 400px;
  animation: popup-appear 0.3s ease-out;
}

@keyframes popup-appear {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

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

/* Complete Screen */
.complete-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

.complete-container h1 {
  background: linear-gradient(90deg, #22c55e, #4ade80);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.completion-info {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 1.5rem 2rem;
  margin: 2rem 0;
  min-width: 280px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.info-row:last-child {
  border-bottom: none;
}

.info-row .label {
  color: #64748b;
}

.info-row .value {
  font-weight: 600;
  color: #fff;
}

.thank-you-section {
  margin-top: 2rem;
  padding: 1.5rem;
  text-align: center;
}

.thank-you {
  font-size: 1.5rem;
  color: #4ade80;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.good-luck {
  font-size: 1.2rem;
  color: #fbbf24;
  margin-bottom: 1rem;
}

.close-tab {
  font-size: 0.9rem;
  color: #64748b;
}

/* Prize Draw Section */
.prize-draw-section {
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 16px;
  padding: 1.5rem;
  margin: 1.5rem 0;
  text-align: center;
}

.prize-draw-section h3 {
  color: #a78bfa;
  margin-bottom: 0.5rem;
}

.prize-description {
  color: #94a3b8;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.prize-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.form-row {
  display: flex;
  gap: 0.75rem;
}

.form-input {
  flex: 1;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: #fff;
  outline: none;
}

.form-input:focus {
  border-color: #8b5cf6;
}

.form-input::placeholder {
  color: #64748b;
}

.prize-status {
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

.prize-status.success {
  color: #4ade80;
}

.prize-status.error {
  color: #ef4444;
}

.prize-optional {
  color: #64748b;
  font-size: 0.8rem;
  margin-top: 0.75rem;
}

/* Upload Overlay */
.upload-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.upload-overlay.hidden {
  display: none;
}

.upload-modal {
  text-align: center;
  padding: 3rem;
}

.upload-spinner {
  width: 60px;
  height: 60px;
  border: 4px solid rgba(139, 92, 246, 0.3);
  border-top-color: #8b5cf6;
  border-radius: 50%;
  margin: 0 auto 1.5rem;
  animation: spin 1s linear infinite;
}

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

.upload-modal h2 {
  color: #fff;
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.upload-warning {
  color: #fbbf24;
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.upload-subtext {
  color: #94a3b8;
  font-size: 0.9rem;
}

/* Question Overlay */
.question-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.question-popup {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 20px;
  padding: 2rem;
  max-width: 500px;
  width: 90%;
  animation: popup-appear 0.3s ease-out;
}

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

.question-badge {
  background: rgba(139, 92, 246, 0.2);
  color: #a78bfa;
  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(139, 92, 246, 0.15);
  border-color: #8b5cf6;
}

.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: #8b5cf6;
}

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

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

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

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

  .intervention-popup {
    margin: 1rem;
    padding: 1.5rem;
  }

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

  .code-input {
    width: 100%;
  }
}
