/* ===========================
   3 × 3 KenKen
   =========================== */

*{
    margin:0;
    padding:0;
    box-sizing:border-box;
    font-family:Arial, Helvetica, sans-serif;
}

body{
    background:#f2f4f8;
    display:flex;
    justify-content:center;
    align-items:center;
    min-height:100vh;
    padding:20px;
}

.container{
    width:100%;
    max-width:700px;
    background:#fff;
    padding:25px;
    border-radius:12px;
    box-shadow:0 5px 15px rgba(0,0,0,.15);
}

h1{
    text-align:center;
    color:#1565c0;
    margin-bottom:20px;
}

.toolbar{
    display:flex;
    justify-content:center;
    align-items:end;
    gap:15px;
    flex-wrap:wrap;
    margin-bottom:20px;
}

.toolbar label{
    display:block;
    margin-bottom:5px;
    font-weight:bold;
}

select,
button{
    padding:10px 15px;
    border-radius:8px;
    border:1px solid #ccc;
    font-size:16px;
}

button{
    background:#1565c0;
    color:white;
    cursor:pointer;
    border:none;
    transition:.2s;
}

button:hover{
    background:#0d47a1;
}

#board{
    display:grid;
    grid-template-columns:repeat(3, 1fr);
    width:min(390px, 100%);
    aspect-ratio:1 / 1;
    margin:20px auto;
    border:3px solid red;
}

.cell{
    position:relative;
    width:100%;
    height:100%;
    min-width:0;
    display:flex;
    align-items:center;
    justify-content:center;
    background:#fff;
    border:1px solid #777;
}

.cell input{
    width:100%;
    height:100%;
    border:0;
    outline:none;
    background:transparent;
    text-align:center;
    font-size:clamp(28px, 7vw, 42px);
    font-weight:bold;
    color:#1565c0;
    padding-top:8px;
}

.cell:focus-within{
    background:#eaf3ff;
    box-shadow:inset 0 0 0 2px #1565c0;
}

.fixed{
    background:#e3f2fd;
}

.fixed input{
    color:#000;
}

/* Cage walls are drawn with JS */
.cell.wall-top{
    border-top:3px solid red;
}

.cell.wall-right{
    border-right:3px solid red;
}

.cell.wall-bottom{
    border-bottom:3px solid red;
}

.cell.wall-left{
    border-left:3px solid red;
}

.cage-label{
    position:absolute;
    top:3px;
    left:5px;
    font-size:13px;
    line-height:1;
    font-weight:bold;
    color:#222;
    pointer-events:none;
    z-index:3;
}

#message{
    text-align:center;
    margin-top:20px;
    font-size:20px;
    font-weight:bold;
    min-height:30px;
}

.success{
    color:green;
}

.error{
    color:red;
}

.status{
    text-align:center;
    font-size:24px;
    font-weight:bold;
    margin:15px 0;
    color:#1565c0;
}

.timer-buttons{
    display:flex;
    justify-content:center;
    gap:10px;
    margin:15px 0;
}

.timer-buttons button{
    width:120px;
}

#bestTime{
    color:#2e7d32;
    font-weight:bold;
}

.game-info{
    margin:20px 0;
    padding:15px 20px;
    background:#eef7ff;
    border-left:5px solid #1565c0;
    border-radius:10px;
}

.game-info h3{
    color:#1565c0;
    margin-bottom:10px;
}

.game-info p{
    margin:8px 0;
    line-height:1.6;
}

@media(max-width:600px){

    .container{
        padding:15px;
    }

    #board{
        width:100%;
    }

    .toolbar{
        flex-direction:column;
        align-items:stretch;
    }

    button,
    select{
        width:100%;
    }

    .cage-label{
        font-size:11px;
    }
}
/* Home navigation */
.home-button{display:inline-flex;align-items:center;justify-content:center;gap:6px;margin:0 auto 16px;padding:9px 16px;border-radius:9px;background:#1769e0;color:#fff;text-decoration:none;font-weight:700;font-size:14px;box-shadow:0 4px 10px rgba(23,105,224,.18);transition:.2s}.home-button:hover{background:#1258bd;transform:translateY(-1px)}
