/* ============================================
   MyLiveTrain — NTES-Style UI
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary: #1a3a6e;
    --primary-light: #1e4d8c;
    --primary-dark: #0f2347;
    --accent: #2563eb;
    --accent-light: #3b82f6;
    --accent-soft: #dbeafe;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --danger-bg: #fff1f1;
    --yellow-bg: #fffbeb;
    --yellow-border: #fcd34d;
    --gray-50: #f7f8fa;
    --gray-100: #f1f3f6;
    --gray-200: #e4e7ec;
    --gray-300: #d0d5dd;
    --gray-400: #98a2b3;
    --gray-500: #667085;
    --gray-600: #475467;
    --gray-700: #344054;
    --gray-800: #1d2939;
    --gray-900: #101828;
    --white: #ffffff;
    --shadow-xs: 0 1px 2px rgba(16,24,40,0.06);
    --shadow-sm: 0 1px 3px rgba(16,24,40,0.1);
    --shadow-md: 0 4px 16px rgba(16,24,40,0.1);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --transition: all 0.22s ease;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

html { scroll-behavior: smooth; font-size: 15px; -webkit-tap-highlight-color: transparent; }

body {
    font-family: var(--font);
    line-height: 1.5;
    color: var(--gray-900);
    background: var(--gray-50);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container { max-width: 820px; margin: 0 auto; padding: 0 16px; }

/* ===== HEADER ===== */
.site-header {
    background: var(--primary);
    color: var(--white);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 12px rgba(0,0,0,0.2);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--white);
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: -0.3px;
}

.logo-icon { font-size: 1.4rem; }
.logo-text span { color: #60a5fa; }

.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px 8px;
}

.nav-list { display: flex; list-style: none; gap: 2px; }

.nav-list a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    font-size: 0.875rem;
    font-weight: 500;
}

.nav-list a:hover { background: rgba(255,255,255,0.12); color: var(--white); }

/* ===== HERO (Homepage) ===== */
.hero {
    background: linear-gradient(160deg, var(--primary-dark) 0%, var(--primary-light) 100%);
    color: var(--white);
    padding: 48px 0 44px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.hero h1 {
    font-size: 1.9rem;
    font-weight: 800;
    margin-bottom: 10px;
    position: relative;
    letter-spacing: -0.5px;
}

.hero p {
    font-size: 1rem;
    opacity: 0.85;
    max-width: 500px;
    margin: 0 auto 28px;
    position: relative;
}

.search-form { max-width: 500px; margin: 0 auto; position: relative; }

.search-box {
    display: flex;
    background: var(--white);
    border-radius: 50px;
    overflow: hidden;
    box-shadow: 0 6px 24px rgba(0,0,0,0.22);
}

.search-box input {
    flex: 1;
    border: none;
    padding: 14px 22px;
    font-size: 0.95rem;
    outline: none;
    color: var(--gray-900);
    font-family: var(--font);
}

.search-box input::placeholder { color: var(--gray-400); }

.search-box button {
    background: var(--accent);
    color: var(--white);
    border: none;
    padding: 14px 28px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    font-family: var(--font);
    letter-spacing: 0.2px;
}

.search-box button:hover { background: var(--primary); }
.search-hint { margin-top: 10px; font-size: 0.78rem; opacity: 0.65; }

/* ===== SECTION ===== */
.section { padding: 40px 0; }
.section-title { font-size: 1.35rem; font-weight: 700; color: var(--primary); margin-bottom: 6px; text-align: center; }
.section-subtitle { text-align: center; color: var(--gray-500); margin-bottom: 28px; max-width: 560px; margin-left: auto; margin-right: auto; font-size: 0.9rem; }
.section-white { background: var(--white); }
.section-gray { background: var(--gray-50); }

.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }

.feature-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: 24px 20px;
    text-align: center;
    transition: var(--transition);
}

