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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  min-height: 100vh;
  color: #fff;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
}

header {
  text-align: center;
  margin-bottom: 40px;
}

header h1 {
  font-size: 2.5rem;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 10px;
}

header p {
  color: #a0a0c0;
  font-size: 1.1rem;
}

.admin-link {
  display: inline-block;
  margin-top: 10px;
  padding: 8px 20px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  color: #a0a0c0;
  text-decoration: none;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.admin-link:hover {
  background: rgba(102, 126, 234, 0.2);
  border-color: #667eea;
  color: #667eea;
}

.form-section {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 30px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: #c0c0e0;
}

.form-group textarea,
.form-group select,
.form-group input[type="number"] {
  width: 100%;
  padding: 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.3);
  color: #fff;
  font-size: 1rem;
  transition: border-color 0.3s;
}

.form-group textarea:focus,
.form-group select:focus,
.form-group input[type="number"]:focus {
  outline: none;
  border-color: #667eea;
}

.form-group textarea {
  resize: vertical;
  min-height: 150px;
  font-family: inherit;
}

.prompt-count {
  text-align: right;
  margin-top: 8px;
  color: #808090;
  font-size: 0.9rem;
}

.form-row {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.form-row .form-group {
  flex: 1;
  min-width: 150px;
}

.form-group input[type="checkbox"] {
  margin-right: 8px;
  transform: scale(1.2);
}

.button-group {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.btn-stop {
  flex: 0 0 120px;
  padding: 16px 24px;
  font-size: 1.1rem;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  background: linear-gradient(90deg, #dc3545 0%, #c82333 100%);
  color: #fff;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-stop:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(220, 53, 69, 0.3);
}

.btn-stop.hidden {
  display: none;
}

.btn-primary {
  flex: 1;
  padding: 16px;
  font-size: 1.1rem;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.timer-section {
  margin-top: 20px;
  text-align: center;
}

.timer-display {
  display: inline-block;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  padding: 15px 40px;
  border-radius: 50px;
  font-size: 1.3rem;
  font-weight: 600;
  animation: pulse 1s ease-in-out infinite;
}

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

.timer-display.retry {
  background: linear-gradient(90deg, #f59e0b 0%, #ef4444 100%);
}

.progress-section,
.results-section {
  margin-top: 30px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 30px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.progress-section h2,
.results-section h2 {
  margin-bottom: 20px;
  font-size: 1.3rem;
  color: #c0c0e0;
}

.progress-bar-container {
  height: 20px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 15px;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  border-radius: 10px;
  transition: width 0.3s ease;
}

.progress-stats {
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 20px;
}

.progress-stats span {
  color: #a0a0c0;
}

.progress-stats strong {
  color: #fff;
}

.active-jobs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 15px;
}

.job-card {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
  padding: 15px;
  border-left: 3px solid #667eea;
}

.job-card.completed {
  border-left-color: #4ade80;
}

.job-card.error {
  border-left-color: #f87171;
}

.job-card.retrying {
  border-left-color: #f59e0b;
}

.job-card .prompt {
  font-size: 0.9rem;
  color: #c0c0e0;
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.job-card .status {
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.job-card .retry-info {
  font-size: 0.75rem;
  color: #f59e0b;
  margin-top: 5px;
}

.spinner-small {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.video-card {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.2s;
}

.video-card:hover {
  transform: translateY(-5px);
}

.video-card video {
  width: 100%;
  display: block;
}

.video-card .video-info {
  padding: 15px;
}

.video-card .video-prompt {
  font-size: 0.9rem;
  color: #c0c0e0;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-card .video-actions {
  display: flex;
  gap: 10px;
}

.video-card .btn-small {
  flex: 1;
  padding: 8px 12px;
  font-size: 0.85rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  transition: background 0.2s;
}

.video-card .btn-small:hover {
  background: rgba(255, 255, 255, 0.2);
}

.hidden {
  display: none;
}

.captcha-mode-toggle {
  display: flex;
  gap: 20px;
  margin-top: 8px;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: #c0c0e0;
}

.radio-label input[type="radio"] {
  transform: scale(1.2);
  cursor: pointer;
}

.form-group input[type="text"],
.form-group textarea#manualToken {
  width: 100%;
  padding: 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.3);
  color: #fff;
  font-size: 1rem;
  transition: border-color 0.3s;
}

.form-group input[type="text"]:focus,
.form-group textarea#manualToken:focus {
  outline: none;
  border-color: #667eea;
}

.btn-secondary {
  margin-top: 10px;
  padding: 10px 20px;
  font-size: 0.9rem;
  font-weight: 500;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: #667eea;
}

@media (max-width: 600px) {
  .form-row {
    flex-direction: column;
    gap: 10px;
  }
  
  header h1 {
    font-size: 1.8rem;
  }
  
  .video-grid {
    grid-template-columns: 1fr;
  }
}

/* Queue Section */
.queue-section {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 25px;
  margin: 20px 0;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.queue-section h2 {
  color: #667eea;
  margin-bottom: 15px;
}

.queue-list {
  max-height: 300px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.queue-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 15px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  border-left: 3px solid #667eea;
}

.queue-item.processing {
  border-left-color: #4ade80;
  background: rgba(74, 222, 128, 0.1);
}

.queue-item.completed {
  border-left-color: #22c55e;
  opacity: 0.6;
}

.queue-item.failed {
  border-left-color: #f87171;
  opacity: 0.6;
}

.queue-index {
  font-weight: bold;
  color: #667eea;
  min-width: 30px;
  text-align: center;
}

.queue-prompt {
  flex: 1;
  color: #c0c0e0;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-status {
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}

.queue-status.pending {
  background: rgba(102, 126, 234, 0.2);
  color: #667eea;
}

.queue-status.processing {
  background: rgba(74, 222, 128, 0.2);
  color: #4ade80;
}

.queue-status.completed {
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
}

.queue-status.failed {
  background: rgba(248, 113, 113, 0.2);
  color: #f87171;
}

/* Character Consistency Multi-Character */
.cc-controls {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 15px;
}

.cc-controls label {
  margin-bottom: 0;
  white-space: nowrap;
}

.cc-controls select {
  width: auto;
  min-width: 150px;
}

.cc-character-boxes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 15px;
  margin-bottom: 15px;
}

.cc-character-box {
  background: rgba(0, 0, 0, 0.3);
  border: 2px dashed rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 15px;
  text-align: center;
  transition: border-color 0.3s, background 0.3s;
  cursor: pointer;
}

.cc-character-box:hover {
  border-color: #667eea;
  background: rgba(102, 126, 234, 0.1);
}

.cc-character-box.uploaded {
  border-color: #4ade80;
  border-style: solid;
  background: rgba(74, 222, 128, 0.1);
}

.cc-character-box input[type="file"] {
  display: none;
}

.cc-character-box .cc-box-label {
  font-size: 0.85rem;
  color: #a0a0c0;
  margin-bottom: 8px;
}

.cc-character-box .cc-box-icon {
  font-size: 2rem;
  margin-bottom: 8px;
}

.cc-character-box .cc-box-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: #4ade80;
  word-break: break-word;
}

.cc-character-box .cc-box-preview {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 8px;
}

.cc-hint {
  font-size: 0.8rem;
  color: #808090;
  font-style: italic;
  margin-top: 10px;
}

/* Locked Relaxed Mode */
.relaxed-mode-locked {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #667eea;
  opacity: 0.8;
}

.relaxed-mode-locked input[type="checkbox"] {
  pointer-events: none;
  opacity: 0.7;
}

/* Video Queue Cards */
.queue-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 500px;
  overflow-y: auto;
}

.video-queue-card {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 12px;
  padding: 16px;
  border-left: 4px solid #667eea;
  transition: all 0.3s ease;
}

.video-queue-card.pending {
  border-left-color: #808090;
}

.video-queue-card.processing {
  border-left-color: #fbbf24;
  background: rgba(251, 191, 36, 0.1);
  animation: pulse-processing 2s ease-in-out infinite;
}

@keyframes pulse-processing {
  0%, 100% { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.3); }
  50% { box-shadow: 0 0 15px 5px rgba(251, 191, 36, 0.2); }
}

.video-queue-card.completed {
  border-left-color: #22c55e;
  background: rgba(34, 197, 94, 0.1);
}

.video-queue-card.failed {
  border-left-color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

.queue-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.queue-card-number {
  font-weight: 700;
  font-size: 1.1rem;
  color: #667eea;
  min-width: 40px;
}

.queue-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
}

.queue-card-icon.pending-icon {
  color: #808090;
  font-size: 0.8rem;
}

.queue-card-icon.completed-icon {
  color: #22c55e;
  font-size: 1.2rem;
  font-weight: bold;
}

.queue-card-icon.failed-icon {
  color: #ef4444;
  font-size: 1.2rem;
  font-weight: bold;
}

.queue-card-status {
  font-size: 0.85rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  margin-left: auto;
}

.queue-card-status.pending {
  background: rgba(128, 128, 144, 0.2);
  color: #a0a0c0;
}

.queue-card-status.processing {
  background: rgba(251, 191, 36, 0.2);
  color: #fbbf24;
}

.queue-card-status.completed {
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
}

.queue-card-status.failed {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.queue-card-prompt {
  color: #c0c0e0;
  font-size: 0.95rem;
  line-height: 1.4;
  padding-left: 52px;
  word-break: break-word;
}
