/* css/style.css */
:root {
    --sakura-color: #FFB7C5;
    --sakura-dark: #FF9EAE;
    --wakakusa-color: #B8D087;
    --wakakusa-dark: #9CB864;
    --text-color: #5D4B4A;
    --bg-color: #FFF9F9;
    --board-bg: rgba(255, 255, 255, 0.4);
    --btn-primary: #FF9EAE;
    --btn-secondary: #E0E0E0;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'M PLUS Rounded 1c', sans-serif;
}

body {
    background-color: #f0f0f0;
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden; /* Prevent scrolling on mobile */
}

#game-container {
    width: 100%;
    max-width: 500px;
    height: 100vh;
    background: url('../img/bg.png') center/cover no-repeat;
    position: relative;
    overflow: hidden;
    padding: 30px 20px; /* 上下30pxの余白を配置 */
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
}

/* -------------------- Layers -------------------- */
#background-effects, #character-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

#background-effects {
    z-index: 1;
}

#character-layer {
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 50px 0;
    opacity: 0.6;
}

.cheering-char {
    width: 220px;
    height: 220px;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    animation: bounce 2s infinite ease-in-out;
}

#char-ichigo {
    background-image: url('../img/cheer_ichigo.png');
}

#char-dorakururi {
    background-image: url('../img/cheer_dorakururi.png');
}

.cheering-char.hidden {
    display: none;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

.screen {
    z-index: 10; /* Above board and effects */
    flex: 1;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    animation: fadeIn 0.5s ease;
    height: 100%;
    position: relative;
}

.screen.active {
    display: flex;
}

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

#screen-title, #screen-select, #screen-result {
    background: rgba(255, 255, 255, 0.85);
    border-radius: 20px;
    padding: 30px 20px;
    margin: 20px 0;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

/* -------------------- Typography & Buttons -------------------- */
h1.game-title {
    font-size: 2.0rem;
    font-weight: 900;
    color: var(--sakura-dark);
    margin-bottom: 5px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.game-title .vs {
    font-size: 1.2rem;
    color: var(--wakakusa-dark);
}

.catchphrase {
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.description {
    font-size: 0.8rem;
    margin-bottom: 20px;
    color: #888;
}

.btn {
    display: inline-block;
    padding: 10px 20px;
    margin: 5px 0;
    border: none;
    border-radius: 30px;
    font-size: 1.0rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    width: 80%;
    max-width: 300px;
    text-decoration: none;
    color: var(--text-color);
}

.primary-btn {
    background-color: var(--sakura-color);
    box-shadow: 0 4px 0 var(--sakura-dark);
}

.primary-btn:active {
    transform: translateY(4px);
    box-shadow: none;
}

.secondary-btn {
    background-color: var(--btn-secondary);
    box-shadow: 0 4px 0 #BDBDBD;
}

.secondary-btn:active {
    transform: translateY(4px);
    box-shadow: none;
}

.small-btn {
    padding: 10px 20px;
    font-size: 0.9rem;
}

/* -------------------- Settings Screen -------------------- */
.setting-group {
    background: rgba(255,255,255,0.7);
    padding: 20px;
    border-radius: 15px;
    width: 100%;
    margin-bottom: 20px;
}

.setting-group h3 {
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.color-select {
    display: flex;
    justify-content: space-around;
}

.btn-color {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: white;
    border: 3px solid transparent;
    border-radius: 10px;
    padding: 10px;
    cursor: pointer;
    transition: 0.2s;
}

.btn-color.active {
    border-color: var(--sakura-color);
    background: #FFF0F5;
}

.piece-mock {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    margin-bottom: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.white-mock { background: white url('../img/ichigo.png') center/cover no-repeat; border: 2px solid #ddd; }
.black-mock { background: #333 url('../img/dorakururi.png') center/cover no-repeat; }

.level-select-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

input[type=range] {
    width: 100%;
    margin-bottom: 15px;
}

#level-display {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--wakakusa-dark);
}

/* -------------------- Game Screen -------------------- */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 20px;
    background: rgba(255,255,255,0.8);
    padding: 10px;
    border-radius: 20px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

.score-panel {
    display: flex;
    align-items: center;
    font-size: 1.2rem;
    font-weight: bold;
}

.score-icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    margin-right: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.white-icon { background: white url('../img/ichigo.png') center/cover no-repeat; border: 1px solid #ccc; }
.black-icon { background: #333 url('../img/dorakururi.png') center/cover no-repeat; }

.turn-indicator {
    font-size: 1.1rem;
    font-weight: bold;
    padding: 5px 15px;
    border-radius: 15px;
    background: var(--sakura-color);
    color: white;
}

/* 盤面 */
.board-wrapper {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    width: 100%;
    max-width: 400px;
    aspect-ratio: 1 / 1;
    background-color: var(--wakakusa-color); /* 若草色 */
    border: 4px solid var(--wakakusa-dark);
    border-radius: 10px;
    /* 盤面の不透明度を下げて背後のキャラを見せる */
    background: rgba(184, 208, 135, 0.7); 
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    position: relative;
    z-index: 5;
}

.cell {
    border: 1px solid rgba(0,0,0,0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    position: relative;
}

.cell.valid-move::after {
    content: '';
    width: 20%;
    height: 20%;
    background-color: rgba(255, 183, 197, 0.8); /* 桜色ハイライト */
    border-radius: 50%;
    position: absolute;
}

/* 駒 */
.piece {
    width: 85%;
    height: 85%;
    border-radius: 50%;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    /* デフォルトのアニメーション */
    transition: transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background-size: cover;
    background-position: center;
}

/* 白（いちご大福） */
.piece.white {
    background-color: white;
    background-image: url('../img/ichigo.png');
}

/* 黒（どらくるり） */
.piece.black {
    background-color: #3e2723; /* こげ茶色ベース */
    background-image: url('../img/dorakururi.png');
}

/* 駒が返されるときの大げさなアニメーション用クラス */
.piece.flipping {
    transform: scale(1.3) rotateY(180deg);
}

.game-footer {
    margin-top: 20px;
    width: 100%;
    display: flex;
    justify-content: center;
}

/* -------------------- Particles -------------------- */
.particle {
    position: absolute;
    pointer-events: none;
    z-index: 1;
    animation: fall linear infinite;
}

.sakura-petal {
    background-color: var(--sakura-color);
    width: 10px;
    height: 15px;
    border-radius: 50% 0 50% 0;
    opacity: 0.7;
}

.leaf {
    background-color: var(--wakakusa-color);
    width: 15px;
    height: 10px;
    border-radius: 0 50% 0 50%;
    opacity: 0.7;
}

@keyframes fall {
    0% { transform: translateY(-50px) rotate(0deg); opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { transform: translateY(100vh) rotate(360deg); opacity: 0; }
}
