/* Othello Game Stylesheet - Responsive */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: 'Segoe UI', 'Meiryo', sans-serif;
    background: #1a1a2e;
    color: #eee;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}
.container { text-align: center; width: 100%; max-width: 480px; padding: 0 8px; }
h1 { margin-bottom: 16px; font-size: 32px; letter-spacing: 0.1em; }
.controls {
    margin-bottom: 12px;
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
}
.controls .label { margin-right: 4px; font-size: 15px; color: #aaa; }
.controls button {
    padding: 6px 18px;
    border: 2px solid #444;
    background: #2a2a4a;
    color: #ccc;
    cursor: pointer;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s;
}
.controls button:hover { background: #3a3a6a; color: #fff; }
.controls button.active {
    border-color: #4CAF50;
    background: #2e4a2e;
    color: #fff;
}
.info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding: 10px 12px;
    background: #2a2a4a;
    border-radius: 6px;
    width: 100%;
}
.scores { display: flex; gap: 28px; font-size: 17px; }
.scores span { display: flex; align-items: center; gap: 6px; }
.disc-icon {
    width: 18px; height: 18px;
    border-radius: 50%;
    display: inline-block;
}
.disc-icon.black { background: #222; border: 2px solid #666; }
.disc-icon.white { background: #eee; border: 2px solid #bbb; }
#status { font-size: 15px; color: #aaa; }
#status.thinking { color: #ffcc00; }
.board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    width: 100%;
    max-width: 460px;
    gap: 2px;
    background: #111;
    padding: 2px;
    border-radius: 4px;
    border: 3px solid #333;
}
.cell {
    aspect-ratio: 1;
    background: #2d8a4e;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    position: relative;
}
.cell:hover { background: #35a55c; }
.cell.valid::after {
    content: '';
    width: 30%; height: 30%;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    position: absolute;
}
/* 初心者用: おすすめの手は中央の丸を大きく明るくして点滅させ、
   丸の中に順位（1・2・3）を出す。1がいちばん有力。 */
.cell.valid.recommended::after {
    content: attr(data-rank);
    width: 50%; height: 50%;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #14321f;
    font-weight: 700;
    font-size: 14px;
    line-height: 1;
    animation: hintBlink 1.1s ease-in-out infinite;
}
/* 数字が読めなくならないよう、薄くなりすぎない点滅にする */
@keyframes hintBlink {
    0%, 100% { opacity: 1;    transform: scale(1); }
    50%      { opacity: 0.45; transform: scale(0.82); }
}
/* 画面の点滅が苦手な人のために、OSの設定に従って動きを止める */
@media (prefers-reduced-motion: reduce) {
    .cell.valid.recommended::after { animation: none; }
}

/* 学習用: いまCOM（白）が打てる場所を破線の枠で示す。
   自分も打てるマスでは、中央の白丸と枠が同時に出て両方わかる。 */
.cell.opp-valid::before {
    content: '';
    position: absolute;
    top: 7%; left: 7%; right: 7%; bottom: 7%;
    border: 2px dashed rgba(255, 150, 80, 0.85);
    border-radius: 4px;
    pointer-events: none;
}
.disc {
    width: 80%; height: 80%;
    border-radius: 50%;
}
.disc.black {
    background: radial-gradient(circle at 35% 35%, #555, #111);
    box-shadow: 1px 2px 4px rgba(0,0,0,0.5);
}
.disc.white {
    background: radial-gradient(circle at 35% 35%, #fff, #ccc);
    box-shadow: 1px 2px 4px rgba(0,0,0,0.3);
}
.disc.flip {
    animation: flipAnim 0.45s ease-in-out;
}
@keyframes flipAnim {
    0%   { transform: rotateY(0deg); }
    50%  { transform: rotateY(90deg); }
    100% { transform: rotateY(0deg); }
}
.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    justify-content: center;
    margin-top: 10px;
    font-size: 13px;
    color: #aaa;
}
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-mark {
    width: 18px; height: 18px;
    display: inline-block;
    background: #2d8a4e;
    border-radius: 3px;
    position: relative;
    flex-shrink: 0;
}
.legend-mark.mine::after {
    content: '';
    position: absolute;
    top: 35%; left: 35%;
    width: 30%; height: 30%;
    background: rgba(255, 255, 255, 0.55);
    border-radius: 50%;
}
.legend-mark.rec::after {
    content: '1';
    position: absolute;
    top: 25%; left: 25%;
    width: 50%; height: 50%;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #14321f;
    font-weight: 700;
    font-size: 9px;
    line-height: 1;
    animation: hintBlink 1.1s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
    .legend-mark.rec::after { animation: none; }
}
.legend-mark.opp::before {
    content: '';
    position: absolute;
    top: 7%; left: 7%; right: 7%; bottom: 7%;
    border: 2px dashed rgba(255, 150, 80, 0.85);
    border-radius: 3px;
}
.legend #oppCount { color: #ff9650; }
.game-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 16px;
}
#undoBtn {
    padding: 10px 28px;
    background: #e6a817;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
}
#undoBtn:hover { background: #c89015; }
#newGameBtn {
    padding: 10px 28px;
    background: #4CAF50;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
}
#newGameBtn:hover { background: #45a049; }
@media (max-width: 430px) {
    .cell.valid.recommended::after { font-size: 11px; }
    .container { padding: 0 4px; }
    h1 { font-size: 22px; margin-bottom: 10px; }
    .controls button { padding: 6px 12px; font-size: 13px; }
    .scores { gap: 16px; font-size: 14px; }
    #status { font-size: 13px; }
    #undoBtn, #newGameBtn {
        padding: 10px 20px;
        font-size: 15px;
        min-height: 44px;
    }
}
