@import url('https://fonts.googleapis.com/css2?family=Assistant:wght@400;700&display=swap');

/* Modern Color Palette - Refined */
:root {
    --primary-color: #2563eb; /* Stronger Blue - Tailwind's Blue-600 */
    --secondary-color: #10b981; /* Teal - Tailwind's Green-500, more modern than emerald */
    --accent-color: #ea580c; /* Orange - Tailwind's Orange-500, more vibrant */
    --background-color: #f5f5f5; /* Lighter Gray - Tailwind's Gray-100 */
    --surface-color: #ffffff; /* White */
    --text-primary: #0f172a; /* Almost Black - Tailwind's Slate-900 */
    --text-secondary: #4b5563; /* Medium Gray - Tailwind's Gray-600 */
    --shadow-color: rgba(0, 0, 0, 0.075); /* Slightly stronger shadow */
    --border-color: #e5e7eb; /* Light Gray - Tailwind's Gray-200 */
}

#round-counter {
    font-size: 3vh;
    margin-bottom: 1vh;
    color: var(--text-secondary);
    font-weight: 600; /* Semi-bold */
    display: flex;
    align-items: center;
    justify-content: center;
}

#round-number {
    margin-right: 10px;
}

#shuffle-button {
    background-color: var(--primary-color);
    color: var(--surface-color);
    padding: 0.5vh 1vw;
    border: none;
    border-radius: 8px; /* More rounded */
    cursor: pointer;
    font-size: 2vh;
    transition: background 0.3s ease, transform 0.1s ease; /* Added transform for a subtle animation */
    margin-left: 40px;
    box-shadow: 0 2px 5px var(--shadow-color); /* Subtle shadow */
}

#shuffle-button:hover {
    background-color: #1e40af; /* Slightly darker blue */
    transform: scale(1.25); /* Subtle scale on hover */
}

#shuffle-button:active {
    transform: scale(0.95); /* Smaller scale when pressed */
}

body {
    font-family: 'Assistant', sans-serif;
    background-color: var(--background-color);
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100vw;
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

.container {
    background-color: var(--surface-color);
    border-radius: 8px;
    padding: 4vh; /* Slightly increased padding */
    box-shadow: 0 6px 15px var(--shadow-color); /* Increased shadow intensity */
    text-align: center;
    max-width: 90vw;
    min-height: 90vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

h1 {
    color: var(--text-primary);
    font-size: 4.5vh; /* Slightly smaller */
    margin-bottom: 2vh;
    font-weight: 700; /* Make heading bolder */
}

#word-list {
    list-style-type: decimal;
    padding-left: 2vw;
    font-size: 2.8vh;
    color: var(--text-primary);
}

#word-list li {
    font-size: 2.8vh;
    margin-bottom: 1.5vh;
    padding: 1.5vh;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: background-color 1.5s ease; /* Smooth background transition */
}

#word-list li:hover {
    background-color: rgba(255, 255, 0, 0.9); /* Light tint of primary blue */
}

.button-container {
    display: flex;
    gap: 40px;
    justify-content: center;
    margin-bottom: 2vh;
}

button {
    background-color: var(--secondary-color);
    color: var(--surface-color);
    padding: 1.8vh 3vw;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 2.3vh;
    transition: background 0.3s ease, transform 0.1s ease;
    box-shadow: 0 2px 5px var(--shadow-color);
}

button:hover {
    background-color: #059669; /* Darker teal */
    transform: scale(1.05);
}

button:active {
    transform: scale(0.95);
}

#instructions-button {
    background-color: var(--accent-color);
    color: var(--surface-color);
    padding: 1.5vh 2.5vw;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 2.3vh;
    transition: background 0.3s ease, transform 0.1s ease;
    box-shadow: 0 2px 5px var(--shadow-color);
}

#instructions-button:hover {
    background-color: #c2410c;
    transform: scale(1.05);
}

#instructions-button:active {
    transform: scale(0.95);
}

#language-button {
    background-color: var(--accent-color);
    color: var(--surface-color);
    padding: 1.5vh 2.5vw;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 2.3vh;
    transition: background 0.3s ease, transform 0.1s ease;
    box-shadow: 0 2px 5px var(--shadow-color);
}

#language-button:hover {
    background-color: #c2410c;
    transform: scale(1.05);
}

#language-button:active {
    transform: scale(0.95);
}

/* ---- MEDIA QUERIES ---- */

@media (max-width: 600px) {
    .container {
        width: 95vw; /* Adjusted width */
        min-height: 70vh; /* Adjusted height */
        padding: 3vh;
    }

    h1 {
        font-size: 4vh;
    }

    #word-list {
        font-size: 2.3vh;
    }

    #word-list li {
        font-size: 2.3vh;
        padding: 1.2vh;
    }

    button,
    #language-button,
    #shuffle-button {
        font-size: 1.8vh;
        padding: 1.2vh 1.8vw;
    }
}

@media (max-width: 400px) {
    h1 {
        font-size: 3.5vh;
    }

    #word-list {
        font-size: 1.8vh;
    }

    #word-list li {
        font-size: 1.8vh;
        padding: 1vh;
    }

    button,
    #language-button,
    #shuffle-button {
        font-size: 1.6vh;
        padding: 1vh 1.6vw;
    }
}

