* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none; 
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

input {
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
}

body {
    font-family: 'Arial', sans-serif;
    background-color: #f0f0f0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    color: #333;
    position: relative;
}

h1 {
    margin-bottom: 10px;
    color: #2c3e50;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
    position: relative;
    z-index: 300;
}

.game-container {
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    padding: 20px;
    width: 100%;
    max-width: 800px;
    position: relative;
    z-index: 10;
    margin-top: 100px;
}

.controls {
    margin-bottom: 15px;
}

.control-row {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

button {
    padding: 8px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
    font-size: 14px;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.difficulty-btn {
    background-color: #3498db;
    color: white;
}

.difficulty-btn.active {
    background-color: #2980b9;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

#new-game {
    background-color: #2ecc71;
    color: white;
}

#hint-btn {
    background-color: #f39c12;
    color: white;
    display: flex;
    align-items: center;
    gap: 5px;
}

#hint-btn:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#custom-game {
    background-color: #9b59b6;
    color: white;
}

#toggle-leaderboard {
    background-color: #1abc9c;
    color: white;
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 150;
    border-radius: 20px;
    font-size: 13px;
    padding: 6px 12px;
}

#toggle-all-records {
    background-color: #1abc9c;
    color: white;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 150;
    border-radius: 20px;
    font-size: 13px;
    padding: 6px 12px;
}

/* 悔步按钮样式 */
#undo-btn {
    background-color: #e74c3c; 
    color: white;
    font-weight: bold;
}

#undo-btn:hover {
    background-color: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

#undo-btn:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.custom-inputs {
    display: none;
    margin: 10px auto;
    gap: 10px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    padding: 10px;
    background-color: #f9f9f9;
    border-radius: 5px;
    max-width: 500px;
}

.custom-inputs.active {
    display: flex;
}

.custom-inputs input {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 5px;
    width: 60px;
}

.custom-inputs button {
    background-color: #e67e22;
    color: white;
}

.game-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-weight: bold;
    padding: 10px;
    background-color: #f5f5f5;
    border-radius: 5px;
}

#game-board {
    margin: 0 auto;
    border: 2px solid #bdc3c7;
    border-collapse: collapse;
    background-color: #ecf0f1;
}

.cell {
    width: 30px;
    height: 30px;
    border: 1px solid #bdc3c7;
    text-align: center;
    font-weight: bold;
    cursor: pointer;
    background-color: #dfe6e9;
    font-size: 14px;
    transition: all 0.1s;
}

.cell:hover {
    background-color: #d2d9dd;
}

.revealed {
    background-color: #f8f9fa;
}

.mine {
    background-color: #ff6b6b;
}

.flag {
    background-color: #feca57;
}

