/* 変数定義（テキストサイズ可変用） */
:root {
    --hint-fs: 13px;
    --hint-ja-fs: 11.5px;
}

/* =========================================
   1. ベーススタイル & ヘッダー
========================================= */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans JP', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f7f7f7;
    background-image: radial-gradient(#d5d5d5 1px, transparent 1px);
    background-size: 20px 20px;
    color: #1a1a1a;
    margin: 0;
    padding: 30px 20px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100dvh;
}

#app-wrapper {
    max-width: 1400px;
    width: 100%;
}

#app-header {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    padding: 25px 40px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.03);
    border: 1px solid #e0e0e0;
    gap: 35px;
}

#app-logo { width: 110px; height: 110px; object-fit: contain; border-radius: 50%; box-shadow: 0 8px 16px rgba(0,0,0,0.15); }
.header-content { display: flex; flex-direction: column; align-items: flex-start; }
.app-title { font-family: 'Playfair Display', serif; font-size: 56px; margin: 0 0 5px 0; line-height: 1; letter-spacing: -1px; }
.title-pic { color: #111111; font-weight: 700; }
.title-scribe { color: #444444; font-style: italic; }
.app-subtitle { font-weight: 700; color: #555555; letter-spacing: 3px; font-size: 13px; margin-bottom: 12px; }
.app-desc { font-weight: 500; font-size: 16px; color: #333333; margin-bottom: 0; }

/* =========================================
   2. メインレイアウト (左サイドバー & 右メイン)
========================================= */
#game-container {
    background: #ffffff;
    padding: 35px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.05);
    border: 1px solid #e0e0e0;
}

.app-body-layout {
    display: flex;
    gap: 30px;
    align-items: stretch;
}

.left-sidebar {
    flex: 0 0 420px; /* ★ さらに横幅を広げ、2段組をゆったり表示 */
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
}

.play-area {
    display: flex;
    gap: 25px;
    align-items: stretch;
}
#image-area-wrapper { flex: 1.1; }
#input-area-wrapper { flex: 1; display: flex; flex-direction: column; }

.dashboard-panel {
    background: #fff;
    padding: 25px;
    border-radius: 8px;
    border: 2px solid #1a1a1a; 
}

/* =========================================
   3. 左サイドバー内コンテンツ
========================================= */
.score-panel { text-align: center; padding: 25px 20px;}
.status-header { font-size: 13px; color: #1a1a1a; margin-bottom: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 2px; text-align: center; }
.gauge-container { 
    position: relative; 
    width: 100%; 
    max-width: 260px; /* ★ 幅に合わせて美しくフィットする最大サイズ */
    padding: 0 20px; 
    margin: 0 auto; 
    text-align: center; 
}
.half-donut { width: 100%; height: auto; display: block; overflow: visible; }
.gauge-bg { fill: none; stroke: #f0f0f0; stroke-width: 10; stroke-linecap: round; }
.gauge-fill { fill: none; stroke: #1a1a1a; stroke-width: 10; stroke-linecap: round; stroke-dasharray: 125.6; stroke-dashoffset: 125.6; transition: stroke-dashoffset 0.8s ease-out, stroke 0.3s; }
.gauge-text { position: absolute; bottom: -5px; left: 0; width: 100%; font-size: 38px; font-weight: 700; color: #1a1a1a; font-family: 'Playfair Display', serif; }
.gauge-text .pts { font-size: 14px; color: #888; margin-left: 2px; }

.combined-hint-panel { flex-grow: 1; display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.support-toggle-section { padding: 12px 20px; background: #fff; border-bottom: 1px solid #eee; display: flex; flex-direction: column; gap: 8px; }
.switch-label { cursor: pointer; font-weight: bold; color: #111; display: inline-flex; align-items: center; gap: 10px; font-size: 14px;}
#hint-level-select { padding: 6px 10px; border-radius: 4px; background: #f9f9f9; color: #111; border: 1px solid #ccc; outline: none; font-size: 13px;}

.hint-sidebar-section { flex-grow: 1; display: flex; flex-direction: column; padding: 15px 20px; background: #fafafa; }
.hint-header { border-bottom: 2px solid #1a1a1a; padding-bottom: 8px; margin-bottom: 12px; }
.hint-header h3 { margin: 0; color: #1a1a1a; font-size: 15px;} 
.hint-placeholder { color: #888; font-size: 13px; line-height: 1.5; text-align: center; margin-top: 10px; margin-bottom: 10px; }
.hint-level-group { margin-bottom: 12px; }
.hint-level-title { color: #666; font-size: 11px; font-weight: bold; margin-bottom: 4px; text-transform: uppercase; letter-spacing: 1px;}
.hint-item { font-size: 13px; margin: 4px 0; padding-left: 8px; border-left: 2px solid #ccc; color: #444; line-height: 1.4;}
.hint-type { color: #1a1a1a; font-weight: bold; margin-right: 5px; }

/* =========================================
   4. 右メイン内：司令塔（アシスタント）
========================================= */
.assistant-panel { padding: 15px 25px; } 
.assistant-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; } 
.modern-step-title { font-size: 17px; font-weight: 800; color: #1a1a1a; margin: 0; font-family: 'Playfair Display', serif; }
.assistant-actions { display: flex; align-items: center; gap: 12px; }
.modern-badge { background: #1a1a1a; color: #fff; padding: 4px 10px; border-radius: 4px; font-size: 12px; font-weight: 700; letter-spacing: 1px; }

.skip-btn { background: #fff; border: 1px solid #1a1a1a; color: #1a1a1a; padding: 4px 10px; border-radius: 4px; font-size: 12px; cursor: pointer; transition: all 0.2s; font-weight: bold; }
.skip-btn:hover { background: #1a1a1a; color: #fff; }
.skip-btn.hidden { display: none; }

.modern-stepper { display: flex; align-items: center; justify-content: space-between; margin: 12px 0; padding: 0; } 
.stepper-item { display: flex; align-items: center; gap: 10px; opacity: 0.3; filter: grayscale(100%); transition: all 0.3s ease; }
.stepper-divider { flex: 1; height: 1px; background-color: #1a1a1a; margin: 0 15px; opacity: 0.2; }
.stepper-icon { width: 30px; height: 30px; border-radius: 50%; background: #fff; border: 2px solid #1a1a1a; color: #1a1a1a; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; transition: all 0.3s; }
.stepper-text { display: flex; flex-direction: column; }
.stepper-title { font-size: 13px; font-weight: 700; color: #1a1a1a; }
.stepper-subtitle { font-size: 10px; color: #666; font-weight: bold; }

.stepper-item.active-slot { opacity: 1; filter: none; }
.stepper-item.active-slot .stepper-icon { background: #1a1a1a; color: #fff; box-shadow: 3px 3px 0px rgba(0,0,0,0.1); }
.stepper-item.completed-slot { opacity: 1; filter: none; }
.stepper-item.completed-slot .stepper-icon { background: #fff; border-color: #27ae60; color: #27ae60; }
.stepper-item.completed-slot .stepper-title { color: #27ae60; }

.modern-message { background: #f7f7f7; padding: 12px 16px; border-radius: 6px; font-size: 14px; color: #1a1a1a; line-height: 1.5; display: block; border: 1px solid #e0e0e0; }
.modern-message::before { content: "NEXT ACTION"; display: block; font-size: 11px; font-weight: 800; color: #888; letter-spacing: 1px; margin-bottom: 4px; }
.modern-message strong { color: #3b82f6; font-weight: 700; background: rgba(59, 130, 246, 0.1); padding: 2px 6px; border-radius: 4px; }

/* =========================================
   4.5 Focus Area ボタン (立体白黒・ネオブルータリズム完璧版) ＆ Scaffolding
========================================= */
.focus-buttons-container {
    display: flex;
    gap: 15px;
    margin: 15px 0 25px 0; /* 下の影の分、マージンを空ける */
}

/* ★ 1. ボタン本体（透明なコンテナにして干渉を防ぐ） */
.focus-btn {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: transparent; /* 背景を透明に！ */
    border: 2px solid transparent; /* 枠線も透明に！ */
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    color: #1a1a1a;
    outline: none;
    transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1; /* 独立したレイヤーを作成 */
}

/* ★ 2. ボタンの見た目（前面の白背景と黒枠を分身として作成） */
.focus-btn::before {
    content: "";
    position: absolute;
    top: -2px; left: -2px; right: -2px; bottom: -2px; /* 透明な枠線を覆い隠す */
    background: #ffffff;
    border: 2px solid #1a1a1a;
    border-radius: 8px;
    z-index: -1; /* コンテンツの裏側に配置 */
    transition: background 0.15s ease;
}

/* ★ 3. 影（背面のストライプを分身として作成し、下にズラす） */
.focus-btn::after {
    content: "";
    position: absolute;
    top: 4px; left: -2px; right: -2px; bottom: -8px; /* 全体を6px下にズラす */
    border: 2px solid #1a1a1a;
    border-radius: 8px;
    background-image: repeating-linear-gradient(
        -45deg,
        #1a1a1a,
        #1a1a1a 1px,
        transparent 2px,
        transparent 5px
    );
    background-size: 7px 7px;
    z-index: -2; /* 白背景のさらに裏側に配置 */
    transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ★ ホバー時の動き（押し込まれるギミック） */
.focus-btn:hover {
    transform: translateY(3px); /* ボタン全体が3px下がる */
}
.focus-btn:hover::after {
    transform: translateY(-3px); /* 影は逆に3px上げて、画面上で静止しているように見せる */
}

/* ★ クリック・選択時の動き（完全に押し込まれるギミック） */
.focus-btn:active, .focus-btn.active-focus {
    transform: translateY(6px); /* ボタン全体が6px下がる */
}
.focus-btn:active::before, .focus-btn.active-focus::before {
    background: #f8fafc; /* 少しグレーになって押した感を持たせる */
}
.focus-btn:active::after, .focus-btn.active-focus::after {
    transform: translateY(-6px); /* 影を完全に上にズラしてボタンと重ねる */
}

/* コンテンツ（アイコンやテキスト）は一番上 */
.focus-icon, .focus-text {
    position: relative;
    z-index: 2;
}

/* アイコンとテキストのスタイル */
.focus-icon {
    font-size: 24px; display: flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; background: #ffffff; border: 2px solid #1a1a1a; border-radius: 8px; transition: transform 0.3s ease;
}
.focus-btn:hover .focus-icon { transform: scale(1.1) rotate(8deg); }
.focus-text { display: flex; flex-direction: column; }
.focus-main { font-size: 15px; font-weight: 800; color: #1a1a1a; font-family: 'Playfair Display', serif; }
.focus-sub { font-size: 11px; color: #555555; font-weight: 700; }

/* 🌟 Scaffolding（足場かけ）UIのスタイル 🌟 */
.scaffold-btn {
    display: inline-block;
    margin-top: 12px;
    padding: 6px 12px;
    background: #1a1a1a;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
}
.scaffold-btn:hover { background: #3b82f6; }

.scaffold-content {
    display: none; /* 初期状態では隠しておく */
    margin-top: 12px;
    padding: 12px;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 13px;
    color: #333;
    line-height: 1.6;
}
.scaffold-content.show { display: block; animation: fadeIn 0.3s ease; }

.scaffold-tag {
    display: inline-block;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    padding: 2px 8px;
    border-radius: 4px;
    margin: 2px 4px 4px 0;
    font-weight: bold;
    color: #0f172a;
}

/* =========================================
   5. 右メイン内：画像エリア
========================================= */
#image-area { position: relative; width: 100%; }
#target-image { width: 100%; height: auto; border-radius: 8px; border: 1px solid #ddd; display: block; }
#overlays-container { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: none; }
.support-active #overlays-container { display: block; }
.clickable-overlay { position: absolute; cursor: pointer; border: 2px dashed rgba(255, 255, 255, 0.9); background-color: rgba(0, 0, 0, 0.1); border-radius: 8px; transition: all 0.2s; }
.clickable-overlay:hover { background-color: rgba(255, 255, 255, 0.3); border-color: #fff; box-shadow: 0 0 10px rgba(255,255,255, 0.5); }

/* =========================================
   6. 右メイン内：入力エリア & 辞書
========================================= */
#dictionary-widget { position: relative; display: flex; align-items: center; background: #fff; border: 1px solid #e0e0e0; border-radius: 8px; padding: 5px 15px; margin-bottom: 15px; box-shadow: inset 0 1px 3px rgba(0,0,0,0.02); }
.search-icon { font-size: 16px; margin-right: 10px; opacity: 0.6; }
#dict-search-input { flex-grow: 1; border: none; outline: none; padding: 10px 0; font-size: 14px; font-family: inherit; color: #111; }
#dict-suggestions { position: absolute; top: 100%; left: 0; right: 0; background: #fff; border: 1px solid #111; border-radius: 6px; margin-top: 5px; padding: 0; list-style: none; box-shadow: 0 4px 15px rgba(0,0,0,0.1); z-index: 100; max-height: 200px; overflow-y: auto; }
#dict-suggestions li { padding: 10px 15px; border-bottom: 1px solid #eee; cursor: pointer; font-size: 14px; display: flex; justify-content: space-between; }
#dict-suggestions li:hover { background: #f4f4f4; }
#dict-suggestions li:last-child { border-bottom: none; }
.sugg-en { font-weight: bold; color: #111; }
.sugg-ja { color: #888; font-size: 12px; }

#user-input { width: 100%; box-sizing: border-box; flex-grow: 1; min-height: 140px; padding: 20px; font-size: 16px; font-family: inherit; background: #ffffff; border: 2px solid #e2e8f0; border-radius: 8px; margin-bottom: 15px; outline: none; line-height: 1.6; transition: all 0.2s; overflow-y: auto; }
#user-input:focus { border-color: #3b82f6; box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15); transform: translateY(-2px); }
#user-input.hit-flash { border-color: #10b981; background: #f0fdf4; }
#user-input:empty:before { content: attr(placeholder); color: #94a3b8; pointer-events: none; display: block; }

button#submit-btn, button#retry-btn { width: 100%; background-color: #111111; color: white; border: none; padding: 15px 25px; font-size: 15px; border-radius: 6px; cursor: pointer; font-weight: bold; transition: all 0.2s; text-transform: uppercase; letter-spacing: 2px; }
button#submit-btn:hover, button#retry-btn:hover { background-color: #333333; box-shadow: 0 4px 10px rgba(0,0,0,0.15); }

/* =========================================
   7. ゲーミフィケーション装飾
========================================= */
.matched-word { font-weight: 700; color: #3b82f6; background: rgba(59, 130, 246, 0.1); border-radius: 3px; padding: 0 4px; transition: all 0.3s ease; }

/* ★ 修正：ぼんやり光る点滅を廃止し、スッキリとした白い薄枠に変更 */
.gold-overlay { 
    position: absolute; 
    border: 2px solid rgba(255, 255, 255, 0.9); /* 白の薄い枠線 */
    background-color: rgba(255, 255, 255, 0.15); /* ほんのわずかなハイライト */
    border-radius: 8px; 
    pointer-events: none; 
    z-index: 10; 
    animation: simplePop 0.3s ease-out forwards; /* 出現時だけ軽くふわっと表示 */
}

@keyframes simplePop {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* ★ ヒント用のオーバーレイ（点線の枠）も、点滅を控えめに調整 */
.hint-glow-overlay { 
    position: absolute; 
    background-color: rgba(255, 255, 255, 0.1); 
    border: 2px dashed rgba(255, 255, 255, 0.7); 
    border-radius: 8px; 
    pointer-events: none; 
    animation: targetBreathing 2s infinite alternate ease-in-out; 
    z-index: 5; 
}

@keyframes targetBreathing { 
    0% { opacity: 0.3; } 
    100% { opacity: 1; } 
}

.floating-text { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 36px; font-weight: bold; color: #111; text-shadow: 0px 4px 15px rgba(255,255,255,0.8); pointer-events: none; animation: floatUp 1s ease-out forwards; z-index: 100; font-family: 'Playfair Display', serif; }
@keyframes floatUp { 0% { opacity: 1; transform: translate(-50%, -10%); scale: 0.5; } 50% { opacity: 1; scale: 1.2; } 100% { opacity: 0; transform: translate(-50%, -100%); } }
/* =========================================
   8. 辞書モーダル & その他
========================================= */
.hidden { display: none !important; }
.model-answers { text-align: left; background: #f9f9f9; padding: 15px; border-radius: 4px; margin: 20px 0; line-height: 1.6; border: 1px solid #ddd; border-left: 4px solid #1a1a1a;}

#dict-modal { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(255, 255, 255, 0.90); backdrop-filter: blur(4px); display: flex; justify-content: center; align-items: center; z-index: 9999; opacity: 1; transition: opacity 0.2s; }
.dict-modal-content { background: #fff; border: 2px solid #111; border-radius: 12px; width: 90%; max-width: 500px; padding: 30px; box-shadow: 0 10px 40px rgba(0,0,0,0.15); position: relative; }
#close-dict-btn { position: absolute; top: 15px; right: 20px; background: none; border: none; font-size: 28px; color: #999; cursor: pointer; padding: 0; line-height: 1; box-shadow: none; }
#close-dict-btn:hover { color: #111; background: none; transform: none;}
.dict-header { border-bottom: 2px solid #111; padding-bottom: 15px; margin-bottom: 20px; }
#dict-word-title { font-family: 'Playfair Display', serif; font-size: 32px; margin: 0 0 5px 0; color: #111; }
#dict-word-meaning { font-size: 16px; color: #555; font-weight: bold; }
.dict-section { margin-bottom: 20px; }
.dict-section h4 { margin: 0 0 8px 0; font-size: 13px; color: #888; text-transform: uppercase; letter-spacing: 1px; }
#dict-explanation { margin: 0; font-size: 15px; color: #333; line-height: 1.6; }
#dict-corpus { margin: 0; font-size: 14px; font-weight: bold; color: #0984e3; background: #f0f8ff; padding: 8px 12px; border-radius: 6px; display: inline-block;}
#dict-synonyms { list-style: none; padding: 0; margin: 0; }
#dict-synonyms li { margin-bottom: 12px; font-size: 14px; line-height: 1.5; color: #555; display: flex; flex-direction: column; background: #fcfcfc; padding: 8px 12px; border-radius: 6px; border-left: 3px solid #0984e3; }
#dict-synonyms strong { color: #0984e3; font-size: 15px; margin-bottom: 2px; }

/* =========================================
   10. ホーム画面（学習トラック ＆ 画像選択）
========================================= */
#selection-screen {
    background: #ffffff;
    padding: 0;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.05);
    border: 1px solid #e0e0e0;
    overflow: hidden;
}

.macro-section {
    background: #111;
    color: #fff;
    padding: 50px 40px;
}
.macro-header {
    text-align: center;
    margin-bottom: 40px;
}
.macro-header h2 {
    font-family: 'Playfair Display', serif;
    font-size: 32px;
    margin: 0 0 10px 0;
    letter-spacing: 1px;
}
.macro-header p {
    color: #aaa;
    font-size: 14px;
    margin: 0;
    letter-spacing: 2px;
}

.macro-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.macro-card {
    position: relative;
    height: 160px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.macro-bg {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-size: cover;
    background-position: center;
    transition: transform 0.6s ease;
}
.macro-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(to bottom, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0.8) 100%);
    transition: background 0.4s ease;
}
.macro-content {
    position: absolute;
    bottom: 20px; left: 20px; right: 20px;
    z-index: 2;
    transition: transform 0.3s ease;
}
.macro-content h3 { font-family: 'Playfair Display', serif; font-size: 20px; margin: 0 0 5px 0; color: #fff; }
.macro-content p { font-size: 11px; color: #ccc; margin: 0; font-weight: bold; letter-spacing: 1px; }

.macro-card:hover .macro-bg { transform: scale(1.1); }
.macro-card:hover .macro-overlay { background: linear-gradient(to bottom, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.7) 100%); }
.macro-card.active { border-color: #fff; box-shadow: 0 0 20px rgba(255,255,255,0.2); transform: translateY(-5px); }
.macro-card.active .macro-content { transform: translateY(-5px); }
.macro-card.active .macro-content h3 { color: #fff; text-shadow: 0 2px 10px rgba(255,255,255,0.5); }

.sub-categories-wrapper {
    padding: 60px !important; 
    background: #fff;
    min-height: 400px;
}

.macro-panel {
    display: none;
    animation: fadeInPanel 0.4s ease;
    width: 100%;
}
.macro-panel.active-panel {
    display: block;
}
@keyframes fadeInPanel {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.category-section { margin-bottom: 50px; }

.category-title { 
    font-size: 26px; 
    font-weight: 800; 
    color: #1a1a1a; 
    border-bottom: 2px solid #1a1a1a; 
    padding-bottom: 12px; 
    margin-bottom: 25px; 
    display: flex; 
    align-items: baseline; 
    gap: 12px; 
}
.category-title span { font-size: 15px; color: #888; font-weight: bold; }

.image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 30px; }

.image-card { background: #fff; border: 2px solid #e0e0e0; border-radius: 10px; overflow: hidden; cursor: pointer; transition: all 0.3s ease; }
.image-card:hover { transform: translateY(-6px); border-color: #1a1a1a; box-shadow: 0 12px 24px rgba(0,0,0,0.1); }
.image-card img { width: 100%; height: 180px; object-fit: cover; border-bottom: 1px solid #e0e0e0; transition: transform 0.3s ease; }
.image-card:hover img { transform: scale(1.05); }
.image-card-info { padding: 16px; background: #fff; position: relative; z-index: 2; }
.image-card-title { font-size: 16px; font-weight: 800; margin: 0 0 5px 0; color: #1a1a1a; }
.image-card-desc { font-size: 12px; color: #666; margin: 0; }

.coming-soon { text-align: center; padding: 60px 20px; color: #888; }
.coming-soon h3 { font-family: 'Playfair Display', serif; font-size: 28px; color: #1a1a1a; margin-bottom: 10px; }
.coming-soon p { font-size: 14px; }

.back-btn { width: 100%; background: transparent; color: #1a1a1a; border: 1px solid #1a1a1a; padding: 10px 15px; border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: bold; margin-bottom: 10px; transition: all 0.2s; }
.back-btn:hover { background: #1a1a1a; color: #fff; }

/* =========================================
   11. スプラッシュ画面（オープニングアニメーション）
========================================= */
#splash-screen {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: #f7f7f7;
    background-image: radial-gradient(#d5d5d5 1px, transparent 1px);
    background-size: 20px 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.8s;
}

.splash-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.splash-logo {
    width: 240px; 
    height: auto;
    margin-bottom: 25px;
    opacity: 0;
    border-radius: 50%; 
    box-shadow: 0 12px 24px rgba(0,0,0,0.15);
    animation: fadeInLogo 1.2s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.splash-title {
    font-family: 'Playfair Display', serif; 
    font-size: 5.5rem; 
    font-weight: 700;
    color: #111;
    margin: 0 0 15px 0;
    white-space: nowrap;
    display: flex; 
    align-items: center; 
    justify-content: center; 
    clip-path: inset(0 100% 0 0);
    animation: brushWrite 1.2s cubic-bezier(0.6, 0.05, 0.15, 1) 0.4s forwards;
}

.splash-title .title-pic { color: #111111; font-weight: 700; font-style: normal; }
.splash-title .title-scribe { color: #444444; font-style: italic; }

.splash-cursor { display: none; }
.splash-subtitle-wrapper { display: inline-block; overflow: hidden; }

.splash-subtitle {
    font-weight: 500; 
    color: #666; 
    letter-spacing: 0.4em; 
    font-size: 1.1rem; 
    white-space: nowrap; 
    opacity: 0;
    transform: translateY(10px);
    animation: fadeUpSubtitle 0.8s ease forwards 1.2s;
}

@keyframes fadeInLogo { 
    0% { opacity: 0; transform: scale(0.9) translateY(10px); } 
    100% { opacity: 1; transform: scale(1) translateY(0); } 
}
@keyframes brushWrite { 
    0% { clip-path: inset(0 100% 0 0); } 
    100% { clip-path: inset(0 0 0 0); } 
}
@keyframes fadeUpSubtitle { 
    0% { opacity: 0; transform: translateY(10px); } 
    100% { opacity: 1; transform: translateY(0); } 
}
.splash-hidden { opacity: 0 !important; visibility: hidden !important; }

/* =========================================
   12. 初期案内のプレースホルダー
========================================= */
.initial-prompt-panel { text-align: center; padding: 100px 20px; color: #666; }
.initial-prompt-panel.active-panel {
    display: flex !important;
    flex-direction: column;
    align-items: center;
}
.prompt-icon { margin-bottom: 25px; animation: elegantFloat 2.5s infinite ease-in-out; }
.initial-prompt-panel h3 { font-family: 'Playfair Display', serif; font-size: 26px; color: #1a1a1a; margin-bottom: 12px; letter-spacing: 1px; }
.initial-prompt-panel p { font-size: 14px; letter-spacing: 0.5px; }

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

/* =========================================
   レスポンシブ対応
========================================= */
@media (max-width: 900px) {
    .app-body-layout { flex-direction: column; }
    .left-sidebar { flex: auto; width: 100%; }
    .play-area { flex-direction: column; }
    .macro-grid { grid-template-columns: repeat(2, 1fr); }
    .macro-section { padding: 40px 30px; }
    .sub-categories-wrapper { padding: 40px 30px; }
}

/* =========================================
   13. 手書き読み込み (OCR) 機能のスタイル
========================================= */
.action-buttons-wrapper {
    display: flex;
    gap: 15px;
    align-items: stretch;
    margin-bottom: 15px;
}

button#submit-btn {
    flex-grow: 1;
    margin-bottom: 0;
}

.icon-only-btn {
    background: #ffffff;
    border: 2px solid #111111;
    color: #111111;
    width: 54px; 
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s;
    padding: 0;
}
.icon-only-btn:hover {
    background: #111111;
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

#ocr-loading {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #111111;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    margin-bottom: 15px;
    color: #111111;
    font-weight: bold;
}
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(17, 17, 17, 0.2);
    border-top-color: #111111;
    border-radius: 50%;
    animation: ocr-spin 0.8s linear infinite;
    margin: 0 auto 10px;
}
@keyframes ocr-spin {
    to { transform: rotate(360deg); }
}

/* =========================================
   14. Finish & Practice モーダル
========================================= */
#finish-modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
}

#finish-modal.hidden {
    display: none;
}

.finish-modal-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* ★ モーダル全体をiPad/PCサイズに拡大 ★ */
.finish-modal-content {
    position: relative;
    background: #ffffff;
    width: 95%; /* 画面幅の95%を贅沢に使用 */
    max-width: 1400px; /* 大画面PCでも対応できるよう最大幅を広げる */
    height: 90vh; /* 縦幅もしっかり確保 */
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.15);
    border: 1px solid #e0e0e0;
    padding: 50px; 
    z-index: 10001;
    display: flex;
    flex-direction: column;
}

#close-finish-modal-btn {
    position: absolute;
    top: 25px; right: 25px;
    background: none; border: none;
    font-size: 28px; cursor: pointer; color: #111;
}

/* ★ 左右のバランスを美しく分割（ここで横並びを強制） ★ */
.finish-modal-body {
    display: flex;
    flex-direction: row; /* 横並び！ */
    gap: 50px; /* 左右の余白を広めにとる */
    margin-top: 20px;
    height: 100%;
    width: 100%; /* 横幅いっぱいを使う */
    overflow: hidden;
}

/* ★ 左ペイン（画像・メーター） */
.modal-left-pane { 
    flex: 0 0 35%; /* 全体の35%を占める（固定） */
    max-width: 450px; /* 広がりすぎないように上限を設ける */
    display: flex; 
    flex-direction: column; 
    gap: 20px; 
}

/* ★ 右ペイン（英文・文字起こし） */
.modal-right-pane { 
    flex: 1; /* 残りの65%の広大なスペースをすべて使う */
    min-width: 0; /* 子要素がはみ出すのを防ぐ魔法のコード */
    display: flex; 
    flex-direction: column; 
    gap: 20px; 
    overflow-y: auto; 
    padding-right: 15px;
}

#modal-review-image {
    width: 100%;
    max-height: 320px; 
    border-radius: 8px;
    object-fit: cover; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.08); 
}

.your-answer-box {
    background: #f8f9fa; padding: 15px; border-radius: 8px; border-left: 4px solid #111;
}

.cefr-tabs { display: flex; border-bottom: 2px solid #eee; }
.cefr-tab {
    padding: 10px 20px; background: none; border: none; font-weight: bold;
    cursor: pointer; color: #888; border-bottom: 2px solid transparent; margin-bottom: -2px;
}
.cefr-tab.active { color: #111; border-bottom-color: #111; }

.cefr-content {
    background: #fff; border: 1px solid #eee; padding: 20px; border-radius: 8px;
    min-height: 120px; font-size: 1.1em; line-height: 1.6;
}

.blanked-word {
    display: inline-block; width: 40px; border-bottom: 2px solid #111; margin: 0 4px;
}

.practice-controls {
    display: flex; flex-direction: column; gap: 15px; background: #f8f9fa; padding: 15px; border-radius: 8px;
}

.speech-btn {
    background: #111; color: #fff; border: none; padding: 15px; border-radius: 8px;
    font-weight: bold; font-size: 16px; cursor: pointer; transition: 0.2s;
}
.speech-btn:hover { background: #333; }
.speech-btn.recording { background: #ef4444; animation: pulse 1.5s infinite; }

#speech-result-area { padding: 0; background: transparent; border: none; }

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

/* =========================================
   15. モーダル内の音読練習用スタイル
========================================= */
.cefr-sentence-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 18px;
    cursor: pointer;
    padding: 10px;
    border-radius: 8px;
    transition: background 0.2s;
}
.cefr-sentence-item:hover { background: #f8f9fa; }
.cefr-sentence-item input[type="checkbox"] { margin-top: 6px; transform: scale(1.3); cursor: pointer; }

/* ★黒線を完全に削除し、文字を大きく */
.practice-text {
    font-size: 1.8em; 
    font-weight: 700;
    line-height: 1.6;
    padding: 30px; 
    background: #f8f9fa;
    border-radius: 12px; 
    margin-bottom: 25px;
    color: #111;
    border: none; /* 黒線（border-left）を完全に排除 */
}
.practice-text p { margin-bottom: 10px; }
.practice-text p:last-child { margin-bottom: 0; }

.transcription-box {
    padding: 20px;
    border: 2px dashed #ccc;
    border-radius: 8px;
    min-height: 120px;
    margin-bottom: 25px;
    background: #ffffff;
}
#live-transcription { font-size: 1.4em; color: #111; line-height: 1.5; }

.practice-actions {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}
.practice-actions button { flex: 1; }

/* =========================================
   16. Accuracy ゲージ専用デザイン
========================================= */
.accuracy-gauge-wrapper {
    position: relative;
    width: 100%;
    max-width: 260px;
    margin: 30px auto 0;
    text-align: center;
}

.accuracy-half-donut { width: 100%; height: auto; display: block; overflow: visible; }
.acc-gauge-bg { fill: none; stroke: #f0f0f0; stroke-width: 8; stroke-linecap: round; }
.acc-gauge-fill {
    fill: none; stroke: #f59e0b; stroke-width: 8; stroke-linecap: round;
    stroke-dasharray: 125.6; stroke-dashoffset: 125.6;
    transition: stroke-dashoffset 1s cubic-bezier(0.4, 0, 0.2, 1), stroke 0.3s;
}

.accuracy-content {
    position: absolute;
    bottom: -15px; 
    left: 0; width: 100%;
    display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
}
.accuracy-label {
    font-size: 15px; font-weight: 700; color: #444; margin-bottom: -2px; 
    font-family: 'Noto Sans JP', sans-serif;
}
.accuracy-number {
    font-size: 58px; font-weight: 900; color: #111; line-height: 1; 
    font-family: 'Arial', sans-serif; letter-spacing: -2px;
}
.acc-percent {
    font-size: 22px; font-weight: 700; color: #555; margin-left: 4px; letter-spacing: 0;
}

/* =========================================
   17. 学習記録 & SLAアドバイスのスタイル
========================================= */
.reading-record-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 15px;
    border-bottom: 1px dashed #ddd;
}

#reading-count-badge {
    background: #111;
    color: #fff;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

#reading-dynamic-comment {
    font-size: 13px;
    color: #555;
    text-align: center;
    font-weight: bold;
    line-height: 1.4;
}

.sla-advice-box {
    background: #f0f4f8; /* 知的な薄いブルーグレー */
    border-left: 4px solid #3b82f6;
    padding: 15px;
    border-radius: 8px;
    margin-top: 25px;
}

.sla-advice-title {
    margin: 0 0 8px 0;
    font-size: 13px;
    color: #1e3a8a; /* 濃いブルー */
    font-weight: 800;
}

#sla-advice-text {
    margin: 0;
    font-size: 13.5px;
    color: #333;
    line-height: 1.6;
    font-weight: 500;
}

/* =========================================
   18. 生徒向けフレンドリー・スカッフホールディング（左枠用）
========================================= */
.friendly-scaffold {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.scaffold-desc {
    font-size: 13.5px;
    color: #1a1a1a;
    line-height: 1.5;
    margin: 0;
    padding-bottom: 10px;
    border-bottom: 1px dashed #cbd5e1;
}

.scaffold-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* 「vocabulary」「grammar」の代わりとなる親切な見出し */
.scaffold-label {
    font-size: 12px;
    font-weight: 800;
    color: #3b82f6; /* 優しいブルー */
    background: #eff6ff;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
    width: fit-content;
}

/* 提案されるフレーズのタグデザイン */
.f-tag {
    display: inline-block;
    background: #ffffff;
    border: 1px solid #94a3b8;
    color: #334155;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    margin: 2px 4px 2px 0;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
/* =========================================
   18. 生徒向けフレンドリー・スカッフホールディング（2段組＆翻訳トグル）
========================================= */
.friendly-scaffold {
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.scaffold-desc {
    font-size: 13.5px; color: #1a1a1a; line-height: 1.5; margin: 0; padding-bottom: 10px; border-bottom: 1px dashed #cbd5e1;
}
.scaffold-group {
    display: flex; flex-direction: column; gap: 8px;
}
.scaffold-label {
    font-size: 12px; font-weight: 800; color: #3b82f6; background: #eff6ff; padding: 4px 8px; border-radius: 4px; display: inline-block; width: fit-content;
}

/* ★ 2段組（グリッド）レイアウト */
.scaffold-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* ★ タップで日本語訳が出るインタラクティブタグ */
.f-tag-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}
.f-tag {
    display: flex;
    align-items: center;
    background: transparent;
    border: none; /* 余計な枠線を削除 */
    color: #1e293b;
    padding: 4px 6px; /* 余白を最小限に */
    border-radius: 6px; /* 長丸をやめて、ごくわずかな角丸に */
    font-size: var(--hint-fs) !important;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    user-select: none;
    width: 100%;
    text-align: left;
}

.f-tag:hover {
    background: #f1f5f9; /* マウスを乗せた時だけうっすらハイライト */
}

.f-tag-ja {
    font-size: var(--hint-ja-fs) !important;
    color: #64748b;
    font-weight: bold;
    margin-top: 2px;
    margin-left: 28px; /* 🔊アイコンの幅を避けて英単語と縦のラインを揃える */
    margin-bottom: 6px; /* 下の単語との間隔 */
    display: none;
    animation: fadeIn 0.2s ease;
}
/* タップされて .show-ja クラスが付いた時の状態 */
.f-tag-wrapper.show-ja .f-tag-ja {
    display: block;
}
.f-tag-wrapper.show-ja .f-tag {
    border-color: #3b82f6; background: #eff6ff; color: #1e3a8a;
}
/* =========================================
   19. 追加UIコントロール（TTS、ページ、文字サイズ）
========================================= */
.hint-header { 
    display: flex; justify-content: space-between; align-items: center; 
    border-bottom: 2px solid #1a1a1a; padding-bottom: 8px; margin-bottom: 12px; 
}

.text-size-controls button {
    background: #f8fafc; border: 1px solid #cbd5e1; border-radius: 4px; padding: 2px 8px; 
    margin-left: 4px; cursor: pointer; color: #475569; font-weight: bold; transition: 0.2s;
}
.text-size-controls button:hover { background: #e2e8f0; color: #0f172a; }

.tts-btn {
    cursor: pointer; font-size: 15px; margin-right: 8px; padding: 2px;
    transition: transform 0.1s; display: inline-block; user-select: none;
}
.tts-btn:hover { transform: scale(1.2); }

.page-btn {
    background: #f1f5f9; border: 1px solid #cbd5e1; padding: 4px 14px; border-radius: 6px;
    cursor: pointer; font-size: 12px; font-weight: bold; color: #334155; transition: 0.2s;
}
.page-btn:hover:not(:disabled) { background: #e2e8f0; color: #0f172a; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
/* =========================================
   21. リサイズバー ＆ 柔軟なレイアウト
========================================= */
/* おしゃれな薄い灰色のリサイズバー */
.resizer {
    width: 14px; /* つかみやすい幅に少し拡大 */
    cursor: col-resize;
    background-color: transparent;
    transition: background-color 0.2s ease;
    margin: 0 4px;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

/* ドラッグできることを示す「2本の縦線」のグリップ */
.resizer::after {
    content: '';
    width: 4px;
    height: 28px;
    border-left: 1.5px solid #cbd5e1; /* 薄いグレーの線 */
    border-right: 1.5px solid #cbd5e1; 
    transition: border-color 0.2s ease;
}

/* ホバー時・ドラッグ中の状態 */
.resizer:hover, .resizer.resizing {
    background-color: #f1f5f9; /* 背景をほんのりグレーに光らせる */
}

.resizer:hover::after, .resizer.resizing::after {
    border-color: #94a3b8; /* ドラッグ中はグリップを少し濃くする */
}

/* 枠を消したCoverage Rateの微調整 */
#live-status {
    background: transparent;
    border: none;
    box-shadow: none;
}

/* 幅に合わせて1段組・2段組が切り替わるグリッド（最小160pxで折り返し） */
.scaffold-2col {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)) !important;
    gap: 8px !important;
}

/* アプリ全体のフレックスレイアウトを横並び固定に */
.app-body-layout {
    display: flex;
    flex-direction: row;
    height: calc(100vh - 80px); /* 画面高さにフィット */
    overflow: hidden;
}

/* サイドバーとメインコンテンツのスクロール設定 */
.left-sidebar {
    overflow-y: auto;
    height: 100%;
}
.main-content {
    flex: 1;
    overflow-y: auto;
    height: 100%;
    min-width: 400px; /* 右側が潰れすぎないように */
}
/* =========================================
   22. ヒントヘッダーの1段組固定（折り返し防止）
========================================= */
.hint-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-wrap: nowrap !important; /* 絶対に折り返さない */
    gap: 8px; /* タイトルとボタンの間の余白 */
    width: 100%;
    overflow: hidden; /* はみ出しを隠す */
}

/* タイトルテキストの制御 */
#hint-title {
    white-space: nowrap; /* テキストの改行を禁止 */
    overflow: hidden;
    text-overflow: ellipsis; /* 幅が足りない場合は「...」で省略 */
    margin: 0;
    flex: 1; /* 余ったスペースを占有する */
}

/* A- / A+ ボタンのグループ */
.text-size-controls {
    display: flex;
    flex-wrap: nowrap; /* ボタン同士も折り返さない */
    gap: 4px;
    flex-shrink: 0; /* ボタンのサイズが潰れるのを防ぐ */
}

.text-size-controls button {
    white-space: nowrap;
    flex-shrink: 0;
}