:root {
    --bg-app: #050505;
    --surface-glass: rgba(11, 14, 20, 0.85);
    --surface-solid: #0b0e14;
    --border-glass: rgba(255, 255, 255, 0.05);
    --accent: #FACC15;
    --accent-glow: rgba(250, 204, 21, 0.3);
    --blue: #3B82F6;
    --red: #EF4444;
    --orange: #F97316;
    --green: #10B981;
    --text-main: #F8FAFC;
    --text-muted: #475569;
    --panel-w: 420px;
    --radius-lg: 16px;
    --radius-md: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg-app);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
}

#map {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: #020617;
}

.ui-layer {
    position: absolute;
    inset: 0;
    z-index: 10;
    pointer-events: none;
    display: flex;
    padding: 24px;
    gap: 24px;
}

.ui-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    pointer-events: none;
}

.ui-right {
    position: absolute;
    top: 24px;
    right: 24px;
    bottom: 24px;
    pointer-events: none;
}

.ui-right .panel {
    height: 100%;
}

.glass-panel {
    pointer-events: auto;
    background: var(--surface-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 70px rgba(0, 0, 0, .65);
}

.search-accordion.glass-panel {
    max-width: 400px;
}

header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    align-self: flex-start;
    width: 100%;
    max-width: 400px;
    background: linear-gradient(135deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .02));
}

.brand-wrap{
    display:flex;
    align-items:center;
    gap:12px;
}

.brand-image{
    width:50px;
    aspect-ratio:1 / 1;
    border-radius:50%;
    object-fit:contain; /* or cover */
    flex-shrink:0;
}

.logo {
    font-family: 'Space Mono', monospace;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #fff 0%, #94A3B8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo span {
    color: var(--accent);
    -webkit-text-fill-color: var(--accent);
}

.header-sub {
    font-size: 13px;
    color: #64748b;
    margin-top: 2px;
}

.live-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    font-weight: 700;
    color: var(--green);
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    padding: 6px 12px;
    border-radius: 30px;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.2);
}

.live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green);
    animation: pulse 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.4;
        transform: scale(0.8);
    }
}

.station-search {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 24px;
    align-self: flex-start;
    width: 100%;
    max-width: 400px;
}

.search-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.search-header h4 {
    font-size: 14px;
    color: var(--text-main);
    font-weight: 600;
}

.search-input {
    width: 100%;
    height: 44px;
    line-height: 20px;
    vertical-align: middle;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    padding: 10px 14px;
    color: var(--text-main);
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
}

.search-input:focus {
    border-color: var(--accent);
    background: rgba(0, 0, 0, 0.5);
    box-shadow: 0 0 10px rgba(250, 204, 21, 0.1);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    color: var(--text-main);
    padding: 8px 12px;
    border-radius: 8px;
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-secondary:hover {
    background: var(--text-main);
    color: var(--bg-app);
}

.station-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 220px;
    overflow-y: auto;
    padding-right: 4px;
}

.station-item {
    padding: 12px 14px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.station-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--accent);
    transform: translateX(4px);
}

.panel {
    width: var(--panel-w);
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateX(120%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.panel.open {
    transform: translateX(0);
}

.panel-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
    gap: 16px;
    color: #64748b;
}

.panel-empty .icon {
    font-size: 56px;
    filter: grayscale(1) opacity(0.3);
}

.panel-empty h3 {
    font-size: 18px;
    color: var(--text-main);
    font-weight: 600;
}

.panel-empty p {
    font-size: 14px;
    line-height: 1.6;
}

.train-detail {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.detail-header {
    padding: 24px 24px 16px;
    border-bottom: 1px solid var(--border-glass);
    position: relative;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02) 0%, transparent 100%);
}

.detail-train-num {
    font-family: 'DM Sans', sans-serif;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.2;
}

.detail-train-id {
    font-size: 13px;
    color: #64748b;
    margin-top: 4px;
    font-weight: 500;
}

