:root {
  color-scheme: light;
  font-family: Inter, ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --navy: #0c294f;
  --blue: #1667d9;
  --cyan: #0ab6d5;
  --mint: #21b47e;
  --amber: #ef9215;
  --red: #e63b48;
  --ink: #101b2b;
  --muted: #697386;
  --card: rgba(255, 255, 255, 0.88);
  --line: rgba(12, 41, 79, 0.1);
  background: #f6f9fd;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 88% 5%, rgba(10, 182, 213, 0.12), transparent 24rem),
    linear-gradient(180deg, #fff 0%, #f5f8fd 45%, #eef5fb 100%);
}

button { font: inherit; }

.shell {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: max(22px, env(safe-area-inset-top)) 18px max(36px, env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--blue);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  color: var(--navy);
  font-size: clamp(2.35rem, 10vw, 3.8rem);
  line-height: 1;
  letter-spacing: -0.055em;
}

h1 span { color: var(--mint); }

.today { margin: 8px 0 0; color: var(--muted); font-size: 1rem; }

.brand-icon {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  box-shadow: 0 14px 32px rgba(240, 126, 17, 0.22);
}

.direction-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  margin-bottom: 18px;
  border-radius: 18px;
  background: #e8edf5;
}

.direction-tab {
  min-height: 50px;
  border: 0;
  border-radius: 14px;
  color: #26354b;
  background: transparent;
  font-weight: 750;
  cursor: pointer;
}

.direction-tab[aria-pressed="true"] {
  color: var(--navy);
  background: #fff;
  box-shadow: 0 3px 12px rgba(12, 41, 79, 0.09);
}

.service-alert {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 13px;
  margin: 0 0 18px;
  padding: 16px;
  border: 1px solid rgba(230, 59, 72, 0.22);
  border-radius: 20px;
  background: rgba(230, 59, 72, 0.07);
}

.alert-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  color: #fff;
  background: var(--red);
  font-weight: 900;
}

.service-alert h2 { margin: 1px 0 5px; color: var(--navy); font-size: 1rem; }
.service-alert p { margin: 0; color: var(--muted); font-size: 0.86rem; line-height: 1.45; }
.service-alert a { display: inline-block; margin-top: 8px; color: var(--red); font-size: 0.82rem; font-weight: 750; }

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 180px;
  padding: 24px;
  border-radius: 26px;
  color: #fff;
  background: linear-gradient(135deg, var(--navy), var(--blue));
  box-shadow: 0 18px 35px rgba(19, 71, 139, 0.22);
}

