:root {
  color-scheme: dark;
  font-family: Inter, Segoe UI, Arial, sans-serif;
  background: #111316;
  color: #f6f1e8;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(42, 157, 143, 0.22), transparent 34%),
    linear-gradient(315deg, rgba(231, 111, 81, 0.18), transparent 38%),
    #111316;
}

.shell {
  display: grid;
  height: 100vh;
  place-items: center;
  padding: 24px;
  overflow: hidden;
}

.panel {
  width: min(760px, 100%);
  max-height: calc(100vh - 48px);
  overflow: hidden;
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(17, 19, 22, 0.86);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.3);
  display: grid;
  gap: 22px;
  transition:
    width 0.55s ease,
    max-width 0.55s ease,
    grid-template-columns 0.55s ease;
}

.panel.is-complete {
  width: min(1160px, 100%);
  grid-template-columns: minmax(320px, 0.92fr) minmax(360px, 1.08fr);
  align-items: stretch;
  gap: 26px;
}

.download-area {
  display: grid;
  align-content: start;
  min-width: 0;
  transition:
    transform 0.55s ease,
    opacity 0.55s ease;
}

.panel.is-complete .download-area {
  transform: translateX(-6px) scale(0.98);
}

.eyebrow {
  margin: 0 0 8px;
  color: #7fd1c8;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(32px, 6vw, 56px);
  letter-spacing: 0;
}

.panel.is-complete h1 {
  font-size: clamp(28px, 3.7vw, 42px);
}

.sub {
  margin: 12px 0 26px;
  color: #cfc7bb;
  line-height: 1.5;
}

.form {
  display: grid;
  grid-template-columns: 1fr 150px;
  gap: 14px;
}

label {
  display: grid;
  gap: 8px;
  color: #e9dfd0;
  font-weight: 700;
}

input,
select,
button,
a {
  min-height: 48px;
  border-radius: 8px;
  font: inherit;
}

input,
select {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: #1c2025;
  color: #fff;
  padding: 0 14px;
}

button,
.actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: #e9c46a;
  color: #171717;
  cursor: pointer;
  font-weight: 850;
  text-decoration: none;
}

button {
  grid-column: 1 / -1;
}

button:disabled {
  cursor: progress;
  opacity: 0.72;
}

.status,
.result {
  margin-top: 22px;
}

.panel.is-complete .status,
.panel.is-complete .result {
  margin-top: 12px;
}

.status {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  align-items: center;
}

.loader {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.16);
  border-top-color: #2a9d8f;
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
}

.status-copy {
  display: grid;
  gap: 4px;
}

.status-copy span {
  color: #cfc7bb;
}

.progress {
  grid-column: 1 / -1;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.13);
}

.progress span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #2a9d8f, #e9c46a, #e76f51);
  transition: width 0.25s ease;
}

video {
  width: 100%;
  max-height: 42vh;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  border-radius: 8px;
  background: #000;
}

.result {
  padding-top: 4px;
  opacity: 0;
  transform: translateX(28px);
  transition:
    opacity 0.45s ease 0.1s,
    transform 0.45s ease 0.1s;
}

.panel.is-complete .result {
  display: grid;
  align-content: start;
  opacity: 1;
  transform: translateX(0);
}

.result-header {
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
}

.result-header strong {
  font-size: 20px;
}

.result-header span {
  color: #cfc7bb;
  overflow-wrap: anywhere;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.video-wrap {
  border-radius: 8px;
  overflow: hidden;
  background: #000;
  max-height: 42vh;
}

.panel.is-complete .video-wrap,
.panel.is-complete video {
  max-height: min(42vh, 320px);
}

.hidden {
  display: none;
}

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

@media (max-width: 640px) {
  .shell {
    padding: 12px;
  }

  .panel {
    padding: 20px;
    max-height: calc(100vh - 24px);
  }

  .panel.is-complete {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .panel.is-complete .download-area {
    transform: none;
  }

  .form,
  .actions {
    grid-template-columns: 1fr;
  }

  .panel.is-complete .sub,
  .panel.is-complete .form {
    display: none;
  }

  .panel.is-complete h1 {
    font-size: 28px;
  }

  .panel.is-complete .status {
    grid-template-columns: 34px 1fr;
  }

  .panel.is-complete .loader {
    width: 32px;
    height: 32px;
  }

  video,
  .video-wrap,
  .panel.is-complete .video-wrap,
  .panel.is-complete video {
    max-height: 30vh;
  }
}
