/* 基本スタイル */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

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

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
}

/* ヘッダー */
header {
    text-align: center;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 2.5rem;
    color: #4a5568;
    margin-bottom: 10px;
}

header p {
    color: #718096;
    font-size: 1.1rem;
}

/* メインコンテンツ */
main {
    display: grid;
    gap: 25px;
}

/* ゲーム盤 */
.game-board {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.guess-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
}

.guess-row {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.letter-cell {
    width: 50px;
    height: 50px;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    transition: all 0.3s ease;
}

.letter-cell.correct {
    background: #10b981;
    color: white;
    border-color: #10b981;
}

.letter-cell.present {
    background: #f59e0b;
    color: white;
    border-color: #f59e0b;
}

.letter-cell.absent {
    background: #6b7280;
    color: white;
    border-color: #6b7280;
}

/* 入力セクション */
.input-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.word-input {
    margin-bottom: 20px;
}

.word-input label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #4a5568;
}

.word-input input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1.2rem;
    text-align: center;
    transition: border-color 0.3s ease;
}

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

.pattern-input {
    margin-bottom: 25px;
}

.pattern-input label {
    display: block;
    margin-bottom: 12px;
    font-weight: 600;
    color: #4a5568;
}

.pattern-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.pattern-btn {
    width: 50px;
    height: 50px;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    font-size: 1.5rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pattern-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.pattern-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.pattern-btn.absent {
    background: #6b7280;
    color: white;
    border-color: #6b7280;
}

.pattern-btn.present {
    background: #f59e0b;
    color: white;
    border-color: #f59e0b;
}

.pattern-btn.correct {
    background: #10b981;
    color: white;
    border-color: #10b981;
}

.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a6fd8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-warning {
    background: #e5e7eb;
    color: #374151;
}

.btn-warning:hover {
    background: #d1d5db;
    color: #1f2937;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(156, 163, 175, 0.3);
}

.btn-secondary {
    background: #e5e7eb;
    color: #374151;
}

.btn-secondary:hover {
    background: #d1d5db;
    color: #1f2937;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(156, 163, 175, 0.3);
}

/* 推奨候補セクション */
.recommendations {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    transition: opacity 0.3s ease;
}

.recommendations.calculating {
    opacity: 0.3;
    pointer-events: none;
    filter: blur(1px);
}

.recommendations h2 {
    margin-bottom: 20px;
    color: #4a5568;
    text-align: center;
}

.best-guess {
    margin-bottom: 20px;
}

.guess-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-radius: 12px;
    border: 2px solid #e2e8f0;
    transition: all 0.3s ease;
}

.guess-card.featured {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-color: transparent;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
}

.guess-card .word {
    font-size: 1.3rem;
    font-weight: bold;
}

.guess-card .score {
    font-size: 1.1rem;
    opacity: 0.9;
}

.advanced-options {
    margin-top: 15px;
}

.advanced-options summary {
    cursor: pointer;
    padding: 10px 0;
    color: #667eea;
    font-weight: 600;
}

.candidates-list {
    display: grid;
    gap: 10px;
    margin-top: 15px;
}

/* 統計情報 */
.stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.stat-label {
    display: block;
    color: #718096;
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.stat-value {
    display: block;
    color: #4a5568;
    font-size: 2rem;
    font-weight: bold;
}

/* 設定パネル */
.settings-panel {
    position: fixed;
    top: 20px;
    right: -300px;
    width: 280px;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transition: right 0.3s ease;
    z-index: 1000;
}

.settings-panel.open {
    right: 20px;
}

.settings-panel h3 {
    margin-bottom: 20px;
    color: #4a5568;
}

.settings-panel label {
    display: block;
    margin-bottom: 15px;
    color: #4a5568;
    cursor: pointer;
}

.settings-panel input[type="checkbox"] {
    margin-right: 10px;
}

.settings-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    z-index: 1001;
}

.settings-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

/* ローディング */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    color: white;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-overlay p {
    font-size: 1.2rem;
}

/* インライン計算中インジケーター */
.inline-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(102, 126, 234, 0.1);
    border: 2px solid #667eea;
    border-radius: 15px;
    padding: 15px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
    margin-top: 15px;
    color: #667eea;
    font-weight: 600;
}

.inline-spinner .spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

input:disabled {
    opacity: 0.5;
    background-color: #f7fafc;
    cursor: not-allowed;
}

/* レスポンシブ対応 */
@media (max-width: 600px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .letter-cell, .pattern-btn {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
    
    .stats {
        grid-template-columns: 1fr;
    }
    
    .settings-panel {
        width: calc(100% - 40px);
        right: -100%;
    }
    
    .settings-panel.open {
        right: 20px;
    }
}
