/* 像素记忆大师 - CSS样式 */
/* 8位复古像素风格 */

/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Courier New', monospace;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f0f23 100%);
    color: #ffffff;
    min-height: 100vh;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* 游戏容器 */
.game-container {
    max-width: 100vw;
    max-height: 100vh;
    overflow: hidden;
    position: relative;
}

/* 屏幕样式 */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: radial-gradient(circle at center, rgba(26, 26, 46, 0.9) 0%, rgba(15, 15, 35, 0.95) 100%);
}

.screen.active {
    display: flex;
}

/* 主菜单样式 */
.game-title {
    text-align: center;
    margin-bottom: 40px;
}

.game-title h1 {
    font-size: 2.5em;
    color: #ffd700;
    text-shadow: 
        2px 2px 0px #ff6b35,
        4px 4px 0px #f7931e,
        6px 6px 0px #000000;
    margin-bottom: 10px;
    font-weight: bold;
    letter-spacing: 2px;
}

.game-title .subtitle {
    font-size: 1.2em;
    color: #ffffff;
    text-shadow: 1px 1px 2px #000000;
    opacity: 0.8;
}

/* 菜单按钮 */
.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
}

.menu-btn {
    padding: 15px 30px;
    font-size: 1.2em;
    font-family: 'Courier New', monospace;
    background: linear-gradient(145deg, #4a4a8a, #2a2a5a);
    color: #ffffff;
    border: 3px solid #ffd700;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 
        0 4px 0 #1a1a3a,
        0 6px 10px rgba(0, 0, 0, 0.3);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: bold;
}

.menu-btn:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 6px 0 #1a1a3a,
        0 8px 15px rgba(0, 0, 0, 0.4);
}

.menu-btn:active {
    transform: translateY(2px);
    box-shadow: 
        0 2px 0 #1a1a3a,
        0 4px 8px rgba(0, 0, 0, 0.3);
}

/* 最高分显示 */
.high-score-display {
    font-size: 1.1em;
    color: #ffd700;
    text-shadow: 1px 1px 2px #000000;
}

.high-score-display span {
    margin: 0 5px;
}

/* 模式选择 */
.mode-select h2 {
    font-size: 2em;
    color: #ffd700;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px #000000;
}

.mode-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    max-width: 800px;
    width: 100%;
    margin-bottom: 30px;
}

