/* ============================================================
   child-ticket-calc · 儿童火车票与高铁票计算器
   铁路票纸风（ctc-）：牛皮纸棕 + 铁道钢蓝，票孔/条形码/票面元素独立设计
   与 bbf 奶白软萌 / ptcc 力量房工业风 / wuc 蓝图 / pbc 账本 / rsf 紫罗兰 零重叠
   ============================================================ */
.ctc-page {
    --ctc-brown: #8b5a2b;
    --ctc-brown-deep: #6b4219;
    --ctc-brown-soft: rgba(139, 90, 43, 0.10);
    --ctc-rail: #2d557a;
    --ctc-rail-deep: #1d3a55;
    --ctc-rail-soft: rgba(45, 85, 122, 0.10);
    --ctc-kraft: #f4e8d0;
    --ctc-kraft-deep: #e8dcc0;
    --ctc-cream: #fbf6eb;
    --ctc-card: #ffffff;
    --ctc-card-2: #faf6ed;
    --ctc-line: #e4d6b8;
    --ctc-line-strong: #c9b78c;
    --ctc-text: #2d2115;
    --ctc-muted: #7a6a52;
    --ctc-warn: #b8590f;
    --ctc-danger: #c63d2b;
    --ctc-ok: #3b7a4f;
    --ctc-shadow: 0 6px 20px rgba(70, 50, 20, 0.12);

    color: var(--ctc-text);
    font-size: 15px;
    line-height: 1.8;
}

[data-theme="dark"] .ctc-page {
    --ctc-brown: #b98954;
    --ctc-brown-deep: #d8a979;
    --ctc-brown-soft: rgba(185, 137, 84, 0.16);
    --ctc-rail: #7aa6cc;
    --ctc-rail-deep: #a6c6e2;
    --ctc-rail-soft: rgba(122, 166, 204, 0.16);
    --ctc-kraft: #3a2f1c;
    --ctc-kraft-deep: #2e2514;
    --ctc-cream: #1a140c;
    --ctc-card: #221b10;
    --ctc-card-2: #2a2114;
    --ctc-line: #3e3220;
    --ctc-line-strong: #5a4a2f;
    --ctc-text: #ecdcc0;
    --ctc-muted: #b09f7b;
    --ctc-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}

.ctc-page h1, .ctc-page h2, .ctc-page h3 { line-height: 1.4; }
.ctc-page b, .ctc-page strong { color: var(--ctc-brown-deep); }

/* ---------- 首屏 ---------- */
.ctc-hero {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.9fr) minmax(230px, 0.7fr);
    gap: 22px 24px;
    align-items: center;
    padding: 28px 30px 24px;
    margin-bottom: 24px;
    border: 1px dashed var(--ctc-line-strong);
    border-radius: 18px;
    background:
        repeating-linear-gradient(90deg, var(--ctc-line-strong) 0 3px, transparent 3px 12px),
        var(--ctc-cream);
    background-size: auto, auto, auto;
    box-shadow: var(--ctc-shadow);
    overflow: hidden;
}
.ctc-kicker {
    display: inline-block;
    padding: 5px 14px;
    margin-bottom: 12px;
    border-radius: 6px;
    background: var(--ctc-brown-soft);
    color: var(--ctc-brown-deep);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.16em;
}
.ctc-hero h1 {
    margin: 0 0 10px;
    font-size: clamp(25px, 3.2vw, 36px);
    font-weight: 900;
    letter-spacing: 0.01em;
}
.ctc-hero-sub { margin: 0 0 14px; max-width: 58ch; color: var(--ctc-muted); font-size: 15px; }
.ctc-hero-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.ctc-hero-chips li {
    padding: 5px 13px;
    border-radius: 999px;
    border: 1px solid var(--ctc-line-strong);
    background: var(--ctc-card);
    color: var(--ctc-muted);
    font-size: 12px;
    font-weight: 700;
}

