:root {
    --ink: #16322c;
    --muted: #60736e;
    --cream: #f6f4ed;
    --paper: #fffdf8;
    --sage: #dce8d5;
    --sage-dark: #789c7c;
    --green: #174f42;
    --green-light: #2f7562;
    --line: rgba(22, 50, 44, 0.12);
    --shadow: 0 28px 70px rgba(36, 67, 58, 0.13);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-width: 320px;
    color: var(--ink);
    background: var(--cream);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

.ambient {
    position: fixed;
    z-index: -1;
    border-radius: 50%;
    filter: blur(2px);
    pointer-events: none;
}

.ambient-one {
    width: 480px;
    height: 480px;
    top: -240px;
    right: -110px;
    background: rgba(184, 211, 179, 0.45);
}

.ambient-two {
    width: 360px;
    height: 360px;
    top: 520px;
    left: -230px;
    background: rgba(225, 205, 164, 0.28);
}

.site-header {
    width: min(1160px, calc(100% - 40px));
    margin: 0 auto;
    padding: 28px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    text-decoration: none;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.brand-mark {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 12px;
    color: white;
    background: var(--green);
}

.brand-mark svg {
    width: 24px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
}

.header-note {
    color: var(--muted);
    font-size: 0.83rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

main {
    width: min(1160px, calc(100% - 40px));
    margin: 0 auto;
}

.hero {
    max-width: 800px;
    margin: 62px auto 50px;
    text-align: center;
}

.eyebrow,
.step-label {
    margin: 0 0 12px;
    color: var(--green-light);
    font-size: 0.73rem;
    font-weight: 750;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.eyebrow {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
}

.eyebrow span {
    width: 22px;
    height: 1px;
    background: var(--green-light);
}

.hero h1 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2.8rem, 6.4vw, 5rem);
    font-weight: 500;
    letter-spacing: -0.055em;
    line-height: 0.98;
}

.hero h1 em {
    color: var(--green-light);
    font-weight: 400;
}

.hero > p {
    max-width: 590px;
    margin: 24px auto 0;
    color: var(--muted);
    font-size: 1.05rem;
    line-height: 1.7;
}

.calculator-shell {
    display: grid;
    grid-template-columns: 0.9fr 1.1fr;
    min-height: 550px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.75);
    border-radius: 28px;
    background: var(--paper);
    box-shadow: var(--shadow);
}

.form-panel,
.result-panel {
    padding: clamp(30px, 5vw, 58px);
}

.form-panel {
    border-right: 1px solid var(--line);
}

.panel-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 40px;
}

.panel-heading h2,
.empty-state h2,
.bmi-guide h2 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 2rem;
    font-weight: 500;
    letter-spacing: -0.035em;
}

.unit-toggle {
    display: flex;
    padding: 3px;
    border: 1px solid rgba(23, 79, 66, 0.16);
    border-radius: 100px;
    background: rgba(220, 232, 213, 0.62);
}

