:root {
    --bg-color: #08060c;
    --card-bg: rgba(22, 16, 30, 0.8);
    --card-border: rgba(249, 83, 198, 0.15);
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --accent-color: #7153f9;
    --accent-glow: rgba(43, 205, 70, 0.3);

    --success-color: #00ff87;
    --error-color: #ff3860;

    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-body);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    overflow-x: hidden;
    position: relative;
}

/* Background Ambient Glows */
.background-glows {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
}

.glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.12;
}

.glow-1 {
    top: -10%;
    right: -10%;
    width: 50vw;
    height: 50vw;
    background: linear-gradient(135deg, #f953c6 0%, #b91d73 100%);
}

.glow-2 {
    bottom: -15%;
    left: -15%;
    width: 50vw;
    height: 50vw;
    background: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
}

/* Container */
.container {
    width: 100%;
    max-width: 1200px;
    padding: 20px;
    z-index: 2;
    display: flex;
    flex-direction: column;
    height: 100vh;
    justify-content: space-between;
}

/* Game Header */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.back-link {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1rem;
    transition: color 0.3s ease;
    padding: 8px 16px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.back-link:hover {
    color: var(--accent-color);
    background: rgba(249, 83, 198, 0.05);
    border-color: rgba(249, 83, 198, 0.2);
}

.game-title {
    position: relative;
}

.player-badge {
    position: absolute;
    top: -35px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent-color);
    color: #fff;
    padding: 2px 12px;
    border-radius: 12px;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 0.8rem;
    box-shadow: 0 0 15px var(--accent-glow);
    white-space: nowrap;
    z-index: 10;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.game-title h1 {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 800;
}

.highlight {
    background: var(--accent-glow);
    color: var(--accent-color);
    padding: 2px 8px;
    border-radius: 8px;
    text-shadow: 0 0 10px var(--accent-glow);
}

.score-container {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    padding: 8px 16px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.score-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

.score-value {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent-color);
}

/* Main Game Area */
.game-area {
    display: flex;
    flex-direction: column;
    gap: 25px;
    flex-grow: 1;
    justify-content: center;
    padding: 15px 0;
}

.section-title {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    margin-bottom: 12px;
    font-weight: 600;
}

/* Player Card Section */
.target-section {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.player-card {
    display: flex;
    align-items: center;
    background: var(--card-bg);
    border: 2px solid var(--accent-color);
    border-radius: 24px;
    padding: 30px 40px;
    width: 100%;
    max-width: 600px;
    box-shadow: 0 15px 35px rgba(249, 83, 198, 0.20), 0 0 25px rgba(249, 83, 198, 0.05);
    position: relative;
    gap: 40px;
}

/* Player controls */
.player-controls {
    flex-grow: 1;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 20px;
}

.song-info h2 {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 6px;
    line-height: 1.3;
}

.song-info p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 0;
    font-weight: 500;
}

.control-buttons {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-shrink: 0;
}

.control-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent-color);
    border: none;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 15px var(--accent-glow);
    transition: all 0.3s ease;
}

.control-btn:hover:not(:disabled) {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(249, 83, 198, 0.5);
}

.control-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

.control-btn svg {
    width: 24px;
    height: 24px;
}

.secondary-btn {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    box-shadow: none;
}

.secondary-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.secondary-btn svg {
    width: 18px;
    height: 18px;
}

/* Music Timeline */
.timeline-section {
    width: 100%;
}

.timeline-scroll-container {
    width: 100%;
    overflow-x: auto;
    padding: 20px 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(249, 83, 198, 0.3) rgba(255, 255, 255, 0.02);
}

.timeline-scroll-container::-webkit-scrollbar {
    height: 6px;
}

.timeline-scroll-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 3px;
}

.timeline-scroll-container::-webkit-scrollbar-thumb {
    background: rgba(249, 83, 198, 0.3);
    border-radius: 3px;
}

.timeline-container {
    display: inline-flex;
    align-items: center;
    min-width: 100%;
    padding: 0 40px;
    gap: 12px;
}

