*,
html,
body {
    box-sizing: border-box;
}
html,
body,
p,
h2,
ul,
li {
    padding: 0;
    margin: 0;
}

@font-face {
    font-family: 'Poppins Local';
    src: url('../fonts/Poppins-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
}

@font-face {
    font-family: 'Poppins Local';
    src: url('../fonts/Poppins-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
}

@font-face {
    font-family: 'Alpha';
    src: url('../fonts/Alphakind.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
}

body {
    font-family: 'Poppins Local';
    font-weight: 500;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: #f4f4f9;
}

main {
    background-color: #fef6df;
    width: 100vw;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 20px 0;
}

#top,
#btm {
    display: none;
}

.content {
    background-image: url(../images/bg.png);
    background-position: center center;
    background-size: cover;
    background-repeat: no-repeat;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 1200px;
    border-radius: 4px;
    box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;
}

#title-bg {
    background-image: url(../images/desk-top.png);
    background-position: center;
    background-size: cover;
    width: 100%;
    height: 13.9rem;
    max-width: 1200px;
    z-index: 10;
}
#bird {
    position: absolute;
    right: 0;
    top: 7rem;
    width: 200px;
    height: 133px;
}

#final {
    display: none;
    width: 100%;
    max-width: 1200px;
    height: 10rem;
    background-image: url(../images/desk-bottom.png);
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
}

#content-grid {
    width: 100%;
    max-width: 1200px;
    flex-grow: 1;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    grid-template-rows: auto min-content;
    grid-gap: 10px;
    padding-top: 16rem;
}
#line1,
#line2 {
    display: grid;
    grid-column: 1 / span 3;
    grid-gap: 10px;
}

#line1 {
    grid-template-columns: subgrid;
}

#line2 {
    grid-template-columns: subgrid;
}

#line2 #column-part {
    grid-column: 1;
}

#line2 > div:last-child {
    grid-column: 2;
}
#column-part1 {
    grid-column: 1;
}

#column-part2 {
    grid-column: 2;
}

#column-part3 {
    grid-column: 3;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
}

#message {
    grid-column: 2;
    background-color: #fdf5de;
    border-radius: 4px;
    text-align: center;
    margin-bottom: 10px;
    padding: 1rem;
    border: 2px solid #000;
    min-height: 60px;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(16, 30px);
    grid-template-rows: repeat(16, 30px);
    border: 2px solid #333;
    width: min-content;
    gap: 2px;
    background-color: #908b7e;
}

.cell {
    background-color: #fef6df;
    width: 30px;
    height: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    /* border: 1px solid #ddd; */
    /* gap: 1px */
    box-sizing: border-box;
    user-select: none;
}

.cell:hover {
    background-color: #e0e0e0;
}

.selected-start,
.selected-end {
    /* background-color: #ffcc00; */
    background-color: #ffff01;
    color: #333;
}

.highlighted {
    background-color: #ffff01 !important;
    /* background-color: #4caf50 !important; */
    /* color: white; */
    color: #333;
}

#part3 {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.question-list-container,
.word-list-container {
    text-align: left;
    font-size: 0.7rem;
    line-height: 1.1;
    padding: 0 1rem 0 1rem;
}
.word-list-container {
    width: 235px;
    margin-top: -7rem;
}
.question-list-container {
    background-color: #fef6df;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-top: 0.7rem;
    border-radius: 8px;
}
.question-list-container h2 {
    text-align: left;
    padding-bottom: 6px;
}
.question-list-container div {
    display: flex;
    margin: 0.3rem 0.5rem;
    align-items: center;
    gap: 6px;
}

.question-list-container div span,
.word-number {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #839f31;
    color: #fff;
    min-width: 18px;
    min-height: 18px;
    box-sizing: border-box;
    border-radius: 100px;
    text-align: center;
    font-size: 0.6rem;
}

h2 {
    font-family: 'Alpha';
    color: #353535;
    font-size: 1.1rem;
    text-transform: uppercase;
    text-align: left;
}

#word-list {
    list-style: none;
    padding: 0;
    display: flex;
    /* flex-wrap: wrap; */
    width: 100%;
    /* max-height: 155px; */
    flex-direction: column;
    justify-content: center;
    padding: 0.5rem 0 0 0;
}

#word-list li {
    display: flex;
    align-items: center;
    font-size: 0.7rem;
    padding: 0.3rem 0.5rem;
    width: 50%;
    box-sizing: border-box;
    gap: 6px;
}

.found {
    text-decoration: line-through;
    color: #888;
}

#final {
    display: none;
}

/* -- MODAL ----------------------------------------------------------------- */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal {
    padding: 3rem;
    max-width: 350px;
    width: 90%;
    text-align: center;
    z-index: 1001;
    background-color: #fef6df;
    color: #76594b;
    border-radius: 1rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    border: 5px solid rgba(158, 182, 0, 1);
    border-top: none;
}

