body {
    margin: 0;
    padding: 0;
    font-family: 'M PLUS Rounded 1c', sans-serif;
    background: url('images/background.png') center/cover, linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    overflow: hidden;
}

#game-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

/* 共通画面スタイル */
#start-screen,
#game-screen,
#result-screen {
    text-align: center;
    width: 100%;
    max-width: 700px;
    padding: 20px;
    display: none; /* デフォルトは非表示 */
}


/* GameBaseの画面管理システムに対応 */
#start-screen.active, #game-screen.active, #result-screen.active {
    display: block;
}

.hidden {
    display: none !important;
}

/* スタート画面 */
#start-screen h1 {
    font-size: 48px;
    margin: 0 0 20px 0;
}

#start-screen p {
    font-size: 20px;
    margin-bottom: 20px;
}

.instructions {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 30px;
    text-align: left;
}

.instructions p {
    font-weight: bold;
    font-size: 18px;
    margin-bottom: 10px;
}

.instructions ul {
    list-style: none;
    padding: 0;
}

.instructions li {
    padding: 5px 0;
    font-size: 16px;
}

/* ボタン */
.primary-btn {
    padding: 15px 40px;
    font-size: 20px;
    font-weight: bold;
    background: #4299e1;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.primary-btn:hover {
    background: #3182ce;
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.4);
}

.primary-btn:active {
    transform: translateY(0);
}

/* UI統計 */
#ui {
    margin-bottom: 20px;
}

.stats {
    display: flex;
    justify-content: space-around;
    gap: 20px;
    font-size: 18px;
    font-weight: bold;
}

.highlight {
    color: #ffd700;
    font-size: 24px;
}

/* 記憶フェーズ */
#show-phase h2 {
    font-size: 24px;
    margin-bottom: 20px;
}

.grid-3x3 {
    display: grid;
    grid-template-columns: repeat(3, 100px);
    grid-gap: 10px;
    justify-content: center;
    margin: 20px auto;
}

.grid-cell {
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    font-weight: bold;
    background: #2d3748;
    border-radius: 10px;
    color: transparent;
    transition: all 0.3s;
}

.grid-cell.active {
    background: #4299e1;
    color: white;
    animation: pulse 0.3s ease-in-out;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

.timer {
    font-size: 24px;
    font-weight: bold;
    margin-top: 20px;
}

/* 入力フェーズ */
#input-phase h2 {
    font-size: 24px;
    margin-bottom: 20px;
}

.input-boxes {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 20px auto;
    min-height: 80px;
    flex-wrap: wrap;
}

.input-box {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: bold;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    animation: slideIn 0.2s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.button-grid {
    display: grid;
    grid-template-columns: repeat(3, 80px);
    grid-gap: 10px;
    justify-content: center;
    margin: 20px auto;
}

.button-grid button {
    width: 80px;
    height: 80px;
    font-size: 32px;
    background: #4299e1;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: bold;
}

.button-grid button:hover {
    background: #3182ce;
    transform: scale(1.05);
}

.button-grid button:active {
    transform: scale(0.95);
}

.undo-btn {
    padding: 10px 20px;
    font-size: 16px;
    background: #e53e3e;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 10px;
    transition: all 0.2s;
}

.undo-btn:hover {
    background: #c53030;
}

/* 結果画面 */
#result-screen h2 {
    font-size: 36px;
    margin-bottom: 30px;
}

.result-stats {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 30px;
    border-radius: 20px;
    margin-bottom: 30px;
}

.result-stats p {
    font-size: 24px;
    margin: 15px 0;
}

/* レスポンシブ対応 */
@media (max-width: 600px) {
    .grid-3x3 {
        grid-template-columns: repeat(3, 80px);
    }

    .grid-cell {
        width: 80px;
        height: 80px;
        font-size: 36px;
    }

    .button-grid {
        grid-template-columns: repeat(3, 70px);
    }

    .button-grid button {
        width: 70px;
        height: 70px;
        font-size: 28px;
    }

    .stats {
        flex-direction: column;
        gap: 10px;
    }
}
