@font-face {
  font-family: "Tauri";
  src: url("/static/fonts/Tauri-Regular.woff2") format("woff2"),
       url("/static/fonts/Tauri-Regular.woff") format("woff");
  font-display: swap;
}

:root {
  --bg: #101721;
  --panel: rgba(12, 18, 27, 0.78);
  --line: rgba(255, 255, 255, 0.12);
  --text: #f5f0e6;
  --muted: #b7c3d1;
  --accent: #ffb347;
  --accent-2: #57d0c8;
  --danger: #ff7575;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(87, 208, 200, 0.14), transparent 34%),
    radial-gradient(circle at top right, rgba(255, 179, 71, 0.15), transparent 30%),
    linear-gradient(180deg, #132133 0%, #0d141e 100%);
  font-family: "Tauri", "Trebuchet MS", sans-serif;
  min-height: 100vh;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

a {
  color: inherit;
}

.page-shell {
  position: relative;
  min-height: 100vh;
  padding: 2rem;
}

.background-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.6), transparent 90%);
  pointer-events: none;
}

.topbar,
.layout,
.footer {
  position: relative;
  z-index: 1;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: flex-end;
  margin-bottom: 1.5rem;
}

.topbar-side {
  display: grid;
  justify-items: end;
  gap: 0.8rem;
}

.eyebrow,
.section-kicker,
.field-label,
.clock-label {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent-2);
  font-size: 0.78rem;
}

.title,
.panel-header h2,
.controls-copy h2 {
  margin: 0.4rem 0 0;
  font-size: clamp(2rem, 3vw, 3.5rem);
  line-height: 0.95;
}

.layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 1.5rem;
}

.controls-panel,
.board-panel,
.clock-card,
.error-card {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--panel);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.controls-panel,
.board-panel {
  padding: 1.5rem;
}

.controls-panel {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.station-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem;
}

.section-text {
  color: var(--muted);
  margin: 0.6rem 0 0;
  line-height: 1.5;
}

.clock-card {
  padding: 1rem 1.2rem;
  display: grid;
  gap: 0.3rem;
  min-width: 180px;
}

.language-switcher {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.45rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
}

.language-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  text-decoration: none;
  color: var(--muted);
  transition: background 120ms ease, color 120ms ease;
}

.language-link:hover,
.language-link.is-active {
  color: var(--text);
  background: rgba(255, 179, 71, 0.16);
}

.language-emoji {
  line-height: 1;
}

.language-code {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
}

.clock-value,
.refresh-time,
.train-time {
  font-family: "Consolas", "SFMono-Regular", monospace;
}

.clock-value {
  font-size: 1.8rem;
}

.search-wrap,
.filters-wrap,
.favorites-wrap {
  display: grid;
  gap: 0.6rem;
}

.search-input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-radius: 18px;
  padding: 0.95rem 1rem;
  font: inherit;
}

.search-input:focus {
  outline: 2px solid rgba(255, 179, 71, 0.55);
  outline-offset: 2px;
}

.search-results {
  display: grid;
  gap: 0.45rem;
}

.search-results[hidden] {
  display: none !important;
}

.search-result-row,
.favorite-station-item {
  display: flex;
  align-items: stretch;
  gap: 0.45rem;
}

.search-item {
  flex: 1 1 auto;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 18px;
  padding: 0.85rem 0.95rem;
  text-align: left;
  color: var(--text);
  cursor: pointer;
}

.search-item:hover,
.search-item.active {
  border-color: rgba(255, 179, 71, 0.45);
  background: rgba(255, 179, 71, 0.12);
}

.search-item-head {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: center;
}

.search-item-codes,
.train-meta,
.message-card p,
.footer {
  color: var(--muted);
}

.search-item-lines,
.line-filters,
.favorite-stations {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.line-chip,
.status-pill,
.ghost-button {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.line-chip,
.ghost-button {
  cursor: pointer;
  padding: 0.55rem 0.9rem;
  font: inherit;
}

.line-chip.active,
.ghost-button:hover {
  border-color: rgba(255, 179, 71, 0.42);
  background: rgba(255, 179, 71, 0.16);
}

.line-chip img {
  width: 1.5rem;
  height: 1.5rem;
  display: block;
}

.line-button,
.favorite-station-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  cursor: pointer;
  padding: 0.55rem 0.9rem;
  font: inherit;
}

.line-button.active,
.favorite-station-button.active {
  border-color: rgba(255, 179, 71, 0.42);
  background: rgba(255, 179, 71, 0.16);
}

.favorite-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.3rem;
  height: 2.3rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  flex: 0 0 auto;
}