/* Placed Cassette Cards */
.timeline-card {
    width: 170px;
    flex-shrink: 0;
    background: rgba(20, 15, 30, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 16px;
    padding: 15px;
    position: relative;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 120px;
    animation: cardEnter 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

@keyframes cardEnter {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.timeline-card.just-added {
    border-color: var(--accent-color);
    box-shadow: 0 0 15px rgba(249, 83, 198, 0.3);
}

.timeline-card .card-info {
    overflow: hidden;
}

.timeline-card h3 {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.timeline-card p {
    color: var(--text-secondary);
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.timeline-card .year-badge {
    align-self: flex-start;
    background: rgba(249, 83, 198, 0.9);
    color: #fff;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 0.85rem;
    padding: 2px 8px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(249, 83, 198, 0.3);
    margin-top: 10px;
}

/* Cassette details decoration */
.timeline-card::after {
    content: '';
    position: absolute;
    bottom: 12px;
    right: 15px;
    width: 24px;
    height: 12px;
    background: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.05) 2px, transparent 2px, transparent 4px);
    border-radius: 2px;
}

/* Timeline Slots (Interactive) */
.timeline-slot {
    width: 48px;
    height: 120px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.slot-line {
    position: absolute;
    width: 2px;
    height: 50px;
    background: rgba(255, 255, 255, 0.12);
    transition: all 0.3s ease;
}

.slot-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(20, 15, 30, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.slot-btn svg {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

/* Slot Hover styling */
.timeline-slot:hover {
    width: 80px;
}

.timeline-slot:hover .slot-line {
    height: 90px;
    background: var(--accent-color);
    box-shadow: 0 0 10px var(--accent-glow);
}

.timeline-slot:hover .slot-btn {
    background: var(--accent-color);
    color: #fff;
    border-color: var(--accent-color);
    transform: scale(1.2);
    box-shadow: 0 0 15px var(--accent-glow);
}

.timeline-slot:hover .slot-btn svg {
    transform: rotate(90deg);
}

/* Overlay & Modals */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 4, 8, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

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

.modal {
    background: rgba(22, 16, 30, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 28px;
    width: 90%;
    max-width: 480px;
    padding: 40px 30px;
    text-align: center;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.overlay.active .modal {
    transform: scale(1);
}

.modal.card-music-theme {
    border-color: rgba(255, 56, 96, 0.3);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5), 0 0 30px rgba(255, 56, 96, 0.1);
}

.modal-title {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--error-color);
    margin-bottom: 8px;
}

.modal-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.5;
    margin-bottom: 25px;
}

/* Result Reveal Details */
.result-details {
    margin-bottom: 30px;
    display: flex;
    justify-content: center;
}

.result-card {
    width: 190px;
    background: rgba(255, 56, 96, 0.05);
    border: 2px solid var(--error-color);
    border-radius: 16px;
    padding: 15px;
    box-shadow: 0 8px 24px rgba(255, 56, 96, 0.15);
    animation: shake 0.6s ease both;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 120px;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    15%,
    45%,
    75% {
        transform: translateX(-8px);
    }

    30%,
    60%,
    90% {
        transform: translateX(8px);
    }
}

.result-card h3 {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
}

.result-card p {
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-card .year-reveal {
    background: var(--error-color);
    color: #fff;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1rem;
    padding: 4px 10px;
    text-align: center;
    border-radius: 8px;
    margin-top: 15px;
    align-self: flex-start;
}

/* Stat Grid */
.stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 30px;
}

.stat-box {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 15px;
    display: flex;
    flex-direction: column;
}

.stat-num {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 700;
    color: #fff;
}

.stat-box:first-child .stat-num {
    color: var(--accent-color);
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 4px;
}

/* Modal buttons */
.modal-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.hidden {
    display: none !important;
}

.modal-btn {
    width: 100%;
    padding: 15px;
    border-radius: 14px;
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    text-align: center;
}

.btn-primary {
    background: var(--accent-color);
    color: #fff;
    border: none;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(249, 83, 198, 0.5);
    transform: translateY(-2px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

/* YouTube player background container */
.yt-background-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
    background-color: var(--bg-color);
}

.yt-background-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, rgba(8, 6, 12, 0.4) 0%, rgba(8, 6, 12, 0.5) 100%);
    pointer-events: none;
    z-index: 2;
}

#yt-player {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100vw;
    height: 56.25vw;
    /* 16:9 ratio */
    min-height: 100vh;
    min-width: 177.77vh;
    /* 16:9 ratio */
    transform: translate(-50%, -50%);
    z-index: 1;
    border: none;
}

#yt-player iframe {
    width: 100% !important;
    height: 100% !important;
    pointer-events: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .game-title h1 {
        font-size: 1.4rem;
    }

    .score-container {
        padding: 6px 12px;
    }

    .score-value {
        font-size: 1.1rem;
    }

    .player-card {
        padding: 20px;
        gap: 20px;
        flex-direction: column;
        align-items: center;
        text-align: center;
        max-width: 100%;
    }

    .player-controls {
        align-items: center;
    }

    .control-buttons {
        justify-content: center;
    }

    .timeline-slot {
        width: 36px;
    }

    .timeline-slot:hover {
        width: 60px;
    }
}