@charset "utf-8";
body {
	font-family: "ヒラギノ丸ゴ Pro W4","ヒラギノ丸ゴ Pro","Hiragino Maru Gothic Pro","ヒラギノ角ゴ Pro W3","Hiragino Kaku Gothic Pro","HG丸ｺﾞｼｯｸM-PRO","HGMaruGothicMPRO";
}
/* 共通スタイル */
.games-wrapper {
    max-width: 900px;
    margin: 0 auto;
}

.page-title {
    text-align: center;
    color: #333;
    margin: 1em 0;
    font-size: 2.0em;
}

/* ゲーム選択メニュー */
.game-menu {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 40px;
    flex-wrap: nowrap;
}

.game-menu-btn {
    padding: 12px 20px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: bold;
	font-family: "ヒラギノ丸ゴ Pro W4","ヒラギノ丸ゴ Pro","Hiragino Maru Gothic Pro","ヒラギノ角ゴ Pro W3","Hiragino Kaku Gothic Pro","HG丸ｺﾞｼｯｸM-PRO","HGMaruGothicMPRO";
}

.game-menu-btn:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
}

.game-menu-btn.active {
    background: #667eea;
    color: white;
}

/* ゲームセクション共通 */
.game-section {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.game-title {
    text-align: center;
    color: #667eea;
    margin-bottom: 20px;
    font-size: 2em;
}

.game-subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 20px;
    font-size: 1.1em;
	font-weight: bold;
}

/* 統計表示 */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.stat-box {
    background: white;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.stat-label {
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
    text-transform: uppercase;
}

.stat-value {
    font-size: 24px;
    font-weight: bold;
    color: #667eea;
}

/* ボタン共通 */
.buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
}

button {
    padding: 12px 25px;
    font-size: 16px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: bold;
}

.start-btn {
    background: #28a745;
    color: white;
}

.start-btn:hover {
    background: #218838;
    transform: scale(1.05);
}

.start-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: scale(1);
}

.reset-btn {
    background: #dc3545;
    color: white;
}

.reset-btn:hover {
    background: #c82333;
    transform: scale(1.05);
}

.next-btn {
    background: #007bff;
    color: white;
}

.next-btn:hover {
    background: #0056b3;
}

.next-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* 結果表示 */
.result {
    background: #d4edda;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    margin-top: 20px;
    display: none;
    border: 3px solid #28a745;
}

.result h4 {
    color: #155724;
    margin-bottom: 15px;
    font-size: 1.8em;
}

.result-text {
    font-size: 16px;
    color: #155724;
    line-height: 1.8;
}

.result-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin-top: 15px;
}

.result-item {
    background: white;
    padding: 10px;
    border-radius: 8px;
    font-size: 14px;
}

