@media (max-width: 640px) {
    *,
    *::before,
    *::after {
        -webkit-tap-highlight-color: transparent;
    }

    button,
    a,
    input,
    textarea,
    select,
    [role="button"],
    .setting-tile,
    .notification-item,
    .driver-option,
    .nav-button,
    .brand-button {
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
    }

    body {
        background: #222924;
    }

    .top-bar {
        top: 16px;
        left: 16px;
        right: auto;
        flex-direction: row;
        align-items: center;
        z-index: 5;
    }

    .brand {
        width: 52px;
        min-height: 52px;
        padding: 0;
        border-radius: 18px;
        justify-content: center;
        background: transparent;
        box-shadow: none;
    }

    .brand strong,
    .status-pill {
        display: none;
    }

    .brand-mark {
        width: 30px;
        height: 30px;
    }

    .notification-button,
    .update-toast {
        top: 16px;
        right: 16px;
    }

    .update-toast {
        right: 16px;
        left: 76px;
        min-width: 0;
    }

    .control-panel {
        inset: 0;
        width: 100vw;
        height: 100vh;
        height: 100svh;
        min-height: 0;
        grid-template-columns: 1fr;
        grid-template-rows: minmax(0, 1fr) auto;
        gap: 18px;
        padding: 78px 16px calc(16px + env(safe-area-inset-bottom));
        border-radius: 0;
        border: 0;
        background: rgba(20, 24, 22, 0.96);
        box-shadow: none;
    }

    .demo-panel {
        width: 100%;
        min-height: 0;
        overflow: hidden;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }

    .demo-panel__tab {
        height: 100%;
        min-height: 0;
        padding-right: 2px;
        -webkit-overflow-scrolling: touch;
    }

    .demo-panel__tab[data-tab="book"] .ride-summary-grid {
        margin-bottom: 4px;
    }

    .booking-launch-button {
        width: min(90%, 420px);
        min-height: 120px;
        border-radius: 28px;
        font-size: 1.2rem;
    }

    .booking-results {
        padding-right: 2px;
    }

    .booking-modal__sheet {
        width: calc(100% - 16px);
        margin: calc(8px + env(safe-area-inset-top)) 8px 0;
        padding: 12px 12px 14px;
        border-radius: 22px;
    }

    .booking-modal__label {
        font-size: 0.86rem;
    }

    .booking-modal__input-row {
        gap: 8px;
    }

    .booking-modal__next {
        width: 52px;
        min-width: 52px;
        height: 52px;
        border-radius: 16px;
    }

    .bottom-nav {
        width: 100%;
        grid-template-columns: 1fr 1.2fr 1fr;
        gap: 8px;
        background: transparent;
        border: 0;
        box-shadow: none;
    }

    .nav-button {
        min-height: 64px;
        border-radius: 18px;
    }

    .settings-grid {
        max-height: none;
        overflow-y: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .settings-grid::-webkit-scrollbar {
        display: none;
    }

    .setting-tile {
        min-height: 108px;
    }

    #notifications-modal,
    #notification-detail-modal,
    #delete-confirm-modal {
        padding: 0;
    }

    #notifications-modal,
    #notification-detail-modal {
        place-items: stretch;
    }

    #notifications-modal .modal__dialog,
    #notification-detail-modal .modal__dialog {
        width: 100vw;
        min-height: 100vh;
        min-height: 100svh;
        border-radius: 0;
        border: 0;
        padding: 72px 18px calc(18px + env(safe-area-inset-bottom));
        overflow-y: auto;
    }

    #notifications-modal .modal__dialog {
        padding-top: 28px;
    }

    #notifications-modal .modal__close,
    #notification-detail-modal .modal__close {
        top: 16px;
        right: 16px;
    }

    #notifications-modal .notifications-heading .modal__close {
        position: relative;
        top: auto;
        right: auto;
    }

    .notification-list {
        max-height: none;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .notification-list::-webkit-scrollbar {
        display: none;
    }

    #delete-confirm-modal {
        place-items: center;
        padding: 18px;
    }

    #delete-confirm-modal .modal__dialog,
    #permissions-modal .modal__dialog {
        width: min(360px, calc(100vw - 28px));
        min-height: auto;
        border-radius: 28px;
        border: 1px solid rgba(255, 255, 255, 0.08);
        padding: 58px 18px 18px;
        overflow: visible;
    }

    #delete-confirm-modal .modal__close {
        top: 14px;
        right: 14px;
    }

    #permissions-modal {
        place-items: center;
        padding: 18px;
    }
}

@media (max-width: 1024px) and (orientation: portrait) {
    .booking-launch-wrap {
        min-height: 100%;
    }

    .booking-results {
        padding-right: 0;
        padding-bottom: 8px;
        min-height: 100%;
    }

    .booking-results .demo-stack {
        min-height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 8px;
    }

    .ride-summary-grid {
        gap: 6px;
    }

    .ride-summary-card {
        min-height: 54px;
        padding: 8px 10px;
        border-radius: 14px;
    }

    .ride-summary-card small {
        margin-bottom: 4px;
        font-size: 0.62rem;
    }

    .ride-summary-card strong {
        font-size: 0.86rem;
    }

    .ride-details-card {
        padding: 10px;
        border-radius: 16px;
    }

    .ride-details-card__header {
        margin-bottom: 8px;
    }

    .ride-details-card__header strong {
        font-size: 0.92rem;
    }

    .ride-details-grid {
        gap: 6px;
    }

    .ride-details-item {
        min-height: 54px;
        padding: 8px 10px;
        border-radius: 14px;
    }

    .ride-details-item small {
        margin-bottom: 4px;
        font-size: 0.62rem;
    }

    .ride-details-item strong {
        font-size: 0.84rem;
    }

    .ride-plans-shell {
        position: static;
        margin-top: 0;
        border-radius: 18px;
        min-height: 232px;
    }

    .ride-options {
        min-height: 232px;
    }

    .ride-options__loading {
        gap: 12px;
    }

    .ride-options {
        gap: 8px;
        padding: 10px;
        background:
            radial-gradient(circle at top center, rgba(255, 122, 26, 0.14), transparent 44%),
            rgba(18, 22, 20, 0.95);
        box-shadow:
            0 14px 28px rgba(0, 0, 0, 0.18),
            0 0 0 1px rgba(255, 255, 255, 0.06);
    }

    .driver-option {
        padding: 14px 14px;
        border-radius: 16px;
    }

    .driver-option strong {
        font-size: 1rem;
    }

    .driver-option small {
        font-size: 0.78rem;
    }

    .driver-option b {
        font-size: 1.08rem;
    }

    #trip-preview-modal {
        place-items: center;
        padding: 16px;
    }

    #trip-preview-modal .modal__dialog {
        width: min(100%, 420px);
        padding: 52px 14px 14px;
    }

    .trip-preview-map {
        min-height: 300px;
        border-radius: 20px;
    }

    .trip-preview-bike {
        width: 34px;
        height: 34px;
    }
}
