/* ==========================================================================
   比例分配 / 配比训练器 /tool/ratio-allocation-drill
   视觉主题：烘焙配比秤 —— 橄榄绿 + 亚麻白 + 铜棕
   ========================================================================== */

.rad-page {
    --rad-linen: #f4f1e6;
    --rad-linen-2: #fbf9f2;
    --rad-linen-3: #ebe5d4;
    --rad-ink: #2f3628;
    --rad-ink-2: #5d6a52;
    --rad-ink-3: #8b9683;
    --rad-line: #dbd4c0;
    --rad-line-2: #e9e3d2;
    --rad-olive: #5b6b3a;
    --rad-olive-2: #46532c;
    --rad-olive-soft: #e5ead6;
    --rad-copper: #a5643c;
    --rad-copper-2: #8a5030;
    --rad-copper-soft: #f2e1d4;
    --rad-cream: #f7efd9;
    --rad-ok: #4a7c3f;
    --rad-warn: #96690f;
    --rad-err: #a8402c;
    --rad-shadow: 0 12px 30px rgba(74, 82, 48, .13);
    --rad-shadow-sm: 0 4px 14px rgba(74, 82, 48, .09);
    --rad-radius: 14px;
}

:root[data-theme="dark"] .rad-page {
    --rad-linen: #1f2620;
    --rad-linen-2: #262e27;
    --rad-linen-3: #2d362d;
    --rad-ink: #e8e7db;
    --rad-ink-2: #a9b1a1;
    --rad-ink-3: #7e8678;
    --rad-line: #3a4238;
    --rad-line-2: #323a31;
    --rad-olive: #9bb165;
    --rad-olive-2: #b1c580;
    --rad-olive-soft: #2b3325;
    --rad-copper: #d28b5d;
    --rad-copper-2: #e0a074;
    --rad-copper-soft: #39291e;
    --rad-cream: #332c1d;
    --rad-ok: #7fbf6d;
    --rad-warn: #d9ab4a;
    --rad-err: #e0806a;
    --rad-shadow: 0 12px 30px rgba(0, 0, 0, .38);
    --rad-shadow-sm: 0 4px 14px rgba(0, 0, 0, .3);
}

.rad-page {
    color: var(--rad-ink);
    font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    line-height: 1.7;
    font-variant-numeric: tabular-nums;
    padding-bottom: 40px;
}

.rad-page * { box-sizing: border-box; }

.rad-page h1,
.rad-page h2,
.rad-page h3 {
    font-family: "Songti SC", "SimSun", "PingFang SC", serif;
    margin: 0;
    letter-spacing: .5px;
}

/* ===================== 首屏 ===================== */
.rad-hero {
    background: linear-gradient(180deg, var(--rad-linen-2), var(--rad-linen));
    border: 1px solid var(--rad-line);
    border-radius: var(--rad-radius);
    box-shadow: var(--rad-shadow);
    padding: 26px 26px 20px;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

/* 顶部刻度尺装饰 */
.rad-hero::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 22px;
    background:
        repeating-linear-gradient(90deg, var(--rad-olive) 0 1px, transparent 1px 20px) 0 0 / 100% 8px no-repeat,
        repeating-linear-gradient(90deg, var(--rad-copper) 0 1px, transparent 1px 100px) 0 8px / 100% 14px no-repeat,
        var(--rad-linen-3);
    opacity: .72;
}

:root[data-theme="dark"] .rad-page .rad-hero::before { opacity: .5; }

.rad-hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 22px;
    align-items: start;
    padding-top: 16px;
}

.rad-kicker {
    display: inline-block;
    font-size: 12px;
    letter-spacing: 3px;
    color: var(--rad-olive);
    border: 1px solid var(--rad-olive);
    border-radius: 999px;
    padding: 2px 12px;
    background: var(--rad-olive-soft);
    margin-bottom: 10px;
}

.rad-hero-copy h1 { font-size: 30px; color: var(--rad-olive-2); margin-bottom: 8px; }

.rad-lead { margin: 0 0 12px; color: var(--rad-ink-2); font-size: 14.5px; max-width: 62ch; }
.rad-lead b { color: var(--rad-copper); }

.rad-tags { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }

.rad-tags li {
    font-size: 12px;
    color: var(--rad-olive);
    background: var(--rad-olive-soft);
    border-radius: 6px;
    padding: 2px 9px;
}

