/* css/style.css */

/* --- Base & Desktop Styles --- */
body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #1a2a1f 0%, #2b4030 50%, #1a2a1f 100%);
    color: #e0e0e0;
    min-height: 100vh;
    padding: 1rem;
}

.main-container {
    display: flex;
    flex-direction: column; /* Default to column for mobile-first approach */
    gap: 1.5rem;
    max-width: 1000px;
    margin: 0 auto;
    background-color: rgba(0, 0, 0, 0.2);
    padding: 1.5rem;
    border-radius: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

/* --- NEW: Mobile Visibility Helper Class --- */
/* This class will be added/removed by JavaScript to control the mobile view */
.mobile-hidden {
    display: none !important;
}

/* --- Desktop Layout Overrides (when screen is 768px or wider) --- */
@media (min-width: 768px) {
    .main-container {
        flex-direction: row;
    }
    #left-column {
        width: 35%;
        flex-shrink: 0;
    }
    #main-content {
        width: 65%;
        flex-grow: 1;
    }
    /* IMPORTANT: On desktop, we override the helper class to ensure everything is always visible */
    .mobile-hidden {
        display: flex !important; /* Use flex for main sections */
    }
    .mobile-hidden-grid {
        display: grid !important; /* Use grid for card container */
    }
}

/* --- Left Column Styles --- */
#left-column {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.cartomancer-title .pepe { color: #4caf50; font-weight: 700; }
.cartomancer-title .cartomancer { color: #ffffff; font-weight: 600; }

.pepe-image-container {
    background-color: #33503a; border: 1px solid #66806a; width: 80%;
    max-width: 250px; aspect-ratio: 1 / 1; margin: 0 auto;
    display: flex; justify-content: center; align-items: center;
    border-radius: 0.5rem; overflow: hidden;
}
.pepe-image-container img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* Message Area & Input */
.message-box {
    background-color: rgba(0, 0, 0, 0.3); backdrop-filter: blur(3px);
    border: 1px solid rgba(255, 255, 255, 0.15); border-radius: 0.5rem; padding: 1rem;
}
#question-input {
    background-color: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.2);
    color: #e0e0e0; border-radius: 0.375rem; padding: 0.5rem; width: 100%;
    margin-top: 0.75rem; box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
#question-input:focus {
    outline: none; border-color: #66806a;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.1), 0 0 0 2px rgba(76, 175, 80, 0.4);
}

/* Main Content Styles */
#main-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Card Area Styles */
.card-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); /* More fluid grid */
    gap: 1rem;
    width: 100%;
}
@media (min-width: 900px) {
    .card-container {
        grid-template-columns: repeat(3, 1fr);
    }
}

.card-slot { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; }
.card-slot-label { font-size: 0.9rem; font-weight: 600; color: #b0d0b5; }
.card-meaning {
    font-size: 0.7rem; color: #c0d0c5; text-align: center; width: 90%;
    max-width: 150px; line-height: 1.3; min-height: 40px;
}

/* Flip Card Styles */
.flip-card {
    background-color: transparent; width: 100%; max-width: 150px;
    min-height: 100px; aspect-ratio: 2.5 / 3.5; perspective: 1000px;
    border-radius: 0.375rem;
}
.flip-card-inner {
    position: relative; width: 100%; height: 100%; text-align: center;
    transition: transform 0.7s; transform-style: preserve-3d; border-radius: inherit;
}
.flip-card-inner.flipped { transform: rotateY(180deg); }
.flip-card-front, .flip-card-back {
    position: absolute; width: 100%; height: 100%; -webkit-backface-visibility: hidden;
    backface-visibility: hidden; border-radius: inherit; display: flex;
    flex-direction: column; justify-content: center; align-items: center;
}
.flip-card-back {
    background-color: #3a5a3f;
    background-image: url('https://i.ibb.co/LdskY5vQ/pepe-the-deck.png');
    background-size: contain; background-position: center; background-repeat: no-repeat;
    border: 1px solid #a0b0a5; color: #d0e0d5;
}
.flip-card-front {
    background-color: #f0e6d2; border: 2px solid #a08a6c; color: #3a2a1a;
    transform: rotateY(180deg); padding: 0; justify-content: space-between;
}
.card-front-content {
    flex-grow: 1; width: 100%; background-size: cover; background-position: center;
    background-repeat: no-repeat; border-top-left-radius: inherit; border-top-right-radius: inherit;
}
.card-name-band {
    background-color: white; color: #3a2a1a; width: 100%; padding: 0.25rem 0.5rem;
    font-size: 0.7rem; font-weight: 600; text-align: center; border-top: 1px solid #a08a6c;
    border-bottom-left-radius: inherit; border-bottom-right-radius: inherit;
    box-sizing: border-box; white-space: nowrap; overflow: hidden;
    text-overflow: ellipsis; flex-shrink: 0;
}

/* Interpretation Areas */
.interpretation-box {
     background-color: rgba(0, 0, 0, 0.3); backdrop-filter: blur(3px);
     border: 1px solid rgba(255, 255, 255, 0.15); border-radius: 0.5rem; padding: 1rem;
     min-height: 80px;
}
#interpretation-text p, #pepe-interpretation-text p { margin-bottom: 0.75rem; line-height: 1.5; }
#pepe-interpretation-area { background-color: rgba(76, 175, 80, 0.1); border-color: rgba(76, 175, 80, 0.3); }
#pepe-interpretation-area h2 { color: #81c784; }

/* Button Container */
#button-container {
    display: flex; flex-wrap: wrap; justify-content: center;
    align-items: center; gap: 1rem; margin-top: 0;
}

