/* hvv Abfahrtstafel – Basis-Styles der Board-App (aus app.php ausgelagert).
 * Lädt VOR shared/themes.css (Themes überschreiben die Basis).
 * Wird wie themes.css vom Service Worker gecacht – bei Änderungen CACHE in sw.js erhöhen. */

  :root {
    --hvv-red:   #e2001a;
    --hvv-green: #4caf00;
    --u1:        #006ab3;
    --u2:        #cc0000;
    --u3:        #f0d000;
    --u3-text:   #1a1a00;
    --u4:        #00a19a;
    --s1:        #007d45;
    --s3:        #9b2f8a;
    --s5:        #e87722;
    --s7:        #8dc63f;
    --xbus:      #4a7c2f;
    --bus:       #e2001a;
    --bg:        #f4f4f6;
    --white:     #ffffff;
    --text:      #1a1a2e;
    --muted:     #6b7280;
    --border:    #e0e3e8;
    --alt:       #fafafa;
    --font: 'Source Sans 3','Helvetica Neue',Arial,sans-serif;
    --transition-speed: 0s;
  }

  html { transition: none; }
  body { transition: none; }
  *, *::before, *::after { margin:0; padding:0; box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
  html, body { height:100%; overflow:hidden; background:var(--bg); color:var(--text); font-family:var(--font); touch-action:manipulation; }

  /* ── LAYOUT ── */
  .app { display:flex; flex-direction:column; height:100vh; }

  /* ── TAB-BAR ── */
  .tab-bar {
    display:flex; gap:5px; padding:7px 8px 6px;
    background:transparent; flex-shrink:0;
  }
  .tab-btn {
    flex:1;
    display:flex; align-items:center; justify-content:center;
    padding:6px 2px; border-radius:7px;
    border:none; background:rgba(0,0,0,.13);
    cursor:pointer; font-family:var(--font);
    color:var(--muted);
    user-select:none;
  }
  .tab-btn:active { opacity:.7; }
  .tab-btn.active {
    background:var(--white);
    box-shadow:0 2px 10px rgba(0,0,0,.22);
    border-top:3px solid var(--hvv-red);
  }
  .tab-btn .line-chip {
    display:inline-flex; align-items:center; justify-content:center;
    font-size:.78rem; font-weight:700; white-space:nowrap;
    width:42px; height:22px;
  }

  /* ── CHIP-TYPEN (Tab-Bar) ── */
  /* Bus: roter Diamant */
  .chip-bus {
    background:var(--bus); color:#fff;
    clip-path:polygon(8px 0%,calc(100% - 8px) 0%,100% 50%,calc(100% - 8px) 100%,8px 100%,0% 50%);
  }
  /* Nachtbus (600er): schwarzer Diamant */
  .chip-nbus {
    background:#000; color:#fff;
    clip-path:polygon(8px 0%,calc(100% - 8px) 0%,100% 50%,calc(100% - 8px) 100%,8px 100%,0% 50%);
  }
  /* X-Bus (Schnellbus): grüner Diamant */
  .chip-xbus {
    background:var(--xbus); color:#fff;
    clip-path:polygon(8px 0%,calc(100% - 8px) 0%,100% 50%,calc(100% - 8px) 100%,8px 100%,0% 50%);
  }
  /* U-Bahn: Rechteck, scharfe Ecken */
  .chip-u1 { background:var(--u1); color:#fff;           border-radius:3px; }
  .chip-u2 { background:var(--u2); color:#fff;           border-radius:3px; }
  .chip-u3 { background:var(--u3); color:var(--u3-text); border-radius:3px; }
  .chip-u4 { background:var(--u4); color:#fff;           border-radius:3px; }
  /* S-Bahn: Pille */
  .chip-s1 { background:var(--s1); color:#fff; border-radius:12px; }
  .chip-s2 { background:#c00000;   color:#fff; border-radius:12px; }
  .chip-s3 { background:var(--s3); color:#fff; border-radius:12px; }
  .chip-s5 { background:var(--s5); color:#fff; border-radius:12px; }
  .chip-s7 { background:var(--s7); color:#1a1a2e; border-radius:12px; }
  /* Regionalzug: schwarzer Kreis mit Buchstabe */
  .chip-rb { background:#000; color:#fff; border-radius:50%; width:22px !important; height:22px !important; font-size:.85rem; }

  /* ── BOARDS CONTAINER ── */
  .boards-container {
    flex:1; min-height:0; display:flex; gap:8px; overflow:hidden;
    margin:0 10px 6px;
  }

  /* ── BOARD ── */
  .board-wrap {
    display:none;
    flex:1; flex-direction:column; overflow:hidden; min-width:0; min-height:0;
    background:var(--white);
    border:1px solid var(--border);
    border-radius:8px;
  }
  .board-wrap.active { display:flex; }

  /* Haltestellen-Header */
  .stop-header {
    padding:10px 16px 8px; flex-shrink:0;
    display:flex; align-items:center; justify-content:space-between; gap:10px;
    border-bottom:1px solid var(--border);
  }
  .stop-header-text { min-width:0; }
  .stop-header-name {
    font-size:1.1rem; font-weight:700;
    white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
  }
  .walk-time {
    display:inline-flex; align-items:center; gap:4px;
    font-size:.75rem; color:var(--muted); margin-top:2px;
    white-space:nowrap;
  }
  .mode-badge {
    display:flex; align-items:center; gap:5px;
    border-radius:20px; padding:3px 10px;
    font-size:.72rem; font-weight:700; letter-spacing:.06em;
    flex-shrink:0; margin-left:10px;
  }
  .mode-badge.live  { background:#dcf5e4; color:#1a5c2a; }
  /* Veraltet: solide Amber-Pille – auf hellem wie dunklem Theme lesbar */
  .mode-badge.stale { background:#f5a623 !important; color:#1a1a1a !important; border-color:#f5a623 !important; }
  /* Statischer Punkt (kein Dauer-Puls): eine endlose Animation würde den
     GPU-Kompositor dauerhaft bei 60 fps halten und die Seite nie idlen lassen. */
  .live-dot  { width:6px;height:6px;border-radius:50%;background:#2a7d2a; }
  .error-dot { width:6px;height:6px;border-radius:50%;background:#e2001a; }
  .stale-dot { width:6px;height:6px;border-radius:50%;background:#7a4a00; }
  /* Veraltete Daten abdimmen – signalisiert, dass die Zeiten nicht aktuell sind */
  .board-wrap.stale .dep-list { opacity:.4; transition:opacity .3s; }

  /* Spalten-Kopf */
  .col-head {
    display:grid; grid-template-columns:52px 1fr 44px 52px;
    gap:0 8px; padding:4px 14px;
    background:var(--alt); border-bottom:1px solid var(--border);
    font-size:.58rem; font-weight:700; letter-spacing:.12em;
    text-transform:uppercase; color:var(--muted); flex-shrink:0;
  }
  .col-head .r { text-align:right; }
  .platform-head, .platform-cell { display:none; }
  .board-wrap.show-platform .col-head,
  .board-wrap.show-platform .dep-row { grid-template-columns:52px 1fr 34px 44px 52px; }
  .board-wrap.show-platform .platform-head,
  .board-wrap.show-platform .platform-cell { display:block; }

  /* Zeilen */
  .dep-list { flex:1; min-height:0; overflow:hidden; opacity:1; transition:opacity .15s; display:flex; flex-direction:column; }
  .dep-list.fading { opacity:0; transition:opacity .10s; }
  .dep-row {
    display:grid; grid-template-columns:52px 1fr 44px 52px;
    gap:0 8px; align-items:center;
    padding:0 14px; flex:none; height:var(--row-h, 52px); min-height:0;
    border-bottom:1px solid var(--border);
  }
  .dep-row:last-child { border-bottom:none; }
  .dep-row:nth-child(even) { background:var(--alt); }

  /* ── HVV LINIENSYMBOLE (Zeilen-Badge) ── */
  .badge {
    display:inline-flex; align-items:center; justify-content:center;
    font-size:.82rem; font-weight:700; white-space:nowrap;
    width:52px; height:26px; flex-shrink:0;
  }
  .badge.badge-sm { font-size:.63rem; letter-spacing:-.01em; }
  /* Bus: roter Diamant */
  .b-def {
    background:var(--bus); color:#fff;
    clip-path:polygon(9px 0%,calc(100% - 9px) 0%,100% 50%,calc(100% - 9px) 100%,9px 100%,0% 50%);
    border-radius:0;
  }
  /* Nachtbus: schwarzer Diamant */
  .b-nbus {
    background:#000; color:#fff;
    clip-path:polygon(9px 0%,calc(100% - 9px) 0%,100% 50%,calc(100% - 9px) 100%,9px 100%,0% 50%);
    border-radius:0;
  }
  /* X-Bus: grüner Diamant */
  .b-xbus {
    background:var(--xbus); color:#fff;
    clip-path:polygon(9px 0%,calc(100% - 9px) 0%,100% 50%,calc(100% - 9px) 100%,9px 100%,0% 50%);
    border-radius:0;
  }
  /* Regionalbahn: schwarzes Rechteck */
  .b-rb   { background:#000; color:#fff; border-radius:3px; }
  /* U-Bahn: farbiges Rechteck */
  .b-U1   { background:var(--u1); color:#fff;           border-radius:3px; }
  .b-U2   { background:var(--u2); color:#fff;           border-radius:3px; }
  .b-U3   { background:var(--u3); color:var(--u3-text); border-radius:3px; }
  .b-U4   { background:var(--u4); color:#fff;           border-radius:3px; }
  /* S-Bahn: Pille */
  .b-S1   { background:var(--s1); color:#fff; border-radius:13px; }
  .b-S2   { background:#c00000;   color:#fff; border-radius:13px; }
  .b-S3   { background:var(--s3); color:#fff; border-radius:13px; }
  .b-S5   { background:var(--s5); color:#fff; border-radius:13px; }
  .b-S7   { background:var(--s7); color:#1a1a2e; border-radius:13px; }

  .dest  { font-size:.92rem; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .via   { font-size:.72rem; font-weight:400; color:var(--muted); }
  .platform-cell { font-size:.78rem; font-weight:700; color:var(--muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .sched-t{ font-size:.88rem; font-weight:600; font-variant-numeric:tabular-nums; color:var(--muted); }
  .delay { font-size:.62rem; font-weight:700; margin-top:1px; }
  .d-ok   { color:#2a7d2a; }
  .d-warn { color:#c47800; }
  .d-late { color:var(--hvv-red); }

  .cnt { font-size:.92rem; font-weight:700; text-align:right; font-variant-numeric:tabular-nums; white-space:nowrap; }
  .cnt-now  { color:var(--hvv-red); }
  .cnt-soon { color:#c47800; }
  .cnt-ok   { color:var(--text); }
  .cnt-plan { font-size:.92rem; font-weight:600; color:var(--muted); text-align:right; }

  /* Ausgefallene Fahrt */
  .dep-row.cancelled .dest,
  .dep-row.cancelled .sched-t { text-decoration:line-through; opacity:.7; }
  .d-cancelled   { color:#e2001a; text-transform:uppercase; letter-spacing:.02em; }
  .cnt-cancelled { color:#e2001a !important; font-weight:700; text-align:right; }

  /* Störungsmeldungen (unten am Board, nur bei relevanten Meldungen) */
  .disruptions {
    flex-shrink:0; display:flex; align-items:center; gap:7px;
    padding:5px 14px; min-height:30px;
    background:rgba(245,166,35,.13); border-bottom:1px solid var(--border);
    font-size:.74rem; line-height:1.2; color:var(--text);
  }
  .disruptions[hidden] { display:none; }
  /* „Keine Störungen": Leiste bleibt sichtbar (gleiche Höhe → konsistentes
     Layout über alle Tafeln), aber ruhig statt amber-warnend. */
  .disruptions.disr-ok { background:transparent; color:var(--muted); }
  .disruptions.disr-ok .disr-icon { color:#4caf00; }
  .disr-icon    { flex-shrink:0; font-size:.9rem; }
  .disr-marquee { flex:1; min-width:0; overflow:hidden; contain:paint; }
  .disr-track   { display:block; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .disr-track.scrolling {
    display:inline-flex; overflow:visible; text-overflow:clip;
    animation:disr-marquee var(--dur,45s) steps(var(--ticker-steps,1350),end) infinite;
    will-change:transform;
  }
  .disr-track.scrolling > span { padding-right:3.5rem; }
  @keyframes disr-marquee { from { transform:translateX(0); } to { transform:translateX(-50%); } }
  html.page-hidden .disr-track.scrolling { animation-play-state:paused; }
  .multi-board .disruptions { padding:4px 8px; font-size:.68rem; min-height:26px; }
  /* „Bewegung reduzieren": Flip anhalten → keine unnötige Animation,
     spart Leistung (Firefox/macOS respektieren diese Systemeinstellung). */
  @media (prefers-reduced-motion: reduce) {
    .disr-track.scrolling { display:block; overflow:hidden; text-overflow:ellipsis; animation:none !important; }
    .disr-track.scrolling > span:nth-child(n+2) { display:none; }
  }

  .empty { display:flex; align-items:center; justify-content:center; flex:1; color:var(--muted); font-size:.85rem; padding:2rem; text-align:center; }

  /* ── FOOTER ── */
  footer {
    height:46px; background:transparent; border-top:none;
    display:grid; grid-template-columns:1fr 1fr 1fr;
    align-items:center;
    padding:0 32px; flex-shrink:0;
    padding-bottom:env(safe-area-inset-bottom);
  }
  .hvv-logo  { display:inline-flex; align-items:baseline; justify-content:flex-start; padding-left:8px; gap:1px; text-decoration:none; }
  .hvv-svg   { height:1.05rem; width:auto; display:block; align-self:baseline; }
  .hvv-www   { color:var(--muted); font-size:.58rem; line-height:1; margin-right:-.6rem; font-family:'Source Sans 3',Arial,sans-serif; }
  .hvv-de    { color:var(--muted); font-size:.58rem; line-height:1; font-family:'Source Sans 3',Arial,sans-serif; }
  .footer-center { display:flex; flex-direction:column; align-items:center; gap:1px; line-height:1.1; white-space:nowrap; }
  .footer-date { text-align:center; font-size:.75rem; color:var(--muted); }
  .footer-impressum { font-size:.6rem; color:var(--muted); text-decoration:none; opacity:.8; }
  .footer-impressum:hover { text-decoration:underline; }
  .clock    { font-size:1.5rem; font-weight:700; color:var(--hvv-red); font-variant-numeric:tabular-nums; line-height:1; text-align:right; padding-right:8px; }

  /* ── DARK MODE ── */
  html.dark {
    --bg:     #0f1117;
    --white:  #1a1f2e;
    --text:   #e8edf5;
    --muted:  #6b7a94;
    --border: #2a3245;
    --alt:    #141928;
  }
  html.dark body { background:#0f1117; color:#e8edf5; }
  html.dark .board-wrap             { background:#1a1f2e; border-color:#2a3245; }
  html.dark .stop-header            { background:#1a1f2e; border-color:#2a3245; }
  html.dark .col-head               { background:#141928; border-color:#2a3245; color:#6b7a94; }
  html.dark .tab-btn:not(.active)   { background:rgba(255,255,255,.08); }
  html.dark .tab-btn.active         { background:#1a1f2e; box-shadow:0 2px 10px rgba(0,0,0,.5); }
  html.dark .dep-row                { border-color:#2a3245; background:#1a1f2e; }
  html.dark .dep-row:nth-child(even){ background:#141928; }
  html.dark .dest                   { color:#e8edf5; }
  html.dark .stop-header-name       { color:#e8edf5; }
  html.dark .sched-t                { color:#6b7a94; }
  html.dark .walk-time              { color:#6b7a94; }
  html.dark .footer-date            { color:#6b7a94; }
  html.dark .cnt-ok                 { color:#e2001a; }
  html.dark .empty                  { color:#6b7a94; }
  .mode-badge.error { background:#fde8e8; color:#b00020; }
  html.dark .mode-badge.live        { background:#0a2010; color:#4caf00; }
  html.dark .mode-badge.error       { background:#2a0a0a; color:#ff6b6b; }

  /* ── DESKTOP: alle Boards nebeneinander ── */
  .multi-board .tab-bar            { display:none; }
  .multi-board .board-wrap          { display:flex; }
  .multi-board .stop-header         { padding:8px 10px 6px; }
  .multi-board .stop-header-name    { font-size:.95rem; }
  .multi-board .col-head            { padding:4px 8px; grid-template-columns:46px 1fr 40px 46px; gap:0 4px; }
  .multi-board .dep-row             { padding:0 8px; grid-template-columns:46px 1fr 40px 46px; gap:0 4px; }
  .multi-board .board-wrap.show-platform .col-head,
  .multi-board .board-wrap.show-platform .dep-row { grid-template-columns:46px 1fr 30px 38px 42px; }
  .multi-board .badge               { width:46px; }

