* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #0E0F12 0%, #15171C 100%);
    min-height: 100vh;
    padding: 20px;
    color: #F3F4F6;
}

.container {
    max-width: 900px;
    margin: 0 auto;
}

.card {
    background: #15171C;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    margin-bottom: 20px;
}

h1 {
    text-align: center;
    font-size: 28px;
    margin-bottom: 30px;
    color: #F3F4F6;
}

h2 {
    font-size: 20px;
    margin-bottom: 20px;
    color: #F3F4F6;
    text-align: center;
}

.logo {
    display: block;
    height: 50px;
    width: auto;
    margin: 0 auto 20px;
}

/* Unit System Toggle */
.unit-toggle {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    background: #0E0F12;
    padding: 8px;
    border-radius: 8px;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.unit-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    background: transparent;
    color: #A6AAB4;
}

.unit-btn.active {
    background: #FF8C42;
    color: #0E0F12;
}

/* Form Grid */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #F3F4F6;
    font-size: 14px;
}

.form-group input,
.form-group select {
    padding: 12px;
    border: 1px solid #2A2D35;
    background: #0E0F12;
    color: #F3F4F6;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s ease;
    width: 100%;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #FF8C42;
    box-shadow: 0 0 0 3px rgba(255, 140, 66, 0.1);
}

.form-group select {
    cursor: pointer;
}

.select-wrapper {
    position: relative;
    display: block;
}

.select-wrapper select {
    width: 100%;
    padding-right: 40px;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.select-wrapper::after {
    content: '';
    pointer-events: none;
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid #A6AAB4;
}

.form-group.full {
    grid-column: 1 / -1;
}

.gender-group {
    display: flex;
    gap: 10px;
}

.gender-btn {
    flex: 1;
    padding: 12px;
    border: 2px solid #2A2D35;
    border-radius: 6px;
    background: #0E0F12;
    color: #A6AAB4;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.gender-btn.active {
    background: #FF8C42;
    color: #0E0F12;
    border-color: #FF8C42;
}

.helper-text {
    font-size: 12px;
    color: #A6AAB4;
    margin-top: 5px;
    margin-bottom: 10px;
    font-weight: 400;
}

.height-imperial {
    display: none;
    gap: 15px;
}

.height-imperial.active {
    display: flex;
}

.height-field {
    flex: 1;
}

.height-field input {
    padding: 12px;
    border: 1px solid #2A2D35;
    background: #0E0F12;
    color: #F3F4F6;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s ease;
    width: 100%;
    box-sizing: border-box;
}

.height-field input:focus {
    outline: none;
    border-color: #FF8C42;
    box-shadow: 0 0 0 3px rgba(255, 140, 66, 0.1);
}

.height-metric {
    display: block;
}

.height-metric.hidden {
    display: none;
}

/* Macro Split */
.macro-split {
    margin-bottom: 30px;
    padding-bottom: 15px;
}

.macro-options {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 25px;
    margin-top: 15px;
}

.macro-option {
    padding: 15px;
    border: 2px solid #2A2D35;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #0E0F12;
    font-weight: 500;
    color: #A6AAB4;
}

.macro-option:hover {
    border-color: #FF8C42;
}

.macro-option.active {
    background: #FF8C42;
    color: #0E0F12;
    border-color: #FF8C42;
}

/* Button */
.calculate-btn {
    width: 100%;
    padding: 15px;
    background: #FF8C42;
    color: #0E0F12;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 12px;
    transition: background 0.3s ease, opacity 0.3s ease, box-shadow 0.3s ease;
}

.calculate-btn:hover {
    background: #FFB366;
}

.calculate-btn:active {
    transform: scale(0.98);
}

.disclaimer-check {
    margin-top: 20px;
    padding: 14px 16px;
    border: 1px solid #2A2D35;
    border-radius: 8px;
    background: rgba(255,255,255,0.02);
}

/* ── Internal mode (?mode=internal) ─────────────────────────────────────────── */
.internal-mode .disclaimer-check { display: none; }
.internal-mode .macro-paywall-overlay { display: none; }
.internal-mode .macro-blurred-content .macro-value,
.internal-mode .macro-blurred-content .macro-percentage,
.internal-mode .macro-blurred-content .meal-calories,
.internal-mode .macro-blurred-content .meal-macros span { filter: none; }
.internal-mode .macro-locked-wrapper { min-height: unset; }
.internal-mode .macro-blurred-content { position: static; }

.calculator-disclaimer {
    margin-top: 16px;
    font-size: 11px;
    color: #6B7280;
    line-height: 1.6;
    text-align: center;
    border-top: 1px solid #1E2028;
    padding-top: 16px;
}

.calculate-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    transform: none;
    background: #3A3D45;
    box-shadow: none;
}

