/* ============================================================
   ぱそトレ！～パソコンスキル訓練タイピング～ 
   Standard Style Sheet (v17.4) - SELECTION UI OPTIMIZED
   Update: 2026/06/05
   ============================================================ */

:root {
    --primary: #2c3e50;
    --primary-hover: #34495e;
    --accent: #3498db;
    --accent-hover: #2980b9;
    --error: #ff4757;
    --bg: #f8f9fa;
    --key-border: #dcdde1;
    --gold: #f1c40f;
}

* { box-sizing: border-box; }

/* スムーズスクロール有効化 */
html { scroll-behavior: smooth; }

body { 
    margin: 0; 
    padding: 0; 
    font-family: 'Noto Sans JP', sans-serif; 
    background-color: var(--bg); 
    color: var(--primary); 
    line-height: 1.6; 
    min-height: 100vh; 
    width: 100vw; 
    display: flex; 
    flex-direction: column; 
    overflow-x: hidden; 
}

/* 画面タイプ別レイアウト */
body.portal-page { overflow-y: auto; height: auto; background-color: var(--bg); }
body.portal-page main { display: block; padding: 20px 0; }

body.game-body { overflow: hidden; height: 100vh; background-color: #d1d5db; position: relative; }
body.game-body main { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding-top: 10px; }

.hidden { display: none !important; }

/* 全体コンテナ：1000pxで視線を安定させる */
#app { width: 1000px; margin: 0 auto; padding: 10px; display: flex; flex-direction: column; box-sizing: border-box; min-height: 100vh; }

header { flex-shrink: 0; text-align: center; margin-bottom: 25px; width: 100%; }
.logo { font-size: 1.8rem; font-weight: bold; margin-bottom: 5px; }
.logo span { color: var(--accent); font-size: 1.1rem; }
.nav-menu { margin-bottom: 5px; display: flex; gap: 15px; justify-content: center; flex-wrap: wrap; }
.nav-menu a { color: var(--primary); text-decoration: none; font-size: 0.85rem; font-weight: bold; padding: 5px 8px; border-bottom: 2px solid transparent; transition: all 0.2s; }
.nav-menu a:hover { color: var(--accent); border-bottom: 2px solid var(--accent); }

/* アドセンス対策 */
.ad-container-top, .result-ad-box { display: none !important; }

main { flex: 1; width: 100%; min-height: 0; }

/* --- タイピング画面 --- */
.screen { width: 100%; display: flex; flex-direction: column; align-items: center; }

.typing-display { 
    background: white; padding: 20px 50px; border-radius: 25px; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.05); margin-bottom: 15px; 
    height: 175px; display: flex; flex-direction: column; justify-content: center; 
    overflow: hidden; width: 860px; position: relative;
}
.typing-display::before {
    content: ""; position: absolute; left: 40px; top: 50%; transform: translateY(-50%);
    width: 2px; height: 95px; background-color: rgba(52, 152, 219, 0.3); z-index: 10; pointer-events: none;
}

