* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0f0f1a;
    color: #e0e0e0;
    line-height: 1.6;
    min-height: 100vh;
}

main {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem;
}

.back-link {
    display: inline-block;
    color: #4ecca3;
    text-decoration: none;
    margin-bottom: 0.5rem;
}

.back-link:hover {
    text-decoration: underline;
}

h1 {
    text-align: center;
    color: #4ecdc4;
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.game-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    width: 100%;
    max-width: 340px;
}

.difficulty-select {
    display: flex;
    gap: 0.5rem;
}

.diff-btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    background: #1a1a2e;
    color: #888;
    border: 1px solid #333;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.diff-btn:hover {
    color: #4ecdc4;
    border-color: #4ecdc4;
}

.diff-btn.active {
    background: #4ecdc4;
    color: #0f0f1a;
    border-color: #4ecdc4;
}

.new-game-btn {
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
    background: #4ecdc4;
    color: #0f0f1a;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
}

.new-game-btn:hover {
    background: #3dbdb5;
}

.grid-wrapper {
    position: relative;
    width: 100%;
    max-width: 340px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    background: #1a1a2e;
    padding: 4px;
    border-radius: 8px;
    border: 3px solid #4ecdc4;
    gap: 1px;
}

.cell {
    aspect-ratio: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.25rem;
    font-weight: 600;
    background: #2a2a3e;
    color: #e0e0e0;
    cursor: pointer;
    transition: background 0.1s;
    user-select: none;
}

.cell:hover {
    background: #3a3a4e;
}

.cell.fixed {
    color: #4ecdc4;
    font-weight: 700;
}

.cell.selected {
    background: #4ecdc4;
    color: #0f0f1a;
}

.cell.highlighted {
    background: #252538;
}

.cell.same-number {
    background: #3a5a58;
}

.cell.selected.same-number {
    background: #4ecdc4;
    color: #0f0f1a;
}

.cell.error {
    color: #ff6b6b;
    background: #4a2a2a;
}

.cell.selected.error {
    background: #ff6b6b;
    color: #0f0f1a;
}

/* 3x3 box borders */
.cell.box-left {
    border-left: 2px solid #4ecdc4;
}

.cell.box-top {
    border-top: 2px solid #4ecdc4;
}

.number-pad {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
    width: 100%;
    max-width: 280px;
    margin-top: 0.5rem;
}

.num-btn {
    aspect-ratio: 1;
    font-size: 1.25rem;
    font-weight: 600;
    background: #1a1a2e;
    color: #4ecdc4;
    border: 2px solid #4ecdc4;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.num-btn:hover {
    background: #2a3a3e;
}

.num-btn:active {
    background: #4ecdc4;
    color: #0f0f1a;
}

.num-btn.completed {
    opacity: 0.3;
    border-color: #333;
    color: #555;
}

.num-btn.erase-btn {
    background: #2a1a1a;
    border-color: #ff6b6b;
    color: #ff6b6b;
}

.num-btn.erase-btn:hover {
    background: #3a2a2a;
}

.num-btn.erase-btn:active {
    background: #ff6b6b;
    color: #0f0f1a;
}

.game-controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    font-size: 1rem;
}

.game-controls strong {
    color: #4ecdc4;
}

.hint-btn {
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
    background: #1a1a2e;
    color: #4ecdc4;
    border: 1px solid #4ecdc4;
    border-radius: 4px;
    cursor: pointer;
}

.hint-btn:hover {
    background: #2a3a3e;
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 15, 26, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    border-radius: 8px;
    z-index: 10;
}

.overlay.hidden {
    display: none;
}

.overlay p {
    font-size: 1.5rem;
    color: #4ecdc4;
}

.overlay p:first-child {
    font-size: 2rem;
}

.overlay button {
    padding: 0.75rem 2rem;
    font-size: 1rem;
    background: #4ecdc4;
    color: #0f0f1a;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
}

.overlay button:hover {
    background: #3dbdb5;
}

.overlay .share-btn {
    background: #2a9d8f;
    margin-top: 0.5rem;
}

.overlay .share-btn:hover {
    background: #248c7f;
}

.instructions {
    font-size: 0.85rem;
    color: #888;
    text-align: center;
    max-width: 340px;
}

.content {
    padding-top: 1rem;
    border-top: 1px solid #2a2a3e;
}

.content h2 {
    color: #4ecdc4;
    font-size: 1.25rem;
    margin: 1.5rem 0 0.75rem;
}

.content h2:first-child {
    margin-top: 1rem;
}

.content p {
    margin-bottom: 0.75rem;
}

.content ul {
    margin: 0.5rem 0 1rem 1.5rem;
}

.content li {
    margin-bottom: 0.5rem;
}

.content a {
    color: #4ecdc4;
}

.content a:hover {
    text-decoration: none;
}

@media (min-width: 600px) {
    main {
        padding: 2rem;
    }

    h1 {
        font-size: 3rem;
    }

    .grid {
        gap: 2px;
        padding: 6px;
    }

    .cell {
        font-size: 1.5rem;
    }

    .number-pad {
        max-width: 340px;
    }

    .num-btn {
        font-size: 1.5rem;
    }

    .instructions {
        font-size: 1rem;
    }
}