.detail-sections {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    padding: 16px 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.station-table-wrapper {
    padding: 0 12px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}

/* TIMELINE AND TABLE DESIGN */
.timetable-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

.timetable-table th {
    padding: 10px 10px;
    color: #cbd5e1;
    font-weight: 700;
    font-size: 11px;
    font-family: 'Space Mono', monospace;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    position: sticky;
    top: 0;
    background: #0b0e14;
    z-index: 10;
}

.timetable-table td {
    padding: 12px 10px;
    color: #f1f5f9;
    vertical-align: middle;
    position: relative;
}

.timetable-table td i {
    color: #fef08a;
    font-style: italic;
}

.timeline-cell {
    width: 32px;
    padding: 0 !important;
    text-align: center;
}

.timeline-line {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #1e293b;
    transform: translateX(-50%);
    z-index: 1;
}

.timeline-line.active {
    background: #3b82f6;
}

.timeline-line.split-top {
    bottom: 50%;
    background: #3b82f6;
}

.timeline-line.split-bottom {
    top: 50%;
    background: #1e293b;
}

.timetable-table tr:first-child .timeline-line {
    top: 50%;
}

.timetable-table tr:last-child .timeline-line {
    bottom: 50%;
}

.timeline-dot {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #0b0e14;
    border: 2px solid #334155;
    transform: translate(-50%, -50%);
    z-index: 2;
    transition: all 0.3s ease;
}

.timeline-dot.passed {
    background: #3b82f6;
    border-color: #3b82f6;
}

.timeline-dot.current {
    background: #22c55e;
    border-color: #22c55e;
    box-shadow: 0 0 12px #22c55e;
    width: 12px;
    height: 12px;
}

.station-name-text {
    font-size: 13.5px;
    font-weight: 500;
    color: #cbd5e1;
}

.station-name-text.passed {
    color: #64748b;
}

.station-name-text.current {
    color: #22c55e;
    font-weight: 600;
}

.station-name-text.terminal {
    color: var(--accent);
}

.time-stack {
    display: flex;
    flex-direction: column;
    font-family: 'Space Mono', monospace;
    font-size: 13px;
    line-height: 1.2;
}

.time-sched-muted {
    font-size: 11px;
    color: #475569;
    margin-bottom: 2px;
}

.time-actual-item {
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.time-actual-item.ontime {
    color: #22c55e;
}

.time-actual-item.late {
    color: #ef4444;
}

.time-actual-item.early {
    color: #3b82f6;
}

.time-actual-item.future {
    color: #475569;
}

.delay-small-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 4px;
    margin-left: 6px;
    display: inline-block;
}

.time-actual-item.late .delay-small-badge {
    background: rgba(239, 68, 68, 0.25);
    color: #fca5a5;
}

.time-actual-item.early .delay-small-badge {
    background: rgba(59, 130, 246, 0.25);
    color: #93c5fd;
}

.timetable-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-glass);
    font-size: 11px;
    color: #64748b;
    background: rgba(0, 0, 0, 0.15);
}

.leg-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.leg-sq {
    width: 8px;
    height: 8px;
    border-radius: 2px;
}

.leg-sq.early {
    background: #3b82f6;
}

.leg-sq.ontime {
    background: #10B981;
}

.leg-sq.late {
    background: #EF4444;
}

.leg-sq.est-ontime {
    background: #34D399;
}

.leg-sq.est-late {
    background: #F97316;
}

/* Fallback / Search Station table */
.station-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

.station-table th {
    padding: 12px 10px;
    color: #64748b;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-glass);
}

.station-table td {
    padding: 12px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    vertical-align: middle;
}

.table-vszam {
    font-family: 'Space Mono', monospace;
    font-weight: 700;
}

.table-viszonylat {
    font-weight: 500;
    color: var(--text-main);
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.table-time-block {
    display: flex;
    flex-direction: column;
    font-size: 12px;
    line-height: 1.3;
}

.info-cell {
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin: 0 12px;
}

.delay-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
}

