:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #182033;
  --muted: #697386;
  --line: #e3e7ee;
  --route: #f2b400;
  --route-dark: #8b6400;
  --down-color: #c47f00;
  --up-color: #ffe066;
  --blue: #2563eb;
  --red: #dc2626;
  --shadow: 0 14px 34px rgba(24, 32, 51, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

body.has-api-error::after {
  position: fixed;
  inset: 0;
  z-index: 50;
  border: 5px solid rgba(220, 38, 38, 0.8);
  content: "";
  pointer-events: none;
  animation: errorFrame 1s ease-in-out infinite;
}

a {
  color: inherit;
}

h1,
h2,
p {
  margin-top: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 28px clamp(18px, 4vw, 48px) 28px clamp(86px, 8vw, 104px);
  background: #171b24;
  color: #fff;
  border-bottom: 6px solid var(--route);
}

.eyebrow {
  margin: 0 0 6px;
  color: #cbd5e1;
  font-size: 0.9rem;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 5vw, 3.8rem);
  line-height: 1.05;
}

.refresh-pill {
  flex: 0 0 auto;
  max-width: 160px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #f8fafc;
  font-size: 0.9rem;
  text-align: center;
}

.refresh-pill[data-state="normal"] {
  border-color: rgba(34, 197, 94, 0.6);
  background: rgba(22, 163, 74, 0.3);
}

.refresh-pill[data-state="loading"] {
  border-color: rgba(242, 180, 0, 0.7);
  background: rgba(242, 180, 0, 0.26);
}

.refresh-pill[data-state="error"] {
  border-color: rgba(248, 113, 113, 0.75);
  background: rgba(220, 38, 38, 0.36);
}

.line-picker {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  display: grid;
  gap: 4px;
  min-width: 150px;
  color: #e2e8f0;
  font-size: 0.78rem;
  font-weight: 800;
}

.line-picker select {
  width: 100%;
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  padding: 0 10px;
}

.layout {
  width: min(1120px, calc(100% - 32px));
  margin: 26px auto 0;
}

.summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.bottom-summary {
  margin-top: 28px;
}

.info-page {
  min-height: 100vh;
}

.info-page .topbar {
  align-items: flex-start;
}

.info-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.info-nav a {
  padding: 8px 11px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  color: #f8fafc;
  font-size: 0.86rem;
  font-weight: 800;
  text-decoration: none;
}

.info-nav a[aria-current="page"],
.info-nav a:hover,
.info-nav a:focus-visible {
  border-color: var(--route);
  background: rgba(242, 180, 0, 0.18);
}

.info-card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.info-card + .info-card {
  margin-top: 16px;
}

.info-card h2 {
  margin-bottom: 12px;
  font-size: 1.25rem;
}

.info-card p,
.info-card li {
  color: var(--muted);
  line-height: 1.7;
}

.info-card ul {
  margin: 0;
  padding-left: 20px;
}

.info-card a {
  color: var(--route-dark);
  font-weight: 800;
}

.link-list {
  display: grid;
  gap: 10px;
  padding-left: 0;
  list-style: none;
}

.link-list a {
  display: inline-flex;
  width: fit-content;
  padding: 8px 12px;
  border: 1px solid rgba(242, 180, 0, 0.45);
  border-radius: 8px;
  background: #fffdf3;
  text-decoration: none;
}

.line-status-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.line-status-list li {
  display: grid;
  gap: 4px;
  min-height: 64px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-weight: 900;
}