/* hero 票面 */
.ctc-hero-ticket {
    position: relative;
    padding: 18px 22px 20px;
    border-radius: 6px;
    background: linear-gradient(180deg, var(--ctc-kraft) 0%, var(--ctc-kraft-deep) 100%);
    color: var(--ctc-brown-deep);
    box-shadow: 0 4px 14px rgba(70, 50, 20, 0.18);
}
.ctc-hero-ticket::before, .ctc-hero-ticket::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 18px; height: 18px;
    background: var(--ctc-cream);
    border-radius: 50%;
    transform: translateY(-50%);
}
.ctc-hero-ticket::before { left: -9px; }
.ctc-hero-ticket::after { right: -9px; }
.ctc-ticket-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font-size: 12px; font-weight: 800; letter-spacing: 0.1em; }
.ctc-ticket-class { padding: 2px 8px; background: var(--ctc-rail); color: #fff; border-radius: 3px; }
.ctc-ticket-middle { font-size: 18px; font-weight: 900; margin: 12px 0 6px; display: flex; justify-content: space-between; align-items: center; }
.ctc-ticket-arrow { font-size: 14px; color: var(--ctc-rail); margin: 0 6px; }
.ctc-ticket-time { font-size: 11.5px; color: var(--ctc-muted); border-top: 1px dashed var(--ctc-line-strong); padding-top: 6px; margin-bottom: 8px; }
.ctc-ticket-price { text-align: right; margin-bottom: 8px; }
.ctc-ticket-amt { font-size: 22px; font-weight: 900; color: var(--ctc-brown-deep); font-variant-numeric: tabular-nums; }
.ctc-ticket-label { display: block; font-size: 11.5px; color: var(--ctc-muted); margin-top: 2px; }
.ctc-ticket-barcode { font-family: monospace; font-size: 14px; color: var(--ctc-brown-deep); letter-spacing: 4px; opacity: 0.7; }

/* hero 读数卡 */
.ctc-hero-readout {
    display: grid;
    gap: 6px;
    padding: 18px 20px;
    border: 1px solid var(--ctc-line-strong);
    border-radius: 12px;
    border-top: 4px solid var(--ctc-brown);
    background: var(--ctc-card);
}
.ctc-readout-label { font-size: 11px; font-weight: 800; letter-spacing: 0.14em; color: var(--ctc-muted); text-transform: uppercase; }
.ctc-readout-num { font-size: 30px; font-weight: 900; line-height: 1.1; color: var(--ctc-brown-deep); font-variant-numeric: tabular-nums; }
.ctc-readout-avg { font-size: 13px; font-weight: 700; color: var(--ctc-rail-deep); }
.ctc-readout-meta { font-size: 12px; color: var(--ctc-muted); }
.ctc-readout-tip { font-size: 11px; color: var(--ctc-muted); opacity: 0.8; }

/* ---------- 测算区 ---------- */
.ctc-calc {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(310px, 370px);
    gap: 22px;
    align-items: start;
    margin-bottom: 28px;
}
.ctc-input-col { display: grid; gap: 18px; }
.ctc-panel {
    padding: 20px 22px 18px;
    border: 1px solid var(--ctc-line-strong);
    border-radius: 12px;
    background: var(--ctc-card);
    box-shadow: var(--ctc-shadow);
    position: relative;
}
.ctc-panel-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.ctc-step {
    flex: none; width: 36px; height: 36px;
    display: grid; place-items: center;
    border-radius: 6px;
    background: var(--ctc-brown-deep);
    color: var(--ctc-cream);
    font-size: 14px; font-weight: 900;
}
.ctc-panel-head h2 { margin: 0 0 3px; font-size: 17px; font-weight: 900; }
.ctc-panel-head p { margin: 0; font-size: 12.5px; color: var(--ctc-muted); line-height: 1.6; }

.ctc-grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.ctc-field { display: grid; gap: 5px; }
.ctc-label { font-size: 12px; font-weight: 800; color: var(--ctc-muted); letter-spacing: 0.04em; }
.ctc-input-wrap, .ctc-select-wrap { position: relative; display: block; }
.ctc-input {
    width: 100%; padding: 9px 12px;
    border: 1.5px solid var(--ctc-line-strong);
    border-radius: 6px;
    background: var(--ctc-card-2);
    color: var(--ctc-text);
    font-size: 14.5px; font-weight: 700;
    font-variant-numeric: tabular-nums;
    transition: border-color 0.15s ease;
}
.ctc-input:focus { outline: none; border-color: var(--ctc-brown); box-shadow: 0 0 0 3px var(--ctc-brown-soft); }
.ctc-input:disabled { opacity: 0.45; cursor: not-allowed; }
.ctc-input-wrap .ctc-input { padding-right: 64px; }
.ctc-unit { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 11px; font-style: normal; font-weight: 700; color: var(--ctc-muted); pointer-events: none; }
select.ctc-input { appearance: none; padding-right: 34px; }
.ctc-select-wrap::after { content: ""; position: absolute; right: 12px; top: 50%; width: 8px; height: 8px; border-right: 2px solid var(--ctc-muted); border-bottom: 2px solid var(--ctc-muted); transform: translateY(-70%) rotate(45deg); pointer-events: none; }

/* child rows */
.ctc-childlist { display: grid; gap: 10px; margin-bottom: 10px; }
.ctc-childrow {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px;
    align-items: end;
    padding: 10px 12px;
    border: 1px solid var(--ctc-line);
    border-radius: 8px;
    background: var(--ctc-card-2);
}
.ctc-childrow b { font-size: 13px; color: var(--ctc-brown-deep); }
.ctc-childrow .ctc-input-wrap .ctc-input { padding-right: 54px; }

/* checks */
.ctc-checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 18px; padding: 6px 0 4px; }
.ctc-checks label { font-size: 13px; color: var(--ctc-muted); font-weight: 600; display: flex; gap: 8px; align-items: center; cursor: pointer; }
.ctc-checks input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--ctc-brown-deep); }
.ctc-hint { margin: 8px 0 0; font-size: 12.5px; color: var(--ctc-muted); line-height: 1.7; }

