@charset "UTF-8";

/* --- 既存の基本設定 --- */
:root { --primary: #009688; --bg: #f7f9fa; --text: #333; }
body { font-family: "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif; background: var(--bg); color: var(--text); margin: 0; padding: 0; display: flex; flex-direction: column; min-height: 100vh; }
.cn-text { font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "SimHei", sans-serif; }

/* ヘッダー */
header { background: #fff; padding: 10px 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); display: flex; align-items: center; justify-content: space-between; position: relative; height: 50px; z-index: 100; }
header h1 a { text-decoration: none; font-size: 20px; color: var(--primary); font-weight: bold; }
.pc-nav { display: block; }
.btn-login { background-color: var(--primary); color: white; padding: 6px 12px; text-decoration: none; border-radius: 4px; font-size: 13px; font-weight: bold; }
.mobile-menu-icon { display: none; font-size: 24px; cursor: pointer; color: var(--primary); }
.mobile-nav { display: none; position: absolute; top: 100%; right: 0; width: 200px; background: #fff; border: 1px solid #ddd; box-shadow: 0 4px 8px rgba(0,0,0,0.1); z-index: 1000; }
.mobile-nav ul { list-style: none; padding: 0; margin: 0; }
.mobile-nav li a { display: block; padding: 12px; text-decoration: none; color: #333; border-bottom: 1px solid #eee; }
@media (max-width: 768px) { .pc-nav { display: none; } .mobile-menu-icon { display: block; } }

/* レイアウト */
.container { max-width: 800px; margin: 20px auto; padding: 0 15px; flex: 1; width: 100%; box-sizing: border-box; }
.ad-banner { background: #e0e0e0; color: #999; height: 100px; display: flex; align-items: center; justify-content: center; margin: 20px 0; border-radius: 8px; font-weight: bold; }

/* 検索ボックス */
.search-box { background: #fff; padding: 20px; border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); margin-bottom: 30px; }
.search-input-group { display: flex; gap: 10px; margin-bottom: 15px; }
.search-input { flex: 1; padding: 10px; font-size: 16px; border: 2px solid #ddd; border-radius: 4px; outline: none; }
.search-input:focus { border-color: var(--primary); }
.btn-search { background: var(--primary); color: #fff; border: none; padding: 0 20px; border-radius: 4px; font-weight: bold; cursor: pointer; }
.search-options { font-size: 13px; color: #666; display: flex; gap: 15px; align-items: center; flex-wrap: wrap; }

/* 結果表示 */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 15px; margin-top: 10px; }
.word-card { background: #fff; padding: 15px; border-radius: 6px; cursor: pointer; border: 1px solid #eee; transition: 0.2s; text-decoration: none; color: inherit; display: block; }
.word-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.05); }
.head-text { font-size: 18px; font-weight: bold; color: var(--primary); margin-right: 10px; }
.pinyin-text { color: #666; font-family: "Courier New", monospace; }
.mean-text { color: #555; font-size: 14px; margin-top: 4px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* 検索結果リスト */
.result-list { margin-top: 20px; }
.result-row { background: #fff; padding: 15px 20px; border-bottom: 1px solid #eee; display: flex; flex-direction: column; text-decoration: none; color: inherit; transition: background 0.2s; }
.result-row:hover { background: #fdfdfd; }

/* 詳細ページ */
.detail-box { background: #fff; padding: 30px; border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
.d-headword { font-size: 32px; font-weight: bold; color: var(--primary); }
.highlight-red { color: red; font-weight: bold; }
.pos-block { margin-top: 20px; padding: 15px; background: #f9f9f9; border-radius: 8px; }

footer { background: #333; color: #fff; text-align: center; padding: 15px; margin-top: auto; font-size: 12px; }

/* ▼▼▼ 追加・修正箇所 (AI機能 & モーダル) ▼▼▼ */

/* 該当なしエリアのデザイン修正 */
.not-found {
    text-align: center;
    padding: 40px 20px;
    background: #fff; /* 背景色を追加 */
    border-radius: 8px; /* 角丸 */
    margin-bottom: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05); /* 影を追加 */
}
.not-found h3 { margin: 0 0 10px 0; font-size: 1.2rem; color: #555; }
.not-found p { color: #777; font-size: 0.9rem; margin-bottom: 20px; }

/* AIボタン */
.btn-ask-ai {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff; border: none; padding: 12px 30px;
    border-radius: 30px; font-size: 15px; font-weight: bold;
    cursor: pointer; box-shadow: 0 4px 10px rgba(118, 75, 162, 0.4);
    transition: transform 0.2s;
    display: inline-block;
}
.btn-ask-ai:hover { transform: scale(1.05); opacity: 0.9; }

/* モーダル (z-indexを強化) */
.modal-wrap {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6); 
    z-index: 9999; /* ヘッダーより確実に上にする */
    display: none; /* 初期状態は非表示 */
    align-items: center; justify-content: center;
    backdrop-filter: blur(2px); /* 背景を少しぼかす */
}
.modal-box {
    background: #fff; width: 90%; max-width: 500px; max-height: 85vh;
    border-radius: 10px; display: flex; flex-direction: column; overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}
.modal-head {
    padding: 15px 20px; border-bottom: 1px solid #eee;
    background: #fafafa; font-weight: bold; color: #333;
    display: flex; justify-content: space-between; align-items: center;
}
.modal-body { padding: 20px; overflow-y: auto; flex: 1; font-size: 14px; }