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

.hidden {
    display: none !important;
}

:root {
    --line-color: #003087;  /* Default blue, overridden dynamically */
    --line-color-light: rgba(0, 48, 135, 0.2);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #1a1a1a;
    color: #ffffff;
}

.app-container {
    max-width: 100%;
    margin: 0 auto;
}

header {
    background: linear-gradient(135deg, #003087 0%, #0019a8 100%);
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    gap: 20px;
    flex-wrap: wrap;
}

header h1 {
    font-size: 1.8em;
    font-weight: 600;
    flex-shrink: 0;
    margin: 0;
}

.home-link {
    color: #ffffff;
    text-decoration: none;
    transition: color 0.3s;
}

.home-link:hover {
    color: #ffd700;
}

.header-controls {
    display: flex;
    gap: 20px;
    align-items: center;
    flex: 1;
    justify-content: center;
}

.selector-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.selector-group label {
    font-size: 0.95em;
    font-weight: 600;
    color: #ffffff;
    white-space: nowrap;
}

.selector-group select {
    padding: 8px 12px;
    font-size: 0.95em;
    border-radius: 5px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    cursor: pointer;
    min-width: 200px;
    transition: all 0.3s;
}

.selector-group select:focus {
    outline: none;
    border-color: #ffd700;
    background-color: rgba(255, 255, 255, 0.15);
}

.selector-group select option {
    background-color: #1a1a1a;
    color: #ffffff;
}

.selector-group select optgroup {
    font-weight: bold;
    color: #ffd700;
    background-color: #1a1a1a;
}

.progress {
    display: flex;
    gap: 20px;
    align-items: center;
}

.progress span {
    font-size: 1.1em;
}

#book-count {
    font-weight: bold;
    color: #ffd700;
}

#view-progress-btn {
    padding: 10px 20px;
    background-color: #ffd700;
    color: #003087;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    transition: all 0.3s;
}

#view-progress-btn:hover {
    background-color: #ffed4e;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(255, 215, 0, 0.4);
}

/* Station container wrapper */
.station-container {
    position: relative;
    max-width: 1400px;
    margin: 0 auto;
}

/* Mobile station name - hidden on desktop, shown on mobile */
.mobile-station-name {
    display: none;
}

/* Line Navigation Panel - Desktop (overlaid on image) */
.line-navigation-panel {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    max-width: 90%;
    padding: 8px;
    display: grid;
    grid-template-columns: auto auto auto;
    gap: 12px;
    align-items: center;
    z-index: 10;
    pointer-events: none;
}

.line-navigation-panel > * {
    pointer-events: all;
}

.line-info {
    background-color: var(--line-color);
    padding: 8px 16px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: background-color 0.3s;
    min-width: 250px;
    max-width: 400px;
}

.line-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.line-name {
    font-size: 1.1em;
    font-weight: bold;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.line-genre {
    font-size: 0.95em;
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.2);
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 600;
}

.station-counter {
    font-size: 0.95em;
    color: rgba(255, 255, 255, 0.9);
    text-align: center;
    font-weight: 500;
}

.nav-button {
    padding: 8px 14px;
    background-color: var(--line-color);
    color: #ffffff;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
}

.nav-button:not(:disabled):hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: #ffd700;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.nav-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.nav-button .arrow {
    font-size: 1.2em;
    font-weight: bold;
}

/* Station name sign - Desktop only (positioned on image) */
.station-name-sign {
    position: absolute;
    bottom: 35%;
    right: 5%;
    background: #003087;
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    border: 3px solid white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
    z-index: 10;
    pointer-events: none;
    max-width: 25%;
}

#station-name-text {
    font-size: 1.5em;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-family: 'Arial', sans-serif;
    white-space: nowrap;
}

/* Mobile station name - hidden on desktop */
.mobile-station-name {
    display: none;
}