/* ===================== 操作入口 ===================== */
.rad-entry {
    background: var(--rad-linen-2);
    border: 1px solid var(--rad-line);
    border-left: 4px solid var(--rad-olive);
    border-radius: 12px;
    padding: 16px 16px 14px;
    box-shadow: var(--rad-shadow-sm);
}

.rad-entry-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px dashed var(--rad-line);
}

.rad-entry-head b { font-size: 15px; color: var(--rad-olive); }
.rad-entry-head span { font-size: 12.5px; color: var(--rad-ink-3); }

.rad-top-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
    margin-bottom: 12px;
}

.rad-field { display: flex; flex-direction: column; gap: 3px; }

.rad-label { font-size: 12.5px; color: var(--rad-ink-2); display: flex; align-items: baseline; gap: 4px; }
.rad-label .rad-unit { font-size: 11px; color: var(--rad-ink-3); }

.rad-input,
.rad-select {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--rad-line);
    border-radius: 8px;
    background: var(--rad-linen);
    color: var(--rad-ink);
    font-size: 14px;
    font-family: inherit;
    font-variant-numeric: tabular-nums;
    transition: border-color .18s ease, box-shadow .18s ease;
}

.rad-input:focus,
.rad-select:focus {
    outline: none;
    border-color: var(--rad-olive);
    box-shadow: 0 0 0 3px rgba(91, 107, 58, .16);
}

.rad-input.is-bad { border-color: var(--rad-err); background: rgba(168, 64, 44, .06); }

.rad-mode-hint { font-size: 11.5px; color: var(--rad-ink-3); margin-top: 2px; }

/* 比例项编辑 */
.rad-items {
    background: var(--rad-cream);
    border: 1px dashed var(--rad-copper);
    border-radius: 10px;
    padding: 10px 12px 6px;
}

.rad-items-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.rad-items-head b { font-size: 13.5px; color: var(--rad-copper-2); }
.rad-items-head span { font-size: 11.5px; color: var(--rad-ink-3); }

.rad-item-row {
    display: grid;
    grid-template-columns: 26px minmax(0, 1fr) 92px minmax(0, 1fr) 30px;
    gap: 8px;
    align-items: center;
    padding: 4px 0;
}

.rad-item-no {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--rad-olive);
    color: #fff;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rad-item-del {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: 1px solid var(--rad-line);
    background: var(--rad-linen-2);
    color: var(--rad-ink-3);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
}

.rad-item-del:hover { border-color: var(--rad-err); color: var(--rad-err); }

.rad-err-tip { font-size: 11.5px; color: var(--rad-err); min-height: 15px; line-height: 1.35; }
.rad-err-tip.is-warn { color: var(--rad-warn); }

.rad-add-btn {
    font-family: inherit;
    font-size: 12.5px;
    color: var(--rad-olive);
    background: var(--rad-linen-2);
    border: 1px dashed var(--rad-olive);
    border-radius: 7px;
    padding: 3px 12px;
    cursor: pointer;
}

.rad-add-btn:hover { background: var(--rad-olive-soft); }
.rad-add-btn:disabled { opacity: .45; cursor: not-allowed; }

.rad-why {
    margin-top: 14px;
    background: var(--rad-linen-3);
    border: 1px solid var(--rad-line-2);
    border-radius: 10px;
    padding: 12px 14px;
}

.rad-why h3 { font-size: 13.5px; color: var(--rad-olive-2); margin-bottom: 6px; }
.rad-why ul { margin: 0; padding-left: 18px; font-size: 12.5px; color: var(--rad-ink-2); }
.rad-why li { margin-bottom: 2px; }

/* ===================== 右侧秤盘 ===================== */
.rad-side { display: flex; flex-direction: column; gap: 12px; }

.rad-scale {
    background: var(--rad-linen-2);
    border: 1px solid var(--rad-line);
    border-radius: 12px;
    box-shadow: var(--rad-shadow-sm);
    overflow: hidden;
}

.rad-scale-head {
    background: var(--rad-olive);
    color: #fff;
    font-size: 13px;
    letter-spacing: 3px;
    text-align: center;
    padding: 7px 8px;
}

.rad-scale-body { padding: 12px 14px 14px; }

