:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --light-bg: #f8f9fa;
    --dark-text: #343a40;
}

body {
    font-family: 'Poppins', sans-serif;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    color: var(--dark-text);
    padding: 20px;
    box-sizing: border-box;
    background-image: url('background.png');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

#logo {
    position: fixed;
    top: 15px;
    left: 15px;
    width: 150px;
    height: auto;
    z-index: 20;
}

#open-theory-button {
    position: fixed;
    top: 15px;
    right: 15px;
    padding: 10px 15px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    border: none;
    background-color: var(--warning-color);
    color: var(--dark-text);
    border-radius: 10px;
    z-index: 10;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

#open-theory-button:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}

#game-container {
    text-align: center;
    background-color: rgba(255, 255, 255, 0.95);
    padding: clamp(20px, 5vw, 40px);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    width: 95%;
    max-width: 700px;
    backdrop-filter: blur(10px);
}

.external-link-container {
    margin-top: 25px;
}

#explora-button {
    padding: 12px 30px;
    font-size: 1.1em;
    font-weight: 600;
    color: white;
    background-color: #ff9800;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 152, 0, 0.4);
    transition: all 0.3s ease;
}

#explora-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(255, 152, 0, 0.5);
}

h1,
h2,
h3 {
    color: var(--primary-color);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

#mode-selection {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

.mode-button {
    padding: 20px 40px;
    font-size: 1.2em;
    font-weight: 700;
    cursor: pointer;
    border-radius: 15px;
    border: 2px solid var(--primary-color);
    background-color: #fff;
    color: var(--primary-color);
    transition: all 0.3s ease;
}

.mode-button:hover {
    background-color: var(--primary-color);
    color: #fff;
    transform: scale(1.05);
}

#level-selection button,
#search-selection button {
    display: block;
    width: 80%;
    margin: 15px auto;
    padding: 15px 20px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    border: none;
    background-color: var(--primary-color);
    color: white;
    border-radius: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
}

#level-selection button:hover:not(:disabled),
#search-selection button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.4);
}

#level-selection button:disabled {
    background-color: var(--secondary-color);
    cursor: not-allowed;
    opacity: 0.7;
    box-shadow: none;
}

#level-selection button:disabled::after {
    content: ' 🔒';
}

.back-button {
    background-color: var(--secondary-color) !important;
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.3) !important;
    width: 50% !important;
    margin-top: 30px !important;
}

.search-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-top: 20px;
}

#search-selection .search-cat-button {
    width: 100%;
}

#stats-bar {
    display: flex;
    justify-content: space-between;
    font-size: 1.1em;
    font-weight: 600;
    margin: 20px 0;
    padding: 10px;
    background-color: #e9ecef;
    border-radius: 10px;
}

#sentence {
    font-size: clamp(1.2rem, 3vw, 1.5rem);
    margin-bottom: 25px;
    line-height: 2;
    min-height: 100px;
    text-align: left;
}

#options button {
    margin: 8px;
    padding: 12px 20px;
    font-size: 1em;
    cursor: pointer;
    border: 2px solid var(--primary-color);
    background-color: #fff;
    color: var(--primary-color);
    border-radius: 10px;
    transition: all 0.2s ease;
    font-weight: 600;
}

#options button:hover:not(:disabled) {
    background-color: var(--primary-color);
    color: #fff;
    transform: scale(1.05);
}

#options button:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

#feedback {
    margin-top: 20px;
    font-size: 1.2em;
    font-weight: bold;
    min-height: 30px;
}

#action-buttons-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
}

#primary-action-wrapper {
    min-height: 50px;
}

.back-button-ingame {
    background-color: transparent;
    color: var(--secondary-color);
    border: none;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    padding: 5px;
    transition: color 0.3s ease;
}

.back-button-ingame:hover {
    color: var(--dark-text);
}

#next-button,
.menu-button,
#check-button {
    padding: 12px 35px;
    font-size: 1.1em;
    cursor: pointer;
    border: none;
    background-color: var(--success-color);
    color: white;
    border-radius: 10px;
    transition: background-color 0.3s;
}

.hidden {
    display: none !important;
}

.correct {
    color: var(--success-color);
}

.incorrect {
    color: var(--danger-color);
}

.word-to-classify {
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: underline;
    text-decoration-thickness: 3px;
    text-decoration-color: var(--warning-color);
}

#sentence .word {
    cursor: pointer;
    transition: background-color 0.2s;
    border-radius: 5px;
    padding: 2px 1px;
}

#sentence .word:hover {
    background-color: rgba(255, 193, 7, 0.4);
}

#sentence .selected {
    background-color: rgba(0, 123, 255, 0.4);
    font-weight: bold;
}

#sentence .found-correct {
    background-color: rgba(40, 167, 69, 0.5);
    color: #fff;
    font-weight: bold;
}

#sentence .found-incorrect {
    background-color: rgba(220, 53, 69, 0.5);
    color: #fff;
    text-decoration: line-through;
    font-weight: bold;
}

#sentence .missed {
    background-color: rgba(255, 193, 7, 0.7);
    border: 2px dashed var(--dark-text);
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-5px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(5px);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

.shake-animation {
    animation: shake 0.5s ease-in-out;
}

.pulse-animation {
    animation: pulse 0.5s ease-in-out;
}

.modal {
    display: flex;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: #fff;
    padding: 30px;
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    text-align: left;
}

.close-button {
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 2rem;
    cursor: pointer;
    color: var(--secondary-color);
}

.theory-section {
    margin-bottom: 20px;
}