* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    //padding: 10px;
    overflow-x: hidden;
}

.container {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    max-width: 100%;
    width: 100%;
    margin: 10px;
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 15px;
    font-size: 1.8rem;
    font-weight: bold;
}
#toggle-notes {
    background: #ff9800;
}

#auto-fill-notes {
    background: #9c27b0;
}

#check-solution {
    background: #2196F3;
}

#new-game {
    background: #f44336;
}
/* Интерактивные индикаторы чисел */
.numbers-counter {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    margin-bottom: 15px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 2px solid #e9ecef;
}

.counter-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 4px;
    background: white;
    border-radius: 8px;
    border: 2px solid #dee2e6;
    min-width: 0;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.counter-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.counter-item:active {
    transform: translateY(0);
}

.counter-item.selected {
    border-color: #2196F3;
    background: #e3f2fd;
    box-shadow: 0 0 0 2px #bbdefb;
}

.counter-item.completed {
    border-color: #4CAF50;
    background: #e8f5e9;
}

.counter-item.completed.selected {
    border-color: #2196F3;
    background: #bbdefb;
}

.counter-number {
    font-size: 1.4rem;
    font-weight: bold;
    color: #2196F3;
    margin-bottom: 3px;
}

.counter-item.selected .counter-number {
    color: #1565c0;
}

.counter-item.completed .counter-number {
    color: #2e7d32;
}

.counter-item.completed.selected .counter-number {
    color: #1565c0;
}

.counter-count {
    font-size: 0.8rem;
    color: #6c757d;
    font-weight: 600;
}

.counter-item.completed .counter-count {
    color: #2e7d32;
}

.counter-item.selected .counter-count {
    color: #1565c0;
}

/* Контролы */
.controls {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 15px;
}

.controls select {
    grid-column: 1 / -1;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
    font-size: 14px;
    text-align: center;
}

.controls button {
    padding: 12px 8px;
    border: none;
    border-radius: 8px;
    background: #4CAF50;
    color: white;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.controls button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.controls button:active {
    transform: translateY(0);
}


/* Игровое поле */
.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.sudoku-grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 1px;
    border: 2px solid #333;
    border-radius: 4px;
    background: #333;
    width: 100%;
    max-width: 400px;
    aspect-ratio: 1/1;
}

