/* デザイン修正 1: フォント、駒の立体感、マーカーの強調、有効マスのハイライト */
body {
    font-family: 'Noto Sans JP', sans-serif;
}

.janken-piece {
    width: 75%; /* 少し大きく */
    height: 75%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    transition: all 0.2s;
    /* 位置調整と影を強調 */
    position: absolute;
    top: 12.5%;
    left: 12.5%;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.player-marker {
    width: 80%;
    height: 80%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: bold;
    border: 4px solid;
    position: absolute;
    top: 10%;
    left: 10%;
    z-index: 100; /* 最前面に */
    background-color: rgba(255, 255, 255, 0.9); /* マーカーの背景を少し透明にして重ねた駒が見えるように */
    box-shadow: 0 0 8px rgba(0,0,0,0.4);
    /* テキストを調整 */
    font-size: 0.9rem; /* W/Bより少し小さく */
    padding: 2px;
}

.stack-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* 重ねる高さを増やし、立体感を出す */
.stack-container .janken-piece {
    top: calc(12.5% - var(--stack-offset, 0) * 5px); /* Y方向のオフセットを減らす */
    left: calc(12.5% - var(--stack-offset, 0) * 5px); /* X方向のオフセットも追加 */
    z-index: var(--stack-offset, 0);
}

.valid-move {
    background-color: rgba(6, 182, 212, 0.3); /* シアン系の色に変更 */
    cursor: pointer;
    transition: background-color 0.1s;
}

.valid-move:hover {
    background-color: rgba(6, 182, 212, 0.5);
}

.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

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

/* AIの思考中を示すローディング表示用 */
.loading-dot {
    animation: dot-flicker 1s infinite;
}

.loading-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes dot-flicker {
    0%, 80%, 100% {
        opacity: 0;
    }
    40% {
        opacity: 1;
    }
}

/* 駒スタック表示用のツールチップ */
.stack-tooltip {
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    white-space: nowrap;
    z-index: 200;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.stack-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
}

.bg-sky-200:hover .stack-tooltip {
    opacity: 1;
}

.stack-tooltip-item {
    display: inline-block;
    margin: 0 4px;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 1rem;
}

/* じゃんけんSVGアイコンのスタイル */
.janken-icon {
    width: 70%;
    height: 70%;
    object-fit: contain;
}

/* 白プレイヤーのSVGは黒色（デフォルト） */
.janken-selector-white .janken-icon {
    filter: brightness(0) saturate(100%);
}

/* 黒プレイヤーのSVGは白色 */
.janken-selector-black .janken-icon {
    filter: brightness(0) saturate(100%) invert(1);
}

/* 勝利・敗北アニメーション */
.game-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    pointer-events: none;
}

/* 勝利時のフラッシュエフェクト */
.victory-flash {
    animation: victoryFlash 1s ease-out;
}

@keyframes victoryFlash {
    0% {
        background-color: rgba(255, 215, 0, 0);
    }
    15% {
        background-color: rgba(255, 215, 0, 0.4);
    }
    30% {
        background-color: rgba(255, 215, 0, 0);
    }
    45% {
        background-color: rgba(255, 215, 0, 0.3);
    }
    60% {
        background-color: rgba(255, 215, 0, 0);
    }
    100% {
        background-color: rgba(255, 215, 0, 0);
    }
}

/* 敗北時のダークオーバーレイ */
.defeat-overlay {
    animation: defeatDarken 1.5s ease-out forwards;
}

@keyframes defeatDarken {
    0% {
        background-color: rgba(0, 0, 0, 0);
    }
    100% {
        background-color: rgba(0, 0, 0, 0.5);
    }
}

/* 紙吹雪パーティクル */
.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    animation: confettiFall linear forwards;
}

@keyframes confettiFall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* ゲーム終了ダイアログ */
.dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.dialog-overlay.show {
    opacity: 1;
}

.dialog-box {
    background: white;
    border-radius: 20px;
    padding: 40px 30px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s ease-in-out;
}

.dialog-overlay.show .dialog-box {
    transform: scale(1);
}

.dialog-emoji {
    font-size: 4rem;
    margin-bottom: 20px;
    animation: bounceIn 0.6s ease-out;
}

@keyframes bounceIn {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

.dialog-message {
    font-size: 1.5rem;
    font-weight: bold;
    color: #334155;
    margin-bottom: 30px;
    line-height: 1.6;
}

.dialog-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dialog-btn {
    padding: 14px 24px;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Noto Sans JP', sans-serif;
}

.dialog-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

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

.dialog-btn-primary {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    color: white;
}

.dialog-btn-primary:hover {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
}

.dialog-btn-secondary {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.dialog-btn-secondary:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
}

.dialog-btn-tertiary {
    background: #e2e8f0;
    color: #475569;
}

.dialog-btn-tertiary:hover {
    background: #cbd5e1;
}
