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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: #000;
  color: #fff;
  overflow: hidden;
}

.container {
  width: 100vw;
  height: 100vh;
  position: relative;
}

.video-container {
  width: 100%;
  height: 100%;
  position: relative;
  background: #000;
}

#videoPlayer {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.overlay-ui {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.8) 0%, transparent 30%, transparent 70%, rgba(0,0,0,0.9) 100%);
  pointer-events: none;
}

.overlay-ui > * {
  pointer-events: auto;
}

.header {
  padding: 20px 30px;
  text-align: center;
  background: rgba(0,0,0,0.3);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
}

.header h1 {
  font-size: 24px;
  font-weight: 600;
  background: linear-gradient(135deg, #007AFF, #5856D6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  font-size: 14px;
  color: rgba(255,255,255,0.6);
  margin-top: 4px;
}

.upload-area {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 400px;
  padding: 60px 40px;
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.2);
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.upload-area:hover {
  background: rgba(255,255,255,0.15);
  transform: translate(-50%, -50%) scale(1.02);
}

.upload-area.drag-over {
  background: rgba(0,122,255,0.2);
  border-color: #007AFF;
}

.upload-icon {
  width: 60px;
  height: 60px;
  color: #007AFF;
  margin-bottom: 20px;
}

.upload-area h2 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 8px;
}

.upload-area p {
  color: rgba(255,255,255,0.6);
  font-size: 14px;
}

.controls {
  display: none;
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 600px;
  background: rgba(30,30,30,0.9);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.1);
  z-index: 10;
  transition: all 0.3s ease;
}

.controls.collapsed {
  width: auto;
  max-width: none;
  background: rgba(30,30,30,0.7);
}

.controls.collapsed .controls-content {
  display: none;
}

.controls.collapsed .controls-toggle {
  transform: rotate(180deg);
}

.controls-toggle {
  display: none;
  width: 40px;
  height: 40px;
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.8);
  cursor: pointer;
  transition: all 0.3s ease;
  margin: 0 auto;
  padding: 0;
}

.controls-toggle:hover {
  color: white;
}

.controls-toggle svg {
  width: 24px;
  height: 24px;
}

.controls.collapsed .controls-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}

.controls:not(.collapsed) .controls-toggle {
  display: none;
}

.controls-content {
  padding: 20px;
}

.primary-btn {
  width: 100%;
  padding: 14px 24px;
  background: linear-gradient(135deg, #007AFF, #5856D6);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.primary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 30px rgba(0,122,255,0.3);
}

.primary-btn.loading .btn-text {
  opacity: 0;
}

.spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  opacity: 0;
}

.primary-btn.loading .spinner {
  opacity: 1;
}

.secondary-btn {
  width: 100%;
  padding: 12px 20px;
  margin-top: 10px;
  background: rgba(255,255,255,0.1);
  color: white;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.secondary-btn:hover {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.3);
}

@keyframes spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

.settings {
  display: flex;
  gap: 20px;
  margin-top: 20px;
  justify-content: center;
}

.setting-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 200px;
}

.setting-item span {
  font-size: 13px;
  color: rgba(255,255,255,0.6);
}

.setting-item select {
  padding: 10px 12px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  color: white;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.setting-item select:hover {
  background: rgba(255,255,255,0.15);
}

.results {
  display: none;
  position: absolute;
  right: 30px;
  top: 100px;
  width: 400px;
  max-height: calc(100vh - 200px);
  background: rgba(30,30,30,0.95);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.1);
  overflow: hidden;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.results-actions {
  display: flex;
  gap: 8px;
}

.results-header h3 {
  font-size: 18px;
  font-weight: 600;
}

.icon-btn {
  width: 32px;
  height: 32px;
  background: rgba(255,255,255,0.1);
  border: none;
  border-radius: 8px;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

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

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.icon-btn.copied {
  background: #30D158;
}

.frame-captions {
  max-height: 300px;
  overflow-y: auto;
  padding: 20px;
}

.frame-caption-item {
  margin-bottom: 10px;
  padding: 10px;
  background: rgba(255,255,255,0.05);
  border-radius: 12px;
  animation: slideIn 0.15s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.frame-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.frame-number {
  font-size: 12px;
  font-weight: 600;
  color: #007AFF;
}

.frame-time {
  font-size: 12px;
  color: rgba(255,255,255,0.5);
}

.frame-text {
  font-size: 14px;
  line-height: 1.5;
  color: rgba(255,255,255,0.9);
}

.live-caption {
  display: none;
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 600px;
  padding: 20px 30px;
  background: rgba(30,30,30,0.9);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.1);
  text-align: center;
  z-index: 10;
}

.caption-text {
  font-size: 18px;
  line-height: 1.5;
  color: white;
  font-weight: 500;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
  min-height: 27px;
  transition: opacity 0.15s ease;
}

.processing-dots::after {
  content: '';
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0%, 20% { content: ''; }
  40% { content: '.'; }
  60% { content: '..'; }
  80%, 100% { content: '...'; }
}

@media (max-width: 768px) {
  .header {
    padding: 15px 20px;
  }
  
  .header h1 {
    font-size: 20px;
  }
  
  .results {
    right: 20px;
    left: 20px;
    width: auto;
    top: 80px;
  }
  
  .controls {
    bottom: 20px;
    width: calc(100% - 40px);
  }
  
  .controls.collapsed {
    width: auto;
  }
  
  .live-caption {
    bottom: 20px;
    width: calc(100% - 40px);
  }
  
  .settings {
    gap: 15px;
  }
  
  .upload-area {
    padding: 40px 30px;
  }
}