.stats {
    display: flex;
    gap: 25px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(30, 35, 80, 0.6);
    padding: 12px 20px;
    border-radius: 12px;
    min-width: 120px;
    border: 1px solid rgba(124, 77, 255, 0.3);
    box-shadow: 0 0 10px rgba(124, 77, 255, 0.1);
}

.stat-item:hover {
    box-shadow: 0 0 20px rgba(124, 77, 255, 0.3);
}

.stat-item span:first-child {
    font-size: 13px;
    opacity: 0.8;
    margin-bottom: 8px;
    color: #2196f3;
}

#timer, #errors {
    font-size: 20px;
    font-weight: bold;
    color: #7c4dff;
    text-shadow: 0 0 10px rgba(124, 77, 255, 0.5);
}

.controls {
    display: flex;
    gap: 15px;
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    background: rgba(30, 35, 80, 0.6);
    color: #e0e0ff;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(124, 77, 255, 0.3);
    font-size: 14px;
    font-weight: 500;
}

.btn:hover {
    box-shadow: 0 0 20px rgba(124, 77, 255, 0.4);
}

.pause {
    background: rgba(255, 152, 0, 0.2);
    border-color: rgba(255, 152, 0, 0.4);
}

.pause:hover {
    background: rgba(255, 152, 0, 0.3);
    box-shadow: 0 0 20px rgba(255, 152, 0, 0.4);
}

.restart {
    background: rgba(33, 150, 243, 0.2);
    border-color: rgba(33, 150, 243, 0.4);
}

.restart:hover {
    background: rgba(33, 150, 243, 0.3);
    box-shadow: 0 0 20px rgba(33, 150, 243, 0.4);
}

.new-game {
    background: linear-gradient(135deg, #7c4dff, #2196f3);
    color: white;
    border: none;
    box-shadow: 0 0 20px rgba(124, 77, 255, 0.4);
}

.new-game:hover {
    box-shadow: 0 0 30px rgba(124, 77, 255, 0.6);
}

main {
    display: grid;
    grid-template-columns: 220px 1fr 320px;
    gap: 25px;
    margin-bottom: 25px;
}

.left-panel, .right-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.panel-section {
    background: rgba(30, 35, 80, 0.6);
    border-radius: 15px;
    padding: 20px;
    border: 1px solid rgba(124, 77, 255, 0.3);
    box-shadow: 0 0 15px rgba(124, 77, 255, 0.1);
}

.panel-section:hover {
    box-shadow: 0 0 25px rgba(124, 77, 255, 0.2);
}

.side-btn {
    width: 100%;
    padding: 15px;
    background: rgba(30, 35, 80, 0.4);
    border: 1px solid rgba(124, 77, 255, 0.3);
    border-radius: 10px;
    color: #e0e0ff;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    text-align: left;
    font-size: 14px;
}

.side-btn:hover {
    background: rgba(124, 77, 255, 0.2);
    box-shadow: 0 0 15px rgba(124, 77, 255, 0.3);
}

.hint-btn .badge {
    background: #ff4081;
    color: white;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 12px;
    margin-left: auto;
    box-shadow: 0 0 10px rgba(255, 64, 129, 0.5);
}

.toggle-switch {
    margin-left: auto;
    width: 50px;
    height: 25px;
    background: rgba(124, 77, 255, 0.3);
    border-radius: 12px;
    position: relative;
    cursor: pointer;
}

.toggle-switch::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 21px;
    height: 21px;
    background: #7c4dff;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.toggle-switch.active::before {
    left: 27px;
    background: #2196f3;
}

.toggle-label {
    display: none;
}

