/* 液压缸推力与流量计算器 —— 剖面卡 + 双力条 + 时间条
   与弹簧曲线、链条带区分：以「对比条」表达推力/拉力与动作时间的差异。 */

.hy-desk {
    display: grid;
    grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr);
    gap: 18px;
    align-items: start;
    margin-top: 24px;
}

.hy-right { display: grid; gap: 14px; min-width: 0; }

/* 缸径快选 */
.hy-chips {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
}
.hy-chips button {
    appearance: none;
    cursor: pointer;
    font-family: var(--d3-mono);
    font-size: 12.5px;
    font-weight: 650;
    line-height: 1;
    padding: 8px 11px;
    min-width: 44px;
    border-radius: 7px;
    border: 1px solid var(--d3-line-2);
    background: var(--d3-paper);
    color: var(--d3-ink-2);
    transition: all .14s ease;
}
.hy-chips button:hover { border-color: var(--d3-accent); color: var(--d3-accent); }
.hy-chips button.is-on {
    background: var(--d3-accent);
    border-color: var(--d3-accent);
    color: #fff;
}

/* 剖面卡 */
.hy-card {
    background:
        radial-gradient(560px 220px at 12% -40%, rgba(var(--d3-accent-rgb), .14), transparent 72%),
        var(--d3-card);
    border: 1px solid var(--d3-line);
    border-radius: var(--d3-radius);
    overflow: hidden;
}

.hy-card-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 11px 16px;
    border-bottom: 1px solid var(--d3-line);
    background: var(--d3-card-2);
}
.hy-card-head h2 { font-size: 13.5px; }
.hy-card-head span {
    margin-left: auto;
    font-family: var(--d3-mono);
    font-size: 11px;
    color: var(--d3-ink-3);
}

#hySvg {
    display: block;
    width: 100%;
    height: auto;
    padding: 6px 6px 0;
    color: var(--d3-accent);
}

