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

:root {
    /* Mini Motorways Color Palette */
    --primary-bg: #f0f4f8;
    --secondary-bg: #e2e8f0;
    --card-bg: #ffffff;
    --text-primary: #2d3748;
    --text-secondary: #4a5568;
    --text-muted: #718096;
    
    /* Direction-based colors */
    --southbound-primary: #22d3ee;
    --southbound-secondary: #7dd3fc;
    --southbound-accent: #0891b2;
    --northbound-primary: #f59e0b;
    --northbound-secondary: #fed7aa;
    --northbound-accent: #d97706;
    
    /* Accent colors */
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    
    /* Mini Motorways inspired elements */
    --border-radius: 16px;
    --border-radius-small: 8px;
    --shadow-soft: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-medium: 0 8px 24px rgba(0, 0, 0, 0.12);
    --shadow-large: 0 16px 40px rgba(0, 0, 0, 0.16);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--primary-bg);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
    position: relative;
    overflow-x: hidden;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Direction-based body themes */
body.direction-southbound {
    background: linear-gradient(180deg, #f0f9ff 0%, #e0f2fe 50%, #bae6fd 100%);
}

body.direction-northbound {
    background: linear-gradient(0deg, #fefbf3 0%, #fef3c7 50%, #fed7aa 100%);
}

/* Dynamic background elements */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    opacity: 0.3;
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    background-size: 60px 60px;
}

body.direction-southbound::before {
    background: 
        radial-gradient(circle at 20% 30%, var(--southbound-secondary) 2px, transparent 2px),
        radial-gradient(circle at 80% 70%, var(--southbound-primary) 1.5px, transparent 1.5px),
        radial-gradient(circle at 40% 80%, var(--southbound-accent) 1px, transparent 1px);
    animation: floatDown 8s ease-in-out infinite;
}

body.direction-northbound::before {
    background:
        radial-gradient(circle at 30% 70%, var(--northbound-secondary) 2px, transparent 2px),
        radial-gradient(circle at 70% 20%, var(--northbound-primary) 1.5px, transparent 1.5px),
        radial-gradient(circle at 50% 90%, var(--northbound-accent) 1px, transparent 1px);
    animation: floatUp 8s ease-in-out infinite;
}

@keyframes floatDown {
    0%, 100% { transform: translateY(-10px); }
    50% { transform: translateY(10px); }
}

@keyframes floatUp {
    0%, 100% { transform: translateY(10px); }
    50% { transform: translateY(-10px); }
}


.planning-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
    z-index: 1;
    background: linear-gradient(135deg, #ff7b7b 0%, #667eea 50%, #764ba2 100%);
    
    /* Diagonal stripe pattern overlay */
    background-image: 
        repeating-linear-gradient(
            45deg,
            rgba(255, 255, 255, 0.1) 0px,
            rgba(255, 255, 255, 0.1) 10px,
            rgba(255, 255, 255, 0.05) 10px,
            rgba(255, 255, 255, 0.05) 20px,
            rgba(0, 0, 0, 0.05) 20px,
            rgba(0, 0, 0, 0.05) 30px,
            rgba(255, 255, 255, 0.1) 30px,
            rgba(255, 255, 255, 0.1) 40px
        );
    
    /* Create diagonal reveal mask */
    clip-path: polygon(0 0, 0 0, 0 100%, 0 100%);
    transition: opacity 0.3s ease;
    
    /* Diagonal text overlay */
    overflow: hidden;
}

.planning-overlay.animate-in {
    animation: swipeReveal 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.planning-overlay.animate-out {
    animation: swipeHide 0.6s cubic-bezier(0.55, 0.06, 0.68, 0.19) forwards;
}

@keyframes swipeReveal {
    0% {
        clip-path: polygon(0 0, 0 0, 0 0, 0 0);
    }
    30% {
        clip-path: polygon(0 0, 30% 0, 0 30%, 0 0);
    }
    70% {
        clip-path: polygon(0 0, 70% 0, 100% 30%, 0 70%);
    }
    100% {
        clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
    }
}

@keyframes swipeHide {
    0% {
        clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
    }
    30% {
        clip-path: polygon(70% 0, 100% 0, 100% 100%, 30% 100%);
    }
    70% {
        clip-path: polygon(100% 0, 100% 0, 100% 70%, 100% 30%);
    }
    100% {
        clip-path: polygon(100% 0, 100% 0, 100% 0, 100% 0);
    }
}

body.planning-mode .planning-overlay {
    opacity: 1;
}

/* Diagonal text elements */
.diagonal-text {
    position: absolute;
    pointer-events: none;
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3em;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.diagonal-text span {
    display: block;
    margin: 0.5em 0;
}

/* Planning text - positioned in top-right area */
.diagonal-text.planning-text {
    top: 10vh;
    right: 5vw;
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.2);
    transform: rotate(45deg);
}

body.planning-mode .diagonal-text.planning-text {
    opacity: 1;
}

/* Weekend/Weekday diagonal text - positioned in bottom-left area */
.diagonal-text.schedule-text {
    bottom: 10vh;
    left: 5vw;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.15);
    transform: rotate(45deg);
}

body.planning-mode.weekend-schedule .diagonal-text.schedule-text.weekend-text {
    opacity: 1;
}

body.planning-mode.weekday-schedule .diagonal-text.schedule-text.weekday-text {
    opacity: 1;
}

/* Direction-based diagonal text - positioned in bottom-right area */
.diagonal-text.direction-text {
    bottom: 5vh;
    right: 10vw;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.08);
    transform: rotate(45deg);
    opacity: 1;
}

