:root {
    --primary-color: #4f46e5;
    --secondary-color: #6366f1;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --text-color: #1f2937;
    --bg-color: #f3f4f6;
    --grid-border-color: #1f2937;
    --cell-border-color: #d1d5db;
    --cell-hover-bg: #e0e7ff;
    --cell-selected-bg: #c7d2fe;
    --cell-related-bg: #eef2ff;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    overflow-x: hidden;
}

/* Background Effects */
.bg-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
    opacity: 0.6;
}

.bg-orb-1 {
    width: 300px;
    height: 300px;
    background: #c7d2fe;
    top: -50px;
    left: -50px;
}

.bg-orb-2 {
    width: 400px;
    height: 400px;
    background: #e0e7ff;
    bottom: -100px;
    right: -100px;
}

/* Navigation */
.top-nav {
    width: 100%;
    padding: 1rem 2rem;
    box-sizing: border-box;
    display: flex;
    justify-content: flex-start;
}

.nav-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    transition: color 0.2s;
}

.nav-link:hover {
    color: var(--primary-color);
}

.nav-link svg {
    width: 20px;
    height: 20px;
    margin-right: 8px;
}

/* Card Container */
.container {
    padding: 2rem;
    width: 100%;
    max-width: 600px;
    box-sizing: border-box;
}

.card {
    background: white;
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    text-align: center;
}

h1 {
    margin: 0 0 0.5rem 0;
    color: var(--primary-color);
}

.subtitle {
    color: #6b7280;
    margin-bottom: 2rem;
    line-height: 1.5;
}

/* Game Controls */
.game-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.info-group {
    font-weight: 600;
    font-size: 1.1rem;
    display: flex;
    gap: 1rem;
}

.btn-group {
    display: flex;
    gap: 0.5rem;
}

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.btn-secondary {
    background-color: #e5e7eb;
    color: var(--text-color);
}

.btn-secondary:hover {
    background-color: #d1d5db;
}

.btn-warning {
    background-color: #fee2e2;
    color: #b91c1c;
}

.btn-warning:hover {
    background-color: #fecaca;
}

.btn-info {
    background-color: #e0f2fe;
    color: #0369a1;
}

.btn-info:hover {
    background-color: #bae6fd;
}

/* Sudoku Board */
.sudoku-board {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 1px;
    background-color: var(--grid-border-color);
    border: 2px solid var(--grid-border-color);
    margin-bottom: 2rem;
    user-select: none;
}

.cell {
    background-color: white;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 500;
    cursor: pointer;
    position: relative;
    transition: background-color 0.1s;
}

/* 3x3 Block Borders */
.cell:nth-child(3n) {
    border-right: 2px solid var(--grid-border-color);
}

.cell:nth-child(9n) {
    border-right: none;
}

.cell:nth-child(n+19):nth-child(-n+27),
.cell:nth-child(n+46):nth-child(-n+54) {
    border-bottom: 2px solid var(--grid-border-color);
}

/* Cell States */
.cell:hover {
    background-color: var(--cell-hover-bg);
}

.cell.selected {
    background-color: var(--cell-selected-bg);
}

.cell.related {
    background-color: var(--cell-related-bg);
}

.cell.fixed {
    color: var(--text-color);
    font-weight: 700;
    background-color: #f9fafb;
}

.cell.user-input {
    color: var(--primary-color);
}

.cell.error {
    background-color: #fee2e2;
    color: var(--error-color);
}

.cell.same-val {
    background-color: #c7d2fe;
}

/* Numpad */
.numpad {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 0.5rem;
    margin-top: 1rem;
}

.num-btn {
    aspect-ratio: 1;
    border: 1px solid #e5e7eb;
    background: white;
    border-radius: 0.5rem;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.num-btn:hover {
    background-color: #f3f4f6;
    border-color: #d1d5db;
}

.num-btn:active {
    transform: translateY(1px);
}

.action-btn {
    grid-column: span 2;
    /* Span slightly wider for actions if grid allows, or reset */
    aspect-ratio: auto;
    font-size: 1rem;
    color: #4b5563;
}

.numpad .action-btn:last-child {
    grid-column: span 3;
    /* Make 'Check' button wider */
    background-color: var(--primary-color);
    color: white;
    border: none;
}

.numpad .action-btn:last-child:hover {
    background-color: var(--secondary-color);
}

/* Status Message */
.status-message {
    margin-top: 1rem;
    height: 1.5rem;
    font-weight: 500;
    color: var(--success-color);
}

/* Mobile Blocker */
#mobile-blocker {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(255, 255, 255, 0.95);
    z-index: 9999;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 2rem;
}

@media (max-width: 768px) {

    /* Adjust numpad for smaller screens */
    .numpad {
        grid-template-columns: repeat(5, 1fr);
    }

    .action-btn {
        grid-column: span 2;
    }

    .numpad .action-btn:last-child {
        grid-column: span 1;
    }
}

/* Print Styles */
.print-header {
    display: none;
}

@media print {
    .noprint {
        display: none !important;
    }

    body {
        background: white;
        height: auto;
    }

    .container {
        padding: 0;
        max-width: 100%;
        box-shadow: none;
    }

    .card {
        box-shadow: none;
        padding: 0;
    }

    .sudoku-board {
        width: 14cm;
        height: 14cm;
        margin: 2cm auto;
        border: 4px solid black;
    }

    .cell {
        border: 1px solid #999;
        font-size: 24pt;
        color: black !important;
        background: white !important;
    }

    .cell:nth-child(3n) {
        border-right: 4px solid black;
    }

    .cell:nth-child(9n) {
        border-right: none;
    }

    .cell:nth-child(n+19):nth-child(-n+27),
    .cell:nth-child(n+46):nth-child(-n+54) {
        border-bottom: 4px solid black;
    }

    .print-header {
        display: block;
        text-align: center;
        margin-bottom: 2rem;
    }

    .print-header h1 {
        font-size: 24pt;
        color: black;
    }
}

/* Subtitle Tag */
.subtitle-tag {
    display: inline-block;
    background: #f3f4f6;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    margin-bottom: 4px;
    color: #4b5563;
}