.highlighted {
    background-color: rgba(255, 255, 0, 0.7); /* Muted yellow highlight */
    font-weight: 600;
    color: var(--text-primary); /* Ensure highlighted text remains readable */
}

/* Instructions Page */
.instructions-page {
    max-width: 800px;
    padding: 40px;
}

.instructions-content {
    text-align: left;
    margin: 30px 0;
    line-height: 1.6;
    color: var(--text-secondary);
    font-size: 18px;
}

.instructions-content h2 {
    color: var(--text-primary);
    font-size: 24px;
    margin-bottom: 20px;
    text-align: center;
}

.instructions-content p {
    margin-bottom: 20px;
}

.instructions-content ol {
    padding-right: 20px;
    margin-bottom: 20px;
}

.instructions-content li {
    margin-bottom: 12px;
    line-height: 1.5;
}

.instructions-content ul {
    padding-right: 20px;
    margin: 8px 0;
}

.instructions-content ul li {
    margin-bottom: 6px;
}

[dir="rtl"] .instructions-content ol,
[dir="rtl"] .instructions-content ul {
    padding-right: 0;
    padding-left: 20px;
}

#back-button {
    margin-top: 30px;
    background-color: var(--accent-color);
}

/* Mobile styles for instructions page */
@media (max-width: 600px) {
    .instructions-page {
        padding: 20px;
    }

    .instructions-content {
        font-size: 16px;
        margin: 20px 0;
    }

    .instructions-content h2 {
        font-size: 22px;
        margin-bottom: 15px;
    }

    .instructions-content ol,
    .instructions-content ul {
        padding-right: 15px;
        margin: 15px 0;
    }

    [dir="rtl"] .instructions-content ol,
    [dir="rtl"] .instructions-content ul {
        padding-right: 0;
        padding-left: 15px;
    }
}

@media (max-width: 400px) {
    .instructions-page {
        padding: 15px;
    }

    .instructions-content {
        font-size: 15px;
        margin: 15px 0;
    }

    .instructions-content h2 {
        font-size: 20px;
        margin-bottom: 12px;
    }

    .instructions-content ol,
    .instructions-content ul {
        padding-right: 12px;
        margin: 12px 0;
    }

    [dir="rtl"] .instructions-content ol,
    [dir="rtl"] .instructions-content ul {
        padding-right: 0;
        padding-left: 12px;
    }
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    overflow-y: auto;
}

.modal-content {
    background-color: var(--surface-color);
    margin: 2% auto;
    padding: 40px;
    border: 1px solid var(--border-color);
    width: 90%;
    max-width: 800px;
    min-height: 70vh;
    border-radius: 8px;
    box-shadow: 0 4px 6px var(--shadow-color);
    position: relative;
}

.modal-content h2 {
    color: var(--text-primary);
    font-size: 36px;
    margin-bottom: 25px;
    text-align: center;
}

.modal-content p {
    margin-bottom: 20px;
    line-height: 1.6;
    color: var(--text-secondary);
    font-size: 24px;
}

.modal-content ol {
    padding-right: 20px;
    margin-bottom: 20px;
    font-size: 24px;
}

.modal-content li {
    margin-bottom: 15px;
    line-height: 1.6;
}

.modal-content ul {
    padding-right: 20px;
    margin: 15px 0;
    font-size: 24px;
}

.close-button {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 48px;
    font-weight: bold;
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    padding: 15px;
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
}

.close-button:hover {
    color: var(--text-primary);
}

[dir="rtl"] .close-button {
    right: auto;
    left: 20px;
}

/* Mobile styles for modal */
@media (max-width: 600px) {
    .modal-content {
        margin: 1% auto;
        padding: 30px;
        width: 95%;
        max-width: 100%;
        min-height: 80vh;
    }

    .modal-content h2 {
        font-size: 32px;
        margin-bottom: 20px;
    }

    .modal-content p {
        font-size: 22px;
    }

    .modal-content ol,
    .modal-content ul {
        padding-right: 20px;
        margin: 20px 0;
        font-size: 22px;
    }

    [dir="rtl"] .modal-content ol,
    [dir="rtl"] .modal-content ul {
        padding-right: 0;
        padding-left: 20px;
    }

    .close-button {
        font-size: 42px;
        width: 60px;
        height: 60px;
        padding: 12px;
    }
}

@media (max-width: 400px) {
    .modal-content {
        margin: 0 auto;
        padding: 20px;
        width: 98%;
        min-height: 85vh;
    }

    .modal-content h2 {
        font-size: 28px;
        margin-bottom: 15px;
    }

    .modal-content p {
        font-size: 20px;
    }

    .modal-content ol,
    .modal-content ul {
        padding-right: 15px;
        margin: 15px 0;
        font-size: 20px;
    }

    [dir="rtl"] .modal-content ol,
    [dir="rtl"] .modal-content ul {
        padding-right: 0;
        padding-left: 15px;
    }

    .close-button {
        font-size: 36px;
        width: 50px;
        height: 50px;
        padding: 10px;
    }
}