@font-face {
  font-family: "Pretendard Variable";
  src: url("../fonts/PretendardVariable.woff2") format("woff2-variations");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #090a0d;
  --surface: rgba(20, 22, 28, 0.82);
  --surface-solid: #15171d;
  --surface-raised: #1b1e26;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #f4f5f8;
  --muted: #9b9faa;
  --dim: #6f7480;
  --accent: #7585ff;
  --accent-bright: #9ba6ff;
  --accent-dark: #5262dd;
  --success: #61d6a6;
  --warning: #f4c86d;
  --danger: #ff7b88;
  --radius: 18px;
  --radius-small: 12px;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
}

* { box-sizing: border-box; }

html { background: var(--bg); scroll-behavior: smooth; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 50% -20%, rgba(90, 104, 230, 0.15), transparent 42%),
    linear-gradient(180deg, #0d0e13 0%, var(--bg) 38%);
  color: var(--text);
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

button:focus-visible,
a:focus-visible,
input:focus-visible,
label:has(input:focus-visible) {
  outline: 3px solid rgba(155, 166, 255, 0.72);
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  left: 16px;
  top: -80px;
  z-index: 100;
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--text);
  color: #101116;
  text-decoration: none;
}
.skip-link:focus { top: 16px; }

.shell { width: min(1160px, calc(100% - 40px)); margin-inline: auto; }