/* Responsive design for mobile */
@media (max-width: 768px) {
    /* Hide desktop station name sign */
    .station-name-sign {
        display: none;
    }

    /* Show mobile station name */
    .mobile-station-name {
        display: block;
        background: var(--line-color);
        color: white;
        padding: 12px 20px;
        text-align: center;
        border-radius: 8px;
        margin: 10px;
    }

    #mobile-station-name-text {
        font-size: 1.2em;
        font-weight: bold;
        text-transform: uppercase;
        letter-spacing: 1px;
    }

    /* Move line navigation panel out of image overlay */
    .line-navigation-panel {
        position: static;
        transform: none;
        width: auto;
        max-width: none;
        margin: 10px;
        padding: 10px;
        grid-template-columns: 1fr;
        gap: 10px;
        background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
        border-radius: 8px;
        pointer-events: auto;
    }

    .line-info {
        order: -1;
        padding: 12px 16px;
    }

    .nav-button {
        width: 100%;
        padding: 12px 16px;
        font-size: 1em;
    }

    .line-name {
        font-size: 1em;
    }

    .station-view {
        margin: 0;
    }
}

.station-view {
    position: relative;
    width: 100%;
    max-width: 1400px;
    margin: 10px auto;
    overflow: hidden;
    border-radius: 10px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
    container-type: inline-size;
}

#platform-background {
    width: 100%;
    height: auto;
    display: block;
}


.book-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.book-spot {
    position: absolute;
    /* Width and height are set dynamically via JavaScript for responsive scaling */
    border: 3px solid var(--line-color);
    background: var(--line-color-light);
    border-radius: 5px;
    cursor: pointer;
    pointer-events: all;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.book-spot:hover {
    transform: scale(1.1);
    box-shadow: 0 0 20px var(--line-color);
    border-color: #ffd700;
}

.book-spot.collected {
    border-color: #00ff00;
    background: rgba(0, 255, 0, 0.2);
}

.book-spot img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background-color: #000;
}

.book-spot.empty::after {
    content: '?';
    font-size: 3em;
    color: #ffd700;
    font-weight: bold;
}

.hover-preview {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(145deg, #2a2a2a, #1a1a1a);
    border: 3px solid #ffd700;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
    z-index: 1000;
    max-width: 500px;
    transition: opacity 0.3s ease;
}

.close-preview {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    border: none;
    color: #ffd700;
    font-size: 2em;
    cursor: pointer;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
    line-height: 1;
    padding: 0;
}

.close-preview:hover {
    background: rgba(255, 215, 0, 0.2);
    transform: rotate(90deg);
}

.hover-preview.hidden {
    display: none;
    opacity: 0;
}

.preview-content {
    display: flex;
    gap: 20px;
}

#preview-cover {
    width: 150px;
    height: 225px;
    object-fit: contain;
    background-color: #000;
    border-radius: 5px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
}

.preview-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.preview-info h3 {
    font-size: 1.5em;
    color: #ffd700;
    margin-bottom: 10px;
}

.preview-info p {
    font-size: 1em;
    color: #cccccc;
    margin-bottom: 8px;
}

#preview-description {
    font-size: 0.9em;
    font-style: italic;
    line-height: 1.4;
}

.read-checkbox {
    margin-top: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background-color: rgba(255, 215, 0, 0.1);
    border-radius: 5px;
    border: 2px solid #ffd700;
}

#read-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #ffd700;
}

.read-checkbox label {
    font-size: 1.1em;
    color: #ffd700;
    cursor: pointer;
    user-select: none;
}

.station-selector {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 48, 135, 0.95);
    padding: 20px;
    border-radius: 10px;
    border: 2px solid #ffd700;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.station-selector h3 {
    margin-bottom: 10px;
    color: #ffd700;
}

#station-select {
    padding: 10px;
    font-size: 1em;
    border-radius: 5px;
    border: 2px solid #ffd700;
    background-color: #1a1a1a;
    color: #ffffff;
    cursor: pointer;
    min-width: 200px;
}

#station-select:focus {
    outline: none;
    border-color: #ffed4e;
}

#station-select optgroup {
    font-weight: bold;
    color: #ffd700;
    background-color: #1a1a1a;
}

#station-select option {
    font-weight: normal;
    padding-left: 10px;
}

.selector-hint {
    margin-top: 8px;
    font-size: 0.75em;
    color: #cccccc;
    font-style: italic;
    text-align: center;
}

/* Progress View Styles */
.progress-view {
    padding: 40px;
    min-height: calc(100vh - 80px);
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
}