.line-status-list span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.metric {
  min-height: 112px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metric-label {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.88rem;
}

.metric strong {
  font-size: clamp(1.35rem, 3vw, 2rem);
}

.error-box {
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fff1f2;
  color: #9f1239;
}

.station-section {
  margin-top: 30px;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.section-head h2 {
  margin-bottom: 4px;
  font-size: 1.35rem;
}

.section-head p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.route-shortcuts {
  margin-bottom: 28px;
}

.route-shortcuts details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.route-shortcuts summary {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 13px 16px;
  color: var(--text);
  cursor: pointer;
  font-weight: 900;
  list-style: none;
}

.route-shortcuts summary::-webkit-details-marker {
  display: none;
}

.route-shortcuts summary::after {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--route-dark);
  border-bottom: 2px solid var(--route-dark);
  content: "";
  transform: rotate(45deg) translateY(-2px);
  transition: transform 180ms ease;
}

.route-shortcuts details[open] summary::after {
  transform: rotate(225deg) translateY(-2px);
}

.route-shortcuts summary span {
  font-size: 1rem;
}

.route-shortcuts summary small {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.route-map {
  padding: 10px;
  border-top: 1px solid var(--line);
}

.route-map-grid {
  --route-gap: 5px;
  position: relative;
  display: grid;
  gap: var(--route-gap);
}

.route-row {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--route-columns), minmax(0, 1fr));
  gap: var(--route-gap);
}

.route-row::before {
  position: absolute;
  top: 50%;
  right: 8px;
  left: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(242, 180, 0, 0.58);
  content: "";
  transform: translateY(-50%);
}

.route-row:not(:last-child)::after {
  position: absolute;
  top: 50%;
  width: 8px;
  height: calc(100% + var(--route-gap));
  border-radius: 999px;
  background: rgba(242, 180, 0, 0.58);
  content: "";
}

.route-row:not(.reverse):not(:last-child)::after {
  right: 8px;
}

.route-row.reverse:not(:last-child)::after {
  left: 8px;
}

.route-stop {
  position: relative;
  z-index: 1;
  display: grid;
  align-content: center;
  min-width: 0;
  min-height: 29px;
  padding: 4px 7px;
  border: 1px solid rgba(242, 180, 0, 0.45);
  border-radius: 8px;
  background: #fffdf3;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  word-break: keep-all;
  overflow: hidden;
  box-shadow: 0 2px 0 rgba(139, 100, 0, 0.18), 0 8px 18px rgba(24, 32, 51, 0.06);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.route-stop:hover,
.route-stop:focus-visible {
  border-color: rgba(139, 100, 0, 0.55);
  color: var(--route-dark);
  box-shadow: 0 3px 0 rgba(139, 100, 0, 0.22), 0 12px 24px rgba(24, 32, 51, 0.1);
  transform: translateY(-1px);
}

.route-stop:active {
  box-shadow: 0 1px 0 rgba(139, 100, 0, 0.2), 0 6px 14px rgba(24, 32, 51, 0.08);
  transform: translateY(1px);
}

.route-stop:focus-visible {
  outline: 3px solid rgba(242, 180, 0, 0.36);
  outline-offset: 2px;
}

.route-stop-name {
  position: relative;
  z-index: 2;
  justify-self: center;
  padding: 1px 3px;
  border-radius: 4px;
  background: rgba(255, 253, 243, 0.86);
}

.transfer-bars {
  position: absolute;
  top: 4px;
  bottom: 4px;
  z-index: 1;
  display: flex;
  gap: 2px;
  pointer-events: none;
}

.transfer-bars.left {
  left: 5px;
}

.transfer-bars.right {
  right: 5px;
}

.transfer-bar {
  width: 6px;
  border-radius: 999px;
  background: var(--transfer-color);
}

.route-stop.active {
  border-color: var(--route);
  background: #fff8d9;
  color: var(--route-dark);
  box-shadow: 0 3px 0 rgba(139, 100, 0, 0.18), 0 10px 22px rgba(139, 100, 0, 0.14);
}

.route-stop.down-live {
  border-bottom-color: var(--down-color);
  border-bottom-width: 4px;
}

.route-stop.up-live {
  border-top-color: var(--up-color);
  border-top-width: 4px;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.82);
}

