/**
 * Child Height Predictor Styles
 * Tool: child-height-predictor
 * Category: health
 */

#tool-child-height-predictor {
    --chp-bg: #f8f6f0;
    --chp-surface: #ffffff;
    --chp-surface-soft: #fffaf0;
    --chp-surface-warm: #fbf7eb;
    --chp-border: #e8e4dc;
    --chp-border-strong: #eadfb8;
    --chp-text: #2d2a26;
    --chp-muted: #6f665d;
    --chp-soft: #8a7d6d;
    --chp-accent: #d4af37;
    --chp-accent-dark: #b8860b;
    --chp-accent-deep: #8a6500;
    --chp-good: #4f9f70;
    --chp-danger: #b65b4d;
    --chp-mono: "Courier New", Courier, monospace;
    --chp-sans: Helvetica, Arial, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", sans-serif;
    --chp-radius: 10px;
    --chp-shadow: 0 1px 4px rgba(45, 42, 38, 0.06), 0 0 0 1px rgba(45, 42, 38, 0.03);
    max-width: 100%;
    overflow-x: hidden;
}

#tool-child-height-predictor,
#tool-child-height-predictor * {
    box-sizing: border-box;
}

.chp-intro {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 14px;
}

.chp-lead {
    margin: 8px 0 0;
    max-width: 820px;
    color: var(--chp-muted);
    font-size: 14px;
    line-height: 1.62;
}

.chp-mode-pill,
.chp-method-badge,
.chp-status-badge,
.chp-preset-btn,
.chp-sex-btn,
.chp-reset-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: 999px;
    white-space: nowrap;
    font-family: var(--chp-sans);
}

.chp-mode-pill {
    padding: 7px 11px;
    border: 1px solid rgba(212, 175, 55, 0.25);
    background: rgba(212, 175, 55, 0.1);
    color: var(--chp-accent-deep);
    font-size: 12px;
    font-weight: 700;
}

.chp-layout {
    display: grid;
    grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
    gap: 14px;
    align-items: start;
}

.chp-input-panel,
.chp-result-main,
.chp-kpi-card,
.chp-card,
.chp-warning,
.chp-notice-card {
    border: 1px solid var(--chp-border);
    border-radius: 12px;
    background: var(--chp-surface);
    box-shadow: var(--chp-shadow);
}

