:root {
  --paper: #f3f5fb; --ink: #243552; --muted: #5d6d85; --violet: #5b62b0;
  --line: #dce2ef; --panel: #fff; --red: #a7354c; --soft: #ebedf8;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: "Malgun Gothic", "Apple SD Gothic Neo", sans-serif; line-height: 1.6; }
header { max-width: 1280px; margin: auto; padding: 32px 48px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { color: var(--ink); text-decoration: none; font-size: 21px; font-weight: 750; letter-spacing: -1px; }
.brand span { font-size: 12px; margin-left: 16px; color: var(--muted); font-weight: 400; letter-spacing: 0; }
main { max-width: 1280px; margin: 28px auto 60px; padding: 0 48px; display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 72px; align-items: start; }
main > *, .job > * { min-width: 0; }
.intro { position: sticky; top: 60px; padding-top: 30px; }
h1 { font-size: 64px; line-height: 1.2; letter-spacing: -4px; margin: 0 0 30px; font-weight: 750; }
.intro > p { font-size: 18px; color: var(--muted); line-height: 1.85; }
.subtitle-sample { margin-top: 55px; border-left: 3px solid var(--violet); padding: 12px 0 12px 20px; }
.subtitle-sample span { display: block; font-family: Consolas, monospace; color: var(--violet); font-size: 12px; }
.subtitle-sample strong { display: block; font-size: 15px; margin-top: 8px; font-weight: 500; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 30px 34px; box-shadow: 0 12px 40px #24355206; }
h2 { font-size: 20px; margin: 0 0 12px; letter-spacing: -.8px; }
.panel > p { color: var(--muted); }
.section-description { font-size: 14px; margin: 0; }
label { display: block; font-size: 14px; margin-bottom: 10px; }
input[type=password] { width: 100%; min-height: 48px; padding: 13px; border: 1px solid var(--line); border-radius: 9px; font-size: 16px; margin-bottom: 16px; background: var(--paper); color: var(--ink); }
button, .workspace-nav a { min-height: 44px; min-width: 44px; touch-action: manipulation; -webkit-tap-highlight-color: #5b62b020; }
button { font: inherit; font-weight: 600; cursor: pointer; background: var(--violet); color: white; border: 0; border-radius: 10px; padding: 12px 18px; transition: background .15s; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.quiet { background: transparent; color: var(--muted); padding: 10px 12px; font-size: 13px; }
.upload-action > button, form > button { width: 100%; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, pre:focus-visible, .file-zone:focus-within { outline: 3px solid #949cdb; outline-offset: 4px; }
.file-zone { position: relative; border: 1.5px dashed #aeb8d4; border-radius: 13px; background: var(--paper); padding: 30px 18px; text-align: center; cursor: pointer; margin: 22px 0 8px; }
.file-zone span { display: block; font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.file-zone small { display: block; color: var(--muted); margin-top: 8px; font-size: 12px; }
input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 16px; }
.file-zone:has(input:disabled) { opacity: .65; cursor: default; }
.file-limit { margin: 0; font-size: 12px; text-align: center; }
.check { display: flex; align-items: center; gap: 12px; min-height: 64px; margin: 18px 0 6px; cursor: pointer; }
.check strong { display: block; font-size: 14px; font-weight: 600; }
.check small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
input[type=checkbox] { accent-color: var(--violet); height: 20px; width: 20px; flex-shrink: 0; margin: 0; }
.note { font-size: 12px; line-height: 1.7; color: var(--muted); margin: 13px 0 19px; overflow-wrap: anywhere; }
video { width: 100%; max-height: 330px; border-radius: 10px; margin: 12px 0 0; background: #18213a; }
progress { width: 100%; height: 10px; accent-color: var(--violet); margin-top: 22px; }
#uploadText { font-size: 14px; color: var(--ink); margin-bottom: 6px; overflow-wrap: anywhere; }
.error { font-size: 13px; color: var(--red) !important; overflow-wrap: anywhere; }
.error:empty, #jobsSummary:empty { display: none; }
.history { margin-top: 32px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-title h2 { margin: 0; }
.muted { color: var(--muted); font-size: 13px; }
.empty { color: var(--ink); font-size: 15px; border: 1px dashed var(--line); padding: 24px 16px; text-align: center; border-radius: 12px; }
.empty span { font-size: 13px; color: var(--muted); }
.job { padding: 20px 0; border-bottom: 1px solid var(--line); }
.job-head { display: flex; gap: 12px; align-items: start; justify-content: space-between; }
.filename { font-size: 15px; font-weight: 650; overflow-wrap: anywhere; min-width: 0; margin: 0; }
.state { font-size: 12px; padding: 4px 10px; border-radius: 20px; background: var(--soft); color: var(--violet); white-space: nowrap; flex-shrink: 0; }
.state-done { background: #e5efe9; color: #366549; }
.state-failed, .state-interrupted { background: #f7e9ed; color: var(--red); }
.job-detail { font-size: 12px; color: var(--muted); margin: 6px 0 10px; overflow-wrap: anywhere; }
.downloads { display: flex; gap: 8px; flex-wrap: wrap; }
.downloads button, button.secondary { font-size: 13px; padding: 10px 12px; background: white; border: 1px solid #bec4e3; color: var(--violet); }
.downloads .primary-download { background: var(--violet); color: white; border-color: var(--violet); }
.warnings { font-size: 13px; color: #80521d; margin: 8px 0; overflow-wrap: anywhere; }
.job-error { margin: 8px 0; }
.delete { font-size: 12px !important; color: var(--muted) !important; margin-left: auto; }
.workspace-nav { display: none; }
.connection { border-left: 3px solid #aa7732; background: #fbf2e4; font-size: 13px; padding: 10px 14px; border-radius: 4px; overflow-wrap: anywhere; }
footer { max-width: 1280px; margin: auto; padding: 20px 48px calc(20px + env(safe-area-inset-bottom)); font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }
.skip-link { position: fixed; top: -100px; left: 12px; z-index: 20; padding: 12px; background: white; color: var(--ink); }
.skip-link:focus { top: 8px; }
dialog { width: min(680px, calc(100% - 32px)); max-height: calc(100dvh - 32px); color: var(--ink); background: white; border: 1px solid var(--line); border-radius: 18px; padding: 24px; overscroll-behavior: contain; }
dialog::backdrop { background: #18213a90; }
body:has(dialog[open]) { overflow: hidden; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.dialog-head h2 { margin: 0; }
.dialog-filename { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; margin: 8px 0 16px; }
#subtitleKind { width: 100%; min-height: 44px; font: inherit; font-size: 16px; color: var(--ink); background: white; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#subtitleContent { font: 15px/1.85 "Malgun Gothic", "Apple SD Gothic Neo", sans-serif; background: var(--paper); border-radius: 10px; padding: 18px; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 48dvh; overflow-y: auto; min-height: 100px; }
.dialog-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.dialog-actions > button { flex: 1; }
#saveHint { margin-bottom: 0; }
[hidden] { display: none !important; }
@media (hover: hover) {
  button:hover { background: #4a5195; }
  button.quiet:hover, .downloads button:not(.primary-download):hover, button.secondary:hover { background: var(--soft); }
  .file-zone:hover { border-color: var(--violet); }
}
@media (max-width: 960px) {
  main { grid-template-columns: 280px minmax(0, 1fr); gap: 35px; }
  h1 { font-size: 52px; }
  .panel { padding: 25px; }
  .brand span { display: none; }
}
@media (max-width: 700px) {
  header { padding: calc(16px + env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) 12px max(20px, env(safe-area-inset-left)); min-height: 72px; }
  .brand { font-size: 20px; }
  main { display: block; padding: 0 max(20px, env(safe-area-inset-right)) 0 max(20px, env(safe-area-inset-left)); margin-top: 0; margin-bottom: 32px; }
  .intro { position: static; padding-top: 12px; margin-bottom: 24px; }
  h1 { font-size: 36px; letter-spacing: -2px; margin-bottom: 12px; }
  h1 br, .intro > p br, .subtitle-sample { display: none; }
  .intro > p { font-size: 14px; margin: 0; }
  .is-unlocked .intro { display: none; }
  .workspace-nav { display: flex; position: sticky; top: 0; z-index: 5; gap: 4px; padding: 8px 0 12px; background: var(--paper); }
  .workspace-nav a { display: flex; align-items: center; justify-content: center; gap: 8px; flex: 1; color: var(--ink); text-decoration: none; font-size: 14px; font-weight: 600; border-bottom: 2px solid var(--line); }
  .workspace-nav a:first-child { border-color: var(--violet); color: var(--violet); }
  #jobCount { background: var(--soft); color: var(--violet); min-width: 22px; border-radius: 20px; font-size: 12px; padding: 0 5px; }
  .panel { padding: 22px 20px; border-radius: 16px; }
  .file-zone { padding: 28px 12px; }
  .file-zone span { font-size: 16px; }
  .upload-action { position: sticky; bottom: max(12px, env(safe-area-inset-bottom)); z-index: 2; background: white; padding: 8px 0; }
  .upload-action > button { min-height: 48px; font-size: 15px; }
  .history { margin-top: 24px; }
  .downloads { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .downloads .primary-download { grid-column: 1 / -1; }
  .downloads button { font-size: 13px; padding: 11px 8px; }
  .downloads .delete { justify-self: end; grid-column: 1 / -1; padding: 10px 12px; }
  footer { padding-left: max(20px, env(safe-area-inset-left)); padding-right: max(20px, env(safe-area-inset-right)); }
  dialog { padding: 20px; border-radius: 16px; }
  #subtitleContent { padding: 14px; }
  .dialog-actions { flex-direction: column; }
}
@media (max-width: 360px) {
  header { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  main { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .panel { padding: 20px 16px; }
  h1 { font-size: 32px; }
  .job-head { flex-direction: column-reverse; gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
