/* 1. RESET & GLOBAL STYLES*/
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #0f172a; /* Deep dark blue background */
    color: #f8fafc;
    overflow-x: hidden;
    position: relative;
    padding: 20px;
}

/* 2. ANIMATED BG */
.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.6;
    z-index: -1;
    animation: float 10s infinite alternate ease-in-out;
}

.blob-1 {
    width: 300px;
    height: 300px;
    background: #ffffff; /* white */
    top: 10%;
    left: 15%;
}

.blob-2 {
    width: 350px;
    height: 350px;
    background: #000000; /* black */
    bottom: 10%;
    right: 15%;
    animation-delay: -3s;
}


/* 3. GLASSMORPHISM MAIN CONTAINER & FADE-IN ANIMATION */
.game-container {
    background: rgba(30, 41, 59, 0.65); /* Semi-transparent dark slate */
    backdrop-filter: blur(16px); /* Blurs the background behind card */
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 30px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    animation: fadeIn 0.8s ease-out; /* Smooth load animation */
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Header Text Styling */
header {
    text-align: center;
    margin-bottom: 20px;
}

header h1 {
    font-size: 2.2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #38bdf8, #c084fc); /* Gradient text */
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

header p {
    color: #94a3b8;
    font-size: 0.9rem;
    margin-top: 4px;
}

/* 4. STATS BAR (Timer & Mistakes) */
.stats-bar {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

.stat-box {
    background: rgba(15, 23, 42, 0.5);
    padding: 10px 18px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 47%;
}

.stat-label {
    font-size: 0.75rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    font-size: 1.2rem;
    font-weight: 600;
    color: #38bdf8;
}

/*  SUDOKU GRID & 3x3 BORDER STYLING */
.sudoku-board {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 1px;
    background: #334155; /* Grid thin internal lines */
    border: 3.5px solid #cbd5e1; /* Strong prominent outer border */
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 20px;
}

.cell {
    width: 100%;
    aspect-ratio: 1; /* Keeps cells square */
    background: rgba(15, 23, 42, 0.85);
    border: none;
    text-align: center;
    font-size: 1.25rem;
    font-weight: 600;
    color: #f8fafc;
    outline: none;
    transition: all 0.2s ease;
}

/* Darker, thicker borders for 3x3 box visual separation */
.cell[data-col="2"], .cell[data-col="5"] {
    border-right: 3px solid #cbd5e1;
}
.cell[data-row="2"], .cell[data-row="5"] {
    border-bottom: 3px solid #cbd5e1;
}

/* Read-only original fixed numbers styling */
.cell.fixed {
    background: rgba(30, 41, 59, 0.95);
    color: #38bdf8; /* Bright Cyan color for given numbers */
    font-weight: 700;
}

/* Interactive Highlights */
.cell.highlighted {
    background: rgba(56, 189, 248, 0.18); /* Light blue for row/col */
}

.cell.selected {
    background: rgba(168, 85, 247, 0.35) !important; /* Purple for active cell */
    border: 2px solid #c084fc;
}

.cell.duplicate {
    background: rgba(239, 68, 68, 0.3) !important; /* Red highlight for invalid inputs */
    color: #fca5a5;
}

/* Correct entry micro-animation */
.cell.correct-anim {
    animation: pulse 0.3s ease-in-out;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); background: rgba(34, 197, 94, 0.4); }
    100% { transform: scale(1); }
}

/* CONTROL BUTTONS & MESSAGES */
.controls {
    display: flex;
    gap: 10px;
}

.btn {
    flex: 1;
    padding: 12px 10px;
    border: none;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
}

.btn-secondary {
    background: rgba(51, 65, 85, 0.8);
    color: #cbd5e1;
}

.btn-accent {
    background: linear-gradient(135deg, #a855f7, #7e22ce);
    color: white;
}

.btn:hover {
    transform: translateY(-2px);
    opacity: 0.9;
}

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

.message {
    text-align: center;
    font-weight: 600;
    margin-bottom: 15px;
    min-height: 24px;
}

.message.success { color: #4ade80; } /* Green text */
.message.error { color: #f87171; }   /* Red text */

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .game-container { padding: 20px 15px; }
    .cell { font-size: 1rem; }
    .btn { font-size: 0.8rem; padding: 10px 5px; }
}