html.light-mode #tp-modal { background: #f8fafc; border-color: rgba(27,102,177,0.15); box-shadow: 0 24px 80px rgba(0,0,0,0.15); }
html.light-mode #tp-modal-header { background: #f8fafc; border-bottom-color: rgba(0,0,0,0.07); }
html.light-mode #tp-modal-title { color: #0D1825; }
html.light-mode #tp-modal-close { color: #2A3F58; }
html.light-mode .tp-label { color: #2A3F58; }
html.light-mode .tp-autocomplete input { background: #fff; border-color: rgba(0,0,0,0.12); color: #0D1825; }
html.light-mode .tp-autocomplete input.has-val { border-color: rgba(27,102,177,0.4); color: #0D1825; }
html.light-mode .tp-dropdown { background: #fff; border-color: rgba(0,0,0,0.10); box-shadow: 0 8px 32px rgba(0,0,0,0.12); }
html.light-mode .tp-drop-item { color: #0D1825; }
html.light-mode .tp-drop-item:hover { background: rgba(27,102,177,0.08); }
html.light-mode .tp-swap-btn { background: #fff; border-color: rgba(0,0,0,0.12); color: #2A3F58; }
html.light-mode .tp-input-small { background: #fff; border-color: rgba(0,0,0,0.12); color: #0D1825; }
html.light-mode .tp-trip-card { background: #fff; border-color: rgba(0,0,0,0.10); }
html.light-mode .tp-trip-card:hover { border-color: rgba(27,102,177,0.3); }
html.light-mode .tp-trip-times { color: #0D1825; }
html.light-mode .tp-trip-meta { color: #2A3F58; }
html.light-mode .tp-legs { border-top-color: rgba(0,0,0,0.07); }
html.light-mode .tp-leg { border-bottom-color: rgba(0,0,0,0.05); }
html.light-mode .tp-leg-stop { color: #0D1825; }
html.light-mode .tp-leg-dir,
html.light-mode .tp-status { color: #2A3F58; }
html.light-mode .tp-leg-time { color: #0D1825; }
html.light-mode .tp-status.loading::after { border-color: rgba(0,0,0,0.10); border-top-color: #1B66B1; }
html.light-mode .tp-leg-walk { background: rgba(27,102,177,0.06); }
html.light-mode .tp-search-btn { background: rgba(27,102,177,0.12); border-color: rgba(27,102,177,0.35); color: #0D1825; }
html.light-mode .tp-search-btn:hover { background: rgba(27,102,177,0.20); }
#tp-modal-overlay{display:none;position:fixed;inset:0;z-index:9200;background:rgba(0,0,0,.65);backdrop-filter:blur(4px);align-items:center;justify-content:center;padding:12px;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;}
#tp-modal-overlay.active{display:flex;}
#tp-modal{background:#080e1a;border:1px solid rgba(59,158,255,.18);border-radius:14px;width:min(420px, calc(100vw - 24px));max-width:min(100%, calc(100vw - 24px));max-height:min(calc(var(--sl-visual-viewport-height, 100dvh) - 24px), 90vh);overflow-y:auto;scrollbar-width:thin;scrollbar-color:#4a6a8a transparent;box-shadow:0 24px 80px rgba(0,0,0,.9);overscroll-behavior:contain;-webkit-overflow-scrolling:touch;}
#tp-modal-header{display:flex;align-items:center;justify-content:space-between;padding:14px 18px 10px;border-bottom:1px solid rgba(255,255,255,.06);position:sticky;top:0;background:#080e1a;z-index:1;}
#tp-modal-title{font-family:"DM Mono",monospace;font-size:13px;letter-spacing:.15em;text-transform:uppercase;color:#b0d0e8;}
#tp-modal-close{background:none;border:none;color:#9ab8d0;cursor:pointer;font-size:16px;padding:2px 8px;}
#tp-modal-close:hover{color:#e2ecf8;}
#tp-modal-body{padding:16px 18px 20px;}
.tp-field-group{display:flex;flex-direction:column;gap:10px;position:relative;}
.tp-field{display:flex;flex-direction:column;gap:4px;}
.tp-label{font-size:11px;letter-spacing:.16em;text-transform:uppercase;color:#9ab8d0;font-family:"DM Mono",monospace;}
.tp-autocomplete{position:relative;}
.tp-autocomplete input{width:100%;background:#0d1827;border:1px solid #1a2e44;border-radius:7px;color:#e2ecf8;font-family:"DM Mono",monospace;font-size:13px;padding:9px 12px;outline:none;transition:border-color .15s,box-shadow .15s;box-sizing:border-box;}
.tp-autocomplete input:focus{border-color:rgba(59,158,255,.5);box-shadow:0 0 0 2px rgba(59,158,255,.12);}
.tp-autocomplete input.has-val{border-color:rgba(59,158,255,.35);color:#b8d8ff;}
.tp-dropdown{position:absolute;top:calc(100% + 3px);left:0;right:0;background:#0d1827;border:1px solid #1a2e44;border-radius:8px;overflow:hidden;max-height:min(260px, calc(var(--sl-visual-viewport-height, 100dvh) - 220px));overflow-y:auto;z-index:100;box-shadow:0 8px 32px rgba(0,0,0,.7);display:none;}
.tp-dropdown.open{display:block;}
.tp-drop-item{padding:8px 12px;font-size:13px;color:#b0d0e8;cursor:pointer;font-family:"DM Mono",monospace;transition:background .12s,color .12s;}
.tp-drop-item:hover{background:rgba(59,158,255,.12);color:#e2ecf8;}
.tp-swap-btn{align-self:center;margin-top:10px;background:#0d1827;border:1px solid #1a2e44;border-radius:50%;width:28px;height:28px;color:#9ab8d0;cursor:pointer;font-size:14px;display:flex;align-items:center;justify-content:center;transition:all .15s;flex-shrink:0;}
.tp-swap-btn:hover{border-color:rgba(59,158,255,.4);color:#b0d0e8;background:rgba(59,158,255,.1);}
.tp-time-row{display:flex;align-items:flex-end;gap:8px;margin-top:14px;flex-wrap:wrap;}.tp-time-row>*{min-width:0;}
.tp-field-small{display:flex;flex-direction:column;gap:4px;flex:1 1 130px;min-width:0;}
.tp-input-small{background:#0d1827;border:1px solid #1a2e44;border-radius:7px;color:#e2ecf8;font-family:"DM Mono",monospace;font-size:13px;padding:8px 10px;outline:none;width:100%;max-width:100%;min-width:0;transition:border-color .15s;box-sizing:border-box;}
.tp-input-small:focus{border-color:rgba(59,158,255,.5);}
.tp-search-btn{flex:1 1 180px;background:rgba(59,158,255,.15);border:1px solid rgba(59,158,255,.4);border-radius:7px;color:#b0d0e8;font-family:"DM Mono",monospace;font-size:13px;letter-spacing:.08em;padding:9px 14px;cursor:pointer;transition:all .15s;white-space:nowrap;min-height:42px;display:inline-flex;align-items:center;justify-content:center;}
.tp-search-btn:hover{background:rgba(59,158,255,.25);color:#e2ecf8;}
.tp-search-btn:disabled{opacity:.4;cursor:not-allowed;}
#tp-results{margin-top:18px;}
.tp-trip-card{background:#0d1827;border:1px solid #1a2e44;border-radius:12px;padding:13px 14px;margin-bottom:10px;cursor:pointer;transition:border-color .15s,box-shadow .15s,transform .15s;touch-action:manipulation;}
.tp-trip-card:hover{border-color:rgba(59,158,255,.3);box-shadow:0 10px 30px rgba(0,0,0,.14);}
.tp-trip-card:focus-visible{outline:2px solid rgba(59,158,255,.55);outline-offset:2px;border-color:rgba(59,158,255,.45);}
.tp-trip-card.open .tp-legs{display:block;}
.tp-trip-card.open .tp-trip-expand{background:rgba(59,158,255,.16);border-color:rgba(59,158,255,.35);color:#e2ecf8;}
.tp-trip-header{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;}
.tp-trip-main{flex:1;min-width:0;}
.tp-trip-times{font-family:"Syne",sans-serif;font-size:18px;font-weight:700;color:#e2ecf8;letter-spacing:-.01em;line-height:1.1;}
.tp-trip-times span{color:#3B9EFF;}
.tp-trip-meta{font-size:12px;color:#9ab8d0;font-family:"DM Mono",monospace;display:flex;gap:8px;align-items:center;flex-wrap:wrap;justify-content:flex-end;}
.tp-trip-meta-chip{white-space:nowrap;}
.tp-trip-expand{display:inline-flex;align-items:center;justify-content:center;padding:4px 9px;border-radius:999px;border:1px solid rgba(59,158,255,.2);background:rgba(59,158,255,.07);color:#b8d8ff;white-space:nowrap;}
.tp-trip-lines{display:flex;gap:4px;flex-wrap:wrap;margin-top:7px;min-width:0;}
.tp-line-chip{font-size:12px;font-weight:700;padding:2px 7px;border-radius:5px;font-family:"DM Mono",monospace;flex:0 0 auto;}
.tp-line-sep{color:#4a6a8a;font-size:12px;margin:0 2px;align-self:center;flex:0 0 auto;}
.tp-legs{display:none;margin-top:12px;border-top:1px solid rgba(255,255,255,.05);padding-top:10px;}
.tp-leg{display:grid;grid-template-columns:36px minmax(0,1fr) auto;gap:10px;padding:8px 0;border-bottom:1px solid rgba(255,255,255,.03);align-items:start;}
.tp-leg:last-child{border-bottom:none;}
.tp-leg-line{display:flex;flex-direction:column;align-items:center;gap:3px;flex-shrink:0;width:36px;}
.tp-leg-chip{font-size:12px;font-weight:700;padding:2px 5px;border-radius:4px;font-family:"DM Mono",monospace;text-align:center;min-width:28px;}
.tp-leg-chip-walk{font-size:14px;padding:3px 4px;}
.tp-leg-info{min-width:0;}
.tp-leg-stop{font-size:13px;color:#b0d0e8;font-family:"DM Mono",monospace;word-break:break-word;}
.tp-leg-stop-secondary{margin-top:4px;color:#9ab8d0;}
.tp-leg-dir{font-size:12px;color:#9ab8d0;font-family:"DM Mono",monospace;margin-top:1px;word-break:break-word;}
.tp-leg-time{font-size:13px;color:#e2ecf8;font-family:"DM Mono",monospace;white-space:nowrap;flex-shrink:0;display:flex;flex-direction:column;align-items:flex-end;gap:2px;text-align:right;}
.tp-leg-time-primary{color:#e2ecf8;}
.tp-leg-time-secondary{color:#9ab8d0;}
.tp-leg-walk{background:rgba(42,64,96,0.15);border-radius:8px;margin:4px 0;padding:9px 8px !important;}
.tp-leg-walk-title{font-size:13px;color:#b0d0e8;font-family:"DM Mono",monospace;}
.tp-leg-walk-meta{display:flex;gap:10px;margin-top:3px;align-items:center;flex-wrap:wrap;}
.tp-leg-walk-distance{font-size:13px;font-weight:700;color:#e2ecf8;font-family:"DM Mono",monospace;}
.tp-leg-walk-duration{font-size:13px;color:#7ab0cc;font-family:"DM Mono",monospace;}
.tp-leg-walk-range{font-size:12px;color:#9ab8d0;font-family:"DM Mono",monospace;margin-top:3px;word-break:break-word;}
.tp-status{padding:20px;text-align:center;font-size:13px;color:#9ab8d0;font-family:"DM Mono",monospace;}
.tp-status.loading::after{content:'';display:inline-block;width:14px;height:14px;border:2px solid #1a2e44;border-top-color:#3B9EFF;border-radius:50%;animation:spin .7s linear infinite;margin-left:8px;vertical-align:middle;}
.tp-products{display:flex;flex-wrap:wrap;gap:8px;margin-top:8px;}
.tp-product-chip{background:#0d1827;border:1px solid #1a2e44;border-radius:999px;color:#9ab8d0;font-family:"DM Mono",monospace;font-size:12px;padding:7px 10px;cursor:pointer;transition:all .15s;}
.tp-product-chip.on{background:rgba(59,158,255,.14);border-color:rgba(59,158,255,.45);color:#d9ebff;}
.tp-product-chip:hover{border-color:rgba(59,158,255,.35);color:#e2ecf8;}
.tp-trip-summary{margin-top:7px;display:flex;flex-wrap:wrap;gap:8px;}
.tp-summary-chip{font-size:11px;color:#8ab4cc;background:rgba(27,102,177,.08);border:1px solid rgba(27,102,177,.18);border-radius:999px;padding:4px 8px;font-family:"DM Mono",monospace;}
@media (max-width: 940px) and (hover: none), (max-height: 520px) and (hover: none), (max-width: 600px) {
    #tp-modal-overlay {
        align-items: flex-end;
        justify-content: center;
        padding: max(12px, env(safe-area-inset-top)) 0 env(safe-area-inset-bottom);
    }
    #tp-modal {
        width: 100%;
        max-width: 100%;
        margin: 0;
        border-radius: 20px 20px 0 0;
        border-bottom: none;
        max-height: calc(var(--sl-visual-viewport-height, 100dvh) - max(12px, env(safe-area-inset-top)));
        scroll-padding-bottom: calc(112px + env(safe-area-inset-bottom));
    }
    #tp-modal-body {
        padding: 16px 14px calc(20px + env(safe-area-inset-bottom));
    }
    .tp-time-row {
        gap: 10px;
    }
    .tp-field-small {
        flex: 1 1 calc(50% - 10px);
    }
    .tp-search-btn {
        flex-basis: 100%;
        width: 100%;
    }
    .tp-autocomplete input,
    .tp-input-small {
        font-size: 16px;
    }
    .tp-trip-card {
        padding: 12px 12px 11px;
        border-radius: 14px;
    }
    .tp-trip-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .tp-trip-meta {
        width: 100%;
        justify-content: space-between;
    }
    .tp-trip-expand {
        margin-left: auto;
    }
    .tp-dropdown {
        max-height: min(240px, calc(var(--sl-visual-viewport-height, 100dvh) - 260px));
    }
    .tp-trip-lines {
        flex-wrap: nowrap;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 2px;
        scrollbar-width: none;
    }
    .tp-trip-lines::-webkit-scrollbar {
        display: none;
    }
    .tp-trip-summary {
        gap: 6px;
    }
    .tp-summary-chip {
        padding: 5px 8px;
    }
    .tp-leg {
        grid-template-columns: 34px minmax(0, 1fr) auto;
        gap: 8px 10px;
        padding: 10px 0;
    }
    .tp-leg-line {
        width: 34px;
    }
    .tp-leg-time {
        font-size: 12px;
    }
    .tp-leg-walk {
        padding: 10px 8px !important;
    }
}
@media (max-width: 420px) and (hover: none), (max-width: 420px) {
    .tp-field-small { flex-basis: 100%; }
    .tp-trip-times {
        font-size: 17px;
    }
    .tp-trip-meta {
        gap: 6px;
    }
    .tp-trip-expand {
        order: 10;
        width: 100%;
        justify-content: center;
    }
    .tp-trip-meta-chip {
        white-space: normal;
    }
    .tp-leg {
        grid-template-columns: 34px minmax(0, 1fr);
    }
    .tp-leg-time {
        grid-column: 2;
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        gap: 10px;
        text-align: left;
        white-space: normal;
        margin-top: 2px;
    }
}