.feature-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--accent-light); }
.feature-card .icon { font-size: 2rem; margin-bottom: 12px; }
.feature-card h3 { font-size: 0.95rem; color: var(--primary); margin-bottom: 5px; font-weight: 600; }
.feature-card p { font-size: 0.82rem; color: var(--gray-500); }

/* ============================================
   TRAIN RESULT — APP-LIKE HEADER
   ============================================ */

/* ---- Top Nav Bar (like "Train Tickets | Bus Tickets | Food on Train") ---- */
.site-nav-tabs {
    background: var(--primary);
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    overflow-x: auto;
    scrollbar-width: none;
}

.site-nav-tabs::-webkit-scrollbar { display: none; }

.site-nav-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 18px;
    color: rgba(255,255,255,0.75);
    font-size: 0.72rem;
    font-weight: 600;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
    white-space: nowrap;
    cursor: pointer;
    letter-spacing: 0.2px;
}

.site-nav-tab .tab-icon { font-size: 1.25rem; }

.site-nav-tab.active,
.site-nav-tab:hover {
    color: var(--white);
    border-bottom-color: var(--white);
}

/* ---- Train Info Header ---- */
.train-info-header {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    padding: 14px 0 0;
    position: sticky;
    top: 52px;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.train-info-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding-bottom: 12px;
}

.train-title h1 {
    font-size: 1rem;
    font-weight: 800;
    color: var(--gray-900);
    line-height: 1.3;
    letter-spacing: -0.2px;
}

.train-title .sub {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 2px;
}

.date-selector {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--white);
    border: 1px solid var(--gray-300);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    color: var(--gray-700);
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: var(--shadow-xs);
}

/* Sub-tabs: Train Status | Time table */
.train-sub-tabs {
    display: flex;
    gap: 0;
    border-top: 1px solid var(--gray-200);
}

.train-sub-tab {
    padding: 10px 18px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--gray-500);
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.train-sub-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* ---- Action Bar ---- */
.action-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0 4px;
}

.action-bar .search-box {
    flex: 1;
    max-width: none;
    box-shadow: none;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
}

.action-bar .search-box input { padding: 9px 16px; font-size: 0.85rem; }
.action-bar .search-box button { padding: 9px 18px; font-size: 0.82rem; border-radius: 0 8px 8px 0; }

.refresh-btn {
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    color: var(--gray-600);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    transition: var(--transition);
    flex-shrink: 0;
}

.refresh-btn:hover { background: var(--gray-200); }
.refresh-btn.spinning .refresh-icon { animation: spin 0.8s linear infinite; }

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ---- Train Animation Bar ---- */
.train-animation-bar {
    background: linear-gradient(180deg, var(--primary-dark) 0%, #1a237e 100%);
    padding: 0;
    overflow: hidden;
    position: relative;
    height: 68px;
}

.train-animation-bar::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 18px;
    background: repeating-linear-gradient(
        90deg,
        rgba(255,255,255,0.07) 0px, rgba(255,255,255,0.07) 6px,
        transparent 6px, transparent 20px
    );
}

.train-animation-bar::after {
    content: '';
    position: absolute;
    bottom: 18px;
    left: 0;
    right: 0;
    height: 2px;
    background: repeating-linear-gradient(
        90deg,
        rgba(255,255,255,0.22) 0px, rgba(255,255,255,0.22) 4px,
        transparent 4px, transparent 14px
    );
    animation: trackMove 0.8s linear infinite;
}

@keyframes trackMove {
    0% { transform: translateX(0); }
    100% { transform: translateX(-18px); }
}