/* error + btn */
.ctc-error { margin: 4px 0 10px; padding: 10px 14px; border: 1px solid var(--ctc-danger); border-left-width: 4px; border-radius: 6px; background: rgba(198, 61, 43, 0.08); color: var(--ctc-danger); font-size: 12.5px; font-weight: 700; }
.ctc-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.ctc-btn {
    padding: 9px 20px;
    border: 1.5px solid var(--ctc-line-strong);
    border-radius: 6px;
    background: var(--ctc-card-2);
    color: var(--ctc-text);
    font-size: 13.5px; font-weight: 800;
    cursor: pointer;
    transition: transform 0.12s ease, border-color 0.12s ease;
}
.ctc-btn:hover { transform: translateY(-1px); border-color: var(--ctc-brown); }
.ctc-btn--primary { border: none; background: var(--ctc-brown-deep); color: var(--ctc-cream); box-shadow: 0 3px 10px rgba(107, 66, 25, 0.3); }
.ctc-btn--primary:hover { box-shadow: 0 5px 14px rgba(107, 66, 25, 0.4); }

/* ---------- 结果列 ---------- */
.ctc-result-col { position: sticky; top: 86px; display: grid; gap: 12px; }
.ctc-result-hero { padding: 18px 20px; border-radius: 10px; background: var(--ctc-rail-deep); color: #fff; box-shadow: 0 8px 20px rgba(29, 58, 85, 0.35); }
.ctc-rh-label { font-size: 11px; font-weight: 800; letter-spacing: 0.14em; opacity: 0.82; }
.ctc-rh-num { font-size: 26px; font-weight: 900; line-height: 1.15; font-variant-numeric: tabular-nums; }
.ctc-rh-sub { font-size: 12.5px; opacity: 0.9; margin-top: 4px; }

.ctc-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ctc-kpi {
    display: grid; gap: 2px;
    padding: 12px 14px 10px;
    border: 1px solid var(--ctc-line-strong);
    border-radius: 8px;
    background: var(--ctc-card);
    box-shadow: var(--ctc-shadow);
}
.ctc-kpi span { font-size: 11px; font-weight: 800; color: var(--ctc-muted); letter-spacing: 0.04em; }
.ctc-kpi b { font-size: 18px; font-weight: 900; color: var(--ctc-brown-deep); font-variant-numeric: tabular-nums; }
.ctc-kpi small { font-size: 11px; color: var(--ctc-muted); }

.ctc-verdict { padding: 14px 16px; border-radius: 8px; border: 1px solid var(--ctc-line); background: var(--ctc-card); font-size: 13px; line-height: 1.75; }
.ctc-verdict.is-good { border-left: 4px solid var(--ctc-ok); background: rgba(59, 122, 79, 0.07); }
.ctc-verdict.is-warn { border-left: 4px solid var(--ctc-warn); background: rgba(184, 89, 15, 0.08); }
.ctc-verdict.is-bad { border-left: 4px solid var(--ctc-danger); background: rgba(198, 61, 43, 0.07); }
.ctc-verdict b { font-size: 14px; }

.ctc-mini-card { padding: 14px 16px; border: 1px solid var(--ctc-line-strong); border-radius: 8px; background: var(--ctc-card); box-shadow: var(--ctc-shadow); }
.ctc-mini-card h3 { margin: 0 0 8px; font-size: 13.5px; font-weight: 900; }
.ctc-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.ctc-table th, .ctc-table td { padding: 6px 8px; text-align: left; border-bottom: 1px solid var(--ctc-line); font-variant-numeric: tabular-nums; }
.ctc-table th { font-size: 11.5px; font-weight: 800; color: var(--ctc-muted); background: var(--ctc-card-2); }
.ctc-table tr:last-child td { border-bottom: none; }
.ctc-table tr.is-best td { background: var(--ctc-brown-soft); font-weight: 800; }
.ctc-table tr.is-warnrow td { color: var(--ctc-danger); font-weight: 700; }

.ctc-result-actions { display: grid; gap: 8px; }
.ctc-result-actions .ctc-btn { width: 100%; }
.ctc-result-foot { margin: 0; font-size: 11.5px; color: var(--ctc-muted); line-height: 1.7; }

/* ---------- A4 准备单 ---------- */
.ctc-sheet-wrap { padding: 22px 24px; margin-bottom: 26px; border: 1px dashed var(--ctc-line-strong); border-radius: 12px; background: var(--ctc-card-2); }
.ctc-sheet-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 14px; }
.ctc-sheet-head h2 { margin: 0 0 5px; font-size: 18px; font-weight: 900; }
.ctc-sheet-head p { margin: 0; font-size: 12.5px; color: var(--ctc-muted); }
.ctc-sheet-kicker { display: inline-block; margin-bottom: 6px; font-size: 11px; font-weight: 900; letter-spacing: 0.14em; color: var(--ctc-brown-deep); }
.ctc-sheet-badge { flex: none; padding: 5px 12px; border-radius: 4px; background: var(--ctc-brown-deep); color: var(--ctc-cream); font-size: 11.5px; font-weight: 800; letter-spacing: 0.06em; }

