.tdee-page,
.nutrition-page {
    min-height: calc(100vh - 76px);
    background:
        radial-gradient(circle at 8% 10%, rgba(5, 184, 79, 0.14), transparent 28%),
        radial-gradient(circle at 92% 8%, rgba(255, 190, 74, 0.14), transparent 24%),
        linear-gradient(135deg, #f2fff7, #fffdf2 52%, #f4fbff);
}

.tool-hero,
.nutrition-hero {
    position: relative;
    overflow: hidden;
    padding: 62px 0 34px;
}

.tool-hero::after,
.nutrition-hero::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(5, 184, 79, 0.22), transparent);
}

.tool-hero-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 48px;
    align-items: center;
}

.tool-copy h1 {
    margin: 14px 0 16px;
    max-width: 720px;
    color: var(--ink);
    font-size: clamp(42px, 6vw, 76px);
    line-height: 0.98;
}

.tool-copy p {
    max-width: 640px;
    margin: 0;
    color: var(--muted);
    font-size: 19px;
    line-height: 1.75;
}

.tool-trust-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 26px;
}

.tool-trust-row span,
.chip,
.eyebrow {
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.tool-trust-row span {
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(5, 184, 79, 0.14);
    color: var(--leaf);
    font-weight: 950;
}

.tool-trust-row span:hover,
.chip:hover {
    transform: translateY(-2px);
    border-color: rgba(5, 184, 79, 0.35);
    box-shadow: 0 12px 26px rgba(5, 184, 79, 0.10);
}

.tool-visual {
    position: relative;
    min-height: 330px;
    display: grid;
    place-items: center;
}

.tool-orbit {
    position: absolute;
    inset: 20px;
    border: 1px dashed rgba(5, 184, 79, 0.28);
    border-radius: 50%;
    animation: rotateSlow 18s linear infinite;
}

.tool-orbit span {
    position: absolute;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--green), #8edb54);
    box-shadow: 0 14px 28px rgba(5, 184, 79, 0.22);
}

.tool-orbit span:nth-child(1) {
    top: 12px;
    left: 50%;
}

