/* ══════════════════════════════════════════════
   windesheim-steigt-ein.de  —  Stylesheet
   Design: eckig, sachlich, Pro-Windesheim-Blau
   234 = Cyan  |  240 = Lila
══════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&display=swap');

:root {
  --blue:        #004885;
  --blue-light:  #0065b8;
  --blue-dark:   #003260;
  --amber:       #ffb300;
  --amber-dim:   #b37d00;
  --amber-bright:#ffd54f;
  --amber-dark:  #6a4e00;
  --board-bg:    #0a0a0a;
  --gray:        #6b7280;
  --gray-light:  #f3f4f6;
  --gray-mid:    #e5e7eb;
  --text:        #1a1a2e;
  /* Linienfarben */
  --c234:        #0891b2;   /* Cyan */
  --c234-bg:     #ecfeff;
  --c234-border: #06b6d4;
  --c240:        #7c3aed;   /* Lila */
  --c240-bg:     #f5f3ff;
  --c240-border: #8b5cf6;
  --green:       #16a34a;
  --orange:      #d97706;
  --red:         #dc2626;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: #e8edf2;
  color: var(--text);
  min-height: 100vh;
}

/* ── HEADER ── */
header {
  background: var(--blue);
  color: #fff;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 70px;
  border-bottom: 3px solid var(--blue-dark);
  box-shadow: 0 2px 10px rgba(0,0,0,.35);
}
.header-left  { display: flex; align-items: center; gap: 14px; }
.header-logo  { height: 44px; filter: brightness(0) invert(1); }
.header-title { font-size: 1.15rem; font-weight: 700; letter-spacing: .03em; }
.header-subtitle { font-size: .72rem; opacity: .7; margin-top: 2px; }
.header-right { font-size: .78rem; opacity: .75; text-align: right; line-height: 1.5; }
.header-right a { color: #fff; text-decoration: none; }
.header-right a:hover { text-decoration: underline; }

/* ── CLOCK BAR ── */
.clock-bar {
  background: var(--blue-dark);
  color: rgba(255,255,255,.9);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 40px;
  font-size: .82rem;
  flex-wrap: nowrap;
  border-bottom: 2px solid #001f40;
}
.clock-bar-left { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.clock-icon { opacity: .55; flex-shrink: 0; }
#live-clock {
  font-weight: 700;
  font-size: 1rem;
  font-family: 'Share Tech Mono', monospace;
  letter-spacing: .06em;
  white-space: nowrap;
}
.clock-sep { opacity: .3; flex-shrink: 0; margin: 0 2px; }

.refresh-btn {
  background: rgba(255,255,255,.1);
  border: 1.5px solid rgba(255,255,255,.3);
  border-radius: 0;
  padding: 4px 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #fff;
  font-size: .75rem;
  font-weight: 600;
  transition: all .2s;
  white-space: nowrap;
  flex-shrink: 0;
}
.refresh-btn:hover  { background: rgba(255,255,255,.22); border-color: rgba(255,255,255,.55); }
.refresh-btn:active { transform: scale(.97); }
.refresh-btn:disabled { opacity: .5; cursor: not-allowed; }
.refresh-btn.loading .refresh-icon { animation: spin 1s linear infinite; }
.refresh-icon { width: 14px; height: 14px; flex-shrink: 0; }
@keyframes spin { 100% { transform: rotate(360deg); } }

.last-update { font-size: .7rem; opacity: .55; white-space: nowrap; flex-shrink: 0; }
#update-ok {
  display: inline-flex; align-items: center; gap: 4px;
  color: #86efac; font-size: .78rem; opacity: 0;
  transition: opacity .4s; white-space: nowrap;
}
#update-ok.show { opacity: 1; }

/* ── STATUS BAR ── */
.status-bar { overflow: hidden; max-height: 0; transition: max-height .4s ease; }
.status-bar.visible { max-height: 100px; }
.status-bar-inner {
  padding: 6px 1.5rem;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  background: #f0f4f8;
  border-bottom: 1px solid var(--gray-mid);
}
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px 3px 8px;
  border-radius: 0;
  font-size: .76rem;
  font-weight: 600;
  letter-spacing: .02em;
  white-space: nowrap;
  border: 1.5px solid currentColor;
  opacity: .9;
}
.status-badge svg { flex-shrink: 0; }
.sb-ferien   { background: #fef3c7; color: #92400e; }
.sb-schule   { background: #dbeafe; color: #1e40af; }
.sb-feiertag { background: #fce7f3; color: #9d174d; }
.sb-countdown { font-size: .7rem; opacity: .75; }
.status-bar-disclaimer {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .68rem; color: var(--gray); margin-left: auto; white-space: nowrap;
}

/* ── MAIN ── */
main { max-width: 1100px; margin: 0 auto; padding: 2rem 1.5rem 3rem; }

.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--blue);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--blue);
}