.hint {
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { background-color: #dfe6e9; }
    50% { background-color: #a8dadc; }
    100% { background-color: #dfe6e9; }
}

.number-1 { color: #3498db; }
.number-2 { color: #2ecc71; }
.number-3 { color: #e74c3c; }
.number-4 { color: #9b59b6; }
.number-5 { color: #e67e22; }
.number-6 { color: #1abc9c; }
.number-7 { color: #34495e; }
.number-8 { color: #7f8c8d; }

#message {
    margin-top: 15px;
    padding: 10px;
    border-radius: 5px;
    text-align: center;
    font-weight: bold;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.win-message {
    background-color: #d4edda;
    color: #155724;
}

.lose-message {
    background-color: #f8d7da;
    color: #721c24;
}

.notices {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.hint-notice {
    font-size: 12px;
    color: #7f8c8d;
    text-align: center;
    padding: 3px 0;
}

@media (max-width: 1200px) {
    .all-records {
        display: none;
    }
    
    .leaderboard {
        display: none;
    }
}

@media (max-width: 768px) {
    .cell {
        width: 25px;
        height: 25px;
        font-size: 12px;
    }
    
    .control-row {
        justify-content: center;
    }
    
    button {
        padding: 6px 12px;
        font-size: 13px;
    }
    
    .game-container {
        margin-top: 90px;
    }
    
    .danmu-container {
        height: 70px;
    }
    
    .danmu {
        font-size: 16px;
    }
}

.leaderboard, .all-records {
    position: fixed;
    top: 20px;
    width: 400px; /* 电脑端默认宽度 */
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    padding: 15px;
    z-index: 100;
    max-height: 666px;
    overflow-y: auto;
}

.leaderboard {
    right: 20px; 
}

.all-records {
    left: 20px; 
}

@media (max-width: 1200px) {
}

@media (max-width: 768px) {
    .cell {
        width: 25px;
        height: 25px;
        font-size: 12px;
    }
    
    .control-row {
        justify-content: center;
    }
    
    button {
        padding: 6px 12px;
        font-size: 13px;
    }
    
    .game-container {
        margin-top: 90px;
    }
    
    .danmu-container {
        height: 70px;
    }
    
    .danmu {
        font-size: 16px;
    }
    
    /* 手机端调整面板宽度 */
    .leaderboard, .all-records {
        width: 380px !important;
        max-height: 300px;
    }
}

.all-records h2 {
    margin-bottom: 15px;
    color: #2c3e50;
    text-align: center;
    font-size: 16px;
}

.all-records-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
    justify-content: flex-start;
}

.all-records-filter {
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 12px;
    background-color: #f1f1f1;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.all-records-filter.active {
    background-color: #3498db;
    color: white;
}

.all-records-item {
    padding: 8px 0;
    font-size: 13px;
    border-bottom: 1px dashed #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.all-records-item:last-child {
    border-bottom: none;
}

.all-records-item .difficulty {
    display: inline-block;
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 10px;
    background-color: #f1f1f1;
    margin-right: 5px;
}

.all-records-item .time {
    color: #e74c3c;
    font-weight: bold;
}

.all-records-item .timestamp {
    font-size: 12px;
    color: #7f8c8d;
    margin-left: 5px;
}

.all-records-empty {
    color: #999;
    font-size: 12px;
    padding: 5px 0;
    text-align: center;
}

.leaderboard h2 {
    margin-bottom: 15px;
    color: #2c3e50;
    text-align: center;
    font-size: 16px;
}

.leaderboard-category {
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px dashed #eee;
}

.leaderboard-category:last-child {
    border-bottom: none;
}

.leaderboard-category h3 {
    font-size: 14px;
    color: #3498db;
    margin-bottom: 6px;
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    font-size: 13px;
}

.leaderboard-item .custom-dimensions {
    font-size: 11px;
    color: #7f8c8d;
    margin-left: 5px;
}

.leaderboard-item .performance-score {
    font-size: 11px;
    color: #2ecc71;
    margin-left: 5px;
}

.leaderboard-item.new-record {
    color: #e74c3c;
    font-weight: bold;
}

.leaderboard-empty {
    color: #999;
    font-size: 12px;
    padding: 5px 0;
}

.victory-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 300;
    display: none;
}

.victory-content {
    background-color: white;
    padding: 30px;
    border-radius: 10px;
    width: 80%;
    max-width: 500px;
    text-align: center;
}

.victory-content .hint-warning {
    color: #e74c3c;
    margin: 10px 0;
    font-size: 14px;
}

.victory-content .hint-count {
    margin: 5px 0;
    font-size: 14px;
}

.victory-content .performance-score {
    margin: 10px 0;
    font-size: 14px;
    color: #2ecc71;
    font-weight: bold;
}

.name-length-hint {
    font-size: 12px;
    color: #7f8c8d;
    margin: 5px 0;
    text-align: left;
}

.victory-content .button-group {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.danmu-container {
    position: absolute;
    top: 50px;
    left: 0;
    width: 100%;
    height: 90px;
    pointer-events: none;
    z-index: 250;
    overflow: hidden;
}

.danmu {
    position: absolute;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    font-size: 18px;
    white-space: nowrap;
    padding: 4px 10px;
    border-radius: 4px;
    background-color: rgba(0,0,0,0.3);
    animation: danmuMove linear;
}

@keyframes danmuMove {
    from { transform: translateX(100vw); }
    to { transform: translateX(-100%); }
}

.hint-cooldown {
    position: relative;
    overflow: hidden;
}

.hint-cooldown::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255,255,255,0.3);
    transform-origin: left center;
    transform: scaleX(0);
    transition: transform 3s linear;
}

.hint-cooldown.active::after {
    transform: scaleX(1);
}

.hint-count-display {
    background-color: rgba(243, 156, 18, 0.1);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    color: #000;
    font-weight: bold;
}

.footer {
    margin-top: 30px;
    text-align: center;
    color: #666;
    padding: 15px 0;
    width: 100%;
    max-width: 800px;
    position: relative;
    z-index: 10;
}

.sound-control-btn {
    background-color: rgba(52, 152, 219, 0.8);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
}

#audio-permission {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0,0,0,0.8);
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 10px;
}

#audio-permission button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 3px;
    cursor: pointer;
}
/* 分享弹窗样式 */
.share-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 400;
    display: none;
}

.share-content {
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    width: 80%;
    max-width: 300px;
}

.share-options {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.share-btn {
    flex: 1;
    min-width: 60px;
    padding: 10px 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    background-color: #f1f1f1;
    color: #333;
}

.share-btn:hover {
    background-color: #3498db;
    color: white;
}

#save-screenshot {
    background-color: #3498db;
    color: white;
}

#share-score {
    background-color: #9b59b6;
    color: white;
}