/* =====================================================================
 *  S14 · ATELIER —— 第 47–60 号工具全新设计基座
 *
 *  与旧工具站完全隔离：所有类名以 s14- / a14- 开头，不改动任何线上页面。
 *  配色：暖象牙纸 + 墨黑 + 单一强调色（每页独立覆写 --p-1/--p-2）
 *  排版：衬线显示字体（标题）/ 无衬线正文 / 等宽数字，八级字号阶梯
 *  主题：只消费公共导航 #themeToggle 写入的 <html data-theme="dark">，
 *        默认跟随系统、手动切换与记忆均由公共 theme-toggle.js 负责。
 * ===================================================================== */

:root {
    /* 纸墨中性色（浅色） */
    --a14-paper:      #f4f1ea;
    --a14-paper-2:    #eae6dc;
    --a14-card:       #fffdf8;
    --a14-card-2:     #f8f5ee;
    --a14-ink:        #1b1a17;
    --a14-ink-2:      #514c43;
    --a14-ink-3:      #8b8375;
    --a14-line:       #ddd7c9;
    --a14-line-soft:  #ebe6da;
    --a14-shadow:     0 1px 2px rgba(27, 26, 23, .05), 0 16px 44px rgba(27, 26, 23, .07);
    --a14-shadow-sm:  0 1px 2px rgba(27, 26, 23, .06);
    --a14-ok:         #2f6d52;
    --a14-warn:       #9a6015;
    --a14-err:        #a53731;

    /* 每页覆写：主色 / 辅色 / 柔色 / 显示字体 */
    --p-1: #b4451f;
    --p-2: #2f5d6c;
    --p-soft: #f7e8e0;
    --p-ink: #7d2d14;
    --a14-display: "Iowan Old Style", "Baskerville", "Songti SC", "Noto Serif SC", "SimSun", serif;
    --a14-sans: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
    --a14-mono: "SFMono-Regular", Consolas, "Liberation Mono", "DejaVu Sans Mono", monospace;

    /* 字号阶梯：与旧站 15.5px 单一体完全不同 */
    --t-xs: 11.5px; --t-sm: 13px; --t-md: 15px; --t-lg: 17.5px;
    --t-xl: 21px; --t-2xl: 27px; --t-3xl: 38px; --t-4xl: 54px;
    --lh-tight: 1.2; --lh-head: 1.45; --lh-body: 1.85; --lh-loose: 2;

    /* 公共面包屑组件所需变量（不引入旧 tool-station.css） */
    --tsk-card: #fffdf8;
    --tsk-line: #ddd7c9;
    --tsk-faint: #8b8375;
    --tsk-sub: #514c43;
    --tsk-ink: #1b1a17;
    --tsk-brand-ink: var(--p-1);
}

:root[data-theme="dark"] {
    --a14-paper:      #101216;
    --a14-paper-2:    #171b21;
    --a14-card:       #1a1e25;
    --a14-card-2:     #222730;
    --a14-ink:        #f1ece1;
    --a14-ink-2:      #bdb5a7;
    --a14-ink-3:      #8d867a;
    --a14-line:       #343a44;
    --a14-line-soft:  #2a3039;
    --a14-shadow:     0 1px 2px rgba(0, 0, 0, .3), 0 18px 46px rgba(0, 0, 0, .36);
    --a14-shadow-sm:  0 1px 2px rgba(0, 0, 0, .3);
    --a14-ok:         #6fc39a;
    --a14-warn:       #e5b45f;
    --a14-err:        #f08b83;

    --tsk-card: #1a1e25;
    --tsk-line: #343a44;
    --tsk-faint: #8d867a;
    --tsk-sub: #bdb5a7;
    --tsk-ink: #f1ece1;
}

