/* Games section - きれいに書こう！ */

.game-container {
    max-width: 500px;
    margin: 0 auto;
    padding: 1rem;
}

.game-header {
    text-align: center;
    margin-bottom: 1rem;
}

.game-back {
    display: inline-block;
    color: var(--color-text-muted, #64748b);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.game-title {
    font-size: 1.5rem;
    color: #333;
}

/* カテゴリタブ */
.category-tabs {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.tab {
    padding: 0.6rem 1.2rem;
    border: 2px solid var(--color-border, #e2e8f0);
    border-radius: 2rem;
    background: #fff;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.2s;
}

.tab:hover {
    border-color: #667eea;
}

.tab.active {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
}

/* お手本 → コントロールバー */
.control-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    padding: 0.5rem 0.8rem;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.control-bar-left {
    display: flex;
    align-items: baseline;
    gap: 0.3rem;
    min-width: 0;
}

.current-char {
    font-size: 2.2rem;
    font-weight: 700;
    line-height: 1;
    color: #333;
}

.current-reading {
    font-size: 0.85rem;
    color: #667eea;
}

.control-bar-center {
    display: flex;
    gap: 0.5rem;
}

.control-bar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* キャンバス */
.canvas-container {
    display: flex;
    justify-content: center;
    margin-bottom: 0.75rem;
}

/* ゲームオプション - 不要（control-barに統合） */

.option-toggle {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: #555;
    cursor: pointer;
}

.option-toggle input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    accent-color: #667eea;
}

.font-switch {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.font-btn {
    padding: 0.3rem 0.55rem;
    border: 1.5px solid var(--color-border, #e2e8f0);
    border-radius: 1rem;
    background: #fff;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s;
    white-space: nowrap;
}

.font-btn:hover {
    border-color: #667eea;
}

.font-btn.active {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
}

#drawCanvas {
    border: 3px solid #ddd;
    border-radius: 12px;
    background: #fff;
    cursor: crosshair;
    max-width: 100%;
}

/* ボタン（control-bar内） */
.control-bar-center .game-btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.game-btn {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.game-btn:active {
    transform: scale(0.96);
}

.btn-clear {
    background: #f1f5f9;
    color: #64748b;
}

.btn-clear:hover {
    background: #e2e8f0;
}

.btn-judge {
    background: #667eea;
    color: #fff;
}

.btn-judge:hover {
    background: #5a6fd6;
}

/* スコア結果 */
.score-result {
    text-align: center;
    padding: 1rem;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 0.75rem;
    animation: fadeInUp 0.35s ease;
}

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

.score-number {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1;
}

.score-excellent { color: #f59e0b; }
.score-good      { color: #10b981; }
.score-ok        { color: #3b82f6; }
.score-try-again { color: #6b7280; }

.score-stars {
    font-size: 1.5rem;
    margin: 0.5rem 0;
}

.score-message {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.score-details {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
    font-size: 0.8rem;
    color: var(--color-text-muted, #64748b);
    margin-bottom: 1rem;
}

.score-details span {
    background: #f1f5f9;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
}

.score-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.btn-retry {
    background: #f1f5f9;
    color: #333;
}

.btn-retry:hover {
    background: #e2e8f0;
}

.btn-next {
    background: #10b981;
    color: #fff;
}

.btn-next:hover {
    background: #059669;
}

/* 統計バー */
.game-stats {
    display: flex;
    justify-content: space-around;
    padding: 0.6rem;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.stat {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--color-text-muted, #64748b);
}

.stat-value {
    display: block;
    font-size: 1.2rem;
    font-weight: 700;
    color: #333;
}

/* ====== メニューページ ====== */
.game-menu-header {
    text-align: center;
    padding: 2rem 0 1rem;
}

.game-menu-header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.game-menu-header p {
    color: var(--color-text-muted, #64748b);
}

.game-age {
    margin-top: 0.35rem;
    color: #0f766e;
    font-size: 0.85rem;
    font-weight: 600;
}

.game-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.game-card {
    background: #fff;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    color: inherit;
    display: block;
}

.game-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    text-decoration: none;
}

.game-card-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.game-card h2 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}

.game-card p {
    font-size: 0.9rem;
    color: var(--color-text-muted, #64748b);
}

.game-card-badge {
    display: inline-block;
    background: #667eea;
    color: #fff;
    padding: 0.2rem 0.8rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    margin-top: 0.5rem;
}

/* ====== カラーゲーム共通 ====== */
.color-game-shell {
    max-width: 720px;
}

.color-mix-board,
.quiz-board,
.quiz-setup {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    padding: 1rem;
}

.mix-hint {
    text-align: center;
    color: #64748b;
    margin-bottom: 0.8rem;
}

.mix-target {
    width: min(62vw, 240px);
    height: min(62vw, 240px);
    margin: 0 auto;
    border-radius: 999px;
    border: 6px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #0f172a;
    transition: transform 0.2s, border-color 0.2s;
}

.mix-target.is-dragging {
    transform: scale(1.03);
    border-color: #3b82f6;
}

.mix-target-dark-text {
    color: #0f172a;
}

.mix-target-label {
    font-size: 0.85rem;
    font-weight: 600;
    opacity: 0.85;
}

.mix-target-name {
    font-size: 1.3rem;
    font-weight: 700;
}

.mix-actions {
    display: flex;
    justify-content: center;
    gap: 0.6rem;
    margin: 0.9rem 0;
    flex-wrap: wrap;
}

.mix-palette {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
    gap: 0.55rem;
    margin-bottom: 0.8rem;
}

.mix-color-btn {
    min-height: 72px;
    border: 2px solid rgba(15, 23, 42, 0.15);
    border-radius: 12px;
    font-weight: 700;
    cursor: grab;
    color: #111;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}

.mix-color-btn:active {
    cursor: grabbing;
}

.mix-info p {
    margin: 0.2rem 0;
    font-size: 0.9rem;
}

.mix-history {
    margin: 0.8rem 0 0;
    padding: 0;
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.4rem;
}

.mix-history li {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    background: #f8fafc;
    border-radius: 8px;
    padding: 0.32rem 0.48rem;
    font-size: 0.82rem;
}

.mix-dot {
    width: 16px;
    height: 16px;
    border-radius: 999px;
    border: 1px solid rgba(0, 0, 0, 0.18);
}

/* ====== いろあてクイズ ====== */
.quiz-setup {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    margin-bottom: 0.8rem;
    flex-wrap: wrap;
}

.quiz-select {
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 0.45rem 0.6rem;
    font-size: 0.95rem;
}

.quiz-status {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.8rem;
    font-weight: 700;
    color: #334155;
}

.quiz-color-swatch {
    width: min(70vw, 280px);
    height: min(52vw, 210px);
    margin: 0 auto 1rem;
    border-radius: 16px;
    border: 4px solid #e2e8f0;
}

.quiz-choices {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.6rem;
}

.quiz-choice-btn {
    border: 2px solid #cbd5e1;
    border-radius: 12px;
    padding: 0.75rem 0.9rem;
    background: #fff;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
}

.quiz-choice-btn:hover {
    border-color: #60a5fa;
}

.quiz-choice-btn.is-correct {
    border-color: #10b981;
    background: #d1fae5;
}

.quiz-choice-btn.is-wrong {
    border-color: #ef4444;
    background: #fee2e2;
}

.quiz-feedback {
    min-height: 2.2rem;
    margin: 0.9rem 0 0.2rem;
    text-align: center;
    font-weight: 700;
    color: #0f172a;
}

/* ====== ヒントことばクイズ ====== */
.word-quiz-board {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    padding: 1rem;
}

.word-hint-wrap {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 0.9rem;
    margin-bottom: 0.8rem;
}

.word-hint-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.word-hint-buttons .game-btn {
    padding: 0.5rem 0.8rem;
    font-size: 0.9rem;
}

.word-hint-note {
    margin: 0.45rem 0 0.2rem;
    color: #475569;
    font-weight: 600;
}

.word-hint-list {
    margin: 0.35rem 0 0;
    padding-left: 1.1rem;
}

.word-hint-list li {
    margin: 0.15rem 0;
}

.word-answer-wrap {
    margin-top: 0.7rem;
}

.word-answer-input {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 0.65rem 0.7rem;
    font-size: 1rem;
    margin-top: 0.35rem;
}

.word-answer-actions {
    display: flex;
    gap: 0.6rem;
    margin-top: 0.7rem;
    flex-wrap: wrap;
}

/* レスポンシブ */
@media (max-width: 480px) {
    .game-container {
        padding: 0.5rem;
    }

    .game-title {
        font-size: 1.3rem;
    }

    .current-char {
        font-size: 1.8rem;
    }

    .control-bar {
        flex-wrap: wrap;
        gap: 0.3rem;
        padding: 0.4rem 0.6rem;
    }

    .control-bar-center .game-btn {
        padding: 0.4rem 0.7rem;
        font-size: 0.8rem;
    }

    .font-btn {
        padding: 0.25rem 0.45rem;
        font-size: 0.7rem;
    }

    .tab {
        padding: 0.5rem 0.8rem;
        font-size: 0.9rem;
    }

    .game-btn {
        padding: 0.6rem 1rem;
        font-size: 1rem;
    }

    .score-number {
        font-size: 2.5rem;
    }

    .mix-color-btn {
        min-height: 62px;
        font-size: 0.85rem;
    }

    .quiz-choice-btn {
        font-size: 0.95rem;
    }
}