.tool-orbit span:nth-child(2) {
    right: 22px;
    bottom: 54px;
    background: linear-gradient(135deg, #ffbe4a, #ff7a1a);
}

.tool-orbit span:nth-child(3) {
    left: 26px;
    bottom: 74px;
    background: linear-gradient(135deg, #20c7d9, #0b7cff);
}

.tool-meter {
    position: relative;
    z-index: 1;
    width: 210px;
    height: 210px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 8px;
    border-radius: 50%;
    background: linear-gradient(135deg, #fff, #e9fff1);
    border: 1px solid rgba(5, 184, 79, 0.14);
    box-shadow: 0 24px 60px rgba(23, 32, 51, 0.12);
    animation: floatSoft 3.5s ease-in-out infinite;
}

.tool-meter strong {
    color: var(--green-dark);
    font-size: 58px;
    font-weight: 950;
}

.tool-meter small {
    color: var(--muted);
    font-weight: 900;
}

.tool-workspace {
    padding-top: 36px;
}

.tool-panel {
    position: relative;
    overflow: hidden;
    padding: 30px;
    border: 1px solid rgba(5, 184, 79, 0.13);
    border-radius: 26px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 24px 70px rgba(23, 32, 51, 0.10);
}

.tool-panel::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 5px;
    background: linear-gradient(90deg, var(--green), #93d96a, #ffbe4a);
}

.tdee-grid {
    display: grid;
    grid-template-columns: minmax(0, 0.92fr) minmax(390px, 1.08fr);
    gap: 28px;
    align-items: start;
}

.panel-heading {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.panel-heading h3 {
    margin: 0 0 4px;
    color: var(--ink);
    font-size: 25px;
}

.panel-heading p {
    margin: 0;
    color: var(--muted);
    line-height: 1.45;
}

.panel-icon,
.result-icon {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: var(--green-soft);
    color: var(--green-dark);
    flex: 0 0 auto;
}

.panel-icon.hot {
    background: #fff3d8;
    color: #ff7a1a;
}

.form-section {
    margin-bottom: 18px;
}

.tdee-form label {
    color: #1f2a3c;
    font-weight: 950;
}

.tdee-form input,
.tdee-form select {
    min-height: 50px;
    border-radius: 16px;
    background: #fbfffd;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.tdee-form input:focus,
.tdee-form select:focus,
.nutrition-search input:focus {
    outline: none;
    border-color: rgba(5, 184, 79, 0.55);
    box-shadow: 0 0 0 4px rgba(5, 184, 79, 0.10);
    background: #fff;
}

.tdee-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 16px;
}

.gender-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.gender-tabs label {
    min-height: 52px;
    display: grid;
    place-items: center;
    border: 1px solid #cfd7e3;
    border-radius: 16px;
    padding: 14px;
    text-align: center;
    cursor: pointer;
    background: #fff;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.gender-tabs label:hover {
    transform: translateY(-2px);
}

.gender-tabs input {
    display: none;
}

.gender-tabs input:checked + span {
    color: var(--green-dark);
    font-weight: 950;
}

.gender-tabs label:has(input:checked) {
    background: var(--green-soft);
    border-color: rgba(5, 184, 79, 0.55);
    box-shadow: inset 0 0 0 1px rgba(5, 184, 79, 0.18);
}

.ai-submit {
    position: relative;
    overflow: hidden;
    width: 100%;
    min-height: 56px;
    margin-top: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-radius: 18px;
    background: linear-gradient(90deg, var(--green), var(--blue));
}

.ai-submit::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: -40%;
    width: 35%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.34), transparent);
    transform: skewX(-18deg);
    transition: left 0.55s ease;
}

.ai-submit:hover::after {
    left: 115%;
}

.result-empty {
    min-height: 430px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 14px;
    text-align: center;
    color: var(--muted);
}

.result-empty .result-icon {
    width: 76px;
    height: 76px;
    margin-bottom: 6px;
    color: #9aa4b2;
    background: #f0f2f6;
}

.result-empty .icon {
    width: 34px;
    height: 34px;
}

.result-empty h3 {
    margin: 0;
    color: var(--ink);
    font-size: 27px;
}

.result-empty p {
    max-width: 440px;
    margin: 0 auto;
    line-height: 1.7;
}

.result-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.result-card {
    border-radius: 22px;
    padding: 22px;
    background: linear-gradient(135deg, #f2fff7, #fff);
    border: 1px solid rgba(5, 184, 79, 0.12);
}

.result-card.primary {
    background: linear-gradient(135deg, var(--green), var(--green-dark));
    color: #fff;
}

.result-card span,
.result-card small {
    display: block;
    color: var(--muted);
    font-weight: 850;
}

.result-card.primary span,
.result-card.primary small {
    color: rgba(255, 255, 255, 0.84);
}

.result-card strong {
    display: block;
    margin: 10px 0 4px;
    color: var(--green-dark);
    font-size: 46px;
    line-height: 1;
}

.result-card.primary strong {
    color: #fff;
}

.goal-calories {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 18px 0;
}

.goal-calories div,
.macro-guide div {
    border-radius: 18px;
    padding: 16px;
    background: #f7f9fb;
    border: 1px solid #edf1f5;
}

.goal-calories div.active {
    background: #fff7e4;
    border-color: #f5d99a;
}

.goal-calories small,
.goal-calories span {
    display: block;
    color: var(--muted);
    font-weight: 850;
}

.goal-calories strong {
    display: block;
    margin: 6px 0;
    color: var(--ink);
    font-size: 26px;
    font-weight: 950;
}

.macro-guide {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 18px 0;
}

.macro-guide strong,
.macro-guide span {
    display: block;
}

.macro-guide strong {
    color: var(--green-dark);
    margin-bottom: 4px;
}

.macro-guide span {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.4;
}

.ai-note {
    padding: 18px;
    border-radius: 20px;
    background: linear-gradient(135deg, #eafff2, #fffdf0);
    border: 1px solid rgba(5, 184, 79, 0.18);
    color: var(--leaf);
    font-weight: 900;
    line-height: 1.65;
}

.tool-title {
    max-width: 820px;
    margin: 0 auto 30px;
}

.nutrition-search {
    position: relative;
    width: min(760px, 100%);
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 112px;
    align-items: center;
    gap: 8px;
    margin: 0 auto;
    padding: 8px;
    border: 1px solid rgba(5, 184, 79, 0.16);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 18px 50px rgba(23, 32, 51, 0.08);
}

.nutrition-search > .icon {
    width: 22px;
    height: 22px;
    margin-left: 14px;
    color: #9aa4b2;
}

.nutrition-search input {
    border: 0;
    padding: 12px 8px;
    background: transparent;
    box-shadow: none;
}

.nutrition-search button {
    min-height: 44px;
    border-radius: 999px;
    padding: 10px 18px;
}

.chip-row {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 24px 0 0;
}

.chip {
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.9);
    border-radius: 999px;
    padding: 9px 16px;
    color: #445066;
    font-weight: 850;
}

.chip.active {
    background: var(--green);
    color: #fff;
    border-color: var(--green);
    box-shadow: 0 12px 24px rgba(5, 184, 79, 0.18);
}

.nutrition-results {
    padding-top: 34px;
}

.nutrition-count {
    width: fit-content;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 auto 26px;
    padding: 10px 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid rgba(5, 184, 79, 0.12);
    color: var(--muted);
    font-weight: 850;
}

.nutrition-count strong {
    color: var(--green-dark);
    font-size: 22px;
}

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

.nutrition-card {
    position: relative;
    overflow: hidden;
    padding: 22px;
    border-radius: 24px;
    border: 1px solid rgba(5, 184, 79, 0.12);
    background:
        radial-gradient(circle at top right, rgba(5, 184, 79, 0.10), transparent 42%),
        #fff;
    box-shadow: 0 18px 45px rgba(23, 32, 51, 0.08);
    animation: cardIn 0.42s ease both;
    animation-delay: var(--delay, 0ms);
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.nutrition-card:hover {
    transform: translateY(-6px);
    border-color: rgba(5, 184, 79, 0.28);
    box-shadow: 0 24px 58px rgba(5, 184, 79, 0.14);
}

.nutrition-card-head {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
}

.nutrition-card h3 {
    margin: 0 0 4px;
    font-size: 19px;
}

.nutrition-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}

.food-tag {
    height: fit-content;
    padding: 7px 10px;
    border-radius: 999px;
    background: #fff1f1;
    color: #ff364b;
    font-size: 12px;
    font-weight: 950;
}

.calories {
    display: flex;
    align-items: baseline;
    gap: 8px;
    color: var(--orange);
    margin: 18px 0;
}

.calories .icon {
    align-self: center;
}

.calories strong {
    font-size: 34px;
    line-height: 1;
    font-weight: 950;
}

.calories span {
    color: var(--muted);
    font-weight: 850;
}

.nutrition-macros {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin: 18px 0;
}

.nutrition-macros div {
    padding: 10px 7px;
    border-radius: 14px;
    background: #f7f9fb;
    text-align: center;
}

.nutrition-macros strong,
.nutrition-macros span {
    display: block;
}

.nutrition-macros strong {
    color: var(--green-dark);
    font-size: 14px;
}

.nutrition-macros span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
}

.nutrition-detail-toggle {
    width: 100%;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 14px;
    background: #f3fff7;
    color: var(--green-dark);
    box-shadow: none;
}

.nutrition-detail-toggle .icon {
    width: 16px;
    height: 16px;
    transition: transform 0.2s ease;
}

.nutrition-card.is-open .nutrition-detail-toggle .icon {
    transform: rotate(180deg);
}

.nutrition-detail {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.25s ease;
}

.nutrition-detail p {
    overflow: hidden;
    margin-top: 0;
    font-weight: 800;
}

.nutrition-card.is-open .nutrition-detail {
    grid-template-rows: 1fr;
    margin-top: 12px;
}

.empty-nutrition {
    max-width: 620px;
    margin: 0 auto;
    text-align: center;
}

.empty-nutrition h3 {
    margin: 0 0 8px;
}

@keyframes rotateSlow {
    to {
        transform: rotate(360deg);
    }
}

@keyframes floatSoft {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-8px);
    }
}

@keyframes cardIn {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 1080px) {
    .tool-hero-inner,
    .tdee-grid {
        grid-template-columns: 1fr;
    }

    .tool-visual {
        min-height: 260px;
    }
}

@media (max-width: 980px) {
    .nutrition-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 620px) {
    .tool-hero,
    .nutrition-hero {
        padding-top: 42px;
    }

    .tdee-fields,
    .goal-calories,
    .macro-guide,
    .result-summary,
    .nutrition-grid {
        grid-template-columns: 1fr;
    }

    .nutrition-search {
        grid-template-columns: 34px minmax(0, 1fr);
        border-radius: 22px;
    }

    .nutrition-search button {
        grid-column: 1 / -1;
        width: 100%;
    }

    .nutrition-macros {
        grid-template-columns: repeat(2, 1fr);
    }
}
