/* ===========================
   グローバルスタイル
   =========================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 30px;
    max-width: 1200px;
    width: 100%;
}

/* ===========================
   ヘッダー
   =========================== */
header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    color: #333;
    font-size: 2.5em;
    margin-bottom: 5px;
}

.subtitle {
    color: #666;
    font-size: 0.9em;
}

/* ===========================
   ゲームコンテナ
   =========================== */
.game-container {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
    justify-content: center;
}

/* ===========================
   コントロールパネル
   =========================== */
.control-panel {
    flex: 1;
    min-width: 280px;
    max-width: 350px;
}

.score-board {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.score-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    margin-bottom: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.score-item:last-child {
    margin-bottom: 0;
}

.score-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #ddd;
}

.score-icon.black {
    background: radial-gradient(circle at 30% 30%, #444, #000);
}

.score-icon.white {
    background: radial-gradient(circle at 30% 30%, #fff, #ddd);
}

.score-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.score-label {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 3px;
}

.score-value {
    font-size: 1.8em;
    font-weight: bold;
    color: #333;
}

/* ===========================
   ゲームステータス
   =========================== */
.game-status {
    background: #e3f2fd;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
}

#statusMessage {
    font-size: 1.1em;
    font-weight: bold;
    color: #1976d2;
    margin-bottom: 5px;
}

.thinking-message {
    font-size: 0.9em;
    color: #666;
    min-height: 20px;
}

/* ===========================
   難易度セレクター
   =========================== */
.difficulty-selector {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
}

.difficulty-selector label {
    display: block;
    font-weight: bold;
    color: #333;
    margin-bottom: 8px;
}

.difficulty-selector select {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 1em;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s;
}

.difficulty-selector select:hover {
    border-color: #667eea;
}

.difficulty-selector select:focus {
    outline: none;
    border-color: #667eea;
}

/* ===========================
   ボタン
   =========================== */
.button-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #e0e0e0;
    color: #333;
}

.btn-secondary:hover {
    background: #d0d0d0;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===========================
   設定
   =========================== */
.settings {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 15px;
}

.settings label {
    display: block;
    margin-bottom: 10px;
    cursor: pointer;
    color: #333;
}

.settings label:last-child {
    margin-bottom: 0;
}

.settings input[type="checkbox"] {
    margin-right: 8px;
    cursor: pointer;
}

/* ===========================
   オセロ盤面
   =========================== */
.board-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 2px;
    background: #2d5016;
    padding: 10px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    width: 480px;
    height: 480px;
}

.cell {
    background: #3d7028;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.2s;
    position: relative;
}

.cell:hover {
    background: #4d8038;
}

.cell.valid-move {
    background: #5da048;
    cursor: pointer;
}

.cell.valid-move::after {
    content: '';
    width: 30%;
    height: 30%;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    position: absolute;
}

.cell.hint-highlight {
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% {
        background: #5da048;
    }
    50% {
        background: #7dc05f;
    }
}

/* ===========================
   石
   =========================== */
.stone {
    width: 85%;
    height: 85%;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    position: relative;
}

.stone.black {
    background: radial-gradient(circle at 30% 30%, #444, #000);
}

.stone.white {
    background: radial-gradient(circle at 30% 30%, #fff, #ddd);
}

.stone.flipping {
    animation: flip 0.6s ease-in-out;
}

@keyframes flip {
    0% { transform: rotateY(0deg); }
    50% { transform: rotateY(90deg); }
    100% { transform: rotateY(180deg); }
}

.stone.placing {
    animation: place 0.3s ease-out;
}

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

/* ===========================
   モーダル
   =========================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.show {
    display: flex;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    max-width: 400px;
    animation: slideUp 0.3s;
}

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

.modal-content h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 2em;
}

.modal-content p {
    color: #666;
    margin-bottom: 20px;
    font-size: 1.1em;
}

.final-score {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 30px;
}

.final-score-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.final-score-item span {
    font-size: 2em;
    font-weight: bold;
    color: #333;
}

/* ===========================
   フッター
   =========================== */
footer {
    margin-top: 30px;
    text-align: center;
    color: #666;
    font-size: 0.9em;
}

footer p {
    margin: 5px 0;
}

/* ===========================
   レスポンシブデザイン
   =========================== */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    header h1 {
        font-size: 1.8em;
    }

    .game-container {
        flex-direction: column;
    }

    .control-panel {
        max-width: 100%;
        order: 2; /* 盤面を上に */
    }
    
    .board-container {
        order: 1; /* 盤面を上に */
        margin-bottom: 20px;
    }

    .board {
        width: 100%;
        max-width: 400px;
        height: auto;
        aspect-ratio: 1;
    }

    .button-group {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
    }

    .btn {
        flex: 1;
        min-width: 120px;
        padding: 10px 15px;
        font-size: 0.9em;
    }
    
    /* タッチ対応の改善 */
    .cell {
        min-height: 40px;
    }
    
    /* スコアボードを見やすく */
    .score-board {
        margin-bottom: 15px;
    }
}

