:root {
  --canvas: #f4f3ee;
  --surface: #fff;
  --ink: #14241f;
  --muted: #475b53;
  --green: #126348;
  --green-hover: #0a4e38;
  --green-outline: #276a54;
  --sage: #e3efe2;
  --drop: #f1f8ef;
  --line: #cdd3cc;
  --quiet-line: #dce3da;
  --disabled: #afc3b4;
  --disabled-ink: #263b30;
  --danger: #a12e2c;
  --danger-bg: #fff3f1;
  --radius: 20px;
  --section-gutter: clamp(20px, 2.1vw, 32px);
  --serif: 'Songti SC', 'Noto Serif CJK SC', 'Noto Serif SC', SimSun, Georgia, serif;
  --sans: 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
  color-scheme: light;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 0; min-height: 100dvh; display: flex; flex-direction: column; }
main { flex: 1; min-width: 0; }
button, input, select, textarea { font: inherit; }
button, summary { color: inherit; }
button, summary, a[href] { cursor: pointer; }
a { color: inherit; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid var(--green-outline); outline-offset: 3px; }
main:focus { outline: none; }
p, h1, h2, h3 { margin: 0; }
.symbols { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 24px; height: 24px; display: block; flex: none; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.6; }
.chevron { width: 18px; height: 18px; }
.sr-only, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
.skip { position: fixed; z-index: 10; top: 8px; left: 8px; padding: 12px 16px; background: var(--surface); border-radius: 8px; }

