/* WP Wordle Unlimited Styles - v1.4.5 */
.wp-wordle-unlimited-container {
    max-width: 500px;
    margin: 20px auto;
    padding: 15px;
    font-family: inherit; 
    background-color: #ffffff;
    color: #1a202c;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
    transition: background-color 0.3s, color 0.3s;
}

.wp-wordle-unlimited-grid-tile,
.wp-wordle-unlimited-key,
.wp-wordle-unlimited-modal-content h2,
.wp-wordle-unlimited-modal-content p,
.wp-wordle-unlimited-modal-content button,
.stats-display-area .stat-item span, 
.stats-display-area .stat-item strong,
#wp-wordle-unlimited-modal-endgame-stats h4 { /* Ensured Roboto for this heading */
    font-family: Roboto, sans-serif; 
}


.wp-wordle-unlimited-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 10px;
}
.wp-wordle-header-title-area {
    flex-grow: 1; 
    text-align: center; 
    margin-left: auto; 
    margin-right: auto; 
}
.wp-wordle-header-title-area h1 {
    margin: 0;
    font-size: 1.8em; 
    color: inherit; 
    font-family: inherit; 
    display: inline-block; 
}
.wp-wordle-header-controls { 
    display: flex;
    gap: 8px; 
    align-items: center;
    flex-basis: auto; 
}
.wp-wordle-header-controls.left-controls {
    justify-content: flex-start;
    min-width: 40px; 
}
.wp-wordle-header-controls.right-controls {
    justify-content: flex-end;
    min-width: 120px; 
}


.wp-wordle-icon-button {
    background: none;
    border: none;
    padding: 5px;
    cursor: pointer;
    color: #4a5568; 
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, color 0.2s;
}
.wp-wordle-icon-button:hover {
    background-color: rgba(0,0,0,0.05);
}
.wp-wordle-icon-button .material-icons-outlined {
    font-size: 24px;
}


