/* ======================================================================
 * NW11 · 第 50–60 号工具（简谱/乐理/白平衡/RAW/翡翠/连读/CEFR/意语/葡语/
 * AI 扩图/AI 口语）共享设计底座 base.css
 * ----------------------------------------------------------------------
 * 只提供「跨 11 个工具都成立」的最小骨架与原子件：
 *   · 设计令牌 + 深浅主题（消费公共导航 #themeToggle 写入的 data-theme）
 *   · 字体层级 / 行距 / 分段基线
 *   · 容器 / 卡片 / 表单 / 按钮 / 分段控件 / 标签 / 表格 / 折叠 / 吐司
 * 每个工具的配色、构图与首屏版式由 css/nw11/{slug}.css 独立决定，
 * 11 页互不复用视觉方案，禁止在此处写任何具体工具的样式。
 * ====================================================================== */

.nx {
    /* ---------- 令牌默认值（各页用自己的 [data-page] 覆盖成独特配色） ---------- */
    --bg: #f7f6f2;
    --bg2: #efede5;
    --card: #ffffff;
    --card2: #f6f4ee;
    --card3: #eceae0;
    --ink: #1c1a15;
    --ink2: #45423a;
    --muted: #7a766a;
    --line: #ddd9cc;
    --line2: #e9e6da;
    --accent: #7a5c33;
    --accent-ink: #ffffff;
    --accent-soft: #f0e7d5;
    --accent2: #a0522d;
    --accent2-soft: #f3e2d3;
    --ok: #2c7a4b;
    --ok-bg: #e2f2e8;
    --warn: #8f6400;
    --warn-bg: #faf0d4;
    --bad: #b03630;
    --bad-bg: #f9e7e4;
    --info: #1a6e84;
    --info-bg: #e0f1f5;
    --shadow-xs: 0 1px 2px rgba(28, 24, 14, .06);
    --shadow: 0 2px 10px rgba(28, 24, 14, .07), 0 14px 36px rgba(28, 24, 14, .08);
    --shadow-lg: 0 6px 22px rgba(28, 24, 14, .1), 0 32px 70px rgba(28, 24, 14, .14);
    --radius: 16px;
    --radius-sm: 10px;
    --radius-pill: 999px;
    --font-head: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
    --font-body: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
    --font-mono: "JetBrains Mono", "Cascadia Code", Consolas, "Courier New", monospace;
    --head-weight: 800;
    --tracking: 0;
    --gap: 18px;

    display: block;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 15.5px;
    line-height: 1.85;
    padding: 0 0 64px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* 深色主题：只消费公共导航栏主题开关写入的 <html data-theme="dark"> */
:root[data-theme="dark"] .nx {
    --bg: #14120e;
    --bg2: #1b1813;
    --card: #201d17;
    --card2: #272419;
    --card3: #302c22;
    --ink: #ede9dd;
    --ink2: #c6c0ae;
    --muted: #948e7c;
    --line: #3b3628;
    --line2: #2e2a1f;
    --accent: #cfa25f;
    --accent-ink: #191405;
    --accent-soft: #332a15;
    --accent2: #d98e5c;
    --accent2-soft: #3a2a1c;
    --ok: #6cc08d;
    --ok-bg: #1d3527;
    --warn: #d9b25c;
    --warn-bg: #352c14;
    --bad: #e2857e;
    --bad-bg: #3b211e;
    --info: #5cb9d1;
    --info-bg: #173038;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .5);
    --shadow: 0 2px 10px rgba(0, 0, 0, .5), 0 14px 36px rgba(0, 0, 0, .38);
    --shadow-lg: 0 6px 22px rgba(0, 0, 0, .55), 0 32px 70px rgba(0, 0, 0, .46);
}

.nx *,
.nx *::before,
.nx *::after { box-sizing: border-box; }

/* ---------- 1. 容器 ---------- */
.nx-wrap {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 22px;
}

/* ---------- 2. 字体层级与排版 ---------- */
.nx h1, .nx h2, .nx h3, .nx h4 {
    font-family: var(--font-head);
    font-weight: var(--head-weight);
    letter-spacing: var(--tracking);
    line-height: 1.32;
    margin: 0;
    color: var(--ink);
}
.nx h1 { font-size: clamp(27px, 3.5vw, 41px); letter-spacing: -.018em; }
.nx h2 { font-size: clamp(19px, 2.1vw, 23px); letter-spacing: -.01em; }
.nx h3 { font-size: 17px; }
.nx h4 { font-size: 15px; }
.nx p { margin: 0 0 12px; }
.nx p:last-child { margin-bottom: 0; }
.nx b, .nx strong { font-weight: 700; color: var(--ink); }
.nx .kw { color: var(--accent); font-weight: 700; }
.nx a { color: var(--accent); text-decoration: none; }
.nx a:hover { text-decoration: underline; }
.nx small { font-size: 12.5px; color: var(--muted); }
.nx code {
    font-family: var(--font-mono);
    font-size: .92em;
    background: var(--card2);
    border: 1px solid var(--line2);
    border-radius: 6px;
    padding: 1px 6px;
}
.nx ul, .nx ol { margin: 6px 0 10px; padding-left: 20px; }
.nx li { margin-bottom: 4px; }
.nx hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

/* ---------- 3. 通用区块头 ---------- */
.nx-sec { margin-top: 34px; }
.nx-sec-hd {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.nx-sec-hd .idx {
    font: 700 11px var(--font-mono);
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--accent2);
}
.nx-sec-hd h2 { font-size: clamp(19px, 2.1vw, 23px); }
.nx-sec-hd .hint { font-size: 12.5px; color: var(--muted); margin-left: auto; }

.nx-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xs);
    padding: 20px 22px;
}
.nx-card + .nx-card { margin-top: var(--gap); }

