/* --- New Game Button (outside card) --- */
.newgame-btn {
    margin-top: 0;
    background: linear-gradient(90deg, #00c6ff 60%, #007bff 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 700;
    padding: 13px 38px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.13);
    cursor: pointer;
    letter-spacing: 0.5px;
    transition: background 0.3s, box-shadow 0.3s, transform 0.2s;
}
.newgame-btn:hover {
    background: linear-gradient(90deg, #007bff 60%, #00c6ff 100%);
    color: #fff;
    box-shadow: 0 6px 16px rgba(0,0,0,0.18);
    transform: translateY(-2px);
}
/* --- Play Button Level Menu --- */
.play-level-menu {
    position: absolute;
    top: 60px;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 16px #007bff33;
    padding: 10px 12px;
    z-index: 100;
    min-width: 90px;
    border: 1.5px solid #007bff;
    animation: fadeIn 0.2s;
}
.play-level-menu .level-btn {
    background: #e3f0ff;
    color: #007bff;
    border: none;
    border-radius: 6px;
    padding: 7px 0;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.play-level-menu .level-btn:hover {
    background: #007bff;
    color: #fff;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- New Game Button Level Menu (Play Page) --- */
.newgame-level-menu {
    position: absolute;
    top: 40px;
    left: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 16px #007bff33;
    padding: 10px 12px;
    z-index: 100;
    min-width: 90px;
    border: 1.5px solid #007bff;
    animation: fadeIn 0.2s;
}
.newgame-level-menu .level-btn {
    background: #e3f0ff;
    color: #007bff;
    border: none;
    border-radius: 6px;
    padding: 7px 0;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.newgame-level-menu .level-btn:hover {
    background: #007bff;
    color: #fff;
}

/* --- Level name next to timer --- */
.timer-level {
    display: flex;
    align-items: center;
    gap: 18px;
    justify-content: flex-end;
}
.timer-level .level-name {
    font-size: 1.1rem;
    color: #444;
    background: #f0f0f0;
    border-radius: 6px;
    padding: 6px 14px;
    font-weight: 600;
    min-width: 70px;
    box-shadow: 0 1px 4px #007bff11;
}
/* --- Play Button (Top Right) --- */
.play-btn {
    position: absolute;
    top: 32px;
    right: 40px;
    z-index: 10;
    width: 54px;
    height: 54px;
    background: rgba(255,255,255,0.85);
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.13);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: box-shadow 0.2s, background 0.2s;
    border: 2px solid #007bff;
    animation: play-pulse 1.5s infinite;
}
.play-btn:hover {
    background: #e3f0ff;
    box-shadow: 0 4px 16px #007bff44;
}
.play-icon {
    display: block;
    width: 0;
    height: 0;
    border-top: 16px solid transparent;
    border-bottom: 16px solid transparent;
    border-left: 26px solid #007bff;
    margin-left: 6px;
    animation: play-icon-move 1.5s infinite;
}
@keyframes play-pulse {
    0% { box-shadow: 0 2px 8px #007bff33; }
    50% { box-shadow: 0 0 24px #007bff66; }
    100% { box-shadow: 0 2px 8px #007bff33; }
}
@keyframes play-icon-move {
    0% { margin-left: 6px; }
    50% { margin-left: 12px; }
    100% { margin-left: 6px; }
}

/* --- Play Page Layout --- */
.play-container {
    max-width: 480px;
    margin: 48px auto 0 auto;
    background: rgba(255,255,255,0.95);
    border-radius: 18px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    padding: 32px 28px 28px 28px;
    text-align: center;
}
.play-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}
.level-select {
    display: flex;
    align-items: center;
    gap: 8px;
}
.timer {
    font-size: 1.2rem;
    font-weight: 600;
    color: #007bff;
    background: #e3f0ff;
    border-radius: 6px;
    padding: 6px 16px;
    min-width: 70px;
    box-shadow: 0 1px 4px #007bff11;
}
.play-actions {
    margin: 18px 0 0 0;
    display: flex;
    justify-content: center;
    gap: 18px;
}
#play-result {
    margin-top: 18px;
    font-size: 1.1rem;
    min-height: 24px;
}
body {
    font-family: 'Arial', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    background-image: url(img.jpeg); 
    background-size: cover; 
    background-position: center; 
    background-repeat: no-repeat; 
}

.container {
    text-align: center;
    background: rgba(255, 255, 255, 0.8); 
    padding: 20px;
    border-radius: 10px; 
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(15px); 
}

h1 {
    margin-bottom: 18px;
    color: #222;
    font-size: 2.2rem;
    letter-spacing: 1px;
    font-weight: 700;
    text-shadow: 0 2px 8px #00000011;
}

.grid {
    display: grid;
    grid-template-columns: repeat(9, 40px);
    grid-template-rows: repeat(9, 40px);
    gap: 0;
    margin: 24px auto 20px auto;
    border: 3px solid #333;
    border-radius: 12px;
    background-color: #f9f9f9;
    box-shadow: 0 2px 16px rgba(0,0,0,0.10), 0 1.5px 0 #333;
    overflow: hidden;
    position: relative;
}

.cell {
    width: 40px;
    height: 40px;
    text-align: center;
    font-size: 20px;
    font-weight: 500;
    border: 1px solid #ddd;
    box-sizing: border-box;
    background-color: #fff;
    transition: background-color 0.2s, box-shadow 0.2s, border-color 0.2s;
    outline: none;
    position: relative;
}

/* 3x3 box distinction */
.cell {
    border-top-width: 1px;
    border-left-width: 1px;
    border-right-width: 1px;
    border-bottom-width: 1px;
    border-color: #ddd;
}
/* 3x3 distinction: black borders */
.cell:nth-child(n+1):nth-child(-n+9) { border-top: 1.5px solid #000 !important; }
.cell:nth-child(9n+1) { border-left: 1.5px solid #000 !important; }
.cell:nth-child(9n) { border-right: 1.5px solid #000 !important; }
.cell:nth-child(n+73):nth-child(-n+81) { border-bottom: 1.5px solid #000 !important; }
.cell:nth-child(3n) { border-right: 1px solid #000 !important; }
.cell:nth-child(3n+1) { border-left: 1px solid #000 !important; }
.cell:nth-child(n+19):nth-child(-n+27),
.cell:nth-child(n+46):nth-child(-n+54) {
    border-bottom: 1px solid #000 !important;
}
.cell:nth-child(n+28):nth-child(-n+36),
.cell:nth-child(n+55):nth-child(-n+63) {
    border-top: 1px solid #000 !important;
}


.cell:focus {
    outline: none;
    background-color: #f0f8ff;
    box-shadow: 0 0 5px rgba(0, 123, 255, 0.6);
}


button {
    margin-top: 20px;
    padding: 10px 20px;
    font-size: 16px;
    color: #fff;
    background-color: #007bff;
         margin-top: 18px;
         margin-right: 10px;
         padding: 10px 28px;
         font-size: 17px;
         color: #fff;
         background: linear-gradient(90deg, #007bff 60%, #00c6ff 100%);
         border: none;
         border-radius: 6px;
         cursor: pointer;
         transition: background 0.3s, box-shadow 0.3s, transform 0.2s;
         box-shadow: 0 2px 8px rgba(0,0,0,0.13);
         font-weight: 600;
         letter-spacing: 0.5px;
}

button:hover {
    background: linear-gradient(90deg, #0056b3 60%, #00aaff 100%);
    box-shadow: 0 6px 16px rgba(0,0,0,0.18);
    transform: translateY(-2px);
}

button:active {
    background: linear-gradient(90deg, #003f7f 60%, #0088cc 100%);
    box-shadow: 0 2px 4px rgba(0,0,0,0.18);
    transform: translateY(0);
}


#result {
    margin-top: 22px;
    text-align: left;
    font-size: 1.1rem;
    color: #333;
    background: #f7f7f7;
    border-radius: 6px;
    padding: 10px 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}