.modal.success {
    border: 5px solid rgba(158, 182, 0, 1);
}
.modal.error {
    border: 5px solid #d9534f;
}

.modal-title {
    font-size: 1.8em;
    font-weight: 700;
    margin-bottom: 0.5rem;
    line-height: 1.2;
    padding-top: 0;
    margin-top: 0.2rem;
}

.modal-actions {
    margin-top: 1.5rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.btn {
    background-color: #76594b;
    color: white;
    font-weight: 700;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 9999px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    text-transform: uppercase;
}

.btn:hover {
    background-color: #5c463c;
    transform: scale(1.05);
    box-shadow: 0 6px 10px rgba(0, 0, 0, 0.2);
}

.btn-ok {
    background-color: rgba(158, 182, 0, 1);
}

.btn-ok:hover {
    background-color: rgba(120, 140, 0, 1);
}

@keyframes bounce-icon {
    0%,
    100% {
        transform: translateY(-25%);
        animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
    }
    50% {
        transform: translateY(0);
        animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
    }
}

.emoji-icon {
    display: block;
}

.modal.success .emoji-icon {
    animation: bounce-icon 1s infinite;
}

/* -- MODAL ----------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
/* -- 1200px ---------------------------------------------------------------- */

@media (max-width: 1200px) {
    .content {
        width: 100%;
    }
    main {
        padding: 0;
    }
}

/* -- 1200px ---------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
/* -- 936px ----------------------------------------------------------------- */

/* -- 936px ----------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
/* -- 768px ----------------------------------------------------------------- */

@media (max-width: 768px) {
    #top {
        background-image: url(../images/top.jpg);
        background-position: center bottom;
        background-size: cover;
        background-repeat: no-repeat;
        height: 10rem;
        width: 100%;
        display: block;
    }
    .content {
        background-image: url(../images/bg-mobile.jpg);
        background-position: center center;
        background-size: cover;
        background-repeat: no-repeat;
        width: 100%;
        box-shadow: none;
    }
    #title-bg,
    #final {
        display: block;
        max-width: 100%;
    }

    #title-bg {
        height: 10rem;
    }

    #content-grid {
        padding-top: 1rem;
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto min-content;
        gap: 15px;
    }
    #line1 {
    }
    #line1,
    #line2 {
        /* Garante que os containers internos não ultrapassem 100% e usem padding reduzido */
        width: 100%;
        padding: 0 10px; /* Seu padding original de 768px */
        box-sizing: border-box;
    }
    #line1 {
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 100%;
        padding: 0 10px;
        box-sizing: border-box;
    }
    #line2:last-child {
        padding-left: 1.5rem;
    }
    #column-part3 {
        order: -1;
        width: 100%;
        max-width: 500px;
        align-items: center;
    }

    #column-part2 {
        order: 0;
        grid-column: 1;
        width: 100%;
        display: flex;
        justify-content: center;
    }

    #column-part1 {
        display: none;
    }

    .word-list-container {
        width: 100%;
        max-width: 250px;
        margin-top: 0;
        box-sizing: border-box;
        padding: 1rem;
        display: flex;
        flex-direction: column;
    }

    .question-list-container {
        width: 100%;
        max-width: 500px;
        padding: 1rem;
        box-sizing: border-box;
    }

    #word-list {
        list-style: none;
        padding: 0.5rem 0 0 0;
        display: block;
        column-count: 2;
        column-gap: 10px;
        width: 100%;
    }

    #word-list li {
        width: 100%;
        break-inside: avoid;
    }

    #line2 {
        padding: 0 10px;
        box-sizing: border-box;
    }
    #line2 > div:last-child {
        grid-column: 1;
    }
    #message {
        grid-column: 1;
        max-width: 500px;
        margin-left: auto;
        margin-right: auto;
        width: 100%;
    }
}

/* -- 768px ----------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
/* -- 636px ----------------------------------------------------------------- */

@media (max-width: 636px) {
    #word-search-grid {
        transform: scale(0.75);
        transform-origin: top center;
        margin-bottom: -100px;
        width: min-content;
    }
}

/* -- 636px ----------------------------------------------------------------- */

@media (max-width: 520px) {
    #word-search-grid {
        transform: scale(0.75);
        transform-origin: top center;
        margin-bottom: -100px;
        width: min-content;
    }
    #line1,
    #line2 {
        padding: 0 5px;
    }
    .question-list-container,
    .word-list-container {
        padding: 0.5rem;
    }
}

@media (max-width: 490px) {
    #content-grid {
        padding-top: 1rem;
        gap: 10px;
    }

    .question-list-container,
    .word-list-container {
        padding: 0.5rem;
    }

    #line1,
    #line2 {
        padding: 0 5px;
    }

    #word-search-grid {
        transform: scale(0.7);
        margin-bottom: -110px;
    }

    h2 {
        font-size: 1rem;
    }

    #word-list li {
        font-size: 0.6rem;
    }

    #title-bg {
        height: 8rem;
    }
    #final {
        height: 8rem;
    }
}