.ctc-sheet { padding: 22px 26px; border: 1px solid var(--ctc-line-strong); border-radius: 8px; background: var(--ctc-kraft); color: var(--ctc-brown-deep); box-shadow: var(--ctc-shadow); }
.ctc-sheet-top { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 12px; border-bottom: 2px solid var(--ctc-brown-deep); }
.ctc-sheet-top h3 { margin: 0 0 3px; font-size: 17px; font-weight: 900; }
.ctc-sheet-top p { margin: 0; font-size: 11.5px; opacity: 0.7; }
.ctc-sheet-meta { display: grid; gap: 2px; text-align: right; font-size: 12px; }
.ctc-sheet-meta b { font-size: 12.5px; }

.ctc-sheet-table { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 12.5px; }
.ctc-sheet-table th, .ctc-sheet-table td { padding: 7px 9px; border: 1px solid var(--ctc-line-strong); text-align: left; }
.ctc-sheet-table th { background: var(--ctc-kraft-deep); font-size: 11px; font-weight: 800; }
.ctc-sheet-notes { display: grid; gap: 4px; margin-bottom: 10px; }
.ctc-sheet-notes p { margin: 0; font-size: 11.5px; line-height: 1.75; opacity: 0.85; }
.ctc-sheet-foot { padding-top: 8px; border-top: 1px solid var(--ctc-line-strong); font-size: 11px; opacity: 0.6; }