/* 待機（READY）画面：文字サイズ最適化 */
.ready-container { text-align: center; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ready-text { 
    font-size: 2.2rem; 
    font-weight: 800; 
    color: var(--primary); 
    animation: pulse 1.5s infinite; 
    margin-bottom: 8px; 
}
.esc-guide-card { font-size: 0.95rem; color: #7f8c8d; font-weight: 500; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.6; transform: scale(0.98); } }

/* 打鍵文字：強調表示 */
.text-wrapper-left { text-align: left; width: 100%; }
#display-kanji { font-size: 2rem; margin-bottom: 2px; font-weight: bold; color: var(--primary); }
#display-kana { font-size: 1.1rem; color: #888; margin-bottom: 5px; }
.romaji-scroll-window { width: 100%; overflow: hidden; position: relative; height: 4.5rem; display: flex; justify-content: flex-start; align-items: center; background: #fafafa; border-radius: 12px; padding: 0; }
.romaji-content { font-family: 'Roboto Mono', monospace; font-size: 2.6rem; font-weight: 700; letter-spacing: 0.1em; color: #333; white-space: nowrap; text-transform: uppercase; transition: transform 0.1s ease-out; margin: 0; }
.typed { color: #d1d5db !important; }
.current { color: var(--accent) !important; border-bottom: 5px solid var(--accent); }

/* --- キーボード：JIS黄金比死守 --- */
#keyboard-container { width: 860px; padding: 25px; background: #f1f2f6; border-radius: 20px; flex-shrink: 0; display: flex; flex-direction: column; align-items: center; }
.keyboard-row { display: flex; justify-content: flex-start; gap: 6px; width: 760px; margin-bottom: 6px; }
.row-0 { padding-left: 10px; }
.row-1 { padding-left: 35px; }
.row-2 { padding-left: 55px; }
.row-3 { padding-left: 10px; }
.row-4 { padding-left: 230px; }
.key { width: 44px; height: 44px; background: white; border-radius: 8px; border: 1px solid var(--key-border); border-bottom-width: 3px; display: flex; align-items: center; justify-content: center; font-size: 0.95rem; font-weight: bold; color: #57606f; flex-shrink: 0; }
.key.wide-shift { width: 64px; } 
.key.space { width: 200px; background: #3498db; border-color: #2980b9; color: white; }
.key.highlight { background: var(--accent); color: white; border-color: #2980b9; transform: translateY(2px); border-bottom-width: 1px; }

/* --- カテゴリ選択UI：総合判定ボタンの修正 (v17.4) --- */
.card { background: white; padding: 25px 35px; border-radius: 25px; box-shadow: 0 10px 30px rgba(0,0,0,0.05); text-align: center; width: 920px; }
.btn-group-container { display: flex; justify-content: center; gap: 12px; width: 100%; margin-bottom: 15px; }
.category-group { flex: 1; display: flex; flex-direction: column; gap: 6px; padding: 10px; background: #f8f9fa; border-radius: 12px; border: 1px solid #eee; }
.category-group.special { flex: 1.1; background: #fff5f0; border-color: #ffd8c0; justify-content: center; }
.group-label { font-size: 0.8rem; color: #7f8c8d; font-weight: 800; margin-bottom: 4px; display: block; }
.btn-category { width: 100%; padding: 8px; border: 1px solid #ddd; background: white; border-radius: 10px; cursor: pointer; font-weight: bold; font-size: 0.85rem; transition: all 0.2s; color: var(--primary); }
.btn-category:hover { border-color: var(--accent); background: #f0f7ff; }
.btn-category.active { background: var(--accent); color: white; border-color: var(--accent); }

/* ★総合判定ボタン：選択時のみオレンジ色になるように修正★ */
.btn-total { 
    height: 100%; 
    font-size: 1.1rem !important; 
    background: white; 
    color: var(--primary);
    border: 1px solid #ddd !important;
}
.btn-total.active { 
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%) !important; 
    color: white !important; 
    border: none !important; 
}

.btn-main { background: var(--primary); color: white; border: none; padding: 15px 70px; font-size: 1.3rem; border-radius: 40px; cursor: pointer; font-weight: bold; box-shadow: 0 5px 0 #1a252f; transition: all 0.1s; text-decoration: none; display: inline-block; }
.btn-main:hover:not(:disabled) { background: var(--accent); transform: translateY(-2px); box-shadow: 0 7px 0 #2980b9; }

/* 結果画面：最適化バランス */
.result-container { display: flex !important; flex-direction: row !important; gap: 20px; width: 1000px; margin: 0 auto; height: 460px; align-items: stretch; justify-content: center; }
.result-side { flex: 1.2; background: white; padding: 25px; border-radius: 25px; box-shadow: 0 5px 20px rgba(0,0,0,0.05); display: flex; flex-direction: column; overflow: hidden; }
.result-main { flex: 2; background: white; padding: 25px; border-radius: 25px; box-shadow: 0 5px 20px rgba(0,0,0,0.05); text-align: center; display: flex; flex-direction: column; justify-content: center; gap: 15px; }
.scroll-list { flex: 1; overflow-y: auto; padding-right: 10px; }
.miss-item { display: flex; justify-content: space-between; padding: 10px 15px; border-bottom: 1px solid #f1f1f1; font-family: 'Roboto Mono', monospace; font-size: 1.1rem; }
.miss-key { font-weight: bold; color: var(--error); }
#result-rank { font-size: 4.5rem; font-weight: bold; color: var(--accent); margin: 0; line-height: 1.2; }
.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 30px; max-width: 450px; margin: 5px auto; text-align: left; }
.res-item { font-size: 1.1rem; border-bottom: 1px solid #f1f1f1; padding-bottom: 3px; white-space: nowrap; }
.result-main .btn-main { padding: 12px 40px; font-size: 1.1rem; width: auto; min-width: 200px; margin: 10px auto; }

/* TOP・読み物ページ・フッター等 */
.portal-page .hero-section { text-align: center; padding: 60px 20px; background: linear-gradient(135deg, #1a365d 0%, #2980b9 100%); color: white; border-radius: 30px; margin-bottom: 80px; width: 100%; }
.portal-page .category-grid { display: grid !important; grid-template-columns: repeat(3, 1fr) !important; gap: 30px !important; width: 100% !important; margin-top: 40px; }
.portal-page .category-card { background: white; padding: 40px 25px; border-radius: 25px; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,0.05); text-decoration: none; color: inherit; border: 1px solid #eee; display: flex !important; flex-direction: column !important; align-items: center !important; transition: all 0.3s ease; }
.portal-page .category-card:hover { border-color: var(--accent); transform: translateY(-8px); box-shadow: 0 15px 40px rgba(0,0,0,0.1); }
.portal-page .cat-icon { font-size: 4.5rem; margin-bottom: 15px; }
.static-page { text-align: left; max-width: 800px !important; width: 95%; margin: 15px auto 40px auto; background: white; padding: 40px 60px; border-radius: 25px; box-shadow: 0 10px 30px rgba(0,0,0,0.05); line-height: 1.8; }
.article-image { text-align: center; margin: 30px 0; }
.article-image img { max-width: 600px; width: 100%; height: auto; border-radius: 12px; box-shadow: 0 5px 15px rgba(0,0,0,0.1); }
.guide-grid { display: grid; grid-template-columns: 1fr; gap: 20px; margin-top: 30px; }
.guide-card { background: #fff; padding: 30px; border-radius: 20px; text-decoration: none !important; color: inherit; border: 1px solid #eee; box-shadow: 0 4px 15px rgba(0,0,0,0.05); transition: all 0.3s ease; display: block; }
.guide-card:hover { transform: translateY(-5px); box-shadow: 0 12px 25px rgba(0,0,0,0.1); border-color: var(--accent); }
.guide-card h3 { color: var(--accent); margin-bottom: 10px; font-size: 1.3rem; font-weight: bold; }
.guide-card p { font-size: 0.95rem; color: #666; margin: 0; }
.point-badge { display: inline-block; background: var(--accent); color: white; padding: 4px 12px; border-radius: 6px; font-size: 0.75rem; font-weight: bold; margin-bottom: 15px; }

footer { margin-top: auto; padding: 8px 0; border-top: 1px solid #eee; text-align: center; background: white; flex-shrink: 0; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.footer-links { display: flex; justify-content: center; gap: 20px; margin-bottom: 3px; width: 100%; }
.footer-links a { color: var(--primary); text-decoration: none; font-size: 0.8rem; }
footer p { font-size: 0.75rem; color: #7f8c8d; margin: 2px 0 0 0; }

/* 用語集ジャンプ & トップ戻る */
.glossary-nav { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 30px; justify-content: center; background: rgba(255, 255, 255, 0.98); padding: 15px; border-radius: 15px; position: sticky; top: 10px; z-index: 1000; box-shadow: 0 8px 25px rgba(0,0,0,0.12); backdrop-filter: blur(8px); }
.nav-chip { padding: 8px 18px; background: #f1f2f6; border-radius: 25px; text-decoration: none; color: var(--primary); font-size: 0.85rem; font-weight: bold; transition: 0.2s; border: 1px solid transparent; }
.nav-chip:hover { background: var(--accent); color: white; transform: translateY(-2px); }
.glossary-section, .glossary-category-title { scroll-margin-top: 320px !important; }
.glossary-category-title { font-size: 1.6rem; border-left: 8px solid var(--accent); padding-left: 15px; margin-bottom: 25px; color: var(--primary); font-weight: bold; }
.glossary-grid { display: grid; grid-template-columns: 1fr; gap: 15px; }
.term-card { background: #fafafa; padding: 22px; border-radius: 18px; border: 1px solid #eee; transition: 0.3s; }
.term-card:hover { background: #fff; box-shadow: 0 5px 15px rgba(0,0,0,0.05); border-color: var(--accent); }
.term-word { font-size: 1.25rem; font-weight: bold; color: var(--accent); margin-bottom: 8px; display: block; border-bottom: 1px solid #eee; padding-bottom: 5px; }
.term-comment { font-size: 0.95rem; color: #555; line-height: 1.8; margin: 0; }

.back-to-top { position: fixed; bottom: 30px; right: 30px; width: 50px; height: 50px; background: var(--accent); color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; text-decoration: none; font-size: 1.5rem; font-weight: bold; box-shadow: 0 4px 15px rgba(0,0,0,0.2); opacity: 0; visibility: hidden; transition: all 0.3s ease; z-index: 3000; }
.back-to-top:hover { background: var(--accent-hover); transform: translateY(-5px); color: white; }
.back-to-top.visible { opacity: 1; visibility: visible; }