/* ───────────────────────────────────────────────────────────────
   nine_mens_morris.css : ナイン・メンズ・モリス
   scope: .game-nmm
   ─────────────────────────────────────────────────────────────── */

.game-nmm {
    --nmm-board-bg: #d4a574;
    --nmm-board-bg-2: #b08454;
    --nmm-line: #4a3018;
    --nmm-empty: rgba(74, 48, 24, 0.18);
    --nmm-white: #f5f5f5;
    --nmm-black: #1a1a1a;
    --nmm-highlight: #ffd700;
    --nmm-target: #4caf50;
    --nmm-removal: #f44336;
}

.game-nmm .board.board-nmm {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-template-rows: repeat(7, 1fr);
    aspect-ratio: 1;
    width: var(--board-max);
    max-width: 100%;
    background: var(--nmm-board-bg);
    background-image:
        /* 外側の正方形 */
        linear-gradient(to right, transparent calc((1 / 14) * 100%), var(--nmm-line) calc((1 / 14) * 100%), var(--nmm-line) calc((1 / 14) * 100% + 3px), transparent calc((1 / 14) * 100% + 3px)),
        linear-gradient(to right, transparent calc((13 / 14) * 100%), var(--nmm-line) calc((13 / 14) * 100%), var(--nmm-line) calc((13 / 14) * 100% + 3px), transparent calc((13 / 14) * 100% + 3px)),
        linear-gradient(to bottom, transparent calc((1 / 14) * 100%), var(--nmm-line) calc((1 / 14) * 100%), var(--nmm-line) calc((1 / 14) * 100% + 3px), transparent calc((1 / 14) * 100% + 3px)),
        linear-gradient(to bottom, transparent calc((13 / 14) * 100%), var(--nmm-line) calc((13 / 14) * 100%), var(--nmm-line) calc((13 / 14) * 100% + 3px), transparent calc((13 / 14) * 100% + 3px));
    border: 4px solid var(--nmm-line);
    border-radius: var(--r-lg);
    padding: 0;
    box-shadow:
        var(--sh-md),
        inset 0 2px 6px rgba(0, 0, 0, 0.25);
    margin: 0 auto;
    align-self: center;
    position: relative;
    overflow: hidden;
}

/* 線の描画は positions の position: relative + 線オーバーレイで擬似的に描く。
   シンプルにするため SVG に頼らず CSS グリッドでマス配置のみ表現し、
   線描画は擬似要素で各マス外周のラインを描く。 */
.game-nmm .board.board-nmm::before,
.game-nmm .board.board-nmm::after {
    content: "";
    position: absolute;
    pointer-events: none;
}

/* 中央の連結線を簡易表現: 縦と横の十字 */
.game-nmm .board.board-nmm::before {
    /* 縦の中央線（外周の上中点 - 内側の上中点） */
    top: 0;
    bottom: 0;
    left: 50%;
    width: 3px;
    background: var(--nmm-line);
    transform: translateX(-50%);
    /* 中央 (row 3, col 3) は何もないので、線を中央付近で消す */
    clip-path: polygon(
        0 0, 100% 0, 100% calc(43%),
        0 calc(43%), 0 calc(57%),
        100% calc(57%), 100% 100%, 0 100%
    );
}

.game-nmm .board.board-nmm::after {
    top: 50%;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--nmm-line);
    transform: translateY(-50%);
    clip-path: polygon(
        0 0, calc(43%) 0, calc(43%) 100%,
        0 100%, 0 0,
        calc(57%) 0, 100% 0, 100% 100%, calc(57%) 100%
    );
}

.game-nmm .nmm-pos {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
    cursor: default;
    transition: background 0.12s ease;
}

/* ── 穴（空きマス） ── */
.game-nmm .nmm-pos.empty .nmm-dot {
    width: 65%;
    height: 65%;
    max-width: 42px;
    max-height: 42px;
    border-radius: 50%;
    background: radial-gradient(
        circle at 40% 35%,
        #2a1a08 0%,
        #160d03 55%,
        #0e0803 100%
    );
    box-shadow:
        inset 2px 3px 10px rgba(0, 0, 0, 0.95),
        inset 0 0 6px rgba(0, 0, 0, 0.7),
        0 1px 2px rgba(210, 165, 95, 0.55);
    border: 1px solid rgba(0, 0, 0, 0.45);
    transition: all 0.12s ease;
}

