* {
    box-sizing: border-box;
}

html,
body {
    touch-action: none;
    user-select: none;
        -webkit-user-select: none;
        -ms-user-select: none;
        -moz-user-select: none;
}

img,
a {
    -webkit-user-drag: none;
    -webkit-touch-callout: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    pointer-events: all;
}

.card-preview img {
    pointer-events: none;
}

body {
    margin: 0;
    font-family: system-ui, sans-serif;
    background: #f8fafc;
    color: #1e293b;
}

.cw-card img.thumb {
    -webkit-user-drag: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

.crossword-page {
	color: #fff;
}

.layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.left-column {
	background: #131c2a;
    width: 280px;
    display: flex;
    flex-direction: column;
    padding: 20px;
    gap: 20px;
    height: calc(100vh - 40px);
    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;
}

#logo-mobile .other-crosswords {
    margin: 0;
}
.other-crosswords {
    text-decoration: none;
    color: #3b93ff;
    font-size: 15px;
    font-weight: 500;
    padding: 8px 16px;
    border: 1px solid rgba(59, 147, 255, 0.3);
    border-radius: 6px;
    transition: all 0.3s ease;
    background: rgba(59, 147, 255, 0.1);
    display: inline-block;
    margin-top: 10px;
        -webkit-user-drag: none;
            -moz-user-select: none;
            -ms-user-select: none;
            user-select: none;
            -webkit-touch-callout: none;
}

.other-crosswords:hover {
    background: rgba(59, 147, 255, 0.2);
    border-color: rgba(59, 147, 255, 0.6);
    color: #3befff;
    transform: translateY(-1px);
}

.other-crosswords:active {
    transform: translateY(0);
}


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,
#down-list li {
    transition: all 0.2s ease;
    border-left: 4px solid transparent;
}

#across-list li.active,
#down-list li.active {
    background: #3befff33;
    border-left: 4px solid #3b93ff;
    color: #fff;
}

#across-list li.solved,
#down-list li.solved {
    background: #56b388;
    border-left: 4px solid #288861;
    text-decoration: line-through;
    color: #fff;
}

li:hover {
    background: #3befff33;
    color: #fff;
}

#across-list li.active:hover,
#down-list li.active:hover {
    background: #3befff66;
    color: #fff;
}

#across-list li.solved:hover,
#down-list li.solved:hover {
    background: #56b388cc;
    color: #fff;
}

#hints-box:hover #no-hints-msg {
    display: block;
}
#no-hints-msg {
    display: none;
        font-size: 10px;
            position: absolute;
            top: 4px;
            left: 0;
            right: 0;
            text-align: right;
            padding-right: 20px;
}

#hints-msg {
    color: #d63031;
    margin-top: 8px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #fff5f5, #ffeaea);
    text-align: center;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid #ff7675;
    box-shadow: 0 2px 12px rgba(214, 48, 49, 0.15);
    position: absolute;
    width: 220px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: none;
}

#hints-msg.warning {
    background: linear-gradient(135deg, #fff9e6, #fff0c2);
    border: 1px solid #fdcb6e;
    color: #e17055;
    box-shadow: 0 2px 12px rgba(253, 203, 110, 0.2);
}

button {
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 10px 16px;
    font-size: 15px;
    cursor: pointer;
}

button:hover {
    background: #1d4ed8;
}

.right-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 20px;
    gap: 20px;
    position: relative;
}

#current-question {
    background: #1e293b;
    color: #fff;
    padding: 12px 16px;
    font-size: 18px;
    border-radius: 10px;
    min-height: 48px;
    display: flex;
    align-items: center;
}

.questions-half, .crosswords-container {
    scrollbar-width: thin;
        scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}
.questions-half::-webkit-scrollbar,
.crosswords-container::-webkit-scrollbar{
    width: 8px;
}

.questions-half::-webkit-scrollbar-track,
.crosswords-container::-webkit-scrollbar-track {
    background: transparent;
}

.questions-half::-webkit-scrollbar-thumb,
.crosswords-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.questions-half::-webkit-scrollbar-thumb:hover,
.crosswords-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

#crossword-wrapper {
    flex: 1;
    overflow: auto;
    touch-action: none;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

#crossword-wrapper::-webkit-scrollbar {
    width: 8px;
}

#crossword-wrapper::-webkit-scrollbar-track {
    background: transparent;
}