.route-stop.both-live {
  border-top-color: var(--up-color);
  border-bottom-color: var(--down-color);
  border-top-width: 4px;
  border-bottom-width: 4px;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.82);
}

.route-stop.active .route-stop-name {
  background: rgba(255, 248, 217, 0.88);
}

.route-stop.express-stop {
  outline: 1px solid var(--red);
  outline-offset: 2px;
}

.route-stop small {
  display: none;
}

.station-list {
  position: relative;
  display: grid;
  gap: 0;
  padding: 8px 0 18px;
}

.station-list::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 10px;
  border-radius: 999px;
  background: var(--route);
  content: "";
  transform: translateX(-50%);
}

.station-list::after {
  position: absolute;
  top: 8px;
  right: 0;
  bottom: 18px;
  left: 0;
  z-index: 0;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='24' viewBox='0 0 18 24'%3E%3Cpath d='M9 18 2 6h14L9 18Z' fill='%23c47f00' fill-opacity='.5'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='24' viewBox='0 0 18 24'%3E%3Cpath d='M9 6 16 18H2L9 6Z' fill='%23ffe066' fill-opacity='.78'/%3E%3Cpath d='M5 17h8' stroke='%23ffffff' stroke-width='1.5' stroke-linecap='round' stroke-opacity='.75'/%3E%3C/svg%3E");
  background-position:
    calc(50% - 222px) 0,
    calc(50% + 204px) 0;
  background-repeat: repeat-y;
  background-size: 18px 24px;
  content: "";
  pointer-events: none;
}

.station-row {
  position: relative;
  z-index: 1;
  --station-link-length: 100px;
  --station-near-offset: 31px;
  --station-far-offset: 46px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 164px minmax(0, 1fr);
  gap: 18px;
  min-height: 77px;
  padding: 8px 0;
  scroll-margin-top: 18px;
}

.station-row::before {
  position: absolute;
  inset: 4px -8px;
  z-index: 0;
  border-radius: 8px;
  background: rgba(242, 180, 0, 0);
  content: "";
  pointer-events: none;
}

.station-row.is-highlighted::before {
  animation: stationHighlight 2s ease-out;
}

.station-axis {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.station-marker {
  position: absolute;
  width: 24px;
  height: 24px;
  border: 5px solid var(--route);
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 0 0 6px var(--bg);
}

.station-name {
  position: relative;
  z-index: 6;
  max-width: 148px;
  padding: 7px 10px;
  border: 1px solid rgba(212, 0, 59, 0.22);
  border-radius: 999px;
  background: #fff;
  color: var(--route-dark);
  font-size: 0.95rem;
  font-weight: 900;
  line-height: 1.2;
  text-align: center;
  word-break: keep-all;
  box-shadow: 0 8px 22px rgba(24, 32, 51, 0.09);
  overflow: visible;
}

.station-name-text {
  position: relative;
  z-index: 2;
}

.station-transfer-marks {
  position: absolute;
  inset: -8px;
  z-index: 1;
  pointer-events: none;
}

.station-transfer-mark {
  position: absolute;
  width: 18px;
  height: 5px;
  border-radius: 999px;
  background: var(--transfer-color);
  opacity: 0.86;
  transform: rotate(-45deg);
}

.station-transfer-mark.ne {
  top: 0;
  right: 2px;
}

.station-transfer-mark.se {
  right: 2px;
  bottom: 0;
  transform: rotate(45deg);
}

.station-transfer-mark.sw {
  bottom: 0;
  left: 2px;
}

.station-transfer-mark.nw {
  top: 0;
  left: 2px;
  transform: rotate(45deg);
}

.direction-column {
  display: grid;
  align-content: center;
  gap: 6px;
  min-width: 0;
}

.down-column {
  justify-items: end;
}

.up-column {
  justify-items: start;
}

.empty {
  position: relative;
  z-index: 1;
  color: #a4adbd;
  font-size: 0.82rem;
}

.last-passed {
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--route-dark);
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
  word-break: keep-all;
}

