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

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface-hover: #22263a;
  --border: #2d3348;
  --text: #e8eaed;
  --text-muted: #8b92a8;
  --accent: #6c8cff;
  --accent-hover: #5a7af5;
  --success: #4ade80;
  --warning: #fbbf24;
  --danger: #f87171;
  --radius: 12px;
}

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

.app {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.brand-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, var(--accent), #4a5fc1);
  border-radius: 14px;
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(108, 140, 255, 0.3);
}

.brand-text {
  text-align: left;
}

.brand-text h1 {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.15rem;
}

.brand-dot {
  color: var(--accent);
}

.brand-tagline {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
}

.header-desc {
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: 560px;
  margin: 0 auto;
}

header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

header p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.upload-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--accent);
  background: var(--surface);
}

.dropzone svg {
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.dropzone-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.dropzone-hint {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.file-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 0.85rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

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

.btn-text {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
}

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

.loading {
  text-align: center;
  padding: 3rem 0;
}

.progress-bar {
  width: 100%;
  max-width: 400px;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  margin: 1.25rem auto 0.5rem;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.4s ease;
}

.progress-detail {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.progress-note {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 1rem;
  font-style: italic;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}

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

.error {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  padding: 1rem;
  color: var(--danger);
  margin-top: 1rem;
}

.results {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-top: 2rem;
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.results-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
}

.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 0.6rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
}

.btn-download:hover:not(:disabled) {
  background: var(--accent);
  color: #fff;
}

.download-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.saved-section {
  margin-bottom: 2rem;
}

.saved-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.saved-hint {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

.saved-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.saved-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  transition: border-color 0.2s, background 0.2s;
}

.saved-item:hover {
  border-color: var(--accent);
  background: var(--surface-hover);
}

.saved-name {
  font-weight: 600;
  font-size: 0.9rem;
  flex: 1;
  min-width: 120px;
}

.saved-date, .saved-words {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.saved-empty {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
}

.cache-notice {
  background: rgba(74, 222, 128, 0.1);
  border: 1px solid var(--success);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  color: var(--success);
  font-size: 0.9rem;
  margin-top: 1rem;
}

.knowledge-item {
  padding: 1rem;
  background: var(--bg);
  border-radius: 8px;
  margin-bottom: 0.75rem;
  border-left: 3px solid var(--accent);
}

.knowledge-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.knowledge-category {
  font-size: 0.8rem;
  color: var(--accent);
}

.knowledge-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.knowledge-content {
  font-size: 0.9rem;
  line-height: 1.7;
}

.knowledge-apply, .knowledge-latam {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

.knowledge-apply strong, .knowledge-latam strong {
  color: var(--accent);
}

.badge-type {
  background: rgba(108, 140, 255, 0.2);
  color: var(--accent);
}

.simple-list {
  list-style: none;
  padding: 0;
}

.simple-list li {
  padding: 0.5rem 0 0.5rem 1.25rem;
  position: relative;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
}

.simple-list li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--accent);
}

.anti-list li::before {
  content: "✕";
  color: var(--danger);
}

.card.hidden {
  display: none !important;
}

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

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.card h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  padding-bottom: 0;
  border-bottom: none;
}

.card-subtitle {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.milestone {
  padding: 1rem;
  background: var(--bg);
  border-radius: 8px;
  margin-bottom: 0.75rem;
}

.milestone:last-child {
  margin-bottom: 0;
}

.milestone-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.milestone-time {
  font-family: monospace;
  font-size: 0.8rem;
  color: var(--accent);
  background: rgba(108, 140, 255, 0.1);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
}

.milestone-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.badge {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  letter-spacing: 0.03em;
}

.badge-high { background: rgba(248, 113, 113, 0.2); color: var(--danger); }
.badge-medium { background: rgba(251, 191, 36, 0.2); color: var(--warning); }
.badge-low { background: rgba(74, 222, 128, 0.2); color: var(--success); }

.milestone-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.milestone-category {
  font-size: 0.8rem;
  color: var(--accent);
  margin-top: 0.35rem;
}

.category {
  margin-bottom: 1rem;
}

.category:last-child {
  margin-bottom: 0;
}

.category-name {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.15rem;
}

.category-desc {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

.category-items {
  list-style: none;
  padding-left: 0;
}

.category-items li {
  padding: 0.35rem 0;
  padding-left: 1rem;
  position: relative;
  font-size: 0.9rem;
}

.category-items li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--accent);
}

#keyPointsList {
  list-style: none;
  padding: 0;
}

#keyPointsList li {
  padding: 0.5rem 0;
  padding-left: 1.25rem;
  position: relative;
  font-size: 0.95rem;
}

#keyPointsList li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--accent);
}

.transcription-meta {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.transcription-text {
  white-space: pre-wrap;
  font-size: 0.95rem;
  line-height: 1.7;
}

.segments-details {
  margin-top: 1.25rem;
}

.segments-details summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 500;
}

.segment {
  display: flex;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

.segment-time {
  color: var(--accent);
  font-family: monospace;
  white-space: nowrap;
  min-width: 5rem;
}

.hidden {
  display: none !important;
}
