.hbpac,
.hbpac * {
    box-sizing: border-box;
}

.hbpac {
    --hbpac-space: 0.9rem;
    --hbpac-control-height: 42px;
    --hbpac-focus: #1d4ed8;
    --hbpac-border: #d9d9d9;
    --hbpac-muted: #666;
    --hbpac-surface: #fff;
    --hbpac-result-surface: #f7f8fa;
    --hbpac-accent: #4865b2;
    --hbpac-accent-hover: #3c7fff;
    --hbpac-slider-thumb-width: 14px;
    width: 100%;
    max-width: 680px;
    margin: 1rem auto;
    padding: 1rem;
    border: 1px solid var(--hbpac-border);
    border-radius: 10px;
    background: var(--hbpac-surface);
    line-height: 1.5;
}

.hbpac__field,
.hbpac__group {
    margin: 0 0 var(--hbpac-space);
}

.hbpac__group {
    min-width: 0;
    padding: 0;
    border: 0;
}

.hbpac__group.is-disabled {
    opacity: 0.6;
}

.hbpac__label,
.hbpac__legend {
    display: block;
    margin: 0 0 0.35rem;
    padding: 0;
    font: inherit;
    font-weight: 700;
}

.hbpac__select,
.hbpac__unit-input input {
    max-width: 100%;
    min-height: var(--hbpac-control-height);
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--hbpac-border);
    border-radius: 6px;
    background: var(--hbpac-surface);
    color: inherit;
    font: inherit;
}

.hbpac__select {
    width: 100%;
}

.hbpac__note {
    margin: 0.45rem 0 0;
    color: var(--hbpac-muted);
    font-size: 0.875em;
}

.hbpac .hbpac__range-wrap {
    position: relative;
    margin: 0.25rem 0 0.75rem;
    padding-bottom: 1.35rem;
}

.hbpac .hbpac__range {
    display: block;
    width: 100%;
    height: 36px;
    margin: 0;
    padding: 0;
    border: 0;
    background-color: transparent;
    cursor: pointer;
    overflow: visible;
    -webkit-appearance: none;
    appearance: none;
}

.hbpac .hbpac__ticks {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    pointer-events: none;
}

.hbpac .hbpac__tick {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 0;
    transform: translateX(-50%);
}

.hbpac .hbpac__tick-line {
    position: absolute;
    top: 10px;
    left: 0;
    width: 1px;
    height: 16px;
    background: rgba(72, 101, 178, 0.45);
}

.hbpac .hbpac__tick-label {
    position: absolute;
    top: 27px;
    left: 0;
    color: var(--hbpac-muted);
    font-size: 0.7em;
    line-height: 1;
    white-space: nowrap;
}

.hbpac .hbpac__tick:first-child .hbpac__tick-label {
    transform: translateX(0);
}

.hbpac .hbpac__tick:last-child .hbpac__tick-label {
    transform: translateX(-100%);
}

.hbpac__group.is-disabled input:disabled,
.hbpac__group.is-disabled .hbpac__range:disabled {
    cursor: not-allowed;
}
.hbpac__range::-webkit-slider-runnable-track {
    height: 6px;
    border: 1px solid var(--hbpac-border);
    border-radius: 3px;
    background: var(--hbpac-border);
}

.hbpac__range::-webkit-slider-thumb {
    width: var(--hbpac-slider-thumb-width);
    height: 30px;
    margin-top: -13px;
    border: 1px solid var(--hbpac-accent);
    border-radius: 3px;
    background: var(--hbpac-accent);
    box-shadow: none;
    -webkit-appearance: none;
    appearance: none;
}

.hbpac__range:disabled::-webkit-slider-thumb {
    cursor: not-allowed;
}

.hbpac__range::-moz-range-track {
    height: 6px;
    border: 1px solid var(--hbpac-border);
    border-radius: 3px;
    background: var(--hbpac-border);
}

.hbpac__range::-moz-range-thumb {
    width: var(--hbpac-slider-thumb-width);
    height: 28px;
    border: 1px solid var(--hbpac-accent);
    border-radius: 3px;
    background: var(--hbpac-accent);
    box-shadow: none;
}

.hbpac__range:disabled::-moz-range-thumb {
    cursor: not-allowed;
}

@supports (-moz-appearance: none) {
    .hbpac .hbpac__range {
        --hbpac-slider-thumb-width: 12px;
    }
}

.hbpac__input-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.hbpac__unit-input {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
}

.hbpac__unit-input input {
    width: 100%;
    min-width: 0;
}

.hbpac__unit-input input[aria-invalid="true"] {
    border-color: #b42318;
}

