* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 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: 800px;
    width: 100%;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

h1 {
    font-size: 2.5em;
    color: #333;
    margin-bottom: 10px;
    font-weight: 700;
}

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

.controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.control-group label {
    font-weight: 500;
    color: #555;
}

select {
    padding: 8px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s;
}

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

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

.game-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.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: #f0f0f0;
    color: #333;
}

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

.btn-warning {
    background: #ffa726;
    color: white;
}

.btn-warning:hover {
    background: #ff9800;
}

.btn-danger {
    background: #ef5350;
    color: white;
}

.btn-danger:hover {
    background: #e53935;
}

.stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
}

.stat-item span:first-child {
    color: #666;
    font-weight: 500;
}

.stat-item span:last-child {
    color: #333;
    font-weight: 700;
    font-size: 18px;
}

.game-board {
    display: grid;
    gap: 2px;
    background: #ddd;
    padding: 2px;
    border-radius: 10px;
    margin: 0 auto 20px;
    max-width: 500px;
    aspect-ratio: 1;
}

.cell {
    background: white;
    border: 2px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    user-select: none;
    color: #333;
}

.cell:hover:not(.initial) {
    background: #f5f5f5;
    border-color: #667eea;
}

.cell.initial {
    background: #f0f0f0;
    color: #666;
    cursor: default;
}

.cell.error {
    background: #ffebee;
    border-color: #ef5350;
    color: #ef5350;
    animation: shake 0.3s;
}

.cell.hint {
    background: #fff3e0;
    border-color: #ffa726;
    color: #f57c00;
    animation: pulse 0.5s;
}

.cell.complete {
    background: #e8f5e9;
    border-color: #4caf50;
    color: #2e7d32;
    animation: bounce 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.message {
    text-align: center;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.3s;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.message.show {
    opacity: 1;
    background: #f5f5f5;
    color: #333;
}

.rules {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.rules h2 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.3em;
}

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

.rules li {
    padding: 8px 0;
    padding-left: 25px;
    position: relative;
    color: #555;
    line-height: 1.6;
}

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

footer {
    text-align: center;
    color: #999;
    font-size: 14px;
    margin-top: 20px;
}

/* レスポンシブデザイン */
@media (max-width: 600px) {
    .container {
        padding: 20px;
    }
    
    h1 {
        font-size: 2em;
    }
    
    .game-controls {
        gap: 8px;
    }
    
    .btn {
        padding: 8px 15px;
        font-size: 12px;
    }
    
    .cell {
        font-size: 18px;
    }
    
    .stats {
        gap: 20px;
    }
    
    .stat-item {
        font-size: 14px;
    }
    
    .stat-item span:last-child {
        font-size: 16px;
    }
}

@media (max-width: 400px) {
    h1 {
        font-size: 1.5em;
    }
    
    .subtitle {
        font-size: 0.9em;
    }
    
    .cell {
        font-size: 14px;
    }
}