/* Basic styling for the clear button */
.clear-button {
    margin: 20px auto;
    padding: 10px 20px;
    font-size: 1rem;
    border: none;
    border-radius: 5px;
    background-color: #dc3545;
    color: white;
    cursor: pointer;
    display: block;
    font-family: 'Inter', sans-serif;
    transition: background-color 0.2s;
}

.clear-button:hover {
    background-color: #c82333;
}

.clear-button:active {
    background-color: #bd2130;
}

body {
    font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif;
    text-align: center;
    padding: 20px;
    margin: 0;
    min-height: 100vh;
    box-sizing: border-box;
}

/* Header image responsive sizing */
body > img {
    max-width: 300px !important;
    width: 90%;
    height: auto !important;
    margin-bottom: 20px !important;
}

/* Section styling for better mobile readability */
section {
    max-width: 600px;
    margin: 0 auto 30px auto;
    text-align: left;
    padding: 0 10px;
}

section h2 {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 15px;
}

section p {
    font-size: 1rem;
    line-height: 1.6;
    color: #333;
}

.wordle-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin: 30px auto 20px auto;
    padding: 0 20px;
    max-width: 350px;
}

.wordle-row {
    display: flex;
    justify-content: center;
    gap: 4px;
    flex-wrap: nowrap;
}

.letter-box {
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    font-weight: bold;
    text-transform: uppercase;
    text-align: center;
    border: 2px solid #d3d6da;
    border-radius: 4px;
    box-sizing: border-box;
    transition: all 0.2s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-color: white;
}

.letter-box:focus {
    outline: none;
    border-color: #878a8c;
    box-shadow: none;
}

.letter-box:disabled {
    background-color: #f0f0f0;
    color: #ccc;
    cursor: not-allowed;
    border-color: #e0e0e0;
}

.letter-box.green {
    background-color: #6aaa64;
    color: white;
    border-color: #6aaa64;
}

.letter-box.yellow {
    background-color: #c9b458;
    color: white;
    border-color: #c9b458;
}

.letter-box.grey {
    background-color: #787c7e;
    color: white;
    border-color: #787c7e;
}

#results {
    max-height: 400px;
    overflow-y: auto;
    border-top: 1px solid #eee;
    padding: 20px 10px;
    display: none;
    margin: 0 auto;
    max-width: 800px;
}

#wordList {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 8px;
    list-style: none;
    padding: 0;
    margin: 0 auto;
    max-width: 600px;
}

#wordList li {
    text-align: center;
    font-size: 1rem;
    padding: 8px 4px;
    background-color: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #e9ecef;
    font-weight: 500;
}

ul {
    list-style: none;
    padding: 0;
}

li {
    font-size: 1rem;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

.row-status {
    font-size: 0.8rem;
    color: #666;
    margin-top: 5px;
    font-style: italic;
}

/* Ad container responsive */
#ad-container {
    margin: 30px auto;
    padding: 0 20px;
    max-width: 600px;
}

/* Footer responsive styling */
footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px 10px;
    border-top: 1px solid #ccc;
    font-size: 0.9rem;
}

footer a {
    text-decoration: none;
    color: #666;
    margin: 0 10px;
    display: inline-block;
    padding: 5px;
}

footer a:hover {
    color: #4CAF50;
}

/* Tablet styles */
@media (max-width: 768px) and (min-width: 481px) {
    body {
        padding: 30px 20px;
    }

    body > img {
        max-width: 250px !important;
        width: 60%;
    }

    .letter-box {
        width: 55px;
        height: 55px;
        font-size: 1.6rem;
    }

    .wordle-grid {
        gap: 5px;
        max-width: 320px;
    }

    .wordle-row {
        gap: 5px;
    }

    #wordList {
        grid-template-columns: repeat(4, 1fr);
        gap: 12px;
    }

    #wordList li {
        font-size: 1.1rem;
        padding: 10px 6px;
    }

    section h2 {
        font-size: 1.6rem;
    }
}

