/* Add this more specific rule at the top of your CSS file */
#intro-section.hidden {
    display: none !important;
}

/* Rest of your existing CSS */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    position: relative;
}

/* Loading indicator styles */
.loading-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(248, 244, 229, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.5s;
}

.loading-container.hidden {
    opacity: 0;
    pointer-events: none;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(0, 0, 0, 0.1);
    border-top-color: #000;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

.loading-bar {
    width: 80%;
    max-width: 300px;
    height: 20px;
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 15px;
}

.loading-progress {
    height: 100%;
    background-color: #000;
    color: #f8f4e5;
    text-align: center;
    line-height: 20px;
    font-size: 12px;
    width: 0%;
    transition: width 0.3s;
}

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

/* Background rotation styles */
#background-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.background-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0; /* Start with zero opacity */
    transition: opacity 2s cubic-bezier(0.4, 0.0, 0.2, 1); /* Smoother easing */
    will-change: opacity; /* Optimize for animations */
}

.active-background {
    opacity: 0.35;
}

.fade-out-background {
    opacity: 0;
}


.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0;
    position: relative;
    z-index: 1;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center; /* Center content vertically */
    align-items: center; /* Center content horizontally */
}

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

h1 {
    margin-bottom: 10px;
    color: #2c3e50;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
}

#progress {
    text-align: center;
    margin-bottom: 20px;
    font-size: 18px;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.7);
}

#images-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    width: 100%;
    height: 100%;
    padding: 20px;
}

/* Updated image choice styles - made larger */
.image-choice {
    flex: 1;
    height: min(500px, calc(100vh - 340px));
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f4e5;
    border-radius: 4px;
    padding: 15px;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Ensure images scale properly */
.image-choice img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
}

.image-choice:hover {
    transform: translateY(-5px);
    box-shadow: 0 7px 20px rgba(0, 0, 0, 0.3);
}

#message {
    text-align: center;
    height: 24px;
    margin-top: 15px;
    font-weight: bold;
    text-shadow: 0 0 2px #fff;
}

.hidden {
    display: none;
}


/* Updated Typography Styles */
#landing-container h1 {
    font-family: 'Times New Roman', Times, serif;
    font-size: 38px;
    margin-bottom: 35px;
    color: #333;
    font-weight: normal;
}

#landing-container p {
    font-family: monospace;
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 18px;
    color: #444;
    max-width: 95%;
    margin-left: auto;
    margin-right: auto;
}

/* Updated Button Style */
#start-game, #play-again, #review-game {
    margin-top: 30px;
    padding: 14px 30px;
    background-color: #000000;
    color: #f8f4e5;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: bold;
    transition: background-color 0.3s, transform 0.2s;
    display: inline-block;
}

#start-game:hover, #play-again:hover, #review-game:hover {
    background-color: #333333;
    transform: translateY(-2px);
}

/* Container Style Updates */
#landing-container {
    text-align: center;
    background: #f8f4e5; /* Same background color used for painting card */
    padding: 50px 30px;
    border-radius: 0px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-width: 580px; /* Made container smaller */
    min-height: 380px;
    margin: 50px auto;
}

/* Better spacing */
#intro-section {
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#results-section h2 {
    margin-bottom: 20px;
    color: #2c3e50;
}

.button-group {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 30px;
}

/* Make buttons in the button group have equal width */
.button-group button {
    min-width: 160px; /* Set fixed width for both buttons */
}

/* Enhanced review hover styles for artwork information */
.review-hover-enabled {
    position: relative;
    overflow: hidden;
}