.delay-ok {
    background: rgba(16, 185, 129, 0.1);
    color: var(--green);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.delay-late {
    background: rgba(239, 68, 68, 0.1);
    color: var(--red);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.delay-early {
    background: rgba(59, 130, 246, 0.1);
    color: var(--blue);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    color: #64748b;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10;
}

.close-btn:hover {
    background: var(--text-main);
    color: var(--bg-app);
    transform: scale(1.05);
}

.emig-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 100000;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.emig-modal {
    width: min(420px, 100%);
    background: rgba(10, 14, 22, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
    padding: 24px;
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: relative;
}

/* Center-align modal content while keeping inputs full-width */
.emig-modal {
    align-items: center;
    text-align: center;
}

.emig-modal label,
.emig-modal input,
.emig-modal .emig-modal-buttons {
    width: 100%;
    max-width: 380px;
}

.emig-modal .emig-modal-buttons {
    justify-content: center;
    display: flex;
}

.emig-modal h3,
.emig-modal p,
.emig-modal h4 {
    text-align: center;
}

.emig-modal h3 {
    margin: 0;
    font-size: 20px;
}

.emig-modal p {
    margin: 0;
    color: #94a3b8;
    font-size: 14px;
    line-height: 1.5;
}

.emig-modal label {
    font-size: 13px;
    color: #cbd5e1;
}

.emig-modal input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 12px 14px;
    color: var(--text-main);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.emig-modal input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 6px rgba(250, 204, 21, 0.12);
}

.emig-modal-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.emig-modal-buttons button {
    flex: 1;
    min-width: 120px;
}

.error-message {
    min-height: 20px;
    font-size: 13px;
    color: #f87171;
}

.marker-holder {
    position: relative;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.marker-holder:hover {
    transform: scale(1.2);
    z-index: 1000 !important;
}

.train-marker {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 255, 255, 0.9);
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
    overflow: hidden;
    z-index: 2;
}

.leaflet-tooltip {
    background: #12141c !important;
    color: #F8FAFC !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: 8px !important;
    padding: 10px 12px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.leaflet-tooltip-top:before {
    border-top-color: #12141c !important;
}

.leaflet-control-zoom {
    border: none !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4) !important;
    margin-left: 24px !important;
    margin-bottom: 24px !important;
}

.leaflet-control-zoom a {
    background: var(--surface-glass) !important;
    color: var(--text-main) !important;
    border-color: var(--border-glass) !important;
}

.leaflet-control-zoom a:hover {
    background: rgba(255, 255, 255, 0.1) !important;
}

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.search-accordion {
    overflow: hidden;
}

.accordion-header {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-main);
    padding: 16px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    font-weight: 600;
}

.accordion-header:hover {
    background: rgba(255, 255, 255, 0.04);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s ease;
}

.search-accordion.open .accordion-content {
    max-height: 700px;
}

.accordion-arrow {
    transition: transform .3s ease;
}

.search-accordion.open .accordion-arrow {
    transform: rotate(180deg);
}

#compositionModal,
#timetableModal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999;
}

.composition-box {
    width: 700px;
    max-width: 90vw;
    height: auto;
    max-height: 90vh;
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.composition-header {
    padding: 20px;
    font-size: 20px;
    font-weight: 700;
    border-bottom: 1px solid var(--border-glass);
}

.composition-search {
    padding: 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

#compositionResults,
#timetableResults {
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    min-height: 0;
    max-height: calc(100% - 160px);
    width: 100%;
}

.btn-primary {
    background: var(--accent);
    color: #000;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    font-family: 'DM Sans', sans-serif;
    font-weight: 700;
    cursor: pointer;
    transition: .2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 15px var(--accent-glow);
}

.loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    flex-shrink: 0;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-message {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-main);
    font-size: 14px;
}

.modal-empty-message {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    min-height: 100%;
    width: 100%;
    gap: 10px;
}

.composition-search input {
    flex: 1;
    min-width: 160px;
    background: rgba(0, 0, 0, .3);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    padding: 10px 14px;
    color: var(--text-main);
}

.vtk-card {
    background: rgba(255, 255, 255, .03);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    margin-bottom: 10px;
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
}

.vtk-body {
    padding: 16px;
    min-width: 0;
}

