/* ==========================================
   Sudoku Contest UI
========================================== */

.sudo-ui{

    display:flex;

    justify-content:center;

    align-items:center;

    position:relative;

    width:100%;

    min-height:0;

    overflow:visible;

}

#board{

    display:grid;

    --sudoku-gap:8px;

    --sudoku-padding:20px;

    gap:var(--sudoku-gap);

    justify-content:center;

    align-content:center;

    margin:20px auto;

    padding:var(--sudoku-padding);

    background:#fff;

    border-radius:15px;

    box-shadow:0 5px 20px rgba(0,0,0,.08);

    min-height:0;

    width:100%;

    max-width:100%;

    box-sizing:border-box;

    overflow:visible;

}
.cell{

    display:block;

    min-width:0;

    min-height:0;

    margin:0;

    padding:0;

    box-sizing:border-box;

    text-align:center;

    line-height:1;

    font-family:inherit;

    appearance:textfield;

    -webkit-appearance:none;

    border:2px solid #cfd8dc;

    border-radius:10px;

    font-weight:700;

    color:#263238;

    transition:.2s;

    caret-color:#1565c0;

}

/* Number input spinner can cover the digit in small 5×5–9×9 cells. */
.cell::-webkit-inner-spin-button,
.cell::-webkit-outer-spin-button{

    margin:0;

    -webkit-appearance:none;

}

.cell:hover{

    border-color:#1565c0;

}

.cell:focus{

    border-color:#1565c0;

    box-shadow:0 0 0 3px rgba(21,101,192,.15);

}


.fixed{
    background:#e3f2fd;
    color:#000;
}


/* ==========================================
   Contest Overlay
========================================== */

.contest-overlay{

    position:absolute;

    inset:0;

    display:flex;

    justify-content:center;

    align-items:center;

    background:rgba(0,0,0,.55);

    backdrop-filter:blur(8px);

}

.overlay-box{

    width:90%;

    max-width:420px;

    background:#fff;

    border-radius:20px;

    padding:35px;

    text-align:center;

    box-shadow:0 20px 50px rgba(0,0,0,.25);

}

.overlay-icon{

    font-size:65px;

    margin-bottom:15px;

}

.overlay-box h2{

    color:#1565c0;

    margin-bottom:12px;

    font-weight:700;

}

.overlay-box p{

    color:#666;

    line-height:1.7;

    margin-bottom:25px;

}

.success{
    color:green;
}

.error{
    color:red;
}
.status{

    display:flex;

    justify-content:center;

    align-items:center;

    gap:8px;

    font-size:18px;

    font-weight:700;

    color:#1565c0;

    margin:12px 0;

}


#bestTime{

    color:#2e7d32;

    font-weight:700;

}
.toolbar{

    display:flex;

    justify-content:center;

    align-items:center;

    gap:18px;

    margin:30px 0;

    flex-wrap:wrap;

}
.timer-buttons{
    text-align: center;
}
.toolbar button,
.timer-buttons button{

    height:34px;

    padding:0 24px;

    border:none;

    border-radius:10px;

    background:#1565c0;

    color:#fff;

    font-size:15px;

    font-weight:600;

    cursor:pointer;

    transition:.25s;

    box-shadow:0 4px 12px rgba(21,101,192,.25);

}

.toolbar button:hover,
.timer-buttons button:hover{

    background:#0d47a1;

    transform:translateY(-2px);

    box-shadow:0 8px 18px rgba(21,101,192,.35);

}

.toolbar button:active,
.timer-buttons button:active{

    transform:scale(.97);

}
.toolbar select{

    height:34px;

    padding:0 16px;

    border:2px solid #2196f3;

    border-radius:10px;

    background:#fff;

    font-size:15px;

    font-weight:600;

    color:#1565c0;

}

#message{

    margin-top:20px;

    text-align:center;

    font-size:18px;

    font-weight:bold;

}

/* ==========================================
   Level Information
========================================== */

.overlay-info{

    display:grid;

    grid-template-columns:1fr 1fr;

    gap:15px;

    margin-bottom:25px;

}

.overlay-info div{

    background:#eef6ff;

    padding:15px;

    border-radius:10px;

}

.overlay-info strong{

    color:#1565c0;

    display:block;

    margin-bottom:8px;

}

.overlay-info span{

    font-size:18px;

    font-weight:bold;

}



/* ==========================================
   Start Button
========================================== */