.review-hover-enabled::before {
    content: attr(data-image-type);
    position: absolute;
    top: 0;  /* Cover the entire image */
    left: 0;
    width: 100%;
    height: 100%;  /* Full height coverage */
    background-color: rgba(248, 244, 229, 0.95);  /* Light cream background matching the theme, more opaque */
    color: #333;  /* Dark text color */
    display: flex;
    flex-direction: column;  /* Stack content vertically */
    justify-content: center;
    align-items: center;
    padding: 20px;
    font-family: 'Times New Roman', Times, serif;  /* Match landing page font */
    font-size: 18px;  /* Slightly smaller font to accommodate longer text */
    font-weight: normal;  /* Make body text normal weight */
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 10;
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.1);  /* Inner shadow for depth */
    text-align: center;
    line-height: 1.5;
    white-space: pre-line;  /* Respect line breaks in the data-image-type attribute */
    overflow-y: auto;  /* Add scrolling for very long content */
}

.review-hover-enabled:hover::before {
    opacity: 1;
}

/* Keyboard focus on image choices */
.image-choice:focus-visible {
    outline: 3px solid #000;
    outline-offset: 3px;
}

/* Touch screens have no hover: show the artwork info as a caption band */
@media (hover: none) {
    .review-hover-enabled::before {
        opacity: 1;
        top: auto;
        bottom: 0;
        height: auto;
        max-height: 50%;
        box-sizing: border-box;
    }
}

/* Progress bar styles */
.progress-bar-container {
    width: 100%;
    height: 4px;
    background-color: rgba(0, 0, 0, 0.1);
    margin-bottom: 15px;
    overflow: hidden;
    position: absolute;
    top: 40px;
    left: 0; /* Add explicit left positioning */
    right: 0; /* Add explicit right positioning */
}

#progress-bar {
    height: 100%;
    background-color: #000;
    width: 0%;
    transition: width 0.3s ease;
}

#share-container {
    text-align: center;
    margin-top: 10px;
    margin-bottom: 10px;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    gap: 8px; /* Reduced gap between buttons */
}

.share-buttons-wrapper {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: -25px;
}

#copy-link-button, #twitter-share-button {
    width: 40px;
    height: 40px;
    background-color: #000000;
    color: #f8f4e5;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s, transform 0.2s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* Make both buttons have same hover effect */
#copy-link-button:hover, #twitter-share-button:hover {
    background-color: #333333;
    transform: translateY(-2px);
}

/* Twitter button styling for X logo */
#twitter-share-button img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.copy-message {
    position: absolute;
    right: 0;
    left: 0;
    text-align: center;
    margin-top: 55px;
    font-family: monospace;
    font-size: 14px;
    color: #333;
    transition: opacity 0.3s;
}

.copy-message.hidden {
    opacity: 0;
    pointer-events: none;
}

/* ==================
   Round status, reveal, zoom, results
   ================== */
.image-choice {
    position: relative;
}

#game-header {
    width: fit-content;
    max-width: calc(100% - 24px);
    margin: 0 auto;
    padding: 6px 22px 8px;
    background: rgba(248, 244, 229, 0.94);
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    text-align: center;
}

#round-status {
    display: flex;
    justify-content: center;
    gap: 18px;
    font-family: monospace;
    font-size: 13px;
    color: #666;
}

#pick-prompt {
    font-family: 'Times New Roman', Times, serif;
    font-size: 24px;
    line-height: 1.25;
    color: #222;
}

#next-prompt {
    font-family: monospace;
    font-size: 15px;
    line-height: 1.6;
    padding: 3px 0;
    color: #444;
}

#landing-container p.task {
    font-weight: bold;
    color: #000;
}

#round-status.hidden {
    display: none;
}

.image-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 11;
    padding: 3px 14px;
    border-radius: 50px;
    font-family: monospace;
    font-size: 13px;
    font-weight: bold;
    letter-spacing: 1px;
    text-transform: uppercase;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.badge-ai {
    background: #000;
    color: #f8f4e5;
}

.badge-human {
    background: #f8f4e5;
    color: #000;
    border: 2px solid #000;
}

.image-choice.revealed,
.image-choice.revealed:hover {
    transform: none;
}

.image-choice.picked-correct {
    outline: 4px solid #2e7d32;
    outline-offset: -4px;
}