/* 剖面 SVG 元素 */
.hy-barrel { fill: rgba(var(--d3-accent-rgb), .10); stroke: var(--d3-accent); stroke-width: 2; }
.hy-piston { fill: var(--d3-accent); opacity: .9; }
.hy-rod { fill: #8a9099; stroke: #6b7280; stroke-width: 1; opacity: .85; }
.hy-port { fill: var(--d3-card); stroke: var(--d3-accent); stroke-width: 1.6; }
.hy-flow-arrow { stroke: var(--d3-accent); stroke-width: 1.6; fill: none; opacity: .75; }
.hy-dim { stroke: var(--d3-ink-3); stroke-width: 1; stroke-dasharray: 4 3; opacity: .7; }
.hy-lab { font-family: var(--d3-mono); font-size: 11px; fill: var(--d3-ink-2); }
.hy-lab-sm { font-family: var(--d3-mono); font-size: 9.5px; fill: var(--d3-ink-3); }
.hy-force-arrow { stroke: var(--d3-accent); stroke-width: 2.2; fill: none; }

/* 双力条 */
.hy-force { padding: 4px 16px 0; }
.hy-force-row {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr) 96px;
    gap: 10px;
    align-items: center;
    padding: 7px 0;
}
.hy-force-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--d3-ink-2);
    white-space: nowrap;
}
.hy-force-label em {
    display: block;
    font-style: normal;
    font-size: 10px;
    font-weight: 500;
    color: var(--d3-ink-3);
}
.hy-force-bar {
    height: 14px;
    border-radius: 4px;
    background: var(--d3-paper-2);
    border: 1px solid var(--d3-line);
    overflow: hidden;
}
.hy-force-bar i {
    display: block;
    height: 100%;
    width: 0;
    border-radius: 3px;
    transition: width .3s cubic-bezier(.4, 0, .2, 1);
}
.hy-push { background: linear-gradient(90deg, var(--d3-accent), #6aa05f); }
.hy-pull { background: repeating-linear-gradient(-45deg, #c2a15a, #c2a15a 5px, #d6bb87 5px, #d6bb87 10px); }
.hy-force-row > b {
    display: flex;
    align-items: baseline;
    gap: 3px;
    justify-content: flex-end;
    font-family: var(--d3-mono);
    font-variant-numeric: tabular-nums;
    font-size: 16px;
    font-weight: 700;
    color: var(--d3-ink);
    white-space: nowrap;
}
.hy-force-row > b small { font-family: var(--d3-sans); font-size: 10.5px; font-weight: 600; color: var(--d3-ink-3); }

.hy-foot {
    margin: 12px 16px 14px;
    padding-top: 10px;
    border-top: 1px dashed var(--d3-line);
    font-size: 11.5px;
    line-height: 1.7;
    color: var(--d3-ink-3);
}

/* 速度卡 */
.hy-speed {
    background: var(--d3-card);
    border: 1px solid var(--d3-line);
    border-radius: var(--d3-radius);
    overflow: hidden;
}
.hy-speed-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 11px 16px;
    border-bottom: 1px solid var(--d3-line);
    background: var(--d3-card-2);
}
.hy-speed-head h2 { font-size: 13.5px; }
.hy-speed-head span {
    margin-left: auto;
    font-family: var(--d3-mono);
    font-size: 11px;
    color: var(--d3-ink-3);
}
.hy-speed-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1px;
    background: var(--d3-line);
    border-bottom: 1px solid var(--d3-line);
}
.hy-speed-cell {
    background: var(--d3-card);
    padding: 10px 12px;
    min-width: 0;
}
.hy-speed-cell > span {
    display: block;
    font-size: 11px;
    color: var(--d3-ink-3);
    white-space: nowrap;
}
.hy-speed-cell b {
    display: flex;
    align-items: baseline;
    gap: 3px;
    margin-top: 2px;
    font-family: var(--d3-mono);
    font-variant-numeric: tabular-nums;
    font-size: 17px;
    font-weight: 700;
    color: var(--d3-ink);
    letter-spacing: -.02em;
}
.hy-speed-cell b small {
    font-family: var(--d3-sans);
    font-size: 10px;
    font-weight: 600;
    color: var(--d3-ink-3);
}
.hy-speed-cell em {
    display: block;
    margin-top: 1px;
    font-style: normal;
    font-size: 10.5px;
    color: var(--d3-ink-3);
    white-space: nowrap;
}

/* 动作时间条 */
.hy-time { padding: 10px 16px 13px; display: grid; gap: 6px; }
.hy-time-row {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) 62px;
    gap: 10px;
    align-items: center;
    font-size: 11.5px;
    color: var(--d3-ink-3);
}
.hy-time-bar {
    height: 8px;
    border-radius: 999px;
    background: var(--d3-paper-2);
    border: 1px solid var(--d3-line);
    overflow: hidden;
}
.hy-time-bar i {
    display: block;
    height: 100%;
    width: 0;
    border-radius: 999px;
    transition: width .3s ease;
}
.hy-t-out { background: var(--d3-accent); }
.hy-t-in { background: #9cb98f; }
.hy-time-row b {
    text-align: right;
    font-family: var(--d3-mono);
    font-variant-numeric: tabular-nums;
    font-size: 11.5px;
    font-weight: 650;
    color: var(--d3-ink-2);
}

.hy-tight { padding: 13px 18px 14px; }

/* 操作 */
.hy-actions { display: flex; gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--d3-line); }
.hy-btn {
    appearance: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 650;
    line-height: 1;
    padding: 10px 15px;
    border-radius: 7px;
    border: 1px solid var(--d3-accent);
    background: var(--d3-accent);
    color: #fff;
    transition: filter .15s ease, transform .1s ease;
}
.hy-btn:hover { filter: brightness(1.08); }
.hy-btn:active { transform: translateY(1px); }
.hy-btn-ghost { background: transparent; color: var(--d3-ink-2); border-color: var(--d3-line-2); }
.hy-btn-ghost:hover { color: var(--d3-ink); border-color: var(--d3-ink-3); filter: none; }

.hy-alerts { display: grid; gap: 8px; margin-top: 14px; }
.hy-alerts:empty { display: none; }
.hy-alerts .d3-alert { font-size: 12.5px; padding: 9px 11px; }

/* 缸径表 */
.hy-table-wrap { margin-top: 14px; }
#hyBoreTable { min-width: 640px; }
#hyBoreTable tr.is-current td {
    background: rgba(var(--d3-accent-rgb), .08);
    font-weight: 700;
}
#hyBoreTable tr.is-current td:first-child::after {
    content: " · 当前";
    font-size: 10.5px;
    font-weight: 600;
    color: var(--d3-accent);
}

@media (max-width: 1020px) {
    .hy-desk { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
    .hy-force-row { grid-template-columns: 76px minmax(0, 1fr) 82px; gap: 8px; }
    .hy-force-row > b { font-size: 14px; }
    .hy-speed-cell { padding: 9px 10px; }
    .hy-speed-cell b { font-size: 15px; }
    .hy-speed-cell b small { font-size: 9px; }
    .hy-actions { flex-wrap: wrap; }
    .hy-btn { flex: 1 1 auto; text-align: center; }
    .hy-chips button { min-width: 40px; padding: 7px 9px; font-size: 12px; }
}

:root[data-theme="dark"] .hy-btn,
:root[data-theme="dark"] .hy-chips button.is-on { color: #0c0e12; }
:root[data-theme="dark"] .hy-rod { fill: #4b5563; stroke: #6b7280; }
