:root {
  color-scheme: light;
  font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --canvas: #f4f2ec;
  --surface: #ffffff;
  --inset: #faf9f6;
  --ink: #171717;
  --ink-hover: #2c2b29;
  --muted: #57534e;
  --subtle: #8a837a;
  --line: rgba(23, 23, 23, 0.08);
  --line-strong: rgba(23, 23, 23, 0.16);
  --jade: #0f766e;
  --jade-hover: #0d635d;
  --jade-soft: #eefaf7;
  --jade-ink: #115e59;
  --amber-soft: #fef5e7;
  --amber-ink: #b45309;
  --slate-soft: #eef2ff;
  --slate-ink: #3730a3;
  --danger-soft: #fef2f2;
  --danger-ink: #b91c1c;
  color: var(--ink);
  background: var(--canvas);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 280px;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse 68% 42% at 50% -6%, rgba(15, 118, 110, 0.085), transparent 72%),
    radial-gradient(ellipse 50% 40% at 88% 12%, rgba(217, 119, 6, 0.05), transparent 70%),
    var(--canvas);
}

[hidden] { display: none !important; }
a { color: inherit; }
button, input { font: inherit; }
button, a.btn { cursor: pointer; }

:focus-visible {
  outline: 2px solid var(--jade);
  outline-offset: 2px;
}

/* Header */
.topbar {
  width: 100%;
  padding: 0 28px;
}

.topbar-inner {
  width: min(980px, 100%);
  margin-inline: auto;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--ink);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(23, 23, 23, 0.16);
}

.brand-name {
  font-size: 0.96rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.brand-tag {
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(23, 23, 23, 0.06);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.04em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lang-switch {
  display: inline-flex;
  padding: 3px;
  border-radius: 10px;
  background: rgba(23, 23, 23, 0.055);
  border: 1px solid rgba(23, 23, 23, 0.04);
}

.lang-opt {
  height: 26px;
  min-width: 32px;
  padding: 0 9px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  transition: background-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.lang-opt:hover:not(.is-active) {
  color: var(--ink);
}

.lang-opt.is-active {
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(23, 23, 23, 0.08);
}

.signout-btn {
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 550;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.signout-btn:hover {
  background: #ffffff;
  color: var(--ink);
  border-color: var(--line-strong);
}

/* Main Stage */
.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 20px 64px;
}

.hero {
  text-align: center;
  max-width: 520px;
  margin-bottom: 28px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  margin-bottom: 14px;
}

.eyebrow-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--jade);
}

h1 {
  margin: 0;
  font-size: clamp(1.7rem, 3.2vw, 2.05rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.22;
  color: var(--ink);
}

.lead {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.55;
}

/* Porcelain Card Surface */
.surface {
  width: min(520px, 100%);
  padding: 26px;
  border-radius: 24px;
  background: var(--surface);
  box-shadow:
    0 0 0 1px rgba(23, 23, 23, 0.055),
    0 24px 54px -18px rgba(28, 25, 23, 0.12),
    0 4px 14px -4px rgba(28, 25, 23, 0.04);
}

.surface-narrow {
  width: min(410px, 100%);
  padding: 28px;
}

/* Sign-in Form */
.field-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink);
}

.signin-form input {
  display: block;
  width: 100%;
  height: 46px;
  padding: 0 15px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--inset);
  color: var(--ink);
  font-size: 0.95rem;
  transition: background-color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.signin-form input::placeholder {
  color: var(--subtle);
}

.signin-form input:focus {
  outline: none;
  background: #ffffff;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(23, 23, 23, 0.08);
}

.signin-form input[aria-invalid="true"] {
  border-color: #dc2626;
  background: #ffffff;
}

.alert-inline {
  margin: 10px 0 0;
  padding: 10px 13px;
  border-radius: 10px;
  background: var(--danger-soft);
  color: var(--danger-ink);
  font-size: 0.84rem;
}

/* Dropzone */
.drop {
  position: relative;
  display: block;
  border: 1.5px dashed #d6d3cd;
  border-radius: 16px;
  background: var(--inset);
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.drop:hover,
.drop.dragging {
  border-color: var(--jade);
  background: var(--jade-soft);
}

.drop.has-file {
  border-style: solid;
  border-color: rgba(23, 23, 23, 0.12);
  background: #ffffff;
}

.drop.has-file:hover {
  border-color: var(--jade);
  background: #fcfdfc;
}

.drop:focus-within {
  outline: 2px solid var(--jade);
  outline-offset: 2px;
}

.drop:has(input:disabled) {
  cursor: default;
  opacity: 0.72;
}

.drop input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.drop-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  padding: 36px 20px;
}

.drop-emblem {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid var(--line);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
  box-shadow: 0 2px 8px rgba(23, 23, 23, 0.05);
  transition: transform 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.drop:hover .drop-emblem,
.drop.dragging .drop-emblem {
  color: var(--jade);
  border-color: rgba(15, 118, 110, 0.25);
  transform: translateY(-2px);
}

.drop-title {
  font-size: 0.96rem;
  font-weight: 600;
  color: var(--ink);
}

.drop-hint {
  font-size: 0.82rem;
  color: var(--subtle);
}

/* Selected File Horizontal Card */
.file-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
}