/* ---------- 1. 页面骨架 ---------- */
.s14-page {
    --a14-radius: 14px;
    display: block;
    min-height: 60vh;
    background: var(--a14-paper);
    color: var(--a14-ink-2);
    font-family: var(--a14-sans);
    font-size: var(--t-md);
    line-height: var(--lh-body);
    letter-spacing: .15px;
    padding-bottom: 76px;
    overflow: hidden;
}
.s14-page *, .s14-page *::before, .s14-page *::after { box-sizing: border-box; }
.s14-page .s14-wrap { width: min(1180px, calc(100% - 48px)); margin: 0 auto; }
.s14-page .s14-wrap--wide { width: min(1320px, calc(100% - 48px)); margin: 0 auto; }
.s14-page h1, .s14-page h2, .s14-page h3, .s14-page h4 {
    color: var(--a14-ink); font-family: var(--a14-display);
    line-height: var(--lh-head); margin: 0; font-weight: 700; text-wrap: balance;
}
.s14-page h1 { font-size: clamp(34px, 4.6vw, var(--t-4xl)); letter-spacing: -1.4px; }
.s14-page h2 { font-size: clamp(24px, 2.6vw, var(--t-3xl)); letter-spacing: -.7px; }
.s14-page h3 { font-size: var(--t-xl); letter-spacing: -.3px; }
.s14-page h4 { font-size: var(--t-lg); font-family: var(--a14-sans); font-weight: 700; }
.s14-page p { margin: 0 0 .85em; }
.s14-page p:last-child { margin-bottom: 0; }
.s14-page strong, .s14-page b { color: var(--a14-ink); font-weight: 700; }
.s14-page .kw { font-weight: 700; color: var(--p-ink); box-shadow: inset 0 -6px 0 var(--p-soft); }
.s14-page a { color: var(--p-ink); text-decoration: none; border-bottom: 1px solid var(--p-soft); }
.s14-page a:hover { border-bottom-color: var(--p-1); }
.s14-page code, .s14-page .mono, .s14-page .num {
    font-family: var(--a14-mono); font-variant-numeric: tabular-nums;
}
.s14-page code { background: var(--a14-card-2); padding: 1px 6px; border-radius: 5px; font-size: .92em; }
.s14-page :focus-visible { outline: 2px solid var(--p-1); outline-offset: 3px; }

/* ---------- 2. 公共面包屑（partials.tool-station.crumb）重绘 ---------- */
.s14-page .tsk-crumb-bar {
    background: var(--a14-card); border-bottom: 1px solid var(--a14-line);
    backdrop-filter: none; -webkit-backdrop-filter: none;
}
.s14-page .tsk-crumb-bar-in { max-width: 1180px; padding: 11px 0; }
.s14-page .tsk-crumb { font-size: var(--t-sm); gap: 7px; letter-spacing: .3px; }
.s14-page .tsk-crumb a { color: var(--a14-ink-3); }
.s14-page .tsk-crumb a:hover { color: var(--p-1); }
.s14-page .tsk-crumb-sep { color: var(--a14-ink-3); opacity: .6; }
.s14-page .tsk-crumb-cur {
    color: var(--p-ink); font-weight: 700; background: var(--p-soft);
    padding: 2px 10px; border-radius: 999px;
}
:root[data-theme="dark"] .s14-page .tsk-crumb-cur { color: var(--a14-ink); }

/* ---------- 3. 首屏：价值 3 秒可见，操作入口直接放首屏 ---------- */
.s14-hero {
    display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr);
    gap: clamp(24px, 4vw, 60px); align-items: start;
    padding: clamp(34px, 5vw, 64px) 0 clamp(30px, 4vw, 48px);
}
.s14-hero--single { grid-template-columns: 1fr; }
.s14-hero--reverse { grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); }
.s14-kicker {
    display: inline-flex; align-items: center; gap: 9px;
    font-family: var(--a14-mono); font-size: var(--t-xs); letter-spacing: 2.4px;
    text-transform: uppercase; color: var(--p-ink); font-weight: 700; margin: 0 0 18px;
}
.s14-kicker::before { content: ""; width: 26px; height: 2px; background: var(--p-1); display: inline-block; }
.s14-lede {
    font-size: var(--t-lg); line-height: 1.72; color: var(--a14-ink-2);
    max-width: 56ch; margin: 18px 0 20px;
}
.s14-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 22px; padding: 0; list-style: none; }
.s14-chip {
    display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-sm);
    color: var(--a14-ink-2); background: var(--a14-card); border: 1px solid var(--a14-line);
    border-radius: 999px; padding: 5px 13px; line-height: 1.5;
}
.s14-chip::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--p-1); }
.s14-hero-panel { align-self: start; }
.s14-hero-note { font-size: var(--t-sm); color: var(--a14-ink-3); margin-top: 12px; line-height: 1.7; }