.train-card {
  position: relative;
  z-index: 2;
  --status-offset: 0px;
  width: min(100%, 280px);
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  transform: translateY(var(--status-offset));
}

.train-card::before {
  position: absolute;
  top: 50%;
  z-index: -1;
  width: var(--station-link-length);
  height: 4px;
  border-radius: 999px;
  background: rgba(242, 180, 0, 0.55);
  content: "";
  transform: translateY(-50%);
}

.down-column .train-card::before {
  right: calc(var(--station-link-length) * -1);
  background: color-mix(in srgb, var(--down-color) 72%, transparent);
}

.up-column .train-card::before {
  left: calc(var(--station-link-length) * -1);
  background:
    repeating-linear-gradient(
      90deg,
      rgba(255, 224, 102, 0.88) 0 8px,
      rgba(255, 255, 255, 0.8) 8px 11px
    );
}

.train-card.previous-departed::before {
  opacity: 0.42;
}

.train-card.departed::before {
  opacity: 0.7;
}

.train-card.arrived::before {
  opacity: 0.9;
}

.down-column .train-card.previous-departed,
.down-column .train-card.approaching {
  --status-offset: calc(var(--station-far-offset) * -1);
}

.down-column .train-card.departed {
  --status-offset: var(--station-near-offset);
}

.up-column .train-card.previous-departed,
.up-column .train-card.approaching {
  --status-offset: var(--station-far-offset);
}

.up-column .train-card.departed {
  --status-offset: calc(var(--station-near-offset) * -1);
}

.train-card.express-train {
  border-color: var(--red);
  box-shadow: 0 10px 26px rgba(220, 38, 38, 0.13);
}

.down-column .train-card {
  border-right: 5px solid var(--route);
  text-align: right;
}

.up-column .train-card {
  border-left: 5px solid var(--route);
}

.down-column .train-card.express-train {
  border-right-color: var(--red);
}

.up-column .train-card.express-train {
  border-left-color: var(--red);
}

.train-terminal {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--route-dark);
  font-size: 1.05rem;
  font-weight: 900;
  line-height: 1.25;
  word-break: keep-all;
}

.train-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 5px 8px;
  min-width: 0;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.down-column .train-meta {
  flex-direction: row-reverse;
}

.train-info {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  white-space: nowrap;
}

.train-number {
  color: #334155;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  font-size: 0.78rem;
  font-weight: 800;
}

.badge.express {
  background: #fef2f2;
  color: var(--red);
}

.badge.local {
  background: #eff6ff;
  color: var(--blue);
}

.badge.last {
  background: #fef2f2;
  color: var(--red);
}

.footer {
  width: min(1120px, calc(100% - 32px));
  margin: 32px auto 22px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.6;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-bottom: 12px;
  color: var(--text);
  font-weight: 800;
}

.footer-links a {
  text-decoration-color: rgba(139, 100, 0, 0.32);
  text-underline-offset: 4px;
}

.footer-links a:hover,
.footer-links a:focus-visible {
  color: var(--route-dark);
}

.footer p {
  margin-bottom: 6px;
}