.rad-scale-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    font-size: 12.5px;
    color: var(--rad-ink-2);
    padding: 3px 0;
    border-bottom: 1px dotted var(--rad-line-2);
}

.rad-scale-row b { color: var(--rad-ink); font-size: 13px; }

.rad-scale-total {
    margin-top: 10px;
    background: var(--rad-copper-soft);
    border: 1px dashed var(--rad-copper);
    border-radius: 8px;
    padding: 9px 12px;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}

.rad-scale-total span { font-size: 12.5px; color: var(--rad-copper-2); }

.rad-scale-total strong {
    font-size: 24px;
    color: var(--rad-copper);
    font-family: "DIN Alternate", "Arial Narrow", Arial, sans-serif;
}

.rad-scale-foot { font-size: 11px; color: var(--rad-ink-3); text-align: center; padding: 4px 0 12px; letter-spacing: 2px; }

.rad-total-check {
    border-radius: 9px;
    padding: 8px 12px;
    font-size: 13px;
    border: 1px solid var(--rad-line);
    background: var(--rad-linen-2);
    color: var(--rad-ink-2);
}

.rad-total-check.is-ok { border-color: var(--rad-ok); background: var(--rad-olive-soft); color: var(--rad-ok); }
.rad-total-check.is-bad { border-color: var(--rad-warn); background: var(--rad-copper-soft); color: var(--rad-warn); }

/* ===================== 预置 ===================== */
.rad-presets {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px dashed var(--rad-line);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.rad-presets-label { font-size: 12.5px; color: var(--rad-ink-3); margin-right: 2px; }

.rad-presets button {
    font-family: inherit;
    font-size: 12.5px;
    color: var(--rad-olive);
    background: var(--rad-linen);
    border: 1px solid var(--rad-line);
    border-radius: 999px;
    padding: 4px 13px;
    cursor: pointer;
    transition: all .18s ease;
}

.rad-presets button:hover { border-color: var(--rad-copper); color: var(--rad-copper); background: var(--rad-copper-soft); }

/* ===================== 错误条 ===================== */
.rad-errbar {
    background: rgba(168, 64, 44, .08);
    border: 1px solid var(--rad-err);
    border-left-width: 4px;
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 18px;
    font-size: 13px;
    color: var(--rad-err);
}

.rad-errbar b { display: block; margin-bottom: 4px; }
.rad-errbar ul { margin: 0; padding-left: 18px; }
.rad-errbar li { margin-bottom: 2px; }
.rad-errbar .rad-warn-title { color: var(--rad-warn); margin-top: 6px; }

.rad-errbar.is-warn {
    background: rgba(150, 105, 15, .07);
    border-color: var(--rad-warn);
    color: var(--rad-warn);
}

.rad-errbar.is-warn .rad-warn-title { color: var(--rad-warn); margin-top: 0; }

/* ===================== 结果面板 ===================== */
.rad-result { display: flex; flex-direction: column; gap: 18px; }

.rad-panel {
    background: var(--rad-linen-2);
    border: 1px solid var(--rad-line);
    border-radius: var(--rad-radius);
    padding: 20px 22px;
    box-shadow: var(--rad-shadow-sm);
    position: relative;
}

.rad-panel::before {
    content: "";
    position: absolute;
    left: 0;
    top: 18px;
    bottom: 18px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: linear-gradient(180deg, var(--rad-olive), var(--rad-copper));
}

.rad-panel-head { margin-bottom: 14px; }

.rad-panel-kicker {
    display: inline-block;
    font-size: 11.5px;
    letter-spacing: 2px;
    color: var(--rad-copper-2);
    border: 1px solid var(--rad-copper);
    border-radius: 4px;
    padding: 0 8px;
    margin-bottom: 6px;
}

.rad-panel-head h2 { font-size: 20px; color: var(--rad-olive-2); }
.rad-panel-head p { margin: 4px 0 0; font-size: 13px; color: var(--rad-ink-2); }

/* ===================== 分配表 ===================== */
.rad-table-wrap { overflow-x: auto; }

.rad-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    min-width: 560px;
}

.rad-table th,
.rad-table td { border: 1px solid var(--rad-line-2); padding: 9px 11px; text-align: left; }

.rad-table th { background: var(--rad-linen-3); color: var(--rad-olive-2); font-size: 12.5px; font-weight: 600; }

