/* ===========================================================
   TikTok Transcript — single stylesheet, no framework
   Palette: 普鲁斯蓝 Prussian Blue #0B3868  +  浮光 Fuguang #B89076
   =========================================================== */

:root {
  /* --- brand --- */
  --prussian: #0B3868;          /* 主色 · 普鲁斯蓝 */
  --fuguang: #B89076;           /* 辅色 · 浮光 */

  /* --- surfaces --- */
  --bg: #FBFCFE;                /* page background: a whisper of blue, not pure white */
  --surface: #FFFFFF;           /* cards / inputs */
  --soft: #F1F4F9;              /* muted panels, tabs track */
  --line: #DFE5EE;              /* borders */
  --line-strong: #C6D0DE;       /* dashed drop border */

  /* --- text --- */
  --fg: #10233A;                /* body text: Prussian-derived near-black-blue */
  --heading: var(--prussian);   /* headings carry the brand colour */
  --muted: #5F6E82;             /* secondary text */

  /* --- interactive --- */
  --accent: var(--prussian);    /* primary buttons */
  --accent-fg: #FFFFFF;
  --accent-soft: #E7EDF5;       /* hover tints */
  --link: var(--prussian);

  /* --- feedback --- */
  --ok: #1F6B4E;
  --warn-bg: #FDF6EE;           /* warm, keyed to 浮光 */
  --warn-line: #E8D2BC;
  --warn-ink: #7A5230;

  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  background: var(--prussian);
  border-bottom: 1px solid var(--prussian);
}
.brand {
  font-weight: 650;
  letter-spacing: -0.01em;
  color: #FFFFFF;
  font-size: 17px;
}
.badge-no-upload {
  font-size: 12px;
  color: var(--fuguang);
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 2px 9px;
  white-space: nowrap;
}

main { max-width: 780px; margin: 0 auto; padding: 0 20px 64px; }

/* ---------- hero / tool ---------- */
.hero { padding-top: 28px; }

h1 {
  font-size: clamp(24px, 5.2vw, 34px);
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0 0 10px;
  color: var(--heading);
}
.sub { margin: 0 0 22px; color: var(--muted); }

