* {
            box-sizing: border-box;
        }

        html,
        body {
            margin: 0;
            padding: 0;
            width: 100%;
            height: 100%;
            font-family: Arial, Helvetica, sans-serif;
            background: #eef1f3;
        }

        #map {
            position: absolute;
            inset: 0;
            width: 100%;
            height: 100%;
        }

        /*
         * Main GMI header
         */
        .gmi-header {
            position: absolute;
            top: 18px;
            left: 18px;
            z-index: 10;

            display: flex;
            align-items: center;
            gap: 14px;

            width: min(620px, calc(100vw - 90px));
            padding: 10px 12px;

            background: rgba(255, 255, 255, 0.96);
            border: 1px solid rgba(48, 56, 63, 0.14);
            border-radius: 14px;

            box-shadow:
                0 2px 5px rgba(0, 0, 0, 0.08),
                0 10px 28px rgba(0, 0, 0, 0.10);

            backdrop-filter: blur(8px);
        }

        .gmi-logo {
            width: 138px;
            height: auto;
            flex: 0 0 auto;
        }

        /*
         * Main search
         */
        .gmi-search {
            position: relative;
            flex: 1 1 auto;
            min-width: 0;
        }

        .gmi-search input {
            width: 100%;
            height: 46px;
            padding: 0 48px 0 16px;

            border: 1px solid #cbd1d5;
            border-radius: 10px;

            background: #ffffff;
            color: #30383f;

            font-size: 15px;
            outline: none;

            transition:
                border-color 0.15s ease,
                box-shadow 0.15s ease;
        }

        .gmi-search input:focus {
            border-color: #3f8f4f;
            box-shadow: 0 0 0 3px rgba(63, 143, 79, 0.14);
        }

        #gmi-search-button {
            position: absolute;
            top: 50%;
            right: 6px;
            transform: translateY(-50%);

            width: 36px;
            height: 36px;

            border: 0;
            border-radius: 8px;

            background: #3f8f4f;
            color: #ffffff;

            cursor: pointer;
            font-size: 18px;
            line-height: 1;
        }

        #gmi-search-button:hover {
            background: #347943;
        }

        #gmi-search-button:disabled {
            opacity: 0.65;
            cursor: default;
        }

        .gmi-search-results {
            display: none;

            position: absolute;
            top: calc(100% + 8px);
            left: 0;
            right: 0;

            z-index: 30;

            max-height: 360px;
            overflow-y: auto;

            background: #ffffff;
            border: 1px solid #d7dcdf;
            border-radius: 10px;

            box-shadow:
                0 4px 12px rgba(0, 0, 0, 0.08),
                0 14px 30px rgba(0, 0, 0, 0.15);
        }

        .gmi-search-results.is-open {
            display: block;
        }

        .gmi-search-result {
            display: block;
            width: 100%;
            margin: 0;
            padding: 11px 14px;

            border: 0;
            border-bottom: 1px solid #edf0f1;

            background: #ffffff;
            color: #30383f;

            text-align: left;
            cursor: pointer;
        }

        .gmi-search-result:last-child {
            border-bottom: 0;
        }

        .gmi-search-result:hover,
        .gmi-search-result:focus {
            background: #f3f7f3;
            outline: none;
        }

        .gmi-search-result-name {
            display: block;
            color: #30383f;
            font-size: 14px;
            font-weight: 700;
            line-height: 1.3;
        }

        .gmi-search-result-address {
            display: block;
            margin-top: 3px;
            color: #68737a;
            font-size: 12px;
            line-height: 1.35;
        }

        .gmi-search-message {
            padding: 13px 14px;
            color: #68737a;
            font-size: 13px;
            line-height: 1.4;
        }

        /*
         * Route planner
         */
        .gmi-route-card {
            display: none;

            position: absolute;
            top: 92px;
            left: 18px;
            z-index: 9;

            width: min(430px, calc(100vw - 36px));
            max-height: calc(100vh - 112px);
            overflow-y: auto;

            padding: 15px;

            background: rgba(255, 255, 255, 0.97);
            border: 1px solid rgba(48, 56, 63, 0.14);
            border-radius: 14px;

            box-shadow:
                0 2px 5px rgba(0, 0, 0, 0.08),
                0 10px 28px rgba(0, 0, 0, 0.10);
        }

        .gmi-route-card.is-open {
            display: block;
        }

        .gmi-route-heading {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            margin-bottom: 12px;
        }

        .gmi-route-heading strong {
            color: #30383f;
            font-size: 16px;
        }

        #gmi-route-close {
            border: 0;
            background: transparent;
            color: #68737a;
            cursor: pointer;
            font-size: 20px;
            line-height: 1;
        }

        .gmi-route-field {
            position: relative;
            margin-bottom: 9px;
        }

        .gmi-route-field-row {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .gmi-route-label {
            width: 42px;
            flex: 0 0 42px;

            color: #68737a;
            font-size: 12px;
            font-weight: 700;
        }

        .gmi-route-field input {
            width: 100%;
            height: 42px;
            padding: 0 42px 0 12px;

            border: 1px solid #cbd1d5;
            border-radius: 9px;

            background: #ffffff;
            color: #30383f;

            font-size: 13px;
            outline: none;
        }

        .gmi-route-field input:focus {
            border-color: #3f8f4f;
            box-shadow: 0 0 0 3px rgba(63, 143, 79, 0.12);
        }

        .gmi-route-field-search {
            position: absolute;
            top: 3px;
            right: 3px;

            width: 36px;
            height: 36px;

            border: 0;
            border-radius: 7px;

            background: #eef3ef;
            color: #3f8f4f;

            cursor: pointer;
            font-size: 16px;
        }

        .gmi-route-field-search:hover {
            background: #e1ebe2;
        }

        .gmi-route-actions {
            display: grid;
            grid-template-columns: 46px 1fr 86px;
            gap: 8px;
            margin-top: 10px;
        }

        #gmi-route-reverse {
            height: 42px;

            border: 1px solid #cbd1d5;
            border-radius: 9px;

            background: #ffffff;
            color: #30383f;

            cursor: pointer;
            font-size: 20px;
        }

        #gmi-route-reverse:hover {
            background: #f4f6f5;
        }

        #gmi-route-button {
            height: 42px;

            border: 0;
            border-radius: 9px;

            background: #3f8f4f;
            color: #ffffff;

            cursor: pointer;
            font-size: 14px;
            font-weight: 700;
        }

        #gmi-route-button:hover {
            background: #347943;
        }

        #gmi-route-button:disabled {
            opacity: 0.65;
            cursor: default;
        }

        #gmi-route-share {
            height: 42px;
            border: 1px solid #cbd1d5;
            border-radius: 9px;
            background: #ffffff;
            color: #263844;
            cursor: pointer;
            font-size: 13px;
            font-weight: 700;
        }

        #gmi-route-share:hover {
            background: #f4f6f5;
        }

        #gmi-route-share:disabled {
            opacity: 0.5;
            cursor: default;
        }

        /*
         * Dropped pin card
         */
        .gmi-pin-card {
            display: none;
            position: absolute;
            left: 50%;
            bottom: 28px;
            z-index: 12;
            transform: translateX(-50%);
            width: min(410px, calc(100vw - 28px));
            padding: 14px;
            background: rgba(255,255,255,0.98);
            border: 1px solid rgba(48,56,63,0.14);
            border-radius: 14px;
            box-shadow:
                0 2px 5px rgba(0,0,0,0.08),
                0 10px 28px rgba(0,0,0,0.14);
        }

        .gmi-pin-card.is-open {
            display: block;
        }

        .gmi-pin-heading {
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            gap: 12px;
        }

        .gmi-pin-heading strong {
            color: #30383f;
            font-size: 15px;
        }

        .gmi-pin-coordinates {
            margin-top: 3px;
            color: #68737a;
            font-size: 12px;
        }

        #gmi-pin-close {
            border: 0;
            background: transparent;
            color: #68737a;
            cursor: pointer;
            font-size: 20px;
            line-height: 1;
        }

        .gmi-pin-actions {
            display: grid;
            grid-template-columns: 1fr 92px;
            gap: 8px;
            margin-top: 12px;
        }

        #gmi-pin-route {
            min-height: 42px;
            border: 0;
            border-radius: 9px;
            background: #3f8f4f;
            color: #ffffff;
            cursor: pointer;
            font-size: 14px;
            font-weight: 800;
        }

        #gmi-pin-route:hover {
            background: #347943;
        }

        #gmi-pin-share {
            min-height: 42px;
            border: 1px solid #cbd1d5;
            border-radius: 9px;
            background: #ffffff;
            color: #263844;
            cursor: pointer;
            font-size: 13px;
            font-weight: 700;
        }

        #gmi-pin-share:hover {
            background: #f4f6f5;
        }

        .gmi-share-message {
            display: none;
            margin-top: 8px;
            color: #3f8f4f;
            font-size: 12px;
            font-weight: 700;
        }

        .gmi-share-message.is-open {
            display: block;
        }

        /*
         * Route endpoint search results
         */
        .gmi-route-search-results {
            display: none;

            margin: 8px 0 10px 50px;

            max-height: 220px;
            overflow-y: auto;

            background: #ffffff;
            border: 1px solid #d7dcdf;
            border-radius: 9px;

            box-shadow:
                0 4px 10px rgba(0, 0, 0, 0.07),
                0 10px 22px rgba(0, 0, 0, 0.10);
        }

        .gmi-route-search-results.is-open {
            display: block;
        }

        .gmi-route-result {
            display: block;
            width: 100%;
            padding: 10px 12px;

            border: 0;
            border-bottom: 1px solid #edf0f1;

            background: #ffffff;
            color: #30383f;

            text-align: left;
            cursor: pointer;
        }

        .gmi-route-result:last-child {
            border-bottom: 0;
        }

        .gmi-route-result:hover {
            background: #f3f7f3;
        }

        .gmi-route-result strong {
            display: block;
            color: #30383f;
            font-size: 13px;
        }

        .gmi-route-result span {
            display: block;
            margin-top: 2px;
            color: #68737a;
            font-size: 11px;
            line-height: 1.35;
        }

        /*
         * Status + summary
         */
        .gmi-route-status {
            display: none;
            margin-top: 10px;
            color: #68737a;
            font-size: 13px;
        }

        .gmi-route-summary {
            display: none;

            margin-top: 12px;

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

        .gmi-route-summary.is-open {
            display: grid;
        }

        .gmi-route-stat {
            padding: 10px;

            background: #f5f7f6;
            border-radius: 9px;

            text-align: center;
        }

        .gmi-route-stat strong {
            display: block;
            color: #30383f;
            font-size: 17px;
        }

        .gmi-route-stat span {
            display: block;
            margin-top: 2px;
            color: #68737a;
            font-size: 11px;
        }


        /*
         * Prominent next manoeuvre
         */
        .gmi-next-manoeuvre {
            display: none;
            margin-top: 12px;
            padding: 14px;
            background: #263844;
            border-radius: 12px;
            color: #ffffff;
        }

        .gmi-next-manoeuvre.is-open { display: block; }

        .gmi-next-main {
            display: grid;
            grid-template-columns: 82px 1fr;
            gap: 14px;
            align-items: center;
        }

        .gmi-next-icon {
            width: 82px;
            height: 82px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 12px;
            background: #ffffff;
        }

        .gmi-next-icon svg {
            width: 66px;
            height: 66px;
        }

        .gmi-next-details { min-width: 0; }

        .gmi-next-distance {
            color: #9bd0a4;
            font-size: 25px;
            font-weight: 800;
            line-height: 1;
        }

        .gmi-next-instruction {
            margin-top: 7px;
            color: #ffffff;
            font-size: 17px;
            font-weight: 700;
            line-height: 1.25;
        }

        .gmi-next-road {
            margin-top: 5px;
            color: #d9e0e4;
            font-size: 13px;
            line-height: 1.3;
        }

        .gmi-next-label {
            margin-top: 11px;
            padding-top: 9px;
            border-top: 1px solid rgba(255,255,255,0.16);
            color: #b9c5cb;
            font-size: 10px;
            font-weight: 700;
            letter-spacing: 0.08em;
            text-transform: uppercase;
        }

        /*
         * Navigation controls + driving mode
         */
        .gmi-navigation-actions {
            display: none;
            margin-top: 12px;
        }

        .gmi-navigation-actions.is-open {
            display: block;
        }

        #gmi-navigation-start,
        #gmi-navigation-exit {
            width: 100%;
            min-height: 44px;
            border: 0;
            border-radius: 9px;
            cursor: pointer;
            font-size: 14px;
            font-weight: 800;
        }

        #gmi-navigation-start {
            background: #3f8f4f;
            color: #ffffff;
        }

        #gmi-navigation-start:hover {
            background: #347943;
        }

        #gmi-navigation-exit {
            display: none;
            margin-top: 8px;
            background: #ffffff;
            color: #263844;
            border: 1px solid #cbd1d5;
        }

        .gmi-live-location-marker {
            width: 18px;
            height: 18px;
            border: 3px solid #ffffff;
            border-radius: 50%;
            background: #1565d8;
            box-shadow:
                0 1px 4px rgba(0,0,0,0.35),
                0 0 0 5px rgba(21,101,216,0.20);
            pointer-events: none;
        }

        body.gmi-navigation-mode .gmi-header {
            display: none;
        }

        body.gmi-navigation-mode .gmi-route-card {
            display: block;
            top: 14px;
            left: 14px;
            width: min(430px, calc(100vw - 28px));
            max-height: none;
            padding: 0;
            overflow: visible;
            background: transparent;
            border: 0;
            border-radius: 0;
            box-shadow: none;
            backdrop-filter: none;
        }

        body.gmi-navigation-mode .gmi-route-card > * {
            display: none !important;
        }

        body.gmi-navigation-mode
        .gmi-route-card > .gmi-next-manoeuvre.is-open {
            display: block !important;
            margin-top: 0;
            box-shadow:
                0 2px 5px rgba(0,0,0,0.12),
                0 10px 28px rgba(0,0,0,0.18);
        }

        body.gmi-navigation-mode
        .gmi-route-card > .gmi-navigation-actions {
            display: block !important;
        }

        body.gmi-navigation-mode #gmi-navigation-start {
            display: none;
        }

        body.gmi-navigation-mode #gmi-navigation-exit {
            display: block;
        }


        /*
         * Header quick actions: Home, History and Settings.
         * SVG icons are inline in the HTML so the frontend remains self-contained.
         */
        .gmi-header-tools {
            display: flex;
            align-items: center;
            gap: 6px;
            flex: 0 0 auto;
        }

        .gmi-header-tool {
            width: 40px;
            height: 40px;
            padding: 0;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            border: 1px solid #cbd1d5;
            border-radius: 9px;
            background: #ffffff;
            color: #30383f;
            cursor: pointer;
        }

        .gmi-header-tool:hover,
        .gmi-header-tool:focus {
            background: #f3f7f3;
            border-color: #8eb998;
            outline: none;
        }

        .gmi-header-tool.is-active {
            background: #eef5ef;
            border-color: #3f8f4f;
            color: #347943;
        }

        .gmi-header-tool svg {
            width: 20px;
            height: 20px;
            display: block;
            fill: none;
            stroke: currentColor;
            stroke-width: 2;
            stroke-linecap: round;
            stroke-linejoin: round;
        }

        /*
         * History / Settings panels.
         */
        .gmi-panel-card {
            display: none;
            position: absolute;
            top: 92px;
            left: 18px;
            z-index: 11;
            width: min(430px, calc(100vw - 36px));
            max-height: calc(100vh - 112px);
            overflow-y: auto;
            padding: 15px;
            background: rgba(255, 255, 255, 0.98);
            border: 1px solid rgba(48, 56, 63, 0.14);
            border-radius: 14px;
            box-shadow:
                0 2px 5px rgba(0, 0, 0, 0.08),
                0 10px 28px rgba(0, 0, 0, 0.10);
        }

        .gmi-panel-card.is-open {
            display: block;
        }

        .gmi-panel-heading {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            margin-bottom: 12px;
        }

        .gmi-panel-heading strong {
            color: #30383f;
            font-size: 16px;
        }

        .gmi-panel-close {
            border: 0;
            background: transparent;
            color: #68737a;
            cursor: pointer;
            font-size: 22px;
            line-height: 1;
        }

        .gmi-panel-note,
        .gmi-settings-value {
            color: #68737a;
            font-size: 12px;
            line-height: 1.45;
        }

        .gmi-history-empty {
            padding: 18px 4px;
            color: #68737a;
            font-size: 13px;
            text-align: center;
        }

        .gmi-history-list {
            display: grid;
            gap: 7px;
        }

        .gmi-history-item {
            display: block;
            width: 100%;
            padding: 10px 11px;
            border: 1px solid #e0e4e6;
            border-radius: 9px;
            background: #ffffff;
            color: #30383f;
            cursor: pointer;
            text-align: left;
        }

        .gmi-history-item:hover,
        .gmi-history-item:focus {
            background: #f3f7f3;
            border-color: #b9cdbd;
            outline: none;
        }

        .gmi-history-item strong {
            display: block;
            overflow: hidden;
            color: #30383f;
            font-size: 13px;
            line-height: 1.3;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .gmi-history-item span {
            display: block;
            margin-top: 3px;
            overflow: hidden;
            color: #7a848a;
            font-size: 11px;
            line-height: 1.3;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .gmi-settings-section {
            padding: 12px 0;
            border-top: 1px solid #edf0f1;
        }

        .gmi-settings-section:first-of-type {
            padding-top: 0;
            border-top: 0;
        }

        .gmi-settings-title {
            margin-bottom: 7px;
            color: #30383f;
            font-size: 13px;
            font-weight: 700;
        }

        .gmi-settings-home-current {
            margin-bottom: 9px;
            padding: 9px 10px;
            border-radius: 8px;
            background: #f5f7f8;
            color: #536068;
            font-size: 12px;
            line-height: 1.4;
        }

        .gmi-settings-row {
            display: flex;
            gap: 7px;
            align-items: stretch;
        }

        .gmi-settings-row input {
            min-width: 0;
            flex: 1 1 auto;
            height: 40px;
            padding: 0 11px;
            border: 1px solid #cbd1d5;
            border-radius: 8px;
            background: #ffffff;
            color: #30383f;
            font-size: 13px;
            outline: none;
        }

        .gmi-settings-row input:focus {
            border-color: #3f8f4f;
            box-shadow: 0 0 0 3px rgba(63, 143, 79, 0.12);
        }

        .gmi-settings-button {
            min-height: 40px;
            padding: 0 12px;
            border: 0;
            border-radius: 8px;
            background: #3f8f4f;
            color: #ffffff;
            cursor: pointer;
            font-size: 12px;
            font-weight: 700;
        }

        .gmi-settings-button.secondary {
            border: 1px solid #cbd1d5;
            background: #ffffff;
            color: #30383f;
        }

        .gmi-settings-button.danger {
            border: 1px solid #ddc5c5;
            background: #ffffff;
            color: #8a3d3d;
        }

        .gmi-settings-actions {
            display: flex;
            flex-wrap: wrap;
            gap: 7px;
            margin-top: 8px;
        }

        .gmi-settings-results {
            display: none;
            margin-top: 8px;
            overflow: hidden;
            border: 1px solid #d7dcdf;
            border-radius: 9px;
            background: #ffffff;
        }

        .gmi-settings-results.is-open {
            display: block;
        }

        .gmi-settings-result {
            display: block;
            width: 100%;
            padding: 9px 10px;
            border: 0;
            border-bottom: 1px solid #edf0f1;
            background: #ffffff;
            color: #30383f;
            cursor: pointer;
            text-align: left;
        }

        .gmi-settings-result:last-child {
            border-bottom: 0;
        }

        .gmi-settings-result:hover,
        .gmi-settings-result:focus {
            background: #f3f7f3;
            outline: none;
        }

        .gmi-settings-result strong {
            display: block;
            font-size: 12px;
        }

        .gmi-settings-result span {
            display: block;
            margin-top: 2px;
            color: #7a848a;
            font-size: 10px;
            line-height: 1.3;
        }

        @media (max-width: 620px) {
            /*
             * Mobile driving mode:
             * keep the map view open and place the compact manoeuvre
             * card and Exit navigation control together at the bottom.
             */
            body.gmi-navigation-mode .gmi-route-card {
                top: auto;
                bottom: calc(10px + env(safe-area-inset-bottom, 0px));
                left: 10px;
                right: 10px;
                width: auto;
            }

            body.gmi-navigation-mode
            .gmi-route-card > .gmi-next-manoeuvre.is-open {
                padding: 9px 10px;
                border-radius: 10px;
            }

            body.gmi-navigation-mode .gmi-next-main {
                grid-template-columns: 54px 1fr;
                gap: 9px;
            }

            body.gmi-navigation-mode .gmi-next-icon {
                width: 54px;
                height: 54px;
                border-radius: 9px;
            }

            body.gmi-navigation-mode .gmi-next-icon svg {
                width: 44px;
                height: 44px;
            }

            body.gmi-navigation-mode .gmi-next-distance {
                font-size: 20px;
            }

            body.gmi-navigation-mode .gmi-next-instruction {
                margin-top: 4px;
                font-size: 14px;
                line-height: 1.18;
            }

            body.gmi-navigation-mode .gmi-next-road {
                margin-top: 3px;
                font-size: 11px;
                line-height: 1.2;
            }

            body.gmi-navigation-mode .gmi-next-label {
                display: none;
            }

            body.gmi-navigation-mode
            .gmi-route-card > .gmi-navigation-actions {
                margin-top: 6px;
            }

            body.gmi-navigation-mode #gmi-navigation-exit {
                min-height: 36px;
                margin-top: 0;
                border-radius: 8px;
                font-size: 12px;
            }
        }

        /*
         * Turn-by-turn directions
         */
        .gmi-turns {
            display: none;
            margin-top: 12px;

            border: 1px solid #e1e5e7;
            border-radius: 10px;

            background: #ffffff;
            overflow: hidden;
        }

        .gmi-turns.is-open {
            display: block;
        }

        .gmi-turns-heading {
            padding: 10px 12px;

            background: #f5f7f6;
            border-bottom: 1px solid #e1e5e7;

            color: #30383f;
            font-size: 13px;
            font-weight: 700;
        }

        .gmi-turn-list {
            max-height: 320px;
            overflow-y: auto;
        }

        .gmi-turn {
            display: flex;
            align-items: flex-start;
            gap: 10px;

            padding: 11px 12px;

            border-bottom: 1px solid #edf0f1;
        }

        .gmi-turn:last-child {
            border-bottom: 0;
        }

        .gmi-turn-icon {
            width: 28px;
            height: 28px;
            flex: 0 0 28px;

            display: flex;
            align-items: center;
            justify-content: center;

            border-radius: 50%;

            background: #eef5ef;
            color: #3f8f4f;

            font-size: 15px;
            font-weight: 700;
        }

        .gmi-turn-content {
            flex: 1;
            min-width: 0;
        }

        .gmi-turn-instruction {
            color: #30383f;
            font-size: 13px;
            font-weight: 600;
            line-height: 1.35;
        }

        .gmi-turn-distance {
            margin-top: 3px;

            color: #7a848a;
            font-size: 11px;
        }

        @media (max-width: 620px) {
            .gmi-header {
                top: 10px;
                left: 10px;
                right: 10px;

                width: auto;

                flex-direction: column;
                align-items: stretch;
                gap: 8px;

                padding: 10px;
            }

            .gmi-logo {
                width: 116px;
            }

            .gmi-search input {
                height: 44px;
            }

            .gmi-search-results {
                max-height: 300px;
            }

            .gmi-header-tools {
                justify-content: flex-end;
            }

            .gmi-header-tool {
                width: 38px;
                height: 36px;
            }

            .gmi-panel-card {
                top: 174px;
                left: 10px;
                right: 10px;
                width: auto;
                max-height: calc(100vh - 194px);
            }

            .gmi-route-card {
                top: 174px;
                left: 10px;
                right: 10px;

                width: auto;
                max-height: calc(100vh - 146px);
            }

            .gmi-turn-list {
                max-height: 260px;
            }

            .gmi-pin-card {
                bottom: 14px;
                width: calc(100vw - 20px);
            }
        }
