:root {
  color-scheme: dark;
  --hintergrund: #091322;
  --flaeche: #121f30;
  --kante: #40556d;
  --schrift: #fff4df;
  --leise: #a9bccc;
  --signal: #ffca74;
  --wunsch: #43e4d0;
  --strecke: #83cffd;
  --gleis: #7891a7;
  font-family: "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--hintergrund); color: var(--schrift); }
button, select, input { font: inherit; }
button {
  border: 1px solid transparent; border-radius: .55rem; background: var(--wunsch);
  color: #071b23; font-weight: 750; padding: .72rem 1rem; cursor: pointer;
}
button.secondary { background: #192c41; color: var(--schrift); border-color: var(--kante); }
button:disabled { opacity: .48; cursor: default; }
button:focus-visible, select:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid var(--signal); outline-offset: 3px; }
a { color: var(--wunsch); }
h1, h2, p { margin: 0; }
.leinwand { min-height: 520px; background: var(--hintergrund); padding: 1.35vw 1.6vw; position: relative; }
.screen-head {
  display: flex; gap: 1rem; align-items: baseline; justify-content: space-between;
  border-bottom: 1px solid var(--kante); padding: .2rem .2rem .75rem;
}
.screen-head h1 { font-size: clamp(30px, 4.3vw, 85px); line-height: 1; letter-spacing: -.03em; text-transform: uppercase; }
.zielmarke { font-size: clamp(16px, 2.1vw, 42px); font-weight: 800; text-transform: uppercase; white-space: nowrap; }
.screen-body {
  display: grid; grid-template-columns: minmax(0, 2.65fr) minmax(220px, 1fr);
  align-items: stretch; gap: 1.4vw; margin-top: 1.35vw;
}
#karte { display: block; width: 100%; margin: auto; max-height: calc(89vh - 5rem); }
.gleis { fill: none; stroke: var(--gleis); stroke-width: 4.2; stroke-linejoin: round; stroke-linecap: round; opacity: .74; }
.gleis.gefahren { stroke: var(--strecke); opacity: 1; }
.gleis.vorschlag { stroke: var(--wunsch); stroke-dasharray: 6 7; opacity: 1; }
.gleis.gestellt { stroke: var(--signal); stroke-width: 5.2; opacity: 1; }
.station circle { fill: var(--schrift); stroke: #142637; stroke-width: 2; }
.station text {
  fill: var(--schrift); font-size: 18px; font-weight: 700; paint-order: stroke;
  stroke: #102034; stroke-width: 4; stroke-linejoin: round;
}
.station.ziel circle { fill: #102034; stroke: var(--wunsch); stroke-width: 3.5; r: 10; }
.station.ziel text { fill: var(--wunsch); }
.station.naechste circle { fill: #15212b; stroke-width: 3.4; stroke: var(--signal); r: 8; }
#zug { filter: drop-shadow(0 0 5px #9bd9ff); }
.status {
  padding: clamp(14px, 1.6vw, 32px); border-radius: 1rem; border: 1px solid #536e84;
  background: linear-gradient(135deg, #172a3c, #0d1928 75%); min-width: 0;
  display: flex; flex-direction: column; justify-content: center; min-height: 380px;
}
.status-heading { text-transform: uppercase; color: var(--leise); font-weight: 800; font-size: clamp(14px, 1.4vw, 28px); letter-spacing: .06em; }
#status-titel { font-size: clamp(27px, 3.7vw, 69px); line-height: 1.06; margin: .28em 0 .5em; overflow-wrap: anywhere; }
.status p { font-size: clamp(15px, 1.5vw, 31px); }
#qr { border-radius: 8px; width: min(100%, 230px); height: auto; margin: 0 0 1rem; }
.votes { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; border-top: 1px solid var(--kante); padding-top: 1rem; }
.votes > div:last-child { text-align: right; }
.votes strong { display: block; font-size: clamp(23px, 3.1vw, 63px); white-space: nowrap; }
.votes span { display: block; font-size: clamp(13px, 1.45vw, 28px); line-height: 1.18; }
.vote-bar, .bar { position: relative; border-radius: 100px; overflow: hidden; background: #25394c; height: 1.12rem; margin: .85rem 0; }
.vote-bar i, .bar i { position: absolute; left: 0; height: 100%; background: var(--wunsch); transition: width .12s linear; width: 0; }
.vote-bar i { background: #c5d8e5; }
.vote-bar i:last-child { left: auto; right: 0; }
.vote-bar i.mehrheit { background: var(--wunsch); }
#weichenstellung { color: var(--signal); font-weight: 750; margin: 1.1rem 0; }
#weichenstellung:empty { display: none; }
#halteblock { border-top: 1px solid var(--kante); padding-top: 1rem; color: var(--wunsch); font-size: clamp(14px, 1.5vw, 28px); }
#restzeit { color: var(--leise); margin-top: .55rem; }
.controls { border-top: 1px solid var(--kante); padding: 1.3rem 1.6vw 2rem; }
.control-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.control-actions { display: flex; align-items: center; gap: .6rem; }
#angemeldet-als { color: var(--leise); font-size: .95rem; }
.controls form { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; }
.controls label { display: grid; gap: .3rem; color: var(--leise); }
.controls input, .controls select {
  width: 100%; background: var(--flaeche); border: 1px solid var(--kante);
  color: var(--schrift); border-radius: .45rem; padding: .62rem;
}
.actions { display: flex; flex-wrap: wrap; align-items: end; gap: .5rem; grid-column: 1/-1; }
#meldung { color: var(--signal); }
#meldung:not(:empty), #beitritt { display: block; margin-top: .8rem; }
.fullscreen-actions { display: none; }
.leinwand:fullscreen { display: flex; flex-direction: column; justify-content: space-evenly; }
.leinwand:fullscreen .fullscreen-actions { display: flex; gap: .6rem; padding-top: .4rem; }
.handy { max-width: 32rem; margin: auto; padding: 1.25rem; }
.handy header { border-bottom: 1px solid var(--kante); padding-bottom: 1rem; margin-bottom: 1.5rem; }
.handy h1 { font-size: clamp(1.8rem, 8vw, 2.8rem); line-height: 1; }
.handy h2 { font-size: 1.45rem; margin-bottom: .75rem; }
.handy p { color: var(--leise); margin: .7rem 0; }
.handy button { width: 100%; margin-top: .65rem; }
.richtungstasten { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin: 1rem 0; }
.richtungstasten button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 8rem;
  background: var(--flaeche); color: var(--schrift); border-color: var(--kante);
  touch-action: none; user-select: none; padding: .45rem; overflow-wrap: anywhere;
}
.richtungstasten .gewaehlt { background: var(--wunsch); color: #071b23; opacity: 1; }
.richtungstasten span { font-size: 2.7rem; line-height: 1.5; }
.connection { min-height: 1.5em; font-size: .92rem; }
@media (max-width: 680px) {
  .screen-head { flex-wrap: wrap; }
  .screen-body { grid-template-columns: 1fr; }
  .status { min-height: 210px; }
  .leinwand, .controls { padding: .85rem; }
}