/* ---------- 4. 卡片 / 表单 / 按钮 ---------- */
.s14-card {
    background: var(--a14-card); border: 1px solid var(--a14-line);
    border-radius: var(--a14-radius); box-shadow: var(--a14-shadow);
    padding: clamp(18px, 2.4vw, 28px);
}
.s14-card--flat { box-shadow: none; background: var(--a14-card-2); }
.s14-card__head {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--a14-line-soft);
}
.s14-card__title { font-family: var(--a14-display); font-size: var(--t-xl); color: var(--a14-ink); font-weight: 700; margin: 0; }
.s14-card__hint { font-size: var(--t-sm); color: var(--a14-ink-3); }
.s14-field { margin-bottom: 16px; }
.s14-field:last-child { margin-bottom: 0; }
.s14-label {
    display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px;
    font-size: var(--t-sm); font-weight: 700; color: var(--a14-ink); margin-bottom: 7px; letter-spacing: .3px;
}
.s14-label small { font-weight: 400; color: var(--a14-ink-3); font-size: var(--t-xs); }
.s14-input, .s14-select, .s14-textarea {
    display: block; width: 100%; font-family: var(--a14-sans); font-size: var(--t-md);
    color: var(--a14-ink); background: var(--a14-card-2);
    border: 1px solid var(--a14-line); border-radius: 9px; padding: 10px 13px;
    line-height: 1.6; transition: border-color .15s, box-shadow .15s;
}
.s14-textarea { min-height: 104px; resize: vertical; font-family: var(--a14-mono); font-size: var(--t-sm); }
.s14-input:focus, .s14-select:focus, .s14-textarea:focus {
    outline: none; border-color: var(--p-1); box-shadow: 0 0 0 3px var(--p-soft);
}
.s14-input::placeholder, .s14-textarea::placeholder { color: var(--a14-ink-3); opacity: .8; }
.s14-select { appearance: none; padding-right: 34px;
    background-image: linear-gradient(45deg, transparent 50%, var(--a14-ink-3) 50%), linear-gradient(135deg, var(--a14-ink-3) 50%, transparent 50%);
    background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
.s14-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.s14-row > .s14-field { flex: 1 1 150px; margin-bottom: 0; }
.s14-grid { display: grid; gap: 16px; }
.s14-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.s14-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.s14-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.s14-btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.s14-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    font-family: var(--a14-sans); font-size: var(--t-sm); font-weight: 700; letter-spacing: .4px;
    color: var(--a14-ink); background: var(--a14-card-2);
    border: 1px solid var(--a14-line); border-radius: 9px; padding: 10px 17px;
    cursor: pointer; transition: transform .13s, box-shadow .13s, background .13s, color .13s;
    line-height: 1.5; min-height: 40px;
}
.s14-btn:hover { transform: translateY(-1px); border-color: var(--p-1); color: var(--p-ink); }
.s14-btn:active { transform: translateY(0); }
.s14-btn--primary { color: #fff; background: var(--p-1); border-color: var(--p-1); box-shadow: 0 6px 18px rgba(0,0,0,.12); }
.s14-btn--primary:hover { color: #fff; filter: brightness(1.08); }
.s14-btn--ghost { background: transparent; }
.s14-btn--sm { padding: 6px 11px; min-height: 32px; font-size: var(--t-xs); }
.s14-btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.s14-seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--a14-card-2); border: 1px solid var(--a14-line); border-radius: 10px; }
.s14-seg button {
    font-size: var(--t-sm); font-weight: 600; color: var(--a14-ink-2); background: transparent;
    border: 0; border-radius: 7px; padding: 7px 13px; cursor: pointer;
}
.s14-seg button[aria-pressed="true"] { background: var(--p-1); color: #fff; }
.s14-inline-check { display: inline-flex; align-items: center; gap: 7px; font-size: var(--t-sm); color: var(--a14-ink-2); cursor: pointer; }
.s14-inline-check input { accent-color: var(--p-1); width: 15px; height: 15px; }

/* ---------- 5. 结果 / 数据展示 ---------- */
.s14-out {
    margin-top: 18px; background: var(--a14-card-2); border: 1px solid var(--a14-line);
    border-radius: 10px; padding: 16px 18px; min-height: 66px;
}
.s14-out[hidden] { display: none; }
.s14-out-title { font-size: var(--t-xs); letter-spacing: 1.6px; text-transform: uppercase; color: var(--a14-ink-3); margin-bottom: 10px; font-family: var(--a14-mono); }
.s14-kpi { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.s14-kpi__i { background: var(--a14-card); border: 1px solid var(--a14-line); border-radius: 10px; padding: 13px 15px; }
.s14-kpi__k { font-size: var(--t-xs); color: var(--a14-ink-3); letter-spacing: .4px; }
.s14-kpi__v { font-family: var(--a14-mono); font-size: var(--t-xl); font-weight: 700; color: var(--a14-ink); line-height: 1.35; margin-top: 3px; word-break: break-word; }
.s14-kpi__u { font-size: var(--t-xs); color: var(--a14-ink-3); margin-left: 4px; font-family: var(--a14-sans); }
.s14-table-wrap { overflow-x: auto; border: 1px solid var(--a14-line); border-radius: 10px; }
.s14-table { width: 100%; border-collapse: collapse; font-size: var(--t-sm); background: var(--a14-card); }
.s14-table th, .s14-table td { padding: 10px 13px; text-align: left; border-bottom: 1px solid var(--a14-line-soft); vertical-align: top; }
.s14-table th { background: var(--a14-card-2); color: var(--a14-ink); font-weight: 700; white-space: nowrap; font-size: var(--t-xs); letter-spacing: .5px; }
.s14-table tr:last-child td { border-bottom: 0; }
.s14-table td.num, .s14-table th.num { font-family: var(--a14-mono); font-variant-numeric: tabular-nums; }
.s14-table tbody tr:hover td { background: var(--p-soft); }
:root[data-theme="dark"] .s14-table tbody tr:hover td { background: var(--a14-card-2); }
.s14-note { font-size: var(--t-sm); line-height: 1.75; color: var(--a14-ink-3); }
.s14-msg { border-left: 3px solid var(--p-1); background: var(--p-soft); padding: 11px 14px; border-radius: 0 8px 8px 0; font-size: var(--t-sm); color: var(--a14-ink-2); }
.s14-msg--ok { border-left-color: var(--a14-ok); }
.s14-msg--err { border-left-color: var(--a14-err); }
.s14-badge { display: inline-block; font-size: var(--t-xs); font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--p-soft); color: var(--p-ink); }
:root[data-theme="dark"] .s14-badge { color: var(--a14-ink); }
.s14-badge--mute { background: var(--a14-card-2); color: var(--a14-ink-3); }
.s14-empty { text-align: center; color: var(--a14-ink-3); font-size: var(--t-sm); padding: 20px 8px; }
.s14-tagline { font-family: var(--a14-display); font-size: var(--t-2xl); color: var(--a14-ink); line-height: 1.5; }

/* ---------- 6. 操作完成后的弹窗（页面加载时绝不触发）与提示条 ---------- */
.s14-mask {
    position: fixed; inset: 0; z-index: 9000; display: grid; place-items: center;
    background: rgba(20, 18, 15, .58); padding: 18px;
}
.s14-mask[hidden] { display: none; }
.s14-modal {
    width: min(520px, 100%); max-height: 84vh; overflow: auto;
    background: var(--a14-card); color: var(--a14-ink-2); border: 1px solid var(--a14-line);
    border-radius: 16px; box-shadow: 0 30px 80px rgba(0,0,0,.3); padding: 26px;
}
.s14-modal h3 { margin-bottom: 10px; }
.s14-modal__body { font-size: var(--t-md); line-height: 1.8; }
.s14-modal__foot { margin-top: 20px; display: flex; justify-content: flex-end; gap: 10px; }
.s14-toast {
    position: fixed; z-index: 9100; left: 50%; bottom: 34px; transform: translateX(-50%) translateY(12px);
    background: var(--a14-ink); color: var(--a14-paper); font-size: var(--t-sm);
    padding: 10px 18px; border-radius: 999px; box-shadow: var(--a14-shadow);
    opacity: 0; pointer-events: none; transition: opacity .22s, transform .22s;
}
.s14-toast[data-show="1"] { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 7. 说明内容区：分段、行距、关键词加粗 ---------- */
.s14-section { padding: 46px 0 0; }
.s14-section__head { margin-bottom: 22px; }
.s14-section__head p { color: var(--a14-ink-3); font-size: var(--t-sm); margin-top: 8px; }
.s14-prose { max-width: 78ch; font-size: var(--t-md); line-height: var(--lh-loose); color: var(--a14-ink-2); }
.s14-prose p { margin-bottom: 1.1em; }
.s14-prose h3 { margin: 1.4em 0 .5em; }
.s14-prose ul, .s14-prose ol { padding-left: 1.4em; margin: 0 0 1.1em; }
.s14-prose li { margin-bottom: .5em; }
.s14-faq { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.s14-faq details { background: var(--a14-card); border: 1px solid var(--a14-line); border-radius: 10px; padding: 14px 17px; }
.s14-faq summary { cursor: pointer; font-weight: 700; color: var(--a14-ink); font-size: var(--t-md); }
.s14-faq p { margin: 10px 0 0; font-size: var(--t-sm); line-height: 1.8; color: var(--a14-ink-2); }
.s14-kwlist { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.s14-kwlist span { font-size: var(--t-xs); color: var(--a14-ink-3); background: var(--a14-card-2); border: 1px solid var(--a14-line); padding: 4px 10px; border-radius: 6px; }
.s14-footnote { margin-top: 38px; padding-top: 18px; border-top: 1px solid var(--a14-line); font-size: var(--t-sm); color: var(--a14-ink-3); line-height: 1.8; }

/* ---------- 8. 图片：压缩矢量、懒加载占位、不产生布局抖动 ---------- */
.s14-page img[loading="lazy"] {
    background: var(--a14-card-2); color: transparent;
    animation: s14-fade .35s ease both;
}
@keyframes s14-fade { from { opacity: 0 } to { opacity: 1 } }

/* ---------- 9. 响应式 ---------- */
@media (max-width: 980px) {
    .s14-hero, .s14-hero--reverse { grid-template-columns: 1fr; }
    .s14-hero { padding-top: 30px; }
    .s14-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .s14-faq { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
    .s14-page .s14-wrap, .s14-page .s14-wrap--wide { width: calc(100% - 28px); }
    .s14-page { padding-bottom: 52px; }
    .s14-grid--2, .s14-grid--3, .s14-grid--4 { grid-template-columns: 1fr; }
    .s14-hero { gap: 22px; }
    .s14-lede { font-size: var(--t-md); }
    .s14-btn { flex: 1 1 auto; }
    .s14-card { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
    .s14-page *, .s14-page *::before, .s14-page *::after {
        animation-duration: .001ms !important; transition-duration: .001ms !important;
    }
}