.hbpac__input-error {
    grid-column: 1 / -1;
    color: #b42318;
    font-size: 0.875em;
    line-height: 1.4;
}

.hbpac__unit-input:nth-child(2) input {
    background: #fbfcfe;
}

.hbpac__result {
    margin-top: 0.5rem;
    padding: 1.25rem;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: var(--hbpac-result-surface);
    text-align: center;
}

.hbpac__result-label {
    margin-bottom: 0.5rem;
    color: var(--hbpac-muted);
    font-size: 0.95em;
    font-weight: 700;
}

.hbpac__result-values {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem 1.25rem;
}

.hbpac__result-primary,
.hbpac__result-secondary {
    font-variant-numeric: tabular-nums;
}

.hbpac__result-primary {
    font-size: 1.8em;
    font-weight: 700;
}

.hbpac__result-secondary {
    align-self: center;
    color: var(--hbpac-muted);
    font-size: 1.05em;
    font-weight: 600;
}

.hbpac__reset {
    display: inline-block;
    min-height: var(--hbpac-control-height);
    margin: 0 0 0 auto;
    padding: 0.55rem 1rem;
    border: 1px solid #b8c0cc;
    border-radius: 6px;
    background: var(--hbpac-surface);
    color: inherit;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.hbpac__reset:hover,
.hbpac__reset:focus-visible {
    border-color: var(--hbpac-accent);
    background: #f5f7fb;
}

.hbpac__select:focus-visible,
.hbpac__unit-input input:focus-visible,
.hbpac__range:focus-visible,
.hbpac__button:focus-visible,
.hbpac__comparison td:last-child button:focus-visible,
.hbpac__reset:focus-visible {
    outline: 2px solid var(--hbpac-focus);
    outline-offset: 2px;
}

.hbpac__sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 520px) {
    .hbpac {
        padding: 1rem;
    }

    .hbpac__input-row {
        gap: 0.55rem;
    }

    .hbpac .hbpac__tick--secondary {
        display: none;
    }

    .hbpac__result-values {
        flex-direction: column;
    }

    .hbpac .hbpac__comparison table {
        min-width: 0;
        table-layout: fixed;
        font-size: 0.78em;
    }

    .hbpac .hbpac__comparison th:nth-child(1), .hbpac .hbpac__comparison td:nth-child(1) { width: 33%; }
    .hbpac .hbpac__comparison th:nth-child(2), .hbpac .hbpac__comparison td:nth-child(2) { width: 18%; }
    .hbpac .hbpac__comparison th:nth-child(3), .hbpac .hbpac__comparison td:nth-child(3) { width: 18%; }
    .hbpac .hbpac__comparison th:nth-child(4), .hbpac .hbpac__comparison td:nth-child(4) { width: 11%; }
    .hbpac .hbpac__comparison th:nth-child(5), .hbpac .hbpac__comparison td:nth-child(5) { width: 11%; }
    .hbpac .hbpac__comparison th:nth-child(6), .hbpac .hbpac__comparison td:nth-child(6) { width: 9%; }

    .hbpac .hbpac__comparison th,
    .hbpac .hbpac__comparison td {
        padding: 0.45rem 0.2rem;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .hbpac__result {
        padding: 1rem 0.75rem;
    }

    .hbpac__result-primary {
        font-size: 1.55em;
    }

    .hbpac__result-secondary {
        font-size: 1em;
    }

    .hbpac__comparison th:last-child,
    .hbpac__comparison td:last-child {
        padding-left: 0.2rem;
    }

    .hbpac__comparison td:last-child button {
        min-height: 36px;
        padding: 0.15rem 0.1rem;
        font-size: 0.68em;
    }
}

.hbpac__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    flex: 1 1 28rem;
    min-width: 0;
}

.hbpac__action-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: var(--hbpac-space);
}

