* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Arial', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #16a085 0%, #1abc9c 100%);
    min-height: 100vh;
    padding-top: 60px;
    user-select: none;
}

/* 导航栏 */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    padding: 15px 0;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

.nav-logo {
    font-size: 24px;
    font-weight: bold;
    color: #16a085;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 30px;
}

.nav-menu a {
    text-decoration: none;
    color: #333;
    font-weight: 500;
    transition: color 0.3s;
    padding: 5px 10px;
}

.nav-menu a:hover,
.nav-menu a.active {
    color: #16a085;
}

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

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

/* 主容器 */
.main-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 60px);
    padding: 20px;
}

.container {
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.3);
    padding: 30px;
    max-width: 600px;
}

.header {
    margin-bottom: 20px;
}

.difficulty-selector {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.difficulty-btn {
    padding: 10px 25px;
    background: #f5f5f5;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.3s;
    color: #333;
}

.difficulty-btn:hover {
    background: #d4f1f4;
    border-color: #16a085;
}

.difficulty-btn.active {
    background: #16a085;
    color: white;
    border-color: #16a085;
}

.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px 20px;
    gap: 15px;
}

.timer-display, .mistakes-counter {
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

.new-game-btn {
    padding: 10px 20px;
    background: #16a085;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.3s;
}

.new-game-btn:hover {
    background: #1abc9c;
}

/* 数独棋盘 */
.game-board-wrapper {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

.sudoku-board {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    grid-template-rows: repeat(9, 1fr);
    gap: 0;
    background: #34495e;
    border: 3px solid #34495e;
    border-radius: 5px;
    width: 100%;
    max-width: 540px;
    aspect-ratio: 1;
}

.sudoku-cell {
    background: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    border: 1px solid #ddd;
}

.sudoku-cell:hover {
    background: #ecf0f1;
}

.sudoku-cell.initial {
    background: #f8f9fa;
    color: #2c3e50;
    cursor: default;
}

.sudoku-cell.user-input {
    color: #16a085;
}

.sudoku-cell.selected {
    background: #3498db !important;
    color: white;
}

.sudoku-cell.highlighted {
    background: #d4f1f4;
}

.sudoku-cell.error {
    background: #ffebee;
    color: #e74c3c;
}

.sudoku-cell.border-right {
    border-right: 3px solid #34495e;
}

.sudoku-cell.border-bottom {
    border-bottom: 3px solid #34495e;
}

/* 笔记模式 */
.sudoku-cell.has-notes {
    font-size: 12px;
    padding: 2px;
}

.notes-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    width: 100%;
    height: 100%;
    gap: 0;
}

.notes-grid span {
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 10px;
    color: #7f8c8d;
}

/* 控制按钮 */
.game-controls {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin: 20px 0;
}

.control-btn {
    padding: 12px;
    background: #fff;
    border: 2px solid #16a085;
    color: #16a085;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.3s;
}

.control-btn:hover {
    background: #16a085;
    color: white;
}

.control-btn.active {
    background: #16a085;
    color: white;
}

/* 数字输入面板 */
.number-pad {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}

.number-btn {
    padding: 15px;
    background: #f8f9fa;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    font-size: 20px;
    font-weight: bold;
    color: #2c3e50;
    transition: all 0.3s;
}

.number-btn:hover {
    background: #16a085;
    color: white;
    border-color: #16a085;
}

.number-btn.erase-btn {
    grid-column: span 5;
    background: #e74c3c;
    color: white;
    border-color: #e74c3c;
}

.number-btn.erase-btn:hover {
    background: #c0392b;
    border-color: #c0392b;
}

/* 游戏结束遮罩 */
.game-over-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.game-over-overlay.show {
    display: flex;
}

.game-over-message {
    background: white;
    padding: 50px;
    border-radius: 15px;
    text-align: center;
    animation: popIn 0.3s ease-out;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
}

.game-over-message h2 {
    font-size: 36px;
    margin-bottom: 20px;
    color: #16a085;
}

.game-over-message p {
    font-size: 20px;
    margin-bottom: 30px;
    color: #555;
}

.game-over-message button {
    padding: 15px 40px;
    font-size: 18px;
    background: #16a085;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s;
    font-weight: bold;
}

.game-over-message button:hover {
    background: #1abc9c;
}

@keyframes popIn {
    from {
        transform: scale(0.5);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* 关于页面样式 */
.about-container, .guide-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px;
}

.about-content, .guide-content {
    background: white;
    border-radius: 15px;
    padding: 50px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.2);
}

.about-content h1, .guide-content h1 {
    color: #16a085;
    font-size: 42px;
    margin-bottom: 30px;
    text-align: center;
}

.about-content h2, .guide-content h2 {
    color: #1abc9c;
    font-size: 28px;
    margin-top: 40px;
    margin-bottom: 20px;
}

.about-content h3, .guide-content h3 {
    color: #16a085;
    font-size: 22px;
    margin-top: 30px;
    margin-bottom: 15px;
}

.about-content p, .guide-content p {
    line-height: 1.8;
    color: #333;
    margin-bottom: 20px;
    font-size: 16px;
}

.about-content ul, .about-content ol,
.guide-content ul, .guide-content ol {
    margin-left: 40px;
    margin-bottom: 20px;
}

.about-content li, .guide-content li {
    line-height: 2;
    color: #555;
    margin-bottom: 10px;
    font-size: 16px;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    margin: 40px 0;
}

.feature-item {
    background: #f0fdf4;
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    border: 2px solid #d4f1f4;
    transition: all 0.3s;
}

.feature-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(22, 160, 133, 0.2);
}

