
        /* =====================================================
           CALORIE DEFICIT CALCULATOR — scoped styles
           ===================================================== */

        :root {
            --cdc-accent: #0d9488;
            --cdc-accent-soft: #f0fdfa;
            --cdc-accent-chip-bg: #ccfbf1;
            --cdc-accent-chip-color: #115e59;
            --cdc-cut: #0d9488;
            --cdc-bulk: #7c3aed;
            --cdc-maintain: #6b7280;
            --cdc-warn-bg: #fffbeb;
            --cdc-warn-border: #fde68a;
            --cdc-warn-text: #92400e;
        }

        .tool-page {
            min-height: 100vh;
            display: flex;
            flex-direction: column;
        }

        .tool-main {
            flex: 1;
            padding: 80px 0 80px;
        }

        /* Header */
        .tool-header {
            text-align: center;
            margin-bottom: 40px;
        }

        .tool-badge {
            display: inline-block;
            padding: 5px 14px;
            border-radius: var(--radius-full);
            font-size: 0.8rem;
            font-weight: 600;
            background: var(--color-text);
            color: var(--color-bg);
            margin-bottom: 16px;
            letter-spacing: 0.01em;
        }

        .tool-header h1 {
            font-family: var(--font-display);
            font-size: 3rem;
            font-weight: 900;
            letter-spacing: -0.035em;
            line-height: 1.08;
            color: var(--color-text);
            margin-bottom: 12px;
        }

        .tool-header p {
            font-size: 1.1rem;
            color: var(--color-text-secondary);
            max-width: 580px;
            margin: 0 auto;
            line-height: 1.65;
        }

        /* Calculator Card */
        .tool-calc-card {
            max-width: 560px;
            margin: 0 auto 28px;
            background: var(--color-bg);
            border: 1px solid var(--color-border);
            border-radius: var(--radius-lg);
            padding: 36px;
            box-shadow: var(--shadow-elevated);
        }

        .section-label {
            font-family: var(--font-body);
            font-size: 0.72rem;
            font-weight: 700;
            color: var(--color-text-tertiary);
            text-transform: uppercase;
            letter-spacing: 0.08em;
            margin-bottom: 10px;
        }

        /* Unit toggle */
        .tool-unit-toggle-standalone {
            display: inline-flex;
            background: var(--color-surface);
            border-radius: var(--radius-full);
            padding: 4px;
            border: 1px solid var(--color-border);
            margin-bottom: 22px;
        }

        .tool-unit-btn {
            padding: 7px 18px;
            font-family: var(--font-body);
            font-size: 0.82rem;
            font-weight: 600;
            color: var(--color-text-tertiary);
            background: transparent;
            border: none;
            border-radius: var(--radius-full);
            cursor: pointer;
            transition: all 0.2s ease;
        }

        .tool-unit-btn.active {
            background: var(--color-bg);
            color: var(--color-text);
            box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
        }

        /* Input row */
        .tool-input-row {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 12px;
            margin-bottom: 20px;
        }

        .tool-input-group {
            margin-bottom: 20px;
        }

        .tool-input-group.compact { margin-bottom: 0; }

        .tool-input-label {
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-size: 0.85rem;
            font-weight: 600;
            color: var(--color-text);
            margin-bottom: 6px;
            letter-spacing: 0.01em;
        }

        .tool-input-hint {
            font-weight: 400;
            color: var(--color-text-tertiary);
            font-size: 0.8rem;
        }

        .tool-input-field {
            width: 100%;
            padding: 12px 16px;
            font-family: var(--font-body);
            font-size: 1rem;
            font-weight: 500;
            color: var(--color-text);
            background: var(--color-surface);
            border: 1px solid var(--color-border);
            border-radius: var(--radius-sm);
            outline: none;
            transition: border-color 0.2s ease, box-shadow 0.2s ease;
            -moz-appearance: textfield;
            appearance: textfield;
        }

        .tool-input-field::-webkit-outer-spin-button,
        .tool-input-field::-webkit-inner-spin-button {
            -webkit-appearance: none;
            margin: 0;
        }

        .tool-input-field::placeholder {
            color: var(--color-text-tertiary);
            font-weight: 400;
        }

        .tool-input-field:focus {
            border-color: var(--color-text);
            box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.06);
        }

        .tdee-help {
            display: block;
            font-size: 0.78rem;
            color: var(--color-text-tertiary);
            margin-top: 6px;
        }

        .tdee-help a {
            color: var(--color-text-secondary);
            text-decoration: underline;
            text-underline-offset: 2px;
            font-weight: 500;
        }

        .tdee-help a:hover {
            color: var(--color-text);
        }

        /* Rate pill grid */
        .rate-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 10px;
        }

        .rate-pill {
            position: relative;
            padding: 14px 14px 12px;
            background: var(--color-surface);
            border: 1px solid var(--color-border);
            border-radius: var(--radius-md);
            cursor: pointer;
            text-align: left;
            transition: all 0.2s ease;
            font-family: inherit;
        }

        .rate-pill:hover {
            border-color: var(--color-text-secondary);
            transform: translateY(-1px);
        }

        .rate-pill.active {
            background: var(--color-bg);
            border-color: var(--color-text);
            box-shadow: 0 0 0 1px var(--color-text), 0 4px 12px rgba(0, 0, 0, 0.05);
        }

        .rate-pill .rate-amount {
            font-family: var(--font-display);
            font-size: 1.3rem;
            font-weight: 800;
            color: var(--color-text);
            letter-spacing: -0.015em;
            line-height: 1;
        }

        .rate-pill .rate-unit {
            font-family: var(--font-display);
            font-size: 0.8rem;
            font-weight: 700;
            color: var(--color-text-secondary);
            margin-left: 2px;
            letter-spacing: -0.01em;
        }

        .rate-pill .rate-label {
            font-family: var(--font-body);
            font-size: 0.78rem;
            font-weight: 600;
            color: var(--color-text);
            margin-top: 6px;
            text-transform: uppercase;
            letter-spacing: 0.04em;
        }

        .rate-pill .rate-delta {
            font-family: var(--font-body);
            font-size: 0.75rem;
            color: var(--color-text-tertiary);
            margin-top: 2px;
        }

        .rate-pill .rate-recommend {
            position: absolute;
            top: -8px;
            right: 10px;
            padding: 2px 8px;
            background: var(--cdc-accent);
            color: #fff;
            font-family: var(--font-body);
            font-size: 0.6rem;
            font-weight: 800;
            letter-spacing: 0.06em;
            text-transform: uppercase;
            border-radius: var(--radius-full);
            white-space: nowrap;
        }

        .tool-error-msg {
            color: #ef4444;
            font-size: 0.85rem;
            font-weight: 500;
            margin-top: 12px;
            display: none;
            text-align: center;
        }

        .tool-error-msg.show {
            display: block;
        }

        /* =====================================================
           RESULT
           ===================================================== */

        .tool-result {
            display: none;
            max-width: 860px;
            margin: 0 auto 48px;
            animation: toolFadeIn 0.5s ease;
        }

        .tool-result.show {
            display: block;
        }

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

        .tool-result-hero {
            background: var(--color-bg);
            border: 1px solid var(--color-border);
            border-radius: var(--radius-lg);
            padding: 36px 40px 32px;
            box-shadow: var(--shadow-elevated);
            text-align: center;
            position: relative;
            overflow: hidden;
            margin-bottom: 20px;
        }

        .tool-result-hero::before {
            content: "";
            position: absolute;
            inset: 0;
            background: radial-gradient(ellipse at top, var(--cdc-accent-soft) 0%, transparent 70%);
            opacity: 0.8;
            pointer-events: none;
        }

        .tool-result-hero > * { position: relative; }

        .direction-chip {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            padding: 5px 14px;
            border-radius: var(--radius-full);
            font-family: var(--font-body);
            font-size: 0.8rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.08em;
            margin-bottom: 14px;
        }

        .direction-chip.cut      { background: #ccfbf1; color: #115e59; }
        .direction-chip.bulk     { background: #ede9fe; color: #5b21b6; }
        .direction-chip.maintain { background: #e5e7eb; color: #374151; }

        .direction-chip svg {
            width: 14px;
            height: 14px;
        }

        .result-number {
            font-family: var(--font-display);
            font-size: 5rem;
            font-weight: 900;
            letter-spacing: -0.045em;
            line-height: 1;
            color: var(--color-text);
            margin-bottom: 2px;
        }

        .result-unit {
            font-family: var(--font-display);
            font-size: 1.4rem;
            font-weight: 800;
            color: var(--color-text-secondary);
            letter-spacing: -0.02em;
        }

        .result-caption {
            font-size: 0.95rem;
            color: var(--color-text-secondary);
            margin-top: 6px;
            font-weight: 500;
        }

        .result-context {
            display: inline-block;
            margin-top: 12px;
            padding: 5px 14px;
            background: var(--color-surface);
            border-radius: var(--radius-full);
            font-size: 0.82rem;
            font-weight: 600;
            color: var(--color-text-secondary);
        }

        .result-context strong {
            color: var(--color-text);
            font-family: var(--font-display);
            font-weight: 800;
            letter-spacing: -0.005em;
        }

        /* Key stats */
        .result-stats {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 14px;
            margin-top: 26px;
            padding-top: 24px;
            border-top: 1px solid var(--color-border);
        }

        .result-stat {
            text-align: center;
        }

        .result-stat-label {
            font-family: var(--font-body);
            font-size: 0.68rem;
            font-weight: 700;
            color: var(--color-text-tertiary);
            text-transform: uppercase;
            letter-spacing: 0.06em;
            margin-bottom: 4px;
        }

        .result-stat-value {
            font-family: var(--font-display);
            font-size: 1.3rem;
            font-weight: 800;
            color: var(--color-text);
            letter-spacing: -0.015em;
            line-height: 1.1;
        }

        .result-stat-sub {
            font-size: 0.72rem;
            color: var(--color-text-tertiary);
            margin-top: 2px;
            font-weight: 500;
        }

        /* Safety warning card */
        .warning-card {
            background: var(--cdc-warn-bg);
            border: 1px solid var(--cdc-warn-border);
            border-radius: var(--radius-md);
            padding: 16px 20px;
            margin-bottom: 20px;
            display: flex;
            align-items: flex-start;
            gap: 12px;
        }

        .warning-card svg {
            width: 20px;
            height: 20px;
            flex-shrink: 0;
            color: var(--cdc-warn-text);
            margin-top: 2px;
        }

        .warning-card .warning-title {
            font-family: var(--font-display);
            font-size: 0.95rem;
            font-weight: 800;
            color: var(--cdc-warn-text);
            letter-spacing: -0.01em;
            margin-bottom: 4px;
        }

        .warning-card .warning-body {
            font-size: 0.86rem;
            color: var(--cdc-warn-text);
            line-height: 1.55;
        }

        /* =====================================================
           TIMELINE VISUALIZATION
           ===================================================== */

        .timeline-card {
            background: var(--color-bg);
            border: 1px solid var(--color-border);
            border-radius: var(--radius-lg);
            padding: 32px 40px;
            margin-bottom: 20px;
            box-shadow: var(--shadow-card);
        }

        .timeline-card h3 {
            font-family: var(--font-display);
            font-size: 1.3rem;
            font-weight: 800;
            letter-spacing: -0.02em;
            color: var(--color-text);
            margin-bottom: 4px;
        }

        .timeline-card .subtitle {
            font-size: 0.9rem;
            color: var(--color-text-secondary);
            margin-bottom: 28px;
        }

        .timeline-wrap {
            position: relative;
            padding: 10px 0 6px;
        }

        .timeline-track {
            position: relative;
            height: 6px;
            background: var(--color-surface);
            border-radius: var(--radius-full);
            margin: 36px 0 52px;
        }

        .timeline-track::before {
            content: "";
            position: absolute;
            top: 0;
            bottom: 0;
            left: 0;
            right: 0;
            background: linear-gradient(90deg, var(--cdc-accent) 0%, rgba(13, 148, 136, 0.25) 100%);
            border-radius: var(--radius-full);
            opacity: 0.55;
        }

        .timeline-marker {
            position: absolute;
            top: 50%;
            transform: translate(-50%, -50%);
        }

        .timeline-dot {
            width: 14px;
            height: 14px;
            background: var(--color-bg);
            border: 3px solid var(--cdc-accent);
            border-radius: 50%;
            box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
        }

        .timeline-marker.start .timeline-dot,
        .timeline-marker.end .timeline-dot {
            width: 18px;
            height: 18px;
            background: var(--cdc-accent);
            border-color: var(--cdc-accent);
        }

        .timeline-marker.end .timeline-dot {
            background: var(--color-text);
            border-color: var(--color-text);
        }

        .timeline-label-top {
            position: absolute;
            left: 50%;
            transform: translateX(-50%);
            bottom: calc(100% + 12px);
            font-family: var(--font-body);
            font-size: 0.7rem;
            font-weight: 700;
            color: var(--color-text-tertiary);
            text-transform: uppercase;
            letter-spacing: 0.06em;
            white-space: nowrap;
        }

        .timeline-label-bottom {
            position: absolute;
            left: 50%;
            transform: translateX(-50%);
            top: calc(100% + 10px);
            text-align: center;
            white-space: nowrap;
        }

        .timeline-weight {
            font-family: var(--font-display);
            font-size: 1rem;
            font-weight: 800;
            color: var(--color-text);
            letter-spacing: -0.01em;
            line-height: 1;
        }

        .timeline-date {
            font-family: var(--font-body);
            font-size: 0.72rem;
            color: var(--color-text-secondary);
            font-weight: 500;
            margin-top: 4px;
        }

        .timeline-today-badge {
            background: var(--color-text);
            color: var(--color-bg);
            padding: 2px 8px;
            border-radius: var(--radius-full);
            font-family: var(--font-body);
            font-size: 0.6rem;
            font-weight: 800;
            letter-spacing: 0.08em;
            text-transform: uppercase;
        }

        .timeline-goal-badge {
            background: var(--cdc-accent);
            color: #fff;
            padding: 2px 8px;
            border-radius: var(--radius-full);
            font-family: var(--font-body);
            font-size: 0.6rem;
            font-weight: 800;
            letter-spacing: 0.08em;
            text-transform: uppercase;
        }

        /* =====================================================
           TIPS STRIP
           ===================================================== */

        .tips-card {
            background: var(--color-surface);
            border: 1px solid var(--color-border);
            border-radius: var(--radius-lg);
            padding: 32px 36px;
            margin-bottom: 20px;
        }

        .tips-card h3 {
            font-family: var(--font-display);
            font-size: 1.2rem;
            font-weight: 800;
            letter-spacing: -0.02em;
            color: var(--color-text);
            margin-bottom: 4px;
        }

        .tips-card > p {
            font-size: 0.88rem;
            color: var(--color-text-secondary);
            margin-bottom: 22px;
        }

        .tips-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 14px;
        }

        .tip-item {
            display: flex;
            align-items: flex-start;
            gap: 12px;
            padding: 14px 16px;
            background: var(--color-bg);
            border: 1px solid var(--color-border);
            border-radius: var(--radius-md);
        }

        .tip-number {
            flex-shrink: 0;
            width: 24px;
            height: 24px;
            background: var(--color-text);
            color: var(--color-bg);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-family: var(--font-display);
            font-size: 0.78rem;
            font-weight: 800;
        }

        .tip-body {
            font-size: 0.88rem;
            color: var(--color-text);
            font-weight: 500;
            line-height: 1.5;
        }

        /* =====================================================
           METHOD CARD
           ===================================================== */

        .tool-formula {
            max-width: 720px;
            margin: 0 auto 48px;
            padding: 32px 36px;
            background: var(--color-surface);
            border: 1px solid var(--color-border);
            border-radius: var(--radius-lg);
        }

        .tool-formula h2 {
            font-family: var(--font-display);
            font-size: 1.4rem;
            font-weight: 800;
            letter-spacing: -0.02em;
            color: var(--color-text);
            margin-bottom: 16px;
            text-align: center;
        }

        .tool-formula-block {
            background: var(--color-bg);
            border: 1px solid var(--color-border);
            border-radius: var(--radius-md);
            padding: 16px 22px;
            margin-bottom: 12px;
            font-family: var(--font-display);
            font-weight: 700;
            color: var(--color-text);
            font-size: 0.95rem;
            letter-spacing: -0.01em;
            text-align: center;
        }

        .tool-formula-block .eq-label {
            display: block;
            font-family: var(--font-body);
            font-size: 0.7rem;
            font-weight: 600;
            color: var(--color-text-tertiary);
            text-transform: uppercase;
            letter-spacing: 0.08em;
            margin-bottom: 6px;
        }

        .tool-formula p {
            font-size: 0.9rem;
            color: var(--color-text-secondary);
            line-height: 1.7;
            margin-top: 18px;
        }

        /* =====================================================
           OTHER TOOLS + CTA
           ===================================================== */

        .tool-other {
            max-width: 620px;
            margin: 0 auto 24px;
            text-align: center;
        }

        .tool-other h3 {
            font-family: var(--font-display);
            font-weight: 700;
            font-size: 1.05rem;
            margin-bottom: 14px;
            color: var(--color-text);
        }

        .tool-other-links {
            display: flex;
            gap: 10px;
            justify-content: center;
            flex-wrap: wrap;
        }

        .tool-other-links a {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            padding: 10px 18px;
            background: var(--color-surface);
            border: 1px solid var(--color-border);
            border-radius: 999px;
            font-size: 0.85rem;
            font-weight: 600;
            color: var(--color-text);
            text-decoration: none;
            transition: background 0.2s ease, transform 0.2s ease;
        }

        .tool-other-links a:hover {
            background: #ececec;
            transform: translateY(-1px);
        }

        .tool-cta-section {
            max-width: 620px;
            margin: 0 auto 48px;
            text-align: center;
            padding: 48px 40px;
            background: var(--color-surface);
            border-radius: var(--radius-lg);
            border: 1px solid var(--color-border);
        }

        .tool-cta-icon {
            width: 56px;
            height: 56px;
            margin: 0 auto 20px;
            border-radius: var(--radius-sm);
            background: var(--color-text);
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .tool-cta-icon svg {
            width: 26px;
            height: 26px;
            color: #fff;
        }

        .tool-cta-section h2 {
            font-family: var(--font-display);
            font-size: 1.7rem;
            font-weight: 800;
            letter-spacing: -0.025em;
            color: var(--color-text);
            margin-bottom: 12px;
        }

        .tool-cta-section p {
            font-size: 1rem;
            color: var(--color-text-secondary);
            line-height: 1.7;
            max-width: 460px;
            margin: 0 auto 24px;
        }

        .tool-cta-list {
            list-style: none;
            display: inline-flex;
            flex-direction: column;
            gap: 6px;
            text-align: left;
            margin-bottom: 28px;
        }

        .tool-cta-list li {
            font-size: 0.92rem;
            color: var(--color-text-secondary);
            padding-left: 24px;
            position: relative;
        }

        .tool-cta-list li::before {
            content: "✓";
            position: absolute;
            left: 0;
            font-weight: 700;
            color: var(--color-text);
        }

        /* =====================================================
           RESPONSIVE
           ===================================================== */

        @media (max-width: 640px) {
            .tool-main {
                padding: 56px 0 80px;
            }

            .tool-header {
                margin-bottom: 28px;
            }

            .tool-header h1 {
                font-size: 1.95rem;
            }

            .tool-header p {
                font-size: 0.95rem;
            }

            .tool-calc-card {
                padding: 22px 18px;
            }

            .tool-input-row {
                grid-template-columns: 1fr;
                gap: 12px;
            }

            .result-number {
                font-size: 3.6rem;
            }

            .tool-result-hero {
                padding: 28px 22px;
            }

            .timeline-card,
            .tool-formula,
            .tips-card {
                padding: 24px 20px;
            }

            .result-stats {
                grid-template-columns: 1fr;
                gap: 8px;
            }

            .result-stat {
                display: flex;
                justify-content: space-between;
                align-items: center;
                padding: 10px 14px;
                background: var(--color-surface);
                border-radius: var(--radius-sm);
                text-align: left;
            }

            .result-stat-label {
                margin-bottom: 0;
            }

            .result-stat-value {
                font-size: 1.1rem;
            }

            .result-stat-sub {
                margin-top: 0;
                margin-left: 8px;
            }

            .timeline-track {
                margin: 44px 0 62px;
            }

            .timeline-label-top { font-size: 0.65rem; }
            .timeline-weight { font-size: 0.88rem; }
            .timeline-date { font-size: 0.66rem; }

            .rate-grid { grid-template-columns: 1fr 1fr; gap: 8px; }

            .tips-grid {
                grid-template-columns: 1fr;
            }

            .tool-cta-section {
                padding: 32px 22px;
            }

            .tool-cta-section h2 {
                font-size: 1.35rem;
            }
        }
    