.progress-view.hidden {
    display: none;
}

.progress-view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 3px solid #ffd700;
}

.progress-view-header h2 {
    font-size: 2.5em;
    color: #ffd700;
    font-weight: 600;
}

#back-to-station-btn {
    padding: 12px 25px;
    background-color: #003087;
    color: white;
    border: 2px solid #ffd700;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: bold;
    transition: all 0.3s;
}

#back-to-station-btn:hover {
    background-color: #0019a8;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 48, 135, 0.5);
}

.progress-books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
    padding: 20px 0;
}

.progress-book-card {
    background: linear-gradient(145deg, #2a2a2a, #1a1a1a);
    border: 3px solid #ffd700;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.progress-book-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(255, 215, 0, 0.3);
    border-color: #ffed4e;
}

.progress-book-card img {
    width: 100%;
    height: 350px;
    object-fit: contain;
    background-color: #000;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.progress-book-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.progress-book-info h3 {
    font-size: 1.3em;
    color: #ffd700;
    margin: 0;
    line-height: 1.3;
}

.progress-book-info .book-author {
    font-size: 1em;
    color: #cccccc;
    margin: 0;
}

.progress-book-info .book-station {
    font-size: 0.9em;
    color: #ffffff;
    background-color: #003087;
    padding: 5px 10px;
    border-radius: 5px;
    display: inline-block;
    align-self: flex-start;
    margin: 5px 0 0 0;
}

.no-books-message {
    text-align: center;
    padding: 60px 20px;
    font-size: 1.5em;
    color: #cccccc;
}

.no-books-message.hidden {
    display: none;
}

/* Line badges in progress view */
.book-lines {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 8px;
}

.line-badge {
    font-size: 0.75em;
    color: white;
    padding: 3px 8px;
    border-radius: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Footer */
.site-footer {
    background: linear-gradient(135deg, #003087 0%, #0019a8 100%);
    padding: 20px;
    margin-top: 20px;
    box-shadow: 0 -4px 6px rgba(0, 0, 0, 0.3);
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.footer-content p {
    font-size: 1em;
    color: #ffffff;
    margin: 0;
}

.school-logo {
    height: 50px;
    width: auto;
}

/* Home Page Styles */
.home-header {
    background: linear-gradient(135deg, #003087 0%, #0019a8 100%);
    padding: 40px 20px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.home-header h1 {
    font-size: 2.5em;
    font-weight: 600;
    color: #ffffff;
    margin: 0;
}

.home-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

.intro-section {
    text-align: center;
    margin-bottom: 60px;
}

.intro-section h2 {
    font-size: 2em;
    color: #ffd700;
    margin-bottom: 20px;
}

.intro-section p {
    font-size: 1.1em;
    line-height: 1.6;
    color: #cccccc;
    margin-bottom: 15px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.challenge-call {
    font-size: 1.3em;
    color: #ffd700;
    font-weight: 600;
    margin-top: 30px;
}

.map-section {
    margin-bottom: 60px;
}

.map-section h3 {
    font-size: 1.8em;
    color: #ffd700;
    text-align: center;
    margin-bottom: 30px;
}

.tube-map {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    border-radius: 12px;
}

.lines-section {
    margin-bottom: 60px;
}

.lines-section h3 {
    font-size: 1.8em;
    color: #ffd700;
    text-align: center;
    margin-bottom: 30px;
}

.lines-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-width: 600px;
    margin: 0 auto;
}

.line-link {
    background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
    border: 2px solid #003087;
    border-left: 8px solid #ffd700;
    border-radius: 8px;
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-decoration: none;
    transition: all 0.3s;
    color: #ffffff;
}

.line-link:hover {
    transform: translateX(10px);
    border-color: #ffd700;
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.3);
}

.line-link-name {
    font-size: 1.3em;
    font-weight: 600;
}

.line-link-genre {
    font-size: 1em;
    color: #ffd700;
    background: rgba(255, 215, 0, 0.1);
    padding: 5px 15px;
    border-radius: 20px;
}

@media (max-width: 768px) {
    .home-header h1 {
        font-size: 1.8em;
    }

    .intro-section h2 {
        font-size: 1.5em;
    }

    .line-link {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}
