/*
 * 物品数据库页面。共用 query.css 的站头/基础排版，这里只定义物品浏览
 * 特有的工具栏、结果行、详情面板与手机端就地展开。
 */
:root {
  --cat-weapon: #e0af68;
  --cat-armor: #7aa2f7;
  --cat-shadow: #bb9af7;
  --cat-card: #9ece6a;
  --cat-consumable: #f7768e;
  --cat-ammo: #e6c07b;
  --cat-pet: #7dcfff;
  --cat-cash: #ffd700;
  --cat-etc: #9aa3b2;
}

body.items-page { height: 100%; }

/* 左栏：搜索、分类、结果。与 commands/bonus/status 页共用
   query.css 的 .panes / aside / ul.results 骨架。 */
.isummary {
  font-size: 11.5px; color: var(--fg-dim); padding: 7px 14px;
  border-bottom: 1px solid var(--line); background: var(--bg-elev);
}
.isummary b { color: var(--fg); font-weight: 600; }

/* query.css 已给 ul.results flex:1/overflow-y:auto；这里只补行样式 */
ul#results { list-style: none; margin: 0; padding: 0; }
li.item-row {
  display: grid; grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px; padding: 9px 14px; border-bottom: 1px solid var(--line);
  cursor: pointer; align-items: center;
}
li.item-row:hover { background: var(--bg-elev2); }
li.item-row.sel { background: var(--bg-elev2); box-shadow: inset 3px 0 0 var(--accent); }
.item-icon {
  width: 44px; height: 44px; border-radius: 8px; border: 1px solid var(--line);
  background: #12151b; display: flex; align-items: center; justify-content: center;
  overflow: hidden; flex: none;
}
.item-icon img { width: 40px; height: 40px; image-rendering: auto; display: block; object-fit: contain; }
.item-icon svg { width: 28px; height: 28px; }
.cat-weapon { color: var(--cat-weapon); }
.cat-armor { color: var(--cat-armor); }
.cat-shadow { color: var(--cat-shadow); }
.cat-card { color: var(--cat-card); }
.cat-consumable { color: var(--cat-consumable); }
.cat-ammo { color: var(--cat-ammo); }
.cat-pet { color: var(--cat-pet); }
.cat-cash { color: var(--cat-cash); }
.cat-etc { color: var(--cat-etc); }