.rad-table tbody tr:nth-child(even) { background: rgba(219, 212, 192, .16); }

.rad-c-name { font-weight: 600; color: var(--rad-ink); }
.rad-num { text-align: right !important; }
.rad-exact { color: var(--rad-ink-3); font-size: 12.5px; }
.rad-value { color: var(--rad-copper); font-weight: 700; font-size: 15px; }

.rad-pct { width: 150px; color: var(--rad-ink-2); font-size: 12.5px; }

.rad-pct-bar {
    display: inline-block;
    width: 74px;
    height: 8px;
    background: var(--rad-linen-3);
    border: 1px solid var(--rad-line-2);
    border-radius: 999px;
    overflow: hidden;
    margin-right: 7px;
    vertical-align: middle;
}

.rad-pct-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--rad-olive), var(--rad-copper)); }

.rad-sum-row td { background: var(--rad-olive-soft); font-weight: 700; color: var(--rad-olive-2); }

/* ===================== 训练器 ===================== */
.rad-quiz-card {
    background: var(--rad-cream);
    border: 1px dashed var(--rad-copper);
    border-radius: 12px;
    padding: 16px 18px;
}

.rad-quiz-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }

.rad-quiz-bar .rad-select { width: auto; min-width: 110px; }

.rad-quiz-text {
    font-size: 16px;
    color: var(--rad-ink);
    background: var(--rad-linen-2);
    border: 1px solid var(--rad-line);
    border-radius: 10px;
    padding: 12px 15px;
    white-space: pre-line;
    margin-bottom: 12px;
}

.rad-quiz-answer-row { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.rad-quiz-answer-row .rad-field { max-width: 220px; }

.rad-quiz-feedback {
    margin-top: 12px;
    border-radius: 9px;
    padding: 9px 13px;
    font-size: 13.5px;
    border: 1px solid var(--rad-line);
    background: var(--rad-linen-2);
    color: var(--rad-ink-2);
}

.rad-quiz-feedback.is-ok { border-color: var(--rad-ok); background: var(--rad-olive-soft); color: var(--rad-ok); }
.rad-quiz-feedback.is-bad { border-color: var(--rad-err); background: rgba(168, 64, 44, .08); color: var(--rad-err); }

.rad-quiz-answer { margin-top: 12px; }

.rad-quiz-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    background: var(--rad-linen-2);
}

.rad-quiz-table th,
.rad-quiz-table td { border: 1px solid var(--rad-line-2); padding: 7px 10px; text-align: left; }
.rad-quiz-table th { background: var(--rad-linen-3); color: var(--rad-olive-2); font-size: 12.5px; }
.rad-quiz-ask td { background: var(--rad-copper-soft); font-weight: 700; }

.rad-quiz-tip { font-size: 12.5px; color: var(--rad-ink-2); margin: 10px 0 0; line-height: 1.75; }

/* ===================== 按钮 ===================== */
.rad-btn {
    font-family: inherit;
    font-size: 13.5px;
    padding: 8px 18px;
    border-radius: 9px;
    border: 1px solid var(--rad-olive);
    background: var(--rad-olive);
    color: #fff;
    cursor: pointer;
    transition: all .18s ease;
}

.rad-btn:hover { background: var(--rad-olive-2); border-color: var(--rad-olive-2); }

.rad-btn--copper { background: var(--rad-copper); border-color: var(--rad-copper); }
.rad-btn--copper:hover { background: var(--rad-copper-2); border-color: var(--rad-copper-2); }

.rad-btn--ghost { background: transparent; color: var(--rad-olive); border-color: var(--rad-line); }
.rad-btn--ghost:hover { background: var(--rad-olive-soft); color: var(--rad-olive); border-color: var(--rad-olive); }

.rad-actions { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 14px; }

.rad-batch-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.rad-batch-best { margin: 0; font-size: 13px; color: var(--rad-ink-2); }
.rad-batch-best b { color: var(--rad-copper); }

.rad-ops button {
    font-family: inherit;
    font-size: 12px;
    color: var(--rad-olive);
    background: var(--rad-linen);
    border: 1px solid var(--rad-line);
    border-radius: 5px;
    padding: 2px 8px;
    margin-right: 5px;
    cursor: pointer;
}

