@font-face {
  font-family: "Outfit";
  src: url("/static/fonts/Outfit.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #10110f;
  --elev: #1b1d18;
  --elev-2: #23261f;
  --line: rgba(244, 236, 220, 0.12);
  --text: #f4f0e6;
  --muted: #a39e92;
  --faint: #6f6b62;
  --accent: #ef8b3a;
  --accent-2: #f2c14e;
  --ink: #1a1208;
  --danger: #e36d5d;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Outfit", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(900px 420px at 50% -12%, rgba(239, 139, 58, 0.18), transparent 60%),
    var(--bg);
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

.page {
  width: min(920px, calc(100% - 32px));
  margin: 0 auto;
  padding: 36px 0 72px;
}

.top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

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

.mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background:
    linear-gradient(160deg, var(--accent-2), var(--accent));
  position: relative;
  flex: none;
  box-shadow: 0 8px 24px rgba(239, 139, 58, 0.28);
}

.mark::after {
  content: "";
  position: absolute;
  left: 16px;
  top: 12px;
  border-style: solid;
  border-width: 9px 0 9px 14px;
  border-color: transparent transparent transparent var(--ink);
}

h1 {
  margin: 0;
  font-size: 40px;
  line-height: 0.95;
  letter-spacing: -0.045em;
  font-weight: 620;
}

#tagline,
.hint,
.foot,
.versions,
#channel,
#status-extra {
  color: var(--muted);
}

#tagline {
  margin: 6px 0 0;
  font-size: 15px;
  line-height: 1.4;
  max-width: 46ch;
}

.lang {
  display: flex;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
}

.lang button {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.04em;
}

.lang button.is-active {
  background: var(--text);
  color: var(--bg);
}

.banner {
  margin: 22px 0 0;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(242, 193, 78, 0.4);
  background: rgba(239, 139, 58, 0.1);
  color: #f6e2c2;
  font-size: 14px;
  line-height: 1.45;
}

.lookup {
  margin-top: 28px;
}

#url-label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 650;
}

.lookup-row {
  display: flex;
  gap: 10px;
}

#url,
#password {
  flex: 1;
  min-width: 0;
  height: 58px;
  padding: 0 18px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--elev);
  outline: none;
  font-size: 16px;
}

#url::placeholder {
  color: var(--faint);
}

#url:focus,
#password:focus {
  border-color: rgba(239, 139, 58, 0.8);
  box-shadow: 0 0 0 4px rgba(239, 139, 58, 0.15);
}

#password-label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 650;
}

#fetch,
.download,
.save-link {
  border: 0;
  border-radius: 16px;
  background: linear-gradient(180deg, #f2a04e, var(--accent));
  color: var(--ink);
  font-weight: 680;
}

#fetch {
  height: 58px;
  padding: 0 22px;
  flex: none;
}

#fetch:disabled,
.download:disabled {
  opacity: 0.55;
  cursor: progress;
}

.hint {
  margin: 10px 2px 0;
  font-size: 14px;
}

.error {
  margin: 10px 2px 0;
  color: var(--danger);
  font-size: 15px;
  line-height: 1.45;
}

.result {
  margin-top: 22px;
  padding: 18px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: rgba(27, 29, 24, 0.92);
  box-shadow: var(--shadow);
}

.preview {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 18px;
  align-items: center;
}

.thumb-wrap {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: #0c0d0b;
  aspect-ratio: 16 / 9;
}

#thumb {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.duration {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 3px 7px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.72);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.02em;
}

#video-title {
  margin: 0;
  font-size: 30px;
  line-height: 1.12;
  letter-spacing: -0.035em;
  font-weight: 620;
  overflow-wrap: anywhere;
}

#channel {
  margin: 8px 0 0;
  font-size: 15px;
}

.kinds {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 18px;
  padding: 4px;
  border-radius: 14px;
  background: #12130f;
}

.kinds button {
  height: 42px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  font-weight: 650;
}

.kinds button[aria-selected="true"] {
  background: var(--elev-2);
  color: var(--text);
}

.kinds button:disabled {
  opacity: 0.4;
}

.choices {
  display: grid;
  gap: 6px;
  margin-top: 14px;
}

.choice {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: transparent;
}

.choice:hover {
  background: rgba(255, 255, 255, 0.03);
}

.choice[aria-checked="true"] {
  background: rgba(239, 139, 58, 0.12);
  border-color: rgba(239, 139, 58, 0.45);
}

.choice .dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #8d877c;
  box-sizing: border-box;
}

.choice[aria-checked="true"] .dot {
  border-color: var(--accent);
  background:
    radial-gradient(circle, var(--accent) 0 4px, transparent 5px);
}

.choice .label {
  font-weight: 600;
}

.choice .size {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 14px;
}

.choice:disabled {
  opacity: 0.55;
}

.download {
  width: 100%;
  height: 54px;
  margin-top: 16px;
  font-size: 17px;
  letter-spacing: -0.01em;
}

.progress {
  margin-top: 16px;
}

.progress-copy {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

#status-line {
  margin: 0;
  font-weight: 620;
}

#status-extra {
  margin: 0;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.bar {
  margin-top: 10px;
  height: 8px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.bar > span {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.bar.indeterminate > span {
  width: 36%;
  animation: slide 1.1s ease-in-out infinite;
}

.save-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 14px;
  padding: 10px 14px;
  text-decoration: none;
}

details {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 8px 0 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
}

.foot {
  margin-top: 28px;
  font-size: 13px;
  line-height: 1.5;
}

.versions {
  margin-top: 4px;
  color: var(--faint);
}

.logout {
  margin-top: 12px;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0;
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

@media (max-width: 700px) {
  .page {
    width: min(100% - 28px, 920px);
    padding-top: 22px;
  }

  h1 {
    font-size: 34px;
  }

  .top {
    align-items: center;
  }

  .lookup-row {
    flex-direction: column;
  }

  #fetch,
  .download {
    width: 100%;
  }

  .preview {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  #video-title {
    font-size: 24px;
  }

  .progress-copy {
    flex-direction: column;
    gap: 2px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bar.indeterminate > span {
    animation: none;
    width: 100%;
    opacity: 0.45;
  }
}

@keyframes slide {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}
