body {
    font-family: Arial, sans-serif;
    text-align: center;
    margin-top: 30px;
    background: #f5f8fa;
}

h1 {
    margin-bottom: 10px;
}

table {
    margin: 0 auto;
    border-collapse: collapse;
    background: #fff;
}

td {
    border: 1px solid #888;
    width: 40px;
    height: 40px;
    text-align: center;
    font-size: 22px;
    box-sizing: border-box;
    padding: 0;
    position: relative;
}

td input {
    width: 100%;
    height: 100%;
    font-size: 20px;
    text-align: center;
    border: none;
    outline: none;
    background: transparent;
    font-weight: bold;
    color: blue;
    box-sizing: border-box;
    caret-color: #2277ee;
}

/* Thick block borders */
.thick-top {
    border-top: 3px solid #000 !important;
}

.thick-left {
    border-left: 3px solid #000 !important;
}

.thick-bottom {
    border-bottom: 3px solid #000 !important;
}

.thick-right {
    border-right: 3px solid #000 !important;
}

/* Fixed numbers style */
.fixed {
    color: black;
    font-weight: bold;
    background-color: #f0f0f0;
}

/* User input numbers style */
.input {
    color: blue;
    font-weight: bold;
    background-color: transparent;
    position: absolute;
    left: 0;
    top: 0;
}

/* Add styles for elimination cells */
.elimination-cell {
    background-color: #ffcccc !important;
    border: 2px solid #ff6b6b !important;
}

/* Update the hint cell animation */
.hint-cell {
    background-color: rgba(255, 250, 205, 0.5) !important;
    border: 2px solid #ffd700 !important;
    animation: pulse 1s infinite;
}

/* Candidate area */
.candidate-grid {
    position: relative;
    width: 40px;
    height: 40px;
    display: block;
    margin: auto;
}

.candidate-num {
    position: absolute;
    width: 14px;
    height: 14px;
    font-size: 12px;
    text-align: center;
    line-height: 14px;
}

.candidate-green { background: #b7ffb7 !important; } /* reference number */
.candidate-red { background: #ffb7b7 !important; } /* eliminate candidate */
.candidate-gray { color: #d6d5d5 !important; } /* eliminated number */

.candidate-pos-1 { left: 1px; top: 1px; }
.candidate-pos-2 { left: 13px; top: 1px; }
.candidate-pos-3 { left: 26px; top: 1px; }
.candidate-pos-4 { left: 1px; top: 13px; }
.candidate-pos-5 { left: 13px; top: 13px; }
.candidate-pos-6 { left: 26px; top: 13px; }
.candidate-pos-7 { left: 1px; top: 26px; }
.candidate-pos-8 { left: 13px; top: 26px; }
.candidate-pos-9 { left: 26px; top: 26px; }

.candidates-table td {
    border: 1px solid #888;
    width: 40px;
    height: 40px;
    text-align: center;
    font-size: 22px;
    box-sizing: border-box;
    padding: 0;
    position: relative;
}

.filled-candidate {
    font-size: 20px;
    font-weight: bold;
    color: black;
    line-height: 38px;
    text-align: center;
    background-color: #f0f0f0;
    border: 1px solid #eee;
}

@keyframes pulse {
    0% { background-color: #fffacd; }
    50% { background-color: #ffeaa7; }
    100% { background-color: #fffacd; }
}

/* separator between buttons */
.separator {
    display: inline-block;
    width: 2px;
    height: 28px;
    background-color: #ccc;
    margin: 0 8px;
    vertical-align: middle;
}

/* Buttons style */
button#new-game,
button#reset-game,
button#save-game,
button#load-game,
button#hint-btn {
    margin-top: 15px;
    font-size: 16px;
    padding: 8px 16px;
    cursor: pointer;
    border: none;
    border-radius: 4px;
    background: #2277ee;
    color: #fff;
    font-weight: bold;
    transition: background 0.15s;
}

button#new-game:hover,
button#reset-game:hover,
button#save-game:hover,
button#load-game:hover,
button#hint-btn:hover {
    background: #185bb5;
}

/* Message styling */
#msg {
    margin-top: 10px;
    font-weight: bold;
    /* width: 700px; */
    user-select: none;
    display: inline-block;
}

.message {
    color: green;
    font-weight: bold;
}

.error {
    color: red;
    font-weight: bold;
}

/* Popup styles for candidate selection on mobile */
.candidate-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border: 2px solid #333;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    z-index: 1000;
    text-align: center;
    min-width: 200px;
}

.candidate-popup h3 {
    margin-top: 0;
    margin-bottom: 15px;
}

.candidate-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.candidate-btn {
    width: 50px;
    height: 50px;
    font-size: 20px;
    font-weight: bold;
    border: 2px solid #333;
    border-radius: 4px;
    background: #f0f0f0;
    cursor: pointer;
    transition: background 0.2s;
}

.candidate-btn:hover {
    background: #e0e0e0;
}

.color-buttons .candidate-btn {
    width: 80px;
    height: 30px;
    font-size: 14px;
}

.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

.popup-cancel-btn {
    padding: 8px 16px;
    font-size: 16px;
    background: #ff6b6b;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

.popup-cancel-btn:hover {
    background: #ff5252;
}

/* Flip switch styles */
.switch-container {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
    vertical-align: middle;
}

.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #2277ee;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #2277ee;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.switch-label {
    font-weight: bold;
    color: #333;
    user-select: none;
}
