:root {
  --bg: #edf4f7;
  --bg-soft: #f8fbfc;
  --panel: #ffffff;
  --line: #d8e5ec;
  --line-strong: #bfd5df;
  --text: #183542;
  --muted: #5d7a89;
  --accent: #2f7e9d;
  --accent-soft: #e4f1f6;
  --accent-2: #6a9f4f;
  --shadow: 0 18px 48px rgba(32, 71, 89, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "IBM Plex Mono", Menlo, Monaco, Consolas, monospace;
  color: var(--text);
  background:
    radial-gradient(1200px 500px at 12% -10%, #d9ebf2, transparent 50%),
    radial-gradient(760px 420px at 100% 0%, #ddefe7, transparent 55%),
    linear-gradient(160deg, var(--bg), var(--bg-soft));
}

.page {
  max-width: 860px;
  margin: 0 auto;
  padding: 28px 16px 52px;
  display: grid;
  gap: 16px;
}

h1,
h2 {
  font-family: "Space Grotesk", sans-serif;
  margin: 0;
  letter-spacing: 0.01em;
}

h1 {
  font-size: clamp(1.7rem, 4.2vw, 2.5rem);
  margin: 6px 0 8px;
  line-height: 1.08;
  color: #20465a;
}

h2 {
  font-size: clamp(1.1rem, 2.8vw, 1.45rem);
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 700;
}

.muted {
  color: var(--muted);
  margin: 0;
}

.card {
  background: linear-gradient(180deg, #ffffff, #fdfefe);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.hero {
  padding: 20px 18px 16px;
  border-top: 5px solid #c8e3ee;
  animation: fade-in-up 360ms ease-out both;
}

.hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.clock {
  margin: 0;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.04em;
  font-size: 0.88rem;
}

.controls {
  margin: 16px 0 10px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

button {
  border: 1px solid var(--line-strong);
  background: linear-gradient(180deg, #f5fbfe, #e8f4f9);
  color: #20465a;
  padding: 10px 14px;
  border-radius: 9px;
  cursor: pointer;
  font-weight: 700;
  font-family: inherit;
  letter-spacing: 0.01em;
  transition: transform 120ms ease, border-color 120ms ease, color 120ms ease;
}

button:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  color: #153646;
}

button.secondary {
  background: linear-gradient(180deg, #f3f8f2, #e8f3e2);
  color: #35552c;
  border-color: #cfe2c4;
}

button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.status {
  min-height: 21px;
  font-size: 0.88rem;
  color: #406172;
}

.result {
  padding: 14px 14px 10px;
  animation: fade-in-up 420ms ease-out both;
}

.result-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 8px;
}

.live-pill {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid #c5dfe9;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 9px;
}

.hidden {
  display: none;
}

ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.departures {
  margin-top: 8px;
}

li {
  padding: 12px 12px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff, #f9fcfd);
  border-radius: 10px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.departure-now {
  background: linear-gradient(180deg, #f2fbf4, #ecf9ef);
  border-color: #b9dcc2;
}

.departure-soon {
  background: linear-gradient(180deg, #ffffff, #f8fbfc);
  border-color: #cfe0e8;
}

.departure-later {
  background: linear-gradient(180deg, #fbfdfe, #f6f9fb);
  border-color: #dbe7ec;
  opacity: 0.88;
}

.letter-badge {
  min-width: 42px;
  height: 42px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  color: #ffffff;
  background: linear-gradient(180deg, #2f7e9d, #2b6f89);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.15);
}

.departure-now .letter-badge {
  background: linear-gradient(180deg, #5ca56a, #4a8e56);
}

.train {
  display: grid;
  gap: 4px;
}

.line {
  font-weight: 700;
  color: var(--text);
  margin-right: 2px;
}

.destination {
  font-size: 0.92rem;
  color: #2f4e5d;
}

.track {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 0.76rem;
  color: #365160;
  border: 1px solid #c6dbe5;
  background: #edf5f9;
  width: fit-content;
}

.time {
  text-align: right;
  color: #20465a;
  white-space: nowrap;
  font-weight: 700;
}

.remaining {
  display: block;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.16rem;
  line-height: 1.05;
}

.clock-time {
  display: block;
  margin-top: 2px;
  font-size: 0.76rem;
  color: #5d7a89;
  font-weight: 500;
}

.empty-row {
  color: var(--muted);
  font-size: 0.92rem;
  display: block;
}

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

@media (max-width: 640px) {
  .page {
    padding-top: 14px;
    gap: 12px;
  }

  .result-head {
    align-items: flex-start;
    flex-direction: column;
  }

  li {
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "badge detail"
      "time time";
    gap: 8px 10px;
  }

  .letter-badge {
    grid-area: badge;
  }

  .train {
    grid-area: detail;
  }

  .time {
    grid-area: time;
    text-align: left;
    border-top: 1px dashed var(--line);
    padding-top: 7px;
  }
}
