/* Download anything — 스타일 / styles. 빌드 없음, CSS 변수로 라이트/다크 / no build, light & dark via CSS vars */
:root {
  --bg: #f4f6fb; --card: #fff; --text: #1b1f2a; --muted: #6b7280; --line: #e3e6ee;
  --accent: #4f6df5; --accent2: #8b5cf6; --ok: #16a34a; --err: #dc2626; --warn: #d97706;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f1117; --card: #171a23; --text: #e6e8ef; --muted: #9aa0ae; --line: #272b38; }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
}
.top { max-width: 820px; margin: 0 auto; padding: 28px 16px 8px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.top h1 { margin: 0; font-size: 22px; display: flex; align-items: center; gap: 10px; color: var(--accent); }
.top h1 span { color: var(--text); }
.tagline { color: var(--muted); font-size: 14px; flex: 1; }
#lang { width: auto; padding: 6px 10px; }
main { max-width: 820px; margin: 0 auto; padding: 8px 16px 64px; }
form { display: grid; gap: 16px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card h2 { margin: 0 0 6px; font-size: 17px; display: flex; align-items: center; gap: 10px; }
.num { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; display: inline-grid; place-items: center; font-size: 13px; flex-shrink: 0; }
.hint { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 18px 0 2px; }
.row { display: flex; gap: 8px; }
.row input { flex: 1; }
.indent { margin: 8px 0 0 28px; }

input, select, button { font: inherit; color: inherit; }
input:not([type=checkbox]):not([type=radio]), select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text);
}
textarea { resize: vertical; font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
input:user-invalid { border-color: var(--err); }
button { padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); cursor: pointer; white-space: nowrap; }
button:hover { border-color: var(--accent); }
button:disabled { opacity: .6; cursor: default; }
button.primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; border: 0; font-weight: 600; }
button.big { width: 100%; padding: 14px; font-size: 16px; margin-top: 14px; }
button.ghost { background: transparent; margin-top: 8px; }
button.icon { padding: 0; width: 32px; height: 32px; display: grid; place-items: center; border: 0; color: var(--muted); background: transparent; }
button.icon:hover { color: var(--text); background: var(--bg); }
button.icon svg { width: 18px; height: 18px; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-top: 12px; }
label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); align-content: start; }
label small { font-size: 12px; line-height: 1.4; }
label.check { grid-template-columns: auto 1fr; align-items: center; gap: 8px; margin-top: 14px; color: var(--text); font-size: 14px; cursor: pointer; }
label.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
label.check small { display: block; color: var(--muted); }

.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 8px; }
.mode {
  border: 1px solid var(--line); border-radius: 12px; padding: 14px; cursor: pointer; color: var(--text); font-size: 15px; font-weight: 600;
  display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; align-items: center;
}
.mode input { display: none; }
.mode:has(:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--card)); }
.mode svg { width: 28px; height: 28px; grid-row: span 2; color: var(--accent); }
.mode small { font-weight: 400; color: var(--muted); font-size: 12px; }
body[data-mode=audio] .video-only, body[data-mode=video] .audio-only { display: none; }
.hidden { display: none !important; }

.preview { display: flex; gap: 14px; margin-top: 14px; align-items: center; }
.preview img { width: 128px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; background: var(--line); flex-shrink: 0; }
.pv { min-width: 0; }
.pv strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta { color: var(--muted); font-size: 13px; }
.range { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
#plRange input { width: 80px; padding: 5px 8px; }   /* 전역 input 폭 100% 보다 우선 / beats the global 100% input width */
.range small { flex-basis: 100%; }
.error { color: var(--err); font-size: 13px; margin: 10px 0 0; white-space: pre-wrap; }
details { margin-top: 12px; }
summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.section-row { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 8px; margin-top: 8px; align-items: center; }

/* 작업 카드 / job cards */
#jobs h2 { font-size: 17px; margin: 28px 0 10px; }
.job { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px; }
.job header { display: flex; align-items: center; gap: 10px; }
.job h3 { margin: 0; flex: 1; font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill { font-size: 12px; padding: 3px 10px; border-radius: 999px; background: var(--line); white-space: nowrap; font-weight: 600; }
.pill.downloading { background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); }
.pill.converting { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }
.pill.done { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.pill.error { background: color-mix(in srgb, var(--err) 15%, transparent); color: var(--err); }
.bar { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; margin: 10px 0 6px; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); border-radius: 999px; transition: width .8s linear; }
.bar.indeterminate i { width: 30% !important; animation: slide 1.2s infinite ease-in-out; }
@keyframes slide { from { margin-left: -30%; } to { margin-left: 100%; } }
.line { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.line b { color: var(--text); }
.files { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.files li { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; min-width: 0; }
.files a { color: var(--accent); text-decoration: none; display: flex; align-items: center; gap: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files a:hover { text-decoration: underline; }
.files svg { width: 16px; height: 16px; flex-shrink: 0; }
.files span { color: var(--muted); font-size: 13px; white-space: nowrap; }
a.zip { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line); color: var(--accent); text-decoration: none; font-size: 14px; }
a.zip:hover { border-color: var(--accent); }
a.zip svg { width: 16px; height: 16px; }

.foot { margin-top: 40px; text-align: center; color: var(--muted); font-size: 13px; line-height: 1.6; }
.foot a { color: var(--accent); text-decoration: none; font-weight: 600; }
.foot a:hover { text-decoration: underline; }

/* 로그인 모달 / login modal */
dialog.card { width: min(92vw, 400px); color: var(--text); }
dialog::backdrop { background: rgba(15, 17, 23, .6); backdrop-filter: blur(3px); }
#newRows { display: grid; gap: 16px; }

@media (max-width: 600px) {
  .modes { grid-template-columns: 1fr; }
  .section-row { grid-template-columns: 1fr 1fr auto; }
  .section-row .s-title { grid-column: 1 / -1; }
  .tagline { display: none; }
}