.floating-refresh,
.floating-help,
.floating-share,
.floating-line-menu {
  position: fixed !important;
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border: 1px solid rgba(24, 32, 51, 0.12);
  border-radius: 999px;
  background: #fff;
  color: #111827;
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  box-shadow: var(--shadow);
  pointer-events: auto;
  touch-action: manipulation;
  transform: none;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.floating-help,
.floating-share {
  z-index: 60;
  font-size: 1.25rem;
}

.floating-line-menu {
  inset: 18px auto auto 18px;
  z-index: 62;
}

.floating-line-menu span,
.floating-line-menu::before,
.floating-line-menu::after {
  width: 20px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  content: "";
}

.floating-line-menu {
  gap: 4px;
}

.floating-line-menu::before,
.floating-line-menu::after {
  display: block;
}

.floating-help {
  inset: auto 18px 80px auto;
}

.floating-share {
  inset: auto 18px 140px auto;
}

.floating-refresh:hover,
.floating-refresh:focus-visible,
.floating-help:hover,
.floating-help:focus-visible,
.floating-share:hover,
.floating-share:focus-visible,
.floating-line-menu:hover,
.floating-line-menu:focus-visible {
  border-color: rgba(24, 32, 51, 0.28);
  box-shadow: 0 16px 34px rgba(24, 32, 51, 0.16);
  transform: translateY(-1px);
}

.floating-refresh:active,
.floating-help:active,
.floating-share:active,
.floating-line-menu:active {
  transform: translateY(1px);
}

.line-menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 58;
  background: rgba(24, 32, 51, 0.36);
}

.line-menu-panel {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 59;
  width: min(360px, calc(100% - 44px));
  padding: 18px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 22px 0 48px rgba(24, 32, 51, 0.18);
  overflow-y: auto;
  animation: lineMenuEnter 180ms ease-out;
}

.line-menu-panel[hidden],
.line-menu-backdrop[hidden] {
  display: none;
}

.line-menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding-left: 54px;
}

.line-menu-head h2 {
  margin: 0;
  font-size: 1.2rem;
}

.line-menu-head button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 1.25rem;
  font-weight: 900;
}

.line-menu-list {
  display: grid;
  gap: 8px;
}

.line-menu-item {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr);
  gap: 11px;
  width: 100%;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.line-menu-item:hover,
.line-menu-item:focus-visible,
.line-menu-item.is-selected {
  border-color: var(--line-menu-color, var(--route));
  box-shadow: 0 10px 24px rgba(24, 32, 51, 0.09);
}

.line-menu-color {
  width: 8px;
  min-height: 42px;
  border-radius: 999px;
  background: var(--line-menu-color, var(--route));
}

.line-menu-item strong,
.line-menu-item small {
  display: block;
}

.line-menu-item strong {
  font-size: 0.98rem;
}