#crossword-wrapper::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#crossword-wrapper::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

#crossword-container {
    width: max-content;
    height: max-content;
}

#correct-answers-box {
    margin: 10px 0;
        color: #ffd700;
        font-size: 18px;
}

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;
	 color: #131c2a;

}

.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;
    height: auto;
    padding-left: 15px;
}

.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;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes confettiFall {
    0% {
        transform: translateY(-100px) rotate(0deg);
    }

    100% {
        transform: translateY(100vh) rotate(360deg);
    }
}

@keyframes btnShine {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

.congrats-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.congrats-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: fadeIn 0.6s ease-out;
    border: 3px solid #ffd700;
    min-width: 400px;
    color: white;
    text-align: center;
}

.congrats-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 25px;
}

.congrats-header h2 {
    margin: 0;
    font-size: 28px;
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.trophy {
    font-size: 32px;
    animation: bounce 1s infinite alternate;
}

@keyframes bounce {
    from {
        transform: translateY(0px);
    }

    to {
        transform: translateY(-10px);
    }
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
    margin: 30px 0;
}

.stat-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 12px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.stat-icon {
    font-size: 24px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 24px;
    font-weight: bold;
    color: #ffd700;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 12px;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.performance-message {
    font-style: italic;
    margin: 20px 0;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    border-left: 4px solid #ffd700;
}

.continue-btn {
    position: relative;
    background: linear-gradient(45deg, #ff6b6b, #ffd700);
    border: none;
    padding: 15px 30px;
    height: auto;
    border-radius: 50px;
    color: white;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.continue-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(255, 215, 0, 0.3);
}

.btn-shine {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.4),
            transparent);
    animation: btnShine 2s infinite;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #ffd700;
    border-radius: 50%;
    animation: confettiFall 3s linear infinite;
}

.confetti:nth-child(1) {
    left: 10%;
    animation-delay: 0s;
}

.confetti:nth-child(2) {
    left: 50%;
    animation-delay: 1s;
}

.confetti:nth-child(3) {
    left: 90%;
    animation-delay: 2s;
}

@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;
        padding-bottom: 50vh;
    }

    .settings {
        gap: 8px;
        position: fixed;
        left: 10px;
        right: 10px;
        bottom: 10px;
    }

    .settings h3 {
        font-size: 12px;
    }

    button {
        padding: 8px 5px;
        font-size: 14px;
        height: 36px;
    }
}

#logo-mobile,
.menu-button {
    display: none;
}

#current-question-wrapper {
    display: flex;
    gap: 6px;
}

#current-question {
    flex: 1;
}

#hints-box {
    display: flex;
    align-items: center;
    padding-left: 10px;
}

#hints-count {
    margin-right: 10px;
}

.dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

.dialog-box {
    background: #fff;
    color: #212121;
    padding: 20px;
    border-radius: 12px;
    width: 85%;
    max-width: 300px;
    text-align: center;
    font-family: sans-serif;
    box-shadow: 0 4px 20px rgba(0, 0, 0, .25);
}

.dialog-text {
    font-size: 16px;
    margin-bottom: 15px;
}

.dialog-buttons {
    display: flex;
    gap: 10px;
}

.dialog-yes,
.dialog-cancel {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    border: none;
    font-size: 15px;
    cursor: pointer;
}

.dialog-yes {
    background: #4caf50;
    color: #fff;
}

.dialog-cancel {
    background: #e0e0e0;
    color: #333;
}

.dialog-cancel:hover {
    color: #e0e0e0;
}

@media (max-width: 900px) {

        #no-hints-msg {
                top: 1px;
            }

    .left-column {
        position: fixed;
        top: 0;
        left: -280px;
        width: 280px;
        height: 100vh;
        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: 50px;
        flex-shrink: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        background: #2563eb;
        color: #fff;
        border: none;
        padding: 5px; 
        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 correct hints button"
                "question question question question";
            grid-template-columns: 1fr auto;
            grid-template-rows: auto auto;
            gap: 6px;
            width: 100%;
            box-sizing: border-box;
            padding: 0 10px;
        }

        #correct-answers-box {
            grid-area: correct;
        }
    
        #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;
            padding: 6px 12px;
            cursor: pointer;
            font-size: 14px;
        }
    
        #hints-box {
            grid-area: hints;
        }
}