.favorite-toggle.active {
  color: var(--accent);
  border-color: rgba(255, 179, 71, 0.42);
  background: rgba(255, 179, 71, 0.16);
}

.station-favorite-toggle {
  width: 2.7rem;
  height: 2.7rem;
  font-size: 1.15rem;
}

.favorite-station-button {
  flex: 1 1 auto;
  justify-content: space-between;
}

.favorite-station-meta {
  color: var(--muted);
  font-size: 0.85rem;
  white-space: nowrap;
}

.section-text.compact {
  margin-top: 0;
  font-size: 0.92rem;
}

.filters-header,
.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.panel-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.status-pill {
  padding: 0.45rem 0.8rem;
  font-size: 0.85rem;
}

.status-pill.error {
  border-color: rgba(255, 117, 117, 0.42);
  background: rgba(255, 117, 117, 0.14);
}

.status-pill.ok {
  border-color: rgba(87, 208, 200, 0.42);
  background: rgba(87, 208, 200, 0.14);
}

.messages {
  display: grid;
  gap: 0.8rem;
  margin: 1.2rem 0;
}

.message-card {
  border-radius: 20px;
  padding: 0.95rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.05);
}

.message-card.high {
  border-color: rgba(255, 117, 117, 0.35);
  background: rgba(255, 117, 117, 0.12);
}

.message-card p {
  margin: 0.3rem 0 0;
}

.board-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1rem;
}

.train-card {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  padding: 1rem;
  min-height: 240px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.03));
}

.train-card::after {
  content: "";
  position: absolute;
  inset: auto -20% -45% 45%;
  height: 160px;
  background: radial-gradient(circle, rgba(255, 179, 71, 0.28), transparent 70%);
  pointer-events: none;
}

.train-card.cancelled::after,
.train-card.delayed::after {
  background: radial-gradient(circle, rgba(255, 117, 117, 0.26), transparent 70%);
}

.train-top,
.train-bottom {
  position: relative;
  z-index: 1;
}

.train-top {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
}

.train-time {
  font-size: 2rem;
  line-height: 1;
}

.train-time.small {
  font-size: 1.55rem;
}

.train-mission {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.95rem;
}

.train-line-icon {
  width: 1.4rem;
  height: 1.4rem;
}

.train-destination {
  margin: 1rem 0 0.4rem;
  font-size: 1.25rem;
}

.train-meta {
  margin: 0;
  line-height: 1.5;
}

.train-stops {
  margin-top: 0.8rem;
  display: grid;
  gap: 0.35rem;
}

.train-stops-label {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.68rem;
  color: var(--accent-2);
}

.marquee {
  position: relative;
  overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, black 8%, black 92%, transparent);
}

.marquee-track {
  display: inline-flex;
  gap: 2.5rem;
  min-width: 100%;
  white-space: nowrap;
}

.marquee-track.is-scrolling {
  animation: marquee-slide 18s linear infinite;
}

.marquee-track span {
  color: var(--muted);
  font-size: 0.94rem;
}

.train-bottom {
  margin-top: 1.1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.badge {
  border-radius: 999px;
  padding: 0.4rem 0.65rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.85rem;
}

.footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 0 0.5rem;
  font-size: 0.92rem;
}

.footer-theme,
.footer-language {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.footer > span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  line-height: 1;
}

.footer-theme a {
  text-decoration: none;
  opacity: 0.75;
}

.footer-current-theme {
  color: var(--accent);
  font-weight: 700;
}

.footer-language .language-switcher {
  padding: 0.15rem 0.25rem;
}

.footer-language .language-link {
  padding: 0.2rem 0.4rem;
}

.footer-theme a.is-active,
.footer-theme a:hover {
  opacity: 1;
  color: var(--accent);
}

.noscript-banner,
.error-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem;
}

.error-card {
  max-width: 480px;
  padding: 2rem;
}

@keyframes marquee-slide {
  from {
    transform: translateX(0);
  }

  to {
    transform: translateX(-50%);
  }
}

@media (max-width: 960px) {
  .page-shell {
    padding: 1.2rem;
  }

  .topbar,
  .layout,
  .panel-header,
  .filters-header {
    grid-template-columns: 1fr;
    display: grid;
  }

  .clock-card {
    min-width: 0;
  }

  .topbar-side {
    justify-items: start;
  }
}
