/* ==========================================================================
   FFXIV アイテム検索システム - リスト表示＆アコーディオン詳細スタイル
   (添付画像準拠ライトグレーテーマ)
   ========================================================================== */

:root {
    --bg-main: #ececec;
    --bg-card: #f8f9fa;
    --bg-input: #ffffff;
    --bg-header: #cccccc;
    --bg-detail: #cccccc;
    --border-color: #cfd4dc;
    --border-dark: #b0b5be;
    --border-bar: #7f7f7f;
    
    --text-primary: #111111;
    --text-secondary: #444444;
    --text-muted: #666666;
    
    /* レア度カラー */
    --rarity-common: #111111;       /* 通常: 黒 (1) */
    --rarity-green: #1f8b24;        /* 緑 (2) */
    --rarity-blue: #0070dd;         /* 青 (3) */
    --rarity-purple: #9438d4;       /* 紫 (4 / レリック等) */
    --rarity-ethereal: #ff70c5;     /* エーテリアル: 鮮やかなピンク (7) */

    --radius: 4px;
    --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN", "BIZ UDPGothic", "Meiryo", sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-main);
    line-height: 1.5;
    font-size: 14px;
    min-height: 100vh;
}

/* サイトヘッダー */
header.site-header {
    background: linear-gradient(180deg, #2b313c 0%, #1c2027 100%);
    border-bottom: 2px solid #5a6273;
    padding: 10px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 16px rgba(0,0,0,0.5);
    transition: all 0.2s ease;
}

header.site-header.sticky-header {
    position: sticky;
    top: 0;
    z-index: 600;
}

.site-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.site-title h1 {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.5px;
    margin: 0;
}

.site-title h1 a,
.site-title-link {
    color: #ffffff;
    text-decoration: none;
    cursor: pointer;
    transition: opacity 0.15s ease, color 0.15s ease;
}

.site-title-link:hover {
    opacity: 0.85;
    color: #c5d8f0;
}

.site-title .version-badge {
    background: #4a5468;
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
}

.header-meta {
    font-size: 12px;
    color: var(--text-secondary);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 16px;
}

/* 検索パネル (スティッキー固定 & 折りたたみ対応) */
.search-panel {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 0;
    margin-bottom: 20px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

.search-panel.sticky-panel {
    position: sticky;
    top: 54px; /* sticky-header 直下にピッタリ追従 */
    z-index: 500;
}

/* パネルヘッダーバー (開閉トリガー) */
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    cursor: pointer;
    user-select: none;
    border-radius: var(--radius);
    background-color: #edf1f7;
    transition: background-color 0.15s ease;
}

.panel-header:hover {
    background-color: #e2e7f0;
}

.search-panel:not(.collapsed) .panel-header {
    border-bottom: 1px solid var(--border-color);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.panel-title-content {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 14px;
    font-weight: bold;
    color: #111111;
}

.panel-icon {
    stroke: #3b6da1;
    flex-shrink: 0;
}

.panel-heading-text {
    white-space: nowrap;
    font-size: 14px;
    font-weight: bold;
    color: #111111;
}

.panel-summary-badges {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.summary-badge {
    display: inline-block;
    background-color: #ffffff;
    color: #2b4c7e;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
    border: 1px solid #b8c8dc;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.panel-toggle-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #3b6da1;
    flex-shrink: 0;
    padding-left: 10px;
}

.panel-toggle-btn .toggle-arrow {
    font-size: 10px;
    transition: transform 0.2s ease;
}

/* パネルボディ */
.panel-body {
    padding: 16px 18px 18px 18px;
    max-height: calc(85vh - 60px);
    overflow-y: auto;
}

/* 折りたたみ時 */
.search-panel.collapsed .panel-body {
    display: none;
}

.search-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 14px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-control {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 7px 10px;
    border-radius: 4px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}

.form-control:focus {
    border-color: #3b6da1;
}

.range-inputs {
    display: flex;
    align-items: center;
    gap: 6px;
}

.range-inputs input {
    width: 100%;
    text-align: center;
}

.range-inputs span {
    color: var(--text-muted);
}

/* オプション・ボタン */
.options-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--border-color);
    align-items: center;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    accent-color: #3b6da1;
    width: 15px;
    height: 15px;
}

.button-row {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 14px;
}

.btn {
    padding: 7px 18px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background-color: #3b6da1;
    color: #fff;
}

.btn-primary:hover {
    background-color: #2e5986;
}

.btn-secondary {
    background-color: #e2e5ea;
    color: #333;
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: #d0d5dd;
}

/* 検索件数バー */
.results-info-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding: 6px 12px;
    background-color: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    font-size: 13px;
    color: var(--text-secondary);
}

