  /* ===== デザイン・見た目 (CSS) ===== */
        
        body {
            font-family: "Hiragino Maru Gothic ProN", "Noto Sans JP", "メイリオ", Meiryo, sans-serif;
            background: linear-gradient(135deg, #e0f2fe, #fdf4ff);
            text-align: center;
            margin: 0;
            padding: 20px 10px;
            color: #333;
            display: flex;
            flex-direction: column;
            align-items: center;
            min-height: 100vh;
            touch-action: manipulation; /* ダブルタップズームなどを防ぐ */
        }

        .app-container {
            width: 90vw;
            max-width: 600px;
            background: #ffffff;
            padding: 20px;
            border-radius: 20px;
            box-shadow: 0 8px 16px rgba(0,0,0,0.1);
            position: relative; 
            border: 4px solid #bae6fd;
            margin-top: 10px;
        }

        h1 {
            margin: 10px 0 15px 0;
            font-size: 2rem;
            color: #ff7f50;
            text-shadow: 2px 2px 0px #fff;
        }

        /* サウンドON/OFFボタン（右上に固定） */
        #sound-toggle {
            position: absolute;
            top: -20px;
            right: 15px;
            background: #f59e0b;
            color: white;
            border: none;
            border-radius: 15px;
            padding: 8px 15px;
            font-size: 14px;
            font-weight: bold;
            cursor: pointer;
            box-shadow: 0 4px 0 #b45309;
            transition: all 0.1s;
            z-index: 10;
        }
        #sound-toggle:active { transform: translateY(4px); box-shadow: 0 0 0 #b45309; }

        /* --- 設定画面のデザイン --- */
        .setting-section {
            margin-bottom: 20px;
            background: #f8fafc;
            padding: 15px;
            border-radius: 15px;
        }
        .setting-section p { 
            margin: 0 0 10px 0; 
            font-size: 1.2rem;
            font-weight: bold;
            color: #334155;
        }
        
        .option-group {
            display: flex;
            justify-content: center;
            flex-wrap: wrap;
            gap: 10px; /* ボタンが多いので少し隙間を詰めます */
        }

        /* 学年のボタンを「上段3つ・下段3つ」にきれいに並べるための専用設定 */
        #grade-options {
            display: grid;
            grid-template-columns: repeat(3, 1fr); /* 3列に均等に分ける */
            max-width: 350px; /* 広がりすぎないように幅を制限 */
            margin: 0 auto; /* 中央に寄せる */
        }
        
        /* 選択ボタンの基本デザイン */
        .opt-btn {
            background: #fff;
            color: #64748b;
            border: 3px solid #cbd5e1;
            padding: 8px 12px; /* 少しスリムに */
            border-radius: 10px;
            font-size: 1rem;
            font-weight: bold;
            cursor: pointer;
            transition: all 0.2s ease;
        }
        /* 選ばれている状態（active）のデザイン */
        .opt-btn.selected {
            background: #3b82f6; 
            color: #fff;
            border-color: #2563eb;
            transform: scale(1.1); 
            box-shadow: 0 4px 10px rgba(59, 130, 246, 0.4);
        }

        /* スタートボタン */
        #start-btn {
            background: #10b981;
            color: white;
            font-size: 1.5rem;
            font-weight: bold;
            padding: 15px 40px;
            border: none;
            border-radius: 15px;
            box-shadow: 0 6px 0 #059669;
            cursor: pointer;
            margin-top: 10px;
            width: 80%;
            transition: all 0.1s ease;
        }
        #start-btn:active { transform: translateY(6px); box-shadow: 0 0 0 #059669; }

        /* --- ゲーム画面のデザイン --- */
        .info-bar {
            display: flex;
            justify-content: space-between;
            gap: 10px;
            font-size: 1.2rem;
            font-weight: bold;
            background: #ffffff;
            padding: 10px 20px;
            border-radius: 15px;
            box-shadow: 0 4px 8px rgba(0,0,0,0.1);
            margin-bottom: 15px;
            flex-wrap: wrap;
        }
        #timer { color: #e11d48; font-size: 1.3rem; }
        #score-display { color: #0284c7; }

        #game-message {
            font-weight: bold; 
            font-size: 1.2rem;
            margin-top: 15px;
            background: #fff;
            padding: 8px 16px;
            border-radius: 20px;
            display: inline-block;
            box-shadow: 0 4px 6px rgba(0,0,0,0.1);
            color: #0284c7;
        }

        /* 漢字を並べる枠組み（ゲームエリアっぽく） */
        #grid-container {
            display: grid;
            gap: 8px; /* ボタン同士の隙間 */
            margin: 0 auto;
            max-width: 450px;
            background: #f0fdf4;
            border: 4px solid #4ade80;
            padding: 12px;
            border-radius: 20px;
            box-shadow: 0 8px 16px rgba(0,0,0,0.1);
        }

        /* 漢字ボタン */
        .kanji-cell {
            font-family: 'Klee One', 'UD デジタル 教科書体 N-R', 'YuKyokasho Yoko', '游教科書体', serif;
            /* ▼▼ 変更ポイント1：フォントの太さを指定 ▼▼ */
            font-weight: 600;
            background-color: white;
            border: 3px solid #cbd5e1;
            border-radius: 12px;
            font-weight: bold;
            color: #334155;
            -webkit-text-stroke: 1px #334155;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            aspect-ratio: 1 / 1; 
            padding: 0;
            transition: all 0.1s;
            box-shadow: 0 4px 0 #cbd5e1;
        }
        .kanji-cell:active:not(:disabled) {
            transform: translateY(4px) scale(0.95);
            box-shadow: 0 0 0 #cbd5e1;
        }
        /* 間違えて押したボタン */
        .kanji-cell:disabled {
            background-color: #f1f5f9;
            color: #94a3b8;
            border-color: #e2e8f0;
            box-shadow: 0 2px 0 #e2e8f0;
            transform: translateY(2px);
            cursor: default;
        }

        /* --- 結果画面のデザイン --- */
        #result-screen {
            background: rgba(255, 255, 255, 0.95);
            padding: 30px;
            border-radius: 20px;
            border: 4px solid #ff7f50;
        }
        #result-screen h2 { font-size: 1.8rem; color: #ff7f50; font-weight: bold; margin-top: 0; }
        #final-score { font-size: 2.2rem; color: #e11d48; font-weight: bold; margin: 20px 0; }
        #result-msg { font-size: 1.5rem; font-weight: bold; color: #0284c7; margin-bottom: 30px; }

        /* やめる（タイトルへもどる）ボタン */
        #quit-btn {
            background: #ef4444;
            color: #fff;
            font-size: 1.2rem;
            font-weight: bold;
            padding: 10px 20px;
            border: none;
            border-radius: 15px;
            cursor: pointer;
            box-shadow: 0 6px 0 #b91c1c;
            margin-top: 15px;
            transition: all 0.1s ease;
        }
        #quit-btn:active { transform: translateY(6px); box-shadow: 0 0 0 #b91c1c; }

        .hidden { display: none !important; }