/* リセットとベースのスタイル */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'MS Gothic', 'monospace', sans-serif;
    background: #000000;
    color: #ffffff;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.famicom-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.famicom-screen {
    width: 460px;
    height: 403px;
    background: #086868;
    border: 4px solid #ffffff;
    display: flex;
    flex-direction: column;
    font-size: 16px;
    position: relative;
}

.top-area {
    height: 140px;
    background: #000000;
    border: 2px solid #ffffff;
    margin: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.direction-boxes {
    display: flex;
    gap: 8px;
}

.direction-box {
    width: 60px;
    height: 60px;
    background: #ffffff;
    border: 2px solid #000000;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #000000;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.1s ease;
}

.direction-box.selected {
    background: #ff0000;
    color: #ffffff;
}

.direction-box.computer-choice {
    background: #0000ff;
    color: #ffffff;
    cursor: default;
}

.direction-box:hover:not(.computer-choice) {
    background: #cccccc;
}

.character-area {
    height: 200px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #086868;
}

#character {
    max-width: 120px;
    max-height: 120px;
    image-rendering: pixelated;
    transition: opacity 0.1s ease;
}

.bottom-area {
    height: 80px;
    background: #000000;
    border: 2px solid #ffffff;
    margin: 8px;
    padding: 8px;
    color: #ffffff;
}

.info-bar {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.level-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.label {
    font-size: 12px;
    color: #ffffff;
    min-width: 40px;
}

.result-squares {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.square-row {
    display: flex;
    gap: 2px;
    align-items: center;
}

.square {
    width: 8px;
    height: 8px;
    background: #000080;
    border: 1px solid #ffffff;
    flex-shrink: 0;
}

.square.correct {
    background: #0000ff;
}

.square.incorrect {
    background: #ff0000;
}

.square-spacer {
    width: 4px;
    height: 8px;
    flex-shrink: 0;
}

.score-info {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    font-family: monospace;
}

.score-text {
    color: #ffffff;
}

.control-panel {
    display: flex;
    gap: 20px;
}

.control-btn {
    padding: 12px 24px;
    font-size: 16px;
    font-family: 'MS Gothic', monospace;
    background: #ffffff;
    color: #000000;
    border: 2px solid #000000;
    cursor: pointer;
    transition: all 0.1s ease;
}

.control-btn:hover {
    background: #cccccc;
}

.control-btn:active {
    background: #999999;
}

.result-area {
    margin: 20px 0;
    min-height: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 10px;
    font-family: 'MS Gothic', monospace;
}

#round-result {
    font-size: 18px;
    font-weight: bold;
    padding: 10px;
    min-height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
}

.correct {
    color: #00ff00;
}

.incorrect {
    color: #ff0000;
}

#game-result {
    font-size: 20px;
    font-weight: bold;
    padding: 15px;
    margin-top: 10px;
    color: #ffffff;
}

.game-clear {
    color: #ffff00;
}

.game-over {
    color: #ff0000;
}

/* レスポンシブデザイン */
@media (max-width: 600px) {
    .famicom-screen {
        width: 360px;
        height: 315px;
    }

    .direction-box {
        width: 42px;
        height: 42px;
        font-size: 18px;
    }

    .top-area {
        height: 100px;
    }

    .character-area {
        height: 135px;
    }

    #character {
        max-width: 90px;
        max-height: 90px;
    }

    .bottom-area {
        height: 65px;
    }

    .square {
        width: 6px;
        height: 6px;
    }

    .score-info {
        font-size: 12px;
    }
}

/* 非常に小さい画面向け */
@media (max-width: 400px) {
    .famicom-screen {
        width: 320px;
        height: 280px;
    }

    .direction-box {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }

    .top-area {
        height: 90px;
    }

    .character-area {
        height: 120px;
    }

    #character {
        max-width: 80px;
        max-height: 80px;
    }

    .bottom-area {
        height: 60px;
    }

    .square {
        width: 5px;
        height: 5px;
    }

    .score-info {
        font-size: 11px;
    }

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

/* アニメーション効果 */
.direction-box.flash {
    animation: flash 0.2s ease-in-out;
}

@keyframes flash {
    0% { background: #ffffff; }
    50% { background: #ffff00; }
    100% { background: #ffffff; }
}

.direction-box.computer-flash {
    animation: computer-flash 0.5s ease-in-out;
}

@keyframes computer-flash {
    0% { background: #0000ff; }
    50% { background: #00ffff; }
    100% { background: #0000ff; }
}