/* ============================================================
   영상 자막 작업실 — 화면 스타일
   큰 글씨 · 높은 대비 · 절제된 포인트 컬러 · 라이트/다크 대응
   ============================================================ */
:root {
  color-scheme: dark;
  --bg: #0b0c11;
  --bg-glow: rgba(124, 116, 255, 0.16);
  --surface: #14161e;
  --surface-2: #1b1e28;
  --surface-3: #222633;
  --line: #292e3d;
  --line-strong: #3a4154;
  --text: #f3f5fa;
  --text-dim: #a3aabf;
  --text-faint: #8b92a6;
  --accent: #8f8bff;
  --accent-strong: #a9a5ff;
  --accent-deep: #6157f5;
  --accent-soft: rgba(143, 139, 255, 0.16);
  --accent-line: rgba(143, 139, 255, 0.45);
  --ok: #3fd68c;
  --ok-soft: rgba(63, 214, 140, 0.15);
  --err: #ff7a7a;
  --err-soft: rgba(255, 122, 122, 0.15);
  --warn: #f0b45f;
  --radius-xl: 26px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-lg: 0 22px 60px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.28);
}
@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #f3f4f9;
    --bg-glow: rgba(79, 70, 229, 0.13);
    --surface: #ffffff;
    --surface-2: #f7f8fc;
    --surface-3: #eef0f7;
    --line: #e2e5ef;
    --line-strong: #cdd2e0;
    --text: #13151d;
    --text-dim: #545b70;
    --text-faint: #626a7e;
    --accent: #4f46e5;
    --accent-strong: #3f37cf;
    --accent-deep: #4338ca;
    --accent-soft: rgba(79, 70, 229, 0.10);
    --accent-line: rgba(79, 70, 229, 0.4);
    --ok: #0f8f5f;
    --ok-soft: rgba(15, 143, 95, 0.12);
    --err: #cf3232;
    --err-soft: rgba(207, 50, 50, 0.10);
    --warn: #a86308;
    --shadow-lg: 0 20px 50px rgba(24, 30, 60, 0.10);
    --shadow-md: 0 8px 24px rgba(24, 30, 60, 0.07);
  }
}
* {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  background-image:
    radial-gradient(900px 480px at 12% -8%, var(--bg-glow), transparent 62%),
    radial-gradient(760px 420px at 92% 4%, var(--bg-glow), transparent 60%);
  background-attachment: fixed;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard",
    "Noto Sans KR", "Malgun Gothic", system-ui, "Segoe UI", sans-serif;
  font-size: 18px;
  line-height: 1.65;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
}
h1,
h2,
h3 {
  margin: 0;
  line-height: 1.35;
  letter-spacing: -0.02em;
}
p {
  margin: 0;
}
button {
  font: inherit;
  letter-spacing: -0.01em;
}
b {
  font-weight: 700;
  color: var(--text);
}

/* ── 상단 바 ─────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(150%) blur(14px);
  -webkit-backdrop-filter: saturate(150%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.brand-mark {
  flex: none;
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border-radius: 16px;
  color: #fff;
  background: linear-gradient(140deg, var(--accent-deep), var(--accent));
  box-shadow: 0 10px 24px var(--accent-soft);
}
.brand-text h1 {
  font-size: 23px;
  font-weight: 800;
}
.brand-text p {
  margin-top: 2px;
  font-size: 16px;
  color: var(--text-dim);
}
.topbar-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-dim);
  white-space: nowrap;
}
.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-faint);
  flex: none;
}
.dot.online {
  background: var(--ok);
  box-shadow: 0 0 0 4px var(--ok-soft);
}
.dot.offline {
  background: var(--err);
  box-shadow: 0 0 0 4px var(--err-soft);
}

/* ── 레이아웃 ─────────────────────────────────────────────── */
.layout {
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 24px 80px;
  display: grid;
  gap: 26px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 30px 32px;
  box-shadow: var(--shadow-lg);
}
.card h2 {
  font-size: 25px;
  font-weight: 800;
}

