:root {
    --navy: #101D4D; --navy-light: #1A2B6D; --steel: #7391C9; --steel-dim: #EAF3FF;
    --text-main: #101D4D; --text-sub: #586B8F; --border: #E2E8F0; --white: #ffffff;
    --success: #10B981; --error: #E53E3E; --bg: #F8FAFC;
}

* { box-sizing: border-box; -webkit-font-smoothing: antialiased; outline: none; }
body { margin: 0; font-family: 'Instrument Sans', sans-serif; color: var(--text-main); background: var(--bg); overflow-x: hidden; }

/* HERO SECTION */
.hero-section {
    background-color: var(--navy); color: white; padding: 120px 20px 60px;
    text-align: center; position: relative;
}
.hero-h1 { font-size: 32px; font-weight: 700; margin: 0 0 12px 0; letter-spacing: -0.5px; }
.hero-sub { color: #A0AEC0; font-size: 16px; max-width: 600px; margin: 0 auto; line-height: 1.5; }

/* WORKSPACE LAYOUT */
.workspace {
    display: flex; max-width: 1600px; width: 100%; margin: -40px auto 0;
    position: relative; box-shadow: 0 20px 40px rgba(0,0,0,0.08);
    background: white; border-radius: 8px; overflow: visible !important; min-height: 800px;
    height: auto !important;
}

/* --- SIDEBAR CONTROLS --- */
.controls { height: auto !important; width: 440px; background: var(--white); border-right: 1px solid var(--border); display: flex; flex-direction: column; z-index: 20; position: relative; }

.controls-header { padding: 32px 32px 0; }
.progress-track { height: 4px; background: #F1F5F9; border-radius: 2px; margin-top: 16px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--navy); width: 25%; transition: width 0.4s ease; }

/* MATT BANNER — hidden until first question answered */
.matt-banner {
    display: flex; align-items: flex-start;
    gap: 12px; padding: 14px 16px; margin: 16px 24px 0;
    background: linear-gradient(135deg, #f0f4ff 0%, #eef2ff 100%);
    border: 1px solid #c7d2fe; border-radius: 10px;
    text-decoration: none; color: var(--navy);
    transition: opacity 0.45s ease, transform 0.45s ease, border-color 0.2s, box-shadow 0.2s;
    cursor: pointer;
    opacity: 0; max-height: 0; overflow: hidden; margin-top: 0; padding: 0 16px;
    pointer-events: none;
}
.matt-banner.visible {
    opacity: 1; max-height: 200px; overflow: visible; margin-top: 16px; padding: 14px 16px;
    pointer-events: auto;
    animation: mattSlideIn 0.5s ease forwards;
}
@keyframes mattSlideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}
.matt-banner:hover {
    border-color: #818cf8;
    box-shadow: 0 3px 12px rgba(16, 29, 77, 0.1);
}
.matt-banner-photo {
    flex-shrink: 0; width: 40px; height: 40px;
    border-radius: 50%; object-fit: cover;
    border: 2px solid white;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
    margin-top: 2px;
}
.matt-banner-text { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.matt-banner-headline { font-size: 12.5px; font-weight: 700; color: var(--navy); line-height: 1.35; }
.matt-banner-sub { font-size: 11px; color: var(--text-sub); line-height: 1.4; }
.matt-banner-cta {
    display: inline-flex; align-items: center; align-self: flex-start;
    background: var(--navy); color: white;
    font-size: 11.5px; font-weight: 700;
    padding: 7px 14px; border-radius: 6px;
    white-space: nowrap;
    transition: background 0.2s;
}
.matt-banner:hover .matt-banner-cta { background: var(--navy-light); }
.matt-guarantee {
    display: flex; align-items: center; gap: 4px;
    margin-top: 7px; font-size: 10px; font-weight: 700;
    color: var(--success); text-transform: uppercase; letter-spacing: 0.4px;
}

.controls-scroll { padding: 32px; display: flex; flex-direction: column; overflow: visible !important; flex: none !important; height: auto !important;}

/* WIZARD STEPS */
.wizard-step { display: none; animation: fadeIn 0.4s ease; }
.wizard-step.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.step-header { font-size: 24px; font-weight: 700; color: var(--navy); margin: 0 0 8px 0; }
.step-sub { color: var(--text-sub); font-size: 14px; margin: 0 0 24px 0; line-height: 1.5; }

/* OPTION CARDS */
.options { display: grid; gap: 10px; }
.option {
    border: 1px solid var(--border); padding: 16px; cursor: pointer; transition: all 0.15s ease-out; background: white; border-radius: 6px;
}
.option:hover { border-color: var(--steel); background: #F8FAFC; transform: translateY(-1px); }
.option.selected { background: var(--navy); border-color: var(--navy); color: white; box-shadow: 0 4px 12px rgba(16, 29, 77, 0.15); }
.option-label { font-size: 15px; font-weight: 600; margin-bottom: 4px; line-height: 1.3; }
.option-desc { font-size: 13px; color: var(--text-sub); line-height: 1.4; }
.option.selected .option-desc { color: rgba(255, 255, 255, 0.75); }

/* STEP 1 + 2 + 3 ENHANCED OPTIONS */
#step1 .option, #step2 .option, #step3 .option {
    display: flex; align-items: center; gap: 12px;
}
#step1 .option:hover, #step2 .option:hover, #step3 .option:hover {
    border-color: #3b82f6;
    box-shadow: 0 2px 10px rgba(59, 130, 246, 0.12);
    transform: translateY(-2px);
}
.option-icon {
    flex-shrink: 0; width: 38px; height: 38px;
    background: var(--steel-dim); border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: var(--navy); transition: background 0.15s, color 0.15s;
}
.option.selected .option-icon { background: rgba(255,255,255,0.18); color: white; }
.option-text { flex: 1; }
.option-text .option-desc { margin-bottom: 0; }
.option-arrow {
    flex-shrink: 0; font-size: 16px; color: var(--steel);
    transition: transform 0.15s ease, color 0.15s;
}
#step1 .option:hover .option-arrow, #step2 .option:hover .option-arrow, #step3 .option:hover .option-arrow { transform: translateX(3px); color: #3b82f6; }
.option.selected .option-arrow { color: rgba(255,255,255,0.7); }

/* START DIVIDER */
.start-divider {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 14px;
    color: var(--text-sub);
    font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.08em;
}
.start-divider::before, .start-divider::after {
    content: ''; flex: 1;
    border-top: 1.5px dashed var(--border);
}


/* 3D LABEL STYLING */
.aisle-badge {
    position: absolute;
    background: #0f172a;
    color: white;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 10px;
    padding: 4px 8px;
    border-radius: 4px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    pointer-events: none;
    transform: translate(-50%, -50%);
    transition: opacity 0.2s;
    border: 1px solid rgba(255,255,255,0.1);
}
.aisle-badge::after {
    content: ''; position: absolute; top: 100%; left: 50%; margin-left: -4px;
    border-width: 4px; border-style: solid; border-color: #0f172a transparent transparent transparent;
}

/* ADVANCED SECTION */
.advanced-section { margin-top: auto; padding-top: 24px; }
.advanced-toggle {
    display: flex; align-items: center; justify-content: space-between;
    cursor: pointer; font-size: 13px; font-weight: 600; color: var(--navy);
    padding: 8px 0; user-select: none; -webkit-tap-highlight-color: transparent;
}
.advanced-toggle:active { opacity: 0.7; }
.advanced-toggle svg { width: 16px; height: 16px; transition: transform 0.3s; color: var(--steel); }
.advanced-toggle.open svg { transform: rotate(180deg); }

.advanced-content { max-height: 0; overflow: hidden; transition: max-height 0.3s ease; }
.advanced-content.open { max-height: 600px; padding-top: 16px; }

.slider-wrap { margin-bottom: 20px; }
.slider-header { display: flex; justify-content: space-between; margin-bottom: 8px; }
.slider-label { font-size: 12px; font-weight: 600; color: var(--text-sub); }
.slider-val { font-family: 'JetBrains Mono'; font-size: 12px; font-weight: 600; color: var(--navy); }
input[type=range] {
    width: 100%;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    transition: background 0.2s ease;
}
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; height: 16px; width: 16px; background: var(--navy); border-radius: 50%; cursor: grab; border: 2px solid white; box-shadow: 0 1px 3px rgba(0,0,0,0.3); transition: transform 0.15s ease, box-shadow 0.15s ease; }
input[type=range]::-webkit-slider-thumb:hover { transform: scale(1.1); box-shadow: 0 2px 6px rgba(0,0,0,0.4); }
input[type=range]::-webkit-slider-thumb:active { cursor: grabbing; transform: scale(1.05); }
input[type=range]::-moz-range-thumb { height: 16px; width: 16px; background: var(--navy); border-radius: 50%; cursor: grab; border: 2px solid white; box-shadow: 0 1px 3px rgba(0,0,0,0.3); transition: transform 0.15s ease, box-shadow 0.15s ease; }
input[type=range]::-moz-range-thumb:hover { transform: scale(1.1); box-shadow: 0 2px 6px rgba(0,0,0,0.4); }
input[type=range]::-moz-range-thumb:active { cursor: grabbing; transform: scale(1.05); }
input[type=range]::-moz-range-track { height: 4px; background: var(--border); border-radius: 2px; }

/* FORMS & INPUTS */
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--navy); margin-bottom: 8px; }
.form-input { width: 100%; padding: 14px; border: 1px solid var(--border); margin-bottom: 16px; border-radius: 6px; font-family: 'Instrument Sans'; font-size: 16px; }
.form-input:focus { border-color: var(--navy); box-shadow: 0 0 0 2px rgba(16, 29, 77, 0.1); }
.form-msg { margin: 12px 0 0; min-height: 18px; font-size: 13px; color: var(--text-sub); }
.form-msg.error { color: var(--error); }
.form-msg.success { color: var(--success); }