.unit-option {
    padding: 7px 11px;
    border: 0;
    border-radius: 100px;
    color: var(--muted);
    background: transparent;
    font-size: 0.7rem;
    font-weight: 750;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    transition: color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.unit-option:hover {
    color: var(--green);
}

.unit-option.active {
    color: white;
    background: var(--green);
    box-shadow: 0 3px 8px rgba(23, 79, 66, 0.2);
}

.unit-option:focus-visible {
    outline: 2px solid var(--green-light);
    outline-offset: 2px;
}

.input-group {
    margin-bottom: 24px;
}

.input-group label {
    display: block;
    margin-bottom: 9px;
    font-size: 0.86rem;
    font-weight: 700;
}

.height-fields {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.height-fields.imperial {
    grid-template-columns: 1fr 1fr;
}

.inches-control[hidden] {
    display: none;
}

.inches-control input {
    padding-left: 10px;
}

.input-control {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 64px;
    padding: 0 18px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: white;
    transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.input-control:focus-within {
    border-color: var(--sage-dark);
    box-shadow: 0 0 0 4px rgba(120, 156, 124, 0.14);
    transform: translateY(-1px);
}

.input-control.invalid {
    border-color: #bd5d4f;
    box-shadow: 0 0 0 4px rgba(189, 93, 79, 0.1);
}

.input-control svg {
    width: 22px;
    flex: 0 0 auto;
    fill: none;
    stroke: var(--sage-dark);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
}

.input-control input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    color: var(--ink);
    background: transparent;
    font-size: 1.15rem;
    font-weight: 650;
    appearance: textfield;
}

.input-control input::-webkit-inner-spin-button {
    appearance: none;
}

.input-control input::placeholder {
    color: #a7b2ad;
}

.input-control > span {
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 650;
}

.field-error {
    display: block;
    min-height: 17px;
    margin: 6px 4px 0;
    color: #a34235;
    font-size: 0.74rem;
}

.calculate-button {
    display: flex;
    width: 100%;
    min-height: 61px;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 8px;
    border: 0;
    border-radius: 14px;
    color: white;
    background: var(--green);
    box-shadow: 0 10px 24px rgba(23, 79, 66, 0.22);
    font-weight: 720;
    transition: background 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.calculate-button:hover {
    background: #216554;
    box-shadow: 0 13px 28px rgba(23, 79, 66, 0.28);
    transform: translateY(-2px);
}

.calculate-button:active {
    transform: translateY(0);
}

.calculate-button:disabled {
    cursor: wait;
    opacity: 0.72;
}

.calculate-button svg {
    width: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.privacy-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin: 17px 0 0;
    color: #81908c;
    font-size: 0.72rem;
}

.privacy-note svg {
    width: 13px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.result-panel {
    display: grid;
    min-width: 0;
    place-items: center;
    background:
        radial-gradient(circle at 90% 10%, rgba(255, 255, 255, 0.7), transparent 32%),
        linear-gradient(145deg, #e8eee0, #d7e4d2);
}

.empty-state {
    max-width: 390px;
    text-align: center;
}

.empty-illustration {
    display: grid;
    width: 154px;
    height: 154px;
    margin: 0 auto 28px;
    place-items: center;
    border: 1px solid rgba(23, 79, 66, 0.09);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.42);
}

.empty-illustration svg {
    width: 110px;
    fill: none;
    stroke: var(--green-light);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.empty-illustration circle:first-child {
    fill: rgba(255, 255, 255, 0.5);
    stroke: none;
}

.empty-state > p:last-child {
    margin: 14px 0 0;
    color: var(--muted);
    line-height: 1.65;
}

.result-content {
    width: 100%;
}

.result-content[hidden] {
    display: none;
}

.score-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
}

.score-caption {
    display: block;
    margin-bottom: -4px;
    color: var(--muted);
    font-size: 0.85rem;
}

#bmi-score {
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(4.6rem, 9vw, 6.8rem);
    font-weight: 500;
    letter-spacing: -0.07em;
    line-height: 1;
}

.category-pill {
    max-width: 175px;
    margin-bottom: 12px;
    padding: 8px 12px;
    border-radius: 100px;
    color: white;
    background: var(--green-light);
    font-size: 0.73rem;
    font-weight: 720;
    text-align: center;
}

.gauge {
    margin: 34px 0 32px;
}

.gauge-track {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1.4fr 1fr 1.5fr;
    height: 9px;
    gap: 3px;
}

.segment {
    display: block;
    border-radius: 10px;
}

.underweight {
    background: #78a5bd;
}

.normal {
    background: #5f9f78;
}

.overweight {
    background: #d6aa58;
}

.obese {
    background: #c8705e;
}

.gauge-marker {
    position: absolute;
    top: -8px;
    left: 50%;
    width: 4px;
    height: 25px;
    border: 2px solid white;
    border-radius: 4px;
    background: var(--ink);
    box-shadow: 0 2px 6px rgba(22, 50, 44, 0.35);
    transform: translateX(-50%);
    transition: left 650ms cubic-bezier(0.22, 1, 0.36, 1);
}

.gauge-labels {
    display: grid;
    grid-template-columns: 1fr 1.4fr 1fr 1.5fr;
    margin-top: 10px;
    color: var(--muted);
    font-size: 0.62rem;
    text-align: center;
}

.insight-card {
    display: flex;
    gap: 13px;
    padding: 18px;
    border: 1px solid rgba(23, 79, 66, 0.08);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.48);
}

.insight-card svg {
    width: 21px;
    height: 21px;
    flex: 0 0 auto;
    fill: none;
    stroke: var(--green-light);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.insight-card span,
.healthy-range span {
    color: var(--green);
    font-size: 0.71rem;
    font-weight: 780;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.insight-card p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 0.84rem;
    line-height: 1.5;
}

.healthy-range {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-top: 16px;
    padding: 18px;
    border-top: 1px solid rgba(23, 79, 66, 0.12);
}

.healthy-range strong {
    white-space: nowrap;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.2rem;
}

.reset-button {
    display: block;
    margin: 10px auto 0;
    padding: 8px 12px;
    border: 0;
    color: var(--green);
    background: transparent;
    font-size: 0.78rem;
    font-weight: 720;
    text-decoration: underline;
    text-underline-offset: 4px;
}

.bmi-guide {
    display: grid;
    grid-template-columns: 0.8fr 1.2fr;
    gap: 40px 80px;
    padding: 110px 0 95px;
}

.bmi-guide > p {
    max-width: 560px;
    margin: 20px 0 0;
    color: var(--muted);
    line-height: 1.7;
}

.guide-grid {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 253, 248, 0.62);
}

.guide-grid article {
    display: grid;
    padding: 25px;
    border-right: 1px solid var(--line);
}

.guide-grid article:last-child {
    border-right: 0;
}

.dot {
    width: 9px;
    height: 9px;
    margin-bottom: 25px;
    border-radius: 50%;
}

.guide-grid strong {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.25rem;
    font-weight: 500;
}

.guide-grid small {
    margin-top: 5px;
    color: var(--muted);
}

footer {
    display: flex;
    width: min(1160px, calc(100% - 40px));
    align-items: center;
    justify-content: space-between;
    gap: 30px;
    margin: 0 auto;
    padding: 28px 0 36px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.72rem;
}

footer span {
    color: var(--ink);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1rem;
    font-weight: 700;
}

footer p {
    max-width: 620px;
    margin: 0;
    text-align: right;
}

@media (max-width: 850px) {
    .hero {
        margin-top: 40px;
    }

    .calculator-shell {
        grid-template-columns: 1fr;
    }

    .form-panel {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .result-panel {
        min-height: 500px;
    }

    .bmi-guide {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 80px 0;
    }

    .guide-grid {
        grid-column: auto;
        grid-template-columns: repeat(2, 1fr);
        margin-top: 30px;
    }

    .guide-grid article:nth-child(2) {
        border-right: 0;
    }

    .guide-grid article:nth-child(-n + 2) {
        border-bottom: 1px solid var(--line);
    }
}

@media (max-width: 520px) {
    .site-header,
    main,
    footer {
        width: min(100% - 28px, 1160px);
    }

    .site-header {
        padding-top: 20px;
    }

    .header-note {
        display: none;
    }

    .hero {
        margin: 45px auto 38px;
    }

    .hero h1 {
        font-size: 2.65rem;
    }

    .hero > p {
        font-size: 0.95rem;
    }

    .calculator-shell {
        border-radius: 20px;
    }

    .form-panel,
    .result-panel {
        padding: 30px 22px;
    }

    .panel-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 18px;
    }

    .result-panel {
        min-height: 450px;
    }

    .score-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .category-pill {
        margin: 0;
    }

    .gauge-labels {
        font-size: 0.52rem;
    }

    .healthy-range {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .guide-grid {
        grid-template-columns: 1fr;
    }

    .guide-grid article {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .guide-grid article:nth-child(3) {
        border-bottom: 1px solid var(--line);
    }

    .guide-grid article:last-child {
        border-bottom: 0;
    }

    footer {
        align-items: flex-start;
        flex-direction: column;
    }

    footer p {
        text-align: left;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
