:root {
    --primary: #0f172a;
    /* Slate 900 - Deep Navy */
    --primary-light: #1e293b;
    /* Slate 800 */
    --accent: #2563eb;
    /* Blue 600 - Dynamic Blue */
    --accent-hover: #1d4ed8;
    /* Blue 700 */
    --secondary: #f8fafc;
    /* Slate 50 - Background */
    --text-main: #334155;
    /* Slate 700 - Main Text */
    --text-muted: #64748b;
    /* Slate 500 */
    --white: #ffffff;
    --border: #e2e8f0;
    /* Slate 200 */

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --radius-md: 0.5rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
}

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

body {
    font-family: 'Noto Sans JP', sans-serif;
    background-color: var(--secondary);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
    color: var(--primary);
    line-height: 1.2;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

/* Utilities */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.highlight {
    color: var(--accent);
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: var(--white);
    padding: 0.75rem 1.5rem;
    border-radius: 9999px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: var(--transition);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 14px 0 rgba(37, 99, 235, 0.39);
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.23);
}

.btn-primary.wide {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
    border-radius: var(--radius-lg);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--white);
    color: var(--text-main);
    padding: 0.75rem 1.5rem;
    border-radius: 9999px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: var(--transition);
    border: 1px solid var(--border);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background: #f1f5f9;
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary.wide {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
    border-radius: var(--radius-lg);
}

/* Navbar */
.navbar {
    background: rgba(10, 15, 36, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 198, 255, 0.3);
    position: sticky;
    top: 0;
    z-index: 50;
    padding: 1rem 0;
    box-shadow: 0 4px 20px rgba(0, 198, 255, 0.15);
}

.navbar-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-contact {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-banner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: var(--white);
    padding: 0.6rem 1.25rem;
    border-radius: 9999px;
    font-weight: 700;
    font-size: 0.95rem;
    transition: var(--transition);
    border: none;
    box-shadow: 0 4px 14px 0 rgba(37, 99, 235, 0.39);
}

.btn-banner:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.5);
    background: var(--accent-hover);
    color: var(--white);
}

.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ef4444;
    /* red-500 */
    color: var(--white);
    padding: 0.75rem 1.5rem;
    border-radius: 9999px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: var(--transition);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 14px 0 rgba(239, 68, 68, 0.39);
}

.btn-danger:hover {
    background: #dc2626;
    /* red-600 */
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.23);
}

.btn-danger.wide {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
    border-radius: var(--radius-lg);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--white);
}

.logo i {
    font-size: 1.8rem;
    color: #00c6ff;
    text-shadow: 0 0 10px #00c6ff, 0 0 20px #00c6ff;
}

.logo-title {
    display: block;
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: #fff;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.8), 0 0 10px #00c6ff, 0 0 20px #00c6ff;
}

.wakey-blue {
    color: #00c6ff;
    text-shadow: 0 0 5px #00c6ff, 0 0 10px #00c6ff, 0 0 20px #0072ff;
}

.logo-subtitle {
    display: block;
    font-size: 0.8rem;
    color: #e0e6ed;
    text-shadow: 0 0 5px rgba(0, 198, 255, 0.8);
}

/* Hero Section */
.hero {
    position: relative;
    padding: 6rem 0;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: var(--white);
    overflow: hidden;
}

.hero::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: url('data:image/svg+xml;utf8,<svg width="40" height="40" viewBox="0 0 40 40" xmlns="http://www.w3.org/2000/svg"><circle cx="20" cy="20" r="1" fill="rgba(255,255,255,0.05)"/></svg>') repeat;
    pointer-events: none;
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--white);
}

.hero-desc {
    font-size: 1.1rem;
    color: #cbd5e1;
    max-width: 600px;
    margin: 0 auto;
}

/* Main Layout */
.main-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
    padding-top: 3rem;
    padding-bottom: 4rem;
    align-items: start;
}

/* Line Selector */
.line-selector {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 100px;
    /* Offset for navbar */
}

.sidebar-title {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border);
}

.line-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 0.5rem;
}

/* Custom Scrollbar */
.line-list::-webkit-scrollbar {
    width: 6px;
}

.line-list::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.line-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.line-item {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: var(--transition);
}

.line-item:hover {
    background: #f1f5f9;
    color: var(--primary);
}