.train-container-scene {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.train-whole {
    position: absolute;
    bottom: 18px;
    display: flex;
    align-items: flex-end;
    animation: trainJourney 8s linear infinite;
    z-index: 2;
}

.train-whole.slow { animation-duration: 12s; }
.train-whole.fast { animation-duration: 5s; }

@keyframes trainJourney {
    0% { transform: translateX(-320px); }
    100% { transform: translateX(calc(100vw + 120px)); }
}

.train-engine {
    position: relative;
    width: 48px;
    height: 26px;
    background: linear-gradient(135deg, #ff6f00, #ff8f00);
    border-radius: 4px 8px 0 0;
    flex-shrink: 0;
}

.train-engine::before {
    content: '';
    position: absolute;
    top: -10px; left: 4px;
    width: 16px; height: 11px;
    background: #ff8f00;
    border-radius: 3px 3px 0 0;
}

.train-engine::after {
    content: '';
    position: absolute;
    top: -6px; left: 22px;
    width: 8px; height: 8px;
    background: #ffe082;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(255,224,130,0.7);
    animation: headlight 1s ease-in-out infinite alternate;
}

@keyframes headlight {
    0% { box-shadow: 0 0 4px rgba(255,224,130,0.3); }
    100% { box-shadow: 0 0 14px rgba(255,224,130,0.95); }
}

.train-engine .wheel {
    position: absolute;
    bottom: -4px;
    width: 8px; height: 8px;
    background: #37474f;
    border-radius: 50%;
    border: 1px solid #546e7a;
    animation: wheelSpin 0.6s linear infinite;
}

.train-engine .wheel:nth-child(1) { left: 6px; }
.train-engine .wheel:nth-child(2) { left: 20px; }
.train-engine .wheel:nth-child(3) { left: 34px; }

@keyframes wheelSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.train-coach {
    position: relative;
    width: 36px; height: 20px;
    background: linear-gradient(180deg, #e8eaf6, #c5cae9);
    border-radius: 0 0 3px 3px;
    border-top: 2px solid #9fa8da;
    flex-shrink: 0;
}

.train-coach::before {
    content: '';
    position: absolute;
    top: 3px; left: 4px; right: 4px;
    height: 7px;
    background: repeating-linear-gradient(
        90deg,
        #90caf9 0px, #90caf9 5px,
        transparent 5px, transparent 9px
    );
    border-radius: 1px;
    opacity: 0.6;
}

.train-coach .wheel {
    position: absolute;
    bottom: -3px;
    width: 6px; height: 6px;
    background: #37474f;
    border-radius: 50%;
    border: 1px solid #546e7a;
    animation: wheelSpin 0.6s linear infinite;
}

.train-coach .wheel:nth-child(2) { left: 4px; }
.train-coach .wheel:nth-child(3) { left: 14px; }
.train-coach .wheel:nth-child(4) { left: 26px; }

.train-connector {
    width: 4px; height: 3px;
    background: #78909c;
    flex-shrink: 0;
    margin-bottom: 2px;
}

.train-smoke {
    position: absolute;
    top: -14px; left: 6px;
    display: flex;
    gap: 2px;
}

.train-smoke span {
    display: block;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    animation: smokeFloat 0.9s ease-out infinite;
}

.train-smoke span:nth-child(1) { width: 4px; height: 4px; animation-delay: 0s; }
.train-smoke span:nth-child(2) { width: 5px; height: 5px; animation-delay: 0.15s; }
.train-smoke span:nth-child(3) { width: 6px; height: 6px; animation-delay: 0.3s; }
.train-smoke span:nth-child(4) { width: 4px; height: 4px; animation-delay: 0.45s; }

@keyframes smokeFloat {
    0% { transform: translateY(0) scale(1); opacity: 0.5; }
    100% { transform: translateY(-18px) scale(0.3); opacity: 0; }
}

.train-direction-label {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.62rem;
    color: rgba(255,255,255,0.6);
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(0,0,0,0.3);
    padding: 3px 10px;
    border-radius: 20px;
    backdrop-filter: blur(4px);
}

.train-direction-label span { font-weight: 600; color: rgba(255,255,255,0.85); }

.train-animation-bar .bg-dots {
    position: absolute;
    top: 6px; left: 0; right: 0;
    display: flex;
    justify-content: space-around;
    opacity: 0.15;
}

.train-animation-bar .bg-dots span {
    width: 2px; height: 2px;
    background: var(--white);
    border-radius: 50%;
}

.speed-line {
    position: absolute;
    top: 30%;
    width: 40px; height: 1px;
    background: rgba(255,255,255,0.06);
    animation: speedLine 1.2s linear infinite;
}

.speed-line:nth-child(1) { left: 5%; animation-delay: 0s; }
.speed-line:nth-child(2) { left: 25%; animation-delay: 0.3s; }
.speed-line:nth-child(3) { left: 50%; animation-delay: 0.6s; }
.speed-line:nth-child(4) { left: 75%; animation-delay: 0.9s; }

@keyframes speedLine {
    0% { transform: translateX(0); opacity: 0.06; }
    100% { transform: translateX(-80px); opacity: 0; }
}

/* ============================================
   JOURNEY PROGRESS & SUMMARY
   ============================================ */

.journey-progress {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    margin: 14px 0;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}

.journey-progress .progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.journey-progress .progress-label {
    font-size: 0.72rem;
    color: var(--gray-500);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.journey-progress .progress-pct {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--accent);
}

.progress-bar-track {
    width: 100%;
    height: 5px;
    background: var(--gray-200);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-light), var(--accent));
    border-radius: 3px;
    transition: width 0.6s ease;
}

.progress-stations {
    display: flex;
    justify-content: space-between;
    margin-top: 5px;
    font-size: 0.65rem;
    color: var(--gray-400);
}

/* Summary Cards */
.summary-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 8px;
    margin: 14px 0;
}

