:root {
  color-scheme: dark;
  --bg: #0d0e10;
  --panel: #17191d;
  --ink: #f5f2ea;
  --muted: #9c9c98;
  --line: #33353a;
  --red: #ff493d;
  --green: #62d6a4;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 85% 10%, rgba(255, 73, 61, 0.14), transparent 32rem),
    var(--bg);
  color: var(--ink);
  font-family: "Pretendard", "Noto Sans KR", system-ui, sans-serif;
}

button,
input,
select {
  font: inherit;
}

.shell {
  width: min(960px, calc(100% - 40px));
  margin: 0 auto;
  padding: 72px 0 40px;
}

.hero {
  margin-bottom: 48px;
}

.eyebrow,
.section-heading span,
.uploader {
  color: var(--red);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1 {
  max-width: 760px;
  margin: 18px 0 20px;
  font-size: clamp(3rem, 9vw, 6.8rem);
  font-weight: 800;
  letter-spacing: -0.075em;
  line-height: 0.91;
}

h1 em {
  color: var(--red);
  font-style: normal;
}

.hero p {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.7;
}

.panel {
  padding: clamp(24px, 5vw, 52px);
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(23, 25, 29, 0.92);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.24);
}

.section-heading {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 26px;
}
.section-heading h2 {
  margin: 0;
  font-size: 1.35rem;
}
form > label:first-child {
  display: block;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 0.84rem;
}
.url-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

input[type="url"] {
  min-width: 0;
  padding: 17px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  background: #101216;
  color: var(--ink);
}

input[type="url"]:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(255, 73, 61, 0.12);
}

button {
  padding: 0 22px;
  border: 0;
  border-radius: 12px;
  background: var(--ink);
  color: #111;
  cursor: pointer;
  font-weight: 750;
}

button:hover {
  filter: brightness(0.9);
}
button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.confirmation {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.83rem;
  line-height: 1.5;
}

.extension-download {
  width: 100%;
  min-height: 52px;
  margin-top: 12px;
  background: var(--red);
  color: white;
}

.extension-status {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
}

.extension-status.ready {
  color: var(--green);
}

.confirmation input {
  margin-top: 3px;
  accent-color: var(--red);
}
.message {
  min-height: 24px;
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}
.message.error {
  color: #ff8a80;
}
.message.success {
  color: var(--green);
}

.preview {
  display: grid;
  grid-template-columns: minmax(180px, 280px) 1fr;
  gap: 24px;
  align-items: center;
  margin-top: 28px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.preview[hidden],
.download-controls[hidden],
.progress-card[hidden] {
  display: none;
}
.preview img {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  object-fit: cover;
  background: #0c0d0f;
}
.preview h3 {
  margin: 9px 0 12px;
  font-size: clamp(1.15rem, 3vw, 1.7rem);
  line-height: 1.3;
}
.duration {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.download-controls {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-top: 28px;
}

.option-groups {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.client-format {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  font-size: 0.82rem;
}

.format-picker {
  display: flex;
  gap: 8px;
}
.format-picker label {
  cursor: pointer;
}
.format-picker input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.format-picker span {
  display: block;
  padding: 12px 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
}
.format-picker input:checked + span {
  border-color: var(--red);
  background: rgba(255, 73, 61, 0.1);
  color: var(--ink);
}
.quality-picker {
  display: flex;
  gap: 9px;
  align-items: center;
  color: var(--muted);
  font-size: 0.82rem;
}
.quality-picker[hidden] {
  display: none;
}
.quality-picker select {
  min-height: 42px;
  padding: 0 34px 0 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  background: #101216;
  color: var(--ink);
  cursor: pointer;
}
.quality-picker select:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(255, 73, 61, 0.12);
}
.primary {
  min-height: 48px;
  background: var(--red);
  color: white;
}

.progress-card {
  margin-top: 24px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #111317;
}
.progress-labels {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.progress-labels span {
  color: var(--muted);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}
.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #2c2e33;
}
.progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--red);
  transition: width 180ms ease;
}
.progress-card p {
  overflow-wrap: anywhere;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.download-summary {
  display: flex;
  gap: 8px 18px;
  flex-wrap: wrap;
  margin-top: 13px;
  color: var(--muted);
  font-size: 0.76rem;
}

.download-summary span + span::before {
  content: "·";
  margin-right: 18px;
  color: #56585e;
}

.cancel-button {
  min-height: 40px;
  margin-top: 14px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
}

.cancel-button[hidden] {
  display: none;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  margin-top: 18px;
  color: #727370;
  font-size: 0.78rem;
}
code {
  color: var(--muted);
}
.folder-button {
  min-height: 38px;
  padding: 0 15px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
}

@media (max-width: 650px) {
  .shell {
    width: min(100% - 24px, 960px);
    padding-top: 42px;
  }
  .url-row {
    grid-template-columns: 1fr;
  }
  .url-row button {
    min-height: 50px;
  }
  .preview {
    grid-template-columns: 1fr;
  }
  .download-controls {
    align-items: stretch;
    flex-direction: column;
  }
  .option-groups {
    align-items: stretch;
    flex-direction: column;
  }
  .quality-picker {
    justify-content: space-between;
  }
  .primary {
    width: 100%;
  }
  footer {
    flex-direction: column;
    gap: 0;
  }
}
