:root {
  --ink: #172033;
  --muted: #687386;
  --line: #dce2ea;
  --surface: #ffffff;
  --soft: #f8f9fc;
  --canvas: #f3f5f8;
  --accent: #3157d5;
  --accent-dark: #2444ad;
  --accent-soft: #eef2ff;
  --success: #24764b;
  --danger: #b42318;
  --radius: 16px;
  --shadow: 0 18px 50px rgba(31, 46, 78, .1);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--canvas); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
.shell { width: min(1120px, calc(100% - 32px)); margin: 40px auto 80px; }
.security-notice { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; border: 1px solid #f1c66f; border-radius: 12px; background: #fff8e8; padding: 12px 16px; color: #704b00; }
.security-notice-icon { display: grid; width: 24px; height: 24px; flex: 0 0 24px; place-items: center; border-radius: 50%; background: #d98b00; color: #fff; font-size: 14px; font-weight: 900; }
.security-notice p { margin: 0; }
.security-notice strong { color: #8a4200; }
.hero { display: flex; align-items: flex-end; justify-content: space-between; padding: 8px 4px 24px; }
.eyebrow { color: var(--accent); font-size: 11px; font-weight: 850; letter-spacing: .14em; }
.hero h1 { margin: 5px 0 4px; font-size: clamp(29px, 4vw, 43px); letter-spacing: -.04em; }
.hero p { margin: 0; color: var(--muted); }
.status { display: flex; align-items: center; gap: 8px; color: var(--success); font-weight: 750; white-space: nowrap; }
.status i { width: 8px; height: 8px; border-radius: 50%; background: #2eaa68; box-shadow: 0 0 0 5px #dff5e9; }

.tool-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.tool-tab { display: flex; align-items: center; gap: 12px; min-width: 0; border: 1px solid var(--line); border-radius: 13px; background: rgba(255, 255, 255, .72); padding: 13px 15px; text-align: left; cursor: pointer; transition: border-color .18s ease, background .18s ease, box-shadow .18s ease, transform .18s ease; }
.tool-tab:hover { border-color: #b8c6ee; background: #fff; transform: translateY(-1px); }
.tool-tab.active { border-color: #aebff1; background: #fff; box-shadow: 0 8px 24px rgba(49, 87, 213, .1); }
.tool-tab > span:last-child { display: flex; min-width: 0; flex-direction: column; }
.tool-tab strong { font-size: 14px; }
.tool-tab small { overflow: hidden; margin-top: 1px; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.tab-icon { display: grid; width: 34px; height: 34px; flex: 0 0 34px; place-items: center; border-radius: 9px; background: #e9edf5; color: #526079; font-size: 12px; font-weight: 850; }
.tool-tab.active .tab-icon { background: var(--accent); color: #fff; }

.panel, .caption-result { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 330px; min-height: 500px; }
.editor { display: flex; flex-direction: column; padding: 28px; border-right: 1px solid var(--line); }
label { display: block; margin-bottom: 8px; font-weight: 750; }
.editor textarea { flex: 1; min-height: 330px; border: 0; outline: 0; resize: vertical; color: var(--ink); font: 18px/1.8 inherit; }
.meta { display: flex; justify-content: space-between; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.controls { padding: 28px; background: #fafbfc; }
.controls label:not(:first-child) { margin-top: 22px; }
.controls output { float: right; color: var(--accent); font-weight: 750; }
select { width: 100%; border: 1px solid var(--line); border-radius: 9px; background: #fff; padding: 11px 12px; color: var(--ink); }
input[type=range] { width: 100%; accent-color: var(--accent); }

.primary { width: 100%; margin-top: 28px; border: 0; border-radius: 10px; background: var(--accent); color: #fff; padding: 13px 18px; font-weight: 800; cursor: pointer; transition: background .18s ease, transform .18s ease; }
.primary:hover { background: var(--accent-dark); }
.primary:active { transform: translateY(1px); }
.primary:disabled { opacity: .55; cursor: wait; }
.message { margin: 20px 28px 0; padding: 12px 14px; border-radius: 9px; background: var(--accent-soft); color: #28499e; }
.message.error { background: #fff0ee; color: var(--danger); }
.audio-result { display: flex; align-items: center; gap: 14px; margin: 20px 28px 28px; padding-top: 20px; border-top: 1px solid var(--line); }
.audio-result audio { width: auto; min-width: 0; flex: 1; }
.download-button { display: inline-flex; min-height: 46px; align-items: center; justify-content: center; gap: 9px; border: 1px solid #cbd7ff; border-radius: 12px; background: #f4f7ff; color: var(--accent); padding: 10px 14px; box-shadow: 0 5px 16px rgba(49, 87, 213, .1); text-decoration: none; font-weight: 800; white-space: nowrap; transition: .18s ease; }
.download-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.download-button small { border-radius: 6px; background: #e1e8ff; padding: 2px 5px; color: #4662bc; font-size: 10px; }
.download-button:hover { border-color: var(--accent); background: var(--accent); color: #fff; box-shadow: 0 8px 22px rgba(49, 87, 213, .24); transform: translateY(-1px); }
.download-button:hover small { background: rgba(255, 255, 255, .18); color: #fff; }

.module-heading { display: flex; align-items: end; justify-content: space-between; gap: 30px; padding: 20px 5px 16px; }
.module-heading h2 { margin: 4px 0 0; font-size: clamp(24px, 3vw, 32px); letter-spacing: -.025em; }
.module-heading p { max-width: 520px; margin: 0 0 3px; color: var(--muted); text-align: right; }
.workflow-panel { padding: 24px; }
.workflow-form { max-width: 820px; margin: auto; }
.drop-zone { display: flex; min-height: 210px; align-items: center; justify-content: center; flex-direction: column; border: 1.5px dashed #bdc7d6; border-radius: 14px; background: var(--soft); cursor: pointer; transition: border-color .18s ease, background .18s ease; }
.drop-zone:hover, .drop-zone.drag { border-color: var(--accent); background: #f3f6ff; }
.drop-zone input { display: none; }
.drop-icon { display: grid; width: 46px; height: 46px; margin-bottom: 12px; place-items: center; border-radius: 50%; background: #e2e8ff; color: var(--accent); font-size: 23px; font-weight: 700; }
.drop-zone strong { font-size: 17px; }
.drop-zone small { margin: 6px 20px 0; color: var(--muted); text-align: center; font-weight: 400; }
.compact-drop { min-height: 150px; margin-top: 14px; }
.option-field { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 14px; padding: 13px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--soft); }
.option-field > span { display: flex; flex-direction: column; }
.option-field small { color: var(--muted); font-weight: 400; }
.option-field input { width: 96px; border: 1px solid #bdc7d6; border-radius: 9px; background: #fff; padding: 10px; text-align: center; font-weight: 750; }
.workflow-submit { display: flex; justify-content: space-between; margin-top: 14px; padding: 15px 18px; }
.field-head { display: flex; align-items: center; justify-content: space-between; margin: 0 2px 9px; }
.field-head label { margin: 0; font-size: 16px; }
.field-head span { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.workflow-form > textarea { width: 100%; min-height: 220px; resize: vertical; border: 1px solid var(--line); border-radius: 13px; padding: 16px; outline: 0; color: var(--ink); line-height: 1.8; }
.workflow-form > textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(49, 87, 213, .1); }
.manuscript-cleaner { margin-top: 10px; border: 1px solid #d8dff0; border-radius: 12px; background: #f8faff; padding: 12px 14px; }
.tts-cleaner { flex: 0 0 auto; }
.tts-cleaner-rules { grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr) 92px; }
.cleaner-head { display: flex; align-items: baseline; gap: 10px; }
.cleaner-head h3 { flex: 0 0 auto; margin: 0; font-size: 14px; }
.cleaner-head p { overflow: hidden; margin: 0; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.cleaner-rules { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr) 92px auto; align-items: end; gap: 9px; margin-top: 9px; }
.cleaner-field { min-width: 0; margin: 0; }
.cleaner-field > span { display: block; margin-bottom: 4px; font-size: 12px; }
.cleaner-field input { width: 100%; height: 36px; border: 1px solid #cbd4e5; border-radius: 8px; background: #fff; padding: 7px 9px; color: var(--ink); }
.cleaner-field input:focus { border-color: var(--accent); outline: 0; box-shadow: 0 0 0 3px rgba(49, 87, 213, .1); }
.cleaner-field-number input { font-variant-numeric: tabular-nums; }
.cleaner-status { display: block; margin-top: 7px; color: var(--muted); font-size: 11px; }
.cleaner-status:empty { display: none; }
.cleaner-status.error { color: var(--danger); }
.cleaner-button { min-height: 36px; flex: 0 0 auto; border: 1px solid #b9c7f0; border-radius: 8px; background: #fff; color: var(--accent); padding: 7px 13px; font-weight: 800; cursor: pointer; white-space: nowrap; transition: border-color .18s ease, background .18s ease, color .18s ease, transform .18s ease; }
.cleaner-button:hover { border-color: var(--accent); background: var(--accent); color: #fff; transform: translateY(-1px); }

.progress { max-width: 820px; margin: 0 auto; padding: 26px 4px 4px; }
.progress-head { display: flex; justify-content: space-between; }
.progress-head span, .progress p { color: var(--muted); }
.progress-bar { height: 7px; overflow: hidden; margin-top: 15px; border-radius: 10px; background: #e8ebf0; }
.progress-bar i { display: block; width: 35%; height: 100%; border-radius: 10px; background: var(--accent); animation: progress-move 1.4s ease-in-out infinite alternate; }
.progress p { margin: 12px 0 0; font-size: 13px; }
.workflow-panel > .message { max-width: 820px; margin: 16px auto 0; }
.caption-result { margin-top: 14px; padding: 26px; }
.result-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.result-head h2 { margin: 3px 0 0; font-size: 28px; }
.srt-button { border: 1px solid #cbd7ff; border-radius: 10px; background: var(--accent-soft); color: var(--accent); padding: 10px 15px; font-weight: 800; cursor: pointer; }
.srt-button:hover { border-color: var(--accent); background: var(--accent); color: #fff; }
.summary { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0; }
.summary span { border: 1px solid var(--line); border-radius: 20px; padding: 6px 10px; color: var(--muted); font-size: 12px; }
.caption-row { display: grid; grid-template-columns: 115px 1fr; gap: 20px; padding: 15px 3px; border-top: 1px solid var(--line); }
.caption-row time { color: var(--accent); font-size: 12px; font-variant-numeric: tabular-nums; }
.caption-row p { margin: 0; line-height: 1.7; }

:focus-visible { outline: 3px solid rgba(49, 87, 213, .25); outline-offset: 2px; }
@keyframes progress-move { to { transform: translateX(185%); } }

@media (max-width: 760px) {
  .shell { width: min(100% - 20px, 1120px); margin: 20px auto 50px; }
  .security-notice { align-items: flex-start; padding: 11px 13px; }
  .security-notice-icon { margin-top: 1px; }
  .hero { align-items: flex-start; flex-direction: column; gap: 18px; }
  .tool-tabs { grid-template-columns: 1fr; }
  .tool-tab { padding: 10px 12px; }
  .tool-tab small { display: none; }
  .workspace { grid-template-columns: 1fr; }
  .editor { border-right: 0; border-bottom: 1px solid var(--line); padding: 20px; }
  .controls { padding: 20px; }
  .meta { gap: 10px; flex-direction: column; }
  .audio-result { align-items: stretch; flex-direction: column; margin: 18px 20px 22px; }
  .download-button { width: 100%; }
  .module-heading { align-items: flex-start; flex-direction: column; gap: 8px; padding-top: 15px; }
  .module-heading p { text-align: left; }
  .workflow-panel { padding: 14px; }
  .drop-zone { min-height: 175px; }
  .option-field { align-items: flex-end; }
  .cleaner-head { align-items: flex-start; flex-direction: column; gap: 2px; }
  .cleaner-head p { white-space: normal; }
  .cleaner-rules { grid-template-columns: 1fr 1fr; }
  .cleaner-field:not(.cleaner-field-number) { grid-column: 1 / -1; }
  .cleaner-button { width: 100%; }
  .caption-result { padding: 20px; }
  .caption-row { grid-template-columns: 1fr; gap: 5px; }
}
