/* Today’s Train uses one unified train render and a roster-first layout. */

.train-card > .section-heading .icon-train {
  width: 54px;
  height: 42px;
  background-image: url('/img/train-engine.webp');
}

.component-train {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.train-route-art {
  position: relative;
  min-height: 128px;
  overflow: hidden;
  border: 1px solid rgba(190, 63, 49, 0.4);
  border-radius: var(--radius-sm);
  background:
    linear-gradient(90deg, rgba(9, 12, 17, 0.2), transparent 24%, transparent 76%, rgba(9, 12, 17, 0.2)),
    linear-gradient(180deg, #1d242d, #11161d);
}

.train-route-art::before {
  content: '';
  position: absolute;
  inset: 12px 24px;
  background: transparent url('/img/train-roster.webp') no-repeat center / contain;
  filter: drop-shadow(0 7px 9px rgba(0, 0, 0, 0.72));
}

.train-route-art::after {
  content: '';
  position: absolute;
  right: 0;
  bottom: 17px;
  left: 0;
  height: 2px;
  z-index: 0;
  background: linear-gradient(90deg, transparent, rgba(201, 162, 39, 0.28), transparent);
}

.train-crew-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.train-crew-card {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  align-items: center;
  gap: 0.8rem;
  min-width: 0;
  padding: 0.85rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(201, 162, 39, 0.09), rgba(255, 255, 255, 0.025));
}

.train-crew-card--forecast {
  border-style: dashed;
  background: var(--tint-muted);
  opacity: 0.75;
}

.role-badge {
  display: block;
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  border-radius: 12px;
  background-color: rgba(6, 9, 13, 0.48);
  background-position: center;
  background-repeat: no-repeat;
  background-size: 74%;
}

.role-badge-conductor {
  background-image: url('/img/components/badge-conductor.webp');
}

.role-badge-vip {
  background-image: url('/img/components/badge-vip.webp');
}

.train-crew-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 0.18rem;
}

.train-crew-role {
  color: var(--color-text-muted);
  font-size: 0.77rem;
  font-weight: 750;
  letter-spacing: 0.065em;
  text-transform: uppercase;
}

.train-crew-card--forecast .train-crew-role {
  opacity: 0.8;
}

.train-crew-copy strong {
  overflow: hidden;
  color: var(--color-text);
  font-size: 1.02rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.train-crew-duties {
  min-width: 0;
  color: var(--color-text-muted);
  font-size: 0.75rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.train-cargo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.train-cargo-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: rgba(13, 18, 24, 0.72);
}

.train-cargo-card--vs-top5 {
  border-color: rgba(223, 178, 55, 0.72);
  background:
    radial-gradient(circle at 92% 8%, rgba(222, 174, 49, 0.13), transparent 35%),
    linear-gradient(145deg, rgba(44, 29, 17, 0.94), rgba(13, 18, 24, 0.9) 62%);
  box-shadow:
    inset 0 1px 0 rgba(255, 234, 165, 0.1),
    0 12px 30px rgba(0, 0, 0, 0.18);
}

.train-cargo-card--vs-top5::after {
  content: '';
  position: absolute;
  top: 0;
  right: 18px;
  left: 18px;
  height: 2px;
  background: linear-gradient(90deg, transparent, #e0ad31, transparent);
  box-shadow: 0 0 12px rgba(224, 173, 49, 0.58);
}

.train-cargo-header {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--color-border);
  background: linear-gradient(90deg, rgba(190, 63, 49, 0.13), rgba(255, 255, 255, 0.025));
}

.train-cargo-card--vs-top5 .train-cargo-header {
  border-bottom-color: rgba(223, 178, 55, 0.28);
  background: linear-gradient(90deg, rgba(161, 52, 37, 0.28), rgba(211, 159, 35, 0.1));
}

.train-cargo-number {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border: 1px solid rgba(201, 162, 39, 0.48);
  border-radius: 50%;
  color: var(--color-accent);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 800;
}

.train-cargo-card--vs-top5 .train-cargo-number {
  border-color: rgba(243, 202, 83, 0.72);
  background: rgba(112, 39, 28, 0.34);
  color: #f7d476;
  box-shadow: inset 0 0 12px rgba(224, 173, 49, 0.08);
}

.train-cargo-vs-icon {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border-radius: 10px;
  background: rgba(7, 10, 14, 0.46) url('/img/ui/vs.webp') no-repeat center / 82%;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.45));
}

.train-cargo-copy {
  min-width: 0;
}

.train-cargo-title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.train-cargo-header h3 {
  margin: 0;
  color: var(--color-text);
  font-size: 0.98rem;
}

.train-cargo-vs-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0.12rem 0.48rem;
  border: 1px solid rgba(245, 203, 82, 0.48);
  border-radius: 999px;
  background: rgba(111, 34, 26, 0.56);
  color: #ffe39a;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 850;
  letter-spacing: 0.045em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

.train-cargo-vs-summary {
  color: #dcbf79 !important;
  font-weight: 650;
}

.train-cargo-copy > span {
  color: var(--color-text-muted);
  font-size: 0.75rem;
}

.train-passenger-list {
  padding: 0.4rem 0.85rem 0.55rem;
}

.train-passenger-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.6rem;
  min-height: 40px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.055);
}

.train-passenger-row:last-child {
  border-bottom: 0;
}

.train-seat-number {
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 0.73rem;
  text-align: center;
}

.train-passenger-name {
  min-width: 0;
  overflow: hidden;
  color: var(--color-text);
  font-weight: 620;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.train-replaced-name {
  color: var(--color-text-muted);
}

.train-cargo-empty {
  padding: 0.7rem 0;
  color: var(--color-text-muted);
  font-size: 0.85rem;
  font-style: italic;
}

@media (max-width: 700px) {
  .train-route-art {
    min-height: 102px;
  }

  .train-route-art::before {
    inset: 10px 12px;
    background-position: right center;
    background-size: auto 74px;
  }

  .train-cargo-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .train-crew-grid {
    grid-template-columns: 1fr;
  }

  .train-card > .section-heading .icon-train {
    width: 48px;
  }

  .train-cargo-vs-icon {
    width: 36px;
    height: 36px;
  }

  .train-cargo-header {
    gap: 0.55rem;
  }
}