.disclaimer-bar {
  background: #fff8e6;
  border: 1px solid #f5d46a;
  border-top: 3px solid #d97706;
  padding: 10px 16px;
  font-size: .8rem;
  color: #78350f;
  margin-bottom: 1.5rem;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.disclaimer-bar a { color: #92400e; }

/* ── LINE FILTER + LEGENDE ── */
.line-filter-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  background: #fff;
  border: 1px solid #d1d9e3;
  border-top: 2px solid var(--blue);
  padding: 10px 14px;
}
.line-filter-bar { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.line-filter-label { font-size: .75rem; color: var(--gray); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.lf-btn {
  padding: 5px 16px;
  border-radius: 0;
  border: 2px solid var(--gray-mid);
  background: #f8fafc;
  font-size: .8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s;
  color: var(--gray);
}
.lf-btn:hover      { border-color: var(--blue); color: var(--blue); background: #fff; }
.lf-btn.active-all { background: var(--blue);  color: #fff; border-color: var(--blue); }
.lf-btn.active-234 { background: var(--c234); color: #fff; border-color: var(--c234); }
.lf-btn.active-240 { background: var(--c240); color: #fff; border-color: var(--c240); }

/* Legende */
.line-legend {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.line-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 6px;
  background: #f8fafc;
  border: 1.5px solid var(--gray-mid);
}
.legend-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
  font-weight: 800;
  font-family: 'Share Tech Mono', monospace;
  width: 38px;
  height: 28px;
  flex-shrink: 0;
  letter-spacing: .04em;
  color: #fff;
}
.badge-234 { background: var(--c234); }
.badge-240 { background: var(--c240); }
.legend-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.2;
}
.legend-text strong { font-size: .78rem; color: var(--text); }
.legend-text span   { font-size: .68rem; color: var(--gray); }

/* Zeitchip-Schnelligkeit-Marker */
.chip-soon { color: #16a34a; font-weight: 700; font-size: .65rem; }
.chip-near { color: #b45309; font-weight: 700; font-size: .65rem; }

/* ── LED BOARD ── */
.led-outer {
  background: #111;
  border-radius: 0;
  padding: 12px;
  box-shadow: 0 0 0 2px #222, 0 0 0 4px #333, 0 8px 36px rgba(0,0,0,.7);
  margin-bottom: 2rem;
  border-top: 3px solid var(--blue);
}
.led-screen {
  background: var(--board-bg);
  border-radius: 0;
  padding: 18px 20px 14px;
  position: relative;
  overflow: hidden;
}
.led-screen::after {
  content: '';
  position: absolute; inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,.07) 2px, rgba(0,0,0,.07) 4px);
}
.led-col-header {
  display: grid;
  grid-template-columns: 80px 1fr 1fr 90px 36px;
  gap: 0 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid #2a2400;
  margin-bottom: 2px;
}
.led-ch { font-family: 'Share Tech Mono', monospace; font-size: .65rem; color: var(--amber-dark); letter-spacing: .1em; text-transform: uppercase; }
.led-ch.right  { text-align: right; }
.led-ch.center { text-align: center; }

.dep-block { border-bottom: 1px solid #1a1600; }
.dep-block:last-of-type { border-bottom: none; }
.dep-block.is-next-dep {
  background: rgba(255,179,0,.06);
  border-top: 2px solid var(--amber);
  box-shadow: inset 0 1px 0 rgba(255,213,79,.18);
}
.dep-block.is-next-dep .line-badge-led  { font-size: 1.35rem; text-shadow: 0 0 14px rgba(255,213,79,.9), 0 0 30px rgba(255,213,79,.4); }
.dep-block.is-next-dep .dest-main-led   { font-size: 1.1rem; }
.dep-block.is-next-dep .dep-min         { font-size: 1.2rem; color: var(--amber-bright); text-shadow: 0 0 12px rgba(255,213,79,.8); }
.dep-block.is-next-dep .dep-uhr         { font-size: .75rem; color: var(--amber-dim); }

.dep-block.is-gone { opacity: .45; }
.dep-block.is-gone .dep-min       { color: #664d00 !important; font-size: .85rem !important; text-shadow: none !important; animation: none !important; }
.dep-block.is-gone .line-badge-led { opacity: .5; }
.dep-block.is-gone .dest-main-led  { text-decoration: line-through; text-decoration-color: #664d00; }

.next-dep-label {
  font-family: 'Share Tech Mono', monospace;
  font-size: .55rem;
  color: #c8860a;
  letter-spacing: .12em;
  text-transform: uppercase;
  margin-bottom: 2px;
  display: block;
}
.dep-main-row {
  display: grid;
  grid-template-columns: 80px 1fr 1fr 90px 36px;
  gap: 0 8px;
  padding: 10px 0;
  align-items: center;
  cursor: pointer;
  user-select: none;
  transition: background .15s;
}
.dep-main-row:hover { background: rgba(255,179,0,.04); }

.led-mono { font-family: 'Share Tech Mono', monospace; color: var(--amber); text-shadow: 0 0 8px rgba(255,179,0,.45), 0 0 18px rgba(255,179,0,.12); }
.line-badge-led {
  font-size: 1.15rem; font-weight: bold;
  color: var(--amber-bright);
  text-shadow: 0 0 10px rgba(255,213,79,.7), 0 0 24px rgba(255,213,79,.3);
  font-family: 'Share Tech Mono', monospace;
  transition: font-size .3s, text-shadow .3s;
}
.dest-main-led  { font-size: 1rem; transition: font-size .3s; }
.dest-sub-led   { font-size: .65rem; color: var(--amber-dark); text-shadow: none; margin-top: 2px; letter-spacing: .06em; font-family: 'Share Tech Mono', monospace; }
.next-stop-col  { text-align: center; }
.next-stop-name { font-family: 'Share Tech Mono', monospace; font-size: .62rem; color: var(--amber-dark); text-transform: uppercase; letter-spacing: .08em; display: block; margin-bottom: 3px; }
.next-stop-time { font-family: 'Share Tech Mono', monospace; font-size: 1.05rem; color: var(--amber); text-shadow: 0 0 8px rgba(255,179,0,.5); display: block; }
.next-stop-time.sofort { color: #ff6b00; text-shadow: 0 0 10px rgba(255,107,0,.8); animation: blink 1s infinite; }
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

.dep-time-col { text-align: right; }
.dep-min { font-family: 'Share Tech Mono', monospace; font-size: 1.05rem; color: var(--amber); text-shadow: 0 0 8px rgba(255,179,0,.5); transition: font-size .3s, color .3s; }
.dep-min.sofort     { color: #ff6b00; text-shadow: 0 0 10px rgba(255,107,0,.8); animation: blink 1s infinite; }
.dep-min.gone-label { color: #4a3600; font-size: .78rem !important; text-shadow: none !important; animation: none !important; line-height: 1.3; }
.dep-uhr { font-family: 'Share Tech Mono', monospace; font-size: .65rem; color: var(--amber-dark); display: block; margin-top: 2px; transition: font-size .3s; }
.expand-btn { font-family: 'Share Tech Mono', monospace; font-size: .85rem; color: var(--amber-dark); text-align: center; transition: transform .25s; display: flex; align-items: center; justify-content: center; }
.dep-block.open .expand-btn { transform: rotate(180deg); color: var(--amber-dim); }

.dep-stops-panel { display: none; padding: 0 0 10px 80px; border-top: 1px solid #1a1600; }
.dep-block.open .dep-stops-panel { display: block; }
.stops-grid { display: flex; gap: 0; padding-top: 10px; flex-wrap: wrap; }
.stop-entry { display: flex; flex-direction: column; align-items: center; flex: 1; min-width: 70px; position: relative; }
.stop-entry:not(:last-child)::after { content: ''; position: absolute; top: 8px; right: -50%; width: 100%; height: 1px; background: #2a2400; }
.stop-dot-led {
  width: 10px; height: 10px;
  border-radius: 0;
  background: #2a2400;
  border: 2px solid var(--amber-dark);
  margin-bottom: 6px;
  position: relative; z-index: 1;
}
.stop-dot-led.next { background: var(--amber); border-color: var(--amber); box-shadow: 0 0 8px rgba(255,179,0,.8); }
.stop-sname { font-family: 'Share Tech Mono', monospace; font-size: .6rem; color: var(--amber-dark); text-align: center; letter-spacing: .06em; text-transform: uppercase; margin-bottom: 3px; }
.stop-stime { font-family: 'Share Tech Mono', monospace; font-size: .85rem; color: var(--amber); text-align: center; text-shadow: 0 0 6px rgba(255,179,0,.4); }
.stop-entry.is-next .stop-sname { color: var(--amber-dim); }
.stop-entry.is-next .stop-stime { color: var(--amber-bright); font-size: .95rem; }
.dep-restriction { font-family: 'Share Tech Mono', monospace; font-size: .58rem; color: #664d00; letter-spacing: .06em; padding: 2px 0 0; }

.led-no-dep { font-family: 'Share Tech Mono', monospace; color: var(--amber-dark); font-size: .88rem; text-align: center; padding: 18px 0; }
.led-brand { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; padding-top: 8px; border-top: 1px solid #1f1a00; gap: 8px; }
.led-brand-text { font-family: 'Share Tech Mono', monospace; font-size: .62rem; color: #3d3000; letter-spacing: .1em; white-space: nowrap; }
.led-ticker { font-family: 'Share Tech Mono', monospace; font-size: .62rem; color: #4a3a00; overflow: hidden; white-space: nowrap; flex: 1; min-width: 0; }
.led-ticker-inner { display: inline-block; animation: ticker 24s linear infinite; }
@keyframes ticker { 0% { transform: translateX(100%); } 100% { transform: translateX(-100%); } }

/* ── COLLAPSIBLE CARDS ── */
.collapsible-card {
  background: #fff;
  border-radius: 0;
  overflow: hidden;
  border: 1px solid #d1d9e3;
  border-top: 2px solid var(--blue);
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.collapsible-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.4rem;
  cursor: pointer;
  user-select: none;
  transition: background .15s;
}
.collapsible-toggle:hover { background: #f4f7fb; }
.collapsible-card.open .collapsible-toggle { border-bottom: 1px solid #e5e7eb; }
.collapsible-left { display: flex; align-items: center; gap: 12px; }
.collapsible-icon {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  background: #eef4fb;
  color: var(--blue);
  flex-shrink: 0;
}
.collapsible-title { font-size: .92rem; font-weight: 700; color: var(--blue); text-transform: uppercase; letter-spacing: .04em; }
.collapsible-sub   { font-size: .73rem; color: var(--gray); margin-top: 2px; }
.collapsible-arrow {
  display: flex; align-items: center;
  color: var(--blue);
  transition: transform .3s;
  flex-shrink: 0;
}
.collapsible-card.open .collapsible-arrow { transform: rotate(180deg); }
.collapsible-body  { display: none; padding: 1.4rem; }
.collapsible-card.open .collapsible-body { display: block; }

/* ── FILTER ── */
.filter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 1.4rem;
}
label.field-label { font-size: .72rem; font-weight: 700; color: var(--gray); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 5px; display: block; }

/* Select with icon wrapper */
.select-wrap { position: relative; }
.select-wrap .select-icon {
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--gray);
}
.select-wrap select { padding-left: 32px; }

select, input[type=time] {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--gray-mid);
  border-radius: 0;
  font-size: .9rem;
  color: var(--text);
  background: #f8fafc;
  outline: none;
  transition: border-color .2s, background .2s;
  appearance: none;
  font-family: inherit;
}
select:focus, input[type=time]:focus { border-color: var(--blue); background: #fff; }

.btn-search {
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 0;
  padding: 10px 20px;
  font-size: .88rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: .04em;
  height: 44px;
}
.btn-search:hover { background: var(--blue-light); }

/* Tabellen */
.result-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.result-table th {
  background: var(--blue); color: #fff;
  padding: 9px 12px; text-align: left;
  font-size: .7rem; letter-spacing: .07em; text-transform: uppercase;
}
.result-table td { padding: 9px 12px; border-bottom: 1px solid var(--gray-mid); }
.result-table tr:last-child td { border-bottom: none; }
.result-table tr:nth-child(even) td { background: #f8fafc; }
.result-table tr:hover td { background: #dde8f5; }

/* Linie-Tags — farblich unterschieden */
.tag-line {
  display: inline-block;
  font-size: .72rem; font-weight: 700;
  padding: 2px 7px;
  border-radius: 0;
  color: #fff;
}
.tag-line-234 { background: var(--c234); }
.tag-line-240 { background: var(--c240); }
.tag-line-def { background: var(--blue); }  /* Fallback */

.tag-vb { display: inline-block; font-size: .62rem; padding: 1px 5px; border-radius: 0; margin-left: 4px; font-weight: 600; }
.tag-vb-s  { background: #fef3c7; color: #92400e; }
.tag-vb-f  { background: #dbeafe; color: #1e40af; }
.tag-vb-fr { background: #ede9fe; color: #6d28d9; }
.tag-vb-md { background: #fce7f3; color: #9d174d; }
.tag-vb-x  { background: #fecaca; color: #991b1b; }

.tag-min-soon  { color: #16a34a; font-weight: 700; }
.tag-min-near  { color: #b45309; font-weight: 700; }
.tag-min-later { color: var(--gray); }
.no-result { display: flex; align-items: center; gap: 8px; padding: 1.5rem 0; color: var(--gray); font-size: .9rem; }

/* ── KALENDER ── */
.cal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.2rem; }
.cal-nav-btn {
  background: none;
  border: 2px solid var(--blue);
  border-radius: 0;
  width: 36px; height: 36px;
  cursor: pointer;
  color: var(--blue);
  transition: all .15s;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.cal-nav-btn:hover { background: var(--blue); color: #fff; }
.cal-month-label { font-size: 1.05rem; font-weight: 700; color: var(--text); text-transform: uppercase; letter-spacing: .06em; }
.cal-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 1rem; font-size: .72rem; }
.cal-legend-item { display: flex; align-items: center; gap: 6px; color: var(--gray); }
.cal-legend-dot { width: 12px; height: 12px; border-radius: 0; flex-shrink: 0; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-dow { text-align: center; font-size: .67rem; font-weight: 700; color: var(--gray); text-transform: uppercase; padding: 4px 0; letter-spacing: .06em; }
.cal-dow.we { color: var(--red); }
.cal-day {
  border-radius: 0;
  padding: 6px 4px;
  text-align: center;
  cursor: pointer;
  transition: all .15s;
  min-height: 52px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  border: 2px solid transparent;
  background: #fff;
}
.cal-day:hover:not(.empty) { background: #dde8f5; border-color: var(--blue); }
.cal-day.empty { cursor: default; background: transparent; }
.cal-day.today { border-color: var(--blue); background: #eff6ff; }
.cal-day.selected { background: var(--blue); color: #fff; border-color: var(--blue); }
.cal-day-num { font-size: .88rem; font-weight: 600; margin-bottom: 3px; }
.cal-day.we-day .cal-day-num { color: var(--red); }
.cal-day.today .cal-day-num { color: var(--blue); font-weight: 800; }
.cal-day.selected .cal-day-num { color: #fff; }
.cal-day-badge { font-size: .52rem; padding: 1px 4px; border-radius: 0; font-weight: 700; letter-spacing: .02em; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.badge-ferien   { background: #fef3c7; color: #92400e; }
.badge-feiertag { background: #fce7f3; color: #9d174d; }
.cal-day.selected .badge-ferien,
.cal-day.selected .badge-feiertag { background: rgba(255,255,255,.28); color: rgba(255,255,255,.95); }

/* ── TAGESVORSCHAU ── */
.day-preview {
  margin-top: 1.4rem;
  padding: 1.2rem 1.4rem;
  background: #f8fafc;
  border: 1px solid #d1d9e3;
  border-top: 2px solid var(--blue);
}
.day-preview-title {
  font-size: .92rem; font-weight: 700; color: var(--blue);
  margin-bottom: .7rem; text-transform: uppercase; letter-spacing: .04em;
  display: flex; align-items: center; gap: 7px;
}
.day-preview-meta { font-size: .75rem; color: var(--gray); margin-bottom: .8rem; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.day-filter-bar {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end;
  margin-bottom: 1rem;
  padding: .9rem 1rem;
  background: #fff;
  border: 1px solid #d1d9e3;
}
.day-filter-field { display: flex; flex-direction: column; gap: 4px; min-width: 120px; }
.day-filter-bar select,
.day-filter-bar input[type=time] { padding: 7px 10px; font-size: .85rem; }
.btn-day-search {
  background: var(--blue); color: #fff;
  border: none; border-radius: 0;
  padding: 8px 16px; font-size: .85rem; font-weight: 700;
  cursor: pointer; transition: background .2s;
  white-space: nowrap; align-self: flex-end;
  display: inline-flex; align-items: center; gap: 6px;
  text-transform: uppercase; height: 38px;
}
.btn-day-search:hover { background: var(--blue-light); }
.btn-now {
  background: none; border: 1.5px solid var(--gray-mid); border-radius: 0;
  padding: 4px 8px; font-size: .72rem; color: var(--gray);
  cursor: pointer; transition: all .15s; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 4px;
}
.btn-now:hover { background: var(--blue); color: #fff; border-color: var(--blue); }
.time-row { display: flex; gap: 4px; align-items: center; }

.day-preview-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.day-preview-table th {
  background: var(--blue); color: #fff;
  padding: 7px 10px; text-align: left;
  font-size: .68rem; letter-spacing: .06em; text-transform: uppercase;
}
.day-preview-table td { padding: 7px 10px; border-bottom: 1px solid var(--gray-mid); vertical-align: middle; }
.day-preview-table tr:nth-child(even) td { background: #fff; }
.day-preview-table tr:last-child td { border-bottom: none; }
.day-preview-table tr:hover td { background: #dde8f5; }
.day-preview-no { color: var(--gray); font-size: .82rem; padding: .4rem 0; display: flex; align-items: center; gap: 6px; }

/* Zusammengefasste Zeiten im Kalender */
.dp-times { display: flex; flex-wrap: wrap; gap: 4px; }
.dp-time-chip {
  font-size: .75rem; font-weight: 700;
  padding: 1px 6px; border-radius: 0;
  font-family: 'Share Tech Mono', monospace;
}
.dp-time-chip-234 { background: var(--c234-bg); color: var(--c234); border: 1px solid var(--c234-border); }
.dp-time-chip-240 { background: var(--c240-bg); color: var(--c240); border: 1px solid var(--c240-border); }

/* ── LINIENNETZ ── */
.linemap-selector { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 1.4rem; }
.lm-btn {
  padding: 7px 14px;
  border-radius: 0;
  border: 2px solid var(--gray-mid);
  background: #fff;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  color: var(--text);
  display: inline-flex; align-items: center;
}
.lm-btn.lm-234 { border-color: var(--c234-border); color: var(--c234); background: var(--c234-bg); }
.lm-btn.lm-240 { border-color: var(--c240-border); color: var(--c240); background: var(--c240-bg); }
.lm-btn.lm-234:hover,
.lm-btn.lm-234.on234 { background: var(--c234); color: #fff; border-color: var(--c234); }
.lm-btn.lm-240:hover,
.lm-btn.lm-240.on240 { background: var(--c240); color: #fff; border-color: var(--c240); }

.h-track { position: relative; padding: 40px 0 16px; margin: 0 10px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.h-track-line { position: absolute; top: 46px; left: 0; right: 0; height: 4px; }
.h-line234 { background: var(--c234); }
.h-line240 { background: var(--c240); }
.h-stops   { display: flex; justify-content: space-between; position: relative; z-index: 1; min-width: 600px; }
.h-stop    { display: flex; flex-direction: column; align-items: center; flex: 1; min-width: 0; }
.h-dot {
  width: 12px; height: 12px; border-radius: 0;
  border: 3px solid #cbd5e1; background: #fff;
  margin-bottom: 8px; flex-shrink: 0;
  position: relative; z-index: 2;
}
.h-dot.wi234 { width: 14px; height: 14px; border: 3px solid var(--c234); background: var(--c234-bg); }
.h-dot.wi240 { width: 14px; height: 14px; border: 3px solid var(--c240); background: var(--c240-bg); }
.h-dot.term  { background: #475569; border-color: #334155; }
.h-lbl  { font-size: .68rem; color: var(--gray); text-align: center; line-height: 1.3; max-width: 80px; word-wrap: break-word; }
.h-lbl.wi   { font-weight: 700; color: var(--text); font-size: .72rem; }
.h-lbl.term { font-weight: 700; color: #334155; }
.h-note { font-size: .58rem; color: #94a3b8; text-align: center; margin-top: 2px; font-style: italic; }
.h-spacer { display: flex; flex-direction: column; align-items: center; flex: 0 0 24px; padding-top: 1px; }
.h-spacer-dots { color: #94a3b8; font-size: .7rem; letter-spacing: .12em; margin-bottom: 8px; }
.h-dir  { font-size: .78rem; color: var(--gray); margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.h-dir strong { color: var(--text); }
.h-info {
  font-size: .72rem; color: var(--gray);
  margin-top: 14px; line-height: 1.5;
  padding: 8px 12px;
  background: var(--gray-light);
  border-left: 3px solid var(--gray-mid);
  display: flex; align-items: flex-start; gap: 6px;
}

/* ── FOOTER ── */
footer {
  background: var(--blue-dark);
  color: rgba(255,255,255,.65);
  border-top: 3px solid var(--blue);
}
.footer-inner {
  max-width: 1100px; margin: 0 auto;
  padding: 1.4rem 1.5rem;
  display: flex; flex-direction: column; gap: 6px;
  font-size: .78rem; line-height: 1.7; text-align: center;
}
footer a { color: rgba(255,255,255,.8); text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* ════════════════════════════════════════
   RESPONSIVE – Tablet (≤ 900px)
════════════════════════════════════════ */
@media (max-width: 900px) {
  main { padding: 1.5rem 1.2rem 2.5rem; }
  .filter-grid { grid-template-columns: 1fr 1fr; }
  .btn-search  { grid-column: 1 / -1; width: 100%; justify-content: center; }
  .led-col-header, .dep-main-row { grid-template-columns: 70px 1fr 80px 80px 28px; }
  .header-title { font-size: 1rem; }
}

/* ════════════════════════════════════════
   RESPONSIVE – Smartphone (≤ 600px)
════════════════════════════════════════ */
@media (max-width: 600px) {

  /* ── Globales Layout ── */
  header { padding: 0 1rem; height: 56px; }
  .header-title    { font-size: .95rem; }
  .header-subtitle { display: none; }
  .header-right    { display: none; }

  .clock-bar { padding: 0 1rem; height: 36px; gap: 6px; }
  #live-clock { font-size: .88rem; }
  .last-update { display: none; }
  #update-ok   { display: none; }
  .refresh-btn span { display: none; }
  .refresh-btn { padding: 4px 8px; }

  .status-bar-inner { padding: 6px 1rem; }
  .status-badge { font-size: .7rem; padding: 2px 7px; }
  .status-bar-disclaimer { display: none; }

  main { padding: .85rem .75rem 2rem; }
  .section-title  { font-size: .92rem; }
  .disclaimer-bar { font-size: .75rem; padding: 8px 12px; }

  /* ── Linienfilter + Legende ── */
  .line-filter-wrap {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 10px 12px;
  }
  .line-filter-bar { justify-content: flex-start; gap: 6px; }
  .lf-btn { padding: 5px 14px; font-size: .78rem; }
  .line-legend { gap: 6px; }
  .line-legend-item { padding: 4px 8px 4px 5px; }
  .legend-badge { width: 32px; height: 26px; font-size: .78rem; }
  .legend-text strong { font-size: .74rem; }
  .legend-text span   { display: none; }

  /* ════════════════════════════════════════
     BOARD – Smartphone-Karten-Design
     Jede Abfahrt = eigenständige dunkle Karte
     Layout pro Karte:
       [Linie-Spalte] | [Ziel-Block]  | [Zeit-Spalte]
                      | [Nächster Halt → schmale Fußzeile]
  ════════════════════════════════════════ */

  /* Äußerer Rahmen: kein Padding mehr, transparent */
  .led-outer {
    padding: 0;
    background: transparent;
    box-shadow: none;
    border: none;
    margin-bottom: 1.2rem;
  }
  .led-screen {
    background: transparent;
    padding: 0;
  }
  /* Scanlines-Overlay abschalten */
  .led-screen::after { display: none; }

  /* Spaltenheader ausblenden */
  .led-col-header { display: none; }

  /* Ticker-Leiste bleibt am Boden, aber kompakter */
  .led-brand {
    background: var(--board-bg);
    margin-top: 4px;
    padding: 6px 10px;
    border-top: 1px solid #1f1900;
  }
  .led-brand-text:first-child { display: none; }

  /* ── Jede Abfahrt = Karte ── */
  .dep-block {
    background: var(--board-bg);
    border: 1px solid #1e1900;
    margin-bottom: 5px;
    position: relative;
  }
  /* Nächste Abfahrt: Amber-Rahmen + leichter Glow */
  .dep-block.is-next-dep {
    border: 2px solid var(--amber);
    background: #0d0b00;
    box-shadow: 0 0 20px rgba(255,179,0,.13), 0 2px 14px rgba(0,0,0,.55);
  }
  .dep-block.is-gone { opacity: .42; }

  /* ── Hauptzeile: 3 Zonen ──
     [52px Linie] | [flex:1 Ziel] | [72px Zeit + Pfeil]
  ── */
  .dep-main-row {
    display: flex;
    align-items: stretch;
    padding: 0;
    gap: 0;
    grid-template-columns: unset; /* Grid aufheben */
  }
  .dep-main-row:hover { background: transparent; }

  /* Zone 1: Linien-Badge */
  .dep-main-row > div:first-child {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 52px;
    width: 52px;
    padding: 10px 6px;
    border-right: 1px solid #2a2200;
    background: rgba(255,179,0,.03);
    flex-shrink: 0;
    gap: 2px;
  }
  .next-dep-label {
    font-size: .38rem;
    letter-spacing: .09em;
    text-align: center;
    line-height: 1.3;
    margin-bottom: 1px;
  }
  .line-badge-led { font-size: 1.45rem; line-height: 1; }
  .dep-block.is-next-dep .line-badge-led {
    font-size: 1.6rem;
    text-shadow: 0 0 18px rgba(255,213,79,1), 0 0 36px rgba(255,213,79,.5);
  }

  /* Zone 2: Ziel */
  .dep-main-row > div:nth-child(2) {
    flex: 1;
    padding: 10px 10px 8px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  .dest-main-led {
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .dep-block.is-next-dep .dest-main-led { font-size: 1.05rem; }
  .dest-sub-led {
    display: block;
    font-size: .56rem;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Zone 3: Zeit + Expand-Pfeil */
  .dep-time-col {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    padding: 10px 8px 10px 4px;
    min-width: 70px;
    flex-shrink: 0;
    border-left: 1px solid #1e1900;
    text-align: right;
  }
  .dep-min { font-size: 1.1rem; }
  .dep-uhr { font-size: .6rem; margin-top: 2px; }
  .dep-block.is-next-dep .dep-min { font-size: 1.22rem; }

  .expand-btn {
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    padding-bottom: 4px;
    color: #2e2500;
  }
  .dep-block.open .expand-btn { color: var(--amber-dark); }

  /* Zone Mitte: Nächster Halt ausblenden (stattdessen Fußzeile) */
  .next-stop-col { display: none; }

  /* ── Fußzeile: Nächster Halt (immer sichtbar, schmal) ── */
  .dep-block::after {
    display: none; /* Fallback abschalten */
  }

  /* Nächster-Halt als eigene Row unter dep-main-row */
  /* Wir nutzen ein Pseudo-Element NICHT — stattdessen
     erzeugen wir die Zeile im bestehenden dep-main-row-Wrapper
     als letztes Flex-Child, indem wir das Board-Layout umbauen.
     Da das JS die next-stop-col als eigene div im dep-main-row hat,
     müssen wir sie anders positionieren. */

  /* Nächster Halt: Umpositionierung des next-stop-col
     als volle Breite unterhalb der drei Zonen */
  .dep-main-row {
    flex-wrap: wrap;
  }
  .next-stop-col {
    display: flex !important;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 4px 10px 5px 62px; /* eingerückt nach Linie-Spalte */
    border-top: 1px solid #1e1900;
    background: rgba(0,0,0,.18);
    order: 10; /* ans Ende */
  }
  .next-stop-name {
    font-size: .56rem;
    display: block;
    margin-bottom: 0;
  }
  .next-stop-name::before {
    content: 'Nächster Halt: ';
    font-size: .48rem;
    color: var(--amber-dark);
    text-transform: uppercase;
    letter-spacing: .07em;
    opacity: .75;
  }
  .next-stop-time { font-size: .85rem; }

  /* ── Ausgeklapptes Haltestellen-Panel ── */
  .dep-stops-panel {
    padding: 8px 8px 10px 12px;
    border-top: 1px solid #2a2200;
    background: rgba(0,0,0,.12);
  }
  .stop-entry { min-width: 56px; }
  .stop-sname { font-size: .55rem; }
  .stop-stime { font-size: .8rem; }

  /* ── Collapsible Karten ── */
  .collapsible-toggle { padding: .85rem 1rem; }
  .collapsible-body   { padding: 1rem; }
  .filter-grid { grid-template-columns: 1fr; gap: 8px; }
  .btn-search  { width: 100%; justify-content: center; }
  select, input[type=time] { font-size: .85rem; padding: 8px 10px; }

  /* ── Kalender ── */
  .cal-grid      { gap: 2px; }
  .cal-day       { min-height: 44px; padding: 4px 2px; }
  .cal-day-num   { font-size: .8rem; }
  .cal-day-badge { font-size: .48rem; padding: 1px 3px; }
  .cal-nav-btn   { width: 32px; height: 32px; }
  .cal-month-label { font-size: .88rem; }
  .cal-legend    { gap: 8px; font-size: .68rem; }

  .day-filter-bar   { flex-direction: column; padding: .8rem 1rem; gap: 8px; }
  .day-filter-field { min-width: unset; width: 100%; }
  .btn-day-search   { width: 100%; justify-content: center; }
  .time-row { flex-wrap: wrap; }

  .result-table, .day-preview-table { font-size: .78rem; }
  .result-table th, .result-table td,
  .day-preview-table th, .day-preview-table td { padding: 6px 8px; }

  /* ── Liniennetz ── */
  .linemap-selector { gap: 4px; }
  .lm-btn { padding: 6px 10px; font-size: .75rem; }
}

@media (max-width: 380px) {
  .cal-day       { min-height: 38px; }
  .cal-day-badge { display: none; }
  .lf-btn        { padding: 3px 8px; font-size: .7rem; }
  .dep-min       { font-size: .95rem; }
  .line-badge-led { font-size: 1.25rem !important; }
  .dest-main-led  { font-size: .9rem !important; }
  .dep-time-col   { min-width: 62px; }
}