.vtk-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.vtk-uic {
    font-family: 'Space Mono', monospace;
    font-size: 14px;
    font-weight: 700;
    color: var(--accent);
}

.railway-monochrome {
    filter: grayscale(100%) brightness(0.9) contrast(1.2);
    opacity: 0.35;
}



/* ==========================================================================
   RESPONSIVE & MOBILE STYLES
   ========================================================================== */

/* ── Mobile search drawer toggle button ── */
.mobile-search-toggle {
    display: none;
}

/* ── Mobile search drawer overlay ── */
.mobile-search-overlay {
    display: none;
}

@media (max-width: 768px) {
    :root {
        --panel-w: 100%;
    }

    .ui-layer {
        padding: 0;
        pointer-events: none;
    }

    .ui-left {
        display: none;
    }

    /* ── Floating search button (top-left) ── */
    .mobile-search-toggle {
        display: flex;
        position: fixed;
        top: 56px;
        left: 16px;
        bottom: unset;
        z-index: 200;
        width: 44px;
        height: 44px;
        border-radius: 12px;
        background: var(--surface-glass);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border: 1px solid rgba(255,255,255,.12);
        box-shadow: 0 4px 16px rgba(0,0,0,.5);
        color: var(--text-main);
        font-size: 20px;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        pointer-events: auto;
        transition: transform .15s ease;
    }

    .mobile-search-toggle:active {
        transform: scale(0.93);
    }

    /* ── Search drawer (slides up from bottom) ── */
    .mobile-search-overlay {
        display: flex;
        flex-direction: column;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 300;
        height: 55vh;
        background: var(--surface-glass);
        backdrop-filter: blur(24px);
        -webkit-backdrop-filter: blur(24px);
        border-top: 1px solid rgba(255,255,255,.1);
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -8px 40px rgba(0,0,0,.7);
        pointer-events: auto;
        transform: translateY(100%);
        transition: transform .35s cubic-bezier(0.16, 1, 0.3, 1);
        overflow: hidden;
    }

    .mobile-search-overlay.open {
        transform: translateY(0);
    }

    .mobile-search-handle {
        display: flex;
        justify-content: center;
        padding: 10px 0 8px;
        cursor: grab;
        flex-shrink: 0;
        touch-action: none;
    }

    .mobile-search-handle::after {
        content: '';
        width: 40px;
        height: 4px;
        border-radius: 2px;
        background: rgba(255,255,255,.25);
    }

    .mobile-search-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 20px 12px;
        border-bottom: 1px solid var(--border-glass);
        flex-shrink: 0;
    }

    .mobile-search-header-logo {
        font-family: 'Space Mono', monospace;
        font-size: 16px;
        font-weight: 700;
        background: linear-gradient(135deg, #fff 0%, #94A3B8 100%);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
    }

    .mobile-search-header-logo span {
        -webkit-text-fill-color: var(--accent);
    }

    .mobile-search-close {
        width: 32px;
        height: 32px;
        border-radius: 50%;
        background: rgba(255,255,255,.06);
        border: 1px solid var(--border-glass);
        color: var(--text-main);
        font-size: 14px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .mobile-search-body {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        flex: 1;
        padding: 8px 0 20px;
        min-height: 0;
    }

    .mobile-search-body .search-accordion {
        border-radius: 0;
        border-left: none;
        border-right: none;
        border-top: none;
        background: transparent;
        box-shadow: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        max-width: 100%;
    }

    .mobile-search-body .search-accordion + .search-accordion {
        border-top: 1px solid var(--border-glass);
    }

    .mobile-search-body .station-search {
        max-width: 100%;
        padding: 12px 20px;
    }

    /* ── Bottom sheet panel ── */
    .ui-right {
        position: fixed;
        inset: 0;
        z-index: 150;
        pointer-events: none;
        padding: 0;
        height: 100%;
        display: flex;
        align-items: flex-end;
    }

    .panel {
        width: 100%;
        height: 55vh;
        border-radius: 20px 20px 0 0;
        transform: translateY(100%);
        transition: transform .4s cubic-bezier(0.16, 1, 0.3, 1);
        position: relative;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    .panel.open {
        transform: translateY(0);
        pointer-events: auto;
    }

    /* Drag handle inside the panel at the top — same style as search drawer */
    .panel-drag-handle {
        position: relative;
        top: unset;
        left: unset;
        right: unset;
        width: 100%;
        height: 28px;
        cursor: grab;
        z-index: 10;
        pointer-events: auto;
        display: flex;
        align-items: center;
        justify-content: center;
        touch-action: none;
        flex-shrink: 0;
        background: transparent;
    }

    .panel-drag-handle::after {
        content: '';
        width: 40px;
        height: 4px;
        border-radius: 2px;
        background: rgba(255,255,255,.25);
    }

    #panelContent {
        flex: 1;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        min-height: 0;
    }

    .close-btn {
        top: 12px;
        right: 12px;
    }

    .composition-box {
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        max-width: 100vw;
        border-radius: 0;
    }

    .composition-search {
        flex-direction: column;
        align-items: stretch;
    }

    .composition-search input,
    .btn-primary {
        width: 100%;
    }

    .station-table-wrapper {
        overflow-x: auto;
        padding: 0 8px;
    }

    .timetable-table th,
    .timetable-table td,
    .station-table th,
    .station-table td {
        padding: 8px 6px;
        font-size: 12px;
    }

    .leaflet-control-zoom {
        margin-left: 12px !important;
        margin-bottom: 16px !important;
        margin-top: 0 !important;
        transform: scale(0.9);
        transform-origin: bottom left;
    }
}

/* ── Mobile top header (always visible) ── */
.mobile-top-header {
    display: none;
}

@media (max-width: 768px) {
    .mobile-top-header {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 12px;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 120;
        padding: 10px 20px;
        background: rgba(5, 5, 5, 0.75);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border-bottom: 1px solid rgba(255,255,255,.06);
        pointer-events: none;
    }

    .mobile-top-logo {
        font-family: 'Space Mono', monospace;
        font-size: 17px;
        font-weight: 700;
        background: linear-gradient(135deg, #fff 0%, #94A3B8 100%);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
    }

    .mobile-top-logo span {
        -webkit-text-fill-color: var(--accent);
    }

    /* Push map content below the fixed header */
    #map {
        top: 44px;
    }

    /* Drawer search accordion styling */
    .mobile-search-body .search-accordion {
        border-bottom: 1px solid var(--border-glass);
    }
}

@media (min-width: 769px) {
    .panel {
        height: 100% !important; 
    }
}

.vtk-uic-row{
  display:flex;
  align-items:center;
  margin:auto;
  justify-content:space-between;
  gap:12px;
}

.copy-uic-btn{
  width:34px;
  height:34px;

  border:none;
  border-radius:10px;

  background:rgba(255,255,255,.06);
  color:#fff;

  cursor:pointer;

  transition:
    transform .15s,
    background .2s,
    box-shadow .2s;

  font-size:16px;
}

.copy-uic-btn:hover{
  background:rgba(255,255,255,.12);
  transform:scale(1.08);
}

.copy-uic-btn:active{
  transform:scale(.92);
}

.copy-uic-btn.copied{
  background:#10B981;
  box-shadow:0 0 14px rgba(16,185,129,.45);
}

.loading-overlay{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.45);
  backdrop-filter:blur(8px);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:99999;
}

.loading-box{
  background:#111827;
  border:1px solid rgba(255,255,255,.1);
  border-radius:20px;
  padding:28px 40px;
  text-align:center;
}

.loading-spinner{
  width:42px;
  height:42px;
  border:4px solid rgba(255,255,255,.15);
  border-top-color:#3b82f6;
  border-radius:50%;
  margin:auto;
  animation:spin 1s linear infinite;
}

.loading-title{
  margin-top:18px;
  font-size:20px;
  font-weight:700;
}

.loading-subtitle{
  margin-top:6px;
  color:#94a3b8;
  font-size:14px;
}

@keyframes spin{
  to{
    transform:rotate(360deg);
  }
}