:root {
  color-scheme: dark;
  --bg: #06101c;
  --bg-soft: #0d1a2b;
  --panel: rgba(16, 30, 49, 0.86);
  --panel-solid: #122238;
  --panel-raised: #182d48;
  --text: #f7fbff;
  --muted: #a8b6c6;
  --faint: #75869a;
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.2);
  --accent: #42e6a4;
  --accent-2: #72b7ff;
  --warning: #ffd166;
  --danger: #ff6476;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.36);
  --radius: 8px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 10% -10%, rgba(66, 230, 164, 0.24), transparent 26rem),
    radial-gradient(circle at 100% 18%, rgba(114, 183, 255, 0.2), transparent 22rem),
    linear-gradient(180deg, #071321 0%, #08111d 48%, #06101c 100%);
  color: var(--text);
}

button {
  font: inherit;
  cursor: pointer;
}

.shell {
  width: min(100%, 540px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 14px max(26px, env(safe-area-inset-bottom));
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 118px;
  margin-bottom: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04)),
    linear-gradient(145deg, rgba(66, 230, 164, 0.16), rgba(114, 183, 255, 0.06));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero-copy {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
}

.app-mark {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 54px;
  height: 54px;
  border-radius: 8px;
  background: linear-gradient(145deg, var(--accent), #2acbff);
  box-shadow: 0 14px 30px rgba(66, 230, 164, 0.18);
}

.app-mark::before {
  content: "";
  position: absolute;
  width: 26px;
  height: 28px;
  border-radius: 5px 5px 7px 7px;
  background: #071321;
}

.app-mark::after {
  content: "";
  position: absolute;
  bottom: 13px;
  width: 25px;
  height: 4px;
  border-radius: 999px;
  background: var(--accent);
}

.app-mark span {
  position: absolute;
  top: 18px;
  width: 18px;
  height: 7px;
  border-radius: 3px;
  background: #eef8ff;
  z-index: 1;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 32px;
  line-height: 0.98;
}

.refresh-button {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 54px;
  height: 54px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  font-size: 26px;
  font-weight: 900;
}

.refresh-button:disabled {
  opacity: 0.45;
}

.control-card {
  position: sticky;
  top: max(10px, env(safe-area-inset-top));
  z-index: 3;
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(8, 18, 31, 0.78);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(20px);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.segment {
  min-height: 48px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-weight: 900;
  transition: transform 130ms ease, background 130ms ease, color 130ms ease, border-color 130ms ease;
}

.segment.is-active {
  border-color: rgba(66, 230, 164, 0.5);
  background: linear-gradient(180deg, var(--accent), #28d090);
  color: #03150f;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.18);
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin: 0 2px 10px;
}

.section-kicker {
  margin-bottom: 2px;
  color: var(--faint);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.section-head h2 {
  margin-bottom: 0;
  font-size: 20px;
  line-height: 1.1;
}

.route-count {
  display: grid;
  place-items: center;
  min-width: 34px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.next-strip {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
  align-items: center;
  margin-bottom: 16px;
  padding: 14px 15px;
  border: 1px solid rgba(66, 230, 164, 0.38);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(66, 230, 164, 0.18), rgba(114, 183, 255, 0.08)),
    rgba(9, 21, 35, 0.9);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.28);
}

.next-strip-label {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--accent);
  color: #03150f;
  font-size: 10px;
  font-weight: 950;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
}

.next-strip strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 18px;
  font-weight: 950;
  line-height: 1.05;
}

.next-strip-detail {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
}

.next-strip.is-empty,
.next-strip.is-loading {
  border-color: var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03)),
    rgba(12, 24, 40, 0.86);
}

.next-strip.is-empty .next-strip-label,
.next-strip.is-loading .next-strip-label {
  background: rgba(255, 255, 255, 0.1);
  color: var(--muted);
}

.next-strip.is-error {
  border-color: rgba(255, 100, 118, 0.38);
  background:
    linear-gradient(135deg, rgba(255, 100, 118, 0.16), rgba(255, 255, 255, 0.04)),
    rgba(12, 24, 40, 0.9);
}

.next-strip.is-error .next-strip-label {
  background: rgba(255, 100, 118, 0.18);
  color: var(--danger);
}

.routes {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.route-button {
  display: grid;
  grid-template-columns: 48px 1fr;
  align-items: center;
  gap: 13px;
  min-height: 82px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03)),
    var(--panel);
  color: var(--text);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.24);
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.route-button.is-selected {
  border-color: rgba(66, 230, 164, 0.7);
  background:
    linear-gradient(180deg, rgba(66, 230, 164, 0.18), rgba(255, 255, 255, 0.04)),
    var(--panel-solid);
}

