.train-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding-bottom: 60px;
}

.section-title {
  margin: 0;
  font-size: 1.4rem;
}

.section-subtitle {
  margin: 0;
  color: #cfd8ff;
  font-size: 1rem;
}

.train-yard {
  position: relative;
  width: 700px;
  max-width: 96vw;
  height: 300px;
  margin-top: 10px;
  background: linear-gradient(180deg, #2d5a3d 0%, #3a6b4a 65%, #2d5a3d 100%);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.river {
  position: absolute;
  left: 0;
  top: 220px;
  width: 100%;
  height: 40px;
  background: linear-gradient(180deg, #60a5fa, #2563eb);
  opacity: 0.85;
  z-index: 0;
}

.river::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.15) 0 10px, transparent 10px 20px);
}

.village-house {
  position: absolute;
  width: 22px;
  height: 16px;
  background: #e8c88f;
  border-radius: 2px;
  z-index: 1;
}

.village-house::before {
  content: "";
  position: absolute;
  top: -10px;
  left: -3px;
  width: 0;
  height: 0;
  border-left: 14px solid transparent;
  border-right: 14px solid transparent;
  border-bottom: 12px solid #c1440e;
}

.house-1 {
  left: 200px;
  top: 36px;
}

.house-2 {
  left: 228px;
  top: 24px;
}

.house-3 {
  left: 250px;
  top: 40px;
}

.tunnel-mountain {
  position: absolute;
  left: 18px;
  top: 92px;
  width: 58px;
  height: 96px;
  background: linear-gradient(135deg, #78716c, #57534e);
  border-radius: 50% 50% 18% 18% / 55% 55% 18% 18%;
  z-index: 2;
}

.tunnel-mouth {
  position: absolute;
  left: 37px;
  top: 106px;
  width: 24px;
  height: 68px;
  background: #1c1917;
  border-radius: 50%;
  z-index: 3;
}

.station-building {
  position: absolute;
  left: 326px;
  top: 18px;
  width: 48px;
  height: 26px;
  background: linear-gradient(180deg, #f1f5f9, #cbd5e1);
  border-radius: 3px;
  z-index: 2;
}

.station-building::before {
  content: "";
  position: absolute;
  top: -8px;
  left: -4px;
  width: 56px;
  height: 10px;
  background: #ef476f;
  border-radius: 3px;
}

.station-platform {
  position: absolute;
  left: 320px;
  top: 50px;
  width: 60px;
  height: 8px;
  background: #94a3b8;
  border-radius: 2px;
  z-index: 1;
}

.track-loop {
  position: absolute;
  top: 60px;
  width: 120px;
  height: 180px;
  border: 3px double rgba(226, 232, 240, 0.85);
  border-radius: 10px;
  box-sizing: border-box;
  z-index: 1;
}

.track-loop-a {
  left: 50px;
}

.track-loop-b {
  left: 290px;
}

.track-loop-c {
  left: 530px;
}

.track-bridge {
  position: absolute;
  top: 148px;
  width: 120px;
  height: 4px;
  background: repeating-linear-gradient(90deg, #94a3b8 0 4px, transparent 4px 8px);
  z-index: 1;
}

.track-bridge-ab {
  left: 170px;
}

.track-bridge-bc {
  left: 410px;
}

.track-bridge-ac {
  left: 170px;
  top: 268px;
  width: 360px;
}

.track-bridge-stub {
  position: absolute;
  top: 240px;
  width: 4px;
  height: 30px;
  background: repeating-linear-gradient(180deg, #94a3b8 0 4px, transparent 4px 8px);
  z-index: 1;
}

.track-bridge-stub-ac-a {
  left: 168px;
}

.track-bridge-stub-ac-c {
  left: 528px;
}

.switch-marker {
  position: absolute;
  top: 144px;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: #64748b;
  transform: rotate(45deg);
  transition: background 0.2s ease, box-shadow 0.2s ease;
  z-index: 3;
}

.switch-marker-ab {
  left: 164px;
}

.switch-marker-bc {
  left: 404px;
}

.switch-marker-ac {
  left: 164px;
  top: 234px;
}

.switch-marker.open {
  background: #06d6a0;
  box-shadow: 0 0 8px #06d6a0;
}

.train {
  position: absolute;
  top: 0;
  left: 0;
  width: 22px;
  height: 12px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: space-evenly;
  padding: 0 2px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  z-index: 5;
  transition: opacity 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
}

.train.selected {
  box-shadow: 0 0 0 2px #fff, 0 0 10px 4px rgba(255, 255, 255, 0.6);
}

.train-1 {
  background: linear-gradient(90deg, #3b82f6, #60a5fa 50%, #3b82f6);
}

.train-2 {
  background: linear-gradient(90deg, #ef476f, #f97b93 50%, #ef476f);
}

.train-3 {
  background: linear-gradient(90deg, #22c55e, #4ade80 50%, #22c55e);
}

.train-4 {
  background: linear-gradient(90deg, #a855f7, #c084fc 50%, #a855f7);
}

.train-stripe {
  position: absolute;
  left: 3px;
  right: 3px;
  top: 50%;
  height: 3px;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.25);
  border-radius: 2px;
}

.train-window {
  position: relative;
  width: 4px;
  height: 4px;
  border-radius: 1px;
  background: rgba(255, 255, 255, 0.9);
}

.train-select-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  min-height: 20px;
}

.train-select-title {
  color: #a5b4fc;
  font-size: 0.85rem;
  font-weight: bold;
}

.train-select-dot {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.5);
}

.train-select-dot[hidden] {
  display: none;
}

.train-select-hint {
  color: #cfd8ff;
  font-size: 0.85rem;
  opacity: 0.8;
}

.train-select-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.train-select-controls[hidden] {
  display: none;
}

.train-pause-btn {
  padding: 6px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.05);
  color: #cfd8ff;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease, color 0.15s ease;
}

.train-pause-btn:hover {
  transform: scale(1.05);
}

.train-pause-btn.paused {
  background: linear-gradient(90deg, #ef476f, #f97b93);
  color: #1b1035;
  font-weight: bold;
  border-color: transparent;
}

.speed-btn-group {
  display: flex;
  gap: 6px;
}

.speed-btn {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.05);
  color: #cfd8ff;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease, color 0.15s ease;
}

.speed-btn:hover {
  transform: scale(1.05);
}

.speed-btn.active {
  background: linear-gradient(90deg, #06d6a0, #4d7cff);
  color: #1b1035;
  font-weight: bold;
  border-color: transparent;
}

.control-center {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: center;
  gap: 16px;
  margin-top: 6px;
}

.junction-control {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.junction-title {
  color: #a5b4fc;
  font-size: 0.8rem;
  font-weight: bold;
}

.switch-btn {
  padding: 10px 22px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.05);
  color: #cfd8ff;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease, color 0.15s ease;
}

.switch-btn:hover {
  transform: scale(1.05);
}

.switch-btn.open {
  background: linear-gradient(90deg, #06d6a0, #4d7cff);
  color: #1b1035;
  font-weight: bold;
  border-color: transparent;
}

.signal-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.signal-label {
  color: #cfd8ff;
  font-size: 0.85rem;
}

.signal-light {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #06d6a0;
  box-shadow: 0 0 8px #06d6a0;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.signal-light.wait {
  background: #ef476f;
  box-shadow: 0 0 8px #ef476f;
}

.signal-status {
  color: #cfd8ff;
  font-size: 0.85rem;
  font-weight: bold;
}