/* === タイピングゲーム === */
.level-select {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.level-btn {
    padding: 10px 20px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.level-btn:hover {
    background: #667eea;
    color: white;
}

.level-btn.active {
    background: #667eea;
    color: white;
}

.word-display {
    background: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    margin-bottom: 20px;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.target-word {
    font-size: 2em;
    font-weight: bold;
    letter-spacing: 5px;
    color: #333;
}

.target-word .correct {
    color: #28a745;
}

.target-word .incorrect {
    color: #dc3545;
}

.input-area {
    margin-bottom: 20px;
}

#typing-input {
    width: 100%;
    padding: 15px;
    font-size: 18px;
    border: 2px solid #ddd;
    border-radius: 10px;
    text-align: center;
    letter-spacing: 3px;
	font-family: "ヒラギノ丸ゴ Pro W4","ヒラギノ丸ゴ Pro","Hiragino Maru Gothic Pro","ヒラギノ角ゴ Pro W3","Hiragino Kaku Gothic Pro","HG丸ｺﾞｼｯｸM-PRO","HGMaruGothicMPRO";

}

#typing-input:focus {
    outline: none;
    border-color: #667eea;
}

/* === 神経衰弱ゲーム === */
.memory-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 25px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.memory-card {
    aspect-ratio: 1;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.5em;
    cursor: pointer;
    transition: all 0.3s;
}

.memory-card:hover {
    transform: scale(1.05);
}

.memory-card.flipped {
    background: white;
    border: 3px solid #f5576c;
}

.memory-card.matched {
    background: #d4edda;
    border: 3px solid #28a745;
    cursor: default;
}

.memory-card.matched:hover {
    transform: scale(1);
}

.card-back {
    font-size: 0.8em;
    color: white;
}

.card-front {
    display: none;
}

.memory-card.flipped .card-back {
    display: none;
}

.memory-card.flipped .card-front {
    display: block;
}

.memory-card.matched .card-back {
    display: none;
}

.memory-card.matched .card-front {
    display: block;
    opacity: 0.7;
}

/* === クイズアプリ === */
.quiz-intro {
    text-align: center;
    color: #666;
    margin-bottom: 25px;
    font-size: 1.1em;
    line-height: 1.6;
	font-weight: bold;
}

.quiz-screen {
    display: none;
}

.progress {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding: 15px;
    background: white;
    border-radius: 10px;
    gap: 15px;
}

.question-number {
    font-size: 16px;
    font-weight: bold;
    color: #4facfe;
    white-space: nowrap;
}

.score-display {
    font-size: 16px;
    font-weight: bold;
    color: #28a745;
    white-space: nowrap;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: #e0e0e0;
    border-radius: 5px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4facfe 0%, #00f2fe 100%);
    transition: width 0.3s;
    width: 0;
}

.question-card {
    background: white;
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 20px;
}

.category {
    display: inline-block;
    background: #4facfe;
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 13px;
    margin-bottom: 15px;
}

.question {
    font-size: 1.3em;
    color: #333;
    line-height: 1.5;
    font-weight: bold;
}

.options {
    display: grid;
    gap: 12px;
    margin-bottom: 20px;
}

.option {
    background: white;
    border: 3px solid #e0e0e0;
    padding: 15px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1em;
}

.option:hover {
    border-color: #4facfe;
    transform: translateX(5px);
}

.option.selected {
    border-color: #4facfe;
    background: #e3f2fd;
}

.option.correct {
    border-color: #28a745;
    background: #d4edda;
}

.option.incorrect {
    border-color: #dc3545;
    background: #f8d7da;
}

.option.disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.quiz-result-screen {
    display: none;
    text-align: center;
}

.final-score {
    font-size: 3em;
    font-weight: bold;
    color: #4facfe;
    margin: 20px 0;
}

.result-message {
    font-size: 1.3em;
    color: #666;
    margin-bottom: 25px;
}

.result-stats-grid {
    background: white;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 25px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #e0e0e0;
}

.stat-item:last-child {
    border-bottom: none;
}

/* === 色当てゲーム === */
.mode-select {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 25px;
}

.mode-btn {
    padding: 10px 20px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    font-weight: bold;
}

.mode-btn:hover {
    background: #667eea;
    color: white;
}

.mode-btn.active {
    background: #667eea;
    color: white;
}

.color-display {
    width: 100%;
    height: 200px;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.color-question {
    text-align: center;
    font-size: 1.2em;
    color: #333;
    margin-bottom: 20px;
    font-weight: bold;
}

.color-options .option {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    text-align: center;
}

/* === リアクションゲーム === */
.reaction-area {
    width: 100%;
    height: 300px;
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 20px;
}

.reaction-area.start {
    background: #6c757d;
}

.reaction-area.waiting {
    background: #dc3545;
}

.reaction-area.ready {
    background: #28a745;
}

.reaction-area.result {
    background: #007bff;
}

.reaction-message {
    color: white;
    font-size: 2em;
    font-weight: bold;
    text-align: center;
    margin-bottom: 10px;
}

.reaction-instruction {
    color: rgba(255,255,255,0.9);
    font-size: 1.1em;
    text-align: center;
}

.time-display {
    font-size: 3em;
    color: white;
    font-weight: bold;
}

.attempts-list {
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.attempts-title {
    font-size: 1.2em;
    font-weight: bold;
    color: #333;
    margin-bottom: 15px;
    text-align: center;
}

.attempt-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 8px;
    border-left: 4px solid #1e3c72;
}

.attempt-item.best {
    border-left-color: #28a745;
    background: #d4edda;
}

.attempt-number {
    font-weight: bold;
    color: #666;
}

.attempt-time {
    font-weight: bold;
    color: #1e3c72;
    font-size: 1.2em;
}

.attempt-item.best .attempt-time {
    color: #28a745;
}

/* === パズルゲーム (2048) === */
.puzzle-instructions {
    background: white;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: center;
    font-size: 14px;
    color: #666;
	font-weight: bold;
}

.puzzle-board {
    background: #bbada0;
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 20px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
    position: relative;
}

.puzzle-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.puzzle-cell {
    aspect-ratio: 1;
    background: #cdc1b4;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.8em;
    font-weight: bold;
    position: relative;
}

.puzzle-tile {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 8px;
    transition: all 0.15s ease-in-out;
    font-weight: bold;
}

.tile-2 { background: #eee4da; color: #776e65; }
.tile-4 { background: #ede0c8; color: #776e65; }
.tile-8 { background: #f2b179; color: #f9f6f2; }
.tile-16 { background: #f59563; color: #f9f6f2; }
.tile-32 { background: #f67c5f; color: #f9f6f2; }
.tile-64 { background: #f65e3b; color: #f9f6f2; }
.tile-128 { background: #edcf72; color: #f9f6f2; font-size: 0.9em; }
.tile-256 { background: #edcc61; color: #f9f6f2; font-size: 0.9em; }
.tile-512 { background: #edc850; color: #f9f6f2; font-size: 0.9em; }
.tile-1024 { background: #edc53f; color: #f9f6f2; font-size: 0.8em; }
.tile-2048 { background: #edc22e; color: #f9f6f2; font-size: 0.8em; }
.tile-super { background: #3c3a32; color: #f9f6f2; font-size: 0.7em; }

.game-over {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(238, 228, 218, 0.95);
padding: 30px;
    border-radius: 15px;
    text-align: center;
    display: none;
    z-index: 100;
    min-width: 250px;
}

.game-over.show {
    display: block;
}

.game-over h4 {
    color: #776e65;
    font-size: 1.8em;
    margin-bottom: 15px;
}

.game-over p {
    color: #776e65;
    font-size: 1.1em;
    margin-bottom: 20px;
}

/* --- チャットエリア (追加・修正部分) --- */
        .chat-area {
            margin-top: 40px;
            padding: 30px 20px;
            background: #ffffff; 
            border-top: 2px solid #eee;
            border-radius: 20px;
            max-width: 100%; /* 親要素(main)に合わせる */
        }
        .chat-message {
            display: flex;
            align-items: flex-end;
            margin-bottom: 20px;
        }
        .page-title2 {
			text-align: center;
			margin-bottom: 1.5em;
		}
        .chat-message.user {
            justify-content: flex-end;
        }
        
        .chat-message.ai {
            justify-content: flex-start;
        }
        
        .avatar {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            display: flex;
            justify-content: center;
            align-items: center;
            font-weight: bold;
            font-size: 16px;
            flex-shrink: 0;
        }
        
        .user-avatar {
            background-color: #667eea;
            color: white;
            margin-left: 10px;
        }
        
        .ai-avatar {
            background-color: #28a745;
            color: white;
            margin-right: 10px;
        }
        
        .bubble {
            max-width: 70%; /* デスクトップではもう少し狭く */
            padding: 12px 18px;
            border-radius: 20px;
            line-height: 1.6;
            word-wrap: break-word;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
        }
        
        .chat-message.user .bubble {
            background-color: #667eea;
            color: white;
            border-bottom-right-radius: 5px;
        }
        
        .chat-message.ai .bubble {
            background-color: #f0f0f0;
            color: #333;
            border-bottom-left-radius: 5px;
            text-align: left;
        }