.line-item.active {
    background: #eff6ff;
    color: var(--accent);
    box-shadow: inset 3px 0 0 var(--accent);
}

/* Stations Display */
.display-header {
    margin-bottom: 2rem;
}

.current-line-title {
    font-size: 1.8rem;
    margin-bottom: 0.25rem;
}

.current-line-desc {
    color: var(--text-muted);
}

.station-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* Station Card */
.station-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.station-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.station-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
    border-color: transparent;
}

.station-card:hover::before {
    transform: scaleX(1);
}

.station-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.station-name {
    font-size: 1.4rem;
    font-weight: 700;
}

.station-time {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #eff6ff;
    color: var(--accent);
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 600;
}

.station-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.station-meta p {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.station-meta i {
    width: 16px;
    text-align: center;
    opacity: 0.7;
}

/* Loader */
.loader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 0;
    color: var(--text-muted);
    display: none;
    /* hidden by default */
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e2e8f0;
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    transform: scale(0.95) translateY(20px);
    transition: transform 0.3s ease;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
}

.modal-overlay.active .modal-content {
    transform: scale(1) translateY(0);
}

.modal-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: #f1f5f9;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1.2rem;
    transition: var(--transition);
    z-index: 10;
}

.modal-close:hover {
    background: #e2e8f0;
    color: var(--primary);
    transform: rotate(90deg);
}

.modal-header {
    padding: 2.5rem 2.5rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(to right, #f8fafc, #ffffff);
}

.modal-station-name {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.modal-meta {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.meta-item {
    font-size: 0.95rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.meta-item i {
    color: var(--accent);
}

.modal-body {
    padding: 2.5rem;
}

.modal-desc {
    font-size: 1.05rem;
    margin-bottom: 2rem;
    color: var(--text-main);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.feature-card {
    background: var(--secondary);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.feature-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: white;
    margin-bottom: 1rem;
}

.bg-blue {
    background: #3b82f6;
}

.bg-green {
    background: #10b981;
}

.bg-orange {
    background: #f59e0b;
}

.bg-purple {
    background: #8b5cf6;
}

.feature-title {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.feature-desc {
    font-size: 0.95rem;
    color: var(--text-muted);
}

.modal-notes-container {
    background: #fffbeb;
    /* amber 50 */
    border-left: 4px solid #f59e0b;
    padding: 1rem;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    font-size: 0.9rem;
    color: #92400e;
}

.timetable-container {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-top: 2rem;
}

.timetable-header {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--primary);
}

.timetable-row {
    margin-bottom: 1rem;
}

.timetable-row:last-child {
    margin-bottom: 0;
}

.timetable-direction {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

.timetable-btn-group {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.btn-secondary.btn-sm {
    padding: 0.5rem;
    font-size: 0.85rem;
    border-radius: var(--radius-md);
}

.modal-footer {
    padding: 1.5rem 2.5rem 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

/* Footer */
.footer {
    background: var(--primary);
    color: var(--white);
    padding: 3rem 0;
    text-align: center;
    margin-top: auto;
}

.footer-logo {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.footer p {
    color: #94a3b8;
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 900px) {
    .main-layout {
        grid-template-columns: 1fr;
    }

    .navbar-container {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-contact {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

    .station-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        /* On tablets we can keep min 280px, but ensure it wraps */
    }

    .line-selector {
        position: relative;
        top: 0;
        margin-bottom: 1rem;
        padding: 1rem;
    }

    .line-list {
        flex-direction: row;
        flex-wrap: wrap;
        overflow-x: visible;
        padding-bottom: 0.5rem;
        max-height: none;
    }

    .line-list::-webkit-scrollbar {
        height: 6px;
    }

    .line-item {
        white-space: nowrap;
        background: #f1f5f9;
    }

    .line-item.active {
        box-shadow: none;
        background: var(--accent);
        color: var(--white);
        border-bottom: none;
    }
}

@media (max-width: 600px) {
    .hero-title {
        font-size: 1.8rem;
    }

    .hero-desc {
        font-size: 1rem;
    }

    .btn-banner,
    .btn-danger {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .nav-contact {
        flex-direction: column;
        gap: 0;
    }

    .modal-content {
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .station-grid {
        grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1.25rem;
    }

    .timetable-btn-group {
        grid-template-columns: 1fr;
    }

    .logo-title {
        font-size: 1.1rem;
    }
}