:root {
	--bg: rgba(18, 22, 30, 0.88);
	--bg2: rgba(255, 255, 255, 0.06);
	--fg: #e9eef5;
	--muted: #9aa6b5;
	--accent: #e3000f;
	--ok: #2ecc71;
	--warn: #f5a623;
	--bad: #ff4d4d;
	--line: rgba(255, 255, 255, 0.1);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; font: 13px/1.4 system-ui, "Segoe UI", Roboto, sans-serif; color: var(--fg);
	background: radial-gradient(ellipse at 50% 30%, #3b2c20 0%, #1d150f 60%, #0d0907 100%); }
#map { position: absolute; inset: 0; }
body.underground #map canvas { filter: saturate(1.1); }

.panel { position: absolute; background: var(--bg); backdrop-filter: blur(10px); border: 1px solid var(--line);
	border-radius: 14px; box-shadow: 0 10px 40px rgba(0,0,0,.45); z-index: 5; }
.hidden { display: none !important; }

#controls { top: 12px; left: 12px; width: 320px; max-height: calc(100% - 24px); display: flex; flex-direction: column; }
#controls header { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
#controls.collapsed .body { display: none; }
#controls .body { overflow-y: auto; padding: 4px 14px 12px; }
h1 { font-size: 15px; margin: 0; letter-spacing: .2px; }
h2 { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin: 14px 0 6px; font-weight: 600; }
h2.clickable { cursor: pointer; }
.sub { color: var(--muted); font-size: 12px; }
.status.ok { color: var(--ok); } .status.err { color: var(--bad); }
.logo { display: flex; gap: 3px; }
.icon-btn { margin-left: auto; background: var(--bg2); border: 1px solid var(--line); color: var(--fg); width: 28px; height: 28px; border-radius: 8px; cursor: pointer; }
.icon-btn:hover { background: rgba(255,255,255,.14); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--bg2); border: 1px solid var(--line); color: var(--fg); padding: 5px 9px; border-radius: 999px; cursor: pointer; font-size: 12px; }
.chip.active { background: var(--accent); border-color: var(--accent); }
.row { display: flex; gap: 6px; }
.toggle-btn { flex: 1; background: var(--bg2); border: 1px solid var(--line); color: var(--fg); padding: 7px 10px; border-radius: 8px; cursor: pointer; font-size: 12px; }
.toggle-btn:hover { background: rgba(255,255,255,.12); }
.toggle-btn.active { background: #8a5a2b; border-color: #c4884b; }
.toggle-btn.small { flex: 0; white-space: nowrap; padding: 5px 9px; }
.slider { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; color: var(--muted); }
.slider input { flex: 1; }
.layers { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; }
.layers label { display: flex; gap: 6px; align-items: center; cursor: pointer; white-space: nowrap; }
.layers .swatch { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.stat { background: var(--bg2); border-radius: 8px; padding: 6px 8px; }
.stat b { display: block; font-size: 16px; }
.stat span { color: var(--muted); font-size: 11px; }

.badge { background: var(--bad); color: #fff; border-radius: 999px; padding: 0 7px; font-size: 11px; margin-left: 6px; }
.disruptions { max-height: 260px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.dis { background: var(--bg2); border-left: 3px solid var(--warn); border-radius: 6px; padding: 6px 8px; cursor: pointer; }
.dis.aufzugsinfo { border-left-color: #6aa9ff; }
.dis .t { font-weight: 600; }
.dis .d { color: var(--muted); font-size: 12px; }

.attrib { color: var(--muted); font-size: 10.5px; margin-top: 14px; line-height: 1.35; }

.search { position: relative; margin-top: 10px; }
.search input { width: 100%; background: var(--bg2); border: 1px solid var(--line); color: var(--fg); padding: 8px 10px; border-radius: 8px; outline: none; }
.search input:focus { border-color: #5b8def; }
.search-results { position: absolute; left: 0; right: 0; top: 38px; background: #1b2130; border: 1px solid var(--line); border-radius: 8px; z-index: 10; max-height: 300px; overflow-y: auto; }
.search-results:empty { display: none; }
.search-results div { padding: 7px 10px; cursor: pointer; display: flex; gap: 8px; align-items: center; }
.search-results div:hover { background: rgba(255,255,255,.08); }

/* Info-Panel */
#info { top: 12px; right: 12px; width: 380px; max-height: calc(100% - 24px); overflow-y: auto; padding: 14px; }
#info .close { position: absolute; top: 10px; right: 10px; }
.info-head { display: flex; gap: 10px; align-items: center; margin-right: 36px; }
.line-badge { min-width: 34px; height: 26px; padding: 0 7px; border-radius: 6px; display: inline-grid; place-items: center; font-weight: 800; color: #fff; font-size: 13px; white-space: nowrap; }
.line-badge.small { min-width: 26px; height: 20px; font-size: 11px; padding: 0 5px; border-radius: 4px; }
.line-badge.clickable { cursor: pointer; }
.line-badge.clickable:hover { filter: brightness(1.25); outline: 2px solid #fff3; }
.info-title { font-size: 16px; font-weight: 700; }
.info-sub { color: var(--muted); font-size: 12px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 12px 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
.actions .toggle-btn { flex: 1 1 auto; }
.loadbar { height: 8px; border-radius: 4px; background: var(--bg2); overflow: hidden; margin-top: 3px; }
.loadbar i { display: block; height: 100%; }
.note { color: var(--muted); font-size: 11px; }
.delay-ok { color: var(--ok); } .delay-warn { color: var(--warn); } .delay-bad { color: var(--bad); }

.stops { list-style: none; margin: 6px 0; padding: 0; position: relative; }
.stops li { display: grid; grid-template-columns: 16px 1fr auto; gap: 8px; align-items: center; padding: 4px 0; cursor: pointer; }
.stops li:hover .n { text-decoration: underline; }
.stops li .dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--c, #fff); background: #111; justify-self: center; position: relative; }
.stops li.past { opacity: .45; }
.stops li.current .dot { background: var(--c, #fff); box-shadow: 0 0 0 4px rgba(255,255,255,.15); }
.stops li .tm { font-variant-numeric: tabular-nums; text-align: right; font-size: 12px; }
.stops li .tm small { display: block; }

table.deps { width: 100%; border-collapse: collapse; margin-top: 6px; }
table.deps td { padding: 5px 4px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.deps tr { cursor: pointer; }
table.deps tr:hover td { background: rgba(255,255,255,.05); }
table.deps td.min { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.deps td.dir { width: 100%; }
table.deps .live { color: var(--ok); font-size: 10px; }
table.deps tr.cancelled td { text-decoration: line-through; opacity: .5; }

.tooltip { position: absolute; pointer-events: none; z-index: 8; background: rgba(10,12,18,.92); border: 1px solid var(--line); padding: 5px 8px; border-radius: 6px; font-size: 12px; white-space: nowrap; transform: translate(12px, 12px); }
.follow-bar { position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%); display: flex; gap: 12px; align-items: center; background: var(--bg); border: 1px solid var(--line); padding: 8px 12px; border-radius: 12px; z-index: 6; }

.maplibregl-ctrl-attrib { font-size: 10px; }

@media (max-width: 760px) {
	#controls { width: calc(100% - 24px); max-height: 45%; }
	#info { top: auto; bottom: 12px; left: 12px; right: 12px; width: auto; max-height: 50%; }
}

.perf { position: absolute; left: 50%; transform: translateX(-50%); bottom: 8px; z-index: 6; display: flex; gap: 10px; align-items: center;
	background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 4px 10px; font-size: 12px; }
.perf-bar { width: 70px; height: 7px; border-radius: 4px; background: var(--bg2); overflow: hidden; display: inline-block; }
.perf-bar i { display: block; height: 100%; width: 0; background: var(--ok); transition: width .4s, background .4s; }
.perf select { background: var(--bg2); color: var(--fg); border: 1px solid var(--line); border-radius: 6px; font-size: 11px; padding: 2px 4px; }
.perf select option { background: #1b2130; }
.follow-bar { bottom: 50px; }
@media (max-width: 760px) { .perf { display: none; } }

.weather { background: var(--bg2); border-radius: 8px; padding: 6px 8px; margin-bottom: 6px; color: var(--fg); }
.weather b { font-size: 15px; }
.toasts { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 9; display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.toast { pointer-events: auto; cursor: pointer; background: rgba(20,24,34,.95); border: 1px solid var(--line); border-left: 4px solid var(--c, #e3000f);
	border-radius: 10px; padding: 8px 12px; min-width: 260px; max-width: 420px; box-shadow: 0 6px 24px rgba(0,0,0,.4); animation: toastIn .3s ease-out; }
.toast .t { font-weight: 700; }
.toast .d { color: var(--muted); font-size: 12px; }
@keyframes toastIn { from { transform: translateY(-12px); opacity: 0 } to { transform: none; opacity: 1 } }
.ev { background: var(--bg2); border-left: 3px solid var(--c); border-radius: 6px; padding: 6px 8px; cursor: pointer; }
.ev .t { font-weight: 600; } .ev .d { color: var(--muted); font-size: 12px; }

/* ---------------- Himmel */
#sky { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
#map { z-index: 1; }
body.underground #sky { display: none; }
#sky .stars { position: absolute; left: 0; top: 0; width: 1px; height: 1px; border-radius: 50%; transition: opacity 2s; }
#sky .sundisk { position: absolute; border-radius: 50%; filter: blur(0.5px); transition: opacity 1s; }
#sky .clouds { position: absolute; left: -20%; width: 140%; height: 46vh; transition: opacity 3s;
	background-image:
		radial-gradient(ellipse 160px 50px at 10% 40%, rgba(var(--ct), .85), transparent 70%),
		radial-gradient(ellipse 240px 70px at 28% 55%, rgba(var(--ct), .75), transparent 70%),
		radial-gradient(ellipse 200px 60px at 47% 35%, rgba(var(--ct), .8), transparent 70%),
		radial-gradient(ellipse 300px 80px at 68% 60%, rgba(var(--ct), .7), transparent 70%),
		radial-gradient(ellipse 180px 55px at 88% 42%, rgba(var(--ct), .8), transparent 70%);
	background-size: 1400px 100%; background-repeat: repeat-x; animation: cloudDrift 240s linear infinite; }
#sky .clouds.c2 { height: 30vh; background-size: 1900px 100%; animation-duration: 400s; filter: blur(2px); }
@keyframes cloudDrift { from { transform: translateX(0) } to { transform: translateX(-1400px) } }
#sky .haze { position: absolute; left: 0; right: 0; height: 80px; }


/* ---------------- Marke 3Dlivemap.at */
.logo svg { width: 34px; height: 34px; display: block; }
h1 span, .modal-hero h1 span { color: #ff5a64; font-weight: 600; }
#controls header .icon-btn + .icon-btn { margin-left: 4px; }
#btn-about { font-family: Georgia, serif; font-style: italic; font-weight: 700; }
.attrib a { color: #9ec3ff; }

/* Ein-/Ausklappbare Abschnitte */
h2[data-fold] { cursor: pointer; user-select: none; display: flex; align-items: center; gap: 6px; }
h2[data-fold]::after { content: '▾'; margin-left: auto; font-size: 11px; transition: transform .2s; }
h2[data-fold].closed::after { transform: rotate(-90deg); }
h2[data-fold].closed + .fold { display: none; }
#controls section { border-bottom: 1px solid var(--line); padding-bottom: 8px; }
#controls .weather { margin-top: 6px; }

/* Willkommen / Info */
.modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: rgba(5, 8, 14, .55); backdrop-filter: blur(3px); padding: 16px; }
.modal-card { width: min(720px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: rgba(18, 22, 30, .97);
	border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 30px 80px rgba(0,0,0,.6); overflow: hidden; }
.modal-hero { display: flex; gap: 16px; align-items: center; padding: 22px 24px 14px;
	background: radial-gradient(ellipse at 0% 0%, rgba(227,0,15,.25), transparent 60%), radial-gradient(ellipse at 100% 0%, rgba(42,107,255,.2), transparent 55%); }
.hero-logo { width: 64px; height: 64px; flex: none; filter: drop-shadow(0 6px 16px rgba(227,0,15,.45)); }
.modal-hero h1 { font-size: 28px; margin: 0; }
.modal-hero p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.modal-tabs { display: flex; gap: 4px; padding: 0 20px; border-bottom: 1px solid var(--line); }
.modal-tabs button { background: none; border: 0; color: var(--muted); padding: 10px 12px; cursor: pointer; font-size: 13px; border-bottom: 2px solid transparent; }
.modal-tabs button.active { color: var(--fg); border-bottom-color: #ff5a64; }
.modal-body { padding: 16px 24px; overflow-y: auto; line-height: 1.5; }
.modal-body p { margin: 0 0 10px; }
.features { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.features div { background: var(--bg2); border-radius: 10px; padding: 10px 12px; }
.features b { display: block; margin-bottom: 2px; }
.features span { color: var(--muted); font-size: 12.5px; }
.loading { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 14px; font-size: 12px; color: var(--muted); }
.loading div::before { content: '◌ '; }
.loading div.done { color: var(--ok); }
.loading div.done::before { content: '✓ '; }
table.help { width: 100%; border-collapse: collapse; }
table.help td { padding: 7px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.help td:first-child { width: 150px; white-space: nowrap; }
.placeholder { background: rgba(245,166,35,.12); border-left: 3px solid var(--warn); padding: 8px 10px; border-radius: 6px; }
.modal-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 24px; border-top: 1px solid var(--line); }
.modal-foot label { color: var(--muted); display: flex; gap: 6px; align-items: center; font-size: 12px; }
.primary-btn { background: #e3000f; color: #fff; border: 0; border-radius: 10px; padding: 10px 22px; font-size: 14px; font-weight: 700; cursor: pointer; }
.primary-btn:hover { background: #ff1a29; }
@media (max-width: 600px) { .features { grid-template-columns: 1fr; } .modal-hero h1 { font-size: 22px; } }

/* Kontaktformular */
.contact-form { display: flex; flex-direction: column; gap: 10px; }
.contact-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.contact-form input, .contact-form textarea { background: var(--bg2); border: 1px solid var(--line); color: var(--fg); border-radius: 8px; padding: 8px 10px; font: inherit; font-size: 13px; outline: none; resize: vertical; }
.contact-form input:focus, .contact-form textarea:focus { border-color: #5b8def; }
.contact-form .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.contact-form .hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.contact-status { font-size: 13px; min-height: 18px; }
.contact-status.ok { color: var(--ok); } .contact-status.err { color: var(--bad); }
.mail-addr { white-space: nowrap; }
@media (max-width: 600px) { .contact-form .row2 { grid-template-columns: 1fr; } }

.cam-img { width: 100%; border-radius: 10px; margin-top: 10px; display: block; background: #0d1117; min-height: 120px; }
#controls select { background: var(--bg2); color: var(--fg); border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; font-size: 12px; }
#controls select option { background: #1b2130; }

/* ---------------- Mobil: Menü und Infos als Leisten von unten */
@media (max-width: 760px) {
	#controls { top: auto; left: 0; right: 0; bottom: 0; width: 100%; max-height: 78vh; border-radius: 18px 18px 0 0; border-bottom: 0;
		padding-bottom: env(safe-area-inset-bottom); }
	#controls header { padding: 14px 14px 10px; position: relative; cursor: pointer; }
	#controls header::before { content: ''; position: absolute; top: 5px; left: 50%; width: 42px; height: 4px; margin-left: -21px; border-radius: 2px; background: rgba(255,255,255,.28); }
	#controls .body { padding-bottom: 24px; }
	.chip { padding: 8px 12px; font-size: 13px; }
	.toggle-btn { padding: 10px; font-size: 13px; }
	.toggle-btn.small { padding: 8px 10px; }
	.layers { gap: 6px 10px; }
	.layers label { font-size: 13.5px; padding: 5px 0; white-space: normal; }
	input[type=checkbox] { width: 18px; height: 18px; }
	.icon-btn { width: 36px; height: 36px; }
	.search input { padding: 11px 12px; font-size: 15px; }
	.search-results div { padding: 11px 12px; }
	h2[data-fold], h2.clickable { padding: 6px 0; font-size: 12px; }
	#info { top: auto; left: 0; right: 0; bottom: 0; width: 100%; max-height: 64vh; border-radius: 18px 18px 0 0; z-index: 7;
		padding: 18px 14px calc(14px + env(safe-area-inset-bottom)); }
	#info::before { content: ''; position: absolute; top: 6px; left: 50%; width: 42px; height: 4px; margin-left: -21px; border-radius: 2px; background: rgba(255,255,255,.28); }
	body.info-open #controls { display: none; }
	.maplibregl-ctrl-bottom-right .maplibregl-ctrl-group, .maplibregl-ctrl-scale { display: none; }
	.maplibregl-ctrl-bottom-right, .maplibregl-ctrl-bottom-left { bottom: 62px; }
	.toasts { top: 8px; width: calc(100% - 16px); }
	.toast { min-width: 0; max-width: none; }
	.follow-bar { bottom: 70px; width: calc(100% - 16px); flex-wrap: wrap; justify-content: center; gap: 6px; font-size: 12px; }
	body.info-open .follow-bar { bottom: calc(64vh + 8px); }
	.tooltip { display: none !important; }
	.modal { padding: 0; }
	.modal-card { height: 100%; max-height: 100%; border-radius: 0; }
	.modal-tabs { overflow-x: auto; padding: 0 10px; }
	.modal-tabs button { white-space: nowrap; }
	.modal-body { padding: 14px 16px; }
	.modal-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
	table.help td:first-child { width: auto; white-space: normal; }
	.stats { grid-template-columns: repeat(3, 1fr); }
	.stat b { font-size: 15px; }
}