.topbar { border-bottom: 1px solid var(--line); background: var(--surface); }
.topbar-inner { min-height: clamp(64px, 5.55vw, 85px); width: min( calc(100% - 6.25vw), 1440px); margin-inline: auto; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: inline-flex; align-items: center; gap: clamp(10px, 1.45vw, 22px); text-decoration: none; white-space: nowrap; font: 700 clamp(20px, 2.2vw, 33px)/1 var(--serif); }
.brand-icon { width: clamp(38px, 3.55vw, 54px); aspect-ratio: 1; display: grid; place-items: center; color: white; background: #0d503b; border-radius: 13px; }
.brand-icon .icon { width: 60%; height: 60%; stroke-width: 1.45; }
.top-actions { display: flex; gap: clamp(8px, 2.2vw, 34px); align-items: center; }
.button { display: inline-flex; justify-content: center; align-items: center; gap: 12px; min-height: 48px; padding: 9px 20px; border: 1px solid transparent; border-radius: 10px; background: transparent; font-weight: 600; text-decoration: none; line-height: 1.35; text-align: center; transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease; }
.button-primary { color: #fff; background: var(--green); }
.button-primary:hover { background: var(--green-hover); }
.button-primary:disabled { color: var(--disabled-ink); background: var(--disabled); }
.button-line { border-color: var(--green-outline); color: var(--ink); background: var(--surface); }
.button-line:hover { background: var(--drop); }
.admin-open { min-height: 46px; min-width: 87px; padding-inline: 14px; font-size: 18px; font-weight: 500; }
.account { position: relative; }
.account summary { list-style: none; min-height: 48px; display: flex; align-items: center; gap: 12px; padding-inline: 4px; border-radius: 8px; white-space: nowrap; }
.account summary::-webkit-details-marker { display: none; }
.account summary:hover, .account[open] summary { color: var(--green); }
.account-icon { width: clamp(25px, 2.4vw, 37px); height: clamp(25px, 2.4vw, 37px); stroke-width: 1.15; }
.account-menu { position: absolute; z-index: 2; top: calc(100% + 8px); right: 0; min-width: 148px; padding: 5px; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; box-shadow: 0 8px 28px #14241f12; }
.account-menu a { display: block; padding: 11px 13px; text-decoration: none; border-radius: 6px; }
.account-menu a:hover { background: var(--sage); }

.workspace { width: min(80.5%, 1236px); margin-inline: auto; }
.work-intro { padding: clamp(39px, 3.75vw, 58px) 0 clamp(30px, 2.94vw, 45px); text-align: center; }
.work-intro h1 { font: 800 clamp(48px, 5.5vw, 84px)/1.12 var(--serif); letter-spacing: -.018em; }
.work-intro p { margin-top: clamp(12px, 1.12vw, 17px); color: var(--muted); font-size: clamp(18px, 1.78vw, 27px); line-height: 1.45; }
.tool-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.mode-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: clamp(8px, 1vw, 15px) 15px 0; border-bottom: 1px solid var(--line); }
.mode-tab { min-width: 0; min-height: clamp(53px, 5.04vw, 77px); display: flex; align-items: center; justify-content: center; gap: clamp(8px, 1.35vw, 20px); padding: 10px 5px; margin: 0; border: 0; border-bottom: 4px solid transparent; border-radius: 12px 12px 0 0; background: var(--surface); font: 700 clamp(16px, 1.61vw, 25px)/1.28 var(--serif); transition: color 160ms ease, background-color 160ms ease; }
.mode-tab .icon { width: clamp(21px, 2.3vw, 35px); height: clamp(21px, 2.3vw, 35px); }
.mode-tab:hover { background: var(--drop); }
.mode-tab[aria-selected='true'] { background: var(--sage); border-bottom-color: var(--green); }
.mode-tab:focus-visible { outline-offset: -4px; }
.tool-body { padding: clamp(24px, 2.48vw, 38px) var(--section-gutter) clamp(21px, 1.82vw, 28px); }
.drop-zone { min-height: clamp(255px, 22.45vw, 345px); display: flex; flex-direction: column; justify-content: center; align-items: center; gap: clamp(14px, 1.21vw, 18px); padding: clamp(20px, 2.1vw, 32px); text-align: center; border: 2px dashed var(--green-outline); border-radius: 17px; background: var(--drop); transition: background-color 160ms ease, border-color 160ms ease; }
.drop-zone.is-dragging { background: var(--sage); border-color: var(--green-hover); outline: 2px solid var(--green); outline-offset: -5px; }
.drop-icon { display: grid; place-items: center; width: clamp(53px, 5.4vw, 83px); height: clamp(53px, 5.4vw, 83px); border: clamp(2px, .23vw, 3.5px) solid var(--green); border-radius: clamp(10px, 1.12vw, 17px); color: var(--green); }
.drop-icon .icon { width: 76%; height: 76%; stroke-width: 1.5; }
.drop-heading { font: 800 clamp(24px, 2.24vw, 34px)/1.22 var(--serif); }
.file-choose { min-width: clamp(155px, 14.8vw, 227px); min-height: clamp(47px, 3.77vw, 58px); padding-inline: 24px; font-size: clamp(16px, 1.43vw, 22px); }
.format-hint { max-width: 100%; color: var(--muted); font-size: clamp(14px, 1.32vw, 20px); line-height: 1.5; }
.format-toggle { background: none; border: 0; padding: 8px 0; margin: -8px 0; font: inherit; color: var(--green-hover); text-decoration: underline; text-decoration-color: #779185; text-underline-offset: 3px; }
.format-toggle:hover { text-decoration-color: currentColor; }
.format-limit { white-space: nowrap; }
.format-limit::before { content: ' · '; white-space: pre; }
.format-list { margin: 11px 2px 0; }
.tool-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: clamp(22px, 2.22vw, 34px); }
.tool-actions .button { min-height: clamp(48px, 3.65vw, 56px); font-size: clamp(16px, 1.35vw, 21px); }
.options-button { min-width: clamp(176px, 14.25vw, 219px); }
.options-button[aria-expanded='true'] .chevron, .account[open] .chevron { transform: rotate(180deg); }
.convert-button { min-width: clamp(156px, 13vw, 200px); }

.fields, .control { display: grid; min-width: 0; }
.fields { gap: 9px; }
.control { gap: 8px; align-content: start; }
.fields label, .control label { font-weight: 650; line-height: 1.4; }
.fields > label:not(:first-child) { margin-top: 10px; }
.fields input, .fields textarea, .control input, .control select { width: 100%; min-width: 0; min-height: 48px; border: 1px solid #a9b6ac; border-radius: 9px; padding: 11px 14px; background: var(--surface); color: var(--ink); }
.fields input::placeholder, .fields textarea::placeholder, .control input::placeholder { color: #5f7067; opacity: 1; }
.fields textarea { resize: vertical; min-height: 156px; line-height: 1.55; font: 16px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; }
.optional, .field-help { color: var(--muted); font-size: 14px; font-weight: 400; line-height: 1.45; }
.input-suffix { display: flex; align-items: center; gap: 8px; }
.input-suffix span { min-width: 50px; color: var(--muted); }
.options { display: grid; grid-template-columns: repeat(3, minmax(110px, 1fr)); border-top: 1px solid var(--quiet-line); padding-top: 20px; gap: 16px; margin-top: 23px; }
.watermark { grid-column: 1 / -1; }
.merge-name { margin-top: 22px; }
.message { margin-top: 15px; padding: 10px 14px; border-radius: 8px; line-height: 1.5; overflow-wrap: anywhere; }
.error { color: var(--danger); background: var(--danger-bg); }
.file-list { list-style: none; margin: 14px 0 0; padding: 0; }
.file-row { display: flex; align-items: center; gap: 12px; min-height: 57px; padding: 7px 12px; border-bottom: 1px solid var(--quiet-line); }
.file-row > .icon { color: var(--green); }
.file-details { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.file-details small { display: block; margin-top: 3px; color: var(--muted); }
.file-controls { display: flex; gap: 4px; }
.icon-button { display: inline-grid; width: 44px; height: 44px; padding: 0; place-items: center; border: 1px solid transparent; border-radius: 8px; background: transparent; }
.icon-button:hover:not(:disabled) { background: var(--sage); color: var(--green-hover); }
.icon-button:disabled { color: #93a298; }
.icon-button .icon { width: 20px; height: 20px; }
.result { display: flex; align-items: center; gap: 14px; margin-top: 24px; border: 1px solid #b8cfbd; border-radius: 12px; background: var(--drop); padding: 15px; }
.result-icon { width: 44px; height: 44px; flex: none; display: grid; place-items: center; color: var(--green); background: var(--sage); border-radius: 10px; }
.result-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.result-text p { color: var(--muted); font-size: 14px; margin-top: 3px; }
.result .button { flex-shrink: 0; }
.preview { margin-top: 16px; }
.preview iframe { width: 100%; height: 520px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }

.auth { width: min(78.4%, 1204px); min-height: clamp(625px, 54.6vw, 838px); display: grid; align-items: center; grid-template-columns: 1fr 1.05fr; gap: clamp(26px, 2.4vw, 37px); padding: clamp(44px, 4.3vw, 66px) 0 28px; margin-inline: auto; }
.auth-intro::before { content: ''; display: block; width: clamp(60px, 6.25vw, 96px); height: 2px; background: var(--green); margin-bottom: clamp(21px, 2.37vw, 36px); }
.auth-intro h1 { font: 800 clamp(46px, 5.5vw, 84px)/1.27 var(--serif); letter-spacing: -.018em; }
.auth-intro p { margin-top: clamp(18px, 2.3vw, 35px); color: var(--muted); font: 500 clamp(16px, 1.73vw, 26px)/1.5 var(--serif); }
.auth-card { padding: clamp(26px, 2.5vw, 38px) clamp(26px, 2.8vw, 43px); max-width: 600px; width: 100%; justify-self: end; border-radius: clamp(18px, 1.82vw, 28px); background: var(--surface); border: 1px solid var(--line); box-shadow: 0 5px 14px #14241f0a; }
.auth-card h2 { font-size: clamp(25px, 2.7vw, 41px); line-height: 1.12; }
.auth-description { margin-top: 10px; color: var(--muted); line-height: 1.5; font-size: clamp(15px, 1.35vw, 20px); }
.auth-tabs { display: grid; grid-template-columns: repeat(2, 1fr); margin-block: clamp(18px, 1.8vw, 27px); border-bottom: 1px solid var(--line); }
.auth-tabs a { min-height: 45px; display: grid; place-items: center; border-radius: 7px 7px 0 0; text-decoration: none; font-size: clamp(16px, 1.42vw, 21px); }
.auth-tabs a:hover { background: var(--drop); }
.auth-tabs a[aria-current='page'] { background: var(--sage); font-weight: 650; }
.auth-fields input { min-height: clamp(47px, 3.55vw, 54px); }
.auth-fields label { font-size: clamp(16px, 1.25vw, 19px); }
.auth-fields label:not(:first-child), #invitation-control { margin-top: clamp(7px, 1.1vw, 16px); }
.password-field { position: relative; }
.password-field input { padding-right: 54px; }
.password-field .icon-button { position: absolute; top: 50%; right: 4px; transform: translateY(-50%); color: var(--muted); }
.auth-submit { margin-top: clamp(12px, 1.7vw, 26px); min-height: clamp(48px, 4vw, 61px); font-size: clamp(16px, 1.5vw, 23px); }
.demo-link { display: grid; align-items: center; width: fit-content; margin: 8px auto -9px; padding: 6px 4px; min-height: 44px; color: var(--green); text-underline-offset: 3px; }

.footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 15px; padding: clamp(20px, 1.63vw, 25px) 16px clamp(24px, 2.2vw, 34px); color: var(--muted); text-align: center; }
.footer p { display: flex; align-items: center; justify-content: center; gap: 9px; font-size: clamp(14px, 1.25vw, 19px); }
.footer .icon { width: 24px; height: 24px; }
.prototype-note { font-size: 12px; border-left: 1px solid var(--line); padding-left: 15px; }

body:has(.admin-dialog[open]) { overflow: hidden; }
.admin-dialog { width: min(1024px, calc(100% - 40px)); max-width: none; max-height: calc(100dvh - 48px); padding: 0 clamp(18px, 2.6vw, 40px) 23px; border: 1px solid var(--quiet-line); border-radius: 24px; color: var(--ink); background: var(--canvas); box-shadow: 0 22px 60px #10241a30; }
.admin-dialog::backdrop { background: #15211cca; opacity: .62; }
.dialog-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-inline: calc(-1 * clamp(18px, 2.6vw, 40px)); padding: 23px clamp(18px, 2.6vw, 40px); border-bottom: 1px solid var(--line); }
.dialog-heading h2 { font-size: clamp(27px, 2.6vw, 40px); }
.dialog-heading .icon { width: 25px; height: 25px; }
.admin-dialog section { margin-top: clamp(20px, 2.15vw, 33px); }
.table-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.table-heading h3 { font-size: clamp(22px, 1.9vw, 29px); }
#create-invite { min-width: clamp(124px, 11vw, 169px); font-size: clamp(16px, 1.25vw, 19px); }
.table-scroll { overflow-x: auto; border-radius: 7px 7px 0 0; }
table { width: 100%; min-width: 620px; border-collapse: collapse; text-align: left; font-size: clamp(15px, 1.24vw, 19px); line-height: 1.4; }
th, td { padding: 8px clamp(10px, 1.6vw, 24px); }
th { padding-block: 13px; background: #dde4d9; font-weight: 650; }
td { border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; white-space: nowrap; }
td[data-active='true'] { color: var(--green-hover); font-weight: 650; }
td[data-active='false'] { color: var(--muted); }
td .button { min-height: 44px; min-width: clamp(70px, 6.8vw, 104px); padding: 6px 12px; }
.admin-note { color: var(--muted); font-size: 14px; margin-top: 17px; }

@media (min-width: 900px) and (min-height: 900px) {
  .admin-dialog { transform: translateY(22px); max-height: calc(100dvh - 96px); }
}

@media (max-width: 1000px) {
  .workspace, .auth { width: calc(100% - 64px); }
  .auth-intro h1 { font-size: clamp(41px, 6vw, 60px); }
}

@media (max-width: 680px) {
  .topbar-inner { width: calc(100% - 32px); gap: 10px; }
  .brand-icon { border-radius: 9px; }
  .top-actions { gap: 8px; }
  .top-actions .admin-open { min-width: 0; min-height: 44px; font-size: 14px; padding-inline: 10px; }
  .account summary { gap: 5px; font-size: 13px; }
  .account .chevron { width: 13px; height: 13px; }
  .workspace, .auth { width: calc(100% - 32px); }
  .work-intro { padding: 31px 0 27px; }
  .work-intro h1 { font-size: clamp(32px, 9.4vw, 51px); }
  .work-intro p { font-size: 16px; }
  .tool-card { border-radius: 16px; }
  .mode-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding: 8px 8px 0; }
  .mode-tab { min-height: 48px; min-width: 0; font-size: clamp(14px, 4.17vw, 17px); border-bottom-width: 3px; border-radius: 8px 8px 0 0; }
  .mode-tab .icon { width: 19px; height: 19px; }
  .tool-body { padding: 16px 12px; }
  .drop-zone { min-height: 240px; padding: 20px 13px; border-radius: 13px; }
  .format-limit { display: block; }
  .format-limit::before { content: none; }
  .tool-actions { gap: 8px; margin-top: 16px; }
  .tool-actions .button { flex: 1; min-width: 0; gap: 5px; font-size: 14px; padding-inline: 7px; }
  .tool-actions .icon { width: 18px; height: 18px; }
  .tool-actions .chevron { width: 14px; height: 14px; }
  .options { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .file-row { gap: 6px; padding-inline: 4px; }
  .file-controls { gap: 0; }
  .result { flex-wrap: wrap; }
  .result .button { width: 100%; }
  .auth { display: block; min-height: 0; padding: 31px 0 15px; }
  .auth-intro { text-align: center; margin-bottom: 25px; }
  .auth-intro::before { display: none; }
  .auth-intro h1 { font-size: clamp(35px, 10vw, 50px); line-height: 1.21; }
  .auth-intro p { font-size: 16px; margin-top: 12px; }
  .auth-card { padding: 22px; margin-inline: auto; }
  .prototype-note { border-left: 0; padding-left: 0; }
  .footer { flex-direction: column; }
}

@media (max-width: 355px) {
  .account-icon { display: none; }
  .file-row > .icon { display: none; }
  .file-row { flex-wrap: wrap; }
}

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

/* 转换进度（真实转换，非百分比）：转圈 + 已用秒数，沿用本页配色。 */
.progress { display: flex; align-items: center; gap: 12px; margin-top: 20px; padding: 13px 16px; border: 1px solid #b8cfbd; border-radius: 12px; background: var(--drop); font-weight: 600; line-height: 1.4; }
.progress-text { flex: 1; min-width: 0; }
.progress-time { color: var(--muted); font-weight: 400; white-space: nowrap; }
.spinner { flex: none; width: 20px; height: 20px; border-radius: 50%; border: 2px solid #cdd3cc; border-top-color: var(--green); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
