@font-face {
    font-family: 'Comic Sans Custom';
    src: url('/ComicSansMS3.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

body {
    font-family: 'Comic Sans Custom', sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background-color: #fcf0e1;
    margin: 0;
    padding: 20px;
    position: relative; /* Needed for absolute/fixed positioning of overlay */
}

h1 {
    margin-bottom: 20px;
    color: #5a4b3b;
}

#machine-area {
    background-color: #d4c1a6;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

#dispense-button {
    padding: 10px 20px;
    font-size: 1.2em;
    cursor: pointer;
    border: none;
    border-radius: 5px;
    background-color: #8f7a6a;
    color: white;
    transition: background-color 0.3s ease;
}

#dispense-button:hover {
    background-color: #7a6756;
}

#card-display-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    border: 2px dashed #a1907d;
    padding: 20px;
    border-radius: 10px;
    background-color: #fffdfa;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 40px;
}

.card-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.card-slot {
    width: 250px;
    height: 200px;
    border: 1px solid #c8b29a;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-color: #edebe6;
    border-radius: 5px;
}

.card-slot img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.card-label {
    font-weight: bold;
    margin-bottom: 0;
    text-align: center;
    color: #6e5c4d;
}

.card-name {
    font-size: 0.9em;
    color: #7f6f60;
    margin-top: 0;
    text-align: center;
}


/* Styles for the Card Gallery */
#card-gallery {
    width: 90%;
    max-width: 800px;
    background-color: #fffdfa;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    text-align: center;
}

#card-gallery h2 {
    margin-top: 0;
    margin-bottom: 30px;
    color: #5a4b3b;
}

.gallery-section {
    margin-bottom: 30px;
}

.gallery-section h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #6e5c4d;
    border-bottom: 1px solid #e0d8cd;
    padding-bottom: 5px;
}

.gallery-cards {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    min-height: 100px; /* Give gallery area some height even when empty */
}

.gallery-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 1px solid #c8b29a;
    padding: 10px;
    border-radius: 5px;
    background-color: #edebe6;
    width: 180px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    cursor: pointer; /* Indicate clickable */
    transition: transform 0.2s ease; /* Add subtle hover effect */
}

.gallery-item:hover {
    transform: translateY(-5px);
}

.gallery-item img {
    width: 100%;
    height: 150px;
    object-fit: contain;
    margin-bottom: 8px;
    border-bottom: 1px solid #e0d8cd;
    padding-bottom: 5px;
    pointer-events: none; /* Prevent image drag */
}

.gallery-item p {
    margin: 0;
    font-size: 0.9em;
    color: #7f6f60;
}

/* Tutorial Overlay Styles */
#tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000; /* Ensure it's on top */
}

#tutorial-box {
    background-color: #fffdfa;
    padding: 30px;
    border-radius: 10px;
    max-width: 500px;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

#tutorial-box h2 {
    margin-top: 0;
    color: #5a4b3b;
}

#tutorial-box p {
    margin-bottom: 20px;
    color: #6e5c4d;
    line-height: 1.5;
}

#close-tutorial-button {
    padding: 10px 20px;
    font-size: 1em;
    cursor: pointer;
    border: none;
    border-radius: 5px;
    background-color: #8f7a6a;
    color: white;
    transition: background-color 0.3s ease;
}

#close-tutorial-button:hover {
    background-color: #7a6756;
}

/* Card Modal Styles */
#card-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1001; /* Above tutorial overlay */
    visibility: hidden; /* Use visibility for transition */
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#card-modal-overlay.visible {
     visibility: visible;
     opacity: 1;
}

#card-modal-box {
    background-color: #fffdfa;
    padding: 20px;
    border-radius: 10px;
    max-width: 90%;
    max-height: 90%;
    overflow: auto; /* In case card is very large */
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    position: relative; /* For close button positioning */

    transform: scale(0.8); /* Start slightly smaller */
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

 #card-modal-overlay.visible #card-modal-box {
     transform: scale(1); /* Scale to normal size */
     opacity: 1;
 }


#modal-card-img {
    max-width: 100%;
    max-height: 500px; /* Limit max height for large screens */
    height: auto;
    object-fit: contain;
    margin-bottom: 10px;
    display: block; /* Remove extra space below image */
    margin-left: auto;
    margin-right: auto;
}

#modal-card-name {
    font-size: 1.2em;
    color: #5a4b3b;
    margin-top: 0;
    margin-bottom: 20px;
}

#close-card-modal {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 1.5em;
    font-weight: bold;
    color: #8f7a6a;
    cursor: pointer;
    border: none;
    background: none;
    padding: 5px;
    line-height: 1;
}

 #close-card-modal:hover {
     color: #7a6756;
 }