/* (step4-callout removed — replaced by step4-actions bar) */

.code-grid { display: flex; gap: 8px; justify-content: center; margin: 24px 0; }
.code-input {
    width: 48px; height: 56px; border: 1px solid var(--border); border-radius: 6px;
    text-align: center; font-size: 22px; font-family: 'JetBrains Mono', monospace; font-weight: 600;
    color: var(--navy);
}
.code-input:focus { border-color: var(--navy); box-shadow: 0 0 0 2px rgba(16, 29, 77, 0.1); }

/* BUTTONS */
.btn-primary {
    width: 100%; padding: 16px; background: var(--navy); color: white; border: none;
    font-weight: 600; font-size: 15px; cursor: pointer; border-radius: 6px;
    display: flex; align-items: center; justify-content: center; gap: 8px; transition: 0.2s;
}
.btn-primary:hover { background: var(--navy-light); }
.btn-primary:disabled { opacity: 0.7; cursor: not-allowed; }

.btn-back {
    background: none; border: none; color: var(--text-sub); font-size: 13px; font-weight: 500;
    cursor: pointer; padding: 16px 0; width: 100%; text-align: center; transition: 0.2s;
}
.btn-back:hover { color: var(--navy); }

/* 3D CONTAINER */
.viz-container { flex: 1; background: #F1F5F9; display: flex; flex-direction: column; position: relative; overflow: hidden; border-radius: 0 8px 8px 0; }
#canvas3d { width: 100%; height: 100%; display: block; }

.viz-toolbar {
    position: absolute; bottom: 32px; right: 32px;
    display: flex; flex-direction: column; gap: 8px; z-index: 10;
}
.btn-zoom {
    width: 36px; height: 36px; background: white; border: 1px solid var(--border);
    border-radius: 6px; font-size: 18px; font-weight: 600; color: var(--navy); cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05); display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
}
.btn-zoom:hover { background: #F8FAFC; border-color: var(--steel); }

/* RESULTS OVERLAY */
.results-overlay {
    position: absolute; top: 24px; right: 24px; background: rgba(255,255,255,0.95); padding: 24px; border-radius: 8px;
    border: 1px solid var(--border); box-shadow: 0 8px 32px rgba(16, 29, 77, 0.1); min-width: 260px; backdrop-filter: blur(4px);
    z-index: 100;
}

/* UPSELL CARD (Mode B) */
.upsell-card {
    background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
    border: 1px solid var(--steel);
    padding: 24px;
    margin-top: 24px;
    position: relative;
    overflow: hidden;
}
.upsell-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, transparent 50%, rgba(115, 145, 201, 0.1) 50%);
    pointer-events: none;
}
.upsell-badge {
    display: inline-block;
    background: var(--navy);
    color: white;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 10px;
    border-radius: 20px;
    margin-bottom: 12px;
}
.upsell-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--navy);
    margin: 0 0 8px 0;
    line-height: 1.3;
}
.upsell-desc {
    font-size: 14px;
    color: var(--text-sub);
    line-height: 1.5;
    margin: 0 0 16px 0;
}
.upsell-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--navy);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.upsell-cta:hover {
    background: var(--navy-light);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 29, 77, 0.2);
}

