/* Movie Buff */

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

body {
    background: #000;
    color: #fff;
    font-family: Helvetica, Arial, sans-serif;
    min-height: 100vh;
}

.game-container {
    width: 90%;
    max-width: 500px;
    margin: 0 auto;
    padding: 14px;
}

/* Header */

header {
    text-align: center;
    margin-bottom: 17px;
}

h1 {
    font-size: 34px;
    font-weight: 700;
    letter-spacing: -1px;
}

.subtitle {
    color: #aaa;
    margin-top: 6px;
    font-size: 18px;
}

.today-date {
    margin-top: 6px;
    color: #888;
    font-size: 15px;
    text-align: center;
}

/* Stats */

.stats {
    display: flex;
    justify-content: space-between;
    margin-top: 17px;
    font-size: 15px;
    color: #ccc;
}

/* Instructions */

.instructions {
    text-align: center;
    color: #aaa;
    line-height: 1;
    margin-top: 10px;
    margin-bottom: 0;
}

/* ── Answer slots ───────────────────────────────── */

#answer-slots {
    margin-bottom: 14px;
}

.slots-label-row {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #666;
    margin-bottom: 6px;
    user-select: none;
    letter-spacing: .5px;
}

#slots-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
}

.slot {
    position: relative;
    aspect-ratio: 2 / 3;
    border-radius: 10px;
    border: 2px dashed #333;
    background: #0d0d0d;
    overflow: hidden;
    transition: border-color .15s, background .15s;
}

/* Position number shown when empty */
.slot:empty::after {
    content: attr(data-pos);
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
    color: #2a2a2a;
}

.slot.drag-over {
    border-color: #fff;
    border-style: solid;
    background: #1a1a1a;
}

.slot.correct {
    border-color: #00ff66;
    border-style: solid;
}

/* Card inside a slot fills it completely */
.slot > .movie-card {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    aspect-ratio: unset;
    border-radius: 8px;
}

.slot > .movie-card .movie-overlay {
    padding: 16px 4px 5px;
}

.slot > .movie-card .movie-title {
    font-size: 7px;
}

.slot > .movie-card .movie-year {
    font-size: 7px;
}

/* ── Poster pool ─────────────────────────────────── */

#poster-pool {
    margin-top: 4px;
}

.pool-label {
    text-align: center;
    font-size: 12px;
    color: #444;
    margin-bottom: 8px;
    letter-spacing: .5px;
    user-select: none;
}

#movie-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

/* ── Movie card ──────────────────────────────────── */

.movie-card {
    position: relative;
    width: 100%;
    aspect-ratio: 2 / 3;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid transparent;
    cursor: grab;
    user-select: none;
    touch-action: none;
    transition:
        transform .15s ease,
        box-shadow .15s ease,
        border-color .15s ease,
        opacity .15s ease;
}

.movie-card.dragging {
    border: 2px solid #fff;
    box-shadow: 0 0 20px rgba(255,255,255,.3);
    opacity: 0.75;
    z-index: 1000;
}

/* Poster fills the full card */

.movie-poster {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}

.movie-poster-placeholder {
    width: 100%;
    height: 100%;
    background: #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: center;
}

.movie-poster-placeholder::after {
    content: "🎬";
    font-size: 28px;
    opacity: 0.3;
}

/* Gradient overlay with title + year */

.movie-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 24px 8px 8px;
    background: linear-gradient(transparent, rgba(0,0,0,0.88));
    pointer-events: none;
}

.movie-title {
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    color: #fff;
    text-shadow: 0 1px 4px rgba(0,0,0,0.9);
}

/* Release year hidden initially */

.movie-year {
    font-size: 10px;
    color: #ddd;
    margin-top: 2px;
    opacity: 0;
    transform: translateY(-3px);
    transition: all .4s ease;
    text-shadow: 0 1px 4px rgba(0,0,0,0.9);
}

.movie-card.reveal .movie-year {
    opacity: 1;
    transform: translateY(0);
}

/* Correct locked tiles */

.movie-card.correct {
    border-color: #00ff66;
    cursor: default;
}

.movie-card.correct .movie-overlay {
    background: linear-gradient(transparent, rgba(0, 60, 20, 0.92));
}

.movie-card.correct .movie-year {
    color: #6effa0;
}

/* Incorrect guess shake */

.movie-card.shake {
    animation: shake .35s;
}

@keyframes shake {
    0%   { transform: translateX(0); }
    25%  { transform: translateX(-10px); }
    50%  { transform: translateX(10px); }
    75%  { transform: translateX(-8px); }
    100% { transform: translateX(0); }
}

