/* BahnsteigFreuden – Farben wie in der iOS-App (Theme.swift) */
:root {
  color-scheme: light dark;
  --bg: #f2f2f7;
  --card: #ffffff;
  --text: #000000;
  --secondary: #6c6c70;
  --separator: #d1d1d6;
  --tint: #0a63c9;
  --platform-bg: #13294b;
  --platform-fg: #ffffff;
  --changed-bg: #ffd60a;
  --changed-fg: #000000;
  --delayed: #b00020;
  --on-time: #116329;
  --cancelled-bg: #e5e5ea;
  --danger: #c62828;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --card: #1c1c1e;
    --text: #ffffff;
    --secondary: #98989f;
    --separator: #38383a;
    --tint: #4da3ff;
    --platform-bg: #2b4c7e;
    --delayed: #ff8a80;
    --on-time: #6ee7a0;
    --cancelled-bg: #2c2c2e;
    --danger: #ff6b6b;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-size: 17px;
  line-height: 1.3;
  padding: env(safe-area-inset-top) max(16px, env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  -webkit-text-size-adjust: 100%;
}
main { max-width: 640px; margin: 0 auto; }
button, input { font: inherit; color: inherit; }
a { color: var(--tint); }
.tabular { font-variant-numeric: tabular-nums; }
.secondary { color: var(--secondary); }
.hidden { display: none !important; }

/* Kopfzeile */
header.bar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px 0 4px;
}
header.bar h1 { font-size: 32px; font-weight: 800; margin: 0; letter-spacing: -0.5px; }
header.bar .actions { display: flex; gap: 4px; }
.icon-button {
  background: none; border: 0; color: var(--tint); font-size: 17px; padding: 8px 10px;
  border-radius: 10px; cursor: pointer;
}
.icon-button:active { background: var(--separator); }
.back { padding-left: 0; }

/* Listen */
.section-header { font-size: 15px; font-weight: 600; color: var(--secondary); margin: 18px 4px 6px; }
.list { background: var(--card); border-radius: 14px; overflow: hidden; }
.row {
  display: block; width: 100%; text-align: left; background: none; border: 0;
  padding: 12px 16px; border-bottom: 1px solid var(--separator); cursor: pointer;
}
.row:last-child { border-bottom: 0; }
.row:active { background: var(--separator); }
.row.static { cursor: default; }
.row.static:active { background: none; }
.footer { text-align: center; font-size: 13px; color: var(--secondary); margin: 10px 0; }