/* EMAIL MODAL */
.email-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(16, 29, 77, 0.6);
    backdrop-filter: blur(4px);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}
.email-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}
.email-modal {
    background: white;
    border-radius: 12px;
    padding: 32px;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}
.email-modal-overlay.active .email-modal {
    transform: translateY(0);
}
.email-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-sub);
    cursor: pointer;
    line-height: 1;
}
.email-modal-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--navy);
    margin: 0 0 8px 0;
}
.email-modal-sub {
    font-size: 14px;
    color: var(--text-sub);
    margin: 0 0 24px 0;
}
.exit-intent-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(16, 29, 77, 0.62);
    backdrop-filter: blur(2px);
    z-index: 3200;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.exit-intent-modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}
.exit-intent-modal {
    position: relative;
    width: min(92vw, 460px);
    background: #fff;
    border-radius: 10px;
    padding: 24px;
    box-shadow: 0 25px 45px rgba(0, 0, 0, 0.2);
}
.exit-intent-modal h3 {
    margin: 0 0 8px;
    font-size: 22px;
    color: var(--navy);
}
.exit-intent-modal p {
    margin: 0 0 18px;
    font-size: 14px;
    color: var(--text-sub);
}
.exit-intent-close {
    position: absolute;
    top: 10px;
    right: 12px;
    border: none;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    font-size: 28px;
    line-height: 1;
}
.exit-intent-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.exit-intent-call {
    display: inline-flex;
    justify-content: center;
    padding: 12px;
    border-radius: 6px;
    background: var(--navy);
    color: #fff;
    text-decoration: none;
    font-weight: 700;
}
.exit-intent-hours {
    font-size: 12px;
    color: var(--text-sub);
    text-align: center;
}
.exit-intent-secondary {
    border: 1px solid var(--border);
    background: #fff;
    color: var(--navy);
    font-size: 14px;
    font-weight: 600;
    border-radius: 6px;
    padding: 10px;
    cursor: pointer;
}
.result-label { font-size: 11px; font-weight: 600; color: var(--text-sub); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.result-value { font-size: 26px; font-weight: 700; color: var(--navy); font-family: 'JetBrains Mono'; }

/* ENGINEERING CONSOLE (loading phase) */
.eng-console {
    font-family: 'Instrument Sans', sans-serif; font-size: 13px;
    margin-top: 20px;
    /* Center the block itself, left-align text inside */
    display: table; margin-left: auto; margin-right: auto;
    text-align: left;
}
.eng-line {
    margin-bottom: 7px; color: var(--text-sub);
    font-weight: 500; line-height: 1.5;
    /* Delay matches JS setTimeout intervals — fade completes before next fires */
    transition: opacity 0.35s ease;
}
.eng-line:last-child { margin-bottom: 0; }


/* NO-SPAM MICROCOPY */
.no-spam-line {
    display: flex; align-items: center; gap: 5px;
    font-size: 10.5px; color: #64748b;
    margin-top: -4px; margin-bottom: 10px;
}

/* STAGED REVEAL */
.reveal-phase { animation: fadeIn 0.4s ease; }

.estimating-container { text-align: center; padding: 40px 0 28px; }
.estimating-spinner-ring {
    width: 48px; height: 48px;
    border: 3px solid var(--border);
    border-top-color: var(--navy);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 24px;
}

/* Phase results smooth reveal */
#phaseResults.phase-enter {
    animation: phaseReveal 0.5s ease both;
}
@keyframes phaseReveal {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* STEP 4 UNIFIED CARD */
.step4-card {
    background: #F8FAFC; border: 1px solid var(--border);
    border-radius: 10px; overflow: visible; margin-top: 16px;
}
.preview-results { padding: 16px 20px; border-radius: 10px 10px 0 0; }
.preview-row { display: flex; justify-content: space-between; margin-bottom: 8px; }
.preview-label { font-size: 13px; color: var(--text-sub); }
.preview-value { font-size: 14px; font-weight: 700; color: var(--navy); font-family: 'JetBrains Mono', monospace; }
.preview-value.blurred {
    filter: blur(4px);
    opacity: 0.45;
    user-select: none;
    pointer-events: none;
    transition: none !important;
}
.preview-divider { height: 1px; background: var(--border); margin: 4px 0 12px; }
.preview-costs { display: flex; justify-content: space-between; }
.preview-value-lg { font-size: 16px; }

/* Form section inside the card */
.step4-form-section {
    padding: 16px 20px 20px;
    border-top: 1px solid var(--border);
    background: white;
    border-radius: 0 0 10px 10px;
}

/* FLAT FORM (replaces conversational reveal) */
.flat-form { display: flex; flex-direction: column; gap: 10px; }
.flat-form .form-input { margin-bottom: 0; padding: 13px 14px; }
.flat-form .btn-primary { margin-top: 4px; }
.flat-form-trust {
    display: flex; align-items: center; justify-content: center; gap: 5px;
    font-size: 11px; color: #64748b; font-weight: 500;
    margin-top: 10px;
}
.flat-form-trust svg { color: var(--success); flex-shrink: 0; }

/* GOOGLE AUTH SECTION */
.google-auth-section { margin-bottom: 4px; }
.google-auth-section #googleBtnContainer {
    width: 100%;
    min-height: 44px;
    border-radius: 6px;
    overflow: hidden;
}
/* Stretch Google's rendered button to fill the container */
.google-auth-section #googleBtnContainer > div { width: 100% !important; }

