* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
    position: relative;
}

/* Предотвращаем прокрутку при перетаскивании */
body.dragula-dragging {
    overflow: hidden !important;
    touch-action: none !important;
    -webkit-overflow-scrolling: auto !important;
}

/* Стили для элементов Dragula */
.gu-mirror {
    position: fixed !important;
    margin: 0 !important;
    z-index: 9999 !important;
    opacity: 0.8;
    pointer-events: none;
    cursor: grabbing !important;
    transform: rotate(5deg);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3) !important;
}

.gu-hide {
    display: none !important;
}

.gu-unselectable {
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
}

.gu-transit {
    opacity: 0.2;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    position: relative;
    z-index: 1;
}

/* Улучшенные стили для drag-and-drop */
.drag-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9998;
    display: none;
}

.drag-overlay.active {
    display: block;
}

.drag-ghost {
    position: fixed;
    pointer-events: none;
    z-index: 10000;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    border-radius: 12px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
    opacity: 0;
    left: 0;
    top: 0;
    text-align: center;
    line-height: 60px;
    transition: opacity 0.2s ease;
}

.drag-ghost.active {
    opacity: 0.9;
}

header {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    padding: 30px;
    text-align: center;
    position: relative;
}

.header-content {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.mobile-menu-btn {
    display: none;
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: all 0.3s ease;
    z-index: 100;
}

.mobile-menu-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
}

.main-content {
    display: flex;
    padding: 30px;
    gap: 30px;
}

.controls {
    flex: 1;
    background: #f8fafc;
    padding: 25px;
    border-radius: 15px;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

.grid-section {
    flex: 2;
    min-width: 0;
}

.control-group {
    margin-bottom: 25px;
}

.control-group h3 {
    color: #334155;
    margin-bottom: 12px;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-group h3 i {
    color: #4f46e5;
}

.btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

button {
    border: none;
    border-radius: 10px;
    padding: 12px 20px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
    color: #475569;
    border: 2px solid #e2e8f0;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

button.active {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    border-color: transparent;
}

.generate-btn {
    width: 100%;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    font-size: 1.1rem;
    padding: 15px;
    border: none;
    margin-top: 10px;
}

.generate-btn:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.print-btn {
    width: 100%;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    font-size: 1.1rem;
    padding: 15px;
    border: none;
    margin-top: 10px;
}

.print-btn:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

.generate-btn:disabled {
    background: #94a3b8;
    cursor: not-allowed;
    transform: none;
}

/* Стили сетки и ячеек */
#crossword-container {
    background: #f8fafc;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    margin-bottom: 30px;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: auto;
}

#crossword-grid {
    display: grid;
    gap: 3px;
    background: transparent;
    padding: 2px;
    margin: 0 auto;
    width: min-content;
    max-width: 100%;
    min-height: 500px;
}

/* Стили для разных размеров сетки */
.grid.size-7 {
    grid-template-columns: repeat(7, 55px);
    grid-template-rows: repeat(7, 55px);
    width: calc(7 * 55px + 6 * 3px);
}

.grid.size-9 {
    grid-template-columns: repeat(9, 50px);
    grid-template-rows: repeat(9, 50px);
    width: calc(9 * 50px + 8 * 3px);
}

.grid.size-11 {
    grid-template-columns: repeat(11, 1fr);
    grid-template-rows: repeat(11, 45px);
    width: calc(11 * 45px + 10 * 3px);
}

.grid.size-13 {
    grid-template-columns: repeat(13, 1fr);
    grid-template-rows: repeat(13, 40px);
    width: calc(13 * 40px + 12 * 3px);
}

.grid.size-15 {
    grid-template-columns: repeat(15, 1fr);
    grid-template-rows: repeat(15, 35px);
    width: calc(15 * 35px + 14 * 3px);
}

.grid-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    transition: all 0.3s ease;
    border-radius: 6px;
    width: 100%;
    height: 100%;
    font-size: 18px;
    position: relative;
    aspect-ratio: 1;
    user-select: none;
    cursor: pointer;
}

.grid-cell.empty {
    background: transparent;
}

.grid-cell.number {
    background: #ffc98b;
    color: #000000;
    border: 2px solid #e0e0e0;
}