#startContestBtn{

    width:100%;

    padding:14px;

    border:none;

    border-radius:10px;

    background:#1565c0;

    color:#ffffff;

    font-size:18px;

    font-weight:bold;

    cursor:pointer;

    transition:.3s;

}

#startContestBtn:hover{

    background:#0d47a1;

    transform:translateY(-2px);

}



/* ==========================================
   Contest Status
========================================== */

.contest-status{

    margin-top:25px;

    display:grid;

    grid-template-columns:repeat(4,1fr);

    gap:15px;

}

.contest-status div{

    background:#ffffff;

    border-radius:12px;

    padding:18px;

    text-align:center;

    box-shadow:0 5px 15px rgba(0,0,0,.08);

    transition:.3s;

}

.contest-status div:hover{

    transform:translateY(-4px);

}

.contest-status strong{

    color:#1565c0;

    display:block;

    margin-bottom:10px;

}

.contest-status span{

    font-weight:bold;

    font-size:18px;

}



/* ==========================================
   Responsive
========================================== */

@media(max-width:768px){

    .sudo-ui{

        min-height:0;

    }

    #board{

        --sudoku-gap:6px;

        --sudoku-padding:14px;

        min-height:0;

    }

    .contest-status{

        grid-template-columns:repeat(2,1fr);

    }
}

@media(max-width:576px){

    #board{

        --sudoku-gap:4px;

        --sudoku-padding:10px;

        margin:12px auto;

        border-radius:12px;

    }

    .contest-status{

        grid-template-columns:1fr;

    }

    .toolbar{

        flex-direction:column;

        align-items:stretch;

    }
}

/* ==========================================
   Compact contest controls and responsive popup
========================================== */

.contest-top-actions{
    display:flex;
    justify-content:center;
    align-items:center;
    gap:12px;
    margin:12px 0;
    flex-wrap:wrap;
}

.sudo-ui{
    min-height:350px;
}

.contest-top-actions .status{
    margin:0;
}

.board-actions{
    display:flex;
    justify-content:center;
    margin:10px 0 20px;
}

#checkBtn{
    min-width:190px;
    min-height:42px;
    padding:10px 24px;
    border:0;
    border-radius:10px;
    background:#1565c0;
    color:#fff;
    font-size:16px;
    font-weight:700;
    cursor:pointer;
    box-shadow:0 4px 12px rgba(21,101,192,.25);
    transition:transform .2s, background-color .2s, box-shadow .2s;
}

#checkBtn:hover{
    background:#0d47a1;
    transform:translateY(-2px);
    box-shadow:0 8px 18px rgba(21,101,192,.32);
}

#checkBtn:active{
    transform:scale(.98);
}

.contest-overlay{
    z-index:10;
    padding:16px;
}

.overlay-box{
    width:min(88%, 360px);
    max-width:360px;
    padding:24px;
    border-radius:16px;
}

.overlay-icon{
    font-size:46px;
    line-height:1;
    margin-bottom:10px;
}

.overlay-box h2{
    margin-bottom:8px;
    font-size:24px;
}

.overlay-box p{
    margin-bottom:16px;
    font-size:14px;
    line-height:1.45;
}

.overlay-info{
    gap:10px;
    margin-bottom:16px;
}

.overlay-info div{
    padding:10px;
}

.overlay-info strong{
    margin-bottom:5px;
}

.overlay-info span{
    font-size:15px;
}

#startContestBtn{
    padding:11px 14px;
    font-size:16px;
}

@media(max-width:576px){
    .sudo-ui{
        min-height:300px;
    }

    .contest-overlay{
        padding:10px;
    }

    .overlay-box{
        width:min(92%, 330px);
        padding:18px 14px;
        border-radius:14px;
    }

    .overlay-icon{
        font-size:36px;
        margin-bottom:7px;
    }

    .overlay-box h2{
        font-size:20px;
    }

    .overlay-box p{
        margin-bottom:12px;
        font-size:13px;
    }

    .overlay-info{
        gap:8px;
        margin-bottom:12px;
    }

    .overlay-info div{
        padding:8px 5px;
    }

    .overlay-info strong{
        font-size:12px;
    }

    .overlay-info span{
        font-size:13px;
    }

    .contest-top-actions{
        flex-wrap:nowrap;
        gap:8px;
    }

    .contest-time{
        font-size:15px;
        white-space:nowrap;
    }

    .timer-buttons button{
        height:32px;
        padding:0 14px;
        font-size:13px;
    }

    #checkBtn{
        width:min(100%, 260px);
        min-width:0;
    }
}
