:root {
    --easy-color: #4CAF50;
    --medium-color: #2196F3;
    --hard-color: #FF9800;
    --expert-color: #F44336;
    --background-color: #f5f5f5;
    --cell-color: #ffffff;
    --border-color: #e0e0e0;
    --border-dark-color: #666666;
    --highlight-color: #e3f2fd;
    --same-number-highlight: #e3f2fd;
    --control-button-color: #607D8B;
    --cell-background: #fafafa;
    --fixed-number-color: #1a237e;
    --input-number-color: #4CAF50;

    --primary-color: #2563eb;    
    --secondary-color: #0284c7;  
    --accent-color: #0ea5e9;     
    --text-color: #0f172a;      
    --text-light: #64748b;      
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--background-color);
    color: var(--text-color);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    line-height: 1.6;
}

.game-container {
    max-width: min(95%, 600px);
    margin: 20px auto;
    padding: 20px;
    background: var(--cell-color);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

h1 {
    text-align: center;
    margin-bottom: 24px;
    color: var(--primary-color);
    font-size: clamp(1.5rem, 4vw, 2rem);
}

.game-info {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 24px;
    flex-wrap: nowrap;
}

.level-info, .timer-container {
    display: flex;
    gap: 10px;
    align-items: center;
}

.level-info,
.timer,
#timer-control {
    text-align: center;
    font-size: 1em;
    padding: 12px;
    background: var(--control-button-color);
    color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    white-space: nowrap;
    min-width: 100px;
    height: 42px;
    border: none;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
}

#timer-control {
    cursor: pointer;
    transition: all 0.2s ease;
}

#timer-control:hover {
    filter: brightness(90%);
}

.game-area {
    display: grid;
    grid-template-columns: auto 120px;
    gap: 10px;
    align-items: start;
    margin-bottom: 24px;
}

.board {
    width: 100%;
    max-width: 500px;
    aspect-ratio: 1;
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    grid-template-rows: repeat(9, 1fr);
    gap: 0;
    background-color: var(--cell-background);
    border: 3px solid var(--border-dark-color);
    padding: 0;
    border-radius: 8px;
    overflow: hidden;
    cursor: default;
}

.board.cursor-0 { 
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Ccircle cx='16' cy='16' r='14' fill='white' stroke='%23F44336' stroke-width='2'/%3E%3Cpath d='M11 11L21 21M21 11L11 21' stroke='%23F44336' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") 16 16, pointer; 
}

