:root {
  color-scheme: dark;
  --bg: #0b0d11;
  --bg-elevated: #12151b;
  --bg-card: #181c24;
  --bg-hover: #1f2530;
  --text: #e9ebef;
  --muted: #8b93a3;
  --border: #2a2f3a;
  --accent: #6cc24a;
  --accent-strong: #8ee06a;
  --accent-soft: rgba(108, 194, 74, 0.16);
  --berlin-red: #e6394f;
  --berlin-yellow: #ffce00;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}
* { box-sizing: border-box; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

html { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(1100px 480px at 12% -10%, rgba(108, 194, 74, 0.07), transparent 60%),
    radial-gradient(900px 420px at 110% 8%, rgba(230, 57, 79, 0.06), transparent 55%),
    var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.header-animate { animation: header-slide-down 0.45s ease-out; }
@keyframes header-slide-down {
  from { opacity: 0; transform: translateY(-100%); }
  to   { opacity: 1; transform: translateY(0); }
}

header {
  background: transparent;
}
nav {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0.85rem 1rem;
  display: flex;
  gap: 1.5rem;
  align-items: center;
}
nav a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s ease;
}
nav a.brand { margin-right: auto; }
nav a.manage-alerts { margin-left: auto; }
nav a:hover { color: var(--accent-strong); }
nav .nav-icon { flex-shrink: 0; }
.roundel { flex-shrink: 0; filter: drop-shadow(0 0 6px rgba(108, 194, 74, 0.45)); }

main {
  max-width: 1000px;
  width: 100%;
  margin: 0 auto;
  padding: 1.75rem 1rem 2.5rem;
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
}
main > :not(.search-hero) { flex-shrink: 0; }
footer {
  max-width: 1000px;
  margin: 2rem auto;
  padding: 1.25rem 1rem;
  color: var(--muted);
  font-size: 0.82rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
footer p { margin: 0; }
footer a { color: var(--muted); }
footer a:hover { color: var(--accent); }
.lang-switch a { color: var(--muted); text-decoration: none; }
.lang-switch a:hover, .lang-switch a.active { color: var(--accent); }

a { color: var(--accent); }
a:hover { color: var(--accent-strong); }

h1 {
  margin-top: 0;
  font-size: 1.65rem;
  letter-spacing: 0.01em;
  position: relative;
  padding-bottom: 0.65rem;
}
h1::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 52px;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--berlin-yellow));
}
h2 {
  font-size: 1.1rem;
  margin-top: 2rem;
  color: var(--text);
  border-left: 3px solid var(--accent);
  padding-left: 0.6rem;
}

table.consequences {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
table.consequences th {
  text-align: left;
  padding: 0.65rem 0.75rem;
  background: var(--bg-elevated);
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  border-bottom: 1px solid var(--border);
}
table.consequences td {
  text-align: left;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.consequences tbody tr:last-child td { border-bottom: none; }
table.consequences tbody tr:hover { background: var(--bg-hover); }
table.consequences td a { color: var(--text); font-weight: 500; }
table.consequences td a:hover { color: var(--accent-strong); }

.search-box { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; margin: 1.25rem 0; }
.search-box input[type="text"],
.search-box input[type="date"],
.search-box select {
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.92rem;
}
.search-box input[type="text"] { flex: 1; min-width: 220px; }
.search-box input::placeholder { color: var(--muted); }
.search-box input:focus, .search-box select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.search-box label { display: flex; gap: 0.4rem; align-items: center; font-size: 0.88rem; color: var(--muted); }
.hint { font-weight: 400; color: var(--muted); font-size: 0.78rem; }

.support-link { margin-top: 1.5rem; text-align: center; font-size: 0.78rem; }
.support-link a { color: var(--muted); text-decoration: none; }
.support-link a:hover { color: var(--accent); text-decoration: underline; }

/* ---- schedule summaries (table + detail page) ---- */
.schedule-entry {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.45rem;
  margin-bottom: 0.3rem;
}
.schedule-entry:last-child { margin-bottom: 0; }
.schedule-range { font-weight: 600; color: var(--text); }
.schedule-duration {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--accent-strong);
  background: var(--accent-soft);
  padding: 0.12rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
}
.schedule-recurring { font-size: 0.76rem; color: var(--muted); }

/* ---- email-alerts CTA banner ---- */
.cta-banner {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  margin: 0.5rem 0 1.75rem;
  padding: 1.1rem 1.4rem;
  background: linear-gradient(120deg, var(--accent-soft), rgba(255, 206, 0, 0.05));
  border: 1px solid rgba(108, 194, 74, 0.35);
  border-radius: 12px;
}
.cta-icon { flex-shrink: 0; color: var(--accent-strong); }
.cta-copy { flex: 1; }
.cta-copy strong { display: block; font-size: 1.02rem; margin-bottom: 0.2rem; }
.cta-copy p { margin: 0; color: var(--muted); font-size: 0.88rem; }
a.cta-button {
  flex-shrink: 0;
  display: inline-block;
  padding: 0.6rem 1.3rem;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--accent-strong), var(--accent) 55%, #4a8f30);
  color: #0b1209;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: filter 0.15s ease;
}
a.cta-button:hover { filter: brightness(1.12); color: #0b1209; }
@media (max-width: 640px) {
  .cta-banner { flex-direction: column; align-items: flex-start; }
  a.cta-button { align-self: stretch; text-align: center; }
}

input[type="checkbox"] { accent-color: var(--accent); }

button, .search-box button {
  padding: 0.55rem 1.4rem;
  border: none;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--accent-strong), var(--accent) 55%, #4a8f30);
  color: #0b1209;
  cursor: pointer;
  font-weight: 700;
  letter-spacing: 0.01em;
  transition: filter 0.15s ease, transform 0.1s ease;
}
button:hover, .search-box button:hover { filter: brightness(1.12); }
button:active, .search-box button:active { transform: translateY(1px); }