/* ── 입력 카드 ─────────────────────────────────────────────── */
.hero {
  display: grid;
  gap: 24px;
}
.hero-copy {
  display: grid;
  gap: 10px;
}
.hero-copy .lead {
  font-size: 19px;
  color: var(--text-dim);
  max-width: 62ch;
}
.hero-copy .lead b {
  color: var(--text);
  font-weight: 700;
}
#job-form {
  display: grid;
  gap: 20px;
}
.field {
  display: grid;
  gap: 9px;
}
.field label {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}
input[type="url"],
input[type="password"],
input[type="text"] {
  width: 100%;
  padding: 19px 22px;
  border-radius: var(--radius-lg);
  border: 2px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 20px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
input::placeholder {
  color: var(--text-faint);
}
input:hover {
  border-color: var(--accent-line);
}
input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 5px var(--accent-soft);
}
.hint {
  font-size: 16px;
  color: var(--text-dim);
}
button {
  cursor: pointer;
  border-radius: var(--radius-lg);
  border: 1px solid transparent;
  transition: transform 0.15s ease, filter 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}
button.primary {
  width: 100%;
  min-height: 66px;
  padding: 16px 28px;
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--accent-deep), var(--accent));
  box-shadow: 0 14px 32px var(--accent-soft);
}
button.primary:hover:not(:disabled) {
  filter: brightness(1.07);
  transform: translateY(-1px);
}
button.primary:active:not(:disabled) {
  transform: translateY(0);
}
button.ghost {
  padding: 10px 18px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-dim);
  background: var(--surface-2);
  border-color: var(--line);
}
button.ghost:hover {
  color: var(--text);
  border-color: var(--line-strong);
  background: var(--surface-3);
}
.form-message {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-dim);
  min-height: 1.4em;
}
.form-message.error {
  color: var(--err);
}
.form-message.success {
  color: var(--ok);
}

/* ── 토큰 설정 (접힘) ─────────────────────────────────────── */
.token {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
.token summary {
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-faint);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}
.token summary::-webkit-details-marker {
  display: none;
}
.token summary::before {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.2s ease;
}
.token[open] summary::before {
  transform: rotate(45deg);
}
.token summary:hover {
  color: var(--text-dim);
}
.token[open] summary {
  margin-bottom: 16px;
}
.token .field {
  max-width: 560px;
}

/* ── 작업 목록 ─────────────────────────────────────────────── */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.job-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 18px;
}

/* 빈 상태 */
.empty {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 38px 24px;
  text-align: center;
  background: var(--surface-2);
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius-xl);
}
.empty[hidden] {
  display: none;
}
.empty-mark {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border-radius: 20px;
  color: var(--accent);
  background: var(--accent-soft);
}
.empty-title {
  font-size: 21px;
  font-weight: 800;
}
.empty-text {
  font-size: 17px;
  color: var(--text-dim);
  max-width: 46ch;
}
.empty-steps {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}
.empty-steps li {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-dim);
}
.empty-num {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 15px;
  font-weight: 800;
}

/* ── 작업 카드 ─────────────────────────────────────────────── */
.job {
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface-2);
  padding: 24px 26px;
  display: grid;
  gap: 16px;
}
.job-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.job-title {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}
.job-name {
  font-size: 20px;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.job-time {
  font-size: 15px;
  color: var(--text-faint);
  white-space: nowrap;
}
.job-url {
  font-size: 15px;
  color: var(--text-faint);
  overflow-wrap: anywhere;
}
.badge {
  flex: none;
  font-size: 15px;
  font-weight: 700;
  padding: 5px 13px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-line);
  white-space: nowrap;
}
.badge.done {
  background: var(--ok-soft);
  color: var(--ok);
  border-color: transparent;
}
.badge.error {
  background: var(--err-soft);
  color: var(--err);
  border-color: transparent;
}

