/* 1. FONT & BASE STYLES */
@import url('https://fonts.googleapis.com/css2?family=Quicksand:wght@400;600;700&display=swap');

/* GLOBAL FONT FORCE */
* { 
    font-family: 'Quicksand', sans-serif; 
    box-sizing: border-box;
}

/* Force Quicksand on Exolve elements specifically */
#exolve-container, #exolve-container *, .exolve-clue, .exolve-grid-text, .exolve-btn {
    font-family: 'Quicksand', sans-serif !important;
}

body { 
    background-color: #f3e5f5; 
    color: #4a148c; 
    margin: 0;
    padding: 140px 15px 40px 15px; 
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
}

/* 2. THE TOP BAR (Logo & Navigation) */
.top-bar {
    position: fixed; 
    top: 0; left: 0; width: 100%;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(243, 229, 245, 0.95);
    backdrop-filter: blur(10px);
    z-index: 1000;
    border-bottom: 1px solid rgba(106, 27, 154, 0.1);
}

.logo-link { text-decoration: none; transition: transform 0.2s ease; -webkit-tap-highlight-color: transparent; }
.logo-link:hover { transform: scale(1.05); }

.logo-cryptiz { display: flex; gap: 3px; }
.logo-cryptiz span {
    width: 32px; height: 32px;
    background: white; border: 2px solid #4a148c;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 1.1rem; color: #4a148c;
    box-shadow: 2px 2px 0px #ce93d8; text-transform: uppercase;
}

.top-nav { display: flex; gap: 10px; }
.nav-button {
    background: white; padding: 8px 18px; border-radius: 20px;
    text-decoration: none; color: #7b1fa2; font-weight: 600; font-size: 0.85rem;
    box-shadow: 0 4px 10px rgba(106, 27, 154, 0.1);
    transition: all 0.3s ease; border: 1px solid rgba(206, 147, 216, 0.3);
}

/* 3. PUZZLE CARDS (Top-Left Tile Lock) */
.puzzle-list { display: grid; grid-template-columns: repeat(2, minmax(0, 320px)); gap: 25px; justify-content: center; width: 100%; max-width: 1100px; }


.puzzle-card { 
    display: block; padding: 25px; background: #ffffff; border-radius: 20px; 
    text-decoration: none; color: #4a148c; width: 100%; max-width: 320px; 
    transition: all 0.3s ease;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05); border: 1px solid rgba(206, 147, 216, 0.2);
}

.puzzle-card:hover { transform: translateY(-8px); box-shadow: 0 15px 35px rgba(106, 27, 154, 0.15); }

.card-content { 
    display: flex; 
    align-items: flex-start; 
    gap: 15px; 
}

.puzzle-tile {
    width: 55px; height: 55px; background: white; border: 2px solid #4a148c;
    border-radius: 4px; flex-shrink: 0; position: relative;
    box-shadow: 3px 3px 0px #ce93d8;
    margin-top: 4px; 
}

.tile-number { 
    position: absolute; top: 2px; left: 4px; 
    font-size: 0.75rem; font-weight: 800; color: #4a148c;
}

.card-text-wrapper h3 { margin: 0 0 5px 0; font-size: 1.2rem; line-height: 1.2; }
.upload-date { font-size: 0.8rem; color: #9c27b0; font-style: italic; opacity: 0.7; }

/* 4. EXOLVE WIDGET (Centering & Customizing) */
#exolve-container {
    background-color: #f3e5f5 !important; border-radius: 25px !important;
    padding: 25px !important; margin: 20px auto !important;
    width: 92% !important; max-width: 800px !important;
}

#exolve-container .exolve-title, 
#exolve-container .exolve-setter, 
#xlv-preamble, 
.exolve-preamble,
div[id$="-preamble"] {
    text-align: center !important;
    display: block !important;
    margin-left: auto !important;
    margin-right: auto !important;
    width: 100% !important;
}

