/* =====================================================================
 * 工具 16 · 开题报告模板 —— 独立视觉「论文稿纸 / 双栏写作台」
 * 母题：左侧装订孔稿纸、衬线标题、紫墨色章节编号、右栏实时 Markdown 预览。
 * 与其它工具完全不同的「编辑文档」形态，不是结果卡片堆叠。
 * ===================================================================== */
.fl9.tp {
    --tp-ink: #4e3f8c;
    --tp-ink2: #352966;
    --tp-soft: #f0ecfb;
    --tp-paper: #fffefa;
    --tp-line: #ddd6ee;
    --tp-accent: #b58a3c;
}
:root[data-theme="dark"] .fl9.tp {
    --tp-ink: #b9a6ff;
    --tp-ink2: #d6caff;
    --tp-soft: #251f3d;
    --tp-paper: #151c2c;
    --tp-line: #363152;
    --tp-accent: #e6c07c;
}

/* ---------- 首屏 ---------- */
.tp-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(330px, .95fr);
    gap: 26px;
    align-items: stretch;
    padding: 16px 0 8px;
}
.tp-hero-copy { position: relative; padding: 10px 24px 10px 34px; }
.tp-hero-copy::before {
    content: ""; position: absolute; left: 0; top: 4px; bottom: 4px; width: 16px;
    border-right: 2px solid var(--tp-line);
    background-image: radial-gradient(circle at 6px 14px, var(--tp-line) 0 3.5px, transparent 4px);
    background-size: 16px 62px; background-repeat: repeat-y;
}
.fl9.tp .fl9-kicker { color: var(--tp-ink); }
.tp-hero-copy h1 { font-family: var(--fl-serif); font-size: clamp(34px, 4.4vw, 48px); color: var(--tp-ink2); margin: 12px 0 14px; }
.tp-hero-copy h1::after { content: ""; display: block; width: 100%; height: 1px; margin-top: 16px; background: repeating-linear-gradient(90deg, var(--tp-line) 0 8px, transparent 8px 14px); }
.fl9.tp b, .fl9.tp .fl9-lede b { color: var(--tp-ink2); }
.tp-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 22px 0; }
.tp-steps > div { border-top: 2px solid var(--tp-ink); padding-top: 9px; }
.tp-steps span { display: block; font-family: var(--fl-mono); font-size: 11px; color: var(--tp-accent); }
.tp-steps b { display: block; font-size: 14px; margin-top: 2px; }
.tp-steps small { display: block; font-size: 11px; color: var(--fl-muted); }
.tp-hero-copy .fl9-note { margin-top: 18px; }

.tp-setup { background: var(--tp-paper); border: 1px solid var(--tp-line); border-radius: 4px; box-shadow: var(--fl-sh); align-self: start; }
.tp-setup-hd { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 13px 18px; border-bottom: 1px solid var(--tp-line); background: var(--tp-soft); }
.tp-setup-hd h2 { font-family: var(--fl-serif); font-size: 19px; color: var(--tp-ink2); }
.tp-setup-body { padding: 16px 18px 18px; }
.tp-setup .fl9-field > span { font-size: 12px; }
.tp-setup input, .tp-setup select { border-radius: 3px; }
.tp-setup #tpTopic { font-family: var(--fl-serif); font-size: 15px; }
.tp-setup .fl9-row { margin-top: 12px; }
.tp-setup .fl9-btn { border-radius: 3px; }
.tp-setup .fl9-btn-main { background: var(--tp-ink); border-color: var(--tp-ink); }
.tp-setup .fl9-btn-main:hover { background: var(--tp-ink2); border-color: var(--tp-ink2); }