body.direction-southbound .diagonal-text.direction-text.south-text {
    color: rgba(34, 211, 238, 0.12);
}

body.direction-northbound .diagonal-text.direction-text.north-text {
    color: rgba(245, 158, 11, 0.12);
}

/* Always-visible ambient diagonal overlay */
.ambient-diagonal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
    opacity: 1;
}

.ambient-diagonal-overlay .diagonal-text.direction-text {
    top: 20vh;
    left: -5vw;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.04);
    transform: rotate(45deg);
    opacity: 0;
    transition: opacity 0.6s ease;
}

body.direction-southbound .ambient-diagonal-overlay .diagonal-text.direction-text.south-text {
    opacity: 1;
    color: rgba(34, 211, 238, 0.06);
}

body.direction-northbound .ambient-diagonal-overlay .diagonal-text.direction-text.north-text {
    opacity: 1;
    color: rgba(245, 158, 11, 0.06);
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 32px 24px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 2;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

body.planning-mode .container {
    /* Removed jarring scale transform - breaks pixel perfection */
}

.page-title {
    text-align: center;
    margin-bottom: 32px;
    padding-top: 32px;
    position: relative;
    z-index: 3;
}

.page-title h1 {
    font-size: 3.2rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--southbound-primary) 0%, var(--southbound-accent) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.03em;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
    margin: 0;
}

