body {
    font-family: Arial, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    background-color: #f0f0f0;
}

/* Base styles for the game container */
.game-container {
    background-color: white;
    padding: 1rem;
    border-radius: 10px;
    box-sizing: border-box;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    text-align: center;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

h1 {
    color: #333;
}

/* Styles for tile containers */
#anagram, #word, #guess-input {
    display: flex;
    justify-content: center;
    flex-wrap: nowrap;
    margin: 1rem 0;
    gap: 0.25rem; /* Consistent gap between tiles */
}

/* Base tile styles */
.tile {
    display: flex;
    justify-content: center;
    align-items: center;
    aspect-ratio: 1 / 1;
    width: calc(11% - 0.25rem);
    max-width: 3rem;
    font-size: calc(1vw + 0.5rem);
    font-weight: bold;
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 4px;
    line-height: 1;
    padding: 0;
    text-align: center;
    box-sizing: border-box;	
}

#anagram .tile, #word .tile, #guess-input .tile {
    /* These styles will override the general .tile styles if needed */
    background-color: #e6f2ff;
}

/* Specific styles for different tile types */
#anagram .revealed {
    color: red;
    background-color: #ffe6e6;
}

#word .tile {
    background-color: #e6f2ff;
}

#timer, #score {
    font-size: 1.3rem;
    margin: 1rem 0;
    color: #666;
}

#guess-input-container {
    position: relative;
    margin-bottom: 1rem;
}

#guess-input .tile {
    background-color: #e6f2ff;
    cursor: text;
    font-size: 1.7rem;
    position: relative;
	caret-color: transparent;
    padding: 2px 0;	
}

#guess-input .tile:focus {
    outline: 2px solid #4CAF50;
}

#guess-input .tile:focus:empty::before {
    content: '|';
    color: #000;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    animation: blink 1s step-end infinite;
}

#hidden-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

#submit-guess {
    font-size: 1rem;
    padding: 0.5rem 1rem;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

#submit-guess:hover {
    background-color: #45a049;
}

#submit-guess:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#message {
    margin-top: 1rem;
    font-weight: bold;
}

#guesses-section {
    margin-top: 1.5rem;
    border-top: 2px solid #ccc;
    padding-top: 1rem;
}

#guesses-section h3 {
    margin-bottom: 1rem;
    color: #333;
    font-size: 1.2rem;
}

#previous-guesses {
    columns: 3;
    column-gap: 1rem;
    text-align: left;
}

#previous-guesses p {
    margin: 0;
    padding: 0.2rem 0;
}

.modal {
    position: fixed;
    z-index: 1;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.4);
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
	position: relative;
    background-color: #fefefe;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    max-width: 400px; /* Set a specific max-width */
    width: 90%; /* Allow some flexibility for smaller screens */
    box-sizing: border-box;
}

.score-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
}

.score-container p {
    margin-bottom: 5px;
}

.final-score {
    font-size: 48px;
    font-weight: bold;
    color: #4CAF50;
}

.score-modal .modal-content {
    text-align: center;
}

.game-guide-modal .modal-content {
    text-align: left;
	max-width: 500px; /* Slightly wider for the game guide */
}

.game-guide-modal .modal-content img {
    display: block;
    margin: 0 auto;
}
.game-guide-modal h2 {
    text-align: center;
}

.score-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
}

.score-container p {
    margin-bottom: 5px;
}

.final-score {
    font-size: 48px;
    font-weight: bold;
    color: #4CAF50;
}

.modal-content button {
    display: block;
    width: 100%;
    margin: 10px 0;
    padding: 10px 20px;
    font-size: 16px;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.close-button {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 24px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    background: none;
    background-color: #25D366;
    border: none;
    padding: 0;
    width: auto;
}

.close-button:hover, .close-button:focus {
    color: #000;
    background-color: #128C7E;
    text-decoration: none;
}

.challenge-button {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 10px 20px;
    margin-top: 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    width: 100%;
}

.challenge-button:hover {
    background-color: #45a049;
}

.game-guide-modal button {
    margin-top: 20px;
    background-color: #4CAF50;  /* Green color for consistency */
}

.game-guide-modal button:hover {
    background-color: #45a049;  /* Darker green on hover */
}

@keyframes shake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    50% { transform: translateX(5px); }
    75% { transform: translateX(-5px); }
    100% { transform: translateX(0); }
}

@keyframes blink {
    from, to { opacity: 0; }
    50% { opacity: 1; }
}

#score.shake {
    animation: shake 0.5s ease-in-out;
}

/* Media query for smaller screens */
@media (max-width: 480px) {
    body {
        position: fixed;
        width: 100%;
        height: 100%;
        overflow-y: scroll;
        -webkit-overflow-scrolling: touch;
    }
    
    .tile {
        font-size: 1rem; /* Fixed font size for smaller screens */
    }
	
    #guess-input .tile {
        font-size: 1.2rem;
        padding: 1px 0;		
    }

    .game-container {
        padding: 0.5rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    #timer, #score {
        font-size: 1.1rem;
    }
	
    .modal-content {
        width: 95%;
        padding: 15px;
    }	
}

/* Even smaller screens */
@media (max-width: 360px) {
    .tile {
        font-size: 0.9rem;
    }

    #guess-input .tile {
        font-size: 1.1rem;
        padding: 0;		
    }
}