/* ── 駒（ボール） ── */
.game-nmm .nmm-pos .nmm-piece {
    width: 70%;
    height: 70%;
    max-width: 44px;
    max-height: 44px;
    border-radius: 50%;
    animation: nmm-place 0.3s var(--ease-pop);
}

.game-nmm .nmm-pos.white .nmm-piece {
    background:
        radial-gradient(circle at 33% 27%, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0) 36%),
        radial-gradient(circle at 62% 68%, rgba(160, 160, 160, 0.35) 0%, rgba(160, 160, 160, 0) 38%),
        radial-gradient(circle at 50% 50%, #eeeeee 0%, #aaaaaa 100%);
    box-shadow:
        0 5px 16px rgba(0, 0, 0, 0.4),
        0 2px 4px rgba(0, 0, 0, 0.25),
        inset 0 -5px 10px rgba(0, 0, 0, 0.18),
        inset 0 3px 5px rgba(255, 255, 255, 0.95);
}

.game-nmm .nmm-pos.black .nmm-piece {
    background:
        radial-gradient(circle at 33% 27%, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 36%),
        radial-gradient(circle at 62% 68%, rgba(90, 90, 90, 0.2) 0%, rgba(90, 90, 90, 0) 35%),
        radial-gradient(circle at 50% 50%, #484848 0%, #070707 100%);
    box-shadow:
        0 5px 16px rgba(0, 0, 0, 0.7),
        0 2px 4px rgba(0, 0, 0, 0.5),
        inset 0 -5px 10px rgba(0, 0, 0, 0.5),
        inset 0 3px 5px rgba(255, 255, 255, 0.18);
}

@keyframes nmm-place {
    0% {
        opacity: 0;
        transform: scale(0.4);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.game-nmm .nmm-pos.selected::after {
    content: "";
    position: absolute;
    inset: 6%;
    border-radius: 50%;
    border: 3px solid var(--nmm-highlight);
    box-shadow: 0 0 8px var(--nmm-highlight);
}

/* ── 移動先（穴が緑に光る） ── */
.game-nmm .nmm-pos.destination .nmm-dot {
    width: 65%;
    height: 65%;
    max-width: 42px;
    max-height: 42px;
    background: radial-gradient(
        circle at 40% 35%,
        rgba(50, 140, 60, 0.85) 0%,
        rgba(20, 90, 30, 0.95) 60%,
        rgba(10, 55, 18, 0.9) 100%
    );
    box-shadow:
        inset 2px 3px 10px rgba(0, 0, 0, 0.6),
        0 0 10px rgba(76, 175, 80, 0.65),
        0 1px 2px rgba(76, 175, 80, 0.45);
    border: 1px solid rgba(76, 175, 80, 0.5);
    cursor: pointer;
}

.game-nmm .nmm-pos.destination:hover .nmm-dot {
    background: radial-gradient(
        circle at 40% 35%,
        rgba(80, 200, 90, 0.9) 0%,
        rgba(30, 130, 45, 0.95) 60%,
        rgba(15, 80, 25, 0.9) 100%
    );
    box-shadow:
        inset 2px 3px 10px rgba(0, 0, 0, 0.5),
        0 0 14px rgba(76, 175, 80, 0.85),
        0 1px 2px rgba(76, 175, 80, 0.6);
}

.game-nmm .nmm-pos.removal-target::before {
    content: "";
    position: absolute;
    inset: 8%;
    border-radius: 50%;
    border: 3px dashed var(--nmm-removal);
    box-shadow: 0 0 8px var(--nmm-removal);
    animation: nmm-pulse 0.9s ease-in-out infinite alternate;
    cursor: pointer;
}

@keyframes nmm-pulse {
    from { opacity: 0.6; }
    to { opacity: 1.0; transform: scale(1.04); }
}

.game-nmm .nmm-phase {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-bottom: 4px;
}

.game-nmm .nmm-phase-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    opacity: 0.85;
}

.game-nmm .nmm-pending-hint {
    font-size: 13px;
    font-weight: 700;
    color: var(--nmm-removal);
    background: rgba(244, 67, 54, 0.12);
    padding: 4px 12px;
    border-radius: 8px;
}

.game-nmm .you-badge.white {
    background: rgba(245, 245, 245, 0.85);
    color: #1a1a1a;
}

.game-nmm .you-badge.black {
    background: rgba(26, 26, 26, 0.85);
    color: #f5f5f5;
}