.summary-card {
    background: var(--white);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    box-shadow: var(--shadow-xs);
    border: 1px solid var(--gray-200);
    text-align: center;
}

.summary-card .label {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-400);
    margin-bottom: 3px;
    font-weight: 600;
}

.summary-card .value {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--primary);
}

.summary-card .value.delayed { color: var(--danger); }
.summary-card .value.ontime { color: var(--success); }
.summary-card .value.small { font-size: 0.72rem; }

/* ============================================
   LIVE STATUS CARD
   ============================================ */
.live-status-card {
    background: linear-gradient(135deg, #0f2347 0%, #1a3a6e 100%);
    color: var(--white);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    margin: 12px 0;
    box-shadow: 0 4px 18px rgba(15,35,71,0.25);
    display: flex;
    align-items: center;
    gap: 14px;
}

.live-status-card .pulse-dot {
    width: 11px; height: 11px;
    background: #22c55e;
    border-radius: 50%;
    flex-shrink: 0;
    position: relative;
}

.live-status-card .pulse-dot::before {
    content: '';
    position: absolute;
    width: 20px; height: 20px;
    background: rgba(34,197,94,0.25);
    border-radius: 50%;
    top: -4.5px; left: -4.5px;
    animation: pulseRing 1.5s ease-in-out infinite;
}

@keyframes pulseRing {
    0% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.6); opacity: 0.1; }
    100% { transform: scale(1); opacity: 0.6; }
}

.live-status-card .status-text { flex: 1; }