body.direction-northbound .page-title h1 {
    background: linear-gradient(135deg, var(--northbound-primary) 0%, var(--northbound-accent) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

header {
    text-align: center;
    margin-bottom: 24px;
    position: relative;
}

/* Title styles moved to .page-title h1 */

.holiday-warning {
    background: rgba(255, 193, 7, 0.95);
    border: 2px solid #ffc107;
    border-radius: 10px;
    padding: 15px 20px;
    margin: 0 20px 20px 20px;
    color: #856404;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
}

.holiday-warning h3 {
    margin: 0 0 10px 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.holiday-warning .holiday-item {
    margin: 8px 0;
    padding: 8px 0;
    border-bottom: 1px solid rgba(133, 100, 4, 0.2);
}

.holiday-warning .holiday-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.holiday-warning .no-service {
    background: rgba(220, 53, 69, 0.1);
    border-left: 4px solid #dc3545;
    padding-left: 12px;
    color: #721c24;
}

.holiday-warning .weekend-schedule {
    background: rgba(102, 126, 234, 0.1);
    border-left: 4px solid #667eea;
    padding-left: 12px;
    color: #2c3e50;
}

.subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
    font-weight: 500;
    opacity: 0.8;
    line-height: 1.4;
}

.current-time {
    font-size: 1.4rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--text-secondary) 0%, #64748b 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.01em;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    margin-top: 8px;
}

main {
    flex: 1;
    background: rgba(255, 255, 255, 0.85);
    border-radius: var(--border-radius);
    padding: 32px 28px;
    box-shadow: var(--shadow-medium);
    backdrop-filter: blur(20px);
    border: 2px solid rgba(255, 255, 255, 0.95);
    position: relative;
    overflow: visible;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
    align-items: center;
}

.direction-toggle, .mode-toggle {
    display: flex;
    background: linear-gradient(135deg, 
        rgba(226, 232, 240, 0.8) 0%, 
        rgba(241, 245, 249, 0.9) 100%);
    border-radius: 32px;
    padding: 6px;
    gap: 4px;
    box-shadow: 
        inset 0 2px 8px rgba(0, 0, 0, 0.1),
        0 4px 16px rgba(0, 0, 0, 0.08);
    justify-content: center;
    align-items: center;
    border: 2px solid rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(20px);
    /* Fixed dimensions to prevent any shifting */
    width: 280px;
    height: 50px;
    flex-shrink: 0;
    box-sizing: border-box; /* Ensure padding is included in height calculation */
}

.direction-btn, .mode-btn {
    flex: 0.35; /* Default inactive size */
    padding: 0 20px; /* Remove vertical padding to let height control it */
    border: none;
    background: transparent;
    border-radius: 22px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    color: var(--text-muted);
    letter-spacing: 0.02em;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    backdrop-filter: blur(10px);
    box-sizing: border-box;
}

.direction-btn.active, .mode-btn.active {
    flex: 0.65; /* Active button takes more space */
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.95) 0%, 
        rgba(248, 250, 252, 0.9) 100%);
    color: var(--text-primary);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    transform: scale(1.02); /* Growth only, no vertical movement */
}

.direction-btn:hover:not(.active), .mode-btn:hover:not(.active) {
    flex: 0.5; /* Equal sizing when hovering */
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.6) 0%, 
        rgba(248, 250, 252, 0.5) 100%);
    /* Removed transform to prevent text rising */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.direction-btn.active:hover, .mode-btn.active:hover {
    /* Look-only hover - no size changes to prevent funky shifting */
    box-shadow: 
        0 6px 16px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.timeline-controls {
    text-align: center;
    margin-bottom: 16px;
}

.schedule-type-controls {
    margin-top: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%; /* Ensure full width for proper centering */
}

.schedule-type-toggle {
    display: flex;
    background: linear-gradient(135deg, 
        rgba(226, 232, 240, 0.8) 0%, 
        rgba(241, 245, 249, 0.9) 100%);
    border-radius: 32px;
    padding: 6px;
    gap: 4px;
    box-shadow: 
        inset 0 2px 8px rgba(0, 0, 0, 0.1),
        0 4px 16px rgba(0, 0, 0, 0.08);
    justify-content: center;
    align-items: center;
    border: 2px solid rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(20px);
    /* Match same dimensions as other toggles */
    width: 280px;
    height: 50px;
    flex-shrink: 0;
    margin: 0 auto; /* Explicit centering */
    box-sizing: border-box; /* Ensure padding is included in height calculation */
}

.schedule-type-btn {
    flex: 0.35; /* Default inactive size */
    padding: 0 20px; /* Remove vertical padding to let height control it */
    border: none;
    background: transparent;
    border-radius: 22px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    color: var(--text-muted);
    letter-spacing: 0.02em;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    backdrop-filter: blur(10px);
    box-sizing: border-box;
}

.schedule-type-btn.active {
    flex: 0.65; /* Active button takes more space */
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.95) 0%, 
        rgba(248, 250, 252, 0.9) 100%);
    color: var(--text-primary);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    transform: scale(1.02); /* Growth only, no vertical movement */
}