.google-loading {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 14px; border: 1px solid var(--border); border-radius: 6px;
    background: #f8fafc; font-size: 14px; font-weight: 500; color: var(--text-sub);
}
.google-loading-spinner { border-color: var(--border); border-top-color: var(--navy); }

.or-divider {
    display: flex; align-items: center; gap: 10px;
    margin: 14px 0 2px;
    font-size: 11.5px; font-weight: 500; color: #94a3b8;
}
.or-divider::before, .or-divider::after {
    content: ''; flex: 1; height: 1px; background: var(--border);
}

/* CONVERSATIONAL FORM */
.conv-form { display: flex; flex-direction: column; }
.conv-question {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transform: translateY(6px);
    /* All three transitions share the same easing so they feel unified */
    transition: max-height 0.4s cubic-bezier(0.22,1,0.36,1),
                opacity 0.3s cubic-bezier(0.22,1,0.36,1),
                transform 0.3s cubic-bezier(0.22,1,0.36,1);
    pointer-events: none;
}
.conv-question.visible {
    max-height: 180px; /* Generous — accommodates label + input + helper text */
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
/* Submit button slot: no helper text, just button */
.conv-question.visible.is-submit { max-height: 72px; }
/* Answered row: collapses to single-line height */
.conv-question.answered {
    max-height: 44px;
    opacity: 0.45;
    transform: translateY(0);
    pointer-events: none;
}
.conv-label {
    display: block;
    font-size: 11px; font-weight: 700; color: var(--text-sub);
    text-transform: uppercase; letter-spacing: 0.5px;
    margin: 10px 0 6px;
}
.conv-label .optional { font-weight: 500; text-transform: none; letter-spacing: 0; color: #b0bec5; }
.conv-answered-row {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 10px; background: #F8FAFC;
    border: 1px solid var(--border); border-radius: 6px;
    margin-bottom: 4px;
    font-size: 13px; font-weight: 600; color: var(--navy);
}
.conv-answered-row svg { color: var(--success); flex-shrink: 0; width: 13px; height: 13px; }
.step4-form-label {
    font-size: 13px; font-weight: 600; color: var(--navy);
    margin: 0 0 14px; line-height: 1.4;
}
.step4-form-section .form-input { margin-bottom: 10px; padding: 12px 14px; }
.step4-form-section .btn-primary { margin-top: 4px; }
.step4-form-section .form-msg { margin: 8px 0 0; }

/* Footer: edit link + legal */
.step4-footer {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 14px; padding-bottom: 24px;
}
.step4-edit-link {
    background: none; border: none; color: var(--text-sub);
    font-size: 12.5px; font-weight: 500; cursor: pointer;
    padding: 0; transition: color 0.2s;
}
.step4-edit-link:hover { color: var(--navy); }

/* 3D VIZ LOCK OVERLAY */
.viz-lock-overlay {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    z-index: 50; pointer-events: none;
    transition: opacity 0.5s ease;
}
.viz-lock-overlay.hidden { opacity: 0; }
.viz-lock-pill {
    display: flex; flex-direction: column; gap: 5px;
    background: rgba(16, 29, 77, 0.82);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(115, 145, 201, 0.22);
    color: white;
    padding: 14px 20px; border-radius: 10px;
    text-align: left; width: 220px;
    box-shadow: 0 12px 40px rgba(16, 29, 77, 0.45);
}
.viz-lock-eyebrow {
    font-size: 10px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.1em;
    color: var(--steel);
}
.viz-lock-headline {
    font-size: 14px; font-weight: 700;
    line-height: 1.45; color: rgba(255, 255, 255, 0.95);
}

/* STEP 4 MICROCOPY */
.step4-legal { font-size: 11px; color: #94a3b8; }
.step4-legal a { color: #94a3b8; text-decoration: none; }
.step4-legal a:hover { text-decoration: underline; }

.spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.3); border-radius: 50%; border-top-color: #fff; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* MOBILE ELEMENTS */
.mobile-3d-btn { display: none; }
.mobile-close-btn { display: none; }

/* SEO CONTENT */
.seo-content { max-width: 860px; margin: 72px auto 96px; padding: 0 24px; }
.seo-eyebrow { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--steel); margin-bottom: 10px; }
.seo-content h2 { font-size: 26px; font-weight: 700; color: var(--navy); margin: 0 0 12px; line-height: 1.3; }
.seo-content p { font-size: 15px; color: var(--text-sub); line-height: 1.7; margin: 0 0 18px; }
.seo-section { margin-top: 56px; padding-top: 56px; border-top: 1px solid var(--border); }

/* Variable cards */
.seo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 24px; }
.seo-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 24px; }
.seo-card { background: #fff; border: 1px solid var(--border); border-left: 3px solid var(--steel); border-radius: 6px; padding: 20px; box-shadow: 0 1px 4px rgba(16,29,77,0.05); }
.seo-card-label { font-size: 10px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--steel); margin-bottom: 8px; }
.seo-card-title { font-size: 15px; font-weight: 700; color: var(--navy); margin-bottom: 8px; }
.seo-card p { font-size: 13.5px; color: var(--text-sub); margin: 0; line-height: 1.55; }

