/* ============================================================
   VARIABLES
   ============================================================ */

:root {
    --bg-color: #f4f4f4;
    --text-color: #171717;
    --accent-color: #222222;
    --button-text: #ffffff;

    --card-bg: #ffffff;
    --card-bg-hover: #ffffff;

    --border-color: rgba(0, 0, 0, 0.15);

    --shadow:
        0 8px 25px rgba(0, 0, 0, 0.12);

    --radius: 16px;
}


/* ============================================================
   RESET
   ============================================================ */

* {
    box-sizing: border-box;
}


html {
    min-height: 100%;
}


body {
    margin: 0;
    min-height: 100vh;

    background: var(--bg-color);
    color: var(--text-color);

    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Helvetica,
        Arial,
        sans-serif;

    transition:
        background-color 0.25s ease,
        color 0.25s ease;
}


button {
    font: inherit;
}


button,
.track {
    -webkit-tap-highlight-color: transparent;
}


button:focus-visible,
.track:focus-visible {
    outline: 3px solid var(--accent-color);
    outline-offset: 3px;
}


/* ============================================================
   SCREEN
   ============================================================ */

.game {
    width: min(100% - 32px, 1200px);
    margin: 0 auto;
    padding: 32px 0 60px;
}


.screen {
    width: 100%;
}


[hidden] {
    display: none !important;
}


/* ============================================================
   HEADER
   ============================================================ */

.screen-header {
    text-align: center;
    margin-bottom: 28px;
}


.screen-header h1 {
    margin: 0 0 8px;

    font-size: clamp(28px, 7vw, 44px);
    line-height: 1.1;

    letter-spacing: -0.03em;
}


.screen-header p {
    margin: 0;

    font-size: 16px;
    line-height: 1.5;

    opacity: 0.75;
}

.screen-header .tagline {
    margin: 0;

    font-size: 18px;
    font-weight: 700;

    opacity: 1;
}


.screen-header .screen-instruction {
    margin-top: 6px;

    font-size: 15px;

    opacity: 0.65;
}

/* ============================================================
   BUTTONS
   ============================================================ */

.primary-button,
.secondary-button {
    width: 100%;

    min-height: 52px;

    border-radius: 12px;
    border: 2px solid var(--accent-color);

    padding: 12px 18px;

    font-weight: 700;

    cursor: pointer;

    transition:
        transform 0.15s ease,
        opacity 0.15s ease,
        background-color 0.15s ease;
}


.primary-button {
    background: var(--accent-color);
    color: var(--button-text);
}


.secondary-button {
    background: transparent;
    color: var(--text-color);
}


.primary-button:hover:not(:disabled),
.secondary-button:hover:not(:disabled) {
    transform: translateY(-1px);
}


.primary-button:active:not(:disabled),
.secondary-button:active:not(:disabled) {
    transform: translateY(0);
}


button:disabled {
    cursor: default;
    opacity: 0.55;
}


.back-button {
    width: auto;
    min-height: 44px;

    margin-bottom: 24px;

    padding: 8px 14px;
}


/* ============================================================
   ARTIST CARDS
   ============================================================ */

.artist-list {
    display: grid;

    grid-template-columns:
        repeat(auto-fill, minmax(220px, 1fr));

    gap: 18px;
}


.artist-card {
    display: flex;
    flex-direction: column;
    align-items: center;

    width: 100%;

    padding: 12px;

    border: 2px solid var(--border-color);
    border-radius: var(--radius);

    background: var(--card-bg);
    color: var(--text-color);

    box-shadow: var(--shadow);

    cursor: pointer;

    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
}


.artist-card:hover {
    transform: translateY(-4px);

    box-shadow:
        0 12px 30px rgba(0, 0, 0, 0.18);
}


.artist-image {
    display: block;

    width: 100%;
    aspect-ratio: 1 / 1;

    object-fit: cover;

    border-radius: 12px;

    background: rgba(0, 0, 0, 0.08);
}


.artist-image.image-error {
    object-fit: contain;
}


.artist-name {
    display: block;

    width: 100%;

    margin-top: 12px;

    font-size: 17px;
    font-weight: 700;

    text-align: center;
}


/* ============================================================
   ALBUM CARDS
   ============================================================ */

.album-list {
    display: grid;

    grid-template-columns:
        repeat(auto-fill, minmax(320px, 1fr));

    gap: 18px;
}


.album-card {
    display: flex;
    align-items: center;

    width: 100%;

    min-height: 150px;

    padding: 12px;

    border: 2px solid rgba(0, 0, 0, 0.15);
    border-radius: var(--radius);

    text-align: left;

    cursor: pointer;

    box-shadow: var(--shadow);

    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
}


.album-card:hover {
    transform: translateY(-4px);

    box-shadow:
        0 12px 30px rgba(0, 0, 0, 0.18);
}


.album-cover {
    flex: 0 0 110px;

    width: 110px;
    height: 110px;

    object-fit: cover;

    border-radius: 10px;

    background: rgba(0, 0, 0, 0.08);
}


.album-cover.image-error {
    object-fit: contain;
}


.album-information {
    display: flex;
    flex-direction: column;

    min-width: 0;

    margin-left: 14px;
}


.album-name {
    font-size: 17px;
    font-weight: 800;

    line-height: 1.25;
}


.album-year {
    margin-top: 6px;

    font-size: 14px;

    opacity: 0.7;
}


/* ============================================================
   GAME HEADER
   ============================================================ */

