:root {
  --bg: #eef2f7;
  --surface: #ffffff;
  --surface-soft: #f7f9fc;
  --line: #dce3ec;
  --line-strong: #c8d2df;
  --text: #142033;
  --muted: #6d7c8f;
  --navy: #101d31;
  --blue: #246ee9;
  --green: #0a9b70;
  --amber: #e09124;
  --red: #d24b47;
  --line-color: #0052a4;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1180px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 0%, rgba(79, 128, 203, 0.10), transparent 32%),
    linear-gradient(180deg, #f6f8fb 0, var(--bg) 420px);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  letter-spacing: -0.01em;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  color: #273750;
  font-weight: 800;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease;
}

button:hover:not(:disabled) {
  border-color: #95a8bf;
  transform: translateY(-1px);
}

button:disabled {
  cursor: default;
  opacity: 0.42;
}

.hidden {
  display: none !important;
}

.app-shell {
  width: min(1540px, calc(100% - 48px));
  margin: 0 auto;
  padding: 28px 0 42px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 20px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 17px;
}

.brand-icon {
  display: block;
  width: 56px;
  height: 56px;
  border-radius: 18px;
  box-shadow: 0 12px 26px rgba(17, 35, 60, 0.18);
}

.eyebrow,
.section-kicker {
  margin: 0 0 5px;
  color: #718198;
  font-size: 10px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.topbar h1 {
  margin: 0;
  color: #122038;
  font-size: 28px;
  line-height: 1.2;
  font-weight: 900;
  letter-spacing: -0.035em;
}

.top-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mode-switch {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  width: 280px;
  margin-bottom: 18px;
  padding: 4px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #e7edf5;
}

.mode-switch button {
  height: 38px;
  border-color: transparent;
  border-radius: 7px;
  background: transparent;
  color: #66768c;
  font-size: 12px;
}

.mode-switch button.active {
  border-color: #cbd6e3;
  background: #fff;
  color: #1b2d46;
  box-shadow: 0 3px 9px rgba(31, 49, 75, 0.10);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 86px;
  height: 34px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: #4a5a70;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
  backdrop-filter: blur(8px);
}

.badge.ok {
  border-color: #afe0cf;
  background: #ebfaf4;
  color: #087f5c;
}

.badge.warn {
  border-color: #f2cf99;
  background: #fff6e8;
  color: #a9630e;
}

.badge.time {
  min-width: 92px;
  color: #24344c;
  font-variant-numeric: tabular-nums;
}

.panel {
  border: 1px solid rgba(205, 215, 227, 0.92);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 14px 35px rgba(32, 48, 73, 0.07);
}

.setup-panel {
  margin-bottom: 18px;
  padding: 17px 18px 18px;
}

.setup-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 13px;
}

.setup-head h2 {
  margin: 0;
  color: #22324b;
  font-size: 17px;
  line-height: 1.15;
  font-weight: 900;
}

.slot-setup-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.slot-setup {
  padding: 13px;
  border: 1px solid #dde5ee;
  border-radius: 13px;
  background: #f9fbfd;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
  cursor: pointer;
}

.slot-setup.selected {
  border-color: #8fb4e9;
  background: #f3f8ff;
  box-shadow: 0 0 0 3px rgba(45, 111, 213, 0.08);
}

.slot-setup.active {
  border-color: #99d8c1;
}

.slot-setup.active.selected {
  border-color: #47aa86;
  box-shadow: 0 0 0 3px rgba(31, 158, 112, 0.09);
}

.slot-setup-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.slot-index {
  color: #23344c;
  font-size: 15px;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.slot-state {
  display: inline-flex;
  align-items: center;
  height: 23px;
  padding: 0 9px;
  border: 1px solid #d8e0e9;
  border-radius: 999px;
  background: #fff;
  color: #77859a;
  font-size: 10px;
  font-weight: 900;
}

.slot-state.active {
  border-color: #a7dfcb;
  background: #e9f9f2;
  color: #087f5c;
}

.slot-state.error {
  border-color: #efb8b5;
  background: #fff0ef;
  color: #b93632;
}

.slot-fields {
  display: grid;
  grid-template-columns: minmax(100px, 0.9fr) minmax(120px, 1.25fr);
  gap: 8px;
}

.subway-common-controls {
  display: flex;
  align-items: end;
  gap: 14px;
  flex-wrap: wrap;
}

.api-key-switch {
  display: flex;
  gap: 6px;
}

.api-key-switch button {
  display: grid;
  gap: 3px;
  min-width: 118px;
  min-height: 48px;
  padding: 7px 12px;
  text-align: left;
  border-radius: 7px;
}

.api-key-switch button strong { font-size: 12px; }
.api-key-switch button small { font-size: 10px; color: #65758b; }
.api-key-switch button.active { background: #e9f2ff; border-color: #6292d6; color: #1855a7; }
.api-key-switch button.exhausted small { color: #b93632; }
.common-interval-label { display: grid; gap: 5px; color: #728096; font-size: 10px; font-weight: 900; }
.common-interval-label input { width: 92px; height: 32px; border: 1px solid #cfd9e5; border-radius: 7px; background: #fff; padding-left: 10px; color: #1d2b40; font-size: 13px; font-weight: 850; }
.shared-request-count { padding-bottom: 8px; color: #65758b; font-size: 11px; white-space: nowrap; }

.slot-fields label {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: #728096;
  font-size: 10px;
  font-weight: 900;
}

.slot-fields input,
.slot-fields select {
  width: 100%;
  height: 38px;
  border: 1px solid #cfd9e5;
  border-radius: 9px;
  outline: 0;
  padding: 0 10px;
  background: #fff;
  color: #1d2b40;
  font-size: 13px;
  font-weight: 850;
}

.slot-fields input:focus,
.slot-fields select:focus {
  border-color: #6292d6;
  box-shadow: 0 0 0 3px rgba(36, 110, 233, 0.09);
}

.input-suffix {
  position: relative;
}

.input-suffix input {
  padding-right: 26px;
}

.input-suffix em {
  position: absolute;
  right: 9px;
  top: 50%;
  color: #8b98aa;
  font-size: 10px;
  font-style: normal;
  transform: translateY(-50%);
}

.button-row {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr 0.75fr;
  gap: 7px;
  margin-top: 9px;
}

.button-row button {
  height: 34px;
  font-size: 11px;
}

.button-row .primary {
  border-color: #2369d4;
  background: #246ee9;
  color: #fff;
}

.button-row .quiet {
  border-color: transparent;
  background: transparent;
  color: #7b8799;
}

.tracking-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 372px;
  gap: 18px;
  align-items: stretch;
}

.live-panel,
.log-panel {
  min-height: 672px;
}

.live-panel {
  position: relative;
  overflow: hidden;
  padding: 22px;
}

.live-panel::before {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: var(--line-color);
  content: "";
}

.live-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.live-indicators {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  margin-left: auto;
}

.train-identity {
  display: flex;
  align-items: center;
  gap: 13px;
}

.line-symbol {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: 4px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(30, 47, 71, 0.13), 0 8px 17px rgba(30, 47, 71, 0.12);
  color: #fff;
  font-size: 15px;
  font-weight: 950;
}

.train-identity p {
  margin: 0 0 2px;
  color: var(--line-color);
  font-size: 12px;
  font-weight: 900;
}

.train-identity h2 {
  margin: 0;
  color: #17253a;
  font-size: 24px;
  line-height: 1.2;
  font-weight: 950;
}

.train-identity h2 small {
  color: #7b899c;
  font-size: 14px;
  font-weight: 800;
}

.certainty-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 132px;
  height: 36px;
  padding: 0 13px;
  border: 1px solid #dce4ed;
  border-radius: 999px;
  background: #f7f9fc;
  color: #627187;
  font-size: 11px;
}

.certainty-chip .pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.certainty-chip.confirmed {
  border-color: var(--station-time-ring, #b3cdf5);
  background: var(--station-time-soft, #eaf2ff);
  color: var(--station-time-color, #1f6bd7);
}

.certainty-chip.confirmed .pulse-dot {
  box-shadow: 0 0 0 5px var(--station-time-soft, #eaf2ff);
}

.evidence-arrival {
  --station-time-color: #1f6bd7;
  --station-time-soft: #eaf2ff;
  --station-time-ring: #b3cdf5;
  --station-time-light: #9fc7ff;
}

.evidence-departure {
  --station-time-color: #087f5b;
  --station-time-soft: #eaf9f3;
  --station-time-ring: #a4dec9;
  --station-time-light: #78e2bd;
}

.evidence-entry {
  --station-time-color: #a56300;
  --station-time-soft: #fff6e8;
  --station-time-ring: #efd09a;
  --station-time-light: #f3cf8b;
}

.station-time.evidence-arrival,
.station-time.evidence-departure,
.station-time.evidence-entry {
  color: var(--station-time-color);
}

.certainty-chip.estimated {
  border-color: #f0cf9a;
  background: #fff6e8;
  color: #a76513;
}

.certainty-chip.estimated .pulse-dot {
  animation: pulse 1.3s infinite;
}

.live-metrics {
  display: grid;
  grid-template-columns: 1.05fr 1.35fr 0.62fr;
  gap: 10px;
  margin-bottom: 14px;
}

.live-metric {
  min-width: 0;
  min-height: 91px;
  padding: 14px;
  border: 1px solid #e0e7ef;
  border-radius: 13px;
  background: #f8fafc;
}

.live-metric > span {
  display: block;
  margin-bottom: 7px;
  color: #76859a;
  font-size: 10px;
  font-weight: 900;
}

.live-metric > strong {
  display: block;
  overflow: hidden;
  margin-bottom: 5px;
  color: #1a293f;
  font-size: 20px;
  line-height: 1.1;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-metric > small {
  display: block;
  overflow: hidden;
  color: #8190a3;
  font-size: 10px;
  line-height: 1.3;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.primary-metric {
  border-color: color-mix(in srgb, var(--line-color) 23%, #dce3ec);
  background: color-mix(in srgb, var(--line-color) 4%, #fff);
}

.primary-metric > strong {
  color: var(--line-color);
}

.compact-metric > strong {
  font-variant-numeric: tabular-nums;
}

.route-stage {
  position: relative;
  overflow: hidden;
  min-height: 366px;
  padding: 19px;
  border-radius: 16px;
  background:
    radial-gradient(circle at 86% 13%, rgba(83, 135, 216, 0.22), transparent 30%),
    linear-gradient(145deg, #0e1a2d 0%, #152845 72%, #102039 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05), 0 16px 30px rgba(18, 32, 54, 0.15);
  color: #fff;
}

.route-stage::before {
  position: absolute;
  inset: 0;
  opacity: 0.18;
  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: 32px 32px;
  content: "";
  pointer-events: none;
}

.route-stage-top,
.route-legend,
.route-viewport {
  position: relative;
  z-index: 1;
}

.route-stage-top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
}

.route-stage-top > div {
  min-width: 0;
}

.route-label {
  display: block;
  margin-bottom: 5px;
  color: #90a5c1;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.18em;
}

.route-stage-top strong {
  display: block;
  overflow: hidden;
  font-size: 17px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-clock {
  color: #bdd0e8;
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.route-viewport {
  position: relative;
  height: 242px;
  margin: 3px 15px 0;
}

.route-line {
  position: absolute;
  top: 126px;
  left: 0;
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: var(--line-color);
  box-shadow: 0 0 22px color-mix(in srgb, var(--line-color) 55%, transparent);
}

.station-layer {
  position: absolute;
  inset: 0;
}

.station-node {
  position: absolute;
  top: 116px;
  width: 94px;
  color: #aebed2;
  text-align: center;
  transform: translateX(-50%);
}

.station-node i {
  display: block;
  width: 20px;
  height: 20px;
  margin: 0 auto 11px;
  border: 5px solid #d9e5f3;
  border-radius: 50%;
  background: #142641;
  box-shadow: 0 0 0 3px rgba(15, 29, 50, 0.85);
}

.station-node strong {
  display: block;
  overflow: hidden;
  color: #c9d6e7;
  font-size: 11px;
  font-weight: 850;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.station-node small {
  display: block;
  margin-top: 3px;
  color: #7f96b2;
  font-size: 9px;
  font-weight: 800;
}

.station-code {
  position: absolute;
  top: -22px;
  left: 50%;
  color: #7289a5;
  font-size: 8px;
  font-weight: 800;
  transform: translateX(-50%);
}

.station-node.visited i {
  border-color: var(--station-time-color, var(--line-color));
  background: #fff;
}

.station-node.current i {
  border-color: #fff;
  background: var(--station-time-color, var(--line-color));
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--station-time-color, var(--line-color)) 45%, transparent), 0 0 22px rgba(255, 255, 255, 0.34);
}

.station-node.current strong {
  color: #fff;
  font-weight: 950;
}

.station-node.current small {
  color: var(--station-time-light, #9fc7ff);
}

.station-node.next i {
  border-color: #f7c873;
  background: #142641;
}

.station-node.next strong,
.station-node.next small {
  color: #f3cf8b;
}

.train-marker {
  position: absolute;
  top: 59px;
  z-index: 4;
  width: 0;
  transition: left 900ms linear;
}

.train-bubble {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 83px;
  height: 38px;
  padding: 0 12px 0 8px;
  border: 2px solid #fff;
  border-radius: 12px;
  background: var(--line-color);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35), 0 0 20px color-mix(in srgb, var(--line-color) 45%, transparent);
  color: #fff;
  transform: translateX(-50%);
}

.train-marker.estimated .train-bubble {
  animation: floatTrain 1.4s ease-in-out infinite;
}

.train-icon {
  display: block;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.train-bubble strong {
  font-size: 13px;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.marker-pin {
  position: absolute;
  top: 38px;
  left: -5px;
  width: 0;
  height: 0;
  border-top: 8px solid #fff;
  border-right: 5px solid transparent;
  border-left: 5px solid transparent;
}

.route-empty {
  position: absolute;
  inset: 32px 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #9cb0ca;
  text-align: center;
}

.empty-rail {
  position: relative;
  width: min(470px, 70%);
  height: 7px;
  margin-bottom: 29px;
  border-radius: 999px;
  background: rgba(131, 154, 185, 0.28);
}

.empty-rail::before,
.empty-rail::after {
  position: absolute;
  top: 50%;
  width: 18px;
  height: 18px;
  border: 4px solid #7187a4;
  border-radius: 50%;
  background: #142641;
  content: "";
  transform: translateY(-50%);
}

.empty-rail::before {
  left: 15%;
}

.empty-rail::after {
  right: 15%;
}

.route-empty strong {
  color: #d0dceb;
  font-size: 14px;
}

.route-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 18px;
  min-height: 30px;
  padding: 0 1px;
  color: #8ea2bc;
  font-size: 9px;
  font-weight: 750;
}

.route-legend > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.legend-dot.confirmed {
  background: #1f6bd7;
}

.legend-dot.departure {
  background: #087f5b;
}

.legend-dot.entry {
  background: #a56300;
}

.legend-dot.estimated {
  border: 2px solid #f2b953;
}

.tracking-strip {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #e5ebf2;
}

.tracking-strip > div > span,
.api-time-box span {
  display: block;
  margin-bottom: 7px;
  color: #8290a3;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.05em;
}

.slot-list {
  display: flex;
  gap: 7px;
}

.slot-pill {
  display: grid;
  grid-template-columns: 22px auto;
  column-gap: 7px;
  align-items: center;
  min-width: 128px;
  height: 47px;
  padding: 5px 10px;
  text-align: left;
}

.slot-pill.selected {
  border-color: color-mix(in srgb, var(--line-color) 55%, #c7d1df);
  background: color-mix(in srgb, var(--line-color) 5%, #fff);
}

.slot-pill-index {
  grid-row: span 2;
  color: var(--line-color);
  font-size: 10px;
  font-weight: 950;
}

.slot-pill strong {
  color: #24344b;
  font-size: 11px;
  font-weight: 950;
}

.slot-pill small {
  color: #8290a3;
  font-size: 8px;
  font-weight: 750;
}

.api-time-box {
  min-width: 94px;
  padding: 0 4px;
  text-align: right;
}

.api-time-box strong {
  color: #25354d;
  font-size: 15px;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.log-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 20px;
}

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

.log-head h2 {
  margin: 0;
  color: #1b2a40;
  font-size: 20px;
  line-height: 1.2;
  font-weight: 950;
}

.download-button {
  flex: 0 0 auto;
  height: 34px;
  padding: 0 11px;
  font-size: 10px;
}

.log-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 10px;
  border: 1px solid #e0e7ef;
  border-radius: 12px;
  background: #f8fafc;
}

.log-summary > div {
  padding: 12px 13px;
}

.log-summary > div + div {
  border-left: 1px solid #e0e7ef;
}

.log-summary > .log-summary-recent {
  grid-column: 1 / -1;
  border-top: 1px solid #e0e7ef;
  border-left: 0;
}

.line-tracking-metrics small {
  color: var(--muted);
  font-size: 11px;
}

.log-summary span {
  display: block;
  margin-bottom: 4px;
  color: #7e8c9f;
  font-size: 9px;
  font-weight: 850;
}

.log-summary strong {
  color: #24344b;
  font-size: 17px;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.arrival-timeline {
  flex: 1 1 auto;
  overflow: auto;
  min-height: 0;
  margin: 0;
  padding: 3px 3px 10px 0;
  list-style: none;
}

.timeline-item {
  display: grid;
  grid-template-columns: 38px 1fr;
  min-height: 78px;
}

.timeline-axis {
  position: relative;
  display: flex;
  justify-content: center;
}

.timeline-axis::after {
  position: absolute;
  top: 26px;
  bottom: -2px;
  left: 50%;
  width: 2px;
  background: #dfe6ee;
  content: "";
  transform: translateX(-50%);
}

.timeline-item:last-child .timeline-axis::after {
  display: none;
}

.timeline-axis span {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 4px solid #eef2f7;
  border-radius: 50%;
  background: #8e9caf;
  color: #fff;
  font-size: 8px;
  font-weight: 950;
}

.timeline-item.latest .timeline-axis span {
  border-color: var(--station-time-soft, #eaf2ff);
  background: var(--station-time-color, #1f6bd7);
  box-shadow: 0 0 0 3px var(--station-time-soft, #eaf2ff);
}

.timeline-content {
  padding: 2px 0 15px 8px;
  border-bottom: 1px solid #edf1f5;
}

.timeline-content > div {
  display: flex;
  align-items: center;
  gap: 7px;
}

.timeline-content strong {
  color: #22324a;
  font-size: 15px;
  font-weight: 950;
}

.timeline-content em {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--station-time-soft, #eaf2ff);
  color: var(--station-time-color, #1f6bd7);
  font-size: 8px;
  font-style: normal;
  font-weight: 900;
}

.timeline-content time {
  display: block;
  margin: 5px 0 3px;
  color: #1f6bd7;
  font-size: 13px;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.timeline-empty {
  display: flex;
  min-height: 292px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #8a98aa;
  text-align: center;
}

.empty-icon {
  display: grid;
  place-content: center;
  width: 42px;
  height: 42px;
  margin-bottom: 12px;
  border-radius: 50%;
  background: #eef3f8;
  color: #8291a5;
  font-size: 18px;
  font-weight: 900;
}

.timeline-empty strong {
  color: #65758a;
  font-size: 13px;
}

.save-strip {
  flex: 0 0 auto;
  padding-top: 12px;
  border-top: 1px solid #e5ebf1;
}

.save-strip > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.save-strip span {
  color: #8a97a8;
  font-size: 9px;
  font-weight: 850;
}

.save-strip strong {
  overflow: hidden;
  color: #324258;
  font-size: 10px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.save-strip p {
  overflow: hidden;
  margin: 6px 0 0;
  color: #98a4b4;
  font-size: 8px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.high-speed-setup {
  margin-bottom: 18px;
  padding: 18px;
}

.rail-slot-fields {
  display: grid;
  grid-template-columns: minmax(128px, 1.15fr) minmax(90px, 0.8fr) 76px;
  gap: 8px;
}

.rail-slot-fields label {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: #728096;
  font-size: 10px;
  font-weight: 900;
}

.rail-slot-fields input {
  width: 100%;
  height: 38px;
  border: 1px solid #cfd9e5;
  border-radius: 9px;
  outline: 0;
  padding: 0 9px;
  background: #fff;
  color: #1d2b40;
  font-size: 12px;
  font-weight: 850;
}

.rail-slot-fields input:focus {
  border-color: #6292d6;
  box-shadow: 0 0 0 3px rgba(36, 110, 233, 0.09);
}

.rail-live-panel {
  --line-color: #16817f;
  display: flex;
  flex-direction: column;
}

.rail-line-symbol {
  border-radius: 12px;
  background: #16817f;
  font-size: 13px;
}

.rail-live-panel .rail-route-band {
  flex: 1 1 auto;
  min-height: 285px;
}

.rail-tracking-strip {
  grid-template-columns: 1fr;
  margin-top: auto;
}

.high-speed-source {
  color: #708096;
  font-size: 11px;
  font-weight: 850;
}

.high-speed-fields {
  display: grid;
  grid-template-columns: 210px minmax(180px, 1fr) 110px minmax(250px, 300px);
  gap: 10px;
  align-items: end;
}

.high-speed-fields label {
  display: grid;
  gap: 6px;
  color: #728096;
  font-size: 10px;
  font-weight: 900;
}

.high-speed-fields input {
  width: 100%;
  height: 42px;
  border: 1px solid #cfd9e5;
  border-radius: 8px;
  outline: 0;
  padding: 0 12px;
  background: #fff;
  color: #1d2b40;
  font-size: 14px;
  font-weight: 850;
}

.high-speed-fields input:focus {
  border-color: #6292d6;
  box-shadow: 0 0 0 3px rgba(36, 110, 233, 0.09);
}

.high-speed-actions {
  margin-top: 0;
}

.high-speed-actions button {
  height: 42px;
  border-radius: 8px;
}

.high-speed-results {
  min-height: 610px;
  padding: 20px;
}

.rail-route-band {
  margin: 16px 0 18px;
  padding: 16px 0 12px;
  border-top: 1px solid #dfe7e8;
  border-bottom: 1px solid #dfe7e8;
  background: #f8fbfa;
}

.rail-route-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 16px 14px;
}

.rail-route-head > div:first-child {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.rail-route-head > div:first-child span {
  color: #16817f;
  font-size: 9px;
  font-weight: 950;
  letter-spacing: 0;
}

.rail-route-head > div:first-child strong {
  overflow: hidden;
  color: #1d2b32;
  font-size: 15px;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rail-route-endpoints {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #4a5a61;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.rail-route-endpoints i {
  position: relative;
  display: block;
  width: 54px;
  height: 1px;
  background: #aebdc0;
}

.rail-route-endpoints i::after {
  position: absolute;
  top: -3px;
  right: 0;
  width: 6px;
  height: 6px;
  border-top: 1px solid #aebdc0;
  border-right: 1px solid #aebdc0;
  content: "";
  transform: rotate(45deg);
}

.rail-route-viewport {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0 0 6px;
  scrollbar-color: #aebfc1 transparent;
  scrollbar-width: thin;
}

.rail-route-viewport::-webkit-scrollbar {
  height: 6px;
}

.rail-route-viewport::-webkit-scrollbar-thumb {
  border-radius: 3px;
  background: #aebfc1;
}

.rail-route-canvas {
  position: relative;
  height: 142px;
  margin: 0 64px;
}

.rail-route-track,
.rail-route-progress {
  position: absolute;
  top: 70px;
  left: 0;
  height: 4px;
  border-radius: 2px;
}

.rail-route-track {
  right: 0;
  background: #d8e1e2;
}

.rail-route-progress {
  z-index: 1;
  width: 0;
  height: 3px;
  background: #d88a31;
  transition: width 0.9s linear;
}

.rail-route-stop {
  position: absolute;
  top: 61px;
  z-index: 2;
  width: 108px;
  color: #718086;
  text-align: center;
  transform: translateX(-50%);
}

.rail-route-stop > span,
.rail-route-stop > strong {
  position: absolute;
  left: 50%;
  width: 108px;
  transform: translateX(-50%);
}

.rail-route-stop > span {
  bottom: 22px;
  color: #849196;
  font-size: 9px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.rail-route-stop > strong {
  top: 25px;
  overflow: hidden;
  color: #58686e;
  font-size: 11px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rail-route-stop > i {
  display: block;
  width: 16px;
  height: 16px;
  margin: 1px auto 0;
  border: 4px solid #d6dfe0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 3px #f8fbfa;
}

.rail-route-stop.passed > i {
  border-color: #168c88;
  background: #168c88;
}

.rail-route-stop.passed > strong {
  color: #2f6665;
}

.rail-route-stop.current > i {
  border-color: #e45845;
  background: #fff;
  box-shadow: 0 0 0 5px rgba(228, 88, 69, 0.13);
  animation: railStationPulse 1.8s ease-in-out infinite;
}

.rail-route-stop.current > strong,
.rail-route-stop.next > strong {
  color: #c84838;
}

.rail-route-stop.next > i {
  border-color: #e7a096;
}

.rail-route-stop.passed.current > i {
  border-color: #168c88;
  background: #168c88;
  box-shadow: 0 0 0 5px rgba(22, 140, 136, 0.13);
}

.rail-train-marker {
  position: absolute;
  top: 14px;
  z-index: 5;
  width: 0;
  transform: translateX(-50%);
  transition: left 0.9s linear;
}

.rail-train-bubble {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 80px;
  height: 38px;
  padding: 0 11px 0 7px;
  border: 2px solid #fff;
  border-radius: 11px;
  background: #16817f;
  box-shadow: 0 8px 20px rgba(40, 67, 70, 0.24);
  color: #fff;
  transform: translateX(-50%);
}

.rail-train-marker.moving .rail-train-bubble {
  animation: railFloatTrain 1.4s ease-in-out infinite;
}

.rail-train-bubble img {
  display: block;
  width: 23px;
  height: 23px;
  border-radius: 6px;
}

.rail-train-bubble strong {
  font-size: 13px;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.rail-marker-pin {
  position: absolute;
  top: 38px;
  left: -5px;
  width: 0;
  height: 0;
  border-top: 8px solid #fff;
  border-right: 5px solid transparent;
  border-left: 5px solid transparent;
}

.rail-route-legend {
  display: flex;
  justify-content: flex-end;
  gap: 15px;
  padding: 0 16px;
  color: #758388;
  font-size: 9px;
  font-weight: 850;
}

.rail-route-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.rail-route-legend i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.rail-route-legend i.confirmed {
  background: #168c88;
}

.rail-route-legend i.estimated {
  border: 2px solid #e45845;
  background: #fff;
}

.high-speed-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 16px 0;
  border: 1px solid #e0e7ef;
  border-radius: 8px;
  background: #f8fafc;
}

.high-speed-summary > div {
  padding: 12px 14px;
}

.high-speed-summary > div + div {
  border-left: 1px solid #e0e7ef;
}

.high-speed-summary span,
.high-speed-summary strong,
.high-speed-summary small {
  display: block;
}

.high-speed-summary span {
  margin-bottom: 5px;
  color: #7e8c9f;
  font-size: 9px;
  font-weight: 850;
}

.high-speed-summary strong {
  color: #24344b;
  font-size: 16px;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.high-speed-summary small {
  margin-top: 3px;
  color: #7e8c9f;
  font-size: 9px;
  font-weight: 750;
}

.high-speed-table-wrap {
  overflow: auto;
  max-height: 460px;
  border: 1px solid #dce4ed;
  border-radius: 8px;
}

.high-speed-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.high-speed-table th,
.high-speed-table td {
  height: 48px;
  padding: 0 18px;
  border-bottom: 1px solid #e5ebf1;
  text-align: left;
}

.high-speed-table tr.confirmed-arrival td:last-child {
  color: #087f5c;
}

.high-speed-table tr.estimated-arrival td:last-child {
  color: #a76513;
}

.high-speed-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f2f6fb;
  color: #53637a;
  font-size: 11px;
  font-weight: 900;
}

.high-speed-table td {
  color: #26364d;
  font-size: 13px;
  font-weight: 800;
}

.high-speed-table th:nth-child(1),
.high-speed-table td:nth-child(1) {
  width: 60%;
}

.high-speed-table th:nth-child(2),
.high-speed-table td:nth-child(2) {
  width: 40%;
  color: #1f6bd7;
  font-variant-numeric: tabular-nums;
}

.high-speed-table tbody tr:last-child td {
  border-bottom: 0;
}

.high-speed-table .table-empty td {
  height: 280px;
  color: #8795a7;
  text-align: center;
}

.high-speed-save {
  margin-top: 14px;
}

.rail-timetable-panel .high-speed-table-wrap {
  flex: 1 1 auto;
  max-height: 520px;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(224, 145, 36, 0.34); }
  50% { box-shadow: 0 0 0 7px rgba(224, 145, 36, 0); }
}

@keyframes floatTrain {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-2px); }
}

@keyframes railFloatTrain {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-2px); }
}

@keyframes railStationPulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(228, 88, 69, 0.10); }
  50% { box-shadow: 0 0 0 8px rgba(228, 88, 69, 0); }
}

@media (max-width: 1260px) {
  body {
    min-width: 1000px;
  }

  .app-shell {
    width: calc(100% - 28px);
  }

  .tracking-grid {
    grid-template-columns: minmax(0, 1fr) 335px;
  }

  .slot-fields {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .rail-slot-fields {
    grid-template-columns: 1fr 0.75fr 72px;
  }

  .route-legend > span:last-child {
    display: none;
  }
}

@media (max-width: 1000px) {
  body {
    min-width: 0;
  }

  .app-shell {
    width: 100%;
    padding: 18px;
  }

  .topbar,
  .setup-head {
    align-items: start;
    flex-direction: column;
  }

  .slot-setup-grid,
  .tracking-grid {
    grid-template-columns: 1fr;
  }

  .rail-slot-fields {
    grid-template-columns: 1fr 1fr 90px;
  }

  .high-speed-fields {
    grid-template-columns: 1fr 1fr 110px;
  }

  .high-speed-actions {
    grid-column: 1 / -1;
  }

  .rail-route-head {
    align-items: start;
    flex-direction: column;
    gap: 10px;
  }

  .tracking-grid {
    gap: 14px;
  }

  .live-panel,
  .log-panel {
    min-height: auto;
  }

  .log-panel {
    min-height: 590px;
  }
}

@media (max-width: 680px) {
  .mode-switch {
    width: 100%;
  }

  .high-speed-fields,
  .high-speed-summary {
    grid-template-columns: 1fr;
  }

  .rail-slot-fields {
    grid-template-columns: 1fr 1fr;
  }

  .rail-slot-fields .interval-field {
    grid-column: 1 / -1;
  }

  .rail-route-canvas {
    margin-right: 50px;
    margin-left: 50px;
  }

  .high-speed-summary > div + div {
    border-top: 1px solid #e0e7ef;
    border-left: 0;
  }
}