.ambient {
  position: fixed;
  z-index: -1;
  border-radius: 999px;
  filter: blur(100px);
  opacity: 0.18;
  pointer-events: none;
}
.ambient-one { width: 340px; height: 340px; top: 100px; left: -180px; background: #4e5fff; }
.ambient-two { width: 280px; height: 280px; top: 520px; right: -170px; background: #8f5fff; }

.topbar {
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(155, 166, 255, 0.34);
  border-radius: 11px;
  background: linear-gradient(145deg, rgba(117, 133, 255, 0.22), rgba(117, 133, 255, 0.04));
  color: var(--accent-bright);
  font-weight: 800;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.08);
}
.brand > span:last-child { display: grid; line-height: 1.1; }
.brand strong { font-size: 17px; letter-spacing: -0.02em; }
.brand small { margin-top: 5px; color: var(--dim); font-size: 9px; font-weight: 700; letter-spacing: 0.16em; }

.account { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }
.account form { margin: 0 0 0 8px; }
.account-dot { width: 7px; height: 7px; border-radius: 99px; background: var(--success); box-shadow: 0 0 12px rgba(97, 214, 166, 0.7); }

.button {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  font-weight: 650;
  transition: background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
}
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: 0.45; }
.button-quiet { background: rgba(255, 255, 255, 0.035); border-color: var(--line); color: #c7cad2; }
.button-quiet:hover:not(:disabled) { background: rgba(255, 255, 255, 0.07); border-color: var(--line-strong); }
.button-primary {
  background: linear-gradient(135deg, var(--accent), #6776ed);
  box-shadow: 0 12px 32px rgba(82, 98, 221, 0.23), inset 0 1px rgba(255,255,255,.22);
}
.button-primary:hover:not(:disabled) { background: linear-gradient(135deg, #8794ff, #6d7cf2); }
.button-danger { color: #ffabb3; background: rgba(255, 123, 136, 0.07); border-color: rgba(255, 123, 136, 0.18); }

.workspace { padding-block: 52px 80px; }
.workspace-heading { margin-bottom: 28px; }
.workspace-heading h1 { margin: 0; font-size: clamp(31px, 4.8vw, 56px); line-height: 1.08; letter-spacing: -0.045em; }
.kicker { margin: 0; color: var(--accent-bright); font-size: 11px; font-weight: 750; letter-spacing: 0.14em; }

.quota-panel,
.upload-panel,
.jobs-panel,
.policy-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}
.quota-panel { margin-bottom: 18px; padding: 24px 26px; }
.upload-panel, .jobs-panel { margin-bottom: 22px; padding: clamp(22px, 4vw, 36px); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.section-heading h2, .dialog-heading h2 { margin: 5px 0 0; font-size: clamp(22px, 3vw, 28px); line-height: 1.2; letter-spacing: -0.03em; }
.section-heading > p, .quota-summary { margin: 0; color: var(--muted); font-size: 13px; }
.compact-heading { margin-bottom: 15px; }

.meter { height: 7px; overflow: hidden; border-radius: 99px; background: rgba(255, 255, 255, 0.07); }
.meter span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent-dark), var(--accent-bright)); transition: width 240ms ease; }
.meter.warning span { background: linear-gradient(90deg, #bd8744, var(--warning)); }
.meter.full span { background: linear-gradient(90deg, #c34f5c, var(--danger)); }
.quota-meta { display: flex; gap: 24px; margin-top: 12px; color: var(--dim); font-size: 12px; }
.quota-meta strong { color: #d9dbe2; font-weight: 600; }

.drop-zone {
  position: relative;
  min-height: 230px;
  padding: 34px;
  display: grid;
  place-items: center;
  text-align: center;
  border: 1px dashed rgba(155, 166, 255, 0.32);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(117, 133, 255, 0.07), rgba(255, 255, 255, 0.014));
  transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
}
.drop-zone.is-dragging { border-color: var(--accent-bright); background: rgba(117, 133, 255, 0.12); transform: scale(1.005); }
.drop-icon { width: 50px; height: 50px; margin: 0 auto 16px; display: grid; place-items: center; border: 1px solid rgba(155, 166, 255, 0.2); border-radius: 15px; background: rgba(117, 133, 255, 0.08); }
.drop-icon::before { content: "↑"; color: var(--accent-bright); font-size: 24px; font-weight: 300; }
.drop-zone strong { font-size: 18px; }
.drop-zone p { margin: 7px 0 5px; color: var(--muted); }
.drop-zone small { color: var(--dim); }
.file-link { min-height: 44px; display: inline-flex; align-items: center; color: var(--accent-bright); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.file-summary { width: min(560px, 100%); grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 15px; padding: 16px; text-align: left; border: 1px solid var(--line); border-radius: 14px; background: rgba(7, 8, 12, 0.6); }
.file-summary:not([hidden]) { display: grid; }
.file-summary > span:nth-child(2) { min-width: 0; display: grid; }
.file-summary strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-summary small { margin-top: 3px; color: var(--muted); }
.file-badge { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 11px; background: rgba(117, 133, 255, 0.12); color: var(--accent-bright); font-size: 10px; font-weight: 800; letter-spacing: .08em; }
.icon-button { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255, 255, 255, 0.035); color: var(--muted); cursor: pointer; font-size: 22px; }
.icon-button:hover { color: var(--text); background: rgba(255, 255, 255, 0.07); }

fieldset { min-width: 0; padding: 0; margin: 28px 0 0; border: 0; }
legend { margin-bottom: 12px; color: #dfe1e8; font-size: 14px; font-weight: 650; }
.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mode-card { position: relative; display: block; cursor: pointer; }
.mode-card input { position: absolute; opacity: 0; pointer-events: none; }
.mode-body { min-height: 134px; display: flex; flex-direction: column; padding: 19px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255, 255, 255, 0.022); transition: border-color 160ms ease, background-color 160ms ease; }
.mode-card input:checked + .mode-body { border-color: rgba(155, 166, 255, 0.65); background: rgba(117, 133, 255, 0.09); box-shadow: inset 0 0 0 1px rgba(117, 133, 255, 0.12); }
.mode-card input:disabled + .mode-body { cursor: not-allowed; opacity: 0.48; }
.mode-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.mode-top strong { font-size: 17px; }
.mode-top em { padding: 3px 7px; border-radius: 99px; background: rgba(117, 133, 255, 0.13); color: var(--accent-bright); font-size: 10px; font-style: normal; font-weight: 700; }
.mode-desc { margin-top: 4px; color: var(--dim); font-size: 12px; }

.segmented { width: fit-content; display: flex; padding: 3px; border: 1px solid var(--line); border-radius: 12px; background: rgba(6, 7, 10, 0.42); }
.segmented label { position: relative; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; }
.segmented span { min-height: 40px; padding: 0 15px; display: flex; align-items: center; gap: 7px; border-radius: 9px; color: var(--muted); font-size: 13px; }
.segmented input:checked + span { background: var(--surface-raised); color: var(--text); box-shadow: 0 2px 10px rgba(0,0,0,.25); }
.segmented small { color: var(--accent-bright); font-size: 10px; }

.rights-check { margin: 28px 0 18px; padding: 15px; display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); cursor: pointer; font-size: 13px; }
.rights-check input { width: 19px; height: 19px; flex: 0 0 auto; margin: 1px 0 0; accent-color: var(--accent); }
#upload-submit { width: 100%; min-height: 54px; }
.form-error { margin: 0 0 14px; padding: 12px 14px; border: 1px solid rgba(255, 123, 136, .2); border-radius: 10px; background: rgba(255, 123, 136, .07); color: #ffb0b8; font-size: 13px; }
.upload-progress { margin: 0 0 16px; padding: 15px; border-radius: 12px; background: rgba(117, 133, 255, 0.055); }
.upload-progress > div:first-child { display: flex; justify-content: space-between; margin-bottom: 10px; color: #dfe1e8; font-size: 13px; }
.upload-progress p { margin: 9px 0 0; color: var(--dim); font-size: 11px; }

.jobs-status { padding: 28px; border: 1px dashed var(--line); border-radius: 14px; color: var(--dim); text-align: center; }
.jobs-list { display: grid; gap: 12px; }
.job-card { display: grid; grid-template-columns: 140px minmax(0, 1fr) auto; gap: 18px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 15px; background: rgba(255, 255, 255, 0.018); }
.job-thumb { position: relative; height: 82px; overflow: hidden; border-radius: 10px; background: linear-gradient(145deg, #232631, #111217); }
.job-thumb video { width: 100%; height: 100%; object-fit: cover; }
.job-thumb::after { content: ""; position: absolute; inset: 0; border: 1px solid rgba(255,255,255,.06); border-radius: inherit; pointer-events: none; }
.job-info { min-width: 0; }
.job-info h3 { margin: 0 0 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.job-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 0; color: var(--dim); font-size: 11px; }
.job-meta span { position: relative; }
.job-meta span + span::before { content: "·"; position: absolute; left: -8px; color: #4e515b; }
.job-status-line { margin-top: 11px; display: flex; align-items: center; gap: 10px; }
.state-pill { padding: 3px 8px; border-radius: 99px; background: rgba(117,133,255,.1); color: #b8c0ff; font-size: 10px; font-weight: 750; letter-spacing: .04em; }
.state-pill.ready { background: rgba(97,214,166,.09); color: #8ae1bc; }
.state-pill.failed, .state-pill.canceled { background: rgba(255,123,136,.08); color: #ffabb3; }
.job-progress { width: min(180px, 40%); height: 4px; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.06); }
.job-progress span { display: block; height: 100%; background: var(--accent); }
.job-progress-copy { color: var(--muted); font-size: 11px; }
.job-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; max-width: 245px; }
.job-actions .button { min-height: 40px; padding-inline: 12px; font-size: 12px; }

.policy-panel { display: flex; flex-wrap: wrap; gap: 10px 24px; padding: 18px 30px; color: var(--muted); font-size: 13px; }
.policy-panel p { margin: 0; }
.policy-fact { color: #dfe1e8; font-weight: 650; }
.storage-warning { color: var(--warning); }

.preview-dialog { width: min(1080px, calc(100% - 28px)); max-height: calc(100vh - 28px); padding: 24px; overflow: auto; border: 1px solid var(--line-strong); border-radius: 18px; background: #12141a; color: var(--text); box-shadow: 0 30px 120px #000; }
.preview-dialog::backdrop { background: rgba(0, 0, 0, .78); backdrop-filter: blur(8px); }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.comparison-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.comparison-grid figure { margin: 0; }
.comparison-grid video { width: 100%; min-height: 260px; max-height: 64vh; display: block; object-fit: contain; border-radius: 12px; background: #050609; }
.comparison-grid figcaption { padding-top: 8px; color: var(--muted); font-size: 12px; text-align: center; }

.error-page { display: grid; place-items: center; padding: 24px; }
.error-card { width: min(500px, 100%); padding: 34px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.error-card .kicker { margin-top: 50px; }
.error-card h1 { margin: 8px 0; font-size: 34px; }
.error-card > p:not(.kicker) { margin: 0 0 28px; color: var(--muted); }

.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(470px, 100%); padding: clamp(28px, 6vw, 42px); border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); backdrop-filter: blur(24px); }
.auth-brand { margin-bottom: 48px; }
.auth-card h1 { margin: 8px 0 10px; font-size: clamp(30px, 8vw, 42px); line-height: 1.12; letter-spacing: -.04em; }
.auth-form { display: grid; gap: 10px; }
.auth-form label { color: #dfe1e8; font-size: 13px; font-weight: 650; }
.auth-form input[type="password"] { width: 100%; min-height: 50px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 11px; background: rgba(5, 6, 9, .64); color: var(--text); }
.auth-form .button { margin-top: 5px; }

@media (max-width: 780px) {
  .shell { width: min(100% - 28px, 1160px); }
  .topbar { min-height: 72px; }
  .account-name, .account-dot { display: none; }
  .workspace { padding-block: 42px 60px; }
  .section-heading { align-items: start; }
  .section-heading > p { max-width: 180px; text-align: right; }
  .mode-grid, .comparison-grid { grid-template-columns: 1fr; }
  .job-card { grid-template-columns: 108px minmax(0, 1fr); }
  .job-actions { grid-column: 1 / -1; max-width: none; justify-content: stretch; }
  .job-actions .button { flex: 1 1 auto; }
}

@media (max-width: 520px) {
  .account .button { padding-inline: 11px; }
  .workspace { padding-top: 38px; }
  .quota-panel, .upload-panel, .jobs-panel, .policy-panel { border-radius: 15px; }
  .quota-panel { padding: 20px; }
  .upload-panel, .jobs-panel { padding: 20px 16px; }
  .section-heading { display: block; }
  .section-heading > p { max-width: none; margin-top: 9px; text-align: left; }
  .quota-meta { flex-wrap: wrap; gap: 4px 14px; }
  .drop-zone { min-height: 210px; padding: 24px 14px; }
  .segmented { width: 100%; }
  .segmented label { flex: 1; }
  .segmented span { justify-content: center; }
  .job-card { grid-template-columns: 1fr; }
  .job-thumb { height: 170px; }
  .job-actions { grid-column: auto; }
  .comparison-grid video { min-height: 190px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