.live-status-card .status-main {
    font-size: 0.88rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.live-status-card .status-sub {
    font-size: 0.72rem;
    opacity: 0.7;
}

/* ============================================
   COLUMN HEADER ROW (Arrival | Station | Departure)
   ============================================ */
.timeline-header {
    display: flex;
    align-items: center;
    background: var(--primary);
    color: var(--white);
    border-radius: var(--radius-sm);
    padding: 8px 0;
    margin: 14px 0 0;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.timeline-header .th-arrival { width: 66px; flex-shrink: 0; text-align: center; }
.timeline-header .th-station { flex: 1; text-align: center; }
.timeline-header .th-departure { width: 66px; flex-shrink: 0; text-align: center; }
.timeline-header .th-marker { width: 22px; flex-shrink: 0; }

/* ============================================
   VERTICAL TIMELINE — NTES Style
   ============================================ */
.timeline-container { padding: 0 0 24px; }

.timeline-item {
    display: flex;
    align-items: stretch;
    position: relative;
    min-height: 74px;
    border-bottom: 1px solid var(--gray-100);
}

/* Times column */
.timeline-times {
    width: 66px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2px;
    padding: 8px 6px;
    background: var(--white);
}

.timeline-times .sch-time {
    font-size: 0.78rem;
    color: var(--gray-700);
    font-weight: 600;
    font-family: var(--font-mono);
}

.timeline-times .act-time {
    font-size: 0.72rem;
    color: var(--danger);
    font-weight: 600;
    font-family: var(--font-mono);
}

/* Center Marker */
.timeline-marker {
    width: 22px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    background: var(--white);
}

.timeline-line {
    position: absolute;
    top: 0; bottom: 0;
    left: 50%;
    width: 2px;
    background: var(--gray-300);
    transform: translateX(-50%);
}

.timeline-item:first-child .timeline-line { top: 37px; }
.timeline-item:last-child .timeline-line { bottom: auto; height: 37px; }

.timeline-dot {
    width: 11px; height: 11px;
    border-radius: 50%;
    background: var(--gray-300);
    border: 2px solid var(--white);
    z-index: 2;
    margin-top: 18px;
    position: relative;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px var(--gray-300);
}

/* Passed */
.timeline-item.passed .timeline-dot {
    background: #60a5fa;
    box-shadow: 0 0 0 2px #93c5fd;
}

.timeline-item.passed .timeline-line { background: #93c5fd; }
.timeline-item.passed .timeline-card-inner { background: var(--gray-50); }
.timeline-item.passed .station-code { color: var(--gray-500); }
.timeline-item.passed .station-name { color: var(--gray-400); }

/* Current (LIVE) */
.timeline-item.current .timeline-dot {
    width: 17px; height: 17px;
    background: var(--accent);
    box-shadow: 0 0 0 4px rgba(37,99,235,0.2);
    margin-top: 15px;
    animation: currentPulse 2s ease-in-out infinite;
}

@keyframes currentPulse {
    0% { box-shadow: 0 0 0 3px rgba(37,99,235,0.2); }
    50% { box-shadow: 0 0 0 9px rgba(37,99,235,0.06); }
    100% { box-shadow: 0 0 0 3px rgba(37,99,235,0.2); }
}

.timeline-item.current .timeline-line { background: #93c5fd; }

.timeline-item.current .timeline-card-inner {
    background: #eff6ff;
    border-left: 3px solid var(--accent);
}

/* Next Stop */
.timeline-item.next-stop .timeline-dot {
    background: var(--warning);
    box-shadow: 0 0 0 3px rgba(217,119,6,0.2);
}

.timeline-item.next-stop .timeline-card-inner {
    background: var(--yellow-bg);
    border-left: 3px solid var(--yellow-border);
}

/* Upcoming */
.timeline-item.upcoming .timeline-dot {
    background: var(--white);
    border: 2px solid var(--gray-300);
    box-shadow: 0 0 0 2px var(--gray-200);
}

.timeline-item.upcoming .timeline-line { background: var(--gray-200); }

/* Station Card (right side) */
.timeline-card {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: stretch;
}

.timeline-card-inner {
    flex: 1;
    background: var(--white);
    padding: 10px 12px;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Departure times column (right) */
.timeline-dep-times {
    width: 66px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2px;
    padding: 8px 6px;
    background: var(--white);
    border-left: 1px dashed var(--gray-200);
}

.timeline-dep-times .sch-time {
    font-size: 0.78rem;
    color: var(--gray-700);
    font-weight: 600;
    font-family: var(--font-mono);
}

.timeline-dep-times .act-time {
    font-size: 0.72rem;
    color: var(--danger);
    font-weight: 600;
    font-family: var(--font-mono);
}

/* LIVE label */
.station-live-label {
    display: none;
    align-items: center;
    gap: 4px;
    background: var(--accent);
    color: var(--white);
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 7px;
    border-radius: 3px;
    margin-bottom: 5px;
    width: fit-content;
}

.station-live-label::before {
    content: '';
    width: 5px; height: 5px;
    background: var(--white);
    border-radius: 50%;
    animation: pulseRing 1.5s ease-in-out infinite;
}

.timeline-item.current .station-live-label { display: inline-flex; }
.timeline-item:not(.current) .station-live-label { display: none; }

/* Next Stop label */
.next-stop-label {
    display: none;
    align-items: center;
    gap: 3px;
    background: var(--warning);
    color: var(--white);
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 7px;
    border-radius: 3px;
    margin-bottom: 5px;
    width: fit-content;
}

.timeline-item.next-stop .next-stop-label { display: inline-flex; }
.timeline-item:not(.next-stop) .next-stop-label { display: none; }

/* Station info */
.timeline-card-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
}

.timeline-card-left { flex: 1; min-width: 0; }

.station-code {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.2;
    letter-spacing: -0.2px;
}

.station-name {
    font-size: 0.75rem;
    color: var(--gray-600);
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.station-index {
    font-size: 0.63rem;
    color: var(--gray-400);
    font-weight: 400;
}

.timeline-card-right { text-align: right; flex-shrink: 0; }

.station-distance {
    font-size: 0.72rem;
    color: var(--gray-500);
    font-weight: 500;
}

.station-platform {
    display: inline-block;
    font-size: 0.62rem;
    font-weight: 700;
    color: var(--accent);
    background: var(--accent-soft);
    padding: 1px 6px;
    border-radius: 3px;
    margin-top: 3px;
}

/* Delay badge row */
.timeline-card-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 5px;
}

.station-delay {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 3px;
}

.station-delay.ontime {
    color: var(--success);
    background: #f0fdf4;
}

.station-delay.late {
    color: var(--danger);
    background: var(--danger-bg);
}

.station-delay.here {
    color: var(--accent);
    background: var(--accent-soft);
}

/* Schd / Actual times inside card */
.station-times {
    display: flex;
    gap: 10px;
    font-size: 0.68rem;
}

.station-times .label { color: var(--gray-400); }
.station-times .sch { color: var(--gray-600); font-weight: 500; }
.station-times .act { color: var(--gray-400); }
.station-times .act.delayed { color: var(--danger); font-weight: 700; }

/* ===== AD PLACEHOLDER ===== */
.ad-placeholder {
    text-align: center;
    padding: 14px;
    margin: 14px 0;
    background: var(--gray-100);
    border: 1px dashed var(--gray-300);
    border-radius: var(--radius-sm);
    min-height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-400);
    font-size: 0.75rem;
}

/* ===== STATIC PAGES ===== */
.page-content {
    max-width: 760px;
    margin: 32px auto;
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 32px 36px;
    box-shadow: var(--shadow-sm);
}

.page-content h1 { font-size: 1.5rem; color: var(--primary); margin-bottom: 14px; }
.page-content h2 { font-size: 1.15rem; color: var(--primary); margin: 18px 0 8px; }
.page-content p, .page-content li { color: var(--gray-600); line-height: 1.7; margin-bottom: 10px; font-size: 0.92rem; }
.page-content ul, .page-content ol { padding-left: 22px; margin-bottom: 14px; }

/* ===== CONTACT FORM ===== */
.contact-form { max-width: 560px; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 5px; color: var(--gray-700); font-size: 0.875rem; }
.form-group input, .form-group textarea, .form-group select {
    width: 100%; padding: 10px 14px;
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    transition: var(--transition);
    font-family: var(--font);
}
.form-group input:focus, .form-group textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.form-group textarea { min-height: 100px; resize: vertical; }

.btn {
    display: inline-block;
    padding: 10px 26px;
    background: var(--accent);
    color: var(--white);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font);
}
.btn:hover { background: var(--primary); transform: translateY(-1px); }

/* ===== ERROR PAGE ===== */
.error-page { text-align: center; padding: 48px 20px; }
.error-page h1 { font-size: 2.5rem; color: var(--gray-300); margin-bottom: 8px; }
.error-page p { color: var(--gray-500); margin-bottom: 20px; }
.search-again { max-width: 400px; margin: 0 auto; }

/* ===== FOOTER ===== */
.site-footer {
    background: var(--gray-900);
    color: rgba(255,255,255,0.75);
    padding: 32px 0 0;
    margin-top: auto;
}

.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 24px; margin-bottom: 24px; }

.footer-col h3 {
    font-size: 0.85rem;
    color: var(--white);
    margin-bottom: 12px;
    position: relative;
    padding-bottom: 6px;
    font-weight: 700;
}

.footer-col h3::after { content: ''; position: absolute; bottom: 0; left: 0; width: 24px; height: 2px; background: var(--accent-light); }
.footer-col p { font-size: 0.8rem; line-height: 1.6; margin-bottom: 5px; }

.footer-links { list-style: none; }
.footer-links a { color: rgba(255,255,255,0.55); text-decoration: none; font-size: 0.8rem; padding: 3px 0; display: block; transition: var(--transition); }
.footer-links a:hover { color: var(--white); padding-left: 3px; }

.footer-bottom { border-top: 1px solid rgba(255,255,255,0.07); padding: 16px 0; text-align: center; }
.footer-bottom p { font-size: 0.72rem; opacity: 0.55; margin-bottom: 2px; }
.disclaimer-text { font-style: italic; font-size: 0.68rem; opacity: 0.35; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .container { padding: 0 10px; }
    .hero { padding: 32px 0 28px; }
    .hero h1 { font-size: 1.4rem; }
    .hero p { font-size: 0.85rem; margin-bottom: 20px; }
    .search-box input { padding: 12px 18px; }
    .search-box button { padding: 12px 20px; }

    .train-info-header { top: 46px; }
    .train-title h1 { font-size: 0.9rem; }
    .date-selector { font-size: 0.72rem; padding: 5px 10px; }

    .timeline-times { width: 54px; }
    .timeline-dep-times { width: 54px; }
    .timeline-marker { width: 20px; }
    .timeline-dot { width: 10px; height: 10px; margin-top: 20px; }
    .timeline-item.current .timeline-dot { width: 15px; height: 15px; margin-top: 17px; }
    .station-code { font-size: 0.82rem; }
    .station-name { font-size: 0.7rem; }
    .summary-row { grid-template-columns: repeat(3, 1fr); }
    .timeline-header .th-arrival, .timeline-header .th-departure { width: 54px; }
    .timeline-header .th-marker { width: 20px; }
    .page-content { padding: 22px 18px; margin: 16px 6px; }
    .features-grid { grid-template-columns: 1fr; }

    .nav-list {
        display: none;
        position: absolute;
        top: 100%; left: 0; right: 0;
        background: var(--primary);
        flex-direction: column;
        padding: 8px 16px;
        box-shadow: var(--shadow-md);
    }
    .nav-list.open { display: flex; }
    .nav-toggle { display: block; }
    .header-inner { position: relative; padding: 8px 0; }
    .logo { font-size: 1.05rem; }
}

@media (max-width: 480px) {
    .timeline-times { width: 48px; }
    .timeline-dep-times { width: 48px; }
    .timeline-times .sch-time, .timeline-dep-times .sch-time { font-size: 0.68rem; }
    .timeline-times .act-time, .timeline-dep-times .act-time { font-size: 0.62rem; }
    .timeline-header .th-arrival, .timeline-header .th-departure { width: 48px; }
    .timeline-card-inner { padding: 8px 8px; }
    .summary-row { grid-template-columns: repeat(2, 1fr); }
    .live-status-card .status-main { font-size: 0.82rem; }
    .action-bar { flex-wrap: wrap; }
    .train-sub-tab { padding: 9px 14px; font-size: 0.78rem; }
}