.grid-cell.operator {
    background: #ffc98b;
    font-size: 1.4rem;
    font-weight: 700;
    border: 2px solid #e0e0e0;
}

.grid-cell.equals {
    background: #ffc98b;
    font-size: 1.4rem;
    font-weight: 700;
    border: 2px solid #e0e0e0;
}

.grid-cell.cross {
    background: #ffc98b;
    position: relative;
    z-index: 1;
    border: 2px solid #e0e0e0;
}

.grid-cell.start {
    position: relative;
    background: #ffc98b;
    border: 2px solid #e0e0e0;
}

.grid-cell.result {
    position: relative;
    background: #ffc98b;
    border: 2px solid #e0e0e0;
}

.grid-cell.new {
    animation: pulse 1s ease-in-out;
}

.grid-cell.user-input {
    background: #fffde7 !important;
    color: #5d4037;
    border: 2px dashed #ffb300 !important;
    cursor: pointer;
}

.grid-cell.user-filled {
    background: #cee7fa !important;
    border: 2px dashed #2196f3 !important;
    cursor: move;
    position: relative;
}

.grid-cell.selected {
    border: 3px solid #FF9800 !important;
    box-shadow: 0 0 15px rgba(255, 152, 0, 0.5);
    transform: scale(0.95);
}

.grid-cell.correct {
    background: #c8e6c9 !important;
    color: #1b5e20;
}

.grid-cell.incorrect {
    background: #ffcdd2 !important;
    color: #b71c1c;
}

.grid-cell.hidden {
    background: #fde4c7 !important;
    color: #000000 !important;
    position: relative;
    cursor: pointer;
}

.grid-cell.hidden::after {
    /* content: '?'; */
    position: absolute;
    color: #999;
    font-size: 16px;
    font-weight: bold;
}

.grid-cell.answer-revealed {
    background: #a5d6a7 !important;
    color: #1b5e20 !important;
    font-weight: bold;
}

.grid-cell.dragover {
    border: 2px solid #2196F3 !important;
    box-shadow: 0 0 10px rgba(33, 150, 243, 0.5);
    background: rgba(33, 150, 243, 0.1) !important;
    transform: scale(1.05);
}

.grid-cell.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

.grid-cell.expression-error {
    animation: error-shake 0.5s ease-in-out;
}

@keyframes error-shake {

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

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

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

    50% {
        transform: scale(1.05);
    }

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

@keyframes fly-to-cell {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }

    100% {
        transform: translate(var(--fly-x), var(--fly-y)) scale(0.3);
        opacity: 0;
    }
}

/* Панель с числами */
.numbers-panel {
    background: #f8fafc;
    padding: 20px;
    border-radius: 15px;
    margin-top: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.numbers-panel h3 {
    color: #334155;
    margin-bottom: 15px;
    font-size: 1.2rem;
    text-align: center;
}

.numbers-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    align-items: center;
    min-height: 80px;
}

.number-btn {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: grab;
    transition: all 0.3s ease;
    user-select: none;
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.number-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(79, 70, 229, 0.4);
}

.number-btn:active {
    cursor: grabbing;
}

.number-btn.dragging {
    opacity: 0.7;
    transform: scale(1.1);
    z-index: 1000;
    cursor: grabbing;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.number-btn.used {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none;
}

.number-btn.used:hover {
    transform: none;
    box-shadow: none;
}

/* Драг элемент для предпросмотра */
.fly-effect {
    position: absolute;
    pointer-events: none;
    z-index: 9999;
    animation: fly-to-cell 0.8s ease-in-out forwards;
}

/* Оверлей победы */
.win-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.5s ease;
}

.win-overlay.active {
    opacity: 1;
    visibility: visible;
}

.win-content {
    background: white;
    padding: 50px;
    border-radius: 20px;
    text-align: center;
    max-width: 500px;
    width: 90%;
    transform: scale(0.9);
    opacity: 0;
    transition: all 0.5s ease;
}

.win-overlay.active .win-content {
    transform: scale(1);
    opacity: 1;
}

.win-content h2 {
    color: #4f46e5;
    font-size: 2.5rem;
    margin-bottom: 20px;
}