/* Button Styles */
.button {
    background: linear-gradient(to right, #4caf50, #81c784); color: white;
    padding: 0.6rem 1.2rem; border: none; border-radius: 9999px; font-weight: 600;
    cursor: pointer; transition: all 0.3s ease; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    text-decoration: none; display: inline-block; text-align: center;
}
.button:hover { transform: translateY(-2px); box-shadow: 0 6px 8px rgba(0, 0, 0, 0.25); }
.button:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; background: #66806a; }
#share-button { background: #1DA1F2; display: none; }
#share-button:hover { background: #0c85d0; }
#more-games-button {
    background: linear-gradient(to right, #6a4f6b, #9a7fbf); padding: 0.4rem 0.8rem; font-size: 0.75rem;
}
#more-games-button:hover { background: linear-gradient(to right, #5a3f5b, #8a6fbf); }

/* Logo Container */
.logo-container {
    display: flex; justify-content: space-between; align-items: center;
    padding-bottom: 1rem; margin-bottom: 1rem; border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.logo-container .logo-link img {
    max-width: 120px; height: auto; display: block;
    opacity: 0.8; transition: opacity 0.3s ease;
}
.logo-container .logo-link:hover img { opacity: 1.0; }

/* Modal Styles */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(0, 0, 0, 0.6); backdrop-filter: blur(5px);
    display: flex; justify-content: center; align-items: center;
    z-index: 1000; opacity: 0; visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal-content {
    background: linear-gradient(145deg, #2b4030, #1a2a1f); padding: 1.5rem 2rem;
    border-radius: 0.75rem; border: 1px solid rgba(76, 175, 80, 0.4);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.4); max-width: 400px; width: 90%;
    text-align: center; transform: scale(0.95); transition: transform 0.3s ease;
}
.modal-overlay.active .modal-content { transform: scale(1); }
.modal-pepe-face {
    width: 100px; height: 100px; margin: 0 auto 1rem auto; border-radius: 0.5rem;
    overflow: hidden; border: 2px solid #66806a; background-color: #4a6a4f;
}
.modal-pepe-face img { display: block; width: 100%; height: 100%; object-fit: cover; }
.modal-card-name { font-size: 1.2rem; font-weight: 700; color: #4caf50; margin-bottom: 0.5rem; }
.modal-pepe-comment { font-size: 0.9rem; font-style: italic; color: #c0d0c5; margin-bottom: 1.5rem; min-height: 40px;}
.modal-button {
    background: linear-gradient(to right, #4caf50, #81c784); color: white; padding: 0.6rem 1.2rem;
    border: none; border-radius: 9999px; font-weight: 600; cursor: pointer;
    transition: all 0.3s ease; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}
 .modal-button:hover { transform: translateY(-2px); box-shadow: 0 6px 8px rgba(0, 0, 0, 0.25); }

 #download-button {
    background: linear-gradient(to right, #6a4f6b, #9a7fbf);
    display: none; /* It will be hidden until a reading is complete */
}
#download-button:hover {
    background: linear-gradient(to right, #5a3f5b, #8a6fbf);
}

/* Style for the displayed user question */
#question-display-area {
    background-color: rgba(100, 100, 100, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}
#question-display-area h2 {
    color: #cccccc;
}
#question-display-text {
    color: #e0e0e0;
    font-size: 1rem;
}