.hero-route { margin: 0 0 8px; color: rgba(255,255,255,.7); font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.hero-countdown { margin: 0; font-size: clamp(2rem, 9vw, 3.4rem); font-weight: 850; line-height: 1.05; letter-spacing: -.04em; }
.hero-line { margin: 12px 0 0; color: rgba(255,255,255,.82); font-weight: 650; }
.hero-mode { display: grid; place-items: center; flex: 0 0 64px; width: 64px; height: 64px; border-radius: 50%; background: rgba(255,255,255,.14); font-size: 1.8rem; font-weight: 800; }

.connections { margin-top: 28px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
h2 { margin: 0; color: var(--navy); font-size: 1.25rem; }

.refresh-button {
  border: 0;
  padding: 9px 11px;
  border-radius: 12px;
  color: var(--blue);
  background: rgba(22, 103, 217, 0.08);
  font-size: .78rem;
  font-weight: 750;
  cursor: pointer;
}

.refresh-button:disabled { opacity: .55; cursor: wait; }
.loading { padding: 24px 0; color: var(--muted); text-align: center; }
.journey-list { display: grid; gap: 14px; margin-top: 14px; }

.journey-card {
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--card);
  box-shadow: 0 12px 30px rgba(31, 61, 98, 0.07);
  backdrop-filter: blur(14px);
}

.journey-card.delay { border-color: rgba(239, 146, 21, .25); }
.journey-card.cancelled { border-color: rgba(230, 59, 72, .3); opacity: .72; }
.journey-head { display: flex; align-items: center; gap: 12px; }

.mode-icon {
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  color: #fff;
  background: var(--blue);
  font-size: .7rem;
  font-weight: 900;
}

.journey-card.train .mode-icon { background: var(--mint); }
.journey-card.delay .mode-icon { background: var(--amber); }
.journey-card.cancelled .mode-icon { background: var(--red); }
.journey-title { min-width: 0; flex: 1; }
.journey-title h3 { margin: 0; font-size: 1.05rem; }
.journey-title p { overflow: hidden; margin: 3px 0 0; color: var(--muted); font-size: .78rem; text-overflow: ellipsis; white-space: nowrap; }

.status-badge { padding: 6px 9px; border-radius: 999px; color: var(--muted); background: rgba(105, 115, 134, .1); font-size: .72rem; font-weight: 800; white-space: nowrap; }
.journey-card.delay .status-badge { color: var(--amber); background: rgba(239,146,21,.12); }
.journey-card.cancelled .status-badge { color: var(--red); background: rgba(230,59,72,.1); }
.journey-card.realtime:not(.delay) .status-badge { color: var(--mint); background: rgba(33,180,126,.1); }

.journey-time { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px; align-items: end; }
.journey-time small { display: block; margin-bottom: 4px; color: #7b8494; font-size: .66rem; font-weight: 800; letter-spacing: .05em; }
.journey-time strong { font-size: 1.75rem; line-height: 1; }
.planned-departure { margin-left: 7px; color: #8991a0; font-size: .8rem; }
.planned-departure:empty { display: none; }
.countdown-wrap { text-align: right; }
.countdown { color: var(--blue); font-size: .92rem !important; }
.journey-card.delay .countdown { color: var(--amber); }
.journey-card.train:not(.delay) .countdown { color: var(--mint); }
.journey-card.cancelled .countdown { color: var(--red); }

.journey-meta { display: flex; flex-wrap: wrap; gap: 7px 13px; margin-top: 17px; color: var(--muted); font-size: .72rem; }
.source { margin-left: auto; }
.error { margin-top: 14px; padding: 14px; border-radius: 14px; color: #a31826; background: rgba(230,59,72,.09); }

.stops { margin-top: 24px; padding: 18px; border: 1px solid var(--line); border-radius: 22px; background: rgba(255,255,255,.66); }
.stops h2 { margin-bottom: 12px; font-size: 1rem; }
.stop-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; }
.stop-row + .stop-row { border-top: 1px solid var(--line); }
.stop-row div { display: grid; gap: 2px; font-size: .86rem; }
.stop-row span { color: var(--muted); font-size: .75rem; }
.stop-mode { display: grid; place-items: center; flex: 0 0 38px; height: 30px; border-radius: 9px; color: #fff !important; background: var(--blue); font-size: .62rem !important; font-weight: 900; }
.stop-mode.train { background: var(--mint); }

.install-panel { align-items: center; justify-content: space-between; gap: 15px; margin-top: 18px; padding: 16px; border-radius: 20px; color: #fff; background: linear-gradient(135deg, #1766d6, #08a8c8); }
.install-panel:not([hidden]) { display: flex; }
.install-panel p { margin: 4px 0 0; color: rgba(255,255,255,.8); font-size: .77rem; }
.install-panel button { border: 0; padding: 10px 13px; border-radius: 12px; color: var(--blue); background: #fff; font-weight: 800; cursor: pointer; }

footer { padding: 24px 8px 0; color: var(--muted); font-size: .7rem; line-height: 1.5; text-align: center; }
footer p { margin: 3px 0; }
.privacy { color: #8290a4; }

button:focus-visible, a:focus-visible { outline: 3px solid rgba(22,103,217,.4); outline-offset: 3px; }

@media (min-width: 620px) {
  .shell { padding-inline: 26px; }
  .journey-list { grid-template-columns: 1fr 1fr; }
  .journey-card:first-child { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: no-preference) {
  .journey-card { animation: enter .28s ease both; }
  @keyframes enter { from { opacity: 0; transform: translateY(8px); } }
}