/* 단계 표시 */
.stages {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 8px;
}
.stage {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 7px 14px 7px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-dim);
  font-size: 16px;
  font-weight: 600;
}
.stage-marker {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--text-faint);
  font-size: 14px;
  font-weight: 800;
  flex: none;
}
.stage.done {
  color: var(--text);
  border-color: var(--ok-soft);
}
.stage.done .stage-marker {
  background: var(--ok-soft);
  color: var(--ok);
}
.stage.active {
  color: var(--text);
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.stage.active .stage-marker {
  background: var(--accent);
  color: #fff;
}
.stage.failed {
  color: var(--err);
  border-color: var(--err);
  background: var(--err-soft);
}
.stage.failed .stage-marker {
  background: var(--err);
  color: #fff;
}

/* 진행률 */
.progress-row {
  display: flex;
  align-items: center;
  gap: 14px;
}
.progress {
  flex: 1;
  height: 14px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-deep), var(--accent));
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.progress-bar.done {
  background: linear-gradient(90deg, #2bb877, var(--ok));
}
.progress-bar.error {
  background: linear-gradient(90deg, #d95b5b, var(--err));
}
.progress-value {
  min-width: 58px;
  text-align: right;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.job-message {
  font-size: 17px;
  color: var(--text-dim);
}
.job-message.error {
  color: var(--err);
  font-weight: 600;
}

/* ── 결과 ─────────────────────────────────────────────── */
.result {
  border-top: 1px dashed var(--line);
  padding-top: 20px;
  display: grid;
  gap: 16px;
}
.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px 22px;
  margin: 0;
}
.result-grid div {
  display: grid;
  gap: 3px;
}
.result-grid dt {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-faint);
}
.result-grid dd {
  margin: 0;
  font-size: 17px;
  overflow-wrap: anywhere;
}
.warnings {
  margin: 4px 0 0;
  padding-left: 20px;
  font-size: 16px;
  color: var(--warn);
}

/* 다운로드 영역 */
.downloads {
  display: grid;
  gap: 14px;
}
.download-primary {
  display: grid;
  gap: 4px;
  justify-items: center;
  text-align: center;
  width: 100%;
  min-height: 92px;
  padding: 18px 24px;
  border: none;
  border-radius: var(--radius-lg);
  color: #fff;
  background: linear-gradient(135deg, var(--accent-deep), var(--accent));
  box-shadow: 0 16px 34px var(--accent-soft);
}
.download-primary:hover {
  filter: brightness(1.07);
  transform: translateY(-1px);
}
.download-primary:active {
  transform: translateY(0);
}
.download-primary-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.download-primary-sub {
  font-size: 16px;
  font-weight: 600;
  opacity: 0.92;
}
.downloads-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-faint);
}
.downloads-more {
  display: grid;
  gap: 8px;
}
.download-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  text-decoration: none;
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
}
.download-link:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.download-link .tag {
  font-size: 15px;
  color: var(--text-faint);
  white-space: nowrap;
}

/* ── 반응형 ─────────────────────────────────────────────── */
@media (max-width: 860px) {
  .layout {
    padding: 26px 18px 64px;
  }
  .card {
    padding: 24px 22px;
    border-radius: var(--radius-lg);
  }
  .job {
    padding: 20px;
  }
}
@media (max-width: 560px) {
  body {
    font-size: 18px;
  }
  .topbar-inner {
    padding: 14px 16px;
  }
  .brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 14px;
  }
  .brand-text h1 {
    font-size: 20px;
  }
  .brand-text p {
    font-size: 15px;
  }
  .layout {
    padding: 20px 14px 56px;
    gap: 20px;
  }
  .card {
    padding: 20px 16px;
  }
  .card h2 {
    font-size: 21px;
  }
  input[type="url"],
  input[type="password"],
  input[type="text"] {
    padding: 16px 16px;
    font-size: 18px;
  }
  button.primary {
    min-height: 60px;
    font-size: 20px;
  }
  .download-primary-title {
    font-size: 22px;
  }
  .job-name {
    font-size: 19px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
}