:root {
  color-scheme: light;
  --paper: #f5f7fb;
  --paper-strong: #ffffff;
  --ink: #0f172a;
  --ink-soft: #475569;
  --ink-faint: #64748b;
  --line: #dce3ee;
  --line-soft: #e2e8f0;
  --jade: #0f766e;
  --jade-deep: #115e59;
  --jade-bright: #14b8a6;
  --jade-light: #ccfbf1;
  --jade-pale: #f0fdfa;
  --night: #0f172a;
  --shadow-sm: 0 8px 24px rgba(30, 41, 59, .07);
  --shadow-lg: 0 24px 64px rgba(30, 41, 59, .13);
  --font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 90% 12%, rgba(20, 184, 166, .11), transparent 30rem),
    var(--paper);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
button, input { font: inherit; }

:focus-visible {
  outline: 3px solid #5eead4;
  outline-offset: 3px;
}

.site-header {
  border-bottom: 1px solid rgba(220, 227, 238, .92);
  background: rgba(245, 247, 251, .92);
  backdrop-filter: blur(18px);
}

.nav {
  width: min(1080px, calc(100% - 40px));
  min-height: 70px;
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -.03em;
  text-decoration: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-links a {
  padding: 9px 13px;
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 720;
  text-decoration: none;
}

.nav-links a:hover { color: var(--jade); background: var(--jade-pale); }

.archive-chip {
  padding: 7px 10px;
  border: 1px solid #99f6e4;
  border-radius: 999px;
  color: var(--jade-deep);
  background: var(--jade-pale);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.wrap {
  width: min(920px, calc(100% - 40px));
  margin: 54px auto 76px;
}

.intro {
  margin-bottom: 28px;
  display: grid;
  gap: 13px;
}

.eyebrow {
  margin: 0;
  color: var(--jade);
  font-size: 12px;
  font-weight: 820;
  letter-spacing: .13em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(38px, 7vw, 64px);
  line-height: 1.08;
  letter-spacing: -.055em;
}

.lead {
  max-width: 720px;
  margin: 0;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.8;
}

.privacy-note {
  padding: 16px 18px;
  border: 1px solid #99f6e4;
  border-radius: 14px;
  color: #134e4a;
  background: rgba(240, 253, 250, .9);
  font-size: 14px;
  line-height: 1.7;
}

.panel {
  padding: clamp(22px, 4vw, 38px);
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, .9);
  box-shadow: var(--shadow-lg);
}

.drop-zone {
  min-height: 250px;
  padding: 36px 24px;
  border: 1.5px dashed #94a3b8;
  border-radius: 16px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  color: var(--ink-soft);
  background: #f8fafc;
  text-align: center;
  transition: border-color .2s ease, background .2s ease, transform .2s ease;
}

.drop-zone[data-dragging="true"] {
  border-color: var(--jade-bright);
  background: var(--jade-pale);
  transform: translateY(-2px);
}

.drop-zone h2 {
  margin: 0;
  color: var(--ink);
  font-size: 22px;
}

.drop-zone p {
  max-width: 560px;
  margin: 0;
  font-size: 13px;
  line-height: 1.7;
}

.file-picker {
  min-height: 46px;
  margin-top: 7px;
  padding: 12px 18px;
  border: 0;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: var(--jade);
  box-shadow: 0 12px 26px rgba(15, 118, 110, .2);
  cursor: pointer;
  font-weight: 760;
}

.file-picker:hover { background: var(--jade-deep); }
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.metadata {
  margin-top: 24px;
  border: 1px solid var(--line);
  border-radius: 15px;
  overflow: hidden;
}

.metadata[hidden] { display: none; }

.metadata-head {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: #f8fafc;
}

.metadata-head strong { font-size: 15px; }
.metadata-head span { color: var(--jade); font-size: 12px; font-weight: 760; }

.metadata dl {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(130px, .35fr) minmax(0, 1fr);
}

.metadata dt,
.metadata dd {
  min-width: 0;
  margin: 0;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.metadata dt { color: var(--ink-faint); background: #fbfdff; }
.metadata dd { color: var(--ink); font-weight: 680; }
.metadata dt:last-of-type,
.metadata dd:last-of-type { border-bottom: 0; }

.archive-settings {
  margin-top: 22px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.setting {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink-soft);
  background: #fff;
  font-size: 12px;
  line-height: 1.55;
}

.setting strong { display: block; margin-bottom: 4px; color: var(--ink); font-size: 13px; }
.setting[data-active="true"] { border-color: #5eead4; background: var(--jade-pale); }

.actions {
  margin-top: 24px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.button {
  min-height: 48px;
  padding: 13px 20px;
  border: 1px solid transparent;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  background: transparent;
  font-weight: 760;
  text-decoration: none;
  cursor: pointer;
}

.button-primary { color: #fff; background: var(--jade); }
.button-primary:hover { background: var(--jade-deep); }
.button-secondary { border-color: var(--line); background: #fff; }
.button-secondary:hover { border-color: #99f6e4; }

.status {
  min-height: 1.6em;
  margin: 14px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.6;
}

.status[data-state="ready"] { color: var(--jade-deep); }
.status[data-state="error"] { color: #b91c1c; }

.stopped-layout {
  min-height: calc(100vh - 71px);
  padding: 70px 20px;
  display: grid;
  place-items: center;
}

.stopped-card {
  width: min(720px, 100%);
  padding: clamp(30px, 6vw, 58px);
  border: 1px solid var(--line);
  border-radius: 24px;
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, .92);
  box-shadow: var(--shadow-lg);
}

.stopped-card::after {
  content: "";
  width: 230px;
  height: 230px;
  border: 44px solid rgba(20, 184, 166, .09);
  border-radius: 50%;
  position: absolute;
  top: -120px;
  right: -95px;
}

.stopped-card h1 { font-size: clamp(38px, 7vw, 58px); }
.stopped-card .lead { margin-top: 22px; }

.milestone {
  margin: 26px 0 0;
  padding: 18px 20px;
  border-left: 3px solid var(--jade-bright);
  color: var(--ink-soft);
  background: var(--jade-pale);
  font-size: 14px;
  line-height: 1.75;
}

.site-footer {
  width: min(920px, calc(100% - 32px));
  margin: 44px auto 28px;
  padding-top: 18px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--ink-faint);
  font-size: 14px;
  text-align: center;
}

.site-footer a,
.upload-footer a {
  color: #45645f;
  font-weight: 700;
  text-decoration: none;
}

/* The upload archive intentionally preserves the original production UI. */
.upload-page {
  color: #1d2329;
  background: #f5f7fb;
}

.upload-wrap {
  width: min(920px, calc(100% - 32px));
  margin: 40px auto;
}

.upload-header {
  margin-bottom: 18px;
}

.dashboard-topbar {
  min-height: 72px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topnav {
  margin-bottom: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.topnav a {
  color: #0f766e;
  font-weight: 700;
  text-decoration: none;
}

.title-row {
  margin-bottom: 8px;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 18px;
}

.title-row h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.3;
  letter-spacing: 0;
}

.mode-switch {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  color: #64748b;
  font-size: 14px;
  font-weight: 600;
}

.mode-switch a {
  min-height: 28px;
  padding: 2px 10px;
  border: 1px solid #99f6e4;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  color: #0f766e;
  background: #ecfdf5;
  font-weight: 800;
  text-decoration: none;
}

.mode-badge {
  font-weight: 700;
}

.account-stack {
  display: grid;
  justify-items: end;
  align-content: center;
  gap: 6px;
}

.account-summary {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  color: #64748b;
  font-size: 14px;
}

.account-summary strong {
  color: #0f172a;
  overflow-wrap: anywhere;
}

.account-summary a {
  color: #0f766e;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.credit-line {
  font-size: 13px;
}

.language-switcher {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #64748b;
  font-size: 12px;
}

.language-switcher-label {
  font-weight: 700;
}

.language-choice {
  margin: 0;
  padding: 4px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  color: #0f766e;
  background: white;
  font-size: 12px;
  line-height: 1.2;
}

.language-choice.is-active {
  border-color: #0f766e;
  color: #0f172a;
  background: #ecfdf5;
}

.upload-description {
  margin: 12px 0 0;
  color: #1d2329;
  line-height: 1.6;
}

.upload-panel {
  padding: 22px;
  border: 1px solid #dce3ee;
  border-radius: 8px;
  background: white;
  box-shadow: 0 8px 24px rgba(30, 41, 59, .07);
}

.form-layout {
  display: grid;
  gap: 10px;
}

.form-layout > label,
.advanced-options label {
  margin-top: 8px;
  font-weight: 700;
}

.form-layout > input,
.form-layout > select,
.advanced-options input,
.advanced-options textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  color: #1d2329;
  background: #fff;
}

.legacy-drop-zone {
  padding: 18px;
  border: 1px dashed #99f6e4;
  border-radius: 8px;
  display: grid;
  gap: 8px;
  background: #f8fffd;
}

.legacy-drop-zone[data-dragging="true"] {
  border-color: #0f766e;
  background: #ecfdf5;
}

.legacy-drop-zone strong {
  color: #0f172a;
}

.legacy-drop-zone > span {
  color: #64748b;
  line-height: 1.5;
}

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

.video-file-picker {
  width: 100%;
  min-height: 48px;
  padding: 8px 10px;
  border: 1px solid #dce3ee;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
}

.video-file-picker-button {
  flex: 0 0 auto;
  padding: 8px 12px;
  border: 1px solid #0f766e;
  border-radius: 6px;
  color: #fff;
  background: #0f766e;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
}

.video-file-picker-button:hover {
  background: #115e59;
}

.video-file-input:focus-visible + .video-file-picker .video-file-picker-button {
  outline: 3px solid #5eead4;
  outline-offset: 2px;
}

.video-file-picker-summary {
  min-width: 0;
  color: #475569;
  overflow-wrap: anywhere;
}

.asr-worker-status {
  width: fit-content;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid #bbf7d0;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #166534;
  background: #f0fdf4;
  font-size: 14px;
  line-height: 1.35;
}

.asr-worker-status strong {
  color: inherit;
  font-size: inherit;
}

.asr-worker-status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: currentColor;
}

.video-mode-note {
  padding: 14px;
  border: 1px solid #dce3ee;
  border-radius: 8px;
  display: grid;
  gap: 8px;
  background: #fff;
}

.video-mode-note h2 {
  margin: 0;
  font-size: 18px;
}

.metadata-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.metadata-table th,
.metadata-table td {
  padding: 9px 10px;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.metadata-table tr:last-child th,
.metadata-table tr:last-child td {
  border-bottom: 0;
}

.metadata-table th {
  width: 150px;
  color: #64748b;
  font-size: 14px;
}

.scale-summary-box {
  padding: 12px;
  border: 1px solid #ccfbf1;
  border-radius: 6px;
  color: #115e59;
  background: #f0fdfa;
  line-height: 1.55;
}

.scale-summary-box strong {
  margin-bottom: 6px;
  display: block;
  color: #0f766e;
}

.microcut-option {
  padding: 10px 12px;
  border: 1px solid #dce3ee;
  border-radius: 6px;
  background: #fff;
}

.microcut-checkbox {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #0f172a;
  font-weight: 700;
}

.microcut-checkbox input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.advanced-options {
  padding: 12px;
  border: 1px solid #dce3ee;
  border-radius: 6px;
  background: #f8fafc;
}

.advanced-options summary {
  color: #0f766e;
  cursor: pointer;
  font-weight: 700;
}

.advanced-options label {
  display: block;
}

.legacy-submit {
  width: fit-content;
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 6px;
  display: inline-block;
  color: #fff;
  background: #0f766e;
  font-weight: 700;
  text-decoration: none;
}

.legacy-submit:hover {
  background: #115e59;
}

.hint {
  margin: 0 0 0;
  color: #64748b;
  line-height: 1.6;
}

.local-status {
  margin: 0;
  color: #64748b;
  line-height: 1.6;
}

.local-status[data-state="ready"] {
  color: #115e59;
}

.local-status[data-state="error"] {
  color: #b91c1c;
}

.bottom-feedback {
  width: min(920px, calc(100% - 32px));
  margin: 16px auto 0;
  padding: 14px 0 0;
  border-top: 1px solid #e2e8f0;
  text-align: center;
}

.bottom-feedback a {
  color: #0f766e;
  font-weight: 700;
  text-decoration: none;
}

.scale-guide {
  margin-top: 18px;
}

.scale-guide h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

.scale-guide p {
  margin: 10px 0 0;
  line-height: 1.6;
}

.scale-guide .notice-line {
  margin: 0;
}

.upload-footer {
  width: min(920px, calc(100% - 32px));
  margin: 44px auto 28px;
  padding-top: 18px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #64748b;
  font-size: 14px;
  text-align: center;
}

@media (max-width: 720px) {
  .nav { width: min(100% - 28px, 1080px); }
  .nav-links a:not(.keep-mobile) { display: none; }
  .wrap { width: min(100% - 28px, 920px); margin-top: 36px; }
  .panel { border-radius: 16px; }
  .drop-zone { min-height: 230px; padding-inline: 16px; }
  .archive-settings { grid-template-columns: 1fr 1fr; }
  .metadata dl { grid-template-columns: 104px minmax(0, 1fr); }
  .metadata dt, .metadata dd { padding: 13px 14px; }
  .actions .button { flex: 1 1 170px; }
  .dashboard-topbar {
    min-height: 0;
    align-items: flex-start;
    flex-direction: column;
  }
  .account-stack {
    justify-items: start;
  }
  .account-summary {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  .site-footer,
  .upload-footer {
    flex-wrap: wrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
