/* ===== 基本レイアウト ===== */
.goi-container { max-width: 1300px; margin: 0 auto; background: #fff; padding: 30px; border-radius: 8px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); font-family: sans-serif; }
.goi-container h1 { text-align: center; color: #2c3e50; margin-bottom: 30px; font-size: 1.8em; }
.goi-container button { background-color: white; color: #292200; border: none; padding: 10px 20px; border-radius: 4px; cursor: pointer; font-weight: bold; font-size: 0.95em; }
.goi-container button:hover { opacity: 0.9; }

/* ===== TOPページ: 案内 ===== */
.goi-top-intro { padding: 20px 24px; background: #f4f4f4; border-radius: 8px; margin-bottom: 20px; text-align: center; }
.goi-top-intro-text { margin: 0; font-size: 1em; color: #444; line-height: 1.8; }

/* ===== データ0件時の案内（原因が一目でわかるように） ===== */
.goi-empty-notice { padding: 14px 18px; background: #fff8e6; border: 1px solid #f0c040; border-radius: 6px; color: #8a6200; font-size: 0.9em; line-height: 1.6; margin-bottom: 20px; }

/* ===== TOPページ: お題 ===== */
.goi-odai-wrap { padding: 12px 16px; border-top: 1px solid #e0e0e0; border-bottom: 1px solid #e0e0e0; margin-bottom: 36px; }
.goi-odai-label { font-size: 0.85em; font-weight: bold; color: #555; margin-bottom: 8px; }
.goi-odai-content { font-size: 1em; color: #2c3e50; font-weight: bold; }
.goi-odai-word { color: #6c5ce7; cursor: pointer; text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 3px; }
.goi-odai-word:hover { color: #5a3fd0; }
.goi-odai-word.goi-odai-word-active { color: #5a3fd0; text-decoration-style: solid; }
.goi-odai-selected:empty { margin-top: 0; }
.goi-odai-selected { margin-top: 12px; }

/* ===== TOPページ: ランダム ===== */
.goi-random-wrap { margin-bottom: 20px; }
.goi-random-header { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.goi-random-label { font-size: 0.9em; font-weight: bold; color: #444; }
.goi-random-reload-btn { background: #F5F5F5!important; color: #8C8C8C !important; border: 1px solid #fafafa !important; padding: 4px 12px !important; font-size: 0.82em !important; border-radius: 4px; font-weight: bold !important; }
.goi-random-container { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.goi-random-card { padding: 10px 12px; background: #fff; border: 1px solid #e0e0e0; border-radius: 6px; font-size: 0.9em; cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s; }
.goi-random-card:hover { border-color: #6c5ce7; box-shadow: 0 2px 8px rgba(108,92,231,0.12); }
.goi-random-card .goi-rc-word { font-weight: bold; color: #2c3e50; display: block; }
.goi-random-card.goi-random-card-active { border-color: #6c5ce7; box-shadow: 0 2px 8px rgba(108,92,231,0.18); background: #f7f5ff; }
.goi-random-selected:empty { margin-top: 0; }
.goi-random-selected { margin-top: 14px; }

.goi-filter-clear-row { display: flex; gap: 10px; margin-top: 8px; }
.goi-filter-clear-btn { display: block; flex: 1; margin-top: 0; padding: 7px; background: #f0f0f0 !important; color: #555 !important; border: 1px solid #ccc !important; border-radius: 4px; font-size: 0.85em; font-weight: bold; cursor: pointer; text-align: center; }
.goi-filter-clear-btn:hover { background: #ffffff !important; color: #333 !important; }

/* ===== 検索バー ===== */
.goi-search-wrap { position: relative; margin-bottom: 12px; }
.goi-search-box { width: 100%; padding: 12px 40px 12px 14px; font-size: 1em; border: 1.5px solid #c8c8d0; border-radius: 6px; box-sizing: border-box; outline: none; transition: border-color 0.2s; }
.goi-search-box:focus { border-color: #6c5ce7; }
.goi-search-clear-btn { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: none; color: #aaa; font-size: 1em; padding: 0 6px; cursor: pointer; font-weight: bold; line-height: 1; }
.goi-search-clear-btn:hover { color: #555; }

/* ===== タグフィルター ===== */
.goi-filter-block { margin-bottom: 32px; }
.goi-filter-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0; border: 1px solid #d8d8d8; border-radius: 6px; overflow: hidden; }
.goi-filter-col { padding: 0; }
.goi-filter-col-emotion   { background: #EBD6F5; }
.goi-filter-col-situation { background: #f5ebd6; }
.goi-filter-col-style     { background: #D6F5EB; }
.goi-filter-col-header { font-size: 0.82em; font-weight: bold; color: #444; text-align: center; padding: 8px 6px; border-bottom: 1px solid #ccc; letter-spacing: 0.05em; }
.goi-filter-tags { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 8px 10px; }
.goi-filter-btn { font-size: 0.82em; padding: 4px 12px; border: 1px solid #d8d8d8; border-radius: 4px; background: #ffffff !important; color: #555; cursor: pointer; transition: border-color 0.15s, color 0.15s; user-select: none; font-weight: 500; letter-spacing: 0.02em; width: 100%; text-align: center; }
.goi-filter-btn:hover { border-color: #aaa; color: #333; background: #ffffff !important; }
.goi-filter-btn.goi-active-emotion   { border-color: #b94040; background: #ffffff !important; color: #b94040; font-weight: bold; }
.goi-filter-btn.goi-active-situation { border-color: #2471a3; background: #ffffff !important; color: #2471a3; font-weight: bold; }
.goi-filter-btn.goi-active-style     { border-color: #6c3483; background: #ffffff !important; color: #6c3483; font-weight: bold; }

/* ===== 用語表示エリア（用語として登録された言葉／タグ・検索フィルター対象／1行3列） ===== */
/* デフォルトでは何も表示せず、タグ選択または検索語句がある場合のみ用語カードが並ぶ */
.goi-term-display-wrap { margin-bottom: 32px; }
.goi-term-display-grid { display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-flow: row dense; gap: 8px; align-items: start; }
.goi-term-display-hint { grid-column: 1 / -1; color: #999; font-size: 0.88em; padding: 14px 4px; text-align: center; }
.goi-term-compact { padding: 12px 14px; background: #fff; border: 1px solid #e0e0e0; border-radius: 6px; cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s; }
.goi-term-compact:hover { border-color: #6c5ce7; box-shadow: 0 2px 8px rgba(108,92,231,0.12); }
.goi-term-compact-word { font-weight: bold; color: #2c3e50; }
.goi-term-compact.goi-term-compact-active { border-color: #6c5ce7; box-shadow: 0 2px 8px rgba(108,92,231,0.18); background: #f7f5ff; }
.goi-term-detail { grid-column: 1 / -1; }

/* ===== マイベスト・サイドバーアコーディオン ===== */
.goi-term-tags-nowrap { display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 4px; margin: 6px 0 8px; }
.goi-twocol-wrap { display: flex; gap: 0; align-items: flex-start; min-height: 400px; }
.goi-sidebar { width: 200px; flex-shrink: 0; border: 1px solid #e0e0e0; border-radius: 6px; overflow: hidden; position: sticky; top: 20px; background: #fff; }
.goi-sidebar-inner { }

.goi-sb-accordion { border-bottom: 1px solid #f0f0f0; }
.goi-sb-acc-header { display: flex; align-items: center; gap: 6px; padding: 11px 14px; font-size: 0.88em; font-weight: bold; color: #2c3e50; cursor: pointer; user-select: none; background: #fafafa; transition: background 0.12s; }
.goi-sb-acc-header:hover { background: #f0f0f0; }
.goi-sb-acc-header.goi-sb-active { background: #f0f0f0; color: #2c3e50; }
.goi-sb-acc-arrow { margin-left: auto; font-size: 0.75em; color: #aaa; transition: transform 0.2s; }
.goi-sb-accordion.goi-sb-open .goi-sb-acc-arrow { transform: rotate(180deg); }

.goi-sidebar-item { display: flex; align-items: center; padding: 9px 14px; font-size: 0.86em; color: #3a3a3a; cursor: pointer; border-bottom: 1px solid #f0f0f0; transition: background 0.12s; user-select: none; font-weight: 500; border-left: 3px solid transparent; }
.goi-sidebar-item:last-child { border-bottom: none; }
.goi-sidebar-item:hover { background: #f8f8f8; }
.goi-sidebar-item.goi-sidebar-active { background: #f5f3ff; color: #5a3fd0; border-left-color: #6c5ce7; font-weight: bold; }

.goi-sb-section-label { padding: 10px 14px 6px; font-size: 0.76em; font-weight: bold; color: #999; letter-spacing: 0.04em; background: #fcfcfc; border-top: 1px solid #f0f0f0; }

/* ===== サイドバー最下部：アフィリエイトリンク（常時表示／画像はメニュー幅に合わせて縮小） ===== */
.goi-sb-affiliate { padding: 14px; border-top: 1px solid #f0f0f0; text-align: center; }
.goi-sb-affiliate a { display: inline-block; max-width: 100%; }
.goi-sb-affiliate img { max-width: 100%; height: auto; }

.goi-main-area { flex: 1; min-width: 0; padding-left: 20px; }

/* ===== 語彙カード ===== */
.goi-term-item { padding: 16px; border: 1px solid #ebebeb; border-radius: 6px; background: #fff; margin-bottom: 14px; box-shadow: 0 1px 4px rgba(0,0,0,0.03); display: flex; gap: 16px; align-items: flex-start; }
.goi-card-left { flex: 2; min-width: 0; }
.goi-card-right { flex: 1; max-width: 280px; width: 100%; }
.goi-term-item.goi-no-right .goi-card-left { flex: 1; }
.goi-term-item.goi-no-right .goi-card-right { display: none; }
.goi-term-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.goi-cat2-badge { color: white; padding: 2px 8px; border-radius: 3px; font-size: 0.76em; font-weight: bold; background: #128a5f; }
.goi-title-wrap { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; flex: 1; }
.goi-term-title { font-size: 1.2em; font-weight: bold; margin: 0; color: #1a1a2e; }
.goi-term-yomi { font-size: 0.84em; color: #888; }

.goi-term-tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0 8px; }
.goi-tag            { display: inline-block; border-radius: 3px; padding: 2px 8px; font-size: 0.8em; font-weight: 500; margin: 2px 3px 2px 0; }
.goi-tag-emotion   { background: #fdf0f0; color: #a94040; border: 1px solid #f0d0d0; }
.goi-tag-situation { background: #eef4fb; color: #1f6191; border: 1px solid #c8ddf0; }
.goi-tag-style     { background: #f3f0fa; color: #5a3080; border: 1px solid #d8c8f0; }
.goi-tag-clickable { cursor: pointer; transition: opacity 0.15s; }
.goi-tag-clickable:hover { opacity: 0.7; }

.goi-term-nuance { margin: 0 0 8px; font-size: 0.92em; color: #3a3a4a; line-height: 1.65; }
.goi-term-example { margin: 8px 0; padding: 10px 14px; background: #f8f6ff; border-left: 3px solid #9b8fe8; border-radius: 0 4px 4px 0; font-size: 0.88em; color: #333; line-height: 1.6; font-style: italic; }
.goi-term-note { padding: 8px 12px; background: #fdf8f0; border-left: 3px solid #e8a020; border-radius: 0 4px 4px 0; color: #7a5010; font-size: 0.88em; line-height: 1.5; margin-top: 8px; }
.goi-divider { border: 0; border-top: 1px solid #f0f0f0; margin: 8px 0; }
.goi-term-rel { font-size: 0.88em; color: #555; }
.goi-rel-tag { display: inline-block; background: #f5f5f5; border: 1px solid #e0e0e0; border-radius: 3px; padding: 2px 8px; margin: 2px 4px 2px 0; font-size: 0.84em; color: #6c5ce7; font-weight: 500; cursor: pointer; transition: background 0.1s; }
.goi-rel-tag:hover { background: #ede8ff; }
.goi-card-image-wrapper { width: 100%; margin-bottom: 10px; border-radius: 4px; overflow: hidden; border: 1px solid #eee; }
.goi-card-image { width: 100%; height: auto; object-fit: contain; max-height: 160px; background: #f8f8f8; display: block; }
.goi-articles-title { font-size: 0.9em; font-weight: bold; color: #444; margin: 0 0 6px; padding-bottom: 4px; border-bottom: 1px solid #eee; }
.goi-articles-list { margin: 0; padding-left: 16px; }
.goi-articles-list li { margin-bottom: 5px; font-size: 0.86em; line-height: 1.4; }
.goi-articles-link { color: #6c5ce7; text-decoration: none; word-break: break-all; }
.goi-articles-link:hover { text-decoration: underline; }

/* お気に入りプルダウン＋ボタン */
.goi-fav-wrap { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.goi-fav-shelf-select { font-size: 0.78em; padding: 3px 6px; border: 1px solid #ddd; border-radius: 4px; color: #555; background: #fff; cursor: pointer; max-width: 110px; }
.goi-fav-shelf-select:focus { outline: none; border-color: #f0a500; }
.goi-fav-btn { background: none; border: none; padding: 0; font-size: 1.3em; color: #ccc; cursor: pointer; line-height: 1; display: inline-flex; align-items: center; }
.goi-fav-btn:hover { color: #f0a500; }
.goi-fav-btn.goi-faved { color: #f0a500; }

/* ===== 画像オーバーレイ ===== */
.goi-img-overlay-bg { display:none; position:fixed; top:0; left:0; width:100%; height:100%; background:rgba(0,0,0,0.82); z-index:10000; justify-content:center; align-items:center; }
.goi-img-overlay-bg.goi-show { display:flex; }
.goi-img-overlay-inner { position:relative; max-width:90vw; max-height:90vh; display:flex; flex-direction:column; align-items:center; }
.goi-img-overlay-close { position:absolute; top:-14px; right:-14px; background:#fff; color:#333; border:none; border-radius:50%; width:32px; height:32px; font-size:1em; cursor:pointer; font-weight:bold; line-height:1; z-index:1; }
.goi-img-overlay-img { max-width:90vw; max-height:80vh; object-fit:contain; border-radius:4px; background:#fff; box-shadow:0 4px 24px rgba(0,0,0,0.5); }
.goi-img-overlay-caption { color:#eee; font-size:0.95em; margin-top:12px; text-align:center; }

/* ===== トースト通知 ===== */
.goi-toast { display: none; position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%); background: rgba(44,62,80,0.92); color: #fff; padding: 10px 24px; border-radius: 6px; font-size: 0.95em; font-weight: bold; z-index: 99999; pointer-events: none; white-space: nowrap; box-shadow: 0 4px 16px rgba(0,0,0,0.25); transition: opacity 0.3s; }

/* ===== マイベスト管理パネル ===== */
.goi-mybest-panel-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 16px; }
.goi-mybest-btn { padding: 7px 10px; background: #fff; border: 1px solid #d8d8d8; border-radius: 4px; font-size: 0.84em; color: #2c3e50; cursor: pointer; text-align: left; font-weight: 500; transition: border-color 0.15s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%; box-sizing: border-box; }
.goi-mybest-btn:hover { border-color: #6c5ce7; color: #6c5ce7; }
.goi-mybest-btn.goi-mybest-btn-active { border-color: #f0a500; background: #fffbf0; color: #d48800; font-weight: bold; }
.goi-mybest-card-area { }
.goi-mybest-expanded { margin-top: 8px; }
.goi-mybest-empty { color: #aaa; font-size: 0.82em; padding: 4px 2px; display: block; line-height: 1.5; }

.goi-shelf-item { display: flex; align-items: center; padding: 8px 14px 8px 22px; font-size: 0.84em; color: #3a3a3a; cursor: pointer; border-bottom: 1px solid #f0f0f0; transition: background 0.12s; user-select: none; font-weight: 500; border-left: 3px solid transparent; }
.goi-shelf-item:hover { background: #f8f8f8; }
.goi-shelf-item.goi-shelf-active { background: #fffbf0; color: #d48800; border-left-color: #f0a500; font-weight: bold; }

.goi-mybest-manage-header { margin-bottom: 16px; }
.goi-mybest-manage-title { font-size: 1.1em; color: #2c3e50; margin: 0 0 4px; border-bottom: 2px solid #f0a500; padding-bottom: 6px; }
.goi-mybest-manage-add { display: flex; gap: 8px; margin-bottom: 16px; }
.goi-shelf-name-input { flex: 1; padding: 8px 10px; border: 1px solid #ccc; border-radius: 4px; font-size: 0.9em; font-family: inherit; }
.goi-shelf-name-input:focus { outline: none; border-color: #f0a500; }
.goi-btn-shelf-add { background: #f0a500; color: #fff; border: none; border-radius: 4px; padding: 8px 14px; font-size: 0.88em; font-weight: bold; cursor: pointer; white-space: nowrap; }
.goi-btn-shelf-add:hover { background: #d48800; }
.goi-shelf-manage-list { display: flex; flex-direction: column; gap: 8px; }
.goi-shelf-manage-row { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid #e8e8e8; border-radius: 6px; background: #fafafa; }
.goi-shelf-manage-name { flex: 1; font-size: 0.9em; font-weight: bold; color: #2c3e50; }
.goi-shelf-manage-count { font-size: 0.78em; color: #888; margin-right: 4px; }
.goi-shelf-rename-input { flex: 1; padding: 5px 8px; border: 1px solid #f0a500; border-radius: 4px; font-size: 0.88em; font-family: inherit; }
.goi-btn-shelf-rename { background: #7f8c8d; color: #fff; border: none; border-radius: 4px; padding: 5px 10px; font-size: 0.8em; font-weight: bold; cursor: pointer; }
.goi-btn-shelf-rename:hover { background: #636e72; }
.goi-btn-shelf-delete { background: #c0392b; color: #fff; border: none; border-radius: 4px; padding: 5px 10px; font-size: 0.8em; font-weight: bold; cursor: pointer; }
.goi-btn-shelf-delete:hover { background: #a93226; }
.goi-shelf-manage-row.goi-shelf-editing .goi-shelf-manage-name { display: none; }
.goi-shelf-manage-row:not(.goi-shelf-editing) .goi-shelf-rename-input { display: none; }

/* ===== レスポンシブ ===== */
@media (max-width: 900px) { .goi-random-container, .goi-term-display-grid { grid-template-columns: repeat(2,1fr); } .goi-sidebar { width: 160px; } }
@media (max-width: 600px) { .goi-random-container, .goi-term-display-grid { grid-template-columns: 1fr; } .goi-term-item { flex-direction:column; } .goi-card-right { max-width:100%; } .goi-twocol-wrap { flex-direction: column; } .goi-sidebar { width: 100%; position: static; } .goi-main-area { padding-left: 0; padding-top: 16px; } }