.mode-card {
    background: linear-gradient(145deg, #3a3a7a, #1a1a4a);
    border: 3px solid #ffd700;
    border-radius: 0;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 
        0 4px 0 #1a1a3a,
        0 6px 10px rgba(0, 0, 0, 0.3);
}

.mode-card:hover {
    transform: translateY(-3px);
    box-shadow: 
        0 6px 0 #1a1a3a,
        0 8px 15px rgba(0, 0, 0, 0.4);
}

.mode-card h3 {
    font-size: 1.5em;
    color: #ffd700;
    margin-bottom: 10px;
    text-shadow: 1px 1px 2px #000000;
}

.mode-card p {
    color: #ffffff;
    margin-bottom: 10px;
    line-height: 1.4;
}

.mode-card small {
    color: #cccccc;
    font-size: 0.9em;
}

/* 返回按钮 */
.back-btn {
    padding: 10px 20px;
    font-size: 1em;
    background: linear-gradient(145deg, #6a4a4a, #4a2a2a);
    color: #ffffff;
    border: 2px solid #ff6b6b;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.back-btn:hover {
    background: linear-gradient(145deg, #8a5a5a, #5a3a3a);
}

/* 游戏界面 */
.game-header {
    width: 100%;
    max-width: 800px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 3px solid #ffd700;
    margin-bottom: 20px;
}

.score-info {
    display: flex;
    gap: 20px;
    font-size: 1.1em;
}

.score-info span {
    color: #ffd700;
    text-shadow: 1px 1px 2px #000000;
}

.lives-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

#lives {
    display: flex;
    gap: 5px;
}

.life {
    font-size: 1.5em;
    text-shadow: 1px 1px 2px #000000;
}

/* 游戏区域 */
.game-area {
    width: 100%;
    max-width: 600px;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* 翻牌匹配模式样式 */
.cards-grid {
    display: grid;
    gap: 10px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 0;
    border: 2px solid #ffd700;
}

.card {
    width: 80px;
    height: 80px;
    background: linear-gradient(145deg, #4a4a8a, #2a2a5a);
    border: 2px solid #ffd700;
    border-radius: 0;
    cursor: pointer;
    position: relative;
    transition: all 0.3s;
    box-shadow: 
        0 4px 0 #1a1a3a,
        0 6px 10px rgba(0, 0, 0, 0.3);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 6px 0 #1a1a3a,
        0 8px 15px rgba(0, 0, 0, 0.4);
}

.card.flipped {
    background: linear-gradient(145deg, #5a5a9a, #3a3a6a);
}

.card.matched {
    background: linear-gradient(145deg, #4a8a4a, #2a5a2a);
    border-color: #00ff00;
    animation: matchPulse 0.5s ease-in-out;
}

.card.wrong {
    background: linear-gradient(145deg, #8a4a4a, #5a2a2a);
    animation: wrongShake 0.5s ease-in-out;
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2em;
    backface-visibility: hidden;
}

.card-front {
    background: linear-gradient(145deg, #2a2a5a, #1a1a3a);
    border: 1px solid #ffd700;
}

.card-back {
    background: linear-gradient(145deg, #5a5a9a, #3a3a6a);
    transform: rotateY(180deg);
}

/* 序列记忆模式样式 */
.sequence-display {
    display: flex;
    gap: 15px;
    padding: 30px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 0;
    border: 3px solid #ffd700;
    margin-bottom: 30px;
}

.sequence-item {
    width: 60px;
    height: 60px;
    background: linear-gradient(145deg, #4a4a8a, #2a2a5a);
    border: 2px solid #ffd700;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    animation: sequenceHighlight 1s ease-in-out;
}

.sequence-input {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.sequence-btn {
    width: 50px;
    height: 50px;
    background: linear-gradient(145deg, #4a4a8a, #2a2a5a);
    border: 2px solid #ffd700;
    border-radius: 0;
    cursor: pointer;
    font-size: 1.2em;
    transition: all 0.2s;
}

.sequence-btn:hover {
    background: linear-gradient(145deg, #5a5a9a, #3a3a6a);
    transform: scale(1.1);
}

/* 数字记忆模式样式 */
.number-grid {
    display: grid;
    gap: 10px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 0;
    border: 2px solid #ffd700;
}

.number-cell {
    width: 80px;
    height: 80px;
    background: linear-gradient(145deg, #4a4a8a, #2a2a5a);
    border: 2px solid #ffd700;
    border-radius: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    font-weight: bold;
    transition: all 0.2s;
}

.number-cell:hover {
    background: linear-gradient(145deg, #5a5a9a, #3a3a6a);
}

.number-cell.revealed {
    background: linear-gradient(145deg, #4a8a4a, #2a5a2a);
    color: #00ff00;
}

.number-cell.selected {
    background: linear-gradient(145deg, #8a8a4a, #5a5a2a);
    border-color: #ffff00;
}

/* 游戏控制按钮 */
.game-controls {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.control-btn {
    padding: 12px 24px;
    font-size: 1em;
    background: linear-gradient(145deg, #4a4a8a, #2a2a5a);
    color: #ffffff;
    border: 2px solid #ffd700;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.control-btn:hover {
    background: linear-gradient(145deg, #5a5a9a, #3a3a6a);
    transform: translateY(-2px);
}

.control-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* 暂停界面 */
.pause-menu {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 30px;
}

/* 游戏结束界面 */
.game-result {
    background: rgba(0, 0, 0, 0.3);
    padding: 30px;
    border-radius: 0;
    border: 3px solid #ffd700;
    margin-bottom: 30px;
    text-align: center;
}

.result-item {
    margin: 15px 0;
    font-size: 1.2em;
}

.result-item span:first-child {
    color: #cccccc;
    margin-right: 10px;
}

.result-item span:last-child {
    color: #ffd700;
    font-weight: bold;
}

#game-rating {
    color: #00ff00;
    font-size: 1.5em;
    font-weight: bold;
}

.game-over-menu {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 30px;
}

/* 设置界面 */
.settings-content {
    background: rgba(0, 0, 0, 0.3);
    padding: 30px;
    border-radius: 0;
    border: 3px solid #ffd700;
    margin-bottom: 30px;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 20px 0;
    font-size: 1.1em;
}

.setting-item label {
    color: #ffffff;
}

.setting-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* 最高分界面 */
.high-scores-list {
    background: rgba(0, 0, 0, 0.3);
    padding: 30px;
    border-radius: 0;
    border: 3px solid #ffd700;
    margin-bottom: 30px;
}

.score-mode {
    margin-bottom: 30px;
}

.score-mode h3 {
    color: #ffd700;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.high-scores-list-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 15px;
    margin: 5px 0;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid #ffd700;
    font-size: 1.1em;
}

.high-scores-list-item:nth-child(1) {
    background: rgba(255, 215, 0, 0.2);
    border-color: #ffd700;
}

.high-scores-list-item:nth-child(2) {
    background: rgba(192, 192, 192, 0.2);
    border-color: #c0c0c0;
}

.high-scores-list-item:nth-child(3) {
    background: rgba(205, 127, 50, 0.2);
    border-color: #cd7f32;
}

/* 通知样式 */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    background: linear-gradient(145deg, #4a8a4a, #2a5a2a);
    color: #ffffff;
    border: 2px solid #00ff00;
    border-radius: 0;
    font-size: 1.1em;
    font-weight: bold;
    transform: translateX(400px);
    transition: transform 0.3s ease-in-out;
    z-index: 1000;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.notification.show {
    transform: translateX(0);
}

.notification.error {
    background: linear-gradient(145deg, #8a4a4a, #5a2a2a);
    border-color: #ff4444;
}

.notification.warning {
    background: linear-gradient(145deg, #8a8a4a, #5a5a2a);
    border-color: #ffaa00;
}

/* 动画 */
@keyframes matchPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes wrongShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

@keyframes sequenceHighlight {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .game-title h1 {
        font-size: 2em;
    }
    
    .game-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .score-info {
        flex-direction: column;
        gap: 10px;
    }
    
    .card {
        width: 60px;
        height: 60px;
        font-size: 1.5em;
    }
    
    .mode-buttons {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .game-title h1 {
        font-size: 1.5em;
    }
    
    .game-title .subtitle {
        font-size: 1em;
    }
    
    .menu-btn {
        padding: 12px 20px;
        font-size: 1em;
    }
    
    .card {
        width: 50px;
        height: 50px;
        font-size: 1.2em;
    }
    
    .number-cell {
        width: 60px;
        height: 60px;
        font-size: 1.2em;
    }
    
    .game-controls {
        flex-direction: column;
        width: 100%;
    }
    
    .control-btn {
        width: 100%;
    }
}