:root {
  --bg-deep: #07121b;
  --bg-panel: #0e1e2c;
  --bg-card: #13283a;
  --bg-card-sub: #0f2030;
  --border-subtle: rgba(148, 197, 232, 0.16);
  --line-green: #009e60;
  --line-green-bright: #10c97e;
  --up-accent: #10c97e;
  --down-accent: #38bdf8;
  --urgent-color: #ff5d5d;
  --warn-color: #f59e0b;
  --text-primary: #f8fafc;
  --text-secondary: #9fb7cc;
  --text-muted: #6c859c;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(circle at top center, #102638 0%, var(--bg-deep) 65%);
  color: var(--text-primary);
  font-family: "Noto Sans KR", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

.pid-shell {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  padding: 18px 28px 14px;
  gap: 14px;
}

/* 헤더 */
.pid-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, rgba(16, 40, 58, 0.96), rgba(10, 26, 40, 0.96));
  border: 1px solid var(--border-subtle);
  border-left: 8px solid var(--line-green);
  border-radius: 16px;
  padding: 14px 24px;
  flex-shrink: 0;
}

.station-brand {
  display: flex;
  align-items: center;
  gap: 18px;
}

.line-badge {
  width: 60px;
  height: 60px;
  flex-shrink: 0;
}

.station-line-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.station-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 12px;
  border-radius: 999px;
  background: var(--line-green);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.station-name {
  font-size: 2.5rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.05;
}

.station-eng {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.direction-label {
  margin-top: 4px;
  font-size: 1.05rem;
  color: var(--line-green-bright);
  font-weight: 600;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 22px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 700;
  border: 1px solid transparent;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.status-pill.live {
  background: rgba(16, 201, 126, 0.14);
  border-color: rgba(16, 201, 126, 0.4);
  color: #6ee7b7;
}
.status-pill.live .status-dot {
  background: #10c97e;
  box-shadow: 0 0 10px #10c97e;
}

.status-pill.replay {
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.45);
  color: #fcd34d;
}
.status-pill.replay .status-dot {
  background: #f59e0b;
}

.status-pill.unavailable {
  background: rgba(255, 93, 93, 0.14);
  border-color: rgba(255, 93, 93, 0.45);
  color: #fca5a5;
}
.status-pill.unavailable .status-dot {
  background: #ff5d5d;
}

.clock-box {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.clock-date {
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.clock-time {
  font-size: 2.15rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #ffffff;
  line-height: 1.1;
}

/* 배너 */
.mode-banner {
  padding: 8px 18px;
  border-radius: 10px;
  font-size: 0.98rem;
  font-weight: 700;
  text-align: center;
  background: rgba(245, 158, 11, 0.16);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fde68a;
  flex-shrink: 0;
}

/* 메인 */
.pid-main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* 수신 대기 화면 */
.unavailable-panel {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.unavailable-card {
  text-align: center;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 56px 72px;
  max-width: 720px;
}

.unavailable-icon {
  font-size: 3.6rem;
  margin-bottom: 16px;
}

.unavailable-card h2 {
  font-size: 2.1rem;
  font-weight: 800;
  margin-bottom: 12px;
}

.unavailable-card p {
  font-size: 1.15rem;
  color: var(--text-secondary);
}

/* 도착 카드 그리드 */
.arrivals-grid {
  flex: 1.25;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

body.view-up .arrivals-grid,
body.view-down .arrivals-grid {
  grid-template-columns: 1fr;
}

.direction-column {
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 16px 20px;
  gap: 12px;
  min-height: 0;
}

.column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border-subtle);
}

.column-header.up {
  border-bottom-color: rgba(16, 201, 126, 0.45);
}

.column-header.down {
  border-bottom-color: rgba(56, 189, 248, 0.45);
}

.dir-title {
  font-size: 1.45rem;
  font-weight: 800;
}

.dir-sub {
  font-size: 0.98rem;
  color: var(--text-secondary);
}

.dir-arrow {
  font-size: 1.35rem;
  font-weight: 900;
}

.column-header.up .dir-arrow {
  color: var(--up-accent);
}

.column-header.down .dir-arrow {
  color: var(--down-accent);
}

.train-cards {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

.train-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 18px 24px;
  gap: 16px;
}

.train-card.primary {
  flex: 1.35;
  background: linear-gradient(135deg, #163147 0%, #102537 100%);
  border-width: 2px;
}

.train-card.primary.up {
  border-color: rgba(16, 201, 126, 0.45);
}

.train-card.primary.down {
  border-color: rgba(56, 189, 248, 0.45);
}

.train-card.secondary {
  flex: 0.85;
  background: var(--bg-card-sub);
}

.train-card.urgent {
  border-color: rgba(255, 93, 93, 0.85) !important;
  box-shadow: 0 0 24px rgba(255, 93, 93, 0.22);
  animation: urgentPulse 1.4s ease-in-out infinite;
}

@keyframes urgentPulse {
  0%, 100% { box-shadow: 0 0 18px rgba(255, 93, 93, 0.2); }
  50% { box-shadow: 0 0 32px rgba(255, 93, 93, 0.5); }
}

.train-left {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.train-order-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.order-badge {
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 0.88rem;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
}

.train-no {
  font-size: 0.92rem;
  color: var(--text-muted);
  font-weight: 600;
}

.train-dest {
  font-size: 2.25rem;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.train-card.secondary .train-dest {
  font-size: 1.65rem;
}

.train-detail {
  font-size: 1.05rem;
  color: var(--text-secondary);
}

.train-right {
  text-align: right;
  flex-shrink: 0;
}

.arrival-text {
  font-size: 2.8rem;
  font-weight: 900;
  color: #fde047;
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
}

.train-card.secondary .arrival-text {
  font-size: 2.05rem;
  color: #e2e8f0;
}

.train-card.urgent .arrival-text {
  color: #ff6b6b;
}

.empty-train-card {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--border-subtle);
  border-radius: 14px;
  color: var(--text-muted);
  font-size: 1.25rem;
  font-weight: 600;
}

/* 노선도 영역 */
.route-section {
  flex: 0.85;
  min-height: 210px;
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 14px 22px 10px;
}

.route-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.route-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.route-legend {
  display: flex;
  gap: 18px;
  font-size: 0.92rem;
  color: var(--text-secondary);
}

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

.legend-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.legend-dot.up {
  background: var(--up-accent);
}

.legend-dot.down {
  background: var(--down-accent);
}

.route-svg-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.route-svg {
  width: 100%;
  height: 100%;
  max-height: 195px;
}

.train-marker {
  transition: transform 0.8s linear;
}

/* 하단 바 */
.pid-footer {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(11, 27, 40, 0.94);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 10px 18px;
  flex-shrink: 0;
}

.notice-badge {
  padding: 3px 12px;
  border-radius: 6px;
  background: var(--line-green);
  color: #fff;
  font-size: 0.92rem;
  font-weight: 800;
  flex-shrink: 0;
}

.notice-text {
  flex: 1;
  font-size: 1.08rem;
  font-weight: 600;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.device-meta {
  font-size: 0.88rem;
  color: var(--text-muted);
  font-weight: 700;
  flex-shrink: 0;
}