.feature-item h3 {
    color: #16a085;
    margin-bottom: 15px;
    font-size: 20px;
}

.feature-item p {
    margin: 0;
    font-size: 15px;
}

.contact-info, .tip-box {
    background: #f0fdf4;
    padding: 30px;
    border-radius: 10px;
    margin-top: 40px;
}

.tip-box {
    border-left: 4px solid #16a085;
}

.tip-box strong {
    color: #16a085;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .nav-menu {
        position: fixed;
        left: -100%;
        top: 60px;
        flex-direction: column;
        background: white;
        width: 100%;
        text-align: center;
        transition: left 0.3s;
        box-shadow: 0 10px 27px rgba(0, 0, 0, 0.1);
        padding: 20px 0;
        gap: 0;
    }

    .nav-menu.active {
        left: 0;
    }

    .nav-menu li {
        padding: 15px 0;
    }

    .nav-toggle {
        display: flex;
    }

    .nav-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(8px, 8px);
    }

    .nav-toggle.active span:nth-child(2) {
        opacity: 0;
    }

    .nav-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(8px, -8px);
    }

    .container {
        padding: 20px;
    }

    .difficulty-btn {
        padding: 8px 16px;
        font-size: 14px;
    }

    .status-bar {
        flex-direction: column;
        gap: 10px;
    }

    .sudoku-cell {
        font-size: 20px;
    }

    .game-controls {
        grid-template-columns: repeat(2, 1fr);
    }

    .number-pad {
        grid-template-columns: repeat(5, 1fr);
    }

    .number-btn {
        padding: 12px;
        font-size: 18px;
    }

    .game-over-message {
        padding: 30px;
        margin: 20px;
    }

    .game-over-message h2 {
        font-size: 28px;
    }

    .game-over-message p {
        font-size: 16px;
    }

    .about-content, .guide-content {
        padding: 30px 20px;
    }

    .about-content h1, .guide-content h1 {
        font-size: 32px;
    }

    .about-content h2, .guide-content h2 {
        font-size: 24px;
    }

    .feature-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .nav-logo {
        font-size: 20px;
    }

    .container {
        padding: 15px;
    }

    .sudoku-cell {
        font-size: 16px;
    }

    .notes-grid span {
        font-size: 8px;
    }

    .control-btn {
        padding: 10px;
        font-size: 14px;
    }

    .number-btn {
        padding: 10px;
        font-size: 16px;
    }

    .game-over-message {
        padding: 25px;
    }

    .game-over-message h2 {
        font-size: 24px;
    }

    .game-over-message p {
        font-size: 14px;
    }

    .about-content h1, .guide-content h1 {
        font-size: 28px;
    }

    .about-content h2, .guide-content h2 {
        font-size: 22px;
    }

    .about-content h3, .guide-content h3 {
        font-size: 18px;
    }
}