.image-choice.picked-wrong {
    outline: 4px solid #c62828;
    outline-offset: -4px;
}

.zoom-button {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 12;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    color: #f8f4e5;
    font-size: 18px;
    line-height: 34px;
    cursor: zoom-in;
    opacity: 0;
    transition: opacity 0.2s, background-color 0.2s;
}

.image-choice:hover .zoom-button,
.zoom-button:focus-visible {
    opacity: 1;
}

.zoom-button:hover {
    background: #000;
}

@media (hover: none) {
    .zoom-button {
        opacity: 0.85;
    }
}

#reveal-panel {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    z-index: 150;
    width: min(560px, calc(100% - 32px));
    max-height: 45vh;
    overflow-y: auto;
    padding: 16px 22px 18px;
    background: #f8f4e5;
    border-radius: 6px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.3);
    text-align: center;
    font-family: monospace;
    font-size: 14px;
    color: #444;
    animation: reveal-in 0.25s ease-out;
}

@keyframes reveal-in {
    from { opacity: 0; transform: translate(-50%, 12px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

#reveal-panel p {
    margin-bottom: 4px;
}

#reveal-verdict {
    font-family: 'Times New Roman', Times, serif;
    font-size: 24px;
    margin-bottom: 8px !important;
}

.verdict-correct {
    color: #2e7d32;
}

.verdict-wrong {
    color: #c62828;
}

#reveal-stat {
    font-style: italic;
    min-height: 1.4em;
}

#next-button,
.small-button {
    background-color: #000;
    color: #f8f4e5;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: background-color 0.3s, transform 0.2s;
}

#next-button {
    margin-top: 10px;
    padding: 12px 28px;
    font-size: 13px;
}

.small-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 11px;
}

.small-button img {
    width: 14px;
    height: 14px;
}

#next-button:hover,
.small-button:hover {
    background-color: #333;
    transform: translateY(-2px);
}

#lightbox:not(.hidden) {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.9);
    cursor: zoom-out;
}

#lightbox img {
    max-width: 96vw;
    max-height: 94vh;
    object-fit: contain;
}

#results-rank {
    font-family: 'Times New Roman', Times, serif;
    font-size: 34px;
    font-weight: normal;
}

#result-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin: 6px 0 18px;
}

.result-cell {
    width: 22px;
    height: 22px;
    border-radius: 4px;
}

.result-cell.correct {
    background: #2e7d32;
}

.result-cell.wrong {
    background: #c62828;
}

.best-score {
    font-weight: bold;
}

/* Wording for touch screens vs mouse */
@media (hover: none) {
    .desktop-only {
        display: none;
    }
}

@media (hover: hover) {
    .touch-only {
        display: none;
    }

    /* Make the action explicit on the image under the mouse */
    .image-choice:not(.revealed):not(.review-hover-enabled):hover::after {
        content: 'This one is AI';
        position: absolute;
        bottom: 14px;
        left: 50%;
        transform: translateX(-50%);
        z-index: 11;
        padding: 4px 14px;
        border-radius: 50px;
        background: #000;
        color: #f8f4e5;
        font-family: monospace;
        font-size: 12px;
        font-weight: bold;
        letter-spacing: 1px;
        text-transform: uppercase;
        white-space: nowrap;
        pointer-events: none;
    }
}

#landing-container p.hint {
    font-size: 13px;
    color: #666;
}

.score-share {
    position: relative;
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 8px;
}

.score-share.hidden {
    display: none;
}

.score-share .copy-message {
    margin-top: 40px;
}

