/* リセットとベースレイアウト */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ヘッダー */
header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* コントロールエリア */
.controls {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    margin-bottom: 30px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    align-items: end;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-group label {
    font-weight: 600;
    color: #444;
    font-size: 0.9rem;
}

.control-group select,
.control-group input {
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.control-group select:focus,
.control-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.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: #f8f9fa;
    color: #495057;
    border: 2px solid #e9ecef;
}

.btn-secondary:hover {
    background: #e9ecef;
    transform: translateY(-1px);
}

/* ボードセクション */
.board-section {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    margin-bottom: 30px;
}

.board-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 20px;
}

.team-counts {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.count {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    padding: 8px 15px;
    background: #f8f9fa;
    border-radius: 20px;
}

.color-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(0,0,0,0.1);
}

.color-dot.red { background-color: #dc3545; }
.color-dot.blue { background-color: #0d6efd; }
.color-dot.neutral { background-color: #ffc107; }
.color-dot.assassin { background-color: #212529; }

.current-seed {
    font-family: 'Courier New', monospace;
    background: #e9ecef;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 0.9rem;
}

.game-results {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.result-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 15px;
    background: #f0f8ff;
    border: 2px solid #667eea;
    border-radius: 20px;
    font-weight: 600;
}

.result-label {
    color: #667eea;
    font-size: 0.9rem;
}

.result-value {
    color: #333;
    font-weight: 700;
}

.result-value.red {
    color: #dc3545;
}

.result-value.blue {
    color: #0d6efd;
}

/* ゲームボード */
.game-board {
    display: grid;
    gap: 8px;
    max-width: 500px;
    margin: 0 auto;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
}

.game-board.size-3 {
    grid-template-columns: repeat(3, 1fr);
}

.game-board.size-4 {
    grid-template-columns: repeat(4, 1fr);
}

.game-board.size-5 {
    grid-template-columns: repeat(5, 1fr);
}

.board-cell {
    aspect-ratio: 1;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.8rem;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 3px solid transparent;
}

.board-cell:hover {
    transform: scale(1.05);
    border-color: rgba(255,255,255,0.8);
}

.board-cell.red {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
}

.board-cell.blue {
    background: linear-gradient(135deg, #0d6efd 0%, #0b5ed7 100%);
}

.board-cell.neutral {
    background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%);
    color: #333;
    text-shadow: none;
}

.board-cell.assassin {
    background: linear-gradient(135deg, #212529 0%, #000 100%);
}

/* 説明セクション */
.instructions {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.instructions h3 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.3rem;
}

.instructions ul {
    list-style: none;
    padding-left: 0;
}

.instructions li {
    margin-bottom: 12px;
    padding-left: 20px;
    position: relative;
}

.instructions li::before {
    content: "•";
    color: #667eea;
    font-weight: bold;
    position: absolute;
    left: 0;
}

.instructions ul ul {
    margin-top: 10px;
    padding-left: 20px;
}

.color-demo {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 3px;
    vertical-align: middle;
    margin-right: 8px;
    border: 1px solid rgba(0,0,0,0.2);
}

.color-demo.red { background-color: #dc3545; }
.color-demo.blue { background-color: #0d6efd; }
.color-demo.neutral { background-color: #ffc107; }
.color-demo.assassin { background-color: #212529; }

/* レスポンシブデザイン */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .controls {
        grid-template-columns: 1fr 1fr;
        padding: 20px;
        gap: 15px;
    }
    
    .board-info {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .team-counts {
        justify-content: center;
        width: 100%;
    }
    
    .game-board {
        gap: 6px;
        padding: 15px;
    }
    
    .board-cell {
        font-size: 0.7rem;
    }
    
    .btn {
        flex: 1;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.8rem;
    }
    
    .controls {
        grid-template-columns: 1fr;
        padding: 15px;
        gap: 15px;
    }
    
    .team-counts {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .count {
        font-size: 0.9rem;
        padding: 6px 12px;
    }
    
    .game-board {
        gap: 4px;
        padding: 10px;
    }
}

/* アニメーション */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.board-cell {
    animation: fadeIn 0.5s ease forwards;
}

.board-cell:nth-child(n) {
    animation-delay: calc(var(--index) * 0.05s);
}