:root {
  --bg-primary: #0a0a0b;
  --bg-secondary: #131316;
  --bg-tertiary: #1c1c21;
  --bg-elevated: #232329;
  --text-primary: #e8e8ed;
  --text-secondary: #9898a0;
  --text-muted: #56565e;
  --accent: #e53935;
  --accent-hover: #c62828;
  --accent-glow: rgba(229, 57, 53, 0.15);
  --blue: #4d8df7;
  --blue-hover: #3a7ae8;
  --blue-glow: rgba(77, 141, 247, 0.15);
  --border: #2a2a30;
  --border-light: #36363e;
  --success: #34d399;
  --error: #f87171;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --transition: all 0.2s ease;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 48px 24px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
header {
  text-align: center;
  margin-bottom: 48px;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 10px;
}

.youtube-icon {
  width: 36px;
  height: 36px;
  color: var(--accent);
}

h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 400;
}

/* Input Section */
.input-section {
  margin-bottom: 32px;
}

.input-wrapper {
  display: flex;
  gap: 10px;
  background: var(--bg-secondary);
  padding: 6px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  transition: var(--transition);
}

.input-wrapper:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

#urlInput {
  flex: 1;
  background: transparent;
  border: none;
  padding: 12px 16px;
  font-size: 0.95rem;
  color: var(--text-primary);
  outline: none;
  font-family: inherit;
}

#urlInput::placeholder {
  color: var(--text-muted);
}

#extractBtn {
  background: var(--accent);
  color: white;
  border: none;
  padding: 12px 28px;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 100px;
  font-family: inherit;
}

#extractBtn:hover {
  background: var(--accent-hover);
}

#extractBtn:active {
  transform: scale(0.98);
}

#extractBtn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.spinner {
  width: 20px;
  height: 20px;
  animation: spin 1s linear infinite;
}

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

.hint {
  margin-top: 10px;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

/* Error Message */
.error-message {
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.3);
  color: var(--error);
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 24px;
  text-align: center;
  font-size: 0.9rem;
}

/* Result Section */
.result-section {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  animation: fadeIn 0.3s ease;
  flex: 1;
  display: flex;
  flex-direction: column;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  gap: 16px;
  flex-wrap: wrap;
}

.video-preview {
  display: flex;
  align-items: center;
  gap: 14px;
}

#thumbnail {
  width: 100px;
  height: 56px;
  object-fit: cover;
  border-radius: var(--radius-xs);
}

.video-info h3 {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
}

.video-info h3 span {
  color: var(--text-secondary);
  font-family: 'SF Mono', 'Fira Code', monospace;
}

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

.action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.action-btn:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-light);
}

.action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.action-btn svg {
  width: 14px;
  height: 14px;
}

.translate-btn {
  background: rgba(77, 141, 247, 0.1);
  border-color: rgba(77, 141, 247, 0.25);
  color: var(--blue);
}

.translate-btn:hover {
  background: rgba(77, 141, 247, 0.18);
  color: var(--blue);
  border-color: rgba(77, 141, 247, 0.4);
}

/* Translate Bar */
.translate-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
}

.translate-bar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.translate-bar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.translate-timer {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.8rem;
  color: var(--text-muted);
  min-width: 40px;
  text-align: right;
}

.translate-timer.active {
  color: var(--blue);
}

.translate-timer.done {
  color: var(--success);
}

.picker-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.picker-options {
  display: flex;
  gap: 4px;
  background: var(--bg-primary);
  padding: 3px;
  border-radius: var(--radius-xs);
}

.picker-btn {
  padding: 5px 14px;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.picker-btn:hover {
  color: var(--text-secondary);
}

.picker-btn.active {
  background: var(--bg-elevated);
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Reading Controls */
.reading-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 8px 20px;
  border-bottom: 1px solid var(--border);
}

.control-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-right: 2px;
}

.size-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.size-btn:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.size-display {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.75rem;
  color: var(--text-secondary);
  min-width: 20px;
  text-align: center;
}

/* Tabs */
.tabs {
  display: flex;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  gap: 2px;
  overflow-x: auto;
}

.tab {
  padding: 12px 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  position: relative;
  transition: var(--transition);
  white-space: nowrap;
  font-family: inherit;
}

.tab:hover {
  color: var(--text-secondary);
}

.tab.active {
  color: var(--text-primary);
}

.tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
}

/* Transcript Content */
.transcript-container {
  padding: 24px;
  flex: 1;
  overflow-y: auto;
  min-height: 400px;
  max-height: calc(100vh - 380px);
}

.transcript-container::-webkit-scrollbar {
  width: 6px;
}

.transcript-container::-webkit-scrollbar-track {
  background: transparent;
}

.transcript-container::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.transcript-container::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.transcript-content {
  line-height: 1.85;
  word-wrap: break-word;
}

#fullText, #translatedFull {
  color: var(--text-primary);
}

#timestamps .timestamp-item,
#translatedTimestamps .timestamp-item {
  display: flex;
  gap: 12px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(42, 42, 48, 0.4);
}

#timestamps .timestamp-item:last-child,
#translatedTimestamps .timestamp-item:last-child {
  border-bottom: none;
}

.timestamp-time {
  color: var(--accent);
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.75rem;
  min-width: 44px;
  flex-shrink: 0;
  padding-top: 2px;
}

.timestamp-text {
  color: var(--text-primary);
  line-height: 1.5;
}

/* Summary Box */
.summary-box {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px 22px;
  margin-bottom: 16px;
  line-height: 1.75;
}

.summary-box .summary-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--accent);
  margin-bottom: 6px;
}

.summary-box .summary-text {
  color: var(--text-primary);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--bg-elevated);
  color: var(--text-primary);
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  font-size: 0.85rem;
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 1000;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast.success {
  border-color: rgba(52, 211, 153, 0.4);
}

.toast.error {
  border-color: rgba(248, 113, 113, 0.4);
}

/* Footer */
footer {
  margin-top: auto;
  padding-top: 40px;
  text-align: center;
}

footer p {
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* Responsive */
@media (max-width: 640px) {
  .container {
    padding: 24px 16px;
  }

  h1 {
    font-size: 1.35rem;
  }

  .input-wrapper {
    flex-direction: column;
  }

  #extractBtn {
    width: 100%;
  }

  .result-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .video-preview {
    width: 100%;
  }

  .result-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .action-btn {
    flex: 1;
    justify-content: center;
  }

  .transcript-container {
    min-height: 300px;
    max-height: calc(100vh - 420px);
  }

  .translate-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .translate-bar-left {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .translate-bar-right {
    justify-content: space-between;
  }

  .picker-options {
    width: 100%;
  }

  .picker-btn {
    flex: 1;
    text-align: center;
  }

  .tabs {
    padding: 0 12px;
  }

  .tab {
    padding: 10px 10px;
    font-size: 0.75rem;
  }
}
