body {
    background: #fff8e1;
    font-family: 'Zen Maru Gothic', sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0;
    padding: 20px;
    color: #333;
}

.container {
    background: white;
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    width: 100%;
    max-width: 420px;
    text-align: center;
    box-sizing: border-box;
}

h1 {
    font-size: 1.2rem;
    color: #d84315;
    margin-top: 0;
    margin-bottom: 5px;
}

p {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 15px;
}

.info-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-weight: bold;
    font-size: 0.9rem;
}

#restart-btn {
    padding: 6px 12px;
    background: #ff7043;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-weight: bold;
}

/* 4×4のカードグリッド */
.grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

/* カードのスタイル */
.card {
    aspect-ratio: 1;
    background-color: #ffe0b2;
    border-radius: 8px;
    cursor: pointer;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.card.flipped {
    transform: rotateY(180deg);
    cursor: default;
}

.card.matched {
    opacity: 0.4;
    cursor: default;
}

/* カードの裏表共通 */
.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 8px;
    box-sizing: border-box;
}

/* 裏面（めくる前：おかかのイラストや茶色いテクスチャ風） */
.card-back {
    background: #ffcc80;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    border: 2px dashed #fb8c00;
}
.card-back::after {
    content: '🍚';
}

/* 表面（めくった後：画像の一部を切り抜いて表示） */
.card-front {
    background-image: url('okaka.png');
    background-size: 300% 300%; /* 3×3に分割したうちの拡大率 */
    transform: rotateY(180deg);
    border: 2px solid #d84315;
}

/* モーダル */
#clear-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.modal-hidden {
    display: none !important;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    width: 80%;
    max-width: 300px;
}

.modal-content h2 {
    color: #d84315;
    margin-top: 0;
}

#modal-restart-btn {
    margin-top: 15px;
    padding: 10px 20px;
    background: #ff7043;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    font-family: inherit;
}

.back-btn {
    align-self: flex-start;
    margin-bottom: 15px;
    text-decoration: none;
    color: #555;
    font-weight: bold;
    background: white;
    padding: 8px 16px;
    border-radius: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
