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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

/* Navigation Bar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transition: all 0.3s ease;
    height: 60px;
    overflow: hidden;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
}

.nav-brand h2 {
    color: #4a5568;
    font-size: 1.3rem;
    font-weight: bold;
    margin: 0;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 1.5rem;
    margin: 0;
    padding: 0;
}

.nav-link {
    text-decoration: none;
    color: #4a5568;
    font-weight: 500;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.nav-link:hover {
    background: #f7fafc;
    color: #2d3748;
}

.nav-link.active {
    background: #4299e1;
    color: white;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
    gap: 4px;
}

.nav-toggle span {
    width: 25px;
    height: 3px;
    background: #4a5568;
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* Page Management */
.page {
    display: none;
    padding-top: 70px;
    min-height: 100vh;
}

.page.active {
    display: block;
}

.container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    max-width: 800px;
    width: 100%;
    margin: 1rem auto;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

h1 {
    color: #4a5568;
    margin-bottom: 1rem;
    font-size: 2.5rem;
    font-weight: bold;
}

.subtitle {
    color: #718096;
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.timer {
    font-size: 1.2rem;
    font-weight: bold;
    color: #2d3748;
    background: #f7fafc;
    padding: 0.5rem 1rem;
    border-radius: 10px;
    border: 2px solid #e2e8f0;
}

.controls {
    display: flex;
    gap: 0.5rem;
}

.btn {
    background: #4299e1;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn:hover {
    background: #3182ce;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn:active {
    transform: translateY(0);
}

.game-selectors {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.sudoku-type-selector,
.difficulty-selector {
    text-align: center;
}

.sudoku-type-selector label,
.difficulty-selector label {
    font-weight: bold;
    margin-right: 0.5rem;
    color: #4a5568;
}

.sudoku-type-selector select,
.difficulty-selector select {
    padding: 0.5rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
}

.sudoku-board {
    display: grid;
    gap: 1px;
    background: #2d3748;
    border: 3px solid #2d3748;
    border-radius: 10px;
    margin: 0 auto;
    aspect-ratio: 1;
}

/* Standard 9x9 */
.sudoku-board.standard {
    grid-template-columns: repeat(9, 1fr);
    max-width: 450px;
}

/* Mini 4x4 */
.sudoku-board.mini4 {
    grid-template-columns: repeat(4, 1fr);
    max-width: 300px;
}

/* Mini 6x6 */
.sudoku-board.mini6 {
    grid-template-columns: repeat(6, 1fr);
    max-width: 360px;
}

/* Giant 16x16 */
.sudoku-board.giant {
    grid-template-columns: repeat(16, 1fr);
    max-width: 600px;
}

.cell {
    background: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    aspect-ratio: 1;
}

/* Font sizes for different board sizes */
.sudoku-board.standard .cell {
    font-size: 1.5rem;
}

.sudoku-board.mini4 .cell {
    font-size: 1.8rem;
}

.sudoku-board.mini6 .cell {
    font-size: 1.6rem;
}

.sudoku-board.giant .cell {
    font-size: 0.9rem;
}

.cell:hover {
    background: #f7fafc;
}

.cell.selected {
    background: #4299e1;
    color: white;
}

.cell.initial {
    background: #e2e8f0;
    color: #2d3748;
    font-weight: 900;
}

.cell.conflict {
    background: #fed7d7;
    color: #c53030;
}

.cell.highlight {
    background: #bee3f8;
}

.cell.highlight.selected {
    background: #3182ce;
}

/* Border styles for different board sizes */
/* Standard 9x9 borders */
.sudoku-board.standard .cell:nth-child(3n) {
    border-right: 2px solid #2d3748;
}

.sudoku-board.standard .cell:nth-child(9n) {
    border-right: none;
}

.sudoku-board.standard .cell:nth-child(n+19):nth-child(-n+27),
.sudoku-board.standard .cell:nth-child(n+46):nth-child(-n+54) {
    border-bottom: 2px solid #2d3748;
}

/* Mini 4x4 borders */
.sudoku-board.mini4 .cell:nth-child(2n) {
    border-right: 2px solid #2d3748;
}

.sudoku-board.mini4 .cell:nth-child(4n) {
    border-right: none;
}

.sudoku-board.mini4 .cell:nth-child(n+5):nth-child(-n+8),
.sudoku-board.mini4 .cell:nth-child(n+13):nth-child(-n+16) {
    border-bottom: 2px solid #2d3748;
}

/* Mini 6x6 borders */
.sudoku-board.mini6 .cell:nth-child(2n) {
    border-right: 2px solid #2d3748;
}

.sudoku-board.mini6 .cell:nth-child(6n) {
    border-right: none;
}

.sudoku-board.mini6 .cell:nth-child(n+7):nth-child(-n+12),
.sudoku-board.mini6 .cell:nth-child(n+19):nth-child(-n+24),
.sudoku-board.mini6 .cell:nth-child(n+31):nth-child(-n+36) {
    border-bottom: 2px solid #2d3748;
}

/* Giant 16x16 borders */
.sudoku-board.giant .cell:nth-child(4n) {
    border-right: 2px solid #2d3748;
}

.sudoku-board.giant .cell:nth-child(16n) {
    border-right: none;
}

.sudoku-board.giant .cell:nth-child(n+17):nth-child(-n+32),
.sudoku-board.giant .cell:nth-child(n+49):nth-child(-n+64),
.sudoku-board.giant .cell:nth-child(n+81):nth-child(-n+96),
.sudoku-board.giant .cell:nth-child(n+113):nth-child(-n+128) {
    border-bottom: 2px solid #2d3748;
}

/* Number pad: 横向排列一行且按钮变小 */
.number-buttons {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    gap: 0.3rem;
    margin: 1.5rem auto 1rem;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
}

/* 适配不同类型，全部一行显示 */
.number-buttons.standard,
.number-buttons.mini4,
.number-buttons.mini6,
.number-buttons.giant {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    gap: 0.3rem;
    max-width: 100%;
}

.num-btn {
    background: #48bb78;
    color: white;
    border: none;
    padding: 0.4rem 0.7rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    font-size: 1rem;
    min-width: 32px;
    min-height: 32px;
    aspect-ratio: unset;
}

.num-btn:hover {
    background: #38a169;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.num-btn:active {
    transform: translateY(0);
}

/* Font sizes for number buttons */
.number-buttons.standard .num-btn {
    font-size: 1.2rem;
}

.number-buttons.mini4 .num-btn {
    font-size: 1.4rem;
}

.number-buttons.mini6 .num-btn {
    font-size: 1.3rem;
}

.number-buttons.giant .num-btn {
    font-size: 0.9rem;
}

.action-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

#eraserBtn {
    background: #ed8936;
}

#eraserBtn:hover {
    background: #dd6b20;
}