/* ---------- 4. 表单 ---------- */
.nx-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.nx-label { font-size: 13px; font-weight: 700; color: var(--ink2); letter-spacing: .02em; }
.nx-input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--card2);
    color: var(--ink);
    font: 500 15px/1.6 var(--font-body);
    padding: 9px 12px;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.nx-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
select.nx-input { cursor: pointer; }
textarea.nx-input { resize: vertical; min-height: 96px; line-height: 1.8; }

/* ---------- 5. 按钮 ---------- */
.nx-btn {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--card2);
    color: var(--ink);
    font: 700 14px/1 var(--font-body);
    padding: 11px 18px;
    cursor: pointer;
    transition: transform .12s, box-shadow .15s, border-color .15s, background .15s;
    user-select: none;
}
.nx-btn:hover { border-color: var(--accent); box-shadow: var(--shadow-xs); }
.nx-btn:active { transform: translateY(1px); }
.nx-btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.nx-btn--main {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-ink);
    box-shadow: var(--shadow-xs);
}
.nx-btn--main:hover { box-shadow: var(--shadow); }
.nx-btn--ai {
    background: linear-gradient(135deg, var(--accent2), var(--accent));
    border: 0;
    color: var(--accent-ink);
}
.nx-btn--sm { padding: 7px 12px; font-size: 13px; border-radius: 8px; }

/* ---------- 6. 分段控件 / 胶囊 ---------- */
.nx-seg {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    background: var(--card2);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 4px;
}
.nx-seg button {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--ink2);
    font: 700 13.5px/1 var(--font-body);
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: background .15s, color .15s;
    white-space: nowrap;
}
.nx-seg button:hover { color: var(--ink); }
.nx-seg button.on {
    background: var(--accent);
    color: var(--accent-ink);
    box-shadow: var(--shadow-xs);
}

/* ---------- 7. 标签 / 徽章 ---------- */
.nx-tag {
    display: inline-block;
    font: 700 12px/1 var(--font-body);
    padding: 5px 10px;
    border-radius: var(--radius-pill);
    background: var(--accent-soft);
    color: var(--accent);
    white-space: nowrap;
}
.nx-tag.is-ok   { background: var(--ok-bg);   color: var(--ok); }
.nx-tag.is-warn { background: var(--warn-bg); color: var(--warn); }
.nx-tag.is-bad  { background: var(--bad-bg);  color: var(--bad); }
.nx-tag.is-info { background: var(--info-bg); color: var(--info); }

/* ---------- 8. 表格 ---------- */
.nx-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.8px;
    line-height: 1.7;
}
.nx-table th, .nx-table td {
    text-align: left;
    padding: 9px 12px;
    border-bottom: 1px solid var(--line2);
    vertical-align: top;
}
.nx-table th {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--muted);
    letter-spacing: .04em;
    white-space: nowrap;
}
.nx-table tr:last-child td { border-bottom: 0; }
.nx-table-scroll { overflow-x: auto; }

/* ---------- 9. 折叠 FAQ ---------- */
.nx-faq { display: grid; gap: 10px; }
.nx-faq details {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.nx-faq summary {
    cursor: pointer;
    font-weight: 700;
    font-size: 14.8px;
    padding: 14px 18px;
    list-style: none;
    position: relative;
    padding-right: 40px;
    color: var(--ink);
}
.nx-faq summary::-webkit-details-marker { display: none; }
.nx-faq summary::after {
    content: '+';
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-52%);
    font: 700 18px var(--font-mono);
    color: var(--accent);
}
.nx-faq details[open] summary::after { content: '−'; }
.nx-faq details > div { padding: 0 18px 15px; }
.nx-faq details > div p { font-size: 13.8px; line-height: 1.85; color: var(--ink2); margin: 0; }
.nx-faq details > div p b { color: var(--ink); }