/* ── Email Gate ──────────────────────────────────────────────────────────────── */
.email-gate {
    display: none;
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.email-gate.visible {
    display: block;
    opacity: 1;
    transform: translateY(0);
    animation: slideIn 0.4s ease forwards;
}

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

.email-gate h2 {
    margin-bottom: 8px;
}

.email-gate-subtitle {
    text-align: center;
    color: #A6AAB4;
    margin-bottom: 28px;
    font-size: 15px;
    line-height: 1.5;
}

.optional {
    font-weight: 400;
    color: #A6AAB4;
    font-size: 13px;
}

.required-star {
    color: #FF8C42;
}

/* Checkbox row */
.checkbox-group {
    margin-top: 4px;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.checkbox-custom {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    min-width: 22px;
    border: 2px solid #3A3D45;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.05);
    margin-top: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom {
    background: #FF8C42;
    border-color: #FF8C42;
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom::after {
    content: '';
    display: block;
    width: 5px;
    height: 10px;
    border: 2px solid #fff;
    border-top: none;
    border-left: none;
    transform: rotate(45deg) translateY(-1px);
}

.checkbox-text {
    font-size: 13px;
    color: #A6AAB4;
    line-height: 1.5;
    font-weight: 400;
}

/* Error message */
.gate-error {
    background: rgba(220, 53, 69, 0.12);
    border: 1px solid rgba(220, 53, 69, 0.4);
    color: #ff6b7a;
    border-radius: 6px;
    padding: 12px 14px;
    font-size: 14px;
    margin-bottom: 16px;
}

.hidden {
    display: none !important;
}

/* Results Section */
.results {
    display: none;
    animation: slideIn 0.3s ease;
}

.results.visible {
    display: block;
}

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

.calorie-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

/* Deficit spans the full width below the 3 informational cards */
.calorie-card.deficit {
    grid-column: 1 / -1;
}

.calorie-card {
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    border: 2px solid;
}

.calorie-card.surplus {
    border-color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
}

.calorie-card.tdee {
    border-color: #0088cc;
    background: rgba(0, 136, 204, 0.1);
}

.calorie-card.deficit {
    border-color: #27ae60;
    background: rgba(39, 174, 96, 0.15);
    padding: 32px 20px;
}

.calorie-card.bmr {
    border-color: #f39c12;
    background: rgba(243, 156, 18, 0.1);
}

.calorie-card label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.calorie-card .label-surplus {
    color: #e74c3c;
}

.calorie-card .label-tdee {
    color: #0088cc;
}

.calorie-card .label-deficit {
    color: #27ae60;
}

.calorie-card .label-bmr {
    color: #f39c12;
}

.calorie-value {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #F3F4F6;
}

.calorie-card.surplus .calorie-value {
    color: #e74c3c;
}

.calorie-card.tdee .calorie-value {
    color: #0088cc;
}

.calorie-card.deficit .calorie-value {
    color: #27ae60;
    font-size: 56px;
}

.calorie-card.bmr .calorie-value {
    color: #FFB366;
}

.calorie-unit {
    font-size: 12px;
    color: #A6AAB4;
}

.calorie-note {
    font-size: 11px;
    margin-top: 8px;
    line-height: 1.4;
    color: #A6AAB4;
}

.calorie-card.bmr .calorie-note {
    color: #f39c12;
    font-weight: 600;
}

/* Macro Breakdown */
.macro-breakdown {
    margin-bottom: 30px;
}

.macro-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
}

.macro-card {
    padding: 20px;
    border-radius: 8px;
    background: #0E0F12;
    text-align: center;
    border: 1px solid #2A2D35;
}

.macro-card label {
    display: block;
    font-size: 12px;
    color: #A6AAB4;
    margin-bottom: 8px;
    text-transform: uppercase;
    font-weight: 600;
}

.macro-value {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #FF8C42;
}

.macro-percentage {
    font-size: 12px;
    color: #A6AAB4;
}

/* ── Macro Paywall ──────────────────────────────────────────────────────────── */
.macro-locked-wrapper {
    position: relative;
    min-height: 560px;
}

/* Blurred inner content — fills the wrapper, vertically stacked */
.macro-blurred-content {
    position: absolute;
    inset: 0;
    user-select: none;
    pointer-events: none;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 2px;
}

/* Only blur the numbers, not labels/images/descriptions */
.macro-blurred-content .macro-value,
.macro-blurred-content .macro-percentage,
.macro-blurred-content .meal-calories,
.macro-blurred-content .meal-macros span {
    filter: blur(5px);
    user-select: none;
}

/* ── Meal Plan ──────────────────────────────────────────────────────────────── */
.meal-plan {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.meal-plan-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #A6AAB4;
    text-align: center;
    margin-bottom: 2px;
}

.meal-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #0E0F12;
    border: 1px solid #2A2D35;
    border-radius: 8px;
    padding: 10px 12px;
}

.meal-img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

.meal-info {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.meal-label-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.meal-label {
    font-size: 11px;
    font-weight: 700;
    color: #A6AAB4;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.meal-desc {
    font-size: 12px;
    color: #F3F4F6;
    font-weight: 500;
    line-height: 1.3;
}

.meal-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
}

.meal-calories {
    font-size: 18px;
    font-weight: 700;
    color: #FF8C42;
    line-height: 1;
    white-space: nowrap;
}

.meal-macros {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.meal-macros span {
    font-size: 10px;
    color: #A6AAB4;
    background: #1A1C22;
    border: 1px solid #2A2D35;
    border-radius: 4px;
    padding: 2px 6px;
    white-space: nowrap;
}

.macro-paywall-overlay {
    /* covers exactly the cards grid */
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    /* solid-ish dark fill — no backdrop-filter which breaks child blur */
    background: rgba(14, 15, 18, 0.88);
}

.macro-paywall-content {
    text-align: center;
    padding: 0 20px;
    max-width: 340px;
    width: 100%;
}

.paywall-lock-icon {
    font-size: 28px;
    margin-bottom: 10px;
}

.paywall-title {
    font-size: 17px;
    font-weight: 700;
    color: #F3F4F6;
    margin-bottom: 8px;
}

.paywall-subtitle {
    font-size: 13px;
    color: #A6AAB4;
    line-height: 1.5;
    margin-bottom: 18px;
}

.paywall-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.paywall-btn {
    display: block;
    width: 100%;
    padding: 14px 28px;
    background: linear-gradient(135deg, #FF8C42 0%, #FFB366 100%);
    color: #0E0F12;
    border: 2px solid transparent;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    box-sizing: border-box;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.paywall-btn-secondary {
    background: transparent;
    color: #FF8C42;
    border-color: #FF8C42;
}

.paywall-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(255, 140, 66, 0.35);
}

.paywall-btn-secondary:hover {
    background: rgba(255, 140, 66, 0.08);
    box-shadow: none;
}

/* CTA Button */
.cta-btn {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, #FF8C42 0%, #FFB366 100%);
    color: #0E0F12;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    margin-bottom: 15px;
    transition: transform 0.2s ease;
}

.cta-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(255, 140, 66, 0.4);
}

.cta-note {
    text-align: center;
    font-size: 12px;
    color: #A6AAB4;
}

.copy-btn {
    width: 100%;
    padding: 15px;
    background: #FF8C42;
    color: #0E0F12;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 10px;
    display: block;
    text-align: center;
    box-sizing: border-box;
}

.copy-btn:hover {
    background: #FFB366;
    transform: translateY(-1px);
}

.copy-btn:active {
    transform: scale(0.98);
}

.copy-btn.copied {
    background: #27ae60;
}

.recalculate-btn {
    width: 100%;
    padding: 12px;
    background: #0E0F12;
    color: #FF8C42;
    border: 1px solid #2A2D35;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.recalculate-btn:hover {
    background: #15171C;
    border-color: #FF8C42;
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    .macro-locked-wrapper {
        min-height: unset;
    }

    .macro-blurred-content {
        position: static;
        filter: none;
    }

    .macro-blurred-content .macro-value,
    .macro-blurred-content .macro-percentage,
    .macro-blurred-content .meal-calories,
    .macro-blurred-content .meal-macros span {
        filter: blur(5px);
    }

    .macro-paywall-overlay {
        position: static;
        inset: unset;
        width: 100%;
        border-radius: 12px;
        padding: 20px 16px;
        margin-top: 8px;
        background: rgba(14, 15, 18, 0.97);
    }

    .macro-paywall-content {
        padding: 0;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .checkbox-label {
        align-items: flex-start;
        gap: 14px;
        padding: 4px 0;
    }

    .checkbox-custom {
        width: 26px;
        height: 26px;
        min-width: 26px;
    }

    .checkbox-text {
        font-size: 14px;
    }

    .form-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .calorie-cards {
        grid-template-columns: 1fr;
    }

    .macro-cards {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 24px 16px;
        border-radius: 12px;
    }

    .logo {
        height: 40px;
        margin-bottom: 16px;
    }

    h1 {
        font-size: 24px;
        margin-bottom: 20px;
    }

    h2 {
        font-size: 18px;
    }

    .form-group {
        margin-bottom: 4px;
    }

    .form-group label {
        font-size: 15px;
        margin-bottom: 10px;
    }

    .form-group input,
    .form-group select {
        padding: 16px;
        font-size: 16px;
        min-height: 52px;
        -webkit-appearance: none;
        appearance: none;
        border: 2px solid #3A3D45;
        background: rgba(255, 255, 255, 0.05);
        width: 100%;
        box-sizing: border-box;
    }

    .select-wrapper select {
        padding-right: 44px;
    }

    .form-group input:focus,
    .form-group select:focus {
        border-color: #FF8C42;
    }

    .gender-btn,
    .macro-option {
        padding: 16px 14px;
        font-size: 15px;
        min-height: 52px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .calculate-btn,
    .copy-btn,
    .recalculate-btn {
        padding: 18px;
        font-size: 17px;
        min-height: 56px;
    }

    .unit-btn {
        padding: 14px 18px;
        font-size: 15px;
        min-height: 50px;
    }

    .calorie-card {
        padding: 18px;
    }

    .calorie-value {
        font-size: 32px;
    }

    .macro-card {
        padding: 18px;
    }

    .macro-value {
        font-size: 26px;
    }

    .height-imperial {
        gap: 12px;
    }

    .height-field input {
        font-size: 16px;
        padding: 16px;
        min-height: 52px;
        border: 2px solid #3A3D45;
        background: rgba(255, 255, 255, 0.05);
    }

    .helper-text {
        font-size: 13px;
        margin-top: 8px;
    }
}

@media (max-width: 480px) {
    .card {
        padding: 20px 14px;
    }

    h1 {
        font-size: 22px;
        margin-bottom: 16px;
    }

    .unit-toggle {
        flex-direction: column;
        width: 100%;
    }

    .unit-btn {
        width: 100%;
        padding: 16px;
    }

    .form-group label {
        font-size: 14px;
    }

    .form-group input,
    .form-group select {
        padding: 16px;
        font-size: 16px;
        min-height: 52px;
        border: 2px solid #3A3D45;
        background: rgba(255, 255, 255, 0.05);
        width: 100%;
        box-sizing: border-box;
    }

    .select-wrapper select {
        padding-right: 44px;
    }

    .gender-group {
        flex-direction: column;
        gap: 12px;
    }

    .gender-btn {
        padding: 16px 14px;
        min-height: 52px;
    }

    .calorie-card {
        padding: 16px;
    }

    .calorie-card label {
        font-size: 11px;
    }

    .calorie-value {
        font-size: 28px;
    }

    .calorie-unit {
        font-size: 11px;
    }

    .macro-option {
        padding: 14px;
        font-size: 14px;
        min-height: 52px;
    }
}
