body {
    font-family: 'Arial Rounded MT Bold', 'Arial', sans-serif;
    background-color: #f0f9ff;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    padding: 20px;
}

.game-container {
    background-color: white;
    border-radius: 20px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    padding: 20px;
    max-width: 300px;
    width: 100%;
    text-align: center;
    position: relative;
}

.explanation-container {
    margin-bottom: 15px;
    font-size: 1.2rem;
    color: #333;
}

.info-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.score-container {
    display: flex;
    gap: 15px;
    font-size: 1rem;
}

.target-container {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: #f5f5f5;
    padding: 5px 10px;
    border-radius: 20px;
}

.target-container p {
    margin: 0;
    font-size: 0.9rem;
    color: #555;
}

#target-character {
    width: 40px;
    height: 40px;
    border: 2px dashed #4CAF50;
    border-radius: 8px;
    background-color: #f8fff8;
    object-fit: contain;
    padding: 2px;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 20px;
}

.cell {
    aspect-ratio: 1/1;
    background-color: #e3f2fd;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.cell-inner {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.character {
    transition: all 0.3s;
    position: relative;
    opacity: 0;
    object-fit: contain;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
}

.character.found {
    opacity: 1 !important;
    filter: drop-shadow(0 0 10px gold);
    transform: scale(1.1);
    cursor: default;
    z-index: 2;
}

/* 正解時のスタイル */
.cell.correct {
    animation: correctGlow 0.5s;
    background-color: rgba(76, 175, 80, 0.2);
}

@keyframes correctGlow {
    0% { box-shadow: 0 0 5px rgba(0, 0, 0, 0.2); }
    50% { box-shadow: 0 0 20px gold; }
    100% { box-shadow: 0 0 5px rgba(0, 0, 0, 0.2); }
}

/* セルを揺らすアニメーション */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-5px); }
    40% { transform: translateX(5px); }
    60% { transform: translateX(-5px); }
    80% { transform: translateX(5px); }
}

.cell.shake {
    animation: shake 0.5s ease-in-out;
    background-color: rgba(255, 0, 0, 0.2);
}

/* 不正解時のスタイル */
.wrong-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(120, 120, 120, 0.7);
    border-radius: 8px;
    z-index: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 24px;
}

.button-container button {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
}

.button-container button:hover {
    background-color: #45a049;
    transform: scale(1.05);
}

.button-container button:disabled {
    background-color: #cccccc;
    transform: none;
    cursor: not-allowed;
}

/* ゲームオーバー時のオーバーレイ */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 1.5rem;
    border-radius: 20px;
    z-index: 10;
}

.overlay h2 {
    margin-bottom: 10px;
}

.overlay p {
    margin: 5px 0;
}

.overlay button {
    margin-top: 20px;
    padding: 10px 20px;
    border-radius: 50px;
    border: none;
    background-color: #4CAF50;
    color: white;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s;
}

.overlay button:hover {
    background-color: #45a049;
    transform: scale(1.05);
}

/* 記憶時間オーバーレイ */
.memory-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    z-index: 20;
    border-radius: 20px;
}

.memory-message {
    font-size: 1.2rem;
    margin-bottom: 20px;
    text-align: center;
}

.countdown {
    font-size: 3rem;
    font-weight: bold;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}