.win-content p {
    color: #666;
    font-size: 1.2rem;
    margin-bottom: 30px;
    line-height: 1.6;
}

.new-crossword-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    font-size: 1.2rem;
    padding: 15px 40px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.new-crossword-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(16, 185, 129, 0.4);
}

/* Окно настроек нового кроссворда */
.settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10001;
    opacity: 0;
    visibility: hidden;
    transition: all 0.5s ease;
}

.settings-overlay.active {
    opacity: 1;
    visibility: visible;
}

.settings-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    max-width: 600px;
    width: 90%;
    transform: scale(0.9);
    opacity: 0;
    transition: all 0.5s ease;
    position: relative;
}

.settings-overlay.active .settings-content {
    transform: scale(1);
    opacity: 1;
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: #f0f0f0;
    color: #333;
}

.settings-content h2 {
    color: #4f46e5;
    font-size: 2rem;
    margin-bottom: 30px;
    text-align: center;
}

.settings-group {
    margin-bottom: 25px;
}

.settings-group h3 {
    color: #334155;
    margin-bottom: 12px;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.settings-buttons {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.settings-buttons button {
    flex: 1;
    padding: 15px;
    font-size: 1.1rem;
}

#generation-status {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 30px 40px;
    border-radius: 15px;
    display: none;
    z-index: 1000;
    text-align: center;
    min-width: 300px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.success {
    color: #10b981;
    font-size: 1.2rem;
    font-weight: bold;
}

.error {
    color: #ef4444;
    font-size: 1.2rem;
    font-weight: bold;
}

/* Стили для кнопок операторов */
.operator-btn {
    min-width: 50px;
    padding: 10px 15px;
}

.operator-btn.active {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
}

/* Эффект улетания числа */
.fly-effect {
    position: absolute;
    pointer-events: none;
    z-index: 9999;
    animation: fly-to-cell 0.8s ease-in-out forwards;
}

/* Мобильное меню */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    z-index: 10002;
    display: none;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-menu-overlay.active {
    display: flex;
    opacity: 1;
}

.mobile-menu-content {
    background: white;
    width: 90%;
    max-width: 400px;
    max-height: 80%;
    overflow-y: auto;
    border-radius: 15px;
    padding: 30px;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.mobile-menu-overlay.active .mobile-menu-content {
    transform: translateY(0);
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.mobile-menu-header h2 {
    color: #4f46e5;
    font-size: 1.8rem;
}

.close-mobile-menu {
    background: none;
    border: none;
    font-size: 28px;
    color: #666;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-mobile-menu:hover {
    background: #f0f0f0;
    color: #333;
}

.mobile-controls {
    background: #f8fafc;
    padding: 20px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

/* Адаптивные стили */
@media (max-width: 900px) {
    .main-content {
        flex-direction: column;
    }

    #crossword-grid {
        min-height: 400px;
    }

    .win-content {
        padding: 30px;
    }

    .settings-content {
        padding: 30px;
    }

    .grid.size-7 {
        grid-template-columns: repeat(7, 45px);
        grid-template-rows: repeat(7, 45px);
        width: calc(7 * 45px + 6 * 3px);
    }

    .grid.size-9 {
        grid-template-columns: repeat(9, 40px);
        grid-template-rows: repeat(9, 40px);
        width: calc(9 * 40px + 8 * 3px);
    }

    .grid.size-11 {
        grid-template-columns: repeat(11, 35px);
        grid-template-rows: repeat(11, 35px);
        width: calc(11 * 35px + 10 * 3px);
    }

    .grid.size-13 {
        grid-template-columns: repeat(13, 30px);
        grid-template-rows: repeat(13, 30px);
    }

    .grid.size-15 {
        grid-template-columns: repeat(15, 26px);
        grid-template-rows: repeat(15, 26px);
    }

    .grid-cell {
        font-size: 16px;
    }

    .grid-cell.operator,
    .grid-cell.equals {
        font-size: 1.2rem;
    }

    .number-btn {
        width: 45px;
        height: 45px;
        font-size: 16px;
    }

    .drag-ghost {
        width: 55px;
        height: 55px;
        font-size: 20px;
        line-height: 55px;
    }
}

@media (max-width: 768px) {
    .controls {
        display: none;
    }

    .mobile-menu-btn {
        display: block;
    }

    h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .main-content {
        padding: 20px;
        gap: 20px;
    }

    #crossword-container {
        padding: 15px;
    }

    .numbers-panel {
        padding: 15px;
    }

    .grid.size-7 {
        grid-template-columns: repeat(7, 40px);
        grid-template-rows: repeat(7, 40px);
        width: calc(7 * 40px + 6 * 3px);
    }

    .grid.size-9 {
        grid-template-columns: repeat(9, 35px);
        grid-template-rows: repeat(9, 35px);
        width: calc(9 * 35px + 8 * 3px);
    }

    .grid.size-11 {
        grid-template-columns: repeat(11, 30px);
        grid-template-rows: repeat(11, 30px);
        width: calc(11 * 30px + 10 * 3px);
    }

    .number-btn {
        touch-action: manipulation;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    header {
        padding: 20px;
    }

    h1 {
        font-size: 1.7rem;
    }

    .grid.size-7 {
        grid-template-columns: repeat(7, 35px);
        grid-template-rows: repeat(7, 35px);
        width: calc(7 * 35px + 6 * 3px);
    }

    .grid.size-9 {
        grid-template-columns: repeat(9, 30px);
        grid-template-rows: repeat(9, 30px);
        width: calc(9 * 30px + 8 * 3px);
    }

    .grid.size-11 {
        grid-template-columns: repeat(11, 26px);
        grid-template-rows: repeat(11, 26px);
    }

    .grid.size-13 {
        grid-template-columns: repeat(13, 22px);
        grid-template-rows: repeat(13, 22px);
    }

    .grid.size-15 {
        grid-template-columns: repeat(15, 20px);
        grid-template-rows: repeat(15, 20px);
    }
}

.number-btn {
    width: 40px;
    height: 40px;
    font-size: 14px;
}

.mobile-menu-content {
    padding: 20px;
}

.drag-ghost {
    width: 50px;
    height: 50px;
    font-size: 18px;
    line-height: 50px;
}
}

/* Улучшения для мобильного интерфейса */
.grid-cell.user-filled::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 6px;
    box-shadow: inset 0 0 0 2px rgba(33, 150, 243, 0.3);
    pointer-events: none;
}

.grid-cell.selected::after {}

/* Анимация удаления для мобильных */
@keyframes remove-pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(0.8);
        opacity: 0.5;
    }

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

/* Инструкция для пользователей */
.mobile-hint {
    display: none;
    text-align: center;
    padding: 10px;
    font-size: 12px;
    color: #666;
    background: #f8fafc;
    border-radius: 8px;
    margin-top: 10px;
}

@media (max-width: 768px) {
    .mobile-hint {
        display: block;
    }

    .grid-cell.user-filled {
        cursor: move;
    }
}

/* Анимация возврата числа в панель */
.return-to-panel {
    animation: returnToPanel 0.5s ease-in-out forwards;
    position: fixed;
    z-index: 9999;
    pointer-events: none;
}

@keyframes returnToPanel {
    0% {
        transform: scale(1) translate(0, 0);
        opacity: 1;
    }

    100% {
        transform: scale(0.3) translate(var(--return-x), var(--return-y));
        opacity: 0;
    }
}

/* Стили для классов выражений */
.expr-color-1 {
    background-color: #ffc98b !important;
}

.expr-color-2 {
    background-color: #a7e6ff !important;
}

.expr-color-3 {
    background-color: #b5e6a7 !important;
}

.expr-color-4 {
    background-color: #e6a7ff !important;
}

.expr-color-5 {
    background-color: #ffa7a7 !important;
}

.expr-color-6 {
    background-color: #ffeda7 !important;
}

.expr-color-7 {
    background-color: #a7ffdc !important;
}

.expr-color-8 {
    background-color: #d4a7ff !important;
}

.expr-color-9 {
    background-color: #a7c8ff !important;
}

.expr-color-10 {
    background-color: #ffe6a7 !important;
}

.expr-color-11 {
    background-color: #a7ffe6 !important;
}

.expr-color-12 {
    background-color: #ffa7e6 !important;
}

/* Для скрытых ячеек - более светлые оттенки */
.grid-cell.hidden.expr-color-1 {
    background-color: #ffe0b2 !important;
}

.grid-cell.hidden.expr-color-2 {
    background-color: #e3f2fd !important;
}

.grid-cell.hidden.expr-color-3 {
    background-color: #e8f5e9 !important;
}

.grid-cell.hidden.expr-color-4 {
    background-color: #f3e5f5 !important;
}

.grid-cell.hidden.expr-color-5 {
    background-color: #ffebee !important;
}

.grid-cell.hidden.expr-color-6 {
    background-color: #fff3e0 !important;
}

.grid-cell.hidden.expr-color-7 {
    background-color: #e0f2f1 !important;
}

.grid-cell.hidden.expr-color-8 {
    background-color: #f3e5f5 !important;
}

.grid-cell.hidden.expr-color-9 {
    background-color: #e3f2fd !important;
}

.grid-cell.hidden.expr-color-10 {
    background-color: #fff3e0 !important;
}

.grid-cell.hidden.expr-color-11 {
    background-color: #e0f2f1 !important;
}

.grid-cell.hidden.expr-color-12 {
    background-color: #fce4ec !important;
}

/* Анимация удаления для ячеек */
@keyframes shrink {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(0.8);
        opacity: 0.5;
    }

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

/* Стили для выделенных ячеек на мобильных */
@media (max-width: 768px) {
    .grid-cell.selected {
        border: 3px solid #4CAF50 !important;
        box-shadow: 0 0 20px rgba(76, 175, 80, 0.7);
        z-index: 10;
    }

    .mobile-hint {
        display: block;
        text-align: center;
        padding: 10px;
        font-size: 12px;
        color: #666;
        background: #f8fafc;
        border-radius: 8px;
        margin-top: 10px;
        transition: all 0.3s ease;
    }

    .number-btn {
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    }

    .number-btn:active {
        transform: scale(0.95);
        transition: transform 0.1s ease;
    }

    /* Улучшенная обратная связь для мобильных */
    .grid-cell.user-filled:active {
        transform: scale(0.95);
        transition: transform 0.1s ease;
    }
}

/* Стили для печати */
@media print {
    body {
        background: white !important;
        color: black !important;
    }

    .container,
    .main-content {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    header,
    .controls,
    .mobile-menu-btn,
    .mobile-menu-overlay,
    #win-overlay,
    #settings-overlay,
    .drag-overlay,
    .numbers-container,
    .mobile-hint {
        display: none !important;
    }

    .grid-section {
        display: block !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 10px !important;
    }

    #crossword-container {
        margin: 0 !important;
        padding: 10px 0 !important;
    }

    /* Стили для сетки кроссворда при печати */
    #crossword-grid {
        display: grid !important;
        border: 2px solid black !important;
        border-collapse: collapse !important;
        margin: 0 auto !important;
        background: white !important;
    }

    .grid-cell {
        background: white !important;
        border: 1px solid black !important;
        color: black !important;
        font-weight: bold !important;
    }

    .grid-cell.empty,
    .grid-cell.hidden {
        background: white !important;
    }

    .grid-cell.user-filled {
        background: white !important;
        color: black !important;
    }

    /* Печать скрытых чисел */
    .print-numbers-container {
        display: grid !important;
        grid-template-columns: repeat(auto-fill, minmax(50px, 1fr)) !important;
        gap: 10px !important;
        margin-top: 30px !important;
        padding: 20px !important;
        border-top: 2px solid black !important;
    }

    .print-number-item {
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        width: 40px !important;
        height: 40px !important;
        border: 1px solid black !important;
        background: white !important;
        color: black !important;
        font-weight: bold !important;
        font-size: 18px !important;
        text-align: center !important;
        margin: 5px !important;
    }

    /* Для кнопки печати */
    .print-btn {
        background: #4CAF50 !important;
        color: white !important;
        border: none !important;
        padding: 10px 15px !important;
        cursor: pointer !important;
        border-radius: 5px !important;
        font-size: 14px !important;
        margin-top: 10px !important;
    }

    .print-btn:hover {
        background: #45a049 !important;
    }
}