.line-menu-item small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.share-icon {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.share-toast {
  position: fixed;
  right: 18px;
  bottom: 190px;
  z-index: 61;
  margin: 0;
  padding: 8px 11px;
  border-radius: 999px;
  background: #171b24;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
  box-shadow: var(--shadow);
}

.help-dialog {
  width: min(420px, calc(100% - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 24px 64px rgba(24, 32, 51, 0.22);
}

.help-dialog::backdrop {
  background: rgba(24, 32, 51, 0.42);
}

.help-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.help-dialog h2 {
  margin: 0;
  font-size: 1.15rem;
}

.help-dialog button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 1.2rem;
  font-weight: 900;
}

.help-dialog ul {
  margin: 0;
  padding: 16px 22px 18px 38px;
}

.help-dialog li {
  margin-bottom: 8px;
  color: var(--muted);
  line-height: 1.55;
}

.floating-refresh {
  inset: auto 18px 20px auto;
  z-index: 40;
  font-size: 1.45rem;
}

.floating-refresh:disabled {
  cursor: wait;
  opacity: 0.84;
}

.refresh-icon {
  position: relative;
  z-index: 1;
}

.cooldown-ring {
  position: absolute;
  inset: -5px;
  border-radius: 999px;
  background:
    repeating-conic-gradient(
      from -90deg,
      rgba(242, 180, 0, 0.22) 0deg 48deg,
      transparent 48deg 51.43deg
    );
  opacity: 0;
  padding: 4px;
  pointer-events: none;
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

.floating-refresh.cooling .refresh-icon {
  animation: refreshSpin 900ms linear infinite;
}

.floating-refresh.cooling .cooldown-ring {
  opacity: 1;
  background:
    conic-gradient(var(--route) 0 var(--cooldown-progress), transparent var(--cooldown-progress) 360deg),
    repeating-conic-gradient(
      from -90deg,
      rgba(242, 180, 0, 0.22) 0deg 48deg,
      transparent 48deg 51.43deg
    );
}

@keyframes refreshSpin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes lineMenuEnter {
  from {
    transform: translateX(-18px);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes errorFrame {
  50% {
    border-color: rgba(220, 38, 38, 0.18);
  }
}

@keyframes stationHighlight {
  0%,
  70% {
    background: rgba(242, 180, 0, 0.7);
  }

  100% {
    background: rgba(242, 180, 0, 0);
  }
}

@media (max-width: 760px) {
  .topbar {
    align-items: center;
    flex-direction: row;
    padding-left: 68px;
  }

  .topbar h1 {
    font-size: 1.8rem;
  }

  .info-page .topbar {
    gap: 12px;
  }

  .info-nav {
    width: 100%;
  }

  .info-card {
    padding: 18px;
  }

  .line-picker {
    min-width: 1px;
  }

  .line-picker span {
    display: none;
  }

  .refresh-pill {
    margin-left: auto;
  }

  .summary {
    grid-template-columns: 1fr;
  }

  .section-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .route-shortcuts summary {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
    min-height: 50px;
    padding: 11px 13px;
  }

  .route-shortcuts summary::after {
    position: absolute;
    right: 16px;
    margin-top: 6px;
  }

  .route-shortcuts summary small {
    margin-left: 0;
    padding-right: 24px;
  }

  .route-map {
    padding: 6px;
  }

  .route-map-grid {
    --route-gap: 4px;
  }

  .route-stop {
    min-height: 25px;
    padding: 3px 5px;
    border-radius: 6px;
    font-size: 0.66rem;
  }

  .route-stop small {
    display: none;
  }

  .station-row {
    --station-link-length: 64px;
    --station-near-offset: 22px;
    --station-far-offset: 34px;
    grid-template-columns: minmax(0, 1fr) 112px minmax(0, 1fr);
    gap: 8px;
    min-height: 83px;
  }

  .station-list::before {
    width: 8px;
  }

  .station-list::after {
    background-position:
      calc(50% - 132px) 0,
      calc(50% + 114px) 0;
    background-size: 16px 22px;
  }

  .station-name {
    max-width: 104px;
    padding: 6px 8px;
    font-size: 0.82rem;
  }

  .station-marker {
    width: 20px;
    height: 20px;
    border-width: 4px;
  }

  .train-card {
    padding: 6px 7px;
  }

  .train-terminal {
    font-size: 0.88rem;
    gap: 5px;
  }

  .train-meta {
    align-items: center;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 2px 4px;
    min-width: 0;
    font-size: 0.68rem;
  }

  .down-column .train-meta {
    flex-direction: row-reverse;
  }

  .train-info {
    gap: 4px;
    overflow: hidden;
  }

  .train-number {
    font-size: 0.66rem;
  }

  .badge {
    min-height: 18px;
    padding: 1px 5px;
    font-size: 0.66rem;
  }

  .badge.last {
    flex: 0 0 auto;
  }

  .empty {
    display: none;
  }

  .empty.last-passed {
    display: inline-flex;
    max-width: 100%;
    font-size: 0.68rem;
  }

  .floating-refresh {
    inset: auto 14px 16px auto;
    width: 44px;
    height: 44px;
  }

  .floating-refresh,
  .floating-help,
  .floating-share,
  .floating-line-menu {
    width: 44px;
    height: 44px;
  }

  .floating-line-menu {
    inset: 12px auto auto 12px;
  }

  .floating-help {
    inset: auto 14px 70px auto;
    font-size: 1rem;
  }

  .floating-share {
    inset: auto 14px 124px auto;
  }

  .share-icon {
    width: 22px;
    height: 22px;
  }

  .share-toast {
    right: 14px;
    bottom: 166px;
  }
}