.cell {
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    position: relative;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* УВЕЛИЧИВАЕМ РАЗМЕРЫ ДЛЯ МОБИЛЬНЫХ */
@media (max-width: 480px) {
    .cell {
        font-size: 16px;
    }
}

@media (max-width: 360px) {
    .cell {
        font-size: 14px;
    }
}

/* Ошибки - ЯРКИЕ и заметные */
.cell.error {
    background: #ffcdd2 !important;
    color: #c62828 !important;
    font-weight: bold;
}

.cell.user-input.error {
    background: #ffcdd2 !important;
    color: #c62828 !important;
}

/* Выбранное поле - ОЧЕНЬ ЯРКОЕ */
.cell.selected {
    background: #bbdefb !important;
    box-shadow: 0 0 0 3px #2196F3 !important;
    z-index: 10;
    transform: scale(1.05);
}

/* Подсветка области */
.cell.highlighted {
    ..background: #e3f2fd !important;
    background: rgba(245, 245, 245, 0.9);

}

/* Одинаковые числа - ЯРКИЕ */
.cell.same-number {
    background: #90caf9 !important;
    font-weight: bold;
}

/* Зеленые заметки - ОЧЕНЬ ЯРКИЕ */
.cell.same-note {
    background: #2196f3 !important;
    //border: 2px solid #4caf50 !important;
    box-shadow: 0 0 5px rgba(76, 175, 80, 0.5);
}

.cell.same-note .note-number {
    //font-weight: bold;
    color: #1b3a21 !important;
    //font-size: 9px;
}

.cell.fixed {
    background: #e9ecef;
    color: #000;
    font-weight: bold;
}

.cell.user-input {
    color: #2196F3;
    background: #f9f9f9;
}

.cell.occupied {
    background: #f9f9f9;
}

/* Заметки - УВЕЛИЧИВАЕМ РАЗМЕР */
.notes {
    position: absolute;
    top: 1px;
    left: 1px;
    right: 1px;
    bottom: 1px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    font-size: 8px;
    //padding: 2px;
    background: rgba(255, 255, 255, 0.75);
}

.note-number {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-weight: 600;
    font-size: 7px;
}

.note-number.impossible {
    color: #999;
    text-decoration: line-through;
}

/* Еще больше увеличиваем заметки на мобильных */
@media (max-width: 480px) {
    .notes {
        font-size: 9px;
        //padding: 1px;
    }

    .note-number {
        font-size: 12px;
    }

    .cell.same-note .note-number {
        //font-size: 10px !important;
    }
}

@media (max-width: 360px) {
    .notes {
        font-size: 8px;
    }

    .note-number {
        font-size: 10px;
    }

    .cell.same-note .note-number {
       // font-size: 9px !important;
    }
}

/* Границы */
.cell.border-right-3 {
    border-right: 2px solid #333 !important;
}

.cell.border-bottom-3 {
    border-bottom: 2px solid #333 !important;
}

/* Статус */
.status {
    text-align: center;
    margin: 10px 0;
    font-size: 14px;
    font-weight: 500;
    min-height: 20px;
    padding: 8px;
    border-radius: 6px;
}

.status.correct {
    background: #e8f5e9;
    color: #2e7d32;
}

.status.incorrect {
    background: #ffebee;
    color: #c62828;
}

.status.loading {
    background: #e3f2fd;
    color: #1565c0;
}

.notes-info {
    text-align: center;
    font-size: 12px;
    color: #666;
    min-height: 18px;
    padding: 5px;
}

/* Адаптивность для больших экранов */
@media (min-width: 768px) {
    .container {
        max-width: 600px;
        padding: 30px;
    }

    h1 {
        font-size: 2.2rem;
        margin-bottom: 20px;
    }

    .controls {
        grid-template-columns: repeat(4, 1fr);
        gap: 10px;
    }

    .controls select {
        grid-column: auto;
    }

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

    .cell {
        font-size: 20px;
    }

    .notes {
        font-size: 9px;
        //padding: 2px;
    }

    .note-number {
        font-size: 9px;
    }

    .numbers-counter {
        grid-template-columns: repeat(9, 1fr);
        padding: 15px;
    }

    .counter-item {
        padding: 10px 6px;
    }

    .counter-number {
        font-size: 1.6rem;
    }

    .counter-count {
        font-size: 0.9rem;
    }
}

/* Адаптивность для индикаторов */
@media (max-width: 480px) {
    .numbers-counter {
        gap: 4px;
        padding: 10px;
    }

    .counter-item {
        padding: 6px 3px;
    }

    .counter-number {
        font-size: 1.2rem;
    }

  .notes {
    font-size: 12px;
  }

    .counter-count {
        font-size: 0.7rem;
    }
}

@media (max-width: 360px) {
    .counter-number {
        font-size: 1.1rem;
    }

    .counter-count {
        font-size: 0.65rem;
    }
}

/* Портретная ориентация */
@media (orientation: portrait) {

    .container {
        padding: 0px;
        margin: 0px;
    }

    h1 {
        font-size: 1.5rem;
        margin-bottom: 10px;
    }

    .game-container {
        gap: 10px;
    }


    .cell {
        font-size: 20px;
    }
}

/* Ландшафтная ориентация */
@media (max-width: 900px) and (orientation: landscape) {
    .container {
        padding: 15px;
        max-width: 100%;
    }

    .game-container {
        flex-direction: row;
        justify-content: center;
        align-items: flex-start;
    }

    .sudoku-grid {
        max-width: 45vh;
    }

    .numbers-counter {
        grid-template-columns: repeat(9, 1fr);
        margin-bottom: 10px;
        padding: 8px;
    }

    .counter-item {
        padding: 5px 2px;
    }

    .counter-number {
        font-size: 1.1rem;
    }

    .counter-count {
        font-size: 0.7rem;
    }

    .cell {
        font-size: 14px;
    }
}

/* Очень маленькие экраны */
@media (max-width: 320px) {

    .container {
        padding: 0px;
        margin: 0px;
    }
    .controls button {
        font-size: 11px;
        padding: 10px 6px;
    }

    .cell {
        font-size: 14px;
    }

    .notes {
        font-size: 7px;
    }

    .note-number {
        font-size: 9px;
    }

    .counter-number {
        font-size: 1rem;
    }

    .counter-count {
        font-size: 0.7rem;
    }
}