.exolve-preamble { font-style: italic; color: #7b1fa2; margin-bottom: 20px !important; opacity: 0.9; }
.exolve-setter { font-size: 0.9rem; margin-bottom: 10px; opacity: 0.7; }

.exolve-grid-svg { margin: 0 auto !important; display: block !important; max-width: 100% !important; height: auto !important; }

/* Underlines in Clues */
.exolve-clue u { text-decoration: none; border-bottom: 2px solid #ce93d8; padding-bottom: 1px; }

/* Buttons */
.exolve-btn {
    background-color: #7b1fa2 !important; color: white !important;
    border-radius: 12px !important; border: none !important;
    padding: 10px 20px !important; margin: 5px !important; cursor: pointer;
    font-weight: 600 !important; transition: all 0.2s;
}
.exolve-btn:hover { background-color: #9c27b0 !important; transform: translateY(-1px); }

/* 5. SUCCESS OVERLAY */
#custom-success-message {
    display: none; 
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(243, 229, 245, 0.9);
    backdrop-filter: blur(10px);
    z-index: 10000;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 15px;
    animation: fadeIn 0.5s ease-out;
}

.success-card {
    background: white;
    padding: 30px;
    border-radius: 25px;
    border: 2px solid #4a148c;
    box-shadow: 8px 8px 0px #ce93d8;
    max-width: 450px;
    width: 100%;
    box-sizing: border-box;
}

#custom-success-message h1 { font-weight: 700; font-size: 2.2rem; color: #4a148c; margin: 0 0 10px 0; }
#custom-success-message p { font-size: 1rem; color: #7b1fa2; margin-bottom: 25px; font-weight: 600; line-height: 1.4; }

.success-button-group { display: flex; flex-direction: column; gap: 12px; }
.success-btn-main {
    background-color: #7b1fa2; color: white !important;
    padding: 12px 25px; border-radius: 15px; text-decoration: none;
    font-weight: 700; font-size: 1rem; border: none; cursor: pointer;
    transition: all 0.2s ease; box-shadow: 0 4px 10px rgba(106, 27, 154, 0.2);
}
.success-btn-main:hover { background-color: #9c27b0; transform: translateY(-2px); }

.success-btn-secondary {
    background: white; color: #7b1fa2 !important;
    padding: 10px 20px; border-radius: 15px; text-decoration: none;
    font-weight: 600; font-size: 0.9rem; border: 1px solid #ce93d8;
    cursor: pointer; transition: all 0.2s ease;
}
.success-btn-secondary:hover { background: #f3e5f5; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 6. SUBMISSION FORM */
.clue-form { display: flex; flex-direction: column; gap: 15px; margin-top: 20px; text-align: left; }
.input-group { display: flex; flex-direction: column; gap: 5px; }
.input-group label { font-weight: 600; color: #7b1fa2; font-size: 0.9rem; }
.input-group input, .input-group textarea {
    padding: 12px; border-radius: 12px; border: 2px solid #ce93d8; outline: none;
}
.input-group input:focus, .input-group textarea:focus { border-color: #7b1fa2; background: #fdfbff; }

/* 7. MOBILE OVERRIDES (Balanced Centering & Keyboard) */
@media (max-width: 600px) {
    body { 
        padding-top: 170px; 
        padding-left: 10px !important; 
        padding-right: 10px !important;
        /* This creates a safe zone at the very bottom of the page */
        padding-bottom: 80px !important; 
    }
    .puzzle-list { grid-template-columns: 1fr; justify-items: center; }
    .top-bar { flex-direction: column; gap: 12px; padding: 15px; }
    
    #exolve-container { 
        width: 100% !important; 
        padding: 15px 5px !important; 
        margin: 10px 0 !important;
        border-radius: 15px !important;
    }

    /* Fix Success Message on Mobile */
    .success-card { padding: 20px; }
    #custom-success-message h1 { font-size: 1.8rem; }
    #custom-success-message p { font-size: 0.95rem; }
    .success-btn-main, .success-btn-secondary { width: 100%; padding: 12px; }

    /* ENLARGE VIRTUAL KEYBOARD & FORCE BOTTOM BUFFER */
    /* Target the specific keyboard container and the area below it */
    .exolve-kb-row:last-child {
        margin-bottom: 40px !important; /* Forces space below the last row of keys */
    }

    #xlv-buttons, .exolve-controls {
        margin-bottom: 20px !important;
    }

    .exolve-key {
        min-width: 34px !important; 
        height: 44px !important;
        font-size: 1.1rem !important;
        margin: 2px !important;
        border-radius: 8px !important;
    }
    
    .exolve-grid-svg {
        margin: 0 auto !important;
        display: block !important;
    }
}

/* 8. ARTICLES & STATIC CONTENT */
article {
    max-width: 700px; background: white; padding: 30px;
    border-radius: 25px; box-shadow: 8px 8px 0px #ce93d8; margin: 20px auto;
}