/* Custom styles for Killer Sudoku */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

body {
    font-family: 'Inter', sans-serif;
    background-color: #f8fafc;
    color: #1e293b;
}

.sudoku-grid {
    display: grid;
    grid-template-columns: repeat(9, minmax(0, 1fr));
    border: 3px solid #1e293b;
    /* Thicker border */
    background-color: #1e293b;
    gap: 1px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    max-width: 600px;
    /* Increased max-width */
    width: 100%;
    margin: 0 auto;
}

.cell {
    background-color: white;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    /* Larger font size */
    font-weight: 500;
    cursor: pointer;
    position: relative;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    touch-action: manipulation;
    transition: background-color 0.1s ease;
    /* Prevent OS keyboard in PWA mode */
    caret-color: transparent;
}

.cell-selected {
    background-color: #93c5fd !important;
    /* Blue 300 - Stronger */
}

.cell-highlighted {
    background-color: #dbeafe;
    /* Blue 100 - Stronger */
}

.cell-same-value {
    background-color: #60a5fa;
    /* Blue 400 - Stronger */
    color: white;
}

.cell-initial {
    font-weight: 700;
    color: #0f172a;
}

.cell-user {
    color: #1d4ed8;
    /* Blue 700 */
}

.cage-sum {
    position: absolute;
    top: 2px;
    left: 2px;
    font-size: 1rem;
    /* Larger font */
    font-weight: 800;
    /* Bolder */
    color: #1e293b;
    /* Darker */
    line-height: 1;
    z-index: 10;
    background-color: rgba(255, 255, 255, 0.95);
    /* More opaque */
    padding: 2px 4px;
    /* More padding */
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.cage-sum-invalid {
    color: #dc2626 !important;
    /* Red text */
    background-color: #fee2e2 !important;
    /* Light red background */
    border: 1px solid #dc2626;
}

button {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

/* Thick borders for 3x3 blocks */
.cell:nth-child(3n) {
    border-right: 1px solid #1e293b;
}

.cell:nth-child(9n) {
    border-right: none;
}

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

/* Custom dashed borders that connect perfectly by being on the edge */
.cell::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 5;
    border: 0 solid transparent;
}

.cage-top::before {
    border-top: 2px dashed #334155;
}

.cage-bottom::before {
    border-bottom: 2px dashed #334155;
}

.cage-left::before {
    border-left: 2px dashed #334155;
}

.cage-right::before {
    border-right: 2px dashed #334155;
}

/* Remove previous complex logic and corner fills */

/* Error styles */
.cell-invalid {
    background-color: #fee2e2 !important;
    /* Red 100 */
}

.cell-invalid .cell-user {
    color: #dc2626 !important;
    /* Red 600 */
}

.cell-invalid.cell-selected {
    background-color: #fecaca !important;
    /* Red 200 */
}

/* Control buttons hover effects */
.num-btn {
    transition: all 0.2s ease;
}

.num-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.num-btn:active {
    transform: translateY(0);
}

.control-btn {
    transition: all 0.2s ease;
}

.control-btn:hover {
    background-color: #e2e8f0;
    color: #1e293b;
}

#new-game-btn {
    transition: all 0.2s ease;
}

#new-game-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

#new-game-btn:active {
    transform: translateY(0);
}