/* ---------- 10. 提示条 ---------- */
.nx-note {
    font-size: 13px;
    line-height: 1.8;
    border-radius: var(--radius-sm);
    padding: 11px 14px;
    background: var(--card2);
    border: 1px solid var(--line2);
    color: var(--ink2);
}
.nx-note b { color: var(--ink); }
.nx-note.is-warn { background: var(--warn-bg); border-color: transparent; color: var(--warn); }
.nx-note.is-warn b { color: var(--warn); }
.nx-note.is-ok   { background: var(--ok-bg); border-color: transparent; color: var(--ok); }
.nx-note.is-ok b { color: var(--ok); }

/* ---------- 11. 错误区 / 结果区 ---------- */
.nx-err {
    display: none;
    margin-top: 10px;
    font-size: 13.2px;
    font-weight: 600;
    color: var(--bad);
    background: var(--bad-bg);
    border-radius: var(--radius-sm);
    padding: 9px 13px;
}
.nx-err.is-on { display: block; }

.nx-result { display: none; }
.nx-result.is-on { display: block; }

/* ---------- 12. 文章正文 ---------- */
.nx-prose h3 { margin: 18px 0 8px; }
.nx-prose h3:first-child { margin-top: 0; }
.nx-prose h3 .kw { border-bottom: 2px solid var(--accent-soft); }
.nx-prose p { font-size: 14.2px; line-height: 1.92; color: var(--ink2); }

/* ---------- 13. 步骤条 ---------- */
.nx-steps { counter-reset: nxstep; display: grid; gap: 0; }
.nx-steps > div {
    counter-increment: nxstep;
    position: relative;
    padding: 0 0 18px 44px;
    border-left: 2px solid var(--line);
    margin-left: 15px;
}
.nx-steps > div:last-child { padding-bottom: 2px; border-left-color: transparent; }
.nx-steps > div::before {
    content: counter(nxstepstep, decimal);
    content: counter(nxstep);
    position: absolute;
    left: -15px;
    top: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--accent-ink);
    font: 700 13px/28px var(--font-body);
    text-align: center;
}
.nx-steps > div p { font-size: 13.9px; line-height: 1.85; color: var(--ink2); margin: 2px 0 0; }
.nx-steps > div p b { color: var(--ink); }

/* ---------- 14. 同组推荐 / 免责声明 ---------- */
.nx-related {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 12px;
}
.nx-related a {
    display: flex;
    gap: 12px;
    align-items: center;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 13px 15px;
    color: inherit;
    transition: border-color .15s, box-shadow .15s, transform .12s;
}
.nx-related a:hover { border-color: var(--accent); box-shadow: var(--shadow-xs); text-decoration: none; transform: translateY(-1px); }
.nx-related .ri { font-size: 22px; line-height: 1; }
.nx-related b { display: block; font-size: 14px; }
.nx-related small { color: var(--muted); font-size: 12px; }

.nx-foot {
    margin-top: 36px;
    font-size: 12.3px;
    line-height: 1.85;
    color: var(--muted);
    border-top: 1px dashed var(--line);
    padding-top: 14px;
}
.nx-foot b { color: var(--ink2); }

/* ---------- 15. 吐司 / 弹窗（JS 懒创建，加载时不渲染） ---------- */
#nxToast {
    position: fixed;
    left: 50%;
    bottom: 34px;
    transform: translateX(-50%) translateY(16px);
    background: var(--ink);
    color: var(--bg);
    font: 600 13.5px/1 var(--font-body);
    padding: 12px 20px;
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s, transform .2s;
    z-index: 9999;
    max-width: 86vw;
    text-align: center;
}
#nxToast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }
#nxToast.is-bad { background: var(--bad); color: #fff; }

#nxModalMask {
    position: fixed;
    inset: 0;
    background: rgba(12, 10, 6, .55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 9998;
}
#nxModal {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: min(680px, 100%);
    max-height: 82vh;
    display: flex;
    flex-direction: column;
    padding: 22px 24px;
}
#nxModal h3 { margin-bottom: 12px; }
.nx-modal-body { overflow: auto; font-size: 14px; line-height: 1.85; color: var(--ink2); }
.nx-modal-body pre {
    white-space: pre-wrap;
    word-break: break-word;
    font-family: var(--font-mono);
    font-size: 13px;
    background: var(--card2);
    border: 1px solid var(--line2);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
}
.nx-modal-acts { display: flex; justify-content: flex-end; margin-top: 14px; }

/* ---------- 16. 响应式 ---------- */
@media (max-width: 720px) {
    .nx-wrap { padding: 0 14px; }
    .nx-card { padding: 16px 14px; }
    .nx-sec { margin-top: 28px; }
}