.shortcut {
    font-size: 11px;
    opacity: 0.6;
    margin-left: auto;
    background: rgba(124, 77, 255, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
}

.center-panel {
    display: flex;
    justify-content: center;
    align-items: center;
}

.stats-panel {
    background: rgba(30, 35, 80, 0.6);
    border-radius: 15px;
    padding: 20px;
    border: 1px solid rgba(124, 77, 255, 0.3);
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(124, 77, 255, 0.2);
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-row span:first-child {
    color: #2196f3;
}

.stat-row span:last-child {
    font-weight: 600;
    color: #7c4dff;
}

.diff-select {
    padding: 8px 12px;
    background: rgba(30, 35, 80, 0.6);
    border: 1px solid rgba(124, 77, 255, 0.3);
    border-radius: 8px;
    color: #e0e0ff;
    cursor: pointer;
    font-size: 14px;
}

.diff-select option {
    background: #1a1f4a;
    color: #e0e0ff;
}

.cell .notes {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    padding: 2px;
    gap: 0;
    pointer-events: none;
}

.cell .note {
    font-size: 14px;
    color: rgba(124, 77, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    line-height: 1;
}

.mobile-stats-bar,
.mobile-control-buttons,
.mobile-number-input,
.mobile-stats-panel {
    display: none;
}

@media (max-width: 992px) {
    main {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .left-panel, .right-panel {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 15px;
    }
    
    .panel-section {
        flex: 1;
        min-width: 200px;
        padding: 15px;
    }
    
    .side-btn {
        padding: 12px;
        font-size: 13px;
    }
    
    .controls {
        width: 100%;
        justify-content: center;
    }
    
    .btn {
        padding: 10px 15px;
        font-size: 13px;
    }
}

@media (max-width: 768px) {
    header {
        padding: 8px 10px;
        gap: 6px;
        margin-bottom: 12px;
    }
    
    .stats {
        gap: 4px;
        flex-wrap: nowrap;
    }
    
    .stat-item {
        min-width: auto;
        padding: 4px 8px;
        flex: 1;
        min-width: 80px;
        border-radius: 6px;
    }
    
    .stat-item span:first-child {
        font-size: 10px;
        margin-bottom: 2px;
    }
    
    #timer, #errors {
        font-size: 12px;
        text-shadow: none;
    }
    
    .diff-select {
        padding: 3px 6px;
        font-size: 11px;
    }
    
    .controls {
        display: none !important;
    }
    
    .stats {
        display: none !important;
    }
    
    main {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto 1fr;
        gap: 12px;
        margin-bottom: 12px;
    }
    
    .mobile-stats-bar {
        display: flex;
        justify-content: space-between;
        background: rgba(30, 35, 80, 0.6);
        padding: 4px 10px;
        border-radius: 6px;
        border: 1px solid rgba(124, 77, 255, 0.3);
        grid-column: 1 / -1;
        grid-row: 1;
    }
    
    .mobile-stat-item {
        display: flex;
        align-items: center;
        gap: 4px;
        font-size: 13px;
        color: #e0e0ff;
        font-weight: 500;
    }
    
    .mobile-stat-item i {
        color: #7c4dff;
        font-size: 13px;
    }
    
    /* 移动端控制按钮栏（横排） */
    .mobile-control-bar {
        display: flex;
        gap: 6px;
        padding: 8px 10px;
        background: rgba(30, 35, 80, 0.4);
        border-radius: 8px;
        border: 1px solid rgba(124, 77, 255, 0.2);
        grid-column: 1 / -1;
        grid-row: 2;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .mobile-ctrl-btn {
        flex: 1;
        min-width: 60px;
        padding: 8px 6px;
        border: 1px solid rgba(124, 77, 255, 0.3);
        border-radius: 6px;
        background: rgba(30, 35, 80, 0.6);
        color: #e0e0ff;
        cursor: pointer;
        transition: all 0.2s ease;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        font-size: 11px;
    }
    
    .mobile-ctrl-btn i {
        font-size: 16px;
        color: #7c4dff;
    }
    
    .mobile-ctrl-btn span {
        font-size: 10px;
        white-space: nowrap;
    }
    
    .mobile-ctrl-btn:hover,
    .mobile-ctrl-btn:active {
        background: rgba(124, 77, 255, 0.3);
        transform: scale(0.95);
    }
    
    .mobile-ctrl-btn.test-btn {
        border-color: rgba(255, 193, 7, 0.5);
    }
    
    .mobile-ctrl-btn.test-btn i {
        color: #ffc107;
    }
    
    /* 移动端难度选择器样式 */
    .mobile-diff-select select {
        padding: 4px 8px;
        border: 1px solid rgba(124, 77, 255, 0.4);
        border-radius: 4px;
        background: rgba(30, 35, 80, 0.8);
        color: #e0e0ff;
        font-size: 13px;
        font-weight: 500;
        outline: none;
        cursor: pointer;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%237c4dff' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 6px center;
        padding-right: 20px;
    }
    
    .mobile-diff-select select:focus {
        border-color: #7c4dff;
        box-shadow: 0 0 0 2px rgba(124, 77, 255, 0.2);
    }
    
    .left-panel {
        overflow: visible;
        padding: 0;
        position: absolute;
        left: 4px;
        top: 50%;
        transform: translateY(-50%);
        z-index: 10;
        display: none;
    }
    
    .center-panel {
        grid-column: 1;
        grid-row: 3;
        display: flex;
        justify-content: center;
        align-items: flex-start;
        padding-top: 0;
    }
    
    .center-panel .sudoku-board {
        max-width: 100%;
        width: 100%;
        aspect-ratio: 1/1;
        min-height: 0;
    }
    
    .center-panel .cell {
        font-size: 15px;
    }
    
    /* 移动端笔记字体调整 */
    .cell .note {
        font-size: 11px;
    }
    
    .cell .notes {
        padding: 1px;
    }
    
    .right-panel {
        grid-column: 2;
        grid-row: 2;
        display: flex;
        flex-direction: column;
        gap: 6px;
        padding: 0;
        align-items: flex-end;
        padding-top: 0;
    }
    
    .left-panel .panel-section {
        display: flex;
        flex-direction: column;
        gap: 6px;
        padding: 0;
        background: transparent;
        box-shadow: none;
        border: none;
    }
    
    .left-panel .side-btn {
        display: flex !important;
    }
    
    .side-btn {
        width: 38px;
        height: 38px;
        min-width: 38px;
        padding: 0;
        margin: 0;
        border-radius: 6px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 15px;
        position: relative;
    }

    .side-btn i {
        font-size: 15px !important;
    }
    
    .right-panel .panel-section {
        display: none !important;
    }
    
    /* 隐藏旧的垂直按钮栏 */
    .mobile-control-buttons {
        display: none !important;
    }
    
    .mobile-control-btn {
        width: 38px;
        height: 38px;
        border-radius: 6px;
        border: 1px solid rgba(124, 77, 255, 0.4);
        background: rgba(30, 35, 80, 0.6);
        color: #e0e0ff;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 15px;
        cursor: pointer;
    }

    .mobile-control-btn i {
        font-size: 15px !important;
    }

    /* 测试按钮特殊样式 */
    .mobile-control-btn.test-btn {
        border-color: rgba(255, 87, 34, 0.6);
        background: rgba(255, 87, 34, 0.2);
        color: #ff9800;
    }

    .mobile-control-btn.test-btn:hover {
        background: rgba(255, 87, 34, 0.3);
        border-color: rgba(255, 87, 34, 0.8);
    }
    
    .mobile-control-btn:hover {
        background: rgba(124, 77, 255, 0.3);
        box-shadow: 0 0 15px rgba(124, 77, 255, 0.5);
    }
    
    .mobile-number-input {
        width: 100%;
        display: block !important;
        padding: 6px 4px;
        background: rgba(30, 35, 80, 0.4);
        border-radius: 6px;
        margin-top: 12px;
        border: 1px solid rgba(124, 77, 255, 0.2);
    }
    
    .mobile-number-input .number-grid {
        display: flex;
        gap: 3px;
        margin-bottom: 8px;
    }
    
    /* 移动端笔记模式切换按钮 */
    .mobile-note-toggle {
        margin-bottom: 8px;
    }
    
    .note-toggle-btn {
        width: 100%;
        padding: 10px 15px;
        border: 2px solid rgba(124, 77, 255, 0.4);
        border-radius: 6px;
        background: rgba(30, 35, 80, 0.6);
        color: #e0e0ff;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.3s ease;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
    }
    
    .note-toggle-btn i {
        font-size: 16px;
        color: #7c4dff;
    }
    
    .note-toggle-btn .toggle-indicator {
        padding: 4px 10px;
        border-radius: 12px;
        background: rgba(255, 255, 255, 0.1);
        font-size: 12px;
        font-weight: 700;
        transition: all 0.3s ease;
    }
    
    .note-toggle-btn.active {
        background: rgba(124, 77, 255, 0.2);
        border-color: #7c4dff;
        box-shadow: 0 0 15px rgba(124, 77, 255, 0.4);
    }
    
    .note-toggle-btn.active .toggle-indicator {
        background: #7c4dff;
        color: white;
    }
    
    .note-toggle-btn:active {
        transform: scale(0.98);
    }
    
    .mobile-number-input .num-btn {
        flex: 1;
        padding: 8px 0;
        border: none;
        border-radius: 4px;
        background: rgba(30, 35, 80, 0.6);
        color: #e0e0ff;
        font-size: 13px;
        font-weight: 600;
        cursor: pointer;
        border: 1px solid rgba(124, 77, 255, 0.3);
        transition: all 0.2s ease;
    }
    
    .mobile-number-input .num-btn:hover {
        background: rgba(124, 77, 255, 0.3);
        box-shadow: 0 0 10px rgba(124, 77, 255, 0.3);
    }
    
    .mobile-number-input .num-btn:active {
        transform: scale(0.95);
    }
    
    .mobile-number-input .action-buttons {
        display: flex;
        gap: 6px;
    }
    
    .mobile-number-input .action-btn {
        flex: 1;
        padding: 8px 12px;
        border: none;
        border-radius: 4px;
        cursor: pointer;
        font-size: 12px;
        font-weight: 500;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 4px;
        transition: all 0.2s ease;
    }

    .mobile-number-input .action-btn i {
        font-size: 12px !important;
    }
    
    .mobile-number-input .action-btn.clear {
        background: linear-gradient(135deg, rgba(255, 82, 82, 0.3), rgba(255, 111, 0, 0.3));
        border: 1px solid rgba(255, 82, 82, 0.5);
        color: #ffab91;
    }
    
    .mobile-number-input .action-btn.clear:hover {
        background: linear-gradient(135deg, rgba(255, 82, 82, 0.5), rgba(255, 111, 0, 0.5));
        box-shadow: 0 0 15px rgba(255, 82, 82, 0.4);
    }
    
    .mobile-number-input .action-btn.erase {
        background: linear-gradient(135deg, rgba(33, 150, 243, 0.3), rgba(63, 81, 181, 0.3));
        border: 1px solid rgba(33, 150, 243, 0.5);
        color: #90caf9;
    }
    
    .mobile-number-input .action-btn.erase:hover {
        background: linear-gradient(135deg, rgba(33, 150, 243, 0.5), rgba(63, 81, 181, 0.5));
        box-shadow: 0 0 15px rgba(33, 150, 243, 0.4);
    }
    
    footer {
        margin-top: 12px;
        padding-top: 8px;
    }
    
    .right-panel > .stats-panel {
        display: none !important;
    }
    
    .stat-row {
        font-size: 12px;
        padding: 4px 0;
        margin-bottom: 4px;
    }
    
    .stats-panel {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .mobile-number-input .num-btn {
        font-size: 12px;
        padding: 6px 0;
    }
    
    .center-panel .cell {
        font-size: 13px;
    }
}

/* ========== 胜利弹窗样式 ========== */
.victory-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.victory-modal.show {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.victory-content {
    background: linear-gradient(135deg, #1a1f4a 0%, #2d1b69 100%);
    border-radius: 20px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(124, 77, 255, 0.5);
    border: 2px solid rgba(124, 77, 255, 0.5);
    animation: slideUp 0.5s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.victory-header {
    text-align: center;
    margin-bottom: 30px;
}

.victory-icon {
    font-size: 60px;
    color: #ffd700;
    display: block;
    margin-bottom: 15px;
    animation: bounce 1s ease infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.victory-header h2 {
    color: #fff;
    font-size: 28px;
    margin: 0;
    text-shadow: 0 0 20px rgba(124, 77, 255, 0.8);
}

.victory-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

.victory-stat-item {
    background: rgba(124, 77, 255, 0.2);
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    border: 1px solid rgba(124, 77, 255, 0.3);
}

.victory-stat-item i {
    font-size: 24px;
    color: #7c4dff;
    margin-bottom: 8px;
    display: block;
}

.victory-stat-item .stat-label {
    display: block;
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    margin-bottom: 5px;
}

.victory-stat-item .stat-value {
    display: block;
    color: #fff;
    font-size: 20px;
    font-weight: 700;
}

.victory-rating {
    text-align: center;
    margin-bottom: 20px;
}

.victory-rating i {
    font-size: 32px;
    color: #ffd700;
    margin: 0 5px;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
}

.victory-message {
    text-align: center;
    color: rgba(255, 255, 255, 0.9);
    font-size: 16px;
    margin-bottom: 25px;
    line-height: 1.6;
}

.victory-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.victory-btn {
    flex: 1;
    min-width: 120px;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.victory-btn.primary {
    background: linear-gradient(135deg, #7c4dff 0%, #4a148c 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(124, 77, 255, 0.4);
}

.victory-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(124, 77, 255, 0.6);
}

.victory-btn.secondary {
    background: rgba(124, 77, 255, 0.2);
    color: #e0e0ff;
    border: 1px solid rgba(124, 77, 255, 0.4);
}

.victory-btn.secondary:hover {
    background: rgba(124, 77, 255, 0.3);
}

.victory-btn.tertiary {
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.victory-btn.tertiary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .victory-content {
        padding: 25px;
        width: 95%;
    }
    
    .victory-header h2 {
        font-size: 22px;
    }
    
    .victory-icon {
        font-size: 48px;
    }
    
    .victory-stats {
        gap: 10px;
    }
    
    .victory-stat-item {
        padding: 10px;
    }
    
    .victory-stat-item i {
        font-size: 20px;
    }
    
    .victory-stat-item .stat-value {
        font-size: 16px;
    }
    
    .victory-actions {
        flex-direction: column;
    }
    
    .victory-btn {
        width: 100%;
    }
}