.board.cursor-1 { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Ccircle cx='16' cy='16' r='14' fill='white' stroke='%232196F3' stroke-width='2'/%3E%3Ctext x='16' y='16' font-size='20' fill='%232196F3' text-anchor='middle' dominant-baseline='middle' font-weight='bold'%3E1%3C/text%3E%3C/svg%3E") 16 16, pointer; }
.board.cursor-2 { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Ccircle cx='16' cy='16' r='14' fill='white' stroke='%232196F3' stroke-width='2'/%3E%3Ctext x='16' y='16' font-size='20' fill='%232196F3' text-anchor='middle' dominant-baseline='middle' font-weight='bold'%3E2%3C/text%3E%3C/svg%3E") 16 16, pointer; }
.board.cursor-3 { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Ccircle cx='16' cy='16' r='14' fill='white' stroke='%232196F3' stroke-width='2'/%3E%3Ctext x='16' y='16' font-size='20' fill='%232196F3' text-anchor='middle' dominant-baseline='middle' font-weight='bold'%3E3%3C/text%3E%3C/svg%3E") 16 16, pointer; }
.board.cursor-4 { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Ccircle cx='16' cy='16' r='14' fill='white' stroke='%232196F3' stroke-width='2'/%3E%3Ctext x='16' y='16' font-size='20' fill='%232196F3' text-anchor='middle' dominant-baseline='middle' font-weight='bold'%3E4%3C/text%3E%3C/svg%3E") 16 16, pointer; }
.board.cursor-5 { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Ccircle cx='16' cy='16' r='14' fill='white' stroke='%232196F3' stroke-width='2'/%3E%3Ctext x='16' y='16' font-size='20' fill='%232196F3' text-anchor='middle' dominant-baseline='middle' font-weight='bold'%3E5%3C/text%3E%3C/svg%3E") 16 16, pointer; }
.board.cursor-6 { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Ccircle cx='16' cy='16' r='14' fill='white' stroke='%232196F3' stroke-width='2'/%3E%3Ctext x='16' y='16' font-size='20' fill='%232196F3' text-anchor='middle' dominant-baseline='middle' font-weight='bold'%3E6%3C/text%3E%3C/svg%3E") 16 16, pointer; }
.board.cursor-7 { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Ccircle cx='16' cy='16' r='14' fill='white' stroke='%232196F3' stroke-width='2'/%3E%3Ctext x='16' y='16' font-size='20' fill='%232196F3' text-anchor='middle' dominant-baseline='middle' font-weight='bold'%3E7%3C/text%3E%3C/svg%3E") 16 16, pointer; }
.board.cursor-8 { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Ccircle cx='16' cy='16' r='14' fill='white' stroke='%232196F3' stroke-width='2'/%3E%3Ctext x='16' y='16' font-size='20' fill='%232196F3' text-anchor='middle' dominant-baseline='middle' font-weight='bold'%3E8%3C/text%3E%3C/svg%3E") 16 16, pointer; }
.board.cursor-9 { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Ccircle cx='16' cy='16' r='14' fill='white' stroke='%232196F3' stroke-width='2'/%3E%3Ctext x='16' y='16' font-size='20' fill='%232196F3' text-anchor='middle' dominant-baseline='middle' font-weight='bold'%3E9%3C/text%3E%3C/svg%3E") 16 16, pointer; }

.cell {
    background-color: var(--cell-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(1.2rem, 3vw, 1.8rem);
    cursor: inherit;
    transition: background-color 0.2s ease;
    user-select: none;
    position: relative;
    border: 1px solid var(--border-color);
    min-height: 100%;
    min-width: 100%;
}

.cell.selected {
    background-color: var(--highlight-color);
}

.cell.fixed {
    color: #141414;
    background-color: #f3f3f3;
}

.cell:not(.fixed) {
    color: var(--input-number-color);
}

.cell.error {
    color: var(--error-color);
}

.cell:nth-child(9n+3), 
.cell:nth-child(9n+6) {
    border-right: 3px solid var(--border-dark-color);
}

.cell:nth-child(n+19):nth-child(-n+27),
.cell:nth-child(n+46):nth-child(-n+54) {
    border-bottom: 3px solid var(--border-dark-color);
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 40px;
}

.difficulty {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.difficulty button {
    width: 100%;
    padding: 8px 16px;
    cursor: pointer;
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    transition: all 0.2s ease;
}

.difficulty button[onclick="newGame('easy')"] {
    background-color: var(--easy-color);
}

.difficulty button[onclick="newGame('medium')"] {
    background-color: var(--medium-color);
}

.difficulty button[onclick="newGame('hard')"] {
    background-color: var(--hard-color);
}

.difficulty button[onclick="newGame('expert')"] {
    background-color: var(--expert-color);
}

.game-controls {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 100px;
}

.game-controls button {
    width: 100%;
    padding: 8px 16px;
    cursor: pointer;
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    transition: all 0.2s ease;
    background-color: var(--control-button-color);
}

.number-pad {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 6px;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    padding: 0;
}

.number-pad button {
    aspect-ratio: 1;
    font-size: 1rem;
    background-color: var(--medium-color);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.number-pad button.active {
    background-color: #0d47a1;
    transform: scale(0.95);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
}

.number-pad button.disabled {
    background-color: #9e9e9e;
    cursor: not-allowed;
    opacity: 0.5;
    pointer-events: none;
}


.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    padding: 20px 0;
    text-align: center;
    margin-bottom: 20px;
}

header h1 {
    font-size: 35px;
    font-weight: 800;
    color: white;
    margin-bottom: 16px;
    letter-spacing: -0.025em;
    line-height: 45px;
}

header p {
    font-size: 20px;
    color: rgba(255, 255, 255, 0.9);
    max-width: 800px;
    margin: 0 auto;
}

.difficulty-selector {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.difficulty-btn {
    padding: 12px 24px;
    border-radius: 12px;
    background: var(--primary-color);
    color: white;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.difficulty-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    background: var(--secondary-color);
}

.sudoku-grid {
    aspect-ratio: 1;
    max-width: 540px;
    margin: 0 auto;
    background: white;
    padding: 16px;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

article, section {
    background: var(--card-bg);
    border-radius: 24px;
    padding: 48px;
    margin-bottom: 32px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

article:hover, section:hover {
    transform: translateY(-4px);
}

h2 {
    font-size: 36px;
    font-weight: 800;
    color: var(--text-color);
    margin-bottom: 24px;
    letter-spacing: -0.025em;
}

h3 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-color);
    margin: 32px 0 16px;
}

ul {
    list-style: none;
    padding: 0;
    margin: 24px 0;
}

ul li {
    position: relative;
    padding-left: 28px;
    margin: 12px 0;
    color: var(--text-light);
}

ul li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--primary-color);
}

p {
    color: var(--text-light);
    margin: 16px 0;
    line-height: 1.8;
}

footer {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    
    text-align: center;
    margin: 64px auto 0 auto;
}
footer P{
    color: white;
    padding: 20px 0;
}
footer P a{
    color: white;
}

@media (max-width: 768px) {
    header {
        padding: 48px 0;
    }

    header h1 {
        font-size: 36px;
    }

    .container {
        padding: 0 16px;
    }

    article,
    section {
        padding: 24px;
        border-radius: 16px;
    }

    h2 {
        font-size: 28px;
    }

    h3 {
        font-size: 20px;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 600px) {
    .container {
        margin: 10px auto;
        padding: 10px;
        width: 100%;
        max-width: 100%;
    }
    
    .game-area {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .main-game {
        width: 100%;
    }
    
    .board {
        width: 100%;
        max-width: 100%;
        aspect-ratio: 1;
    }
    
    .number-pad {
        width: 100%;
        max-width: 100%;
        gap: 4px;
        padding: 8px 0;
    }
    
    .number-pad button {
        width: 100%;
        max-width: 28px;
        height: 28px;
        font-size: 0.9rem;
        margin: 0 auto;
    }
    
    .controls {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
        margin-top: 10px;
    }
    
    .difficulty, .game-controls {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
        margin-top: 10px;
    }
    
    .difficulty button, .game-controls button {
        width: auto;
        font-size: 0.9rem;
        padding: 6px 12px;
    }
    
    .cell {
        font-size: clamp(1rem, 4vw, 1.5rem);
    }
    
    .game-info {
        flex-direction: row;
        justify-content: center;
        gap: 8px;
        margin-bottom: 16px;
    }
    
    .level-info,
    .timer,
    #timer-control {
        font-size: 0.9em;
        padding: 8px 12px;
    }
    
    .timer-container {
        gap: 6px;
    }
    
    .popup-content {
        padding: 20px;
        width: 90%;
    }
    
    .popup-content p {
        font-size: 1em;
    }
    
    .popup-content button {
        padding: 8px 20px;
        font-size: 0.9rem;
    }
}

@media (max-width: 400px) {
    .container {
        padding: 5px;
        margin: 5px;
    }
    
    .number-pad button {
        width: 24px;
        height: 24px;
        font-size: 0.8rem;
    }
    
    .cell {
        font-size: clamp(0.9rem, 3.5vw, 1.3rem);
    }
    
    h1 {
        font-size: 1.2rem;
        margin-bottom: 15px;
    }
    
    .level-info,
    .timer,
    #timer-control {
        font-size: 0.8em;
        padding: 6px 10px;
    }
}

@media (prefers-color-scheme: dark) {
    :root {
        --background-color: #121212;
        --cell-color: #1e1e1e;
        --border-color: #333333;
        --border-dark-color: #888888;
        --text-color: #ffffff;
        --cell-background: #242424;
        --same-number-highlight: #1a237e;
        --highlight-color: #1a237e;
        --fixed-number-color: #90caf9;
        --input-number-color: #81c784;
    }
    
    .container {
        box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    }
    
    .cell.same-number {
        background-color: #1a237e;
    }
    
    .cell.answer {
        color: #64B5F6;
    }
    
    .popup-content,
    .pause-content {
        background-color: var(--cell-color);
        border: 1px solid var(--border-dark-color);
    }
}


.cell.same-number {
    background-color: #e3f2fd;
    position: relative;
}

.cell.same-number::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 2px solid var(--medium-color);
    opacity: 0.7;
    pointer-events: none;
    border-radius: 50%;
}


@media (prefers-color-scheme: dark) {
    .cell.same-number {
        background-color: #1a237e; 
    }
}


.difficulty button[onclick="newGame('easy')"].active,
.difficulty button[onclick="newGame('medium')"].active,
.difficulty button[onclick="newGame('hard')"].active,
.difficulty button[onclick="newGame('expert')"].active {
    background-color: #333333;
}


.cell.answer {
    color: #2196F3; 
    font-weight: 500;
}


@media (prefers-color-scheme: dark) {
    .cell.answer {
        color: #64B5F6; 
    }
}


.main-game {
    display: flex;
    flex-direction: column;
    gap: 12px;
}


.number-pad {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 6px;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    padding: 0;
}


.cell:empty::after {
    content: '\00a0'; 
    visibility: hidden;
}

.completion-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.popup-content {
    background-color: var(--cell-color);
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    max-width: 90%;
    width: 400px;
    text-align: center;
}

.popup-content p {
    margin-bottom: 20px;
    font-size: 1.1em;
    line-height: 1.6;
    color: var(--text-color);
}

.popup-content button {
    padding: 10px 24px;
    background-color: var(--medium-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.popup-content button:hover {
    background-color: var(--secondary-color);
    transform: translateY(-1px);
}

.pause-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.pause-content {
    background-color: var(--cell-color);
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    text-align: center;
}

.pause-content h2 {
    color: var(--text-color);
    margin-bottom: 10px;
    font-size: 1.5em;
}
.pause-content p {
    margin-bottom:30px;
}

.pause-content button {
    padding: 12px 24px;
    background-color: var(--medium-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.pause-content button:hover {
    background-color: #333333;
    transform: translateY(-1px);
}

.timer-container {
    display: flex;
    gap: 10px;
    align-items: center;
}

.timer-container .timer,
.timer-container button {
    text-align: center;
    font-size: 0.8em;
    padding: 6px 10px;
    background: var(--control-button-color);
    color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    white-space: nowrap;
    min-width: fit-content;
    border: none;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 120px
}

.timer-container button:hover {
    filter: brightness(90%);
}

@media (max-width: 600px) {
    .timer-container {
        gap: 6px;
    }
    
    .timer-container .timer,
    .timer-container button {
        font-size: 0.9em;
        padding: 8px 12px;
    }
}

@media (max-width: 400px) {
    .timer-container .timer,
    .timer-container button {
        font-size: 0.8em;
        padding: 6px 10px;
    }
}
.share-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.share-button {
    padding: 10px 20px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    color: white;
    display: inline-block;
    text-align: center;
    cursor: pointer;
}

.facebook {
    background-color: #3b5998;
}

.twitter {
    background-color: #1da1f2;
}

.whatsapp {
    background-color: #25d366;
}

.share-button:hover {
    opacity: 0.8;
}

.share-button:active {
    transform: scale(0.95);
}