/* Mobile styles */
@media (max-width: 480px) {
    body {
        padding: 15px 10px;
    }

    body > img {
        max-width: 200px !important;
        width: 80%;
        margin-bottom: 15px !important;
    }

    section {
        padding: 0 5px;
        margin-bottom: 25px;
    }

    section h2 {
        font-size: 1.3rem;
        margin-bottom: 12px;
    }

    section p {
        font-size: 0.9rem;
        line-height: 1.5;
    }

    .wordle-grid {
        gap: 3px;
        margin: 25px auto 15px auto;
        padding: 0 10px;
        max-width: 250px;
    }

    .wordle-row {
        gap: 3px;
    }

    .letter-box {
        width: 45px;
        height: 45px;
        font-size: 1.3rem;
        border-radius: 6px;
    }

    #results {
        max-height: 300px;
        padding: 15px 5px;
    }

    #wordList {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
        max-width: 100%;
    }

    #wordList li {
        font-size: 0.9rem;
        padding: 6px 3px;
        border-radius: 3px;
    }

    #ad-container {
        margin: 25px auto;
        padding: 0 10px;
    }

    footer {
        margin-top: 30px;
        padding: 15px 5px;
        font-size: 0.8rem;
    }

    footer a {
        margin: 0 5px;
        padding: 3px;
        display: inline-block;
        line-height: 1.4;
    }

    .row-status {
        font-size: 0.7rem;
        margin-top: 3px;
    }
}

/* Very small mobile devices */
@media (max-width: 320px) {
    .wordle-grid {
        gap: 2px;
        padding: 0 5px;
        max-width: 220px;
    }

    .wordle-row {
        gap: 2px;
    }

    .letter-box {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }

    #wordList {
        grid-template-columns: repeat(2, 1fr);
        gap: 5px;
    }

    #wordList li {
        font-size: 0.85rem;
        padding: 8px 4px;
    }

    footer a {
        display: block;
        margin: 5px 0;
        padding: 8px;
    }
}

/* Landscape orientation on mobile */
@media (max-height: 500px) and (orientation: landscape) {
    body {
        padding: 10px;
    }

    body > img {
        max-width: 120px !important;
        width: 25%;
        margin-bottom: 10px !important;
    }

    section {
        margin-bottom: 15px;
    }

    section h2 {
        font-size: 1.2rem;
        margin-bottom: 8px;
    }

    section p {
        font-size: 0.8rem;
        line-height: 1.4;
    }

    .wordle-grid {
        margin: 15px auto 10px auto;
        gap: 3px;
    }

    .wordle-row {
        gap: 3px;
    }

    .letter-box {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }

    #results {
        max-height: 200px;
        padding: 10px 5px;
    }

    footer {
        margin-top: 20px;
        padding: 10px 5px;
    }

    .row-status {
        font-size: 0.6rem;
        margin-top: 2px;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .letter-box {
        border-width: 1.5px;
    }
}

/* Improve touch targets */
@media (pointer: coarse) {
    .letter-box {
        min-height: 44px;
        min-width: 44px;
    }

    footer a {
        min-height: 44px;
        padding: 10px;
    }
}

/* Ultra-aggressive mobile ad fixes */
@media (max-width: 768px) {
    div[style*="text-align: center"] {
        margin: 3px 0 !important;
        padding: 0 !important;
        max-height: 100px !important;
        min-height: 0 !important;
        overflow: hidden !important;
    }

    .adsbygoogle,
    ins.adsbygoogle {
        max-height: 90px !important;
        min-height: 0 !important;
        margin: 2px 0 !important;
        padding: 0 !important;
        overflow: hidden !important;
        display: block !important;
    }
}

@media (max-width: 480px) {
    div[style*="text-align: center"] {
        margin: 2px 0 !important;
        max-height: 80px !important;
    }

    .adsbygoogle,
    ins.adsbygoogle {
        max-height: 70px !important;
        margin: 1px 0 !important;
    }
}

/* Hide completely empty ads */
.adsbygoogle:empty,
ins.adsbygoogle:empty {
    display: none !important;
    margin: 0 !important;
    height: 0 !important;
}