.hbpac__button {
    min-height: var(--hbpac-control-height);
    padding: 0.45rem 0.8rem;
    border: 1px solid var(--hbpac-border);
    border-radius: 6px;
    background: var(--hbpac-surface);
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.hbpac__button:hover,
.hbpac__button:focus-visible { border-color: var(--hbpac-accent); background: #f5f7fb; }
.hbpac__feedback { min-height: 1.25em; margin: 0.25rem 0 0; color: var(--hbpac-muted); font-size: 0.875em; }
.hbpac__details { margin-top: 0.5rem; color: var(--hbpac-muted); font-size: 0.9em; }
.hbpac__comparison { margin-top: 1rem; }
.hbpac__comparison-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.65rem 1rem; margin-bottom: 0.75rem; }
.hbpac__comparison-title { margin: 0; font-size: 1.1em; font-weight: 700; }
.hbpac__unit-switch { display: inline-flex; align-items: center; gap: 0.45rem; margin-left: auto; cursor: pointer; font-size: 0.82em; white-space: nowrap; }
.hbpac__unit-switch input { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.hbpac__unit-switch-track { position: relative; display: inline-block; flex: 0 0 2.4rem; width: 2.4rem; height: 1.25rem; border-radius: 999px; background: #cbd5e1; transition: background-color 0.15s ease; }
.hbpac__unit-switch-track::after { position: absolute; top: 0.15rem; left: 0.15rem; width: 0.95rem; height: 0.95rem; border-radius: 50%; background: #fff; content: ""; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18); transition: transform 0.15s ease; }
.hbpac__unit-switch input:checked + .hbpac__unit-switch-track { background: var(--hbpac-accent); }
.hbpac__unit-switch input:checked + .hbpac__unit-switch-track::after { transform: translateX(1.15rem); }
.hbpac__unit-switch input:focus-visible + .hbpac__unit-switch-track { outline: 2px solid var(--hbpac-accent); outline-offset: 3px; }
.hbpac__target-controls[data-unit-system="imperial"] .hbpac__unit-switch-label--imperial,
.hbpac__target-controls[data-unit-system="metric"] .hbpac__unit-switch-label--metric { color: #172033; font-weight: 700; }
.hbpac__target-controls[data-unit-system="imperial"] .hbpac__unit-switch-label--metric,
.hbpac__target-controls[data-unit-system="metric"] .hbpac__unit-switch-label--imperial { color: var(--hbpac-muted); }
.hbpac__table-wrap { width: 100%; min-width: 0; max-width: 100%; }
.hbpac__comparison table { width: 100%; min-width: 0; table-layout: fixed; border-collapse: collapse; font-size: 0.9em; }
.hbpac__comparison th, .hbpac__comparison td { padding: 0.55rem 0.5rem; border-bottom: 1px solid #e7eaf0; text-align: right; vertical-align: middle; white-space: normal; overflow-wrap: anywhere; }
.hbpac__comparison th { background: #f7f8fa; color: #4b5563; font-size: 0.9em; font-weight: 700; text-align: center; }
.hbpac__comparison td:first-child { text-align: left; }
.hbpac__comparison th:nth-child(1), .hbpac__comparison td:nth-child(1) { width: 38%; }
.hbpac__comparison th:nth-child(2), .hbpac__comparison td:nth-child(2) { width: 18%; }
.hbpac__comparison th:nth-child(3), .hbpac__comparison td:nth-child(3) { width: 18%; }
.hbpac__comparison th:nth-child(4), .hbpac__comparison td:nth-child(4) { width: 9%; }
.hbpac__comparison th:nth-child(5), .hbpac__comparison td:nth-child(5) { width: 9%; }
.hbpac__comparison th:nth-child(6), .hbpac__comparison td:nth-child(6) { width: 8%; }
.hbpac__comparison th:last-child, .hbpac__comparison td:last-child { padding-left: 0.8rem; border-left: 1px solid #edf0f4; text-align: center; }
.hbpac__comparison td:last-child button { min-height: 34px; padding: 0.3rem 0.55rem; border: 1px solid #cbd5e1; border-radius: 5px; background: #fff; color: #5b6472; font: inherit; font-size: 0.9em; cursor: pointer; }
.hbpac__comparison td:last-child button:hover { border-color: #9aa5b5; background: #f8fafc; }
.hbpac__chart { display: grid; gap: 0.5rem; margin: 1rem 0; }
.hbpac__chart-row { display: grid; grid-template-columns: minmax(0, 48%) minmax(0, 1fr); gap: 24px; align-items: center; min-width: 0; }
.hbpac__chart-label { min-width: 0; overflow-wrap: anywhere; font-size: 0.8em; font-variant-numeric: tabular-nums; }
.hbpac__bar-track { min-width: 0; height: 1.5rem; border-radius: 3px; background: rgba(217, 217, 217, 0.65); }
.hbpac__bar { height: 100%; min-width: 0; border-radius: 3px; background: var(--hbpac-accent); }
.hbpac__comparison-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.hbpac__button:disabled { border-color: #e2e5ea; background: #f1f3f5; color: #9aa1ab; cursor: not-allowed; }
.hbpac__button:disabled:hover { border-color: #e2e5ea; background: #f1f3f5; }

.hbpac__target-section { margin-top: 0.8rem; }
.hbpac__target-title { margin: 0 0 0.35rem; font-size: 0.95em; font-weight: 700; }
.hbpac__target-controls { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.55rem 1rem; margin-bottom: 0.4rem; }
.hbpac__target-switch { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.hbpac__target-button { min-height: var(--hbpac-control-height); padding: 0.45rem 0.8rem; border: 1px solid var(--hbpac-border); border-radius: 6px; background: var(--hbpac-surface); color: inherit; font: inherit; cursor: pointer; }
.hbpac__target-button:hover,
.hbpac__target-button:focus-visible { border-color: var(--hbpac-accent); background: #f5f7fb; }
.hbpac__target-button.is-active { border-color: var(--hbpac-accent); background: var(--hbpac-accent); color: #fff; font-weight: 700; }
.hbpac__target-button:focus-visible { outline: 2px solid var(--hbpac-focus); outline-offset: 2px; }
.hbpac__target-dot-control { display: flex; align-items: center; flex-wrap: wrap; gap: 0.45rem; margin: 0 0 0.4rem; font-size: 0.88em; }
.hbpac__target-dot-control select { min-height: var(--hbpac-control-height); max-width: 100%; padding: 0.35rem 2rem 0.35rem 0.55rem; border: 1px solid var(--hbpac-border); border-radius: 5px; background: var(--hbpac-surface); color: inherit; font: inherit; }
.hbpac__target-dot-control select:focus-visible { outline: 2px solid var(--hbpac-focus); outline-offset: 2px; }
.hbpac__target-stage { position: relative; width: 100%; height: clamp(190px, 48vw, 300px); overflow: hidden; border: 1px solid #cbd3df; border-radius: 6px; background: #fbfcff; user-select: none; -webkit-user-select: none; }
.hbpac__target-stage[hidden] { display: none; }
.hbpac__target-grid { position: absolute; z-index: 0; inset: 0; pointer-events: none; user-select: none; }
.hbpac__target-grid-labels { position: absolute; z-index: 2; inset: 0; pointer-events: none; user-select: none; }
.hbpac__target-grid-line { position: absolute; display: block; background: rgba(54, 78, 119, 0.38); }
.hbpac__target-grid-line--x { top: 0; bottom: 0; width: 1px; }
.hbpac__target-grid-line--y { right: 0; left: 0; height: 1px; }
.hbpac__target-grid-line.is-minor { background: rgba(86, 111, 153, 0.18); }
.hbpac__target-grid-label,
.hbpac__target-grid-unit { position: absolute; color: #26354f; background: rgba(251, 252, 255, 0.82); font: 10px/1.2 sans-serif; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hbpac__target-grid-label--x { top: 3px; transform: translateX(-50%); }
.hbpac__target-grid-label--y { left: 4px; transform: translateY(-50%); }
.hbpac__target-grid-unit { right: 4px; bottom: 3px; }
.hbpac__target-art { position: absolute; z-index: 1; top: 50%; left: 50%; display: none; transform-origin: 0 0; }
.hbpac__target-art.is-active { display: block; }
.hbpac__target-art--bear img,
.hbpac__target-art--deer img { display: block; width: min(680px, 180vw); max-width: none; height: auto; }
.hbpac__target-stage img { -webkit-user-drag: none; user-select: none; -webkit-user-select: none; }
.hbpac__target-art--man,
.hbpac__target-art--man svg { width: 220px; height: 330px; }
.hbpac__target-art--man svg { overflow: visible; }
.hbpac__man-shape { fill: #52647d; stroke: #26354f; stroke-width: 3; }
.hbpac__target-group-circle { position: absolute; z-index: 3; top: 50%; left: 50%; box-sizing: border-box; border: 2px solid #d52323; border-radius: 50%; background: transparent; transform: translate(-50%, -50%); pointer-events: none; }
.hbpac__target-dot { position: absolute; z-index: 4; top: 50%; left: 50%; box-sizing: border-box; border: 1px solid #fff; border-radius: 50%; background: #bd1717; box-shadow: 0 0 0 1px rgba(117, 12, 12, 0.75); transform: translate(-50%, -50%); pointer-events: none; }
.hbpac__target-note { margin: 0.3rem 0 0; color: var(--hbpac-muted); font-size: 0.78em; }

@media (max-width: 560px) {
    .hbpac__target-controls { align-items: flex-start; }
    .hbpac__target-switch { flex: 1 1 100%; }
    .hbpac__target-controls .hbpac__unit-switch { margin-left: 0; }
}

.hbpac__group.is-disabled .hbpac__unit-input input:disabled {
    background: #f1f3f5;
    color: #5b6472;
    opacity: 1;
}