.route-button:active,
.segment:active,
.refresh-button:active {
  transform: translateY(1px) scale(0.99);
}

.route-badge {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(66, 230, 164, 0.36);
  border-radius: 8px;
  background: rgba(66, 230, 164, 0.12);
  color: var(--accent);
  font-size: 14px;
  font-weight: 950;
}

.route-copy {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 5px;
  min-width: 0;
}

.route-button .from,
.route-button .to {
  overflow-wrap: anywhere;
  font-size: 18px;
  font-weight: 950;
  line-height: 1.08;
}

.route-button .to {
  color: var(--muted);
}

.route-line {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr auto;
  align-items: center;
  gap: 6px;
  width: 100%;
  color: var(--accent);
}

.line-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
}

.line-rule {
  height: 1px;
  min-width: 18px;
  background: rgba(66, 230, 164, 0.35);
}

.arrow {
  font-size: 17px;
  font-weight: 950;
}

.result {
  min-height: 150px;
}

.empty-state,
.loading,
.error,
.board {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03)),
    rgba(12, 24, 40, 0.86);
  box-shadow: var(--shadow);
}

.empty-state,
.loading {
  display: grid;
  gap: 9px;
  padding: 22px;
  color: var(--muted);
}

.empty-state strong,
.loading strong {
  color: var(--text);
  font-size: 20px;
}

.empty-icon {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(114, 183, 255, 0.36);
  border-radius: 8px;
  background:
    linear-gradient(90deg, transparent 46%, rgba(114, 183, 255, 0.95) 46% 54%, transparent 54%),
    linear-gradient(180deg, rgba(114, 183, 255, 0.2), rgba(66, 230, 164, 0.1));
}

.loading-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.loading-head div {
  display: grid;
  gap: 3px;
}

.loader {
  width: 38px;
  height: 38px;
  border: 4px solid rgba(255, 255, 255, 0.13);
  border-top-color: var(--accent);
  border-radius: 999px;
  animation: spin 850ms linear infinite;
}

.skeleton {
  height: 48px;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.06));
  background-size: 220% 100%;
  animation: shimmer 1.25s ease-in-out infinite;
}

.skeleton.short {
  width: 68%;
}

.error {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 18px;
}

.error strong {
  display: block;
  margin-bottom: 4px;
  color: var(--danger);
  font-size: 19px;
}

.error span:last-child {
  color: var(--muted);
}

.error-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: rgba(255, 100, 118, 0.16);
  color: var(--danger);
  font-weight: 950;
}

.board {
  overflow: hidden;
  animation: rise 180ms ease-out;
}

.board-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(66, 230, 164, 0.15), rgba(114, 183, 255, 0.07)),
    rgba(255, 255, 255, 0.04);
}

.board-title {
  margin-bottom: 2px;
  font-size: 24px;
  font-weight: 950;
  line-height: 1.05;
}

.board-route {
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 17px;
  font-weight: 900;
}

.updated {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.badge {
  flex: 0 0 auto;
  border: 1px solid rgba(66, 230, 164, 0.34);
  border-radius: 999px;
  padding: 7px 11px;
  background: rgba(66, 230, 164, 0.14);
  color: var(--accent);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}

.service {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.service:last-child {
  border-bottom: 0;
}

.time-block {
  display: grid;
  gap: 3px;
  align-content: center;
}

.time {
  font-size: 34px;
  font-weight: 950;
  line-height: 0.95;
}

.time-label {
  color: var(--faint);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.service-main {
  display: grid;
  align-content: center;
  gap: 8px;
  min-width: 0;
}

.status {
  width: fit-content;
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  font-size: 14px;
  font-weight: 950;
}

.status.on-time {
  background: rgba(66, 230, 164, 0.15);
  color: var(--accent);
}

.status.cancelled {
  background: rgba(255, 100, 118, 0.16);
  color: var(--danger);
}

.status.changed {
  background: rgba(255, 209, 102, 0.15);
  color: var(--warning);
}

.arrival {
  color: var(--muted);
  font-size: 15px;
  font-weight: 800;
}

.arrival strong {
  color: var(--text);
}

.no-services {
  padding: 18px;
  color: var(--muted);
  font-weight: 800;
}

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

@keyframes shimmer {
  to {
    background-position: -220% 0;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 470px) {
  .control-card {
    grid-template-columns: 1fr 1fr;
  }

  .routes {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .route-button {
    min-height: 136px;
    grid-template-columns: 1fr;
    align-content: start;
  }

  .route-badge {
    width: 42px;
    height: 42px;
  }
}