.wp-wordle-unlimited-message-area {
    min-height: 25px; 
    margin: 10px 0;
    font-weight: 500;
    text-align: center;
    font-size: 0.95em;
    color: #4a5568;
    transition: color 0.3s;
}
.wp-wordle-unlimited-message-area.win { color: #48bb78; font-weight: bold; }
.wp-wordle-unlimited-message-area.loss { color: #f56565; font-weight: bold; }
.wp-wordle-unlimited-message-area.error { color: #ed8936; }
.wp-wordle-unlimited-message-area.info { color: #718096; }


/* Grid */
.wp-wordle-unlimited-grid {
    display: grid;
    grid-template-rows: repeat(6, 1fr);
    gap: 5px;
    width: 100%;
    max-width: 330px;
    margin-bottom: 20px;
}
.wp-wordle-unlimited-grid-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 5px;
}
.wp-wordle-unlimited-grid-tile {
    width: 100%;
    aspect-ratio: 1 / 1;
    border: 2px solid #d3d6da;
    display: flex; 
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    font-weight: bold;
    text-transform: uppercase;
    color: #1a202c;
    background-color: #fff;
    box-sizing: border-box;
    transition: transform 0.6s, background-color 0.3s, border-color 0.3s, color 0.3s;
    transform-style: preserve-3d;
}
.wp-wordle-unlimited-grid-tile span { 
    display: block;
}

.wp-wordle-unlimited-grid-tile.filled { border-color: #878a8c; }
.wp-wordle-unlimited-grid-tile.correct,
.wp-wordle-unlimited-grid-tile.present,
.wp-wordle-unlimited-grid-tile.absent { color: #fff; }

/* Example tile styling for Intro Modal */
#wp-wordle-unlimited-modal-intro-body .wp-wordle-grid-tile.example {
    width: 40px; 
    height: 40px;
    font-size: 1.5rem;
    border-width: 2px; 
    display: flex; 
    justify-content: center;
    align-items: center;
}
#wp-wordle-unlimited-modal-intro-body .wp-wordle-grid-tile.example span {
    display: block; 
}

#wp-wordle-unlimited-modal-intro-body .wp-wordle-grid-tile.example.correct { background-color: #6aaa64; border-color: #6aaa64; color: #fff;}
#wp-wordle-unlimited-modal-intro-body .wp-wordle-grid-tile.example.present { background-color: #c9b458; border-color: #c9b458; color: #fff;}
#wp-wordle-unlimited-modal-intro-body .wp-wordle-grid-tile.example.absent { background-color: #787c7e; border-color: #787c7e; color: #fff;}


.wp-wordle-unlimited-grid-tile.correct { background-color: #6aaa64; border-color: #6aaa64; }
.wp-wordle-unlimited-grid-tile.present { background-color: #c9b458; border-color: #c9b458; }
.wp-wordle-unlimited-grid-tile.absent { background-color: #787c7e; border-color: #787c7e; }
.wp-wordle-unlimited-grid-tile.flip { animation: flipTile 0.5s forwards; } 

@keyframes flipTile {
    0% { transform: rotateX(0deg); }
    50% { transform: rotateX(90deg); background-color: #e2e8f0; } 
    100% { transform: rotateX(0deg); }
}

/* Keyboard */
.wp-wordle-unlimited-keyboard {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    max-width: 480px;
}
.wp-wordle-unlimited-keyboard-row { display: flex; justify-content: center; gap: 6px; }
.wp-wordle-unlimited-key {
    flex: 1;
    height: 50px;
    font-size: 0.9em;
    font-weight: bold;
    background-color: #d3d6da;
    color: #1a202c;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-transform: uppercase;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.2s, color 0.2s;
    padding: 0 5px;
    box-sizing: border-box;
    min-width: 30px;
}
.wp-wordle-unlimited-key:hover { background-color: #b9bcc0; }
.wp-wordle-unlimited-key.key-enter { flex: 1.5; font-size: 0.8em; }
.wp-wordle-unlimited-key.key-backspace {
    flex: 1.5;
}
.wp-wordle-unlimited-key.key-backspace .material-icons-outlined {
    font-size: 20px; 
}
.wp-wordle-unlimited-key.correct { background-color: #6aaa64 !important; color: white; }
.wp-wordle-unlimited-key.present { background-color: #c9b458 !important; color: white; }
.wp-wordle-unlimited-key.absent { background-color: #787c7e !important; color: white; }

/* Game Actions (Give Up Button) */
.wp-wordle-game-actions {
    margin-top: 15px;
    width: 100%;
    text-align: center;
}
#wp-wordle-give-up.wp-wordle-text-button { 
    background-color: #1a202c; 
    border: 1px solid #1a202c;
    color: #ffffff; 
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 500;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}
#wp-wordle-give-up.wp-wordle-text-button:hover { 
    background-color: #2d3748; 
    border-color: #2d3748;
}


/* Shake animation */
.shake { animation: shakeRow 0.5s; }
@keyframes shakeRow {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Modal Styles (Common) */
.wp-wordle-unlimited-modal {
    display: none; 
    position: fixed;
    z-index: 10000; 
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow-y: auto; 
    background-color: rgba(0,0,0,0.6);
    display: flex; 
    align-items: center;
    justify-content: center;
    padding: 20px; 
    box-sizing: border-box;
}
.wp-wordle-unlimited-modal-content {
    background-color: #fff;
    color: #1a202c;
    padding: 25px;
    border-radius: 8px;
    width: 100%;
    max-width: 450px; 
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    text-align: left; 
    position: relative;
    animation: fadeInModal 0.3s ease-out;
    max-height: 90vh; 
    overflow-y: auto; 
}
@keyframes fadeInModal {
    from { opacity: 0; transform: scale(0.95) translateY(-10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.wp-wordle-unlimited-modal-close {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 32px; 
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}
.wp-wordle-unlimited-modal-close:hover { color: #333; }

.wp-wordle-unlimited-modal-content h2 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.6em;
    color: inherit;
    text-align: center;
}
.wp-wordle-unlimited-modal-content p {
    margin-bottom: 10px;
    line-height: 1.6;
}
.wp-wordle-unlimited-modal-actions {
    margin-top: 20px;
    text-align: center;
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}
.wp-wordle-unlimited-modal-actions .wp-wordle-unlimited-button {
    color: white;
    padding: 10px 18px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
    transition: background-color 0.2s, transform 0.1s;
    min-width: 120px; 
}
.wp-wordle-unlimited-modal-actions .wp-wordle-unlimited-button:hover { opacity: 0.9; }
.wp-wordle-unlimited-modal-actions .wp-wordle-unlimited-button:active { transform: translateY(1px); }

/* Specific Modal Button Colors */
#wp-wordle-unlimited-modal-play-next, 
#wp-wordle-unlimited-modal-intro-close, 
#wp-wordle-unlimited-modal-confirm-yes,
#wp-wordle-unlimited-modal-stats-close { 
    background-color: #48bb78; /* Green */
}
#wp-wordle-unlimited-modal-challenge { background-color: #ed8936; /* Orange for challenge */ }
#wp-wordle-unlimited-modal-confirm-no { background-color: #718096; /* Gray */ }
.wp-wordle-unlimited-button.secondary { background-color: #a0aec0; } 


/* Intro Modal Specifics */
#wp-wordle-unlimited-modal-intro-body .wp-wordle-example-row {
    display: flex;
    gap: 5px;
    margin-bottom: 5px;
    justify-content: center; 
}
#wp-wordle-unlimited-modal-intro-body .wp-wordle-grid-tile.example {
    width: 40px; 
    height: 40px;
    font-size: 1.5rem;
    border-width: 2px; 
    display: flex; 
    justify-content: center;
    align-items: center;
}
#wp-wordle-unlimited-modal-intro-body .wp-wordle-grid-tile.example span {
    display: block; 
}

#wp-wordle-unlimited-modal-intro-body .wp-wordle-grid-tile.example.correct { background-color: #6aaa64; border-color: #6aaa64; color: #fff;}
#wp-wordle-unlimited-modal-intro-body .wp-wordle-grid-tile.example.present { background-color: #c9b458; border-color: #c9b458; color: #fff;}
#wp-wordle-unlimited-modal-intro-body .wp-wordle-grid-tile.example.absent { background-color: #787c7e; border-color: #787c7e; color: #fff;}

#wp-wordle-unlimited-modal-intro-body hr {
    border: 0;
    border-top: 1px solid #e0e0e0;
    margin: 15px 0;
}

/* End Game Modal Specifics */
#wp-wordle-unlimited-modal-endgame-resulttext { text-align: center; margin-bottom: 10px; }
.shareable-result-grid {
    font-family: monospace;
    white-space: pre;
    font-size: 1.3em;
    line-height: 1.1;
    background-color: #f7fafc;
    padding: 10px;
    border-radius: 4px;
    display: block; 
    text-align: center; 
    margin: 10px auto;
    border: 1px solid #e2e8f0;
    max-width: max-content; 
}
#wp-wordle-unlimited-modal-endgame-stats { 
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dashed #e0e0e0;
}
#wp-wordle-unlimited-modal-endgame-stats h4 { 
    text-align: center;
    margin-bottom: 10px; 
    font-size: 1.2em;
    font-weight: 500;
    color: inherit; 
    font-family: Roboto, sans-serif !important; 
}

.word-definition-area {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
    font-size: 0.9em;
}
.word-definition-area p { margin-bottom: 5px; }
.word-definition-area strong { color: #2d3748; }
.word-definition-area em { color: #718096; }
.word-definition-area a { color: #4299e1; text-decoration: underline; }

/* Stats Modal Specifics & End Game Modal Stats - REVAMPED FOR SINGLE ROW */
.stats-display-area.stats-grid {
    display: flex;
    flex-direction: row; /* Force items into a single row */
    justify-content: space-around; /* Distribute space around items */
    align-items: flex-start; /* Align items to the top of the row */
    flex-wrap: nowrap; /* Prevent wrapping to new lines */
    width: 100%;
    margin-top: 10px;
    padding-bottom: 5px; /* For potential scrollbar */
    overflow-x: auto; /* Allow horizontal scrolling if items overflow */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

.stats-display-area.stats-grid .stat-item {
    display: flex;
    flex-direction: column; /* Stack number (strong) above label (span) */
    align-items: center; /* Center content of each stat item */
    text-align: center;
    padding: 0 10px; /* Horizontal padding for spacing between items */
    flex: 0 1 auto; /* Allow shrinking, don't grow, basis is auto */
    min-width: 60px; /* Minimum width for each stat item */
}

.stats-display-area.stats-grid .stat-item strong {
    font-size: 2.2em; /* Large number for the stat value */
    font-weight: bold;
    line-height: 1;
    display: block;
    color: #1a202c; /* Default color for stat value */
    margin-bottom: 3px; /* Space between value and label */
}

.stats-display-area.stats-grid .stat-item span {
    font-size: 0.7em; /* Smaller label text */
    text-transform: uppercase;
    color: #718096; /* Subdued color for the label */
    line-height: 1.1;
    display: block;
    white-space: nowrap; /* Prevent label from wrapping */
}

.stats-display-area p { /* For "No stats yet" message, if not using grid */
    text-align: center;
    color: #718096;
    margin-top: 10px;
    width: 100%; 
}


/* --- Dark Mode --- */
.wp-wordle-unlimited-container.dark-mode {
    background-color: #1a202c; 
    color: #e2e8f0; 
}
.wp-wordle-unlimited-container.dark-mode .wp-wordle-header {
    border-bottom-color: #2d3748; 
}
.wp-wordle-unlimited-container.dark-mode .wp-wordle-icon-button {
    color: #a0aec0; 
}
.wp-wordle-unlimited-container.dark-mode .wp-wordle-icon-button:hover {
    background-color: rgba(255,255,255,0.08);
}
.wp-wordle-unlimited-container.dark-mode .wp-wordle-unlimited-message-area { color: #a0aec0; }
.wp-wordle-unlimited-container.dark-mode .wp-wordle-unlimited-message-area.win { color: #68d391; } 
.wp-wordle-unlimited-container.dark-mode .wp-wordle-unlimited-message-area.loss { color: #fc8181; } 
.wp-wordle-unlimited-container.dark-mode .wp-wordle-unlimited-message-area.error { color: #f6ad55; } 
.wp-wordle-unlimited-container.dark-mode .wp-wordle-unlimited-message-area.info { color: #a0aec0; }

.wp-wordle-unlimited-container.dark-mode .wp-wordle-unlimited-grid-tile {
    background-color: #2d3748; 
    border-color: #4a5568;    
    color: #e2e8f0;           
}
.wp-wordle-unlimited-container.dark-mode .wp-wordle-unlimited-grid-tile.filled {
    border-color: #718096; 
}
.wp-wordle-unlimited-container.dark-mode .wp-wordle-unlimited-grid-tile.correct { background-color: #579047; border-color: #579047; color: #fff;} 
.wp-wordle-unlimited-container.dark-mode .wp-wordle-unlimited-grid-tile.present { background-color: #b59f3b; border-color: #b59f3b; color: #fff;} 
.wp-wordle-unlimited-container.dark-mode .wp-wordle-unlimited-grid-tile.absent { background-color: #3a3a3c; border-color: #3a3a3c; color: #fff;} 

/* Dark mode example tiles */
.wp-wordle-unlimited-container.dark-mode #wp-wordle-unlimited-modal-intro-body .wp-wordle-grid-tile.example.correct { background-color: #579047; border-color: #579047; color: #fff;}
.wp-wordle-unlimited-container.dark-mode #wp-wordle-unlimited-modal-intro-body .wp-wordle-grid-tile.example.present { background-color: #b59f3b; border-color: #b59f3b; color: #fff;}
.wp-wordle-unlimited-container.dark-mode #wp-wordle-unlimited-modal-intro-body .wp-wordle-grid-tile.example.absent { background-color: #3a3a3c; border-color: #3a3a3c; color: #fff;}
.wp-wordle-unlimited-container.dark-mode #wp-wordle-unlimited-modal-intro-body .wp-wordle-grid-tile.example {
    background-color: #2d3748; 
    border-color: #4a5568;    
    color: #e2e8f0;           
}


.wp-wordle-unlimited-container.dark-mode .wp-wordle-unlimited-key {
    background-color: #4a5568; 
    color: #e2e8f0; 
}
.wp-wordle-unlimited-container.dark-mode .wp-wordle-unlimited-key:hover {
    background-color: #718096;
}
.wp-wordle-unlimited-container.dark-mode .wp-wordle-unlimited-key.correct { background-color: #579047 !important; color: #fff; }
.wp-wordle-unlimited-container.dark-mode .wp-wordle-unlimited-key.present { background-color: #b59f3b !important; color: #fff; }
.wp-wordle-unlimited-container.dark-mode .wp-wordle-unlimited-key.absent { background-color: #3a3a3c !important; color: #fff; }

/* Dark Mode Give Up Button */
.wp-wordle-unlimited-container.dark-mode #wp-wordle-give-up.wp-wordle-text-button {
    background-color: #e53e3e; /* Red background */
    border-color: #c53030; /* Darker red border */
    color: #ffffff; /* White text */
}
.wp-wordle-unlimited-container.dark-mode #wp-wordle-give-up.wp-wordle-text-button:hover {
    background-color: #c53030;
    border-color: #9b2c2c;
}


.wp-wordle-unlimited-container.dark-mode .wp-wordle-unlimited-modal-content {
    background-color: #2d3748; 
    color: #e2e8f0; 
}
.wp-wordle-unlimited-container.dark-mode .wp-wordle-unlimited-modal-close { color: #718096; }
.wp-wordle-unlimited-container.dark-mode .wp-wordle-unlimited-modal-close:hover { color: #e2e8f0; }
.wp-wordle-unlimited-container.dark-mode #wp-wordle-unlimited-modal-intro-body hr { border-top-color: #4a5568; }
.wp-wordle-unlimited-container.dark-mode .shareable-result-grid {
    background-color: #1a202c;
    border-color: #4a5568;
}
.wp-wordle-unlimited-container.dark-mode .word-definition-area { border-top-color: #4a5568; }
.wp-wordle-unlimited-container.dark-mode .word-definition-area strong { color: #cbd5e0; }
.wp-wordle-unlimited-container.dark-mode .word-definition-area em { color: #a0aec0; }
.wp-wordle-unlimited-container.dark-mode .word-definition-area a { color: #63b3ed; }

.wp-wordle-unlimited-container.dark-mode .stats-display-area.stats-grid .stat-item strong {
    color: #e2e8f0;
}
.wp-wordle-unlimited-container.dark-mode .stats-display-area.stats-grid .stat-item span {
    color: #a0aec0;
}
.wp-wordle-unlimited-container.dark-mode .stats-display-area p {
    color: #a0aec0;
}
.wp-wordle-unlimited-container.dark-mode #wp-wordle-unlimited-modal-endgame-stats {
    border-top-color: #4a5568;
}
.wp-wordle-unlimited-container.dark-mode #wp-wordle-unlimited-modal-endgame-stats h4 {
    color: #e2e8f0;
}


/* Responsive Adjustments */
@media (max-width: 480px) {
    .wp-wordle-unlimited-container { margin: 10px; padding: 10px; }
    .wp-wordle-header-title-area h1 { font-size: 1.5em; }
    .wp-wordle-icon-button .material-icons-outlined { font-size: 22px; }
    .wp-wordle-unlimited-grid { max-width: 100%; gap: 4px; } 
    .wp-wordle-unlimited-grid-row { gap: 4px; }
    .wp-wordle-unlimited-grid-tile { font-size: 1.5rem; }
    .wp-wordle-unlimited-keyboard { gap: 4px; padding: 0 2px; }
    .wp-wordle-unlimited-key { height: 45px; font-size: 0.8em; min-width: auto; flex-grow: 1; flex-basis: 0; } 
    .wp-wordle-unlimited-key.key-enter,
    .wp-wordle-unlimited-key.key-backspace { font-size: 0.7em; flex-grow: 1.5; }
     .wp-wordle-unlimited-key.key-backspace .material-icons-outlined { font-size: 18px; }

    .wp-wordle-unlimited-modal-content { padding: 20px; max-width: 95%; }
    .wp-wordle-unlimited-modal-content h2 { font-size: 1.4em; }
    .wp-wordle-unlimited-modal-actions .wp-wordle-unlimited-button { font-size: 0.9em; padding: 8px 12px; min-width: 100px;}
    
    /* Stats grid for smaller screens - 2x2 layout */
    .stats-display-area.stats-grid { 
        display: grid; /* Switch to grid for 2x2 */
        grid-template-columns: repeat(2, 1fr); 
        grid-template-rows: repeat(2, auto);    
        gap: 15px; 
        justify-items: center; 
        flex-wrap: wrap; /* Keep wrap for grid, though grid should control it */
        overflow-x: visible; /* Not needed for grid */
    }
    .stats-display-area.stats-grid .stat-item {
        min-width: 0; 
        flex-basis: auto; /* Not strictly needed for grid items but harmless */
        padding: 5px; 
    }
    .stats-display-area.stats-grid .stat-item strong { font-size: 1.6em; } 
    .stats-display-area.stats-grid .stat-item span { font-size: 0.7em; }

}

@media (max-width: 360px) {
     .wp-wordle-unlimited-grid-tile { font-size: 1.2rem; }
     .wp-wordle-header-title-area h1 { font-size: 1.3em; }
     .wp-wordle-icon-button .material-icons-outlined { font-size: 20px; }
     .wp-wordle-unlimited-key { height: 40px; font-size: 0.75em; } 
     .wp-wordle-unlimited-key.key-backspace .material-icons-outlined { font-size: 16px; }
     .stats-display-area.stats-grid .stat-item strong { font-size: 1.5em; } 
     .stats-display-area.stats-grid .stat-item span { font-size: 0.65em; }
     .stats-display-area.stats-grid {
        gap: 10px; /* Slightly smaller gap for very small screens */
     }
}

