        :root {
            --sand-50:  #faf4e6;
            --sand-100: #f1e6cd;
            --sand-200: #e1cca0;
            --sand-300: #c9a967;
            --sand-400: #9c7c43;
            --terra-500: #b5683a;
            --terra-600: #8c4a26;
            --ink-900: #1f1a12;
            --ink-700: #3b3326;
            --ink-500: #6d6353;
            --ink-300: #a59a86;
            --line:    rgba(31, 26, 18, 0.10);
            --line-2:  rgba(31, 26, 18, 0.18);
            --glass:   rgba(252, 247, 233, 0.78);
            --glass-strong: rgba(252, 247, 233, 0.92);
            --accent:  #b5683a;
            --accent-ink: #6b3614;
            --shadow-card: 0 30px 60px -28px rgba(53, 32, 7, 0.32), 0 8px 22px -12px rgba(53, 32, 7, 0.18);
            --shadow-pill: 0 16px 32px -18px rgba(53, 32, 7, 0.35), 0 2px 6px rgba(53, 32, 7, 0.10);
        }

        *, *::before, *::after { box-sizing: border-box; }
        html, body { height: 100%; margin: 0; overflow-x: hidden; }
        body {
            font-family: 'IBM Plex Sans Arabic', 'Inter', system-ui, sans-serif;
            color: var(--ink-900);
            background: #e8d6b2;
            overflow: hidden;
            -webkit-font-smoothing: antialiased;
            text-rendering: optimizeLegibility;
        }

        #villa-canvas {
            position: fixed; inset: 0;
            width: 100%; height: 100%;
            display: block;
            touch-action: none;
            cursor: grab;
        }
        #villa-canvas:active { cursor: grabbing; }

        /* Subtle top + bottom vignettes so the chrome floats over the scene. */
        .vignette {
            position: fixed; left: 0; right: 0;
            pointer-events: none;
            z-index: 1;
        }
        .vignette.top {
            top: 0; height: 180px;
            background: linear-gradient(to bottom,
                rgba(31, 26, 18, 0.22),
                rgba(31, 26, 18, 0));
        }
        .vignette.bottom {
            bottom: 0; height: 260px;
            background: linear-gradient(to top,
                rgba(31, 26, 18, 0.32),
                rgba(31, 26, 18, 0));
        }

        /* ── Top brand bar ──────────────────────────────────────── */
        .topbar {
            position: fixed; top: 0; left: 0; right: 0;
            z-index: 10;
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 22px 28px;
            pointer-events: none;
        }
        .brand {
            display: flex; align-items: center; gap: 14px;
            pointer-events: auto;
        }
        .brand-mark {
            width: 40px; height: 40px;
            border-radius: 12px;
            background: linear-gradient(140deg, #b5683a, #8c4a26 70%);
            position: relative;
            box-shadow: var(--shadow-pill);
        }
        .brand-mark::before, .brand-mark::after {
            content: ''; position: absolute; background: var(--sand-50);
        }
        .brand-mark::before { /* roof triangle */
            left: 6px; right: 6px; top: 9px; height: 12px;
            clip-path: polygon(50% 0, 100% 100%, 0 100%);
        }
        .brand-mark::after { /* base block */
            left: 8px; right: 8px; bottom: 9px; height: 16px;
            border-radius: 1px 1px 0 0;
        }
        .brand-text {
            line-height: 1.15;
            color: var(--sand-50);
            text-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
        }
        .brand-title {
            font-weight: 700;
            font-size: 17px;
            letter-spacing: -0.005em;
        }
        .brand-sub {
            font-size: 12.5px;
            opacity: 0.85;
            font-weight: 400;
            margin-top: 2px;
            font-family: 'Inter', sans-serif;
            font-feature-settings: "tnum" 1;
            direction: ltr;
        }

        .top-actions {
            display: flex; gap: 8px;
            pointer-events: auto;
        }
        .top-pill {
            display: inline-flex; align-items: center; gap: 8px;
            padding: 8px 14px;
            background: var(--glass);
            backdrop-filter: blur(14px) saturate(140%);
            -webkit-backdrop-filter: blur(14px) saturate(140%);
            border: 1px solid var(--line-2);
            border-radius: 999px;
            color: var(--ink-700);
            font-size: 13px;
            font-weight: 500;
            box-shadow: var(--shadow-pill);
            cursor: pointer;
            transition: transform .15s ease, background .15s ease;
        }
        .top-pill:hover { background: var(--glass-strong); transform: translateY(-1px); }
        .top-pill svg { width: 14px; height: 14px; }
        .kbd {
            font-family: 'Inter', sans-serif;
            font-size: 11px;
            background: rgba(31, 26, 18, 0.08);
            border: 1px solid rgba(31, 26, 18, 0.12);
            border-radius: 5px;
            padding: 1px 5px;
            color: var(--ink-700);
        }

        /* ── Step card pinned to the inline-start edge — right side
           in RTL, left side in LTR. ─────────────────────────────── */
        .step-card {
            position: fixed;
            top: 86px;
            inset-inline-start: 28px;
            width: min(420px, calc(100vw - 56px));
            z-index: 9;
            background: var(--glass-strong);
            backdrop-filter: blur(20px) saturate(150%);
            -webkit-backdrop-filter: blur(20px) saturate(150%);
            border: 1px solid var(--line-2);
            border-radius: 18px;
            padding: 20px 22px 22px;
            box-shadow: var(--shadow-card);
            transition: opacity .25s ease, transform .25s ease;
        }
        .step-card .row1 {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            margin-bottom: 14px;
        }
        .step-card .row1-end {
            display: inline-flex;
            align-items: center;
            gap: 8px;
        }
        /* Mobile-only collapse/expand chevron on the step card. */
        .step-card-toggle {
            display: none; /* shown only on mobile via the @media block below */
            appearance: none;
            -webkit-appearance: none;
            background: rgba(31, 26, 18, 0.06);
            border: 0;
            width: 30px; height: 30px;
            border-radius: 999px;
            align-items: center; justify-content: center;
            color: var(--ink-700);
            cursor: pointer;
            padding: 0;
            transition: background .15s ease;
        }
        .step-card-toggle:hover { background: rgba(31, 26, 18, 0.10); }
        .step-card-toggle:active { background: rgba(31, 26, 18, 0.14); }
        .step-card-toggle svg {
            width: 16px; height: 16px;
            transform: rotate(180deg); /* chevron points up (^) when card is open */
            transition: transform .2s ease;
        }
        .step-card.collapsed .step-card-toggle svg {
            transform: rotate(0); /* chevron points down (v) when card is collapsed */
        }
        .step-phase {
            display: inline-flex; align-items: center; gap: 8px;
            font-size: 11px;
            font-weight: 600;
            color: var(--accent-ink);
            letter-spacing: 0.04em;
            text-transform: none;
        }
        .step-phase::before {
            content: '';
            width: 8px; height: 8px;
            border-radius: 2px;
            background: var(--accent);
            box-shadow: 0 0 0 3px rgba(181, 104, 58, 0.18);
        }
        .step-counter-pill {
            font-family: 'Inter', 'IBM Plex Sans Arabic', sans-serif;
            font-feature-settings: "tnum" 1;
            font-variant-numeric: tabular-nums;
            font-size: 12px;
            color: var(--ink-500);
            background: rgba(31, 26, 18, 0.06);
            padding: 4px 10px;
            border-radius: 999px;
            direction: ltr;
        }
        .step-title {
            font-size: 22px;
            line-height: 1.3;
            font-weight: 700;
            letter-spacing: -0.005em;
            color: var(--ink-900);
            margin: 0;
            text-wrap: pretty;
        }
        .step-desc {
            margin-top: 10px;
            font-size: 14.5px;
            line-height: 1.7;
            color: var(--ink-700);
            font-weight: 400;
            text-wrap: pretty;
        }
        .step-progress {
            margin-top: 16px;
            height: 4px;
            background: rgba(31, 26, 18, 0.08);
            border-radius: 999px;
            overflow: hidden;
            position: relative;
        }
        .step-progress > i {
            position: absolute; inset: 0;
            background: linear-gradient(90deg, var(--accent), #d68a52);
            transform-origin: right center; /* RTL fill from right */
            transform: scaleX(var(--p, 0));
            transition: transform .35s cubic-bezier(.4,.0,.2,1);
            border-radius: inherit;
        }

        /* ── Bottom dock: prev / next, scrubber, dots ─────────────── */
        .dock {
            position: fixed;
            left: 0; right: 0; bottom: 0;
            z-index: 9;
            display: flex;
            flex-direction: column;
            align-items: center;
            padding: 0 24px 22px;
            pointer-events: none;
        }
        .dock > * { pointer-events: auto; }

        .phase-strip {
            display: flex;
            gap: 6px;
            margin-bottom: 10px;
            padding: 5px 10px;
            font-size: 11px;
            color: var(--ink-700);
            opacity: 0.85;
            font-weight: 500;
            font-family: 'IBM Plex Sans Arabic', sans-serif;
            background: rgba(252, 247, 233, 0.78);
            backdrop-filter: blur(14px) saturate(140%);
            -webkit-backdrop-filter: blur(14px) saturate(140%);
            border: 1px solid var(--line);
            border-radius: 999px;
            box-shadow: var(--shadow-pill);
        }
        .phase-strip span {
            padding: 2px 8px;
            border-radius: 999px;
            transition: background .15s ease, color .15s ease;
            white-space: nowrap;
        }
        .phase-strip span.active {
            color: #fff;
            background: var(--accent);
            opacity: 1;
        }

        .scrubber {
            width: min(1100px, calc(100vw - 48px));
            max-width: 100%;
            background: var(--glass-strong);
            backdrop-filter: blur(18px) saturate(140%);
            -webkit-backdrop-filter: blur(18px) saturate(140%);
            border: 1px solid var(--line-2);
            border-radius: 16px;
            padding: 14px 18px 12px;
            box-shadow: var(--shadow-card);
        }
        .scrubber-track {
            position: relative;
            height: 28px;
        }
        .scrubber-track .baseline {
            position: absolute;
            inset-inline-start: 6px;
            inset-inline-end: 6px;
            top: 50%;
            height: 2px;
            transform: translateY(-50%);
            background: rgba(31, 26, 18, 0.10);
            border-radius: 2px;
        }
        .scrubber-track .fill {
            position: absolute;
            top: 50%;
            height: 2px;
            transform: translateY(-50%);
            inset-inline-start: 6px;
            background: linear-gradient(90deg, var(--accent), #d68a52);
            border-radius: 2px;
            width: var(--fill, 0%);
            transition: width .35s cubic-bezier(.4,.0,.2,1);
        }
        .scrubber-track .dots {
            position: absolute;
            inset: 0;
            display: flex;
            align-items: center;
        }
        .dot {
            position: relative;
            flex: 1 1 0;
            min-width: 0;
            display: flex;
            justify-content: center;
            align-items: center;
            cursor: pointer;
            outline: none;
            height: 100%;
            padding: 0;
            margin: 0;
            border: 0;
            background: transparent;
            color: inherit;
            font: inherit;
            -webkit-appearance: none;
            appearance: none;
        }
        .dot::after {
            content: '';
            width: 8px; height: 8px;
            border-radius: 50%;
            background: var(--sand-200);
            border: 1.5px solid var(--sand-50);
            box-shadow: 0 1px 2px rgba(0,0,0,0.15);
            transition: transform .15s ease, background .15s ease, width .15s ease, height .15s ease;
        }
        .dot.done::after { background: var(--accent); }
        .dot.active::after {
            background: var(--accent);
            width: 14px; height: 14px;
            box-shadow:
                0 0 0 3px rgba(181, 104, 58, 0.18),
                0 1px 3px rgba(0,0,0,0.20);
        }
        .dot:hover::after { transform: scale(1.25); }
        .dot:focus-visible::after {
            outline: 2px solid var(--accent);
            outline-offset: 3px;
        }
        .scrubber-tip {
            position: absolute;
            bottom: calc(100% + 12px);
            left: 50%;
            transform: translateX(-50%);
            background: var(--ink-900);
            color: var(--sand-50);
            padding: 8px 14px;
            border-radius: 10px;
            font-size: 13px;
            font-weight: 500;
            opacity: 0;
            transition: opacity .15s ease, transform .15s ease;
            pointer-events: none;
            max-width: 300px;
            text-wrap: pretty;
            line-height: 1.45;
            box-shadow: 0 10px 22px -8px rgba(0,0,0,.4);
            white-space: normal;
            text-align: center;
            z-index: 2;
        }
        .scrubber-tip::after {
            content: '';
            position: absolute;
            top: 100%;
            left: var(--arrow, 50%);
            transform: translateX(-50%);
            border: 6px solid transparent;
            border-top-color: var(--ink-900);
        }
        .scrubber-tip.visible { opacity: 1; }

        .scrubber-controls {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-top: 8px;
            gap: 12px;
        }
        .nav-group {
            display: flex; align-items: center; gap: 6px;
        }
        .nav-btn {
            display: inline-flex; align-items: center; justify-content: center;
            width: 36px; height: 36px;
            border-radius: 10px;
            background: rgba(31, 26, 18, 0.04);
            border: 1px solid var(--line);
            color: var(--ink-700);
            cursor: pointer;
            transition: background .12s ease, transform .12s ease, color .12s ease;
        }
        .nav-btn:hover:not(:disabled) {
            background: rgba(181, 104, 58, 0.10);
            color: var(--accent-ink);
            transform: translateY(-1px);
        }
        .nav-btn:disabled {
            opacity: 0.35;
            cursor: not-allowed;
        }
        .nav-btn.primary {
            background: var(--ink-900);
            color: var(--sand-50);
            border-color: var(--ink-900);
            width: 44px; height: 36px;
        }
        .nav-btn.primary:hover:not(:disabled) {
            background: var(--accent-ink);
            border-color: var(--accent-ink);
            color: #fff;
        }
        .nav-btn svg { width: 16px; height: 16px; }

        .jump {
            display: flex; align-items: center; gap: 8px;
            font-size: 12px;
            color: var(--ink-500);
        }
        .jump input {
            width: 56px;
            padding: 7px 10px;
            background: rgba(31, 26, 18, 0.04);
            border: 1px solid var(--line);
            border-radius: 8px;
            font-family: 'Inter', sans-serif;
            font-feature-settings: "tnum" 1;
            font-size: 13px;
            color: var(--ink-900);
            text-align: center;
            direction: ltr;
            outline: none;
            transition: border-color .12s ease, background .12s ease;
        }
        .jump input:focus {
            border-color: var(--accent);
            background: #fff;
        }
        .counter {
            font-family: 'Inter', 'IBM Plex Sans Arabic', sans-serif;
            font-feature-settings: "tnum" 1;
            font-variant-numeric: tabular-nums;
            font-size: 13px;
            color: var(--ink-500);
            direction: ltr;
            min-width: 70px;
            text-align: center;
        }

        /* Hide the original elements; build-villa.js still updates them and
           we mirror their text into our visible UI. */
        .legacy {
            position: fixed;
            inset-block-end: 0;
            inset-inline-start: -9999px;
            pointer-events: none;
            opacity: 0;
        }

        /* ── Loading screen ───────────────────────────────────────── */
        .splash {
            position: fixed; inset: 0;
            z-index: 100;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 20px;
            background: linear-gradient(160deg, #ece4d0 0%, #e6d6b2 55%, #d9b885 100%);
            transition: opacity .6s ease;
        }
        .splash.hidden { opacity: 0; pointer-events: none; }
        .splash .spinner {
            width: 42px; height: 42px;
            border-radius: 50%;
            border: 3px solid rgba(31, 26, 18, 0.15);
            border-top-color: var(--accent);
            animation: spin .9s linear infinite;
        }
        .splash .label {
            font-size: 14px;
            color: var(--ink-700);
            font-weight: 500;
            letter-spacing: 0.01em;
        }
        @keyframes spin { to { transform: rotate(360deg); } }

        .scrubber-track .thumb {
            position: absolute;
            top: 50%;
            inset-inline-start: var(--thumb, 0%);
            transform: translate(50%, -50%);
            width: 22px; height: 22px;
            border-radius: 50%;
            background: #fff;
            border: 2px solid var(--accent);
            box-shadow: 0 2px 8px rgba(0,0,0,0.25);
            display: none;
            pointer-events: none;
        }

        /* ── Mobile drawer (all steps list) ──────────────────────── */
        .drawer {
            position: fixed; inset: 0;
            z-index: 50;
            display: flex;
            flex-direction: column;
            background: rgba(31, 26, 18, 0.45);
            backdrop-filter: blur(8px);
            -webkit-backdrop-filter: blur(8px);
            opacity: 0;
            pointer-events: none;
            transition: opacity .2s ease;
        }
        .drawer.open {
            opacity: 1;
            pointer-events: auto;
        }
        .drawer-sheet {
            margin-top: auto;
            background: var(--sand-50);
            border-top-left-radius: 22px;
            border-top-right-radius: 22px;
            max-height: 78vh;
            display: flex;
            flex-direction: column;
            transform: translateY(100%);
            transition: transform .28s cubic-bezier(.4,.0,.2,1);
            box-shadow: 0 -20px 40px -10px rgba(0,0,0,0.3);
        }
        .drawer.open .drawer-sheet { transform: translateY(0); }
        .drawer-grab {
            width: 44px; height: 4px;
            background: rgba(31, 26, 18, 0.18);
            border-radius: 2px;
            margin: 10px auto 8px;
        }
        .drawer-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 4px 18px 14px;
            border-bottom: 1px solid var(--line);
        }
        .drawer-header h2 {
            font-size: 17px;
            font-weight: 700;
            margin: 0;
            color: var(--ink-900);
        }
        .drawer-close {
            width: 36px; height: 36px;
            border-radius: 10px;
            background: rgba(31, 26, 18, 0.06);
            border: none;
            color: var(--ink-700);
            display: inline-flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
        }
        .drawer-close svg { width: 16px; height: 16px; }
        .drawer-list {
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
            padding: 8px 0 24px;
        }
        .drawer-item {
            display: flex;
            align-items: center;
            gap: 14px;
            padding: 12px 18px;
            border: none;
            background: transparent;
            text-align: start;
            width: 100%;
            cursor: pointer;
            font-family: inherit;
            color: var(--ink-900);
            border-bottom: 1px solid rgba(31, 26, 18, 0.05);
        }
        .drawer-item:active { background: rgba(181, 104, 58, 0.08); }
        .drawer-item-num {
            width: 32px; height: 32px;
            border-radius: 8px;
            background: rgba(31, 26, 18, 0.06);
            color: var(--ink-700);
            font-family: 'Inter', sans-serif;
            font-size: 12px;
            font-weight: 600;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            flex: 0 0 32px;
            direction: ltr;
            font-feature-settings: "tnum" 1;
        }
        .drawer-item-text {
            flex: 1;
            min-width: 0;
        }
        .drawer-item-title {
            font-size: 14.5px;
            font-weight: 600;
            line-height: 1.4;
            color: var(--ink-900);
            text-wrap: pretty;
        }
        .drawer-item-phase {
            font-size: 11px;
            color: var(--ink-500);
            margin-top: 2px;
        }
        .drawer-item.done .drawer-item-num {
            background: rgba(181, 104, 58, 0.18);
            color: var(--accent-ink);
        }
        .drawer-item.active {
            background: rgba(181, 104, 58, 0.10);
        }
        .drawer-item.active .drawer-item-num {
            background: var(--accent);
            color: #fff;
        }
        .drawer-item.active .drawer-item-title {
            color: var(--accent-ink);
        }

        /* ── Responsive ──────────────────────────────────────────── */
        @media (max-width: 720px) {
            .topbar { padding: 10px 14px; }
            .top-actions { display: none; }
            .brand-sub { display: none; }
            .brand-title { font-size: 15px; }
            .brand-mark { width: 36px; height: 36px; }

            .vignette.bottom { height: 280px; }
            .vignette.top { height: 120px; }

            /* Step card becomes a bottom sheet, above the dock. */
            .step-card {
                position: fixed;
                top: auto;
                bottom: calc(116px + env(safe-area-inset-bottom, 0px));
                inset-inline-start: 12px;
                inset-inline-end: 12px;
                width: auto;
                padding: 14px 16px;
                border-radius: 16px;
                max-height: calc(100vh - 220px);
                overflow-y: auto;
                -webkit-overflow-scrolling: touch;
            }
            .step-card .row1 { margin-bottom: 8px; }
            .step-card-toggle { display: inline-flex; }
            .step-card.collapsed {
                padding-top: 10px;
                padding-bottom: 10px;
            }
            .step-card.collapsed .row1 { margin-bottom: 0; }
            .step-card.collapsed .step-title,
            .step-card.collapsed .step-desc,
            .step-card.collapsed .step-progress { display: none; }
            .step-title { font-size: 17px; line-height: 1.35; }
            .step-desc {
                margin-top: 8px;
                font-size: 13px;
                line-height: 1.6;
                display: -webkit-box;
                -webkit-line-clamp: 2;
                -webkit-box-orient: vertical;
                overflow: hidden;
                cursor: pointer;
            }
            .step-card.expanded .step-desc {
                -webkit-line-clamp: unset;
                overflow: visible;
            }
            .step-desc::after {
                content: '…';
                color: var(--accent);
                font-weight: 600;
                margin-inline-start: 2px;
            }
            .step-card.expanded .step-desc::after { content: ''; }
            .step-progress { margin-top: 12px; }

            /* Dock: drop dot strip, big nav, single jump-to-list button. */
            .dock { padding: 0 12px calc(12px + env(safe-area-inset-bottom, 0px)); }
            .scrubber {
                padding: 8px 12px 10px;
                border-radius: 14px;
            }
            .scrubber-track {
                height: 28px;
                cursor: pointer;
            }
            .scrubber-track .baseline,
            .scrubber-track .fill {
                height: 4px;
                border-radius: 2px;
            }
            .scrubber-track .dots { display: none; }
            .scrubber-track .thumb { display: block; }

            .scrubber-controls { margin-top: 4px; gap: 8px; }
            .nav-btn {
                width: 44px; height: 44px;
                border-radius: 12px;
            }
            .nav-btn.primary { width: 56px; height: 44px; }
            .jump { display: none; }
            .counter { font-size: 14px; min-width: 64px; }

            /* Show the steps-list trigger. */
            .nav-btn#ui-list { display: inline-flex; }
        }
        @media (min-width: 721px) {
            .nav-btn#ui-list { display: none; }
        }
        @media (max-width: 380px) {
            .nav-btn { width: 40px; height: 40px; }
            .nav-btn.primary { width: 50px; height: 40px; }
            .counter { min-width: 56px; font-size: 13px; }
            .step-title { font-size: 16px; }
        }

        /* Hide the floating WhatsApp button from the shared PublicLayout
           on small screens — it overlaps the bottom step-navigation dock. */
        @media (max-width: 720px) {
            .whatsapp-stack { display: none !important; }
        }