/* ---------- 参考 / FAQ ---------- */
.ctc-section-head { margin-bottom: 14px; }
.ctc-section-kicker { display: inline-block; font-size: 11px; font-weight: 900; letter-spacing: 0.18em; color: var(--ctc-brown-deep); margin-bottom: 6px; }
.ctc-section-head h2 { margin: 0 0 4px; font-size: 22px; font-weight: 900; }
.ctc-section-head p { margin: 0; font-size: 13.5px; color: var(--ctc-muted); }
.ctc-reference, .ctc-faq { margin-bottom: 26px; }
.ctc-ref-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.ctc-ref-card {
    padding: 16px 18px;
    border: 1px solid var(--ctc-line-strong);
    border-radius: 10px;
    background: var(--ctc-card);
    box-shadow: var(--ctc-shadow);
}
.ctc-ref-card h3 { margin: 0 0 6px; font-size: 14px; font-weight: 900; color: var(--ctc-rail-deep); }
.ctc-ref-card p { margin: 0; font-size: 12.5px; color: var(--ctc-muted); line-height: 1.8; }

/* ---------- 返回顶部 ---------- */
.ctc-top {
    position: fixed; right: 26px; bottom: 30px;
    width: 42px; height: 42px;
    display: grid; place-items: center;
    border: 1px solid var(--ctc-line-strong); border-radius: 8px;
    background: var(--ctc-card); color: var(--ctc-rail-deep);
    font-size: 17px; font-weight: 900; cursor: pointer;
    box-shadow: var(--ctc-shadow);
    opacity: 0; pointer-events: none;
    transition: opacity 0.25s ease, transform 0.15s ease;
    z-index: 60;
}
.ctc-top.is-show { opacity: 1; pointer-events: auto; }
.ctc-top:hover { transform: translateY(-2px); }

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
    .ctc-calc { grid-template-columns: minmax(0, 1fr); }
    .ctc-result-col { position: static; }
    .ctc-hero { grid-template-columns: minmax(0, 1fr); }
    .ctc-hero-ticket { display: none; }
    .ctc-grid3 { grid-template-columns: minmax(0, 1fr); }
    .ctc-childrow { grid-template-columns: minmax(0, 1fr); }
    .ctc-ref-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    .ctc-hero, .ctc-panel, .ctc-sheet-wrap { padding: 16px 14px; }
    .ctc-checks { grid-template-columns: minmax(0, 1fr); }
    .ctc-kpis { grid-template-columns: minmax(0, 1fr); }
    .ctc-ref-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- 打印 ---------- */
@media print {
    body * { visibility: hidden !important; }
    .ctc-sheet, .ctc-sheet * { visibility: visible !important; }
    .ctc-sheet { position: absolute; left: 0; top: 0; width: 100%; border: none; box-shadow: none; background: #f4e8d0; color: #2d2115; }
    .ctc-sheet-badge, .ctc-top { display: none !important; }
}