/* ---------- tabs ---------- */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 14px;
}
.tab {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  padding: 9px 10px;
  min-height: 44px;
  border-radius: 7px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.tab.active { background: var(--surface); color: var(--prussian); font-weight: 600; box-shadow: 0 1px 2px rgba(11,56,104,.10); }

/* ---------- panels ---------- */
.panel { display: none; }
.panel.active { display: block; }

/* drop zone */
.drop {
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--soft);
  padding: 30px 18px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.drop:hover, .drop:focus-visible { border-color: var(--fuguang); background: #F6F8FC; }
.drop.over { border-color: var(--prussian); background: var(--accent-soft); }
.drop-inner { pointer-events: none; }
.drop-icon {
  font-size: 22px;
  width: 40px; height: 40px;
  line-height: 40px;
  margin: 0 auto 10px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--prussian);
}
.drop-title { margin: 0 0 4px; font-weight: 600; }
.drop-hint { margin: 0 0 10px; font-size: 14px; color: var(--muted); }
.drop-note { margin: 0; font-size: 12.5px; color: #7C8AA0; }

.linklike {
  border: 0; background: none; padding: 0;
  color: var(--prussian);
  text-decoration: underline;
  text-decoration-color: var(--fuguang);
  text-underline-offset: 2px;
  font: inherit;
  cursor: pointer;
  pointer-events: auto;
}
.linklike:hover { color: var(--fuguang); }

/* The browse control is the only guaranteed way into the file picker, so it gets a real
   tap target instead of a small inline text link. Same treatment as .remove-btn: an inline
   <button> baseline-aligns its box to the font's line box, which leaves only ~21px of
   height — enough for a cursor, not for a thumb. */
.browse-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 168px;
  padding: 10px 18px;
  font-size: 14px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  /* .drop-inner sets pointer-events:none so taps anywhere else land on .drop; this control
     must opt back in or it is unhittable and the click falls through to the drop zone. */
  pointer-events: auto;
  position: relative;
  z-index: 2;
}
.browse-btn:active { background: var(--accent-soft); border-color: var(--prussian); }

.filemeta {
  display: flex; align-items: center; gap: 10px;
  margin-top: 10px; padding: 10px 12px;
  background: var(--soft); border: 1px solid var(--line); border-radius: var(--radius);
  font-size: 14px;
}
.fname { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.fsize { color: var(--muted); white-space: nowrap; }

/* The Remove control must stay a comfortable tap target on a phone.
   iOS wants roughly 44x44 CSS px; a small inline button in a wrapped flex row
   can shrink below that and taps then miss it. */
.remove-btn {
  flex: 0 0 auto;
  min-height: 40px;
  min-width: 84px;
  padding: 9px 14px;
  font-size: 14px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  position: relative;
  z-index: 2;
}
.remove-btn:active { background: var(--accent-soft); border-color: var(--prussian); }

/* link panel */
.lbl { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--heading); }
.textin {
  width: 100%; padding: 12px 13px; font: inherit; font-size: 15px;
  border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--fg);
}
.textin:focus { outline: 2px solid rgba(11,56,104,.22); border-color: var(--prussian); }
.textin::placeholder { color: #93A0B2; }

.notice {
  margin-top: 12px; padding: 12px 14px;
  background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: var(--radius);
  font-size: 14px;
  color: var(--warn-ink);
}
.notice strong { color: #6B4423; }

/* ---------- controls ---------- */
.controls {
  display: flex; gap: 10px; align-items: flex-end;
  margin-top: 14px; flex-wrap: wrap;
}
.ctl { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; }
.ctl-lbl { font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--heading); }
select {
  width: 100%; padding: 11px 12px; font: inherit; font-size: 14px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--fg);
}
select:focus { outline: 2px solid rgba(11,56,104,.22); border-color: var(--prussian); }
.primary {
  flex: 0 0 auto;
  padding: 12px 22px;
  font: inherit; font-weight: 600;
  background: var(--prussian); color: #FFFFFF;
  border: 1px solid var(--prussian); border-radius: var(--radius);
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.primary:disabled {
  background: #C3CCDA;
  border-color: #C3CCDA;
  color: #FFFFFF;
  cursor: not-allowed;
}
.primary:not(:disabled):hover { background: #0E4480; border-color: #0E4480; }

/* ---------- progress ---------- */
.progress { margin-top: 16px; }
.bar { height: 6px; background: var(--soft); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.fill { height: 100%; width: 0; background: var(--fuguang); transition: width .25s; }
.pmsg { margin: 8px 0 0; font-size: 13.5px; color: var(--muted); }

/* ---------- output ---------- */
.output { margin-top: 18px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.out-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; background: var(--soft); border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.fmt { display: flex; gap: 2px; }
.fmtb {
  border: 1px solid transparent; background: transparent; color: var(--muted);
  font: inherit; font-size: 13px; font-weight: 600;
  padding: 5px 12px; border-radius: 7px; cursor: pointer;
}
.fmtb.active { background: var(--surface); color: var(--prussian); border-color: var(--line-strong); }
.out-actions { display: flex; gap: 8px; }
.ghost {
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--prussian);
  font: inherit; font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 7px; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.ghost:hover { background: var(--accent-soft); border-color: var(--prussian); }
.out-body {
  margin: 0; padding: 14px;
  max-height: 420px; overflow: auto;
  font-family: var(--mono); font-size: 13px; line-height: 1.65;
  white-space: pre-wrap; word-break: break-word;
  color: #17324F;
}

/* ---------- prose ---------- */
.prose { margin-top: 56px; }
.prose h2 {
  font-size: 19px; letter-spacing: -0.01em;
  margin: 34px 0 8px; padding-top: 22px; border-top: 1px solid var(--line);
  color: var(--heading);
}
.prose h2:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.prose p { margin: 0 0 12px; }
.prose ol.steps { padding-left: 20px; margin: 0 0 12px; }
.prose ol.steps li { margin-bottom: 7px; }
.fineprint { font-size: 13px; color: var(--muted); }
code { font-family: var(--mono); font-size: .92em; background: var(--accent-soft); color: #17324F; padding: 1px 5px; border-radius: 5px; }
strong { color: var(--heading); }

details { border-bottom: 1px solid var(--line); padding: 12px 0; }
details summary { cursor: pointer; font-weight: 600; color: var(--heading); }
details summary::-webkit-details-marker { display: none; }
details summary::before { content: "+ "; color: var(--fuguang); font-weight: 700; }
details[open] summary::before { content: "– "; }
details p { margin: 9px 0 0; color: var(--fg); }

.foot {
  max-width: 780px; margin: 0 auto; padding: 22px 20px 40px;
  border-top: 1px solid var(--line);
  font-size: 12.5px; color: var(--muted);
}
.foot p { margin: 0; }
.foot-links { margin-top: 6px; }
.foot a { color: var(--prussian); text-decoration-color: var(--fuguang); text-underline-offset: 2px; }
.foot a:hover { color: var(--fuguang); }
.prose a {
  color: var(--prussian);
  text-decoration-color: var(--fuguang);
  text-underline-offset: 2px;
}
.prose a:hover { color: var(--fuguang); }

/* ---------- phone ---------- */
@media (max-width: 560px) {
  main { padding: 0 14px 48px; }
  .hero { padding-top: 18px; }
  .topbar { padding: 12px 14px; }
  .badge-no-upload { font-size: 11px; padding: 2px 7px; }
  .drop { padding: 24px 12px; }
  .controls { flex-direction: column; align-items: stretch; }
  .ctl { flex: 1 1 auto; }
  .primary { width: 100%; }
  .out-head { align-items: stretch; }
  .out-actions { width: 100%; }
  .out-actions .ghost { flex: 1; }
  .out-body { font-size: 12.5px; max-height: 320px; }
  .prose { margin-top: 40px; }
  .filemeta { flex-wrap: wrap; gap: 6px 10px; align-items: center; }
  .fname { flex: 1 1 100%; min-width: 0; }
  .fsize { flex: 0 1 auto; }
  .remove-btn { flex: 1 1 100%; min-height: 44px; width: 100%; }
  /* Full-width so the whole row is the target, not just the words. */
  .drop-hint { display: flex; flex-direction: column; align-items: center; gap: 6px; }
  .browse-btn { display: flex; width: 100%; min-height: 48px; }
  /* Inline links in prose and the footer are only as tall as the text line (~21px), which is
     under the thumb minimum. Inline-block plus padding gives a real tap area without
     breaking the sentence flow or the line rhythm too badly. */
  .prose a, .foot a {
    display: inline-block;
    padding: 10px 2px;
    min-height: 44px;
    line-height: 24px;
  }
  .textin { font-size: 16px; } /* prevents iOS zoom-on-focus */
}
