/* TågLive v0.16.0: visual-only refinement, preserving existing control IDs and layout. */
:root{color-scheme:dark;--tl-bg:#0d1726;--tl-panel:#111e30;--tl-card:#1b293c;--tl-border:#35465d;--tl-muted:#b1c0d3;--tl-green:#86efac}
body{font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;line-height:1.45;color:#edf4ff;background:var(--tl-bg)}
header{background:var(--tl-bg);border-color:var(--tl-border)}
#sidebar{background:var(--tl-panel);scrollbar-color:#50637a var(--tl-panel);scrollbar-width:thin}
#main-nav,#sheet-handle{background:var(--tl-panel)}
#sidebar h2{font-size:clamp(21px,1.7vw,25px);line-height:1.25;overflow-wrap:anywhere;letter-spacing:-.35px}
#sidebar h3{line-height:1.35;overflow-wrap:anywhere}
#sidebar label{font-size:13px;font-weight:550;margin-bottom:7px}
#sidebar input:not([type=checkbox]),#sidebar select{min-height:44px;border-radius:10px;background:var(--tl-card);border:1px solid var(--tl-border);color:#edf4ff;font-size:14px;max-width:100%}
#sidebar input::placeholder{color:#9baec5;opacity:1}
#sidebar button,#country-tools button,#nearby-panel button{border-radius:10px;line-height:1.35}
#sidebar button:not(.nav-arrow){min-height:44px}
button:disabled:not(.nav-arrow):not(.tools-arrow){opacity:.42;cursor:not-allowed;filter:saturate(.25)}
button:disabled:hover{border-color:var(--tl-border)}
button:focus-visible,input:focus-visible,select:focus-visible,summary:focus-visible,a:focus-visible{outline:2px solid #86efac;outline-offset:2px}
.muted,small,dt,footer{color:var(--tl-muted)}
#sidebar .detailhead{gap:12px;align-items:flex-start}
#sidebar .detailhead h2{margin:0;min-width:0}
#sidebar .detailhead button{flex:0 0 42px;min-width:42px;padding:0;line-height:1;font-size:21px}
#sidebar .action-row{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
#sidebar .action-row button{min-width:0;width:100%;margin:0;overflow-wrap:anywhere}
#sidebar .action-row :is(.fi-map-focus,.no-map-focus){grid-column:1/-1}
#results .smart-train-result,#station-results button,.trip-options button{background:var(--tl-card);border-color:var(--tl-border);border-radius:10px;min-height:46px}
#results .smart-train-top strong{font-size:14px;line-height:1.35}
.smart-train-route{line-height:1.5;color:var(--tl-muted)}
.stats-tile,.trip-card,.next-card,.traffic-card,.dated-card{border-radius:12px;border-color:var(--tl-border);background:var(--tl-card)}
#country-tools,#nearby-panel,.legend{border:1px solid var(--tl-border);border-radius:12px;box-shadow:0 4px 16px #07111f35}
#country-tools select{min-height:34px}
#nearby-panel{scrollbar-color:#50637a var(--tl-panel);scrollbar-width:thin}
footer a{color:#9acbff;text-underline-offset:2px;overflow-wrap:anywhere}
footer a:visited{color:#b4c7f7}
#connection-warning{line-height:1.4;box-shadow:0 3px 12px #0003}
/* Reserve a separate strip below the controls on narrow maps. */
@media(max-width:700px){
 #connection-warning{top:82px!important;left:8px!important;right:8px!important;transform:none!important;width:auto!important;max-width:none!important;padding:7px 10px!important;font-size:11px!important;z-index:490!important}
 .mapwrap:has(#connection-warning:not([hidden])) #country-tools:has(#country-content:not([hidden])){z-index:500}
 .mapwrap:has(#connection-warning:not([hidden])) #nearby-panel{top:130px;max-height:calc(100% - 170px)}
 body.sheet-expanded:not(.map-only) #connection-warning{top:4px!important;padding:4px 6px!important}
 #sidebar input:not([type=checkbox]),#sidebar select{font-size:16px}
 #sidebar #sheet-handle button{min-height:36px}
 #sidebar #sheet-handle #sheet-close{min-height:36px}
 header #status{font-size:10px;max-width:125px;white-space:normal;line-height:1.2;text-align:right}
 footer{line-height:1.35;gap:6px;align-items:center}
 footer>span{min-width:0;overflow-wrap:anywhere}
}
@media(prefers-reduced-motion:reduce){button,input,select{transition:none!important;animation:none!important}}
@media(max-width:700px){
 .mapwrap:has(#connection-warning:not([hidden])) #country-tools:has(#country-content:not([hidden])){top:130px;max-height:calc(100% - 145px);overflow:auto}
}

/* Compact desktop delay legend; mobile sheet and attribution stay unchanged. */
@media (min-width:701px){
 .mapwrap .legend{bottom:8px;left:12px;padding:6px 9px;gap:4px 7px;width:max-content;max-width:calc(100% - 24px);font-size:11px;line-height:1.35}
 .mapwrap .legend small{font-size:10px;line-height:1.3}
}