.game-cover {
    display: block;

    width: 180px;
    height: 180px;

    margin: 0 auto 22px;

    object-fit: cover;

    border-radius: 14px;

    box-shadow: var(--shadow);

    background: rgba(0, 0, 0, 0.08);
}


.game-status {
    max-width: 720px;
    margin: 0 auto 18px;

    padding: 12px 16px;

    border-radius: 10px;

    background: rgba(0, 0, 0, 0.08);

    text-align: center;

    font-size: 14px;
    line-height: 1.5;
}


/* ============================================================
   TRACK LIST
   ============================================================ */

.track-list {
    display: flex;
    flex-direction: column;

    gap: 10px;

    max-width: 720px;
    margin: 0 auto;
}


.track {
    display: flex;
    align-items: center;

    min-height: 58px;

    padding: 8px 10px;

    border: 2px solid var(--border-color);
    border-radius: 12px;

    background: var(--card-bg);
    color: var(--text-color);

    box-shadow:
        0 3px 10px rgba(0, 0, 0, 0.08);

    user-select: none;

    cursor: default;

    transition:
        transform 0.15s ease,
        opacity 0.15s ease,
        box-shadow 0.15s ease;
}


.track:hover {
    box-shadow:
        0 5px 14px rgba(0, 0, 0, 0.13);
}


.track.dragging {
    opacity: 0.55;

    transform: scale(1.02);

    box-shadow:
        0 12px 30px rgba(0, 0, 0, 0.2);
}


.track-number {
    display: flex;
    align-items: center;
    justify-content: center;

    flex: 0 0 36px;

    width: 36px;
    height: 36px;

    margin-right: 10px;

    border-radius: 9px;

    background: var(--accent-color);
    color: var(--button-text);

    font-size: 14px;
    font-weight: 800;
}


.track-title {
    flex: 1;

    min-width: 0;

    padding-right: 8px;

    font-size: 15px;
    font-weight: 600;

    line-height: 1.3;
}


.drag-handle {
    display: flex;
    align-items: center;
    justify-content: center;

    flex: 0 0 42px;

    width: 42px;
    height: 42px;

    padding: 0;

    border: 0;
    border-radius: 9px;

    background: transparent;
    color: var(--text-color);

    font-size: 24px;
    line-height: 1;

    cursor: grab;

    touch-action: none;

    opacity: 0.65;
}


.drag-handle:hover {
    background: rgba(0, 0, 0, 0.08);
    opacity: 1;
}


.drag-handle:active {
    cursor: grabbing;
}


/* ============================================================
   GAME ACTIONS
   ============================================================ */

.game-actions {
    display: flex;
    flex-direction: column;

    gap: 12px;

    max-width: 720px;
    margin: 24px auto 0;
}


.results-actions {
    margin-top: 30px;
}


/* ============================================================
   RESULTS
   ============================================================ */

.score {
    margin: 12px 0 6px;

    font-size: clamp(30px, 8vw, 48px);
    font-weight: 900;

    letter-spacing: -0.04em;
}


.results-list {
    display: flex;
    flex-direction: column;

    gap: 9px;

    max-width: 720px;
    margin: 0 auto;
}


.result-row {
    display: grid;

    grid-template-columns:
        38px
        minmax(0, 1fr);

    align-items: center;

    gap: 8px;

    padding: 12px;

    border-radius: 11px;

    color: #151515;
}


.result-row.correct {
    background: #DFF2E1;
}


.result-row.incorrect {
    background: #F8DDDD;
}


.result-position {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 30px;
    height: 30px;

    border-radius: 8px;

    background: rgba(0, 0, 0, 0.1);

    font-weight: 800;
}


.result-answer {
    min-width: 0;

    font-weight: 700;

    line-height: 1.3;

    overflow-wrap: anywhere;
}


.correct-answer {
    grid-column: 2 / -1;

    font-size: 13px;
    font-weight: 600;

    opacity: 0.75;
}


/* ============================================================
   NOSCRIPT
   ============================================================ */

.noscript-message {
    position: fixed;

    left: 16px;
    right: 16px;
    bottom: 16px;

    padding: 16px;

    border-radius: 12px;

    background: #111111;
    color: #ffffff;

    text-align: center;
    font-weight: 700;

    z-index: 9999;
}


/* ============================================================
   MOBILE
   ============================================================ */

@media (max-width: 600px) {

    .game {
        width: min(100% - 22px, 1200px);
        padding-top: 20px;
    }


    .artist-list {
        grid-template-columns: 1fr;
    }


    .artist-card {
        flex-direction: row;

        padding: 10px;

        text-align: left;
    }


    .artist-image {
        width: 82px;
        height: 82px;

        flex: 0 0 82px;
    }


    .artist-name {
        margin: 0 0 0 14px;

        text-align: left;
    }


    .album-list {
        grid-template-columns: 1fr;
    }


    .album-card {
        min-height: 120px;
    }


    .album-cover {
        flex-basis: 92px;

        width: 92px;
        height: 92px;
    }


    .game-cover {
        width: 150px;
        height: 150px;
    }


    .track {
        min-height: 60px;
    }


    .track-title {
        font-size: 14px;
    }


    .drag-handle {
        flex-basis: 38px;

        width: 38px;
    }
}


@media (max-width: 380px) {

    .game {
        width: min(100% - 16px, 1200px);
    }


    .album-cover {
        flex-basis: 78px;

        width: 78px;
        height: 78px;
    }


    .album-name {
        font-size: 15px;
    }


    .track-number {
        flex-basis: 32px;

        width: 32px;
        height: 32px;

        margin-right: 7px;
    }


    .track-title {
        font-size: 13px;
    }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