/* Desktop: header, images filling the remaining height, share row */
@media (min-width: 769px) {
    .container {
        max-width: 1400px;
    }

    #game-container:not(.hidden) {
        display: flex;
        flex-direction: column;
        width: 100%;
        height: 100vh;
        padding: 52px 20px 12px;
    }

    #game-header {
        flex: none;
    }

    #images-container {
        flex: 1;
        min-height: 0;
        height: auto;
        padding: 14px 0 10px;
        gap: 16px;
    }

    .image-choice {
        height: 100%;
        max-height: 900px;
        padding: 10px;
    }

    #share-container {
        flex: none;
        margin: 0;
    }

    .share-buttons-wrapper {
        margin-top: 0;
    }
}

/* Desktop: answer panel as one compact row under the images, text left and button right */
@media (min-width: 769px) {
    #reveal-panel:not(.hidden) {
        bottom: 14px;
        width: min(760px, calc(100% - 32px));
        display: grid;
        grid-template-columns: 1fr auto;
        column-gap: 20px;
        align-items: center;
        padding: 12px 20px;
        text-align: left;
    }

    #reveal-panel p {
        grid-column: 1;
        margin-bottom: 2px;
    }

    #reveal-verdict {
        font-size: 21px;
        margin-bottom: 4px !important;
    }

    #next-button {
        grid-column: 2;
        grid-row: 1 / span 4;
        margin-top: 0;
    }
}

#game-container {
    transition: padding-bottom 0.25s ease;
}

#game-container.revealing {
    padding-bottom: var(--reveal-height, 190px);
}

#game-container.revealing #share-container {
    display: none;
}

/* ==================
   Phones: header, two images sharing the screen height, share row.
   While the answer panel is open the images shrink to stay visible above it.
   ================== */
@media (max-width: 768px) {
    .container {
        height: auto;
        min-height: 100vh;
        min-height: 100dvh;
        padding: 12px;
    }

    #landing-container {
        width: 100%;
        margin: 0;
        padding: 28px 18px;
        min-height: 0;
    }

    #landing-container h1 {
        font-size: 30px;
        margin-bottom: 20px;
    }

    #landing-container p {
        font-size: 14px;
        margin-bottom: 12px;
        max-width: 100%;
    }

    #start-game {
        width: 100%;
        margin-top: 16px;
    }

    .button-group {
        flex-direction: column;
        gap: 10px;
        width: 100%;
        margin-top: 20px;
    }

    .button-group button {
        width: 100%;
        min-width: 0;
        margin-top: 0 !important;
    }

    .score-share {
        flex-wrap: wrap;
    }

    #game-container:not(.hidden) {
        display: flex;
        flex-direction: column;
        width: 100%;
        height: calc(100vh - 24px);
        height: calc(100dvh - 24px);
    }

    .progress-bar-container {
        position: static;
        flex: none;
        margin-bottom: 10px;
    }

    #game-header {
        flex: none;
        padding: 5px 16px 7px;
    }

    #pick-prompt {
        font-size: 19px;
    }

    #images-container {
        flex: 1;
        min-height: 0;
        flex-direction: column;
        gap: 8px;
        height: auto;
        padding: 8px 0 0;
    }

    .image-choice {
        flex: 1 1 0;
        min-height: 0;
        width: 100%;
        height: auto;
        padding: 5px;
        overflow: hidden;
    }

    .image-choice:hover {
        transform: none;
    }

    .image-choice:active:not(.revealed) {
        transform: scale(0.98);
    }

    #share-container {
        flex: none;
        margin: 8px 0 0;
    }

    #copy-link-button, #twitter-share-button {
        width: 36px;
        height: 36px;
        font-size: 17px;
    }

    .share-buttons-wrapper {
        margin-top: 0;
    }

    #game-container.revealing #pick-prompt,
    #game-container.revealing #next-prompt {
        display: none;
    }

    .review-hover-enabled::before {
        font-size: 14px;
        padding: 10px;
        line-height: 1.4;
    }

    #reveal-panel {
        bottom: calc(10px + env(safe-area-inset-bottom, 0px));
        padding: 12px 16px 14px;
        font-size: 13px;
    }

    #reveal-verdict {
        font-size: 20px;
    }
}