#submitBtn {
    background: #38a169;
}

#submitBtn:hover {
    background: #2f855a;
}

/* Tutorial Page Styles */
.tutorial-content {
    max-width: 800px;
    margin: 0 auto;
}

.tutorial-section {
    margin-bottom: 3rem;
}

.tutorial-section h2 {
    color: #2d3748;
    font-size: 1.8rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 0.5rem;
}

.tutorial-card {
    background: #f7fafc;
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.tutorial-card h3 {
    color: #4a5568;
    font-size: 1.3rem;
    margin-bottom: 1rem;
    margin-top: 1.5rem;
}

.tutorial-card h3:first-child {
    margin-top: 0;
}

.tutorial-card ul {
    list-style: none;
    padding-left: 0;
}

.tutorial-card li {
    padding: 0.5rem 0;
    border-bottom: 1px solid #e2e8f0;
    color: #4a5568;
}

.tutorial-card li:last-child {
    border-bottom: none;
}

.tutorial-card strong {
    color: #2d3748;
}

/* Blog Page Styles */
.blog-content {
    max-width: 800px;
    margin: 0 auto;
}

.blog-post {
    background: #f7fafc;
    border-radius: 15px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.blog-post h2 {
    color: #2d3748;
    font-size: 1.8rem;
    margin-bottom: 1rem;
    line-height: 1.3;
}

.post-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    color: #718096;
}

.post-meta .date,
.post-meta .author {
    padding: 0.25rem 0.5rem;
    background: #e2e8f0;
    border-radius: 4px;
}

.post-content {
    color: #4a5568;
    line-height: 1.6;
}

.post-content p {
    margin-bottom: 1rem;
}

.post-content h3 {
    color: #2d3748;
    font-size: 1.3rem;
    margin: 1.5rem 0 0.5rem 0;
}

.post-content h3:first-child {
    margin-top: 0;
}

/* Contact Page Styles */
.contact-content {
    max-width: 600px;
    margin: 0 auto;
}

.contact-card {
    background: #f7fafc;
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.contact-card h2 {
    color: #2d3748;
    font-size: 1.8rem;
    margin-bottom: 1rem;
}

.contact-card > p {
    color: #718096;
    margin-bottom: 2rem;
}

.contact-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.contact-item {
    text-align: center;
    padding: 1rem;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.contact-item h3 {
    color: #4a5568;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.contact-item p {
    color: #718096;
    font-size: 0.9rem;
}

.contact-form {
    background: white;
    border-radius: 10px;
    padding: 2rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.contact-form h3 {
    color: #2d3748;
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    color: #4a5568;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #4299e1;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    text-align: center;
    z-index: 1000;
    max-width: 400px;
    width: 90%;
}

.message.success {
    border: 3px solid #48bb78;
    color: #2f855a;
}

.message.error {
    border: 3px solid #f56565;
    color: #c53030;
}

.message h3 {
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.message p {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

.message button {
    background: #4299e1;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
}

.message button:hover {
    background: #3182ce;
}

.hidden {
    display: none;
}

/* Responsive design */
@media (max-width: 768px) {
    .nav-container {
        padding: 0.5rem 1rem;
    }
    
    .nav-menu {
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        flex-direction: column;
        gap: 0;
        transform: translateY(-100%);
        transition: transform 0.3s ease;
        border-top: 1px solid rgba(0, 0, 0, 0.1);
        max-height: 0;
        overflow: hidden;
    }
    
    .nav-menu.active {
        transform: translateY(0);
        max-height: 300px;
    }
    
    .nav-item {
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    }
    
    .nav-link {
        display: block;
        padding: 1rem;
        border-radius: 0;
    }
    
    .nav-toggle {
        display: flex;
    }
    
    .nav-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }
    
    .nav-toggle.active span:nth-child(2) {
        opacity: 0;
    }
    
    .nav-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -6px);
    }
    
    .container {
        padding: 1rem;
        margin: 0.5rem;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .game-info {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .game-selectors {
        flex-direction: column;
        gap: 1rem;
    }
    
    .sudoku-board.standard {
        max-width: 350px;
    }
    
    .sudoku-board.mini4 {
        max-width: 250px;
    }
    
    .sudoku-board.mini6 {
        max-width: 300px;
    }
    
    .sudoku-board.giant {
        max-width: 400px;
    }
    
    .cell {
        font-size: 1rem;
    }
    
    .action-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 100%;
        max-width: 200px;
    }
    
    .contact-info {
        grid-template-columns: 1fr;
    }
    
    .blog-post {
        padding: 1.5rem;
    }
    
    .blog-post h2 {
        font-size: 1.5rem;
    }
    
    .post-meta {
        flex-direction: column;
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .sudoku-board.standard {
        max-width: 300px;
    }
    
    .sudoku-board.mini4 {
        max-width: 200px;
    }
    
    .sudoku-board.mini6 {
        max-width: 240px;
    }
    
    .sudoku-board.giant {
        max-width: 320px;
    }
    
    .cell {
        font-size: 0.8rem;
    }
    
    .number-buttons {
        max-width: 200px;
    }
    
    .num-btn {
        font-size: 0.8rem;
        padding: 0.3rem 0.5rem;
        min-width: 24px;
        min-height: 24px;
    }
    .number-buttons {
        gap: 0.15rem;
    }
} 