.results-info-bar b {
    color: #111111;
    font-size: 14px;
}

/* ==========================================================================
   アイテムリスト表示 (添付画像 media_1788604793034.png 再現スタイル)
   ========================================================================== */

.item-list-wrapper {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* 大分類ブロック帯 (添付画像の「武器」帯) */
.group-section {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.group-header {
    background-color: var(--bg-header);
    border: 1px solid var(--border-bar);
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 15px;
    font-weight: bold;
    color: #111111;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    margin-top: 6px;
}

.group-items-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 2px 0;
}

/* 各アイテム行 (1行表示) */
.item-entry {
    display: flex;
    flex-direction: column;
}

.item-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 4px;
    border-radius: 3px;
    user-select: none;
}

.item-row:hover {
    background-color: rgba(0, 0, 0, 0.04);
}

/* 小分類アイコン */
.item-uic-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    object-fit: contain;
    image-rendering: -webkit-optimize-contrast;
}

.item-uic-icon-placeholder {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

/* アイテムレベル (IL) */
.item-il {
    font-size: 13px;
    font-weight: bold;
    color: #111111;
    width: 46px;
    flex-shrink: 0;
}

/* 一覧行の実装バージョンバッジ */
.item-ver-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    color: #475569;
    background-color: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 3px;
    padding: 1px 5px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* アイテム名 (リンク) */
.item-link {
    font-size: 14px;
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    text-align: left;
    transition: opacity 0.15s;
}

.item-link:hover {
    opacity: 0.75;
}

/* レア度別のリンクカラー */
.item-link.rarity-1 { color: #111111; }             /* 通常: 黒/濃いグレー */
.item-link.rarity-2 { color: #1f8b24; }             /* 緑 */
.item-link.rarity-3 { color: #0070dd; }             /* 青 */
.item-link.rarity-4 { color: #9438d4; }             /* 紫 (レリック等) */
.item-link.rarity-7 { color: #ff70c5; }             /* エーテリアル: 鮮やかなピンク */

/* ==========================================================================
   アコーディオン展開詳細ボックス (添付画像完全再現)
   ========================================================================== */

.item-detail-drawer {
    display: none; /* 初期状態: 非表示 */
    background-color: var(--bg-detail);
    border: 1px solid var(--border-bar);
    border-radius: 4px;
    padding: 8px 12px;
    margin: 2px 0 6px 20px; /* 小分類アイコン分インデント */
    color: #111111;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.item-detail-drawer.open {
    display: block; /* 展開 */
    animation: fadeIn 0.12s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-2px); }
    to { opacity: 1; transform: translateY(0); }
}

.detail-loading {
    padding: 10px 14px;
    font-size: 13px;
    color: #666666;
    font-style: italic;
}

.detail-error {
    padding: 10px 14px;
    font-size: 13px;
    color: #c0392b;
}

/* 詳細ボックス内アイテム名 (コピー用 & コピーボタン) */
.detail-name-line {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 15px;
    font-weight: bold;
    margin-bottom: 5px;
    line-height: 1.3;
    user-select: text;
}
.detail-name-line.rarity-1 { color: #111111; }
.detail-name-line.rarity-2 { color: #1f8b24; }
.detail-name-line.rarity-3 { color: #0070dd; }
.detail-name-line.rarity-4 { color: #9438d4; }
.detail-name-line.rarity-7 { color: #ff70c5; }

.detail-name-text {
    cursor: text;
    user-select: all;
}

/* クリップボードコピーボタン */
.btn-copy-item-name {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 1px 7px;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.3;
    color: #475569;
    background-color: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    vertical-align: middle;
}

.btn-copy-item-name:hover {
    background-color: #e2e8f0;
    color: #0f172a;
    border-color: #94a3b8;
}

.btn-copy-item-name:active {
    transform: scale(0.96);
}

.btn-copy-item-name .copy-icon {
    flex-shrink: 0;
    stroke: currentColor;
}

.btn-copy-item-name.copied {
    background-color: #dcfce7;
    color: #15803d;
    border-color: #86efac;
}

/* 詳細ボックス内上部 */
.detail-header-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    font-weight: bold;
    color: #111111;
    margin-bottom: 4px;
}

.detail-version-tag {
    font-size: 11px;
    font-weight: 600;
    color: #1e3a8a;
    background-color: #dbeafe;
    border: 1px solid #bfdbfe;
    border-radius: 3px;
    padding: 1px 6px;
    white-space: nowrap;
}

.detail-equip-line {
    font-size: 13px;
    color: #222222;
    margin-bottom: 2px;
}

.detail-flags-line {
    font-size: 13px;
    color: #222222;
    margin-bottom: 4px;
}

.detail-desc-line {
    font-size: 12px;
    color: #444444;
    margin-bottom: 6px;
    line-height: 1.4;
}

/* NQ段 / HQ段の行スタイル (添付画像再現) */
.detail-tier-row {
    display: flex;
    gap: 10px;
    align-items: center;
    border-top: 1px solid #888888;
    padding: 6px 0;
}

.tier-icon-box {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
}

.tier-icon {
    width: 44px;
    height: 44px;
    border: 1px solid #777777;
    border-radius: 3px;
    display: block;
    background-color: #222222;
    object-fit: cover;
}

.tier-icon.hq-fallback-glow {
    filter: drop-shadow(0 0 5px #ffd700) brightness(1.1);
}

.tier-specs-box {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 13px;
    color: #111111;
}

.tier-stats-line {
    font-size: 13px;
    color: #111111;
    font-weight: normal;
    white-space: normal;
    word-break: break-word;
}

.tier-params-line {
    font-size: 13px;
    color: #111111;
    white-space: normal;
    word-break: break-word;
}

/* 付帯ステータスタグ群 */
.detail-tags-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px dashed #999999;
    font-size: 11px;
}

.dtag {
    padding: 1px 6px;
    border-radius: 3px;
    border: 1px solid #999999;
    background-color: #d8d8d8;
    color: #333333;
}

.dtag.ok {
    border-color: #7ba87a;
    background-color: #e2ede2;
    color: #215c21;
}

.dtag.ng {
    border-color: #bbb;
    background-color: #e8e8e8;
    color: #777;
}

.dtag-price {
    border-color: #c9b37a;
    background-color: #f7f3e8;
    color: #785a1a;
}

/* ==========================================================================
   ページネーション & フッター
   ========================================================================== */

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin: 20px 0;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 13px;
    transition: all 0.2s;
}

.page-link:hover {
    background-color: #e4e7ec;
    border-color: #999;
}

.page-link.active {
    background-color: #3b6da1;
    color: #ffffff;
    border-color: #3b6da1;
    font-weight: bold;
}

footer.site-footer {
    text-align: center;
    padding: 24px 16px;
    margin-top: 30px;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 12px;
    background-color: #e2e4e8;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    header.site-header {
        padding: 8px 12px;
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    .search-panel.sticky-panel {
        top: 58px;
    }
    .container {
        padding: 10px;
    }
    .search-grid {
        grid-template-columns: 1fr;
    }
    .form-group[style*="grid-column: span 2;"] {
        grid-column: span 1 !important;
    }
    .item-detail-drawer {
        margin-left: 6px;
        padding: 8px;
    }
}

/* ==========================================================================
   製作レシピ・使用レシピ タブエリア (参考画像完全再現)
   ========================================================================== */

.recipe-panel {
    border: 1px solid #b8b3ab;
    border-radius: 4px;
    margin-top: 14px;
    background-color: #f6f5f0;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.recipe-tab-header {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 6px 8px 0;
    background-color: #ded9d0;
    border-bottom: 1px solid #b8b3ab;
}

.recipe-tab-btn {
    border: 1px solid #b8b3ab;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    background: #ebe6dc;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    color: #4a453f;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
}

.recipe-tab-btn:hover {
    background: #faf8f5;
}

.recipe-tab-btn.active {
    background: #f6f5f0;
    color: #1a1917;
    border-color: #b8b3ab;
    border-bottom: 1px solid #f6f5f0;
    margin-bottom: -1px;
    font-weight: bold;
}

.recipe-tab-body {
    padding: 14px 18px;
    background-color: #f6f5f0;
}

.recipe-tab-pane {
    display: none;
}

.recipe-tab-pane.active {
    display: block;
}

/* レシピ諸元 (完成数、工数、耐久、品質) */
.recipe-specs-box {
    margin-bottom: 12px;
}

.recipe-spec-line {
    font-size: 13px;
    color: #222222;
    margin-bottom: 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.recipe-spec-line .spec-item {
    font-weight: 500;
}

/* 必要作業精度・加工精度・秘伝書の赤文字アラート */
.recipe-condition-line {
    font-size: 12px;
    font-weight: bold;
    color: #cc0000;
    margin-top: 6px;
    margin-bottom: 6px;
    padding: 2px 0;
}

/* 製作素材セクション */
.recipe-ingredients-section {
    margin-top: 10px;
    border-top: 1px dashed #d1ccc4;
    padding-top: 10px;
}

.recipe-section-title {
    font-size: 13px;
    font-weight: bold;
    margin-bottom: 8px;
    color: #333333;
}

.recipe-ingredients-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.recipe-ingredient-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.ingredient-icon-wrap,
.used-recipe-icon-wrap {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1e1e1e;
    border-radius: 3px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.ingredient-icon,
.used-recipe-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    display: block;
}

.ingredient-amount {
    color: #444444;
    font-size: 13px;
    font-weight: 500;
    margin-left: 2px;
}

/* 使用レシピ一覧 */
.used-recipes-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.used-recipe-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.used-recipe-meta {
    color: #555555;
    font-size: 12px;
    margin-left: 2px;
}

/* 項目ラッパー (インライン展開用) */
.recipe-ingredient-item-wrapper,
.used-recipe-item-wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* インラインレシピ展開コンテナ (ツリー状インデント) */
.inline-recipe-drawer {
    margin: 6px 0 8px 16px;
    padding: 2px 0 2px 8px;
    border-left: 3px solid #3b6da1;
    background-color: rgba(0, 0, 0, 0.03);
    border-radius: 0 4px 4px 0;
    animation: inlineDrawerFade 0.2s ease-out;
}

@keyframes inlineDrawerFade {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.inline-loading,
.inline-no-recipe {
    padding: 8px 12px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* インライン展開用レシピパネル */
.inline-recipe-panel {
    margin-top: 4px;
    margin-bottom: 4px;
    background-color: #faf9f6;
    border: 1px solid #c2bcb3;
    border-radius: 4px;
    overflow: hidden;
}

.inline-recipe-panel .recipe-tab-header {
    background-color: #d6d0c5;
}

.inline-recipe-panel .recipe-tab-btn {
    background: #e3ded5;
    font-size: 12px;
    padding: 4px 10px;
}

.inline-recipe-panel .recipe-tab-btn.active {
    background: #faf9f6;
}

.inline-recipe-panel .recipe-tab-body {
    padding: 10px 14px;
    background-color: #faf9f6;
}

/* インライン展開トグルボタン (リンク風) */
.inline-recipe-toggle {
    background: none;
    border: none;
    padding: 0;
    font-size: 13px;
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
    text-align: left;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: opacity 0.15s;
}

.inline-recipe-toggle:hover {
    opacity: 0.75;
}

.inline-toggle-arrow {
    font-size: 9px;
    color: #64748b;
    display: inline-block;
    transition: transform 0.15s;
    user-select: none;
}

/* レシピを持たない素材 (プレーンテキスト) */
.ingredient-name-plain {
    font-size: 13px;
    font-weight: normal;
    text-decoration: none;
    cursor: default;
}

/* レア度別のカラークラス */
.inline-recipe-toggle.rarity-1, .ingredient-name-plain.rarity-1, .modal-item-link.rarity-1 { color: #111111; }
.inline-recipe-toggle.rarity-2, .ingredient-name-plain.rarity-2, .modal-item-link.rarity-2 { color: #1f8b24; }
.inline-recipe-toggle.rarity-3, .ingredient-name-plain.rarity-3, .modal-item-link.rarity-3 { color: #0070dd; }
.inline-recipe-toggle.rarity-4, .ingredient-name-plain.rarity-4, .modal-item-link.rarity-4 { color: #9438d4; }
.inline-recipe-toggle.rarity-7, .ingredient-name-plain.rarity-7, .modal-item-link.rarity-7 { color: #ff70c5; }

/* モーダル表示用アイテムリンク */
.modal-item-link {
    background: none;
    border: none;
    padding: 0;
    font-size: 13px;
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
    text-align: left;
    transition: opacity 0.15s;
}

.modal-item-link:hover {
    opacity: 0.75;
}

/* ==========================================================================
   アイテム詳細モーダルダイアログ (ポップアップ表示)
   ========================================================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    background-color: rgba(0, 0, 0, 0.65);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(3px);
}

.modal-dialog {
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    width: 100%;
    max-width: 680px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #94a3b8;
    animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.96) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    background: linear-gradient(180deg, #303746 0%, #202530 100%);
    color: #ffffff;
    border-bottom: 2px solid #eab308;
    flex-shrink: 0;
}

.modal-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
}

.modal-title {
    font-size: 15px;
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.modal-back-btn {
    background: #475569;
    border: 1px solid #64748b;
    color: #ffffff;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}

.modal-back-btn:hover {
    background: #64748b;
}

.modal-close-btn {
    background: none;
    border: none;
    color: #cbd5e1;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    transition: color 0.15s;
}

.modal-close-btn:hover {
    color: #ffffff;
}

.modal-body {
    padding: 16px;
    overflow-y: auto;
    background-color: var(--bg-detail);
    flex-grow: 1;
}

.modal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    gap: 12px;
}

.modal-loading .spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e2e8f0;
    border-top-color: #3b6da1;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==========================================================================
   ショップ・交換NPCタブスタイル (添付画像再現)
   ========================================================================== */
.shop-gil-container,
.shop-exchange-container {
    padding: 12px 14px;
    font-size: 13px;
    color: #111111;
}

.shop-price-header {
    font-size: 14px;
    margin-bottom: 12px;
    color: #111111;
}

.shop-price-header strong {
    font-weight: bold;
}

.shop-entry-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.shop-npc-entry {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.shop-npc-name {
    font-weight: bold;
    display: flex;
    align-items: center;
    color: #111111;
}

.shop-npc-loc {
    padding-left: 18px;
    display: flex;
    align-items: center;
    color: #222222;
}

/* 販売NPC エリア別ブロック */
.shop-area-blocks {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.shop-area-block {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.shop-area-heading {
    font-size: 13px;
    font-weight: bold;
    color: #111111;
    margin-bottom: 2px;
}

.shop-area-npc-list {
    list-style: none;
    margin: 0;
    padding-left: 14px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.shop-area-npc-item {
    display: flex;
    align-items: baseline;
    gap: 6px;
    font-size: 12.5px;
    color: #222222;
    line-height: 1.4;
}

.shop-npc-coord {
    color: #333333;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.shop-npc-name-text {
    color: #111111;
}

.shop-svg-icon {
    flex-shrink: 0;
    color: #111111;
}

/* 交換NPCカード */
.shop-trade-card {
    padding: 8px 0;
}

.shop-trade-card.card-divider {
    border-top: 1px solid #999999;
    margin-top: 12px;
    padding-top: 14px;
}

.trade-item-row {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
    font-size: 13px;
}

.trade-row-label {
    font-weight: normal;
    min-width: 44px;
    color: #111111;
}

.trade-row-items {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.trade-item-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.trade-mini-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
    vertical-align: middle;
    border: 1px solid #777777;
    border-radius: 2px;
    background-color: #222222;
}

.trade-item-name {
    color: #111111;
    font-weight: 500;
}

.trade-item-count {
    color: #111111;
    font-weight: normal;
}

.trade-shops-list {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.trade-shop-entry {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.trade-shop-title {
    font-weight: bold;
    display: flex;
    align-items: center;
    color: #111111;
}

.trade-loc-list {
    list-style: none;
    margin: 0;
    padding-left: 18px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.trade-loc-list li {
    display: flex;
    align-items: center;
    color: #222222;
}

/* スポットリンク (ショップNPC) */
.shop-npc-spot-link {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    color: inherit;
    text-decoration: none;
    border-radius: 4px;
    padding: 1px 4px;
    margin: -1px -4px;
    transition: background-color 0.15s, color 0.15s;
    cursor: pointer;
}

.shop-npc-spot-link:hover {
    background-color: #e0f2fe;
    color: #0284c7;
}

.shop-npc-spot-link:hover .shop-npc-name-text {
    text-decoration: underline;
}

.shop-spot-icon {
    font-size: 13px;
    opacity: 0.7;
    margin-left: 2px;
}

.shop-npc-spot-link:hover .shop-spot-icon {
    opacity: 1;
}

/* スポットモーダル (二重オーバーレイ対応: アイテムモーダルの手前に表示) */
#spotDetailModal {
    z-index: 10100;
}

#spotDetailModal .modal-dialog {
    max-width: 1040px;
    width: 95vw;
    height: 90vh;
    max-height: 820px;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    box-sizing: border-box;
}

#spotDetailModal .modal-body {
    flex: 1;
    padding: 0;
    overflow: hidden;
}

.spot-iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* マップ画像なしバッジ */
.shop-no-map-badge {
    display: inline-block;
    font-size: 10px;
    line-height: 1.3;
    padding: 1px 5px;
    margin: 0 4px;
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #cbd5e1;
    border-radius: 3px;
    font-weight: 600;
    vertical-align: 1px;
    letter-spacing: 0.02em;
}

/* ==========================================================================
   コンテンツ (Duty) 報酬タブ・リスト表示
   ========================================================================== */

.duty-rewards-list {
    list-style: none;
    margin: 0;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.duty-reward-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 13px;
    line-height: 1.4;
    transition: background 0.15s, border-color 0.15s;
}

.duty-reward-item:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.duty-reward-icon-wrap {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.duty-reward-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    display: block;
}

.duty-reward-name {
    font-weight: 600;
    color: #1e293b;
}

.duty-reward-category {
    font-size: 12px;
    color: #64748b;
    font-weight: normal;
}

/* ==========================================================================
   アチーブメント (Achievement) 報酬タブ・リスト表示
   ========================================================================== */

.achievement-rewards-list {
    list-style: none;
    margin: 0;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.achievement-reward-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.4;
    transition: background 0.15s, border-color 0.15s;
}

.achievement-reward-item:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.achievement-reward-header {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.achievement-reward-icon-wrap {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.achievement-reward-icon {
    width: 28px;
    height: 28px;
    object-fit: contain;
    display: block;
}

.achievement-reward-title-wrap {
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.achievement-reward-name {
    font-weight: 600;
    color: #1e293b;
    font-size: 13.5px;
}

.achievement-reward-category {
    font-size: 12px;
    color: #64748b;
    font-weight: normal;
}

.achievement-reward-points {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #fffbeb;
    border: 1px solid #fef3c7;
    color: #b45309;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    margin-left: auto;
}

.achievement-reward-desc {
    font-size: 12.5px;
    color: #334155;
    background: #ffffff;
    padding: 8px 10px;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
    line-height: 1.5;
}

.achievement-sub-conditions {
    margin-top: 4px;
    padding: 8px 10px;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
}

.achievement-sub-conditions-title {
    font-size: 11.5px;
    font-weight: 700;
    color: #475569;
    margin-bottom: 6px;
}

.achievement-subs-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.achievement-subs-list.depth-2 {
    margin-top: 4px;
    margin-left: 14px;
    padding-left: 8px;
    border-left: 2px solid #cbd5e1;
    gap: 4px;
}

.achievement-sub-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 12px;
}

.achievement-sub-item-header {
    display: flex;
    align-items: baseline;
    gap: 5px;
}

.achievement-sub-bullet {
    color: #64748b;
    font-size: 11px;
}

.achievement-sub-name {
    font-weight: 600;
    color: #1e293b;
}

.achievement-sub-desc {
    color: #475569;
    padding-left: 12px;
    line-height: 1.4;
    font-size: 11.5px;
}

/* ==========================================================================
   採集タブ用スタイル
   ========================================================================== */
.gathering-spots-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.gathering-spot-item {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
    transition: all 0.15s ease;
}

.gathering-spot-item:hover {
    border-color: #cbd5e1;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.gathering-spot-link {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 12px;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s ease;
}

.gathering-spot-link:hover {
    background: #f8fafc;
}

.gathering-spot-plain {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 12px;
}

.gathering-spot-main {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 13px;
}

.gathering-type-icon-wrap {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gathering-type-icon {
    width: 22px;
    height: 22px;
    object-fit: contain;
}

.gathering-spot-level {
    font-weight: 700;
    color: #0f172a;
}

.gathering-spot-point-name {
    font-weight: 600;
    color: #475569;
}

.gathering-spot-area {
    font-weight: 600;
    color: #0284c7;
}

.gathering-spot-place {
    color: #64748b;
    font-size: 12px;
}

.gathering-spot-coord {
    font-family: monospace;
    font-size: 12px;
    color: #475569;
    background: #f1f5f9;
    padding: 1px 5px;
    border-radius: 3px;
    border: 1px solid #e2e8f0;
}

.gathering-spot-map-icon {
    font-size: 14px;
    margin-left: auto;
    opacity: 0.8;
}

.gathering-spot-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    margin-left: 30px;
}

.gathering-badge {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 4px;
    line-height: 1.3;
    font-weight: 600;
}

.badge-node-2 {
    background: #faf5ff;
    color: #7e22ce;
    border: 1px solid #e9d5ff;
}

.badge-node-4 {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

.badge-node-3,
.badge-node-5 {
    background: #fef3c7;
    color: #b45309;
    border: 1px solid #fcd34d;
}

.badge-pop-time {
    background: #f8fafc;
    color: #334155;
    border: 1px solid #cbd5e1;
    font-family: monospace;
}

.badge-folklore {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

.badge-perception {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.badge-hidden {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.badge-time {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    font-family: monospace;
}

.badge-weather {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.badge-predator {
    background: #faf5ff;
    color: #7e22ce;
    border: 1px solid #e9d5ff;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-snagging {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.badge-gathering {
    background: #f8fafc;
    color: #475569;
    border: 1px solid #e2e8f0;
}

/* 漁師タブ内5段表示レイアウト */
.fishing-tab-badges {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 6px;
    align-items: flex-start;
}

.fishing-tab-line {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.fishing-baits-wrap {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.fishing-bait-label {
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    margin-right: 2px;
}

.fishing-bait-badge,
.fishing-baits-wrap .table-cost-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 1px 6px 1px 2px;
    font-size: 12px;
    color: #1e293b;
    line-height: 1.2;
}

.fishing-bait-badge.modal-item-link {
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
    user-select: none;
}

.fishing-bait-badge.modal-item-link:hover {
    background: #e2e8f0;
    border-color: #94a3b8;
    color: #0369a1;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.fishing-bait-badge.modal-item-link:hover .fishing-bait-name {
    text-decoration: underline;
    text-underline-offset: 2px;
}

.fishing-bait-icon,
.fishing-baits-wrap .table-cost-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    background: #1e1e1e;
    border-radius: 3px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    display: block;
    flex-shrink: 0;
}

/* 精選 (Aetherial Reduction) タブスタイル */
.reduction-container {
    padding: 10px 0;
}

.reduction-group-section {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 14px 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.reduction-group-title {
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #f1f5f9;
}

.reduction-title-main {
    display: flex;
    align-items: center;
    gap: 10px;
}

.reduction-title-badge {
    font-size: 12px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 4px;
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
    letter-spacing: 0.03em;
}

.reduction-title-badge-source {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

.reduction-title-text {
    font-size: 12px;
    color: #64748b;
}

.reduction-item-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.reduction-item-wrapper {
    display: flex;
    flex-direction: column;
}

.reduction-item-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    transition: background-color 0.15s, border-color 0.15s;
}

.reduction-item-row:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.reduction-icon-wrap {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.reduction-item-icon {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    object-fit: contain;
}

.reduction-item-category {
    font-size: 12px;
    color: #64748b;
    margin-left: 2px;
}

.reduction-item-il {
    font-size: 11px;
    font-weight: 600;
    color: #475569;
    background: #e2e8f0;
    padding: 2px 7px;
    border-radius: 4px;
    margin-left: auto;
    flex-shrink: 0;
}


