.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
}

#pong-canvas {
    background-color: #2a2a2a;
    border: 4px solid #ffffff;
    box-shadow: 0 0 0 4px #8a2be2, 0 0 10px rgba(138, 43, 226, 0.5), 0 0 20px rgba(138, 43, 226, 0.3);
    margin: 20px 0;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.game-stats {
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 600px;
    margin-bottom: 10px;
    padding: 10px;
    background-color: #2a2a2a;
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 2px #8a2be2;
}

.game-instructions {
    position: absolute;
    left: calc(600px + 50px); 
    text-align: left;
    padding: 10px;
    background-color: #2a2a2a;
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 2px #8a2be2;
    width: 180px;
    max-width: 180px;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    overflow: hidden;
}

.game-instructions h3 {
    color: #8a2be2;
    margin-bottom: 10px;
    font-size: 14px;
    text-align: center;
}

.instructions-content {
    max-height: 0;
    opacity: 0;
    padding: 0 5px;
    transition: max-height 0.4s ease-out, opacity 0.3s ease-out, padding 0.3s ease;
    overflow: hidden;
}

.game-instructions:hover {
    box-shadow: 0 0 0 2px #8a2be2, 0 0 15px rgba(138, 43, 226, 0.7);
}

.game-instructions:hover .instructions-content {
    max-height: 400px;
    opacity: 1;
    padding: 5px;
}

.game-instructions p {
    font-size: 10px;
    margin-bottom: 8px;
    color: #cccccc;
    transform: translateY(5px);
    transition: transform 0.3s ease;
}

.game-instructions:hover p {
    transform: translateY(0);
}

/* 分数记录面板样式 */
.score-records {
    position: absolute;
    left: -220px;
    text-align: left;
    padding: 10px;
    background-color: #2a2a2a;
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 2px #8a2be2;
    width: 100%;
    max-width: 220px;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    overflow: hidden;
}

.score-records h3 {
    color: #8a2be2;
    margin-bottom: 10px;
    font-size: 14px;
    text-align: center;
}

.records-content {
    max-height: 0;
    opacity: 0;
    padding: 0 5px;
    transition: max-height 0.4s ease-out, opacity 0.3s ease-out, padding 0.3s ease;
    overflow: hidden;
}

.score-records:hover {
    box-shadow: 0 0 0 2px #8a2be2, 0 0 15px rgba(138, 43, 226, 0.7);
}

.score-records:hover .records-content {
    max-height: 400px;
    opacity: 1;
    padding: 5px;
}

.high-score {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px dashed rgba(138, 43, 226, 0.5);
}

.record-label {
    display: block;
    font-size: 10px;
    color: #8a2be2;
    margin-bottom: 5px;
}

.record-value {
    font-size: 16px;
    color: #ffffff;
    font-weight: bold;
}

.score-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.score-list li {
    font-size: 10px;
    color: #cccccc;
    margin-bottom: 5px;
    padding: 3px 0;
    border-bottom: 1px dotted rgba(255, 255, 255, 0.2);
}

.score-list li:last-child {
    border-bottom: none;
}

.game-over {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(42, 42, 42, 0.95);
    padding: 20px;
    text-align: center;
    border: 4px solid #ffffff;
    box-shadow: 0 0 0 4px #8a2be2, 0 0 10px rgba(138, 43, 226, 0.5);
    z-index: 100;
    display: none;
}

.game-over h2 {
    color: #8a2be2;
    margin-bottom: 15px;
    font-size: 24px;
    animation: blink 1s steps(2) infinite;
}

.game-over p {
    margin-bottom: 20px;
    color: #ffffff;
}

#restart-btn {
    margin-top: 10px;
}

@keyframes blink {
    0% { opacity: 1; }
    50% { opacity: 0; }
    100% { opacity: 1; }
}

.game-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 14px;
    margin: 15px 0;
    width: 100%;
    max-width: 600px;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .game-instructions, .score-records {
        position: static;
        margin-top: 20px;
        max-width: 600px;
        width: 100%;
    }
    
    .instructions-content, .records-content {
        max-height: none;
        opacity: 1;
        padding: 5px;
    }
    
    .game-instructions p {
        transform: translateY(0);
    }
}

@media (max-width: 640px) {
    #pong-canvas {
        width: 100%;
        height: auto;
    }
    
    .game-stats {
        max-width: 100%;
    }
}

.game-btn.pixel-btn {
    min-width: 80px;
    height: 36px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 8px 16px;
    background: #8a2be2;
    color: #ffffff;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 2px #8a2be2;
    text-transform: uppercase;
    border-radius: 0;
    font-size: 12px;
    font-family: 'Press Start 2P', cursive;
}

.game-btn.pixel-btn:hover {
    background-color: #8a2be2;
    box-shadow: 0 0 15px rgba(138, 43, 226, 0.7);
}

#speed-select {
    appearance: none;
    background-color: #000;
    color: #fff;
    border: 2px solid #8a2be2;
    padding: 10px;
    font-family: 'Press Start 2P', cursive;
    font-size: 14px;
    cursor: pointer;
    text-align: center;
    width: 150px;
    margin: 5px;
    box-shadow: 0 0 10px rgba(138, 43, 226, 0.5);
}

#speed-select option {
    background-color: #000;
    color: #fff;
}


/* 游戏消息样式 */
.game-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Press Start 2P', cursive;
    z-index: 50;
}

.speed-message {
    color: #ff0000;
    font-size: 16px;
    text-shadow: 0 0 10px rgba(255, 0, 0, 0.7);
}

.time-speed-message {
    top: 40%;
    color: #0066cc;
    font-size: 18px;
    text-shadow: 0 0 15px rgba(0, 102, 204, 0.9);
}

.pause-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.pause-text {
    font-family: 'Press Start 2P', cursive;
    font-size: 20px;
    color: #ffffff;
    text-align: center;
}