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

body {
  font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #0f0f1a 0%, #1a1a2e 50%, #16213e 100%);
  min-height: 100vh;
  color: #e4e4e7;
}

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

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

header h1 {
  font-size: 2.5rem;
  background: linear-gradient(135deg, #8b5cf6, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 10px;
  font-weight: 700;
}

header .subtitle {
  color: #71717a;
  font-size: 1.1rem;
}

.input-section {
  display: flex;
  gap: 12px;
  margin-bottom: 30px;
  background: rgba(39, 39, 42, 0.6);
  padding: 16px;
  border-radius: 16px;
  border: 1px solid rgba(63, 63, 70, 0.5);
  backdrop-filter: blur(10px);
}

#youtubeUrl {
  flex: 1;
  padding: 14px 18px;
  border: 2px solid #3f3f46;
  border-radius: 10px;
  background: rgba(24, 24, 27, 0.8);
  color: #e4e4e7;
  font-size: 1rem;
  transition: all 0.3s ease;
}

#youtubeUrl:focus {
  outline: none;
  border-color: #8b5cf6;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

#youtubeUrl::placeholder {
  color: #71717a;
}

.paste-btn {
  padding: 14px 20px;
  background: transparent;
  border: 2px solid #3f3f46;
  border-radius: 10px;
  color: #a1a1aa;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.paste-btn:hover {
  border-color: #8b5cf6;
  color: #8b5cf6;
}

#extractBtn {
  padding: 14px 28px;
  background: linear-gradient(135deg, #8b5cf6, #a78bfa);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

#extractBtn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(139, 92, 246, 0.35);
}

#extractBtn:active {
  transform: translateY(0);
}

.copy-curl-btn {
  padding: 14px 20px;
  background: transparent;
  border: 2px solid #8b5cf6;
  border-radius: 10px;
  color: #a78bfa;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.copy-curl-btn:hover {
  background: rgba(139, 92, 246, 0.1);
}

#langSelect {
  padding: 14px 18px;
  border: 2px solid #3f3f46;
  border-radius: 10px;
  background: rgba(24, 24, 27, 0.8);
  color: #e4e4e7;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

#langSelect:focus {
  outline: none;
  border-color: #8b5cf6;
}

#langSelect option {
  background: #18181b;
  color: #e4e4e7;
}

.fallback-notice {
  background: rgba(251, 191, 36, 0.15);
  border: 1px solid rgba(251, 191, 36, 0.4);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
  color: #fbbf24;
  font-size: 0.9rem;
}

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 30px;
  color: #71717a;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid #3f3f46;
  border-top-color: #8b5cf6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 12px;
  padding: 16px 20px;
  color: #f87171;
  margin-bottom: 20px;
}

.result {
  background: rgba(39, 39, 42, 0.6);
  border: 1px solid rgba(63, 63, 70, 0.5);
  border-radius: 16px;
  overflow: hidden;
  backdrop-filter: blur(10px);
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  background: linear-gradient(135deg, #8b5cf6, #a78bfa);
  border-bottom: none;
}

.result-header h2 {
  font-size: 1.2rem;
  color: #fff;
  font-weight: 600;
}

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

.copy-btn,
.download-btn {
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.copy-btn:hover,
.download-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

.download-btn {
  background: rgba(34, 197, 94, 0.2);
  border-color: rgba(34, 197, 94, 0.4);
}

.download-btn:hover {
  background: rgba(34, 197, 94, 0.35);
}

.subtitle-list {
  max-height: 500px;
  overflow-y: auto;
  padding: 16px;
}

.subtitle-item {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 16px;
  padding: 14px 16px;
  border-radius: 10px;
  transition: background 0.2s ease;
}

.subtitle-item:hover {
  background: rgba(63, 63, 70, 0.3);
}

.subtitle-item:not(:last-child) {
  border-bottom: 1px solid rgba(63, 63, 70, 0.3);
}

.time-range {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: 'SF Mono', 'Consolas', monospace;
  font-size: 0.85rem;
}

.time-label {
  color: #71717a;
  font-size: 0.7rem;
  text-transform: uppercase;
  font-weight: 500;
}

.time-value {
  color: #a78bfa;
  font-weight: 600;
}

.subtitle-text {
  color: #d4d4d8;
  line-height: 1.7;
  align-self: center;
}

.hidden {
  display: none !important;
}

/* Scrollbar */
.subtitle-list::-webkit-scrollbar {
  width: 8px;
}

.subtitle-list::-webkit-scrollbar-track {
  background: #18181b;
}

.subtitle-list::-webkit-scrollbar-thumb {
  background: #3f3f46;
  border-radius: 4px;
}

.subtitle-list::-webkit-scrollbar-thumb:hover {
  background: #52525b;
}

@media (max-width: 600px) {
  .input-section {
    flex-direction: column;
  }

  .subtitle-item {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .time-range {
    flex-direction: row;
    gap: 12px;
  }
}