* {
    box-sizing: border-box;
}

html,
body {
    touch-action: none;
}

body {
    margin: 0;
    font-family: system-ui, sans-serif;
    background: #f8fafc;
    color: #1e293b;
}

.back-a a {
    color: #fff;
}

.logo-block h1 {
    margin: 0;
    font-size: 21px;
}

.layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.left-column {
    width: 280px;
    background: #fff;
    display: flex;
    flex-direction: column;
    padding: 20px;
    gap: 20px;
    overflow: hidden;
}

.logo-block {
    flex-shrink: 0;
}

.questions-block {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow: hidden;
}

.questions-half {
    flex: 1;
    overflow: auto;
    min-height: 0;
}

.logo {
    font-size: 22px;
    font-weight: 700;
}

.other-crosswords {


    font-size: 15px;
}

.logo-block a {
    color: #2563eb;
    text-decoration: none;
}

h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
}

ul {
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 15px;
}

li {
    padding: 6px 10px;
    margin-bottom: 6px;
    border-radius: 8px;
    cursor: pointer;
    transition: background .2s, transform .2s;
}

#across-list li.active,
#down-list li.active {
    background: #ffeb3b33;
    border-left: 4px solid #ffeb3b;
}

#across-list li.solved,
#down-list li.solved {
    background: #a7f3d0;
    border-left: 4px solid #4caa84;
    text-decoration: line-through;
}

li:hover {
    background: #e0f2fe;
}

button {
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 10px 16px;
    font-size: 15px;
    cursor: pointer;
}

button:hover {
    background: #1d4ed8;
}

.right-column {
    flex: 1;
    background-color: #6bcee4;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 20px;
    gap: 20px;
    position: relative;
}

#current-question {
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 12px 16px;
    font-size: 18px;
    border-radius: 10px;
    min-height: 48px;
    display: flex;
    align-items: center;
}

#crossword-wrapper {
    flex: 1;
    overflow: auto;
    touch-action: none;

}

#crossword-container {
    width: max-content;
    height: max-content;
}

svg {
    display: block;

}

.settings {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    gap: 12px;

}


.settings h3 {
    font-size: 14px;
    font-weight: normal;
    margin-bottom: 4px;
}

.settings-hidden {
    display: none;
    transform: scale(0.6);
    opacity: 0;
    pointer-events: none;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 16px;
    margin-bottom: 2px;

}

#settings-close {
    color: #000;
    border: none;
    background: none;
    font-size: 20px;
    cursor: pointer;
}

.settings-floating {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 40px;
    height: 40px;
    border-radius: 6px;
    background: #ffffff;
    color: #fff;
    font-size: 18px;
    border: none;
    display: none;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
    z-index: 9999;
}

.settings-floating.show {
    display: flex;
}

.print-version {
    display: none;
}

@media print {
    .print-version {
        display: block;
    }

    .logo-block,
    #crossword-wrapper,
    #current-question-wrapper,
    .settings,
    .settings-floating {
        display: none !important;
    }

    .print-questions {
        page-break-before: always;
    }
}



@media (max-width: 900px) {
    .layout {
        flex-direction: column;
        height: auto;
    }

    .left-column {
        width: 100%;
        height: auto;
        flex-direction: row;
        overflow-x: auto;
        padding: 10px;
        gap: 10px;
    }

    .questions-block {
        flex-direction: column;
        gap: 10px;
    }

    .questions-half {
        flex: 1;
        min-width: 150px;
    }

    .right-column {
        width: 100%;
        flex: none;
        padding: 10px;
    }

    #current-question {
        font-size: 16px;
        padding: 10px;
    }

    #crossword-wrapper {
        max-height: 70vh;
        overflow: auto;
        padding-bottom: 50vh;
    }

    .settings {
        gap: 8px;
        position: fixed;
        left: 10px;
        right: 10px;
        bottom: 10px;
    }

    .settings h3 {
        font-size: 12px;
    }

    button {
        padding: 8px 12px;
        font-size: 14px;
    }
}

#logo-mobile,
.menu-button {
    display: none;
}

@media (max-width: 900px) {
    .left-column {
        position: fixed;
        top: 0;
        left: -280px;
        width: 280px;
        height: 100vh;
        background: #fff;
        transition: left 0.3s ease;
        z-index: 1000;
        padding: 20px;
        flex-direction: column;
        overflow-y: auto;
    }

    .left-column.show {
        left: 0;
    }

    #current-question-wrapper {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        width: 100%;
        box-sizing: border-box;
        padding: 0 10px;
    }

    #logo-mobile {
        flex-shrink: 0;
        font-size: 18px;
        font-weight: 700;
        display: block;
        line-height: 1;
    }

    #logo-mobile .back-to-homepage {
        font-size: 14px;
        font-weight: normal;
    }

    #current-question {
        flex: 1;
        text-align: left;
        min-width: 0;
    }

    .menu-button {
        width: 80px;
        flex-shrink: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        background: #2563eb;
        color: #fff;
        border: none;
        border-radius: 6px;
        padding: 6px 12px;
        cursor: pointer;
        font-size: 14px;
    }

    .right-column {
        padding-left: 10px;
        padding-right: 10px;
    }
}

@media (max-width: 650px) {
    #current-question-wrapper {
        display: grid;
        grid-template-areas:
            "logo button"
            "question question";
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto;
        gap: 6px;
        width: 100%;
        box-sizing: border-box;
        padding: 0 10px;
    }

    #logo-mobile {
        grid-area: logo;
        font-size: 18px;
        font-weight: 700;
    }

    #current-question {
        grid-area: question;
        flex: none;
        width: 100%;
        white-space: normal;
        overflow: visible;
    }

    .menu-button {
        grid-area: button;
        flex: none;
        display: flex;
        align-items: center;
        justify-content: center;
        background: #2563eb;
        color: #fff;
        border: none;
        border-radius: 6px;
        padding: 6px 12px;
        cursor: pointer;
        font-size: 14px;
    }
}