/* Favoriten-Kachel */
.fav-header { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.fav-header .sub { display: block; font-size: 12px; font-weight: 400; color: var(--secondary); }
.fav-header .return { display: block; font-size: 12px; font-weight: 600; color: var(--secondary); }
.nearby-dot { color: var(--tint); margin-right: 4px; }
.fav-body { display: flex; align-items: center; gap: 12px; }
.fav-body .next { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.fav-body .line-countdown { white-space: nowrap; }
.fav-body .line-countdown .line { font-weight: 600; display: block; }
.status-msg { font-size: 15px; color: var(--secondary); }
.status-msg.error { color: var(--delayed); }

/* Abfahrtszeit */
.dep-time { white-space: nowrap; }
.dep-time .time { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; display: block; line-height: 1.1; }
.dep-time.small .time { font-size: 22px; }
.dep-time .state { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.dep-time.cancelled .time { text-decoration: line-through; color: var(--secondary); }
.delayed { color: var(--delayed); }
.on-time { color: var(--on-time); }
.planned { color: var(--secondary); }
s { text-decoration-thickness: 1.5px; }

/* Gleis-Schild: das wichtigste Element */
.platform {
  flex: none; min-width: 68px; padding: 6px 10px; border-radius: 12px; text-align: center;
  background: var(--platform-bg); color: var(--platform-fg);
}
.platform .label { font-size: 11px; font-weight: 700; text-transform: uppercase; white-space: nowrap; }
.platform .number { font-size: 34px; font-weight: 900; line-height: 1.05; font-variant-numeric: tabular-nums; white-space: nowrap; font-family: ui-rounded, -apple-system, sans-serif; }
.platform .instead { font-size: 15px; font-weight: 700; white-space: nowrap; }
.platform.changed { background: var(--changed-bg); color: var(--changed-fg); box-shadow: inset 0 0 0 2px rgba(0,0,0,.6); }
.platform.cancelled { background: var(--cancelled-bg); color: var(--secondary); }
.platform.cancelled .number { text-decoration: line-through; }

/* Abfahrtsliste */
.conn { display: flex; align-items: center; gap: 12px; }
.conn .when { min-width: 76px; }
.conn .details { flex: 1; min-width: 0; }
.conn .details .line { font-weight: 600; }
.conn .details .dir, .conn .details .arr { font-size: 15px; }
.conn .details .arr { color: var(--secondary); }
.conn .details .remark { font-size: 13px; color: var(--secondary); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.conn .details .remark.cancelled { color: var(--delayed); }
.badge-cancelled { font-size: 11px; font-weight: 800; text-transform: uppercase; color: #fff; background: var(--delayed); border-radius: 99px; padding: 2px 6px; margin-left: 6px; vertical-align: 2px; }
.countdown { font-size: 15px; color: var(--secondary); font-variant-numeric: tabular-nums; }

/* Formulare */
.field { display: block; width: 100%; padding: 12px 14px; border: 1px solid var(--separator); border-radius: 12px; background: var(--card); margin: 6px 0; }
.primary {
  display: block; width: 100%; padding: 14px; border: 0; border-radius: 14px; background: var(--tint); color: #fff;
  font-weight: 600; font-size: 17px; cursor: pointer; margin: 12px 0;
}
.primary:disabled { opacity: .5; }
.danger-text { color: var(--danger); }
.edit-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.edit-actions button { border: 1px solid var(--separator); background: var(--bg); border-radius: 10px; padding: 6px 10px; font-size: 15px; cursor: pointer; }
.edit-actions .danger-text { border-color: var(--danger); }
.empty { text-align: center; padding: 40px 16px; }
.empty .big { font-size: 48px; }
.message { padding: 12px 14px; border-radius: 12px; background: var(--card); margin: 10px 0; }
.message.error { color: var(--delayed); }
.invite-link { word-break: break-all; font-family: ui-monospace, Menlo, monospace; font-size: 13px; background: var(--bg); padding: 8px; border-radius: 8px; margin: 8px 0; }
.pill { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--bg); color: var(--secondary); white-space: nowrap; }
.pill.open { color: var(--on-time); }
.row-flex { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--separator); border-top-color: var(--secondary); border-radius: 50%; animation: spin 0.8s linear infinite; vertical-align: -2px; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Wischgesten auf Favoriten (wie iOS-Listen) */
.swipe { position: relative; overflow: hidden; border-bottom: 1px solid var(--separator); }
.swipe:last-child { border-bottom: 0; }
.swipe .swipe-content { border-bottom: 0; background: var(--card); position: relative; z-index: 1;
  transition: transform .25s ease; touch-action: pan-y; }
.swipe-actions { position: absolute; top: 0; bottom: 0; display: flex; }
.swipe-actions.leading { left: 0; }
.swipe-actions.trailing { right: 0; }
.swipe-actions button { border: 0; color: #fff; font-weight: 600; font-size: 15px; width: 105px; padding: 0 6px; cursor: pointer; }
.swipe-actions .flip { background: #5856d6; width: 104px; }
.swipe-actions .rename { background: #ff9500; }
.swipe-actions .delete { background: #ff3b30; }

/* Ziehen zum Aktualisieren */
#ptr { height: 0; overflow: hidden; display: flex; align-items: center; justify-content: center;
  color: var(--secondary); font-size: 14px; transition: height .2s ease; max-width: 640px; margin: 0 auto; }