/* ---------- 工作区：章节编辑 + 预览 ---------- */
.fl9.tp .fl9-kpi { border-top: 3px solid var(--tp-ink); border-radius: 2px; }
.fl9.tp .fl9-kpi .v { color: var(--tp-ink2); }
.tp-workspace { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(320px, .92fr); gap: 16px; margin-top: 16px; }
.tp-outline { display: grid; gap: 10px; }
.tp-chapter { display: grid; grid-template-columns: 46px minmax(0, 1fr); gap: 12px; background: var(--fl-card); border: 1px solid var(--tp-line); border-radius: 4px; padding: 13px 14px; }
.tp-chapter-no { font-family: var(--fl-mono); font-size: 20px; font-weight: 700; color: var(--tp-ink); line-height: 1.2; border-right: 1px solid var(--tp-line); }
.tp-chapter-hd { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.tp-chapter-hd h3 { font-family: var(--fl-serif); font-size: 16px; color: var(--tp-ink2); }
.tp-chapter-hd span { font-family: var(--fl-mono); font-size: 11.5px; color: var(--tp-ink); background: var(--tp-soft); padding: 1px 8px; border-radius: 2px; }
.tp-chapter-tip { font-size: 12.5px; line-height: 1.8; color: var(--fl-ink2); margin: 6px 0 7px; }
.tp-chapter-tip b { color: var(--tp-ink2); }
.tp-chapter textarea { min-height: 62px; font-family: var(--fl-sans); font-size: 13px; line-height: 1.75; border-radius: 3px; }

.tp-preview { display: flex; flex-direction: column; background: var(--tp-paper); border: 1px solid var(--tp-line); border-radius: 4px; overflow: hidden; min-height: 420px; }
.tp-preview-hd { display: flex; justify-content: space-between; gap: 10px; padding: 11px 15px; border-bottom: 1px solid var(--tp-line); background: var(--tp-soft); font-family: var(--fl-mono); font-size: 11px; letter-spacing: .06em; color: var(--tp-ink2); }
.tp-preview-body { flex: 1; margin: 0; padding: 18px 20px; max-height: 640px; overflow: auto; white-space: pre-wrap; font-family: var(--fl-mono); font-size: 12.5px; line-height: 1.95; color: var(--fl-ink2); background:
    repeating-linear-gradient(180deg, transparent 0 25px, var(--tp-line) 25px 26px);
}

/* ---------- 进度 / 问题 ---------- */
.fl9.tp .tp-cols { margin-top: 14px; }
.fl9.tp .fl9-scroll th { color: var(--tp-ink2); }
.tp-issue { display: flex; gap: 9px; align-items: flex-start; padding: 8px 0; border-bottom: 1px dashed var(--tp-line); font-size: 13px; line-height: 1.8; color: var(--fl-ink2); }
.tp-issue:last-child { border-bottom: 0; }
.tp-issue i { font-style: normal; flex: 0 0 auto; width: 19px; height: 19px; display: grid; place-items: center; border-radius: 50%; background: var(--tp-soft); color: var(--tp-ink2); font-family: var(--fl-mono); font-size: 10px; }
.tp-issue b { color: var(--tp-ink2); }

/* ---------- 批量 / 清洗 ---------- */
.tp-clean { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 14px; padding: 11px 13px; border: 1px dashed var(--tp-line); border-radius: 3px; background: var(--fl-card2); font-size: 12.5px; }
.tp-clean > b { color: var(--tp-ink2); }
.tp-clean code { margin-left: auto; max-width: 100%; overflow-wrap: anywhere; }
.fl9.tp #tpBatchWrap { margin-top: 14px; }
.fl9.tp .fl9-read { border-top-color: var(--tp-ink); }
.fl9.tp .fl9-read h2 { font-family: var(--fl-serif); }

@media (max-width: 980px) {
    .tp-hero { grid-template-columns: 1fr; }
    .tp-workspace { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .tp-hero-copy { padding-left: 22px; }
    .tp-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tp-chapter { grid-template-columns: 34px minmax(0, 1fr); gap: 8px; padding: 10px; }
    .tp-chapter-no { font-size: 16px; }
    .tp-clean code { margin-left: 0; width: 100%; }
}
