/* 卡牌圖鑑列表/詳細彈窗樣式(原內嵌於 Cards.tpl,2026-09-07 外移) */
  :root {
    --bg: #16181d; --panel: #1f232b; --panel2: #262b35;
    --text: #e8eaed; --muted: #9aa0a8; --accent: #ffcb05; --line: #333a46;
  }
  body { background: var(--bg); color: var(--text); }
  #pokedex { font-family: "Hiragino Sans", "Noto Sans JP", "PingFang TC", sans-serif; }
  #pokedex * { box-sizing: border-box; }
  .pkdx-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
  .pkdx-filter-label { color: var(--muted); font-size: 13.5px; margin-right: 6px; }
  .pkdx-bar select { padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line);
                     background: var(--panel2); color: var(--text); }
  .pkdx-listbar { display: flex; justify-content: flex-end; margin-bottom: 10px; }
  .pkdx-count { color: var(--muted); font-size: 13px; }
  .pkdx-main { padding: 18px 20px 60px; max-width: 1200px; margin: 0 auto; }
  .pkdx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 18px; }
  .pkdx-grid .card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
          padding: 10px; cursor: pointer; transition: transform .12s, border-color .12s; }
  .pkdx-grid .card:hover { transform: translateY(-3px); border-color: var(--accent); }
  .pkdx-grid .card img { width: 100%; aspect-ratio: 63/88; object-fit: contain; border-radius: 6px;
              background: #0e1013; display: block; }
  .pkdx-grid .card .nm { font-size: 14.5px; margin-top: 8px; white-space: nowrap; overflow: hidden;
              text-overflow: ellipsis; }
  .pkdx-grid .card .sub { font-size: 12.5px; color: var(--muted); }
  .serialRow { display: flex; align-items: baseline; gap: 6px; }
  .serialRow .serial { flex: 1; min-width: 0; margin-left: 3px; }
  .serialRow .rar { color: var(--muted); font-family: "Fjalla One", monospace;
                    font-size: 12px; white-space: nowrap; }
  .subTitle { font-size: .55em; font-weight: 600; color: var(--muted);
              margin-left: 10px; vertical-align: middle; white-space: nowrap; }
  .subTitle .copyable { color: var(--accent); }
  .subTitle .aliasEdit { color: var(--muted); font-size: .9em; }
  .subTitle .aliasEdit:hover { color: var(--accent); }
  .pkdx-grid .card .serial { color: var(--accent); opacity: .8; white-space: nowrap; overflow: hidden;
                  text-overflow: ellipsis; font-family: "Fjalla One", monospace; margin-left: 3px; }
  .pkdx-grid .card .priceLine { display: flex; align-items: center; justify-content: space-between;
                     gap: 6px; min-width: 0;
                     margin-top: 7px; padding-top: 7px; border-top: 1px solid var(--line); }
  .pkdx-grid .card .priceVal { font-size: 13px; font-weight: 800; color: #ff5b5b;
                    font-family: "Fjalla One", monospace; letter-spacing: .3px;
                    min-width: 0; white-space: nowrap; }
  .pkdx-grid .card .priceVal.none { color: var(--muted); font-weight: 400; }
  .pkdx-grid .card .gradeBadge { flex: 0 0 auto; padding: 2px 8px; border-radius: 8px;
                      border: 2px solid var(--accent);
                      color: var(--accent); font-size: 11px; font-weight: 800;
                      font-family: "Fjalla One", monospace; letter-spacing: .5px; }
  .pkdx-grid .card .gradeBadge.alt { border-color: #7fa6c9; color: #7fa6c9; }  /* 非 PSA10 後備等級 */
  /* 市場行情區塊 */
  .gradeTabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
  .gradeTab { padding: 4px 14px; border-radius: 16px; border: 1px solid var(--line);
              background: var(--panel2); color: var(--muted); cursor: pointer; font-size: 13px; }
  .gradeTab.on { border-color: var(--accent); color: var(--accent); font-weight: 700; }
  /* 行情更新中 loading 指示 */
  .mktSpin { display: inline-block; width: 11px; height: 11px; margin-right: 6px;
             border: 2px solid var(--line); border-top-color: var(--accent);
             border-radius: 50%; vertical-align: -2px;
             animation: mktspin .8s linear infinite; }
  @keyframes mktspin { to { transform: rotate(360deg); } }
  .priceRow { display: flex; gap: 24px; margin: 6px 0 10px; font-size: 14.5px; }
  .priceRow b { color: #6fcf7c; font-family: "Fjalla One", monospace; }
  /* 成交記錄圖表（每週均價折線 + 成交量長條） */
  .soldBox { border: 1px solid var(--line); border-radius: 10px; background: var(--panel2);
             padding: 10px 12px 6px; margin: 4px 0 14px; }
  .soldHead { display: flex; justify-content: space-between; align-items: baseline;
              flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; color: var(--muted); }
  .soldHead .latest b { color: #6fcf7c; font-family: "Fjalla One", monospace; font-size: 15px; }
  .soldFlex { display: flex; gap: 14px; align-items: stretch; }
  .soldFlex svg { flex: 1; min-width: 0; display: block; }
  .soldStats { flex: 0 0 auto; display: flex; flex-direction: column; justify-content: center;
               gap: 3px; font-size: 12.5px; color: var(--muted); padding: 6px 0 14px;
               white-space: nowrap; }
  .soldStats .hd { font-size: 11.5px; border-bottom: 1px solid var(--line); padding-bottom: 3px;
                   margin-bottom: 2px; }
  .soldStats b { color: var(--text, #e8eaed); font-family: "Fjalla One", monospace;
                 font-weight: 400; margin-left: 6px; }
  @media (max-width: 720px) {
    .soldFlex { flex-direction: column; gap: 4px; }
    .soldStats { flex-direction: row; gap: 12px; padding: 0 0 6px; }
    .soldStats .hd { border: none; margin: 0; padding: 0; }
  }
  .lst { display: flex; flex-wrap: wrap; gap: 8px; }
  .lst a { display: inline-block; padding: 4px 12px; border: 1px solid var(--line);
           border-radius: 8px; background: var(--panel2); color: #6fcf7c;
           text-decoration: none; font-family: "Fjalla One", monospace; font-size: 13.5px; }
  .lst a:hover { border-color: #6fcf7c; }
  /* 在售刊登：實拍圖水平捲動列 */
  .lstRow { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: thin; }
  .lstRow a { flex: 0 0 108px; text-decoration: none; border: 1px solid var(--line);
              border-radius: 10px; background: var(--panel2); padding: 6px;
              transition: border-color .12s; }
  .lstRow a:hover { border-color: #6fcf7c; }
  .lstRow img { width: 100%; aspect-ratio: 63/88; object-fit: cover; border-radius: 6px;
                background: #0e1013; display: block; }
  .lstRow .p { text-align: center; color: #6fcf7c; font-family: "Fjalla One", monospace;
               font-size: 13px; margin-top: 5px; }
  /* 點擊複製 */
  .copyable { cursor: pointer; }
  .copyable:hover { text-decoration: underline dotted; text-underline-offset: 4px; }
  .copyable.copied::after { content: " ✓ 已複製"; color: #6fcf7c; font-size: 12px; font-weight: 400; }
  .pkdx-pager { display: flex; gap: 10px; justify-content: center; align-items: center; margin: 26px 0 0; }
  .pkdx-pager button { padding: 8px 18px; border-radius: 8px; border: 1px solid var(--line);
                  background: var(--panel2); color: var(--text); cursor: pointer; }
  .pkdx-pager button:disabled { opacity: .35; cursor: default; }
  .pkdx-empty { text-align: center; color: var(--muted); padding: 60px 0; }
  /* 詳細彈窗 */
  .pkdx-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.7); display: none;
             z-index: 50; padding: 22px; }
  .pkdx-overlay.show { display: block; }
  /* overlay 在 #pokedex 外，吃不到那邊的 border-box reset——height 需含 padding/border，
     否則彈窗底邊會超出視窗（上/左/右 22px 留白、下方被吃掉） */
  .pkdx-modal { max-width: 1400px; margin: 0 auto; height: calc(100vh - 44px);
           box-sizing: border-box;
           background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
           display: flex; gap: 36px; padding: 30px 40px; position: relative; overflow: hidden;
           color: var(--text); }
  .pkdx-modal .left { flex: 0 0 min(420px, 40vw); overflow: hidden; min-height: 0; }
  .pkdx-modal .left img { width: 100%; border-radius: 12px; background: #0e1013; }
  .pkdx-modal .right { flex: 1; min-width: 0; font-size: 15px; overflow-y: auto;
                  min-height: 0; padding-right: 10px; padding-bottom: 25px; }
  .pkdx-modal .right p { font-size: 15px; }
  /* 左欄：編號 / 圖鑑資料盒（參考官網版式） */
  .serialLine { font-family: "Fjalla One", monospace; color: var(--accent);
                margin-top: 12px; font-size: 16px; letter-spacing: .5px; }
  .dexBox { border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px;
            margin-top: 12px; font-size: 14px; }
  .dexBox .noline { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 700; }
  .dexBox hr { border: 0; border-top: 1px solid var(--line); margin: 10px 0; }
  .dexBox p { margin: 0; color: var(--muted); line-height: 1.7; }
  .psaChips { display: flex; flex-wrap: wrap; gap: 6px; margin: -8px 0 14px; }
  .psaChips .psaChip { border: 1px solid var(--line); border-radius: 8px; padding: 3px 9px;
                       font-size: 12px; color: var(--muted); background: var(--panel2); }
  .psaChips .psaChip b { color: var(--text); font-family: "Fjalla One", monospace; }
  .psaPop .psaItem.total { border-color: var(--accent); }
  .psaPop { display: flex; gap: 10px; margin: 4px 0 14px; }
  .psaPop .psaItem { flex: 1; border: 1px solid var(--line); border-radius: 10px;
                     background: var(--panel2); padding: 10px 14px; display: flex;
                     flex-direction: column; gap: 3px; }
  .psaPop .psaLbl { color: var(--muted); font-size: 12px; }
  .psaPop .psaItem b { font-size: 20px; font-family: "Fjalla One", monospace; }
  .underCard { display: flex; justify-content: space-between; align-items: baseline; margin-top: 10px; }
  .illusInline { color: var(--muted); font-size: 13px; font-family: "Fjalla One", monospace; }
  .pkdx-modal h2 { margin: 0 0 4px; }
  .pkdx-modal .meta { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
  .pkdx-modal h3 { font-size: 14px; color: var(--accent); margin: 16px 0 6px;
                   border-bottom: 1px solid var(--line); padding-bottom: 4px; }
  .pkdx-modal p { margin: 6px 0; font-size: 14px; line-height: 1.65; white-space: pre-wrap; }
  /* 貼齊面板右上角內側：面板置中(max 1400px)、外距 22px，取兩者較大的偏移 */
  .pkdx-close { position: fixed; top: 38px;
           right: max(38px, calc((100vw - 1400px) / 2 + 16px));
           font-size: 34px; color: var(--muted);
           cursor: pointer; background: var(--panel2); border: 1px solid var(--line);
           border-radius: 50%; width: 48px; height: 48px; line-height: 44px; z-index: 60; }
  .pkdx-close:hover { color: var(--text); border-color: var(--accent); }
  .langTag { display: inline-block; padding: 0 5px; margin-right: 5px; border-radius: 4px;
             font-size: 10.5px; line-height: 16px; vertical-align: 1px; font-weight: 600;
             color: #ffd97a; border: 1px solid rgba(255,217,122,.45); }
  .chip { display: inline-block; width: 18px; height: 18px; border-radius: 50%; font-size: 11px;
          line-height: 18px; text-align: center; color: #fff; font-weight: 700; vertical-align: -3px;
          margin: 0 1px; text-shadow: 0 1px 1px rgba(0,0,0,.5); }
  .stat-table { font-size: 13.5px; border-collapse: collapse; margin-top: 4px; }
  .stat-table td, .stat-table th { border: 1px solid var(--line); padding: 5px 12px; text-align: center; }
  .stat-table th { color: var(--muted); font-weight: 500; }
  .mv { margin: 10px 0; }
  .mv .nm { font-weight: 700; }
  .mv .dmg { float: right; font-weight: 800; color: var(--accent); }
  .tag { display: inline-block; background: var(--panel2); border: 1px solid var(--line);
         border-radius: 6px; padding: 2px 8px; font-size: 12px; margin: 2px 4px 2px 0; color: var(--muted); }
  /* 收藏：卡圖左上愛心 toggle + 等級/入手價面板 */
  .imgWrap { position: relative; }
  .pfHeart { position: absolute; top: 10px; left: 10px; width: 44px; height: 44px;
           border-radius: 50%; border: 1px solid rgba(255,255,255,.25); padding: 0;
           background: rgba(14,16,19,.68); color: #cfd3da; font-size: 19px;
           text-align: center; cursor: pointer;
           backdrop-filter: blur(2px); transition: transform .12s, color .12s; }
  .pfHeart:hover { transform: scale(1.12); }
  .pfHeart.on { color: #ff5b7d; border-color: rgba(255,91,125,.55);
           filter: drop-shadow(0 0 6px rgba(255,91,125,.5)); }
  /* 浮動收藏面板：錨定在愛心下方、疊在卡圖上 */
  .pfPop { position: absolute; top: 62px; left: 10px; width: 252px; z-index: 6;
           background: rgba(23,26,33,.96); border: 1px solid var(--line);
           border-radius: 12px; padding: 12px 14px;
           box-shadow: 0 10px 28px rgba(0,0,0,.55); backdrop-filter: blur(3px); }
  .pfHead { display: flex; justify-content: space-between; align-items: baseline;
           font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }
  .pfHead a { color: var(--accent); text-decoration: none; }
  .pfHead a:hover { text-decoration: underline; }
  .pfHead .danger { color: #ff8a8a; }
  .pfPopClose { position: absolute; top: 6px; right: 9px; background: none; border: none;
           color: var(--muted); font-size: 15px; cursor: pointer; padding: 2px; }
  .pfPopClose:hover { color: var(--text); }
  .pfGrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .pfGrid label { font-size: 12px; color: var(--muted); display: block; }
  .pfGrid select, .pfGrid input { width: 100%; box-sizing: border-box; margin-top: 4px;
           padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line);
           background: var(--panel2); color: var(--text); font-size: 13.5px; }
  .pfSave { width: 100%; margin-top: 10px; padding: 8px; border: none; border-radius: 8px;
           background: var(--accent); color: #333; font-weight: 800; cursor: pointer;
           font-size: 13.5px; }
  .pfSave:hover { filter: brightness(1.08); }
  .pkdx-toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
           background: var(--panel2); border: 1px solid var(--accent); color: var(--text);
           border-radius: 10px; padding: 10px 22px; font-size: 14px; z-index: 99;
           display: none; }
  @media (max-width: 720px) {
    /* 手機版：彈窗改為「整體捲動」——overlay 當捲軸容器、modal 高度隨內容展開，
       min-height 用 dvh（動態視口）避免手機網址列造成 100vh 失準、捲不到底 */
    .pkdx-overlay { padding: 0; overflow-y: auto; }
    .pkdx-modal { flex-direction: column; padding: 14px 14px 48px; gap: 18px;
             height: auto; min-height: 100vh; min-height: 100dvh;
             max-width: none; border: none; border-radius: 0; overflow: visible; }
    .pkdx-modal .left { flex: none; overflow: visible; }
    .pkdx-modal .right { overflow: visible; height: auto; padding-right: 0; }
    .pkdx-close { position: fixed; top: 10px; right: 10px;
             width: 40px; height: 40px; line-height: 36px; font-size: 26px; }
  }
