/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: #0d0d1a;
  color: #ffffff;
  font-family: Inter, system-ui, sans-serif;
  min-height: 100vh;
}

/* === Topbar === */
.topbar {
  height: 60px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  background: #12122a;
  border-bottom: 1px solid #1e1e3a;
}

.topbar__logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: #7c5cff;
  letter-spacing: -0.5px;
}

.topbar__desc {
  font-size: 0.85rem;
  color: #8888aa;
}

/* === Layout === */
.main-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 32px 16px 64px;
}

/* === Card === */
.card {
  background: #12122a;
  border: 1px solid #1e1e3a;
  border-radius: 16px;
  padding: 32px;
  width: 100%;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

/* === Dropzone === */
.dropzone {
  background: #1a1a2e;
  border: 2px dashed #2a2a3e;
  border-radius: 12px;
  min-height: 360px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  cursor: pointer;
  transition: border-color 200ms, box-shadow 200ms;
  padding: 32px;
}

.dropzone:hover,
.dropzone.drag-over {
  border-color: #7c5cff;
  box-shadow: 0 0 32px rgba(124, 92, 255, 0.3);
}

.dropzone__icon {
  font-size: 3rem;
}

.dropzone__hint {
  color: #8888aa;
  font-size: 0.95rem;
}

.dropzone__formats {
  color: #555577;
  font-size: 0.8rem;
}

/* === Preview === */
.preview-img {
  width: 100%;
  max-height: 400px;
  object-fit: contain;
  border-radius: 8px;
  background: #0d0d1a;
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: transform 150ms, opacity 150ms;
  text-decoration: none;
}

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

.btn-primary {
  background: #7c5cff;
  color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(124, 92, 255, 0.4);
}

.btn-secondary {
  background: #1e1e3a;
  color: #ccccee;
  border: 1px solid #2a2a4a;
}

.btn-secondary:hover:not(:disabled) {
  background: #252545;
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: #8888aa;
}

.btn-ghost:hover:not(:disabled) {
  color: #ccccee;
}

/* === Progress === */
.progress-status {
  font-size: 1rem;
  color: #ccccee;
  text-align: center;
}

.progress-bar-track {
  width: 100%;
  height: 6px;
  background: #1e1e3a;
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #7c5cff, #b08cff);
  border-radius: 3px;
  width: 0%;
  transition: width 600ms ease;
}

/* === Spinner === */
.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #1e1e3a;
  border-top-color: #7c5cff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* === Player === */
#player {
  width: 320px;
  aspect-ratio: 9 / 16;
  border-radius: 12px;
  background: #000;
  object-fit: cover;
}

/* === Result Actions === */
.result-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

/* === Error === */
.error-icon {
  font-size: 2.5rem;
}

.error-message {
  color: #ff7c7c;
  text-align: center;
  font-size: 0.95rem;
  line-height: 1.5;
}

/* === History === */
#history-section {
  width: 100%;
  max-width: 640px;
}

.history-title {
  font-size: 1rem;
  font-weight: 600;
  color: #8888aa;
  margin-bottom: 16px;
  text-align: center;
}

.history-list {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.history-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.history-item video {
  width: 100px;
  aspect-ratio: 9 / 16;
  border-radius: 8px;
  object-fit: cover;
  background: #000;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 200ms;
}

.history-item video:hover {
  border-color: #7c5cff;
}

.history-item__label {
  font-size: 0.75rem;
  color: #555577;
}

/* === Responsive === */
@media (max-width: 480px) {
  .card {
    padding: 20px 16px;
  }

  .topbar__desc {
    display: none;
  }

  #player {
    width: 240px;
  }
}