.chp-input-panel {
    display: grid;
    gap: 12px;
    padding: 14px;
    background: linear-gradient(180deg, #fffdfa 0%, #faf7f0 100%);
    min-width: 0;
}

.chp-panel-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.chp-panel-label,
.chp-result-label,
.chp-kpi-label {
    color: var(--chp-soft);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.chp-panel-head h3 {
    margin: 3px 0 0;
    color: var(--chp-text);
    font-size: 16px;
    line-height: 1.35;
}

.chp-reset-btn {
    min-height: 32px;
    padding: 6px 10px;
    border: 1px solid var(--chp-border);
    background: #fff;
    color: var(--chp-muted);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}

.chp-sex-switch {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.chp-sex-btn,
.chp-preset-btn {
    min-width: 0;
    min-height: 36px;
    border: 1px solid var(--chp-border);
    background: #fff;
    color: var(--chp-muted);
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}

.chp-sex-btn.is-active,
.chp-preset-btn.is-active {
    border-color: #e2c36d;
    background: linear-gradient(135deg, #fff8de 0%, #f5e8b8 100%);
    color: var(--chp-accent-deep);
    box-shadow: 0 3px 10px rgba(184, 134, 11, 0.12);
}

.chp-input-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
}

.chp-field,
.chp-preset-block {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.chp-field-wide {
    grid-column: 1 / -1;
}

.chp-field label {
    margin: 0;
    color: var(--chp-muted);
    font-size: 12px;
    font-weight: 800;
}

.chp-unit-field {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 7px;
    min-width: 0;
}

.chp-unit-field span {
    min-width: 40px;
    padding: 9px 10px;
    border: 1px solid var(--chp-border);
    border-radius: 9px;
    background: var(--chp-surface-warm);
    color: var(--chp-accent-deep);
    font-size: 12px;
    font-weight: 800;
    text-align: center;
}

.chp-input {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 38px;
    padding: 9px 11px;
    border: 1px solid var(--chp-border);
    border-radius: 9px;
    background: #fff;
    color: var(--chp-text);
    font-family: var(--chp-mono);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: -0.02em;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.chp-input:hover {
    border-color: var(--chp-border-strong);
}

.chp-input:focus {
    outline: none;
    border-color: var(--chp-accent);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.13);
}

.chp-mini-title {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--chp-text);
    font-size: 13px;
    font-weight: 800;
}

.chp-mini-title i {
    color: var(--chp-accent-dark);
}

.chp-preset-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
}

.chp-preset-btn {
    min-height: 32px;
    padding: 6px 8px;
    font-size: 12px;
}

.chp-notice-card,
.chp-warning {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    padding: 10px 11px;
    background: #fffaf0;
    color: var(--chp-muted);
}

.chp-notice-card i,
.chp-warning i {
    color: var(--chp-accent-dark);
    line-height: 1.55;
}

.chp-notice-card p,
.chp-warning p,
.chp-card-text {
    margin: 0;
    font-size: 12px;
    line-height: 1.58;
}

.chp-result-panel {
    display: grid;
    gap: 10px;
    min-width: 0;
}

.chp-warning[hidden] {
    display: none !important;
}

.chp-result-main {
    display: grid;
    gap: 9px;
    padding: 16px;
    background: linear-gradient(135deg, #fffaf0 0%, #f6edcf 100%);
    border-color: #eadfb8;
    box-shadow: 0 8px 22px rgba(184, 134, 11, 0.14);
    min-width: 0;
}

.chp-result-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.chp-status-badge,
.chp-method-badge {
    min-height: 28px;
    padding: 5px 9px;
    border: 1px solid rgba(184, 134, 11, 0.22);
    background: rgba(255, 255, 255, 0.72);
    color: var(--chp-accent-deep);
    font-size: 12px;
    font-weight: 800;
}

.chp-status-badge.is-live {
    background: rgba(79, 159, 112, 0.12);
    border-color: rgba(79, 159, 112, 0.28);
    color: #2f7650;
}

.chp-status-badge.is-error {
    background: rgba(182, 91, 77, 0.12);
    border-color: rgba(182, 91, 77, 0.25);
    color: var(--chp-danger);
}

.chp-main-value {
    color: var(--chp-accent-deep);
    font-family: var(--chp-mono);
    font-size: clamp(32px, 6vw, 46px);
    font-weight: 900;
    line-height: 1;
    letter-spacing: -0.07em;
}

.chp-range-text {
    margin: 0;
    color: #5b4a1e;
    font-family: var(--chp-mono);
    font-size: 15px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.chp-summary {
    margin: 0;
    max-width: 720px;
    color: var(--chp-muted);
    font-size: 13px;
    line-height: 1.62;
}

.chp-scale-wrap {
    display: grid;
    gap: 5px;
}

.chp-scale-bar {
    position: relative;
    height: 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(184, 134, 11, 0.18);
    overflow: hidden;
}

.chp-scale-range {
    position: absolute;
    top: 2px;
    bottom: 2px;
    left: 35%;
    width: 20%;
    border-radius: 999px;
    background: rgba(212, 175, 55, 0.28);
}

.chp-scale-marker {
    position: absolute;
    top: 50%;
    left: 58.3%;
    width: 16px;
    height: 16px;
    border: 3px solid #fff;
    border-radius: 50%;
    background: var(--chp-accent-dark);
    box-shadow: 0 2px 8px rgba(45, 42, 38, 0.22);
    transform: translate(-50%, -50%);
}

.chp-scale-labels {
    display: flex;
    justify-content: space-between;
    color: var(--chp-soft);
    font-family: var(--chp-mono);
    font-size: 11px;
    font-weight: 700;
}

.chp-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.chp-kpi-card {
    display: grid;
    gap: 5px;
    min-width: 0;
    padding: 11px;
    background: #fff;
}

.chp-kpi-value {
    color: var(--chp-text);
    font-family: var(--chp-mono);
    font-size: 16px;
    font-weight: 900;
    letter-spacing: -0.04em;
}

.chp-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
    gap: 10px;
}

.chp-card {
    display: grid;
    gap: 10px;
    min-width: 0;
    padding: 13px;
}

.chp-current-bar {
    height: 12px;
    border-radius: 999px;
    overflow: hidden;
    background: #f1ede5;
    border: 1px solid var(--chp-border);
}

.chp-current-fill {
    display: block;
    width: 50%;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #e8d393 0%, #d4af37 100%);
}

.chp-table-wrap {
    max-width: 100%;
    overflow-x: hidden;
}

.chp-summary-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 12px;
}

.chp-summary-table th,
.chp-summary-table td {
    padding: 8px 0;
    border-bottom: 1px solid #f0ece4;
    vertical-align: top;
}

.chp-summary-table tr:last-child th,
.chp-summary-table tr:last-child td {
    border-bottom: 0;
}

.chp-summary-table th {
    width: 34%;
    padding-right: 8px;
    color: var(--chp-soft);
    font-weight: 800;
    text-align: left;
}

.chp-summary-table td {
    color: var(--chp-text);
    font-weight: 700;
    word-break: keep-all;
}

.chp-sex-btn:hover,
.chp-preset-btn:hover,
.chp-reset-btn:hover {
    border-color: var(--chp-accent);
    color: var(--chp-accent-deep);
    box-shadow: 0 3px 10px rgba(184, 134, 11, 0.12);
}

.chp-sex-btn:focus-visible,
.chp-preset-btn:focus-visible,
.chp-reset-btn:focus-visible {
    outline: none;
    border-color: var(--chp-accent);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.15);
}

@media (max-width: 980px) {
    .chp-layout {
        grid-template-columns: 1fr;
    }

    .chp-input-panel {
        position: static;
    }
}

@media (max-width: 768px) {
    .chp-intro {
        display: grid;
    }

    .chp-kpi-grid,
    .chp-detail-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .chp-detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 520px) {
    #tool-child-height-predictor {
        overflow-x: hidden;
    }

    .chp-input-grid,
    .chp-kpi-grid,
    .chp-preset-list {
        grid-template-columns: 1fr;
    }

    .chp-panel-head,
    .chp-result-top {
        align-items: stretch;
    }

    .chp-method-badge,
    .chp-status-badge,
    .chp-mode-pill,
    .chp-reset-btn {
        width: fit-content;
        max-width: 100%;
        white-space: normal;
    }

    .chp-result-main,
    .chp-input-panel,
    .chp-card {
        padding: 12px;
    }

    .chp-main-value {
        font-size: 34px;
    }

    .chp-summary-table th,
    .chp-summary-table td {
        display: block;
        width: 100%;
        padding: 6px 0;
    }

    .chp-summary-table th {
        border-bottom: 0;
        padding-bottom: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .chp-sex-btn,
    .chp-preset-btn,
    .chp-reset-btn,
    .chp-input {
        transition: none !important;
    }
}