.item-main { min-width: 0; }
.item-name { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.item-name .n { font-size: 14px; color: var(--fg); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-name .id { font-family: var(--mono); font-size: 11px; color: var(--fg-dim); flex: none; }
.item-name .badge {
  font-size: 10.5px; padding: 1px 6px; border-radius: 4px; flex: none;
  border: 1px solid var(--line); color: var(--fg-dim); background: var(--bg-elev2);
}
.item-sum { font-size: 12px; color: var(--accent); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-sub { font-size: 11.5px; color: var(--fg-dim); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.imore { padding: 10px 14px; text-align: center; border-top: 1px solid var(--line); }
.imore button {
  background: var(--bg-elev2); color: var(--fg); border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 16px; font-size: 12.5px; cursor: pointer;
}
.imore button:hover { border-color: var(--accent-dim); }

/* ------------------------------------------------------------------ 详情 */
section.detail.idetail {
  border-left: 0; background: var(--bg);
  overflow-y: auto; padding: 22px 24px 40px; min-width: 0;
}
.dback { display: none; }
.dhead { display: flex; gap: 14px; align-items: center; margin-bottom: 6px; }
.dicon {
  width: 72px; height: 72px; border-radius: 10px; border: 1px solid var(--line);
  background: #12151b; display: flex; align-items: center; justify-content: center; flex: none;
}
.dicon img { width: 64px; height: 64px; image-rendering: auto; object-fit: contain; }
.dicon svg { width: 44px; height: 44px; }
/* collection 插图已用 rembg 去背；放在暗色柔光卡上，避免再次引入白底。 */
.dart {
  width: 104px; height: 138px; border-radius: 10px; flex: none;
  background: radial-gradient(circle at 50% 42%, #1b2029, #0f1115 72%);
  border: 1px solid var(--line); padding: 6px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,.45);
}
.dart img { width: 100%; height: 100%; object-fit: contain; }
.dheadtext { min-width: 0; }
.dtitle { font-family: inherit; font-size: 21px; color: var(--fg); margin: 0; line-height: 1.25; overflow-wrap: anywhere; }
.dsub { font-family: var(--mono); font-size: 11.5px; color: var(--fg-dim); margin-top: 5px; overflow-wrap: anywhere; }
.idetail .tags { margin: 12px 0 4px; }

.statgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 6px 0 2px; }
.statbox {
  background: var(--bg-elev2); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; min-width: 0;
}
.statbox .k { font-size: 10.5px; color: var(--fg-dim); letter-spacing: .4px; }
.statbox .v { font-family: var(--mono); font-size: 15px; color: var(--fg); margin-top: 2px; overflow-wrap: anywhere; }
.statbox.good .v { color: var(--ok); }
.statbox.warn .v { color: var(--warn); }

.desc { background: var(--bg-elev2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.desc-line { font-size: 13.5px; line-height: 1.75; color: #cfd6e4; white-space: pre-wrap; overflow-wrap: break-word; }
.desc-line.empty { min-height: 6px; }
.desc-line.sep { color: var(--line); letter-spacing: 1px; margin: 4px 0; }
.desc-missing { color: var(--fg-dim); font-size: 13px; }

.kv { width: 100%; border-collapse: collapse; font-size: 13px; }
.kv td { padding: 5px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.kv td:first-child { color: var(--fg-dim); width: 104px; font-size: 12px; }
.kv td:last-child { color: var(--fg); overflow-wrap: anywhere; }

.taglist { display: flex; flex-wrap: wrap; gap: 6px; }
.taglist .tag { cursor: default; }
.tag.restrict { color: var(--warn); border-color: #4a3a2a; }
.tag.pos { color: var(--ok); border-color: #2f4a2a; }
/* 从综合搜索进来时的返回按钮；沿用 tag 外观，但可点击 */
.tags button.tag { font-family: inherit; cursor: pointer; }
.tag.backlink { color: var(--ok); border-color: #2f4a2a; }
.tag.backlink:hover { color: #bfe39a; border-color: #3f6b35; background: var(--bg-elev2); }

/* 物品组合效果：脚本 + 可点击的搭配物品 */
.combo-group {
  background: var(--bg-elev2); border: 1px solid var(--line); border-radius: 9px;
  padding: 10px 12px; margin-bottom: 10px;
}
.combo-group pre { margin: 0 0 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
.combo-row { font-size: 13px; line-height: 2.1; color: var(--fg-dim); }
.combo-item {
  display: inline-flex; align-items: center; gap: 4px; vertical-align: middle;
  border: 1px solid var(--line); background: var(--bg-elev); color: var(--accent);
  border-radius: 6px; padding: 1px 6px; font-size: 12.5px; cursor: pointer;
  font-family: inherit;
}
.combo-item:hover { border-color: var(--accent-dim); background: var(--bg-elev2); }
.combo-ico { width: 18px; height: 18px; image-rendering: auto; object-fit: contain; }
.combo-plus { color: var(--fg-dim); margin: 0 5px; }
.combo-more { margin: 4px 0 8px; }
.combo-more summary { cursor: pointer; color: var(--accent); font-size: 12.5px; margin: 6px 0; }

/* 服务端脚本必须完整展示：换行 + 长字符串断行，不设高度上限 */
.script-block {
  white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word;
  max-height: none; overflow: visible;
}
.dnote { font-size: 12px; color: var(--fg-dim); margin-top: 18px; line-height: 1.7; }
.dnote code { font-family: var(--mono); background: var(--bg-elev2); padding: 1px 5px; border-radius: 4px; }

/* 物品 → 魔物掉落来源 */
.drops {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px; border: 0; background: transparent;
}
a.drop-row {
  display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 6px;
  align-items: start; padding: 8px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg-elev); color: inherit; text-decoration: none; min-width: 0;
}
a.drop-row:hover { background: var(--bg-elev2); border-color: var(--accent-dim); }
.drop-spr {
  width: 36px; height: 36px; object-fit: contain; flex: none;
  border: 1px solid var(--line); border-radius: 7px; background: #12151b; padding: 2px;
}
.drop-noimg {
  display: flex; align-items: center; justify-content: center;
  color: var(--fg-dim); font-size: 12px;
}
.drop-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.drop-name { font-size: 12.5px; font-weight: 600; color: var(--fg); overflow-wrap: anywhere; }
.drop-meta { font-family: var(--mono); font-size: 10px; color: var(--fg-dim); overflow-wrap: anywhere; }
.drop-side { grid-column: auto; display: flex; flex-direction: column; align-items: flex-end; justify-content: flex-start; gap: 2px; }
.drop-rate { font-family: var(--mono); font-size: 11.5px; color: var(--fg); white-space: nowrap; }
.drop-rate.rare { color: var(--warn); }
.drop-rate.mvp { color: var(--bonus); }
.drop-kind { font-size: 9.5px; color: var(--bonus); border: 1px solid #4a3a2a; border-radius: 5px; padding: 1px 4px; white-space: nowrap; }
.drop-steal { font-size: 9.5px; color: var(--fg-dim); white-space: nowrap; }
.drop-more { margin-top: 8px; }
.drop-more summary { cursor: pointer; color: var(--accent); font-size: 12.5px; padding: 5px 0; }
.drop-more .drops { margin-top: 8px; }
a.drop-row.open { background: var(--bg-elev2); border-color: var(--accent); }
.drop-inline { grid-column: 1 / -1; padding: 10px 12px 12px; background: var(--bg-elev2);
  border: 1px solid var(--accent-dim); border-radius: 8px; }
.drop-inline-top { display: flex; align-items: flex-start; gap: 10px; }
.drop-inline-spr { width: 56px; height: 56px; object-fit: contain; flex: none;
  border: 1px solid var(--line); border-radius: 7px; background: #12151b; padding: 3px; }
.drop-inline-info { flex: 1; min-width: 0; }
.drop-inline-title { display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-size: 14px; font-weight: 600; color: var(--fg); }
.drop-inline-id { font-family: var(--mono); font-size: 11.5px; color: var(--fg-dim); font-weight: 400; }
.drop-inline-mvp { font-size: 10.5px; color: var(--bonus); border: 1px solid #4a3a2a; border-radius: 5px; padding: 1px 5px; }
.drop-inline-sub { font-family: var(--mono); font-size: 11.5px; color: var(--fg-dim); margin-top: 4px; overflow-wrap: anywhere; }
.drop-inline-more { color: var(--accent); font-size: 12px; white-space: nowrap; text-decoration: none; }
.drop-inline-more:hover { text-decoration: underline; }
.drop-inline-foot { margin-top: 8px; }
.drop-inline-stats { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 9px;
  font-family: var(--mono); font-size: 11.5px; color: var(--fg-dim); }
.drop-inline-stats b { color: var(--fg); font-weight: 600; }
.drop-inline-loading { font-size: 12.5px; color: var(--fg-dim); }

/* 物品 → 商店出售 */
.shops { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
a.shop-row {
  display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 9px;
  align-items: center; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--bg-elev); color: inherit; text-decoration: none;
}
a.shop-row:hover { background: var(--bg-elev2); border-color: var(--accent-dim); }
.shop-map-thumb { width: 40px; height: 40px; object-fit: contain; flex: none;
  border: 1px solid var(--line); border-radius: 6px; background: #12151b; padding: 2px; }
.shop-noimg { display: flex; align-items: center; justify-content: center;
  color: var(--fg-dim); font-family: var(--mono); font-size: 9px; }
.shop-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.shop-map { font-size: 12.5px; font-weight: 600; color: var(--fg); overflow-wrap: anywhere; }
.shop-meta { display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  font-family: var(--mono); font-size: 10.5px; color: var(--fg-dim); overflow-wrap: anywhere; }
.shop-npc { display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; flex: none; border: 1px solid var(--line);
  border-radius: 4px; background: #12151b; color: var(--fg-dim); font-size: 10px; }
.shop-npc img { width: 20px; height: 20px; object-fit: contain; }
.shop-npc-main { width: 40px; height: 40px; border-radius: 6px; font-size: 12px; }
.shop-npc-main img { width: 36px; height: 36px; }
.shop-side { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.shop-price { font-family: var(--mono); font-size: 12px; color: var(--fg); white-space: nowrap; }
.shop-stock { font-size: 9.5px; color: var(--fg-dim); white-space: nowrap; }
.shop-more { margin-top: 8px; }
.shop-more summary { cursor: pointer; color: var(--accent); font-size: 12.5px; padding: 5px 0; }
.shop-more .shops { margin-top: 8px; }
a.shop-row.open { background: var(--bg-elev2); border-color: var(--accent); }
.shop-inline { grid-column: 1 / -1; padding: 10px 12px; border: 1px solid var(--accent-dim);
  border-radius: 8px; background: var(--bg-elev2); }
.shop-inline-top { display: flex; align-items: flex-start; gap: 10px; }
.shop-inline-map { width: 56px; height: 56px; object-fit: contain; flex: none;
  border: 1px solid var(--line); border-radius: 7px; background: #12151b; padding: 2px; }
.shop-inline-noimg { display: flex; align-items: center; justify-content: center;
  color: var(--fg-dim); font-family: var(--mono); font-size: 10px; }
.shop-inline-info { flex: 1; min-width: 0; }
.shop-inline-title { display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-size: 14px; font-weight: 600; color: var(--fg); }
.shop-inline-id { font-family: var(--mono); font-size: 11.5px; color: var(--fg-dim); font-weight: 400; }
.shop-inline-sub { font-family: var(--mono); font-size: 11px; color: var(--fg-dim); margin-top: 4px; overflow-wrap: anywhere; }
.shop-inline-stats { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 9px;
  font-family: var(--mono); font-size: 11.5px; color: var(--fg-dim); }
.shop-inline-stats b { color: var(--fg); font-weight: 600; }
.shop-inline-foot { margin-top: 8px; }
.shop-inline-more { color: var(--accent); font-size: 12px; text-decoration: none; }
.shop-inline-more:hover { text-decoration: underline; }
.shop-inline-loading { font-size: 12.5px; color: var(--fg-dim); }

@media (min-width: 901px) and (max-width: 1280px) {
  .drops { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shops { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ------------------------------------------------------------------ 手机 */
@media (max-width: 900px), (pointer: coarse) and (orientation: landscape) and (max-height: 500px) {
  .drops { grid-template-columns: 1fr; }
  .shops { grid-template-columns: 1fr; }
  html, body { height: auto; }
  li.item-row { padding: 7px 12px; grid-template-columns: 48px minmax(0, 1fr); }
  .item-icon { width: 44px; height: 44px; }
  .item-icon img { width: 40px; height: 40px; }
  .idetail { display: none; }
  ul#results li.m-detail {
    padding: 16px 14px 20px; background: var(--bg-elev2);
  }
  ul#results li.m-detail .dhead .dtitle { display: block; }
  ul#results li.m-detail .statgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  a.drop-row { grid-template-columns: 38px minmax(0, 1fr) auto; padding: 7px 8px; }
  .drop-spr { width: 36px; height: 36px; }
  .drop-side { grid-column: auto; align-items: flex-end; justify-content: flex-start; }
  .shop-inline { padding: 9px 8px; }
  .shop-inline-top { flex-wrap: wrap; }
  .shop-inline-map { width: 48px; height: 48px; }
  .drop-inline { padding: 9px 8px 10px; }
  .drop-inline-top { flex-wrap: wrap; }
  .drop-inline-spr { width: 48px; height: 48px; }
  .statgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dtitle { font-size: 19px; }
  .dicon { width: 60px; height: 60px; }
  .dicon img { width: 54px; height: 54px; }
  .dart { width: 90px; height: 120px; }
}