/* Buttons */

#check-button {
    width: 90%;
    margin: 30px auto 0;
    display: block;
    padding: 17px;
    background: #e03131;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: background .2s;
}

#check-button:hover {
    background: #c92a2a;
}

#already-played-share {
    width: 90%;
    margin: 30px auto 0;
    display: block;
    padding: 17px;
    background: white;
    color: black;
    border: none;
    border-radius: 10px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
}

#share-button {
    width: 90%;
    margin: 20px auto 0;
    display: block;
    padding: 17px;
    background: #22a84a;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: background .2s;
}

#share-button:hover {
    background: #1a8f3d;
}

#check-button:active,
#share-button:active,
#already-played-share:active {
    transform: scale(.97);
}

.complete-stars {
    font-size: 28px;
    letter-spacing: 6px;
    margin-bottom: 6px;
}

/* Messages */

#message {
    text-align: center;
    margin-top: 20px;
    font-size: 22px;
}

/* Completion modal overlay */

#complete-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

#complete-overlay.hidden {
    display: none;
}

#complete-screen {
    position: relative;
    background: #111;
    border: 2px solid #c9a84c;
    box-shadow: 0 0 24px rgba(201, 168, 76, 0.25);
    border-radius: 14px;
    padding: 36px 32px 32px;
    text-align: center;
    width: 90%;
    max-width: 380px;
}

#close-modal {
    position: absolute;
    top: 12px;
    right: 14px;
    background: transparent;
    border: none;
    color: #888;
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    padding: 4px 6px;
    border-radius: 6px;
    transition: color .2s;
}

#close-modal:hover {
    color: #fff;
}

.complete-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.complete-congrats {
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 8px;
}

#final-score {
    color: #aaa;
    font-size: 17px;
    font-weight: 400;
    margin-bottom: 24px;
}

/* ── View Answers button ───────────────────────── */

#view-answers-btn {
    width: 90%;
    margin: 12px auto 0;
    display: block;
    padding: 13px;
    background: transparent;
    color: #ccc;
    border: 1px solid #444;
    border-radius: 10px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    transition: border-color .2s, color .2s;
}

#view-answers-btn:hover {
    border-color: #888;
    color: #fff;
}

/* Answers panel */

#answers-panel {
    margin-top: 24px;
}

.answers-label {
    text-align: center;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #666;
    margin-bottom: 14px;
}

#answers-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.answer-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #111;
    border: 1px solid #2a2a2a;
    border-radius: 10px;
    overflow: hidden;
    padding-right: 16px;
}

.answer-rank {
    font-size: 18px;
    font-weight: 700;
    color: #00ff66;
    min-width: 28px;
    text-align: center;
    padding-left: 12px;
}

.answer-poster {
    width: 48px;
    height: 68px;
    object-fit: cover;
    flex-shrink: 0;
    display: block;
}

.answer-poster-placeholder {
    width: 48px;
    height: 68px;
    flex-shrink: 0;
    background: #1e1e1e;
    display: flex;
    align-items: center;
    justify-content: center;
}

.answer-poster-placeholder::after {
    content: "🎬";
    font-size: 18px;
    opacity: 0.4;
}

.answer-info {
    flex: 1;
}

.answer-title {
    font-size: 15px;
    font-weight: bold;
    line-height: 1.2;
}

.answer-year {
    font-size: 13px;
    color: #00ff66;
    margin-top: 4px;
}

/* ── Already Played Screen ─────────────────────── */

.already-played-box {
    text-align: center;
    padding: 30px 20px;
    border: 1px solid #333;
    border-radius: 16px;
    margin-top: 10px;
}

.already-played-box h2 {
    font-size: 24px;
    margin-bottom: 10px;
}

.already-played-box p {
    color: #aaa;
    font-size: 16px;
}

#already-played-score {
    margin-top: 18px;
    font-size: 20px;
    font-weight: bold;
    color: #00ff66;
}

.countdown-wrap {
    margin-top: 24px;
}

.countdown-label {
    font-size: 13px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.countdown-timer {
    font-size: 38px;
    font-weight: 700;
    letter-spacing: 2px;
    margin-top: 6px;
    color: #fff;
}

/* ── Confetti Canvas ───────────────────────────── */

#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    display: none;
}

/* Hidden utility */

.hidden {
    display: none;
}

/* Footer */

footer {
    text-align: center;
    margin-top: 40px;
    color: #666;
    font-size: 13px;
}