/* Formula */
.formula-box { background: var(--navy); border-radius: 8px; padding: 28px 32px; margin: 24px 0; }
.formula-main { font-size: 16px; font-weight: 700; color: #fff; line-height: 1.65; padding-bottom: 20px; margin-bottom: 20px; border-bottom: 1px solid rgba(255,255,255,0.1); letter-spacing: -0.01em; }
.formula-vars { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; align-items: baseline; }
.formula-var-name { font-size: 13px; font-weight: 700; color: var(--steel); white-space: nowrap; padding: 2px 0; }
.formula-var-desc { font-size: 13px; color: #94a3b8; line-height: 1.5; padding: 2px 0; }

/* Steps */
.step-list { counter-reset: steps; list-style: none; padding: 0; margin: 24px 0 0; }
.step-list li { counter-increment: steps; display: flex; gap: 18px; padding: 20px 0; border-bottom: 1px solid var(--border); }
.step-list li:first-child { padding-top: 0; }
.step-list li:last-child { border-bottom: none; padding-bottom: 0; }
.step-list li::before { content: counter(steps); display: flex; align-items: center; justify-content: center; min-width: 32px; height: 32px; background: var(--navy); color: #fff; border-radius: 6px; font-size: 13px; font-weight: 700; flex-shrink: 0; margin-top: 2px; }
.step-list-body h4 { font-size: 15px; font-weight: 700; color: var(--navy); margin: 3px 0 6px; }
.step-list-body p { font-size: 14px; color: var(--text-sub); line-height: 1.65; margin: 0; }

/* Benchmarks */
.benchmark-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 24px; }
.benchmark-item { background: var(--navy); border-radius: 8px; padding: 20px 16px; text-align: center; }
.benchmark-num { font-family: 'JetBrains Mono', monospace; font-size: 22px; font-weight: 700; color: #fff; display: block; margin-bottom: 8px; line-height: 1.2; }
.benchmark-desc { font-size: 12px; color: var(--steel); line-height: 1.45; }

/* Aisle table */
.aisle-table { width: 100%; border-collapse: collapse; margin-top: 20px; font-size: 14px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.aisle-table th { background: var(--navy); color: rgba(255,255,255,0.75); font-weight: 600; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; text-align: left; padding: 11px 16px; }
.aisle-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); color: var(--text-sub); }
.aisle-table td:first-child { color: var(--navy); font-weight: 600; }
.aisle-table tr:last-child td { border-bottom: none; }
.aisle-table tbody tr:hover td { background: #F8FAFC; }
.aisle-badge-tag { display: inline-block; padding: 2px 9px; border-radius: 4px; font-size: 11px; font-weight: 600; letter-spacing: 0.02em; }
.aisle-badge-tag.low { background: var(--steel-dim); color: var(--navy); }
.aisle-badge-tag.med { background: var(--navy); color: #fff; }
.aisle-badge-tag.high { background: var(--steel); color: #fff; }

/* Constraints grid */
.seo-constraints-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 24px; }
.seo-constraints-card { background: #fff; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seo-constraints-header { background: #F8FAFC; border-bottom: 1px solid var(--border); padding: 13px 20px; }
.seo-constraints-header h3 { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--navy); margin: 0; }
.seo-constraint-item { padding: 14px 20px; border-bottom: 1px solid var(--border); font-size: 14px; color: var(--text-sub); line-height: 1.55; }
.seo-constraint-item:last-child { border-bottom: none; }
.seo-constraint-item strong { display: block; font-size: 13px; font-weight: 700; color: var(--navy); margin-bottom: 3px; }

/* FAQ */
.faq-list { margin-top: 24px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.faq-item { border-bottom: 1px solid var(--border); }
.faq-item:last-child { border-bottom: none; }
.faq-q { width: 100%; text-align: left; padding: 18px 20px; background: none; border: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 16px; font-size: 15px; font-weight: 600; color: var(--navy); font-family: inherit; transition: background 0.15s; }
.faq-q:hover { background: #F8FAFC; }
.faq-q svg { min-width: 18px; color: var(--steel); flex-shrink: 0; transition: transform 0.25s; }
.faq-item.open .faq-q { background: #F8FAFC; }
.faq-item.open .faq-q svg { transform: rotate(180deg); }
.faq-a { display: none; padding: 4px 20px 18px; border-top: 1px solid var(--border); }
.faq-a p { font-size: 14px; color: var(--text-sub); line-height: 1.7; margin: 14px 0 0; }
.faq-a p:last-child { margin-bottom: 0; }
.faq-a strong { color: var(--navy); }
.faq-item.open .faq-a { display: block; }

/* Bridge band */
.bridge-band {
    display: flex; align-items: center; justify-content: space-between; gap: 32px;
    margin-top: 32px; padding: 24px 28px;
    background: var(--bg); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.bridge-band-inner { flex: 1; }
.bridge-band-label {
    display: block; font-size: 10px; font-weight: 700; letter-spacing: 0.1em;
    text-transform: uppercase; color: var(--steel); margin-bottom: 6px;
}
.bridge-band-copy {
    font-size: 14px; color: var(--text-sub); line-height: 1.6; margin: 0;
}
.bridge-band-link {
    flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px;
    color: var(--navy); font-size: 14px; font-weight: 700;
    text-decoration: none; white-space: nowrap; transition: opacity 0.15s;
}
.bridge-band-link:hover { opacity: 0.7; }
@media (max-width: 640px) {
    .bridge-band { flex-direction: column; align-items: flex-start; gap: 16px; padding: 20px 0; border-left: none; border-right: none; }
}

/* CTA */
.seo-cta-box { background: var(--navy); border-radius: 8px; padding: 40px; margin-top: 56px; display: flex; gap: 28px; align-items: center; }
.seo-cta-box .cta-photo { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; flex-shrink: 0; border: 2px solid rgba(115,145,201,0.4); }
.seo-cta-text h3 { font-size: 20px; font-weight: 700; color: #fff; margin: 0 0 8px; }
.seo-cta-text p { font-size: 14px; color: rgba(255,255,255,0.6); margin: 0; line-height: 1.6; }
.seo-cta-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.seo-cta-btn { display: inline-flex; align-items: center; gap: 7px; padding: 11px 20px; border-radius: 6px; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; font-family: inherit; transition: all 0.2s; }
.seo-cta-btn.primary { background: #fff; color: var(--navy); border: none; }
.seo-cta-btn.primary:hover { background: var(--steel-dim); }
.seo-cta-btn.secondary { background: transparent; color: rgba(255,255,255,0.8); border: 1px solid rgba(115,145,201,0.35); }
.seo-cta-btn.secondary:hover { background: rgba(255,255,255,0.08); border-color: rgba(115,145,201,0.6); }

/* MOBILE OPTIMIZATION */
@media (max-width: 900px) {
    .hero-section { padding: 88px 20px 20px; }
    .workspace { flex-direction: column; margin: -20px 0 0; height: auto; border-radius: 0; box-shadow: none; background: transparent; }

    /* Controls takes full screen initially */
    .controls { width: 100%; border-right: none; height: auto; border-radius: 20px 20px 0 0; box-shadow: 0 -10px 30px rgba(0,0,0,0.05); overflow: visible; }
    .controls-header { padding: 24px 24px 0; }
    .matt-banner { margin: 0 16px; padding: 0 14px; gap: 10px; }
    .matt-banner.visible { margin: 12px 16px 0; padding: 10px 14px; }
    .matt-banner-photo { width: 34px; height: 34px; }
    .matt-banner-sub { display: none; }
    .matt-banner-cta { padding: 6px 12px; }
    .controls-scroll { padding: 24px; overflow-y: visible; }

    /* Mobile slider improvements - larger touch targets */
    .slider-wrap { margin-bottom: 24px; }
    input[type=range] { padding: 10px 0; } /* Invisible padding for easier touch */
    input[type=range]::-webkit-slider-thumb { height: 28px; width: 28px; }
    input[type=range]::-moz-range-thumb { height: 28px; width: 28px; }
    .advanced-toggle { padding: 12px 0; } /* Larger tap area on mobile */

    /* 3D View is Hidden by default, becomes Modal */
    .viz-container {
        position: fixed; inset: 0; z-index: 2000; background: #F1F5F9;
        transform: translateY(100%); transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        border-radius: 0;
    }
    .viz-container.is-open { transform: translateY(0); }

    /* Mobile Buttons */
    .mobile-3d-btn {
        display: flex; align-items: center; justify-content: center; gap: 8px;
        background: white; border: 1px solid var(--border); color: var(--navy);
        padding: 12px; border-radius: 8px; font-weight: 600; font-size: 14px;
        margin-bottom: 24px; width: 100%; cursor: pointer; box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    }

    .mobile-close-btn {
        display: flex; position: absolute; top: 16px; left: 16px; z-index: 2010;
        background: white; border: none; width: 40px; height: 40px; border-radius: 20px;
        align-items: center; justify-content: center; box-shadow: 0 4px 12px rgba(0,0,0,0.1);
        color: var(--navy); font-weight: bold; cursor: pointer;
    }

    .results-overlay {
        top: auto; bottom: 0; left: 0; right: 0; border-radius: 0;
        display: flex; justify-content: space-between; border-top: 1px solid var(--border);
        box-shadow: 0 -4px 20px rgba(0,0,0,0.1); padding: 20px 24px;
    }

    .exit-intent-modal {
        width: min(94vw, 420px);
        padding: 20px;
    }

    .viz-toolbar { bottom: 100px; right: 20px; } /* Move zoom above results bar */
    .viz-lock-pill { width: 200px; padding: 12px 16px; }
    .seo-grid { grid-template-columns: 1fr; }
    .seo-grid-4 { grid-template-columns: 1fr 1fr; }
    .seo-constraints-grid { grid-template-columns: 1fr; }
    .benchmark-row { grid-template-columns: 1fr 1fr; }
    .seo-cta-box { flex-direction: column; gap: 20px; padding: 28px 24px; }
    .seo-cta-box .cta-photo { width: 56px; height: 56px; }
    .aisle-table th, .aisle-table td { padding: 9px 12px; font-size: 13px; }
    .formula-vars { grid-template-columns: 1fr; gap: 4px; }
    .formula-var-name { color: var(--steel); padding-top: 10px; }
    .formula-var-desc { padding-bottom: 4px; }
    .seo-section { margin-top: 40px; padding-top: 40px; }
}