.rad-ops button:hover { border-color: var(--rad-copper); color: var(--rad-copper); }

.rad-empty { text-align: center !important; color: var(--rad-ink-3); padding: 18px 8px !important; }

/* ===================== CSV / FAQ / 留言 ===================== */
.rad-pre {
    background: var(--rad-linen);
    border: 1px solid var(--rad-line);
    border-radius: 10px;
    padding: 14px 16px;
    font-size: 12px;
    line-height: 1.85;
    color: var(--rad-ink-2);
    overflow-x: auto;
    white-space: pre;
    margin: 0;
    font-family: Consolas, "Courier New", monospace;
}

.rad-faq-item {
    border: 1px solid var(--rad-line-2);
    border-radius: 10px;
    margin-bottom: 8px;
    background: var(--rad-linen);
    overflow: hidden;
}

.rad-faq-item summary {
    cursor: pointer;
    padding: 11px 15px;
    font-size: 14px;
    color: var(--rad-olive-2);
    font-weight: 600;
    list-style: none;
}

.rad-faq-item summary::-webkit-details-marker { display: none; }
.rad-faq-item summary::before { content: "＋"; color: var(--rad-copper); margin-right: 8px; font-weight: 700; }
.rad-faq-item[open] summary::before { content: "－"; }

.rad-faq-a {
    padding: 10px 15px 13px 33px;
    font-size: 13.5px;
    color: var(--rad-ink-2);
    border-top: 1px dashed var(--rad-line-2);
}

.rad-faq-a b { color: var(--rad-copper); }

.rad-comments { margin-top: 4px; }

/* ===================== Toast ===================== */
.rad-toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    transform: translateY(8px);
    opacity: 0;
    pointer-events: none;
    z-index: 9999;
    background: var(--rad-olive);
    color: #fff;
    font-size: 13.5px;
    padding: 9px 20px;
    border-radius: 999px;
    box-shadow: var(--rad-shadow);
    transition: opacity .22s ease, transform .22s ease;
}

.rad-toast.is-error { background: var(--rad-err); }

:root[data-theme="dark"] .rad-toast { background: #55662f; }

/* ===================== A4 分配单 ===================== */
.rad-sheet { display: none; }

@media print {
    body * { visibility: hidden !important; }
    .rad-sheet, .rad-sheet * { visibility: visible !important; }
    .rad-sheet {
        display: block !important;
        position: absolute;
        inset: 0;
        padding: 16mm 14mm;
        background: #fff;
        color: #111;
    }
}

.rad-sheet-title {
    font-family: "Songti SC", "SimSun", serif;
    font-size: 22px;
    text-align: center;
    letter-spacing: 4px;
    color: #111;
    padding-bottom: 8px;
    border-bottom: 2px solid #111;
}

.rad-sheet-sub { text-align: center; font-size: 12px; color: #555; padding: 6px 0 12px; }

.rad-sheet-table { width: 100%; border-collapse: collapse; font-size: 13px; }

.rad-sheet-table th,
.rad-sheet-table td { border: 1px solid #444; padding: 7px 9px; text-align: left; }

.rad-sheet-table th { background: #eee; }
.rad-sheet-num { text-align: right; }
.rad-sheet-total td { background: #f6f6f6; font-weight: 700; }

.rad-sheet-note { font-size: 11.5px; color: #555; margin-top: 10px; line-height: 1.7; }

.rad-sheet-sign {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-top: 30px;
    font-size: 13px;
    color: #333;
}

/* ===================== 响应式 ===================== */
@media (max-width: 1000px) {
    .rad-hero-grid { grid-template-columns: 1fr; }
    .rad-side { flex-direction: row; flex-wrap: wrap; }
    .rad-scale { flex: 1 1 280px; }
    .rad-total-check { flex: 1 1 260px; align-self: center; }
}

@media (max-width: 720px) {
    .rad-hero { padding: 20px 15px 16px; }
    .rad-hero-copy h1 { font-size: 24px; }
    .rad-panel { padding: 16px 14px; }
    .rad-top-row { grid-template-columns: 1fr; }
    .rad-item-row { grid-template-columns: 24px minmax(0, 1fr) 78px 30px; }
    .rad-item-row .rad-err-tip { grid-column: 1 / -1; }
    .rad-side { flex-direction: column; }
}

RAD_PART