.schedule-type-btn:hover:not(.active) {
    flex: 0.5; /* Equal sizing when hovering */
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.6) 0%, 
        rgba(248, 250, 252, 0.5) 100%);
    /* Removed transform to prevent text rising */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.schedule-type-btn.active:hover {
    /* Look-only hover - no size changes to prevent funky shifting */
    box-shadow: 
        0 6px 16px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.toggle-btn {
    padding: 0 20px;
    border: none;
    border-radius: 25px;
    background: linear-gradient(135deg, 
        rgba(102, 126, 234, 0.1) 0%, 
        rgba(118, 75, 162, 0.05) 100%);
    color: #667eea;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(15px);
    letter-spacing: 0.03em;
    height: 40px;
    min-width: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 
        0 2px 8px rgba(102, 126, 234, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
    border: 1.5px solid rgba(102, 126, 234, 0.3);
    box-sizing: border-box;
    position: relative;
    overflow: visible; /* Allow extensions to show */
}


.toggle-btn:hover {
    background: linear-gradient(135deg, 
        rgba(102, 126, 234, 0.2) 0%, 
        rgba(118, 75, 162, 0.15) 100%);
    color: #5a67d8;
    transform: none; /* No scaling - station concept */
    box-shadow: 
        0 4px 16px rgba(102, 126, 234, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    border: 1.5px solid rgba(102, 126, 234, 0.5);
}

.toggle-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transform: none; /* No scaling - it's a station */
    box-shadow: 
        0 6px 24px rgba(102, 126, 234, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    border: 1.5px solid rgba(102, 126, 234, 0.4);
}

.toggle-btn.active:hover {
    transform: none; /* No scaling */
    box-shadow: 
        0 8px 28px rgba(102, 126, 234, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.timeline-container {
    max-width: 600px;
    margin: 0 auto;
}

.train-item {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 24px;
    margin: 20px 0;
    border: none;
    box-shadow: 
        0 8px 24px rgba(0,0,0,0.12),
        0 4px 8px rgba(0,0,0,0.08);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: visible;
    transform: translateZ(0);
    backdrop-filter: blur(20px);
}

/* Station markers for train items */
.train-item::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--southbound-primary);
    box-shadow: 
        0 0 0 6px rgba(255, 255, 255, 0.95),
        0 4px 8px rgba(0, 0, 0, 0.15);
    z-index: 5;
    transition: all 0.3s ease;
}

body.direction-northbound .train-item::before {
    background: var(--northbound-primary);
    right: -12px;
    left: auto;
}

.train-item::after {
    content: '';
    position: absolute;
    left: -2px;
    top: 50%;
    transform: translateY(-50%);
    width: calc(100% + 4px);
    height: 8px;
    background: linear-gradient(90deg, 
        #e2e8f0 0%,
        #e2e8f0 var(--time-position, 20%),
        #22d3ee var(--time-position, 20%),
        #22d3ee calc(var(--time-position, 20%) + 5%),
        #e2e8f0 calc(var(--time-position, 20%) + 5%),
        #e2e8f0 100%);
    z-index: -1;
    opacity: 0.9;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

body.direction-northbound .train-item::after {
    background: linear-gradient(90deg, 
        #e2e8f0 0%,
        #e2e8f0 var(--time-position, 20%),
        #f59e0b var(--time-position, 20%),
        #f59e0b calc(var(--time-position, 20%) + 5%),
        #e2e8f0 calc(var(--time-position, 20%) + 5%),
        #e2e8f0 100%);
}

/* Mini Motorways style decorative elements */
.container::before {
    content: '';
    position: absolute;
    top: -20px;
    right: 20%;
    width: 40px;
    height: 40px;
    background: var(--southbound-accent);
    border-radius: 8px;
    transform: rotate(45deg);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    z-index: -1;
    animation: floatDecoration 6s ease-in-out infinite;
}

.container::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 15%;
    width: 30px;
    height: 60px;
    background: var(--northbound-accent);
    border-radius: 15px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    z-index: -1;
    animation: floatDecoration 8s ease-in-out infinite reverse;
}

body.direction-southbound .container::before {
    background: var(--southbound-accent);
}

body.direction-southbound .container::after {
    background: var(--southbound-secondary);
}

body.direction-northbound .container::before {
    background: var(--northbound-accent);
}

body.direction-northbound .container::after {
    background: var(--northbound-secondary);
}

@keyframes floatDecoration {
    0%, 100% { transform: rotate(45deg) translateY(0px); }
    50% { transform: rotate(45deg) translateY(-10px); }
}


.train-item:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 
        0 12px 32px rgba(0,0,0,0.18),
        0 8px 16px rgba(0,0,0,0.12);
}

.train-item.past {
    opacity: 0.6;
    background: #f8f9fa;
    border-left-color: #dee2e6;
}

.train-item.next {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(16, 185, 129, 0.05) 100%);
    border: 3px solid var(--success);
    animation: nextTrainPulse 2s ease-in-out infinite;
}

.train-item.next::before {
    background: var(--success) !important;
    animation: stationPulse 2s ease-in-out infinite;
}

@keyframes nextTrainPulse {
    0%, 100% { box-shadow: 0 8px 24px rgba(0,0,0,0.12), 0 0 0 0 rgba(16, 185, 129, 0.4); }
    50% { box-shadow: 0 12px 32px rgba(0,0,0,0.18), 0 0 0 8px rgba(16, 185, 129, 0); }
}

@keyframes stationPulse {
    0%, 100% { transform: translateY(-50%) scale(1); }
    50% { transform: translateY(-50%) scale(1.3); }
}

.train-item.upcoming {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.12) 0%, rgba(118, 75, 162, 0.06) 100%);
    border: 2px solid rgba(102, 126, 234, 0.3);
}

.train-item.imminent {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2) 0%, rgba(245, 158, 11, 0.1) 100%);
    border: 3px solid var(--warning);
    animation: imminentPulse 1s ease-in-out infinite;
}