.badge {
  display: inline-block;
  padding: 0.18rem 0.6rem;
  border-radius: 5px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #0b0d11;
  background: #9aa3b2;
}
.badge-no_service, .badge-no_stop { background: var(--berlin-red); color: #fff; }
.badge-replacement, .badge-shuttle_service { background: #f5a623; }
.badge-tact_change, .badge-train_service_changed { background: #4ea1ff; }
.badge-special { background: #b18cff; }

.status { font-size: 0.85rem; font-weight: 700; }
.status.active { color: var(--berlin-red); }
.status.active::before { content: "● "; }
.status.resolved { color: var(--accent-strong); }
.status.resolved::before { content: "✓ "; }

ul.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem; padding: 0; margin: 0.5rem 0; }
ul.chips li a {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  text-decoration: none;
  color: var(--text);
  font-size: 0.85rem;
  transition: border-color 0.15s ease, color 0.15s ease;
}
ul.chips li a:hover { border-color: var(--accent); color: var(--accent-strong); }

dl.meta {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.4rem 1.25rem;
  margin: 1rem 0;
  padding: 1rem 1.1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
}
dl.meta dt { color: var(--muted); font-size: 0.85rem; }
dl.meta dd { margin: 0; }

ul.periods, ul.changes { padding-left: 1.2rem; }
ul.periods li, ul.changes li { margin-bottom: 0.5rem; }
ul.changes li strong { color: var(--accent-strong); }

.subscribe-page {
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.subscribe-page h1::after { left: 50%; transform: translateX(-50%); }
.subscribe-page > p, .subscribe-page > .notice { max-width: 480px; }
.subscribe-page form.subscribe-form { text-align: left; width: 100%; }

form.subscribe-form {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  max-width: 560px;
  padding: 1.5rem 1.6rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
form.subscribe-form label { font-weight: 600; font-size: 0.9rem; }
form.subscribe-form input, form.subscribe-form select {
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 0.95rem;
}
form.subscribe-form input:focus, form.subscribe-form select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
form.subscribe-form select[multiple] { min-height: 8rem; }
form.subscribe-form select[multiple] option:checked {
  background: var(--accent-soft);
  color: var(--accent-strong);
}
form.subscribe-form button { align-self: flex-start; padding: 0.6rem 1.5rem; font-size: 0.95rem; }

/* ---- multi-step layout ---- */
.step-indicator {
  display: flex;
  gap: 0.5rem;
  list-style: none;
  margin: 0 0 0.4rem;
  padding: 0;
}
.step-indicator .step {
  flex: 1;
  text-align: center;
  padding: 0 0 0.6rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--muted);
  border-bottom: 3px solid var(--border);
  transition: color 0.2s ease, border-color 0.2s ease;
}
.step-indicator .step.active { color: var(--accent-strong); border-color: var(--accent); }

.form-step { display: flex; flex-direction: column; gap: 1.2rem; }
.form-step[hidden] { display: none; }
.step-intro { color: var(--muted); font-size: 0.88rem; margin: 0; line-height: 1.5; }
.step-actions { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-top: 0.2rem; }
.step-actions .btn-back {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
}
.step-actions .btn-back:hover { color: var(--text); border-color: var(--muted); filter: none; }

/* ---- searchable station picker ---- */
.field-group { display: flex; flex-direction: column; gap: 0.55rem; }
.field-group > label { font-weight: 600; font-size: 0.9rem; }

.search-results {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-elevated);
}
.search-results li {
  padding: 0.55rem 0.85rem;
  cursor: pointer;
  font-size: 0.92rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s ease, color 0.12s ease;
}
.search-results li:last-child { border-bottom: none; }
.search-results li:hover,
.search-results li.is-focused { background: var(--bg-hover); color: var(--accent-strong); }
.search-results li.search-no-result {
  color: var(--muted);
  font-style: italic;
  cursor: default;
  pointer-events: none;
}

ul.selected-chips {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0;
  margin: 0;
}
ul.selected-chips .chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.32rem 0.55rem 0.32rem 0.85rem;
  background: var(--accent-soft);
  border: 1px solid rgba(108, 194, 74, 0.4);
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--accent-strong);
}
ul.selected-chips .chip button {
  background: transparent;
  border: none;
  color: inherit;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.15rem;
}
ul.selected-chips .chip button:hover { color: var(--berlin-red); }

/* ---- pill multi-select for lines ---- */
.pill-group { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 0.42rem 1.05rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.pill input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.pill:hover { border-color: var(--accent); }
.pill:has(input:checked) {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-strong);
  font-weight: 700;
}
.pill:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

.notice {
  padding: 0.9rem 1.1rem;
  border-radius: 8px;
  background: var(--accent-soft);
  border: 1px solid rgba(108, 194, 74, 0.35);
  color: var(--text);
  margin: 1rem 0;
}
.notice.error { background: rgba(230, 57, 79, 0.12); border-color: rgba(230, 57, 79, 0.4); }

/* ---- account / alert management ---- */
ul.subscription-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 0;
  margin: 1.25rem 0;
}
.subscription-card {
  padding: 1.1rem 1.3rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.subscription-meta { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.subscription-status {
  display: inline-block;
  padding: 0.18rem 0.6rem;
  border-radius: 5px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.subscription-status.status-active { background: var(--accent-soft); color: var(--accent-strong); }
.subscription-status.status-pending_confirmation { background: rgba(255, 206, 0, 0.14); color: var(--berlin-yellow); }
.subscription-status.status-unsubscribed { background: rgba(154, 163, 178, 0.16); color: var(--muted); }
.subscription-since { color: var(--muted); font-size: 0.82rem; }
.subscription-scope { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.92rem; }
.subscription-scope .scope-line strong { color: var(--muted); font-weight: 600; }
.btn-unsubscribe {
  align-self: flex-start;
  background: transparent;
  border: 1px solid var(--berlin-red);
  color: var(--berlin-red);
  font-weight: 600;
}
.btn-unsubscribe:hover { background: rgba(230, 57, 79, 0.12); filter: none; }

/* ---- homepage station search ---- */
.station-search-box {
  position: relative;
  max-width: 420px;
  margin: 1.25rem 0 2rem;
}
.station-search-box .field-group { gap: 0.4rem; }
.station-search-box input[type="text"] {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: hidden;
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text);
  font-size: 1rem;
}
.station-search-box input::placeholder { color: var(--muted); }
.station-search-box input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.station-search-box .search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 0.4rem;
  z-index: 5;
  box-shadow: var(--shadow);
}

/* ---- calendar date-range navigation ---- */
.calendar-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin: 1.25rem 0;
  padding: 0.65rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.calendar-nav-link {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.88rem;
  text-decoration: none;
  white-space: nowrap;
}
.calendar-nav-link:hover { color: var(--accent-strong); }
.calendar-nav-link.is-disabled { color: var(--muted); }
.calendar-nav-range { color: var(--muted); font-size: 0.84rem; font-weight: 600; }

/* ---- station calendar ---- */
.station-calendar { margin-top: 1.5rem; }
.station-calendar + .station-calendar {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}
.station-calendar-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.station-calendar-header h2 { margin: 0; display: flex; align-items: center; gap: 0.4rem; }
.remove-station {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  font-size: 1.05rem;
  line-height: 1;
  color: var(--muted);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}
.remove-station:hover { background: rgba(230, 57, 79, 0.15); color: var(--berlin-red); }
.station-calendar-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }
a.ics-button {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
a.ics-button:hover { border-color: var(--accent); color: var(--accent-strong); background: var(--accent-soft); }

.line-filter { margin: 1.1rem 0 0; }
.line-filter-label {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin: 0 0 0.6rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}
.line-filter-toggle {
  background: transparent;
  border: none;
  padding: 0;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.8rem;
  text-decoration: underline;
  cursor: pointer;
}
.line-filter-toggle:hover { color: var(--accent-strong); }
.pill-affected span::after {
  content: "";
  display: inline-block;
  width: 0.4rem;
  height: 0.4rem;
  margin-left: 0.4rem;
  border-radius: 50%;
  background: var(--berlin-red);
  vertical-align: middle;
}

/* ---- calendar (table, 7 col × 4 week) ---- */
.calendar-grid-wrap { overflow-x: auto; margin: 1.25rem 0; }
.calendar-table-outer {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.calendar-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}
.calendar-weekday {
  padding: 0.45rem 0.5rem;
  background: var(--bg-elevated);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: left;
  border-bottom: 2px solid var(--border);
  border-right: 1px solid var(--border);
}
.calendar-weekday:last-child { border-right: none; }

/* Date cells */
.calendar-day {
  vertical-align: top;
  padding: 0.35rem 0.4rem 0.3rem;
  height: 6.5rem;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.calendar-day:last-child { border-right: none; }
.calendar-day.has-disruption { background: rgba(230, 57, 79, 0.07); }
.calendar-date-wrap { display: flex; align-items: center; gap: 0.25rem; }
.calendar-day-pills {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 0.3rem;
}
.calendar-day-pill {
  display: block;
  background: var(--berlin-red);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: filter 0.15s ease;
}
.calendar-day-pill:hover { filter: brightness(1.15); color: #fff; }
.calendar-date {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  flex-shrink: 0;
}
.calendar-day.is-today .calendar-date { color: #0b1209; background: var(--accent); }
.calendar-date-month { font-size: 0.67rem; color: var(--muted); opacity: 0.6; font-weight: 500; }

/* Week separator */
.calendar-week-group tr:last-child td { border-bottom: 1px solid var(--border); }
.calendar-week-group:last-child tr:last-child td { border-bottom: none; }

/* ---- station+line detail: exact schedules ---- */
.disruption-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 0;
  margin: 1.25rem 0;
}
ul.exact-periods { padding-left: 0; list-style: none; }
ul.exact-periods li {
  padding: 0.65rem 0.8rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 0.55rem;
}
ul.exact-periods li:last-child { margin-bottom: 0; }
.exact-period-range {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1.5rem;
  font-weight: 600;
}
.exact-period-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.55rem;
  margin-top: 0.4rem;
}

/* ---- station+line detail: page header + grouped disruptions ---- */
.back-link { margin: 0 0 1rem; }
.back-link a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.88rem;
  text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.back-link a:hover { border-color: var(--accent); color: var(--accent-strong); background: var(--accent-soft); }

.page-header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}
.page-header-row h1 { margin: 0; }

.disruption-card { gap: 0; }
.disruption-routes {
  list-style: none;
  padding: 0;
  margin: 0 0 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.disruption-route { padding-bottom: 0.7rem; border-bottom: 1px solid var(--border); }
.disruption-route:last-child { padding-bottom: 0; border-bottom: none; }
.disruption-route-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.effect-explainer {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

@media (max-width: 640px) {
  .page-header-row { flex-direction: column; align-items: flex-start; }
  .station-calendar-actions { width: 100%; }
  .page-header-row .ics-button {
    justify-content: center;
    width: 100%;
    text-align: center;
    line-height: 1.3;
  }
  .page-header-row .ics-button span {
    white-space: normal;
    min-width: 0;
  }
  .disruption-route-head { gap: 0.4rem; }
  .exact-period-range { flex-direction: column; gap: 0.2rem; }
  .calendar-table { font-size: 0.82rem; }
}

.inline-form { display: inline; }
.link-button {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
}
.link-button:hover { filter: none; color: var(--accent-strong, var(--accent)); }

/* =================================================================
   HOMEPAGE – HERO + VR SEARCH ANIMATION
   ================================================================= */

/* ---- hero layout ---- */
.search-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 1rem;
  flex: 1;
  min-height: 0;
  gap: 0;
}

.hero-roundel {
  filter: drop-shadow(0 0 18px rgba(108, 194, 74, 0.55));
  opacity: 0;
  animation: hero-fade-up 0.7s 0.0s ease-out forwards;
  margin-bottom: 1.2rem;
}

.hero-title {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  margin: 0 0 0.5rem;
  background: linear-gradient(125deg, var(--accent-strong) 0%, var(--berlin-yellow) 60%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
  opacity: 0;
  animation: hero-fade-up 0.65s 0.12s ease-out forwards;
}
.hero-title::after { display: none; }

.hero-tagline {
  font-size: 1.02rem;
  color: var(--muted);
  margin: 0 0 2.4rem;
  letter-spacing: 0.01em;
  opacity: 0;
  animation: hero-fade-up 0.6s 0.22s ease-out forwards;
}

.hero-hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 1rem 0 0;
  opacity: 0;
  animation: hero-fade-up 0.5s 0.5s ease-out forwards;
}
.hero-hint em { font-style: normal; color: var(--accent); }
.search-hero:has(.search-results:not([hidden])) .hero-hint {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

@keyframes hero-fade-up {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- hero search form sizing ---- */
.search-hero form {
  width: min(560px, 100%);
  margin: 0;
  opacity: 0;
  animation: hero-fade-up 0.55s 0.35s ease-out forwards;
  position: relative;
  z-index: 1;
}

.search-hero form input[type="text"] {
  width: 100%;
  padding: 1.05rem 1.3rem;
  font-size: 1.15rem;
  border: hidden;
  border-radius: 12px;
  background: var(--bg-card);
  color: var(--text);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.search-hero form input[type="text"]::placeholder { color: var(--muted); }
.search-hero form input[type="text"]::selection,
.station-search-box input[type="text"]::selection {
  background: var(--bg-card);
  color: var(--muted);
}
.search-hero form input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft), 0 0 22px 2px rgba(108, 194, 74, 0.14);
}

/* ---- shared search-input wrapper ---- */
.search-input-wrap {
  position: relative;
  border-radius: 12px;
}

/* make the dropdown position relative to this wrapper in both states */
.search-input-wrap .search-results {
  position: absolute;
  top: calc(100% + 0.4rem);
  left: 0;
  right: 0;
  z-index: 5;
  box-shadow: var(--shadow);
}

/* ---- AI spinning glow border ---- */
@property --vr-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

@keyframes vr-rotate {
  to { --vr-angle: 360deg; }
}

.vr-glow-ring {
  position: absolute;
  inset: -2px;
  border-radius: 14px;
  padding: 2px;
  background: conic-gradient(
    from var(--vr-angle),
    #6cc24a,
    #ffce00,
    #e6394f,
    #6cc24a
  );
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: vr-rotate 1s linear infinite;
  animation-play-state: paused;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  filter: drop-shadow(0 0 4px rgba(108, 194, 74, 0.7))
          drop-shadow(0 0 8px rgba(255, 206, 0, 0.4));
}

.search-input-wrap:focus-within .vr-glow-ring {
  opacity: 1;
}

.search-input-wrap.vr-spinning .vr-glow-ring {
  opacity: 1;
  animation-play-state: running;
}

/* ---- hero collapse (pre-submit) ---- */
.search-hero.collapsing {
  animation: hero-collapse 0.42s ease-in forwards;
  pointer-events: none;
}

@keyframes hero-collapse {
  0%   { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-28px) scale(0.982); }
}

/* ---- compact search bar (results page) ---- */
.station-search-compact {
  max-width: 420px !important;
  margin: 0 0 1.5rem !important;
  position: relative;
  z-index: 1;
  opacity: 0;
  animation: compact-slide-in 0.4s 0.05s ease-out forwards;
}

@keyframes compact-slide-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- results section appear ---- */
.homepage-results {
  opacity: 0;
  transform: translateY(16px);
  animation: results-appear 0.55s 0.22s ease-out forwards;
}

@keyframes results-appear {
  to { opacity: 1; transform: translateY(0); }
}

/* ---- calendar week navigation (no full page reload) ---- */
#calendar-content.nav-out-prev { animation: calendar-out-right 0.15s ease-in forwards; }
#calendar-content.nav-out-next { animation: calendar-out-left 0.15s ease-in forwards; }
#calendar-content.nav-in-prev { animation: calendar-in-left 0.25s ease-out; }
#calendar-content.nav-in-next { animation: calendar-in-right 0.25s ease-out; }
#calendar-content.nav-in-fade { animation: calendar-fade-in 0.25s ease-out; }

@keyframes calendar-out-left  { to { opacity: 0; transform: translateX(-16px); } }
@keyframes calendar-out-right { to { opacity: 0; transform: translateX(16px); } }
@keyframes calendar-in-left   { from { opacity: 0; transform: translateX(-16px); } to { opacity: 1; transform: translateX(0); } }
@keyframes calendar-in-right  { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: translateX(0); } }
@keyframes calendar-fade-in   { from { opacity: 0; } to { opacity: 1; } }