.file-ext {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.03em;
  background: var(--slate-soft);
  color: var(--slate-ink);
}

.file-ext[data-ext="doc"] {
  background: var(--amber-soft);
  color: var(--amber-ink);
}

.file-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.file-name {
  font-size: 0.93rem;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-detail {
  font-size: 0.78rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-replace {
  flex: none;
  padding: 5px 10px;
  border-radius: 8px;
  background: var(--inset);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 550;
}

.drop.has-file:hover .file-replace {
  color: var(--ink);
  border-color: var(--line-strong);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 46px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 0.94rem;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.15s ease, transform 0.08s ease, box-shadow 0.15s ease;
}

.btn:active:not(:disabled) {
  transform: scale(0.99);
}

.btn-ink {
  margin-top: 16px;
  background: var(--ink);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(23, 23, 23, 0.16);
}

.btn-ink:hover:not(:disabled) {
  background: var(--ink-hover);
}

.btn-ink:disabled {
  cursor: default;
  background: #e7e5e0;
  color: #a8a29e;
  box-shadow: none;
}

.btn-jade {
  background: var(--jade);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(15, 118, 110, 0.24);
}

.btn-jade:hover {
  background: var(--jade-hover);
}

/* Stepper */
.progress-panel {
  margin-top: 18px;
  padding: 14px 16px 4px;
}

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.step {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  font-weight: 550;
  color: var(--subtle);
}

.step-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #e2dfd8;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.step.is-done {
  color: var(--jade-ink);
}

.step.is-done .step-dot {
  background: var(--jade);
}

.step.is-active {
  color: var(--ink);
  font-weight: 650;
}

.step.is-active .step-dot {
  background: var(--jade);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.18);
  animation: pulse-ring 1.5s ease-in-out infinite;
}

/* Status Banner */
.feedback {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--inset);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 0.875rem;
  line-height: 1.48;
}

.feedback p { margin: 0; }

.feedback-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--jade);
  flex: none;
}

.feedback[data-kind="progress"] .feedback-dot {
  animation: pulse 1.2s ease-in-out infinite;
}

.feedback[data-kind="error"] {
  background: var(--danger-soft);
  border-color: rgba(185, 28, 28, 0.14);
  color: var(--danger-ink);
}

.feedback[data-kind="error"] .feedback-dot {
  background: var(--danger-ink);
}

/* Ready Panel */
.ready-panel {
  margin-top: 14px;
  padding: 18px;
  border-radius: 16px;
  background: var(--jade-soft);
  border: 1px solid rgba(15, 118, 110, 0.16);
}

.ready-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.ready-icon {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--jade);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ready-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.ready-filename {
  font-size: 0.94rem;
  font-weight: 650;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ready-sub {
  font-size: 0.8rem;
  color: var(--jade-ink);
}

/* Job Link Card */
.job-link-box {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--inset);
}

.job-link-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.job-link-label {
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--ink);
}

.job-link-tip {
  font-size: 0.74rem;
  color: var(--subtle);
}

.job-link-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 5px 5px 10px;
  border-radius: 9px;
  background: #ffffff;
  border: 1px solid var(--line);
}

.job-link-url {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.77rem;
  color: var(--jade-ink);
  text-decoration: none;
}

.job-link-url:hover {
  text-decoration: underline;
}

.copy-btn {
  flex: none;
  height: 28px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--inset);
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 600;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.copy-btn:hover {
  background: #efede7;
}

.copy-btn.copied {
  border-color: rgba(15, 118, 110, 0.25);
  background: var(--jade-soft);
  color: var(--jade-ink);
}

/* Reset Row */
.reset-row {
  margin-top: 14px;
  text-align: center;
}

.btn-subtle {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 550;
  padding: 6px 12px;
  border-radius: 8px;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.btn-subtle:hover {
  background: var(--inset);
  color: var(--ink);
}

/* Foot Strip */
.foot-strip {
  list-style: none;
  margin: 22px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 18px;
  color: var(--subtle);
  font-size: 0.78rem;
}

.foot-strip li {
  display: inline-flex;
  align-items: center;
  gap: 18px;
}

.foot-strip li:not(:last-child)::after {
  content: "·";
  color: #c7c1b8;
}

.spinner {
  width: 15px;
  height: 15px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 0.35; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1); }
}

@keyframes pulse-ring {
  0%, 100% { box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14); }
  50% { box-shadow: 0 0 0 6px rgba(15, 118, 110, 0.24); }
}

@media (max-width: 540px) {
  .topbar { padding: 0 16px; }
  .topbar-inner { height: 60px; }
  .stage { padding: 8px 16px 40px; }
  .hero { margin-bottom: 20px; }
  .surface, .surface-narrow {
    padding: 20px;
    border-radius: 20px;
  }
  .drop-empty { padding: 28px 16px; }
  .job-link-top {
    flex-direction: column;
    gap: 2px;
  }
}