@keyframes imminentPulse {
    0%, 100% { transform: scale(1); border-color: var(--warning); }
    50% { transform: scale(1.03); border-color: #ff8c00; }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

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

.departure-time {
    font-size: 2.2rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--southbound-primary) 0%, var(--southbound-accent) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    letter-spacing: -0.02em;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

body.direction-northbound .departure-time {
    background: linear-gradient(135deg, var(--northbound-primary) 0%, var(--northbound-accent) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.countdown {
    font-size: 1.1rem;
    font-weight: 700;
    padding: 8px 16px;
    border-radius: 20px;
    background: #f8f9fa;
    color: #666;
    border: 2px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    letter-spacing: 0.02em;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.countdown.imminent {
    background: linear-gradient(135deg, #ffc107 0%, #f59e0b 100%);
    color: #000;
    border: 2px solid rgba(255, 193, 7, 0.3);
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.3);
}

.countdown.next {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: 2px solid rgba(40, 167, 69, 0.3);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.countdown.upcoming {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: 2px solid rgba(102, 126, 234, 0.3);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.countdown.planning {
    background: linear-gradient(135deg, var(--text-secondary) 0%, #64748b 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 1.1rem;
    font-weight: 700;
    padding: 0;
    border: none;
    border-radius: 0;
    backdrop-filter: none;
    letter-spacing: 0.02em;
    box-shadow: none;
    opacity: 0.9;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

.train-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1rem;
    color: #666;
    flex-wrap: wrap;
    gap: 12px;
}

.arrival-info {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex-shrink: 0;
}

.arrival-time {
    font-size: 1.6rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.01em;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    margin-left: 4px;
}

.route-info {
    font-size: 0.9rem;
    color: #888;
    text-align: right;
    min-width: 0;
    flex-shrink: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

footer {
    text-align: center;
    margin-top: 20px;
    color: rgba(255,255,255,0.8);
}

.note {
    font-size: 0.9rem;
    font-style: italic;
}

@media (max-width: 600px) {
    .container {
        padding: 10px;
    }

    header h1 {
        font-size: 2rem;
    }

    main {
        padding: 20px;
    }

    .time-grid {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
        gap: 6px;
    }

    .time-item {
        padding: 6px 8px;
        font-size: 0.8rem;
    }

    .direction-btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }

    .train-item {
        padding: 20px 18px;
    }

    .train-header {
        margin-bottom: 12px;
        gap: 12px;
    }

    .departure-time {
        font-size: 1.8rem;
    }

    .countdown {
        font-size: 0.95rem;
        padding: 6px 12px;
        min-width: auto;
        white-space: nowrap;
    }

    .train-details {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding-top: 16px;
    }

    .arrival-info {
        justify-content: flex-start;
        gap: 6px;
    }

    .arrival-time {
        font-size: 1.4rem;
    }

    .route-info {
        text-align: left;
        font-size: 0.85rem;
        white-space: normal;
        overflow: visible;
        text-overflow: initial;
    }
}