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

.container {
    background: white;
    border-radius: 20px;
    padding: 10px 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 600px;
    width: 100%;
}

h1 {
    color: #333;
    margin: 20px 0;
    font-size: 2.2em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.sudoku-grid {
    display: inline-block;
    border: 3px solid #333;
    background: #f9f9f9;
    margin: 0;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.sudoku-row {
    display: flex;
}

.sudoku-cell {
    width: 45px;
    height: 45px;
    border: 1px solid #999;
    text-align: center;
    font-size: 18px;
    transition: all 0.2s ease;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sudoku-cell { position: relative; }

.sudoku-cell:nth-child(3n):not(:last-child) {
    border-right: 3px solid #333;
}

.sudoku-row:nth-child(3n) .sudoku-cell {
    border-bottom: 3px solid #333;
}

.sudoku-cell input {
    width: 100%;
    height: 100%;
    padding: 0;
    border: none;
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    background: transparent;
    outline: none;
    position: relative; /* メモより手前に表示するため */
    z-index: 2;
}

.memo-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    z-index: 1;
}

.memo-note-cell {
    font-size: 12px;
    color: #666;
    display: flex;
    justify-content: center;
    align-items: center;
    visibility: hidden; /* デフォルトは非表示 */
}

.memo-note-cell.memo-highlight {
    color: #FF5722; /* ハイライト用の色 */
    font-weight: bold;
}

.sudoku-cell.highlight-same-number {
    background-color: #fff9c4 !important; /* ハイライト用の背景色 */
    transition: background-color 0.3s ease;
}

.sudoku-cell.active {
    background-color: #d0e3ff; /* 選択中のセルの背景色 */
    outline: 2px solid #FF0B55;
    outline-offset: -3px;
}

.sudoku-cell.highlight-same-number input {
    font-weight: bold;
    color: #FF5722;
}

.sudoku-cell.given {
    /* background: #e3f2fd; */
    color: #1976d2;
}

.sudoku-cell.given input {
    font-weight: bold;
}

.sudoku-cell.error {
    background: #ffebee;
    color: #d32f2f;
}

.sudoku-cell.correct {
    background: #e8f5e8;
    color: #2e7d32;
}

.sudoku-cell:hover {
    background: #f0f0f0;
}

.controls {
    margin: 20px 0;
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.btn-primary {
    background: linear-gradient(45deg, #2196F3, #21CBF3);
    color: white;
}

.btn-secondary {
    background: linear-gradient(45deg, #FF9800, #FF5722);
    color: white;
}

.btn-success {
    background: linear-gradient(45deg, #4CAF50, #8BC34A);
    color: white;
}

.btn-info {
    background: linear-gradient(45deg, #6c757d, #343a40);
    color: white;
}

.btn-warning {
    background: linear-gradient(45deg, #FFC107, #FF9800);
    color: white;
}

.btn-undo {
    background: linear-gradient(45deg, #9E9E9E, #616161);
    color: white;
}

.btn-redo {
    background: linear-gradient(45deg, #78909C, #546E7A);
    color: white;
}

.difficulty-selector {
    margin: 20px 0;
}

#memo-toggle-btn.active {
    background: linear-gradient(45deg, #17a2b8, #1fcfd2);
    box-shadow: 0 0 10px #17a2b8;
}

.difficulty-selector select {
    padding: 10px 15px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 16px;
    background: white;
}

.message {
    margin: 15px 0;
    padding: 10px;
    border-radius: 10px;
    font-weight: bold;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.number-pad {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.number-pad button {
    width: 45px;
    height: 45px;
    font-size: 18px;
    font-weight: bold;
    border-radius: 50%;
    border: 2px solid #ccc;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

.btn:disabled, .number-pad button:disabled {
    background: #e0e0e0;
    cursor: not-allowed;
    transform: none;
}

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

    50% {
        transform: scale(1.05);
    }

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

.solving {
    animation: pulse 1s infinite;
}

@media (max-width: 600px) {
    .sudoku-cell {
        width: 35px;
        height: 35px;
    }

    .number-pad button {
        width: 35px;
        height: 35px;
    }

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

    .controls {
        flex-direction: column;
        align-items: center;
    }

    .btn {
        width: 200px;
    }
}