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

body {
    background: linear-gradient(135deg, #8B7355 0%, #A0826D 50%, #8B7355 100%);
    font-family: 'Comic Sans MS', 'Chalkboard SE', 'Bradley Hand', cursive;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.notebook-page {
    background: #FFFEF0;
    background-image: 
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 31px,
            #E0DFD5 31px,
            #E0DFD5 32px
        ),
        linear-gradient(90deg, transparent 0px, transparent 40px, #FFE4E4 41px, transparent 42px);
    box-shadow: 
        0 0 5px rgba(0,0,0,0.1),
        2px 2px 10px rgba(0,0,0,0.15),
        inset 0 0 100px rgba(0,0,0,0.02);
    padding: 40px;
    max-width: 700px;
    width: 100%;
    position: relative;
    border-radius: 3px;
}

.notebook-page::before {
    content: '';
    position: absolute;
    left: 40px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #FFB6C1;
    opacity: 0.5;
}

.page-header {
    text-align: center;
    margin-bottom: 30px;
    position: relative;
}

.page-header h1 {
    font-size: 2.5rem;
    color: #2C3E50;
    text-shadow: 2px 2px 0px rgba(0,0,0,0.05);
    font-family: 'Comic Sans MS', cursive;
    margin-bottom: 10px;
}

.close-btn {
    position: absolute;
    top: 0;
    right: 0;
    background: #FFB6C1;
    border: 2px solid #FF69B4;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: bold;
}

.close-btn:hover {
    background: #FF69B4;
    transform: rotate(90deg);
}

.instructions {
    text-align: center;
    margin-bottom: 25px;
    color: #555;
    font-size: 1.1rem;
}

.sudoku-container {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}

.sudoku-grid {
    display: grid;
    grid-template-columns: repeat(9, 45px);
    grid-template-rows: repeat(9, 45px);
    gap: 0;
    border: 3px solid #2C3E50;
    background: #FFF;
    box-shadow: 3px 3px 8px rgba(0,0,0,0.2);
}

.sudoku-cell {
    width: 45px;
    height: 45px;
    border: 1px solid #B0B0B0;
    text-align: center;
    font-size: 1.5rem;
    font-family: 'Comic Sans MS', cursive;
    font-weight: bold;
    color: #999;
    background: #FFF;
    transition: all 0.2s;
    position: relative;
}

.sudoku-cell:focus {
    outline: none;
    background: #FFF9C4;
    border-color: #FF6B9D;
}

.sudoku-cell.number-highlight {
    box-shadow: inset 0 0 0 3px #FDD835;
}

.sudoku-cell.given {
    background: #E3F2FD;
    color: #000;
    font-weight: 900;
}

.sudoku-cell.solved {
    background: #C8E6C9;
    color: #2E7D32;
}

.sudoku-cell.invalid,
.sudoku-cell.invalid-sudoku {
    background: #FFCDD2;
    color: #C62828;
    font-weight: 900;
}

.illegal-bubble {
    position: absolute;
    top: -35px;
    left: 50%;
    transform: translateX(-50%);
    background: #D32F2F;
    color: white;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: bold;
    white-space: nowrap;
    pointer-events: none;
    animation: bubbleAppear 0.3s ease-out;
    opacity: 1;
    transition: opacity 0.3s ease-in;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

@keyframes bubbleAppear {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Thick borders for 3x3 boxes */
.sudoku-cell:nth-child(3n) {
    border-right: 2px solid #2C3E50;
}

.sudoku-cell:nth-child(n+19):nth-child(-n+27),
.sudoku-cell:nth-child(n+46):nth-child(-n+54) {
    border-bottom: 2px solid #2C3E50;
}

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

.paper-button {
    background: linear-gradient(145deg, #FFEB3B, #FDD835);
    border: 2px solid #F9A825;
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 1.1rem;
    font-family: 'Comic Sans MS', cursive;
    font-weight: bold;
    color: #333;
    cursor: pointer;
    box-shadow: 3px 3px 6px rgba(0,0,0,0.15);
    transition: all 0.2s;
    text-transform: uppercase;
}

.paper-button:hover {
    transform: translateY(-2px);
    box-shadow: 4px 4px 8px rgba(0,0,0,0.2);
    background: linear-gradient(145deg, #FDD835, #FBC02D);
}

.paper-button:active {
    transform: translateY(0);
    box-shadow: 2px 2px 4px rgba(0,0,0,0.15);
}

#clearBtn {
    background: linear-gradient(145deg, #FF8A80, #FF5252);
    border-color: #D32F2F;
}

#clearBtn:hover {
    background: linear-gradient(145deg, #FF5252, #E53935);
}

#exampleBtn {
    background: linear-gradient(145deg, #80DEEA, #26C6DA);
    border-color: #0097A7;
}

#exampleBtn:hover {
    background: linear-gradient(145deg, #26C6DA, #00ACC1);
}

.solution-info {
    margin-top: 30px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.7);
    border: 2px dashed #FF69B4;
    border-radius: 10px;
    text-align: center;
}

.solution-info h3 {
    color: #2C3E50;
    margin-bottom: 10px;
    font-size: 1.3rem;
}

.solution-info p {
    color: #555;
    font-size: 1.1rem;
    line-height: 1.6;
}

/* Responsive */
@media (max-width: 600px) {
    .sudoku-grid {
        grid-template-columns: repeat(9, 35px);
        grid-template-rows: repeat(9, 35px);
    }
    
    .sudoku-cell {
        width: 35px;
        height: 35px;
        font-size: 1.2rem;
    }
    
    .page-header h1 {
        font-size: 2rem;
    }
    
    .notebook-page {
        padding: 20px;
    }
}
