:root {
  color-scheme: dark;
  --bg: #0a0a0c;
  --surface: #121216;
  --surface-2: #19191f;
  --line: #2a2a32;
  --text: #f7f7f8;
  --muted: #a5a5af;
  --accent: #ff4040;
  --accent-2: #ff6a4d;
  --success: #63dc9a;
  --danger: #ff7a7a;
  font-family: Inter, Pretendard, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 72% -10%, rgba(255, 64, 64, .16), transparent 34rem),
    radial-gradient(circle at 8% 40%, rgba(255, 106, 77, .06), transparent 30rem),
    var(--bg);
}
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .55; }
a { color: inherit; text-decoration: none; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.site-header {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.brand-lockup { display: inline-flex; align-items: center; gap: 11px; font-weight: 760; letter-spacing: -.02em; }
.brand-mark {
  width: 34px; height: 25px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-radius: 8px;
  box-shadow: 0 10px 28px rgba(255,64,64,.24);
}
.brand-mark span {
  display: block; width: 0; height: 0; margin-left: 2px;
  border-top: 5px solid transparent; border-bottom: 5px solid transparent; border-left: 8px solid white;
}
.header-actions { display: flex; align-items: center; gap: 18px; }
.text-button { border: 0; background: transparent; color: var(--muted); padding: 8px 0; font-size: 13px; }
.text-button:hover { color: var(--text); }

.page-shell { width: min(920px, calc(100% - 40px)); margin: 0 auto; }
.hero { padding: 64px 0 30px; text-align: center; }
.hero h1, .login-card h1 { margin: 0; letter-spacing: -.06em; line-height: .98; }
.hero h1 { font-size: clamp(38px, 6vw, 58px); }

.download-panel {
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: clamp(22px, 4vw, 42px);
  background: linear-gradient(180deg, rgba(24,24,29,.96), rgba(16,16,20,.96));
  box-shadow: 0 30px 90px rgba(0,0,0,.34);
}
.url-form label, .format-fieldset legend, .login-form label { display: block; margin-bottom: 11px; color: #d6d6dc; font-size: 13px; font-weight: 700; }
.url-row, .password-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
input[type="url"], input[type="password"] {
  width: 100%; min-width: 0; height: 54px; border: 1px solid #35353e; border-radius: 14px;
  outline: none; padding: 0 17px; color: var(--text); background: #0d0d10; transition: border-color .2s, box-shadow .2s;
}
input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(255,64,64,.11); }
.primary-button {
  height: 54px; border: 0; border-radius: 14px; padding: 0 22px; color: white; font-weight: 780;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 12px 26px rgba(255,64,64,.18);
}
.primary-button:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1px); }
.form-message { min-height: 21px; margin: 10px 2px 0; color: var(--muted); font-size: 13px; }
.form-message[data-kind="error"] { color: var(--danger); }
.form-message[data-kind="success"] { color: var(--success); }

.video-card { display: grid; grid-template-columns: 176px 1fr; gap: 20px; align-items: center; margin-top: 24px; padding: 15px; border: 1px solid var(--line); border-radius: 18px; background: #0d0d10; }
.thumbnail-wrap { position: relative; aspect-ratio: 16/9; overflow: hidden; border-radius: 11px; background: #202028; }
.thumbnail-wrap img { width: 100%; height: 100%; display: block; object-fit: cover; }
.duration { position: absolute; right: 7px; bottom: 7px; border-radius: 5px; padding: 3px 6px; color: white; background: rgba(0,0,0,.8); font-size: 11px; }
.video-channel { margin: 0 0 7px; color: var(--accent-2); font-size: 12px; font-weight: 700; }
.video-details h3 { margin: 0; font-size: 18px; letter-spacing: -.025em; line-height: 1.4; overflow-wrap: anywhere; }

.format-fieldset { margin: 28px 0 0; padding: 0; border: 0; }
.format-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.format-option { position: relative; display: flex; align-items: center; min-height: 92px; padding: 18px; border: 1px solid var(--line); border-radius: 17px; background: #111115; cursor: pointer; transition: .2s; }
.format-option:hover { border-color: #484851; }
.format-option input { position: absolute; opacity: 0; pointer-events: none; }
.format-option:has(input:checked) { border-color: var(--accent); background: rgba(255,64,64,.06); box-shadow: inset 0 0 0 1px rgba(255,64,64,.25); }
.format-copy { display: flex; flex-direction: column; gap: 6px; }
.format-copy strong { font-size: 20px; }
.format-copy small { color: var(--muted); }
.radio-check { margin-left: auto; width: 20px; height: 20px; border: 1px solid #555560; border-radius: 50%; }
.format-option:has(input:checked) .radio-check { border: 6px solid var(--accent); }
.download-button {
  width: 100%; min-height: 62px; margin-top: 16px; border: 0; border-radius: 17px; padding: 0 22px;
  display: flex; align-items: center; justify-content: space-between; color: white; background: #f33b3b;
  font-size: 16px; font-weight: 800; box-shadow: 0 16px 36px rgba(243,59,59,.2);
}
.download-button:hover:not(:disabled) { background: #ff4848; }
.download-button span:last-child { font-size: 25px; font-weight: 400; }
.job-status { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 20px; }
.job-copy { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 10px; font-size: 13px; }
.job-copy span { color: var(--muted); }
.progress-track { height: 8px; overflow: hidden; border-radius: 999px; background: #2a2a31; }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .35s ease; }
.job-status p { margin: 10px 0 0; color: var(--muted); font-size: 13px; }
.job-status[data-state="failed"] strong, .job-status[data-state="failed"] p { color: var(--danger); }
.job-status[data-state="ready"] strong, .job-status[data-state="ready"] p { color: var(--success); }

.login-page { display: grid; place-items: center; padding: 30px; }
.login-shell { width: min(520px, 100%); }
.login-card { border: 1px solid var(--line); border-radius: 28px; padding: clamp(28px, 6vw, 48px); background: rgba(18,18,22,.96); box-shadow: 0 30px 100px rgba(0,0,0,.42); }
.login-card .brand-lockup { margin-bottom: 42px; }
.login-card h1 { font-size: clamp(40px, 10vw, 58px); }
.login-card h1 { margin-bottom: 30px; }
.login-form .password-row { grid-template-columns: 1fr; }
.login-form .primary-button { margin-top: 2px; }

@media (max-width: 680px) {
  .site-header, .page-shell { width: min(100% - 28px, 920px); }
  .site-header { min-height: 70px; }
  .hero { padding: 42px 0 24px; text-align: left; }
  .hero h1 { font-size: clamp(36px, 12vw, 52px); }
  .download-panel { border-radius: 22px; }
  .url-row { grid-template-columns: 1fr; }
  .video-card { grid-template-columns: 118px 1fr; gap: 14px; }
  .video-details h3 { font-size: 15px; }
  .format-grid { grid-template-columns: 1fr; }
  .format-option { min-height: 82px; }
}

@media (prefers-reduced-motion: no-preference) {
  .primary-button, .download-button, .format-option { transition: transform .18s ease, filter .18s ease, border-color .18s ease, background .18s ease; }
}
