/* ============ 古籍书页式面板(通用) ============ */
#panel-layer { position: absolute; inset: 0; pointer-events: none; }
.panel-mask {
  position: absolute;
  inset: 0;
  background: rgba(5, 3, 2, 0.55);
  pointer-events: auto;
}

.book-panel {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  min-width: 520px;
  max-width: 92vw;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0)) ,
    linear-gradient(180deg, var(--paper) 0%, var(--paper-dark) 100%);
  border: 3px solid var(--gold-dim);
  border-radius: 8px;
  box-shadow: var(--shadow), 0 0 0 6px var(--wood-dark), 0 0 0 7px var(--gold-dim);
  color: var(--ink);
  pointer-events: auto;
  animation: panel-in 0.18s ease;
}
@keyframes panel-in { from { opacity: 0; transform: translate(-50%, -48%); } to { opacity: 1; transform: translate(-50%, -50%); } }

.book-panel::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(125, 99, 32, 0.4);
  border-radius: 5px;
  pointer-events: none;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px 10px;
  border-bottom: 2px solid rgba(125, 99, 32, 0.5);
}
.panel-header h2 {
  font-size: 24px;
  letter-spacing: 10px;
  text-indent: 10px;
  color: var(--ink);
  font-weight: bold;
}
.panel-header .ph-sub { font-size: 13px; color: var(--ink-light); letter-spacing: 1px; margin-left: 14px; }
.panel-close {
  width: 30px;
  height: 30px;
  line-height: 26px;
  text-align: center;
  font-size: 18px;
  color: var(--paper);
  background: var(--red-btn);
  border: 1px solid var(--gold-dim);
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.12s;
  font-family: sans-serif;
}
.panel-close:hover { background: var(--red-btn-hover); }

.panel-body { padding: 16px 22px 20px; overflow-y: auto; flex: 1; }

.panel-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 10px 22px 14px;
  border-top: 1px dashed rgba(125, 99, 32, 0.5);
}
.panel-footer .pf-info { margin-right: auto; font-size: 14px; color: var(--ink-light); letter-spacing: 1px; }

/* ---- 物品格 ---- */
.slot-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
}
.slot {
  aspect-ratio: 1;
  background:
    radial-gradient(circle at 50% 35%, rgba(255, 255, 255, 0.25), transparent 70%),
    linear-gradient(180deg, #cbb98d, #b7a171);
  border: 2px solid rgba(125, 99, 32, 0.55);
  border-radius: 4px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: box-shadow 0.1s, border-color 0.1s;
  min-width: 0;
}
.slot:hover { border-color: var(--gold); box-shadow: 0 0 8px var(--gold-faint); }
.slot.selected { border-color: var(--gold-bright); box-shadow: 0 0 10px var(--gold-faint), inset 0 0 8px rgba(201, 162, 39, 0.3); }
.slot.bq-blue { border-color: var(--q-blue); }
.slot.bq-purple { border-color: var(--q-purple); }
.slot.bq-gold { border-color: var(--q-gold); }
.slot.bq-red { border-color: var(--q-red); box-shadow: 0 0 8px rgba(192, 57, 43, 0.4); }
.slot .s-name {
  font-size: 13px;
  color: var(--ink);
  text-align: center;
  line-height: 1.15;
  padding: 2px;
  word-break: break-all;
}
.slot .s-icon {
  display: block;
  width: 55%;
  max-height: 55%;
  object-fit: contain;
  margin: 6% auto 0;
}
.slot .slot-has-icon .s-name { font-size: 11px; }
.slot .s-count {
  position: absolute;
  right: 3px;
  bottom: 1px;
  font-size: 12px;
  color: var(--ink);
  font-family: sans-serif;
  text-shadow: 0 0 3px rgba(230, 216, 184, 0.9);
}
.slot .s-empty { font-size: 12px; color: rgba(90, 70, 50, 0.4); }

/* ---- 仓库/道具背包物品卡片(仅 warehouse-panel,经 .wh-grid/.tb-grid 隔离,不影响全局 .slot/.slot-grid) ---- */
.wh-grid { grid-template-columns: repeat(5, 1fr); gap: 12px; }
.tb-grid { grid-template-columns: repeat(4, 1fr); gap: 14px; }
.wh-grid .slot, .tb-grid .slot {
  aspect-ratio: auto; /* 卡片 = 图片区 + 名称行,不再用全局正方形格 */
  flex-direction: column;
  align-items: stretch;
  gap: 5px;
  padding: 6px;
}
.card-img {
  position: relative;
  width: 100%;
  aspect-ratio: 1; /* 图片区始终正方形主视觉,名称行在外不挤压图片 */
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(90, 70, 50, 0.35);
  border-radius: 3px;
  background:
    radial-gradient(circle at 50% 28%, rgba(255, 255, 255, 0.22), transparent 65%),
    linear-gradient(180deg, #cdbd93, #b7a171);
  box-shadow: inset 0 0 10px rgba(60, 42, 20, 0.3);
  overflow: hidden;
}
.wh-grid .slot .card-img .s-icon, .tb-grid .slot .card-img .s-icon {
  width: 80%;
  height: 80%;
  object-fit: contain; /* 不拉伸不裁切,保留透明背景 */
  margin: 0;
}
/* 道具专属渐变主题:按 item id 派生(非品质),上深→下浅,古风暗色调 */
.card-img.item-theme-bandage, .card-img.item-theme-lantern {
  background:
    radial-gradient(circle at 50% 22%, rgba(255, 255, 255, 0.18), transparent 60%),
    linear-gradient(180deg, #24405c 0%, #3c5f80 55%, #8fb0c9 100%);
  box-shadow: inset 0 0 10px rgba(8, 18, 30, 0.45);
}
.card-img.item-theme-shovel {
  background:
    radial-gradient(circle at 50% 22%, rgba(255, 255, 255, 0.16), transparent 60%),
    linear-gradient(180deg, #3a2450 0%, #5b4378 55%, #a78cc2 100%);
  box-shadow: inset 0 0 10px rgba(20, 8, 34, 0.45);
}
/* 猎枪复用夜视仪同款金色主题(§猎枪):不新增重复 CSS,加入同一规则选择器 */
.card-img.item-theme-night_vision, .card-img.item-theme-shotgun {
  background:
    radial-gradient(circle at 50% 22%, rgba(255, 255, 255, 0.18), transparent 60%),
    linear-gradient(180deg, #4d3a14 0%, #776026 55%, #c0a45c 100%);
  box-shadow: inset 0 0 10px rgba(30, 22, 4, 0.45);
}
/* 耐久:图片区左上,绝对定位 + 描边阴影保证渐变背景上可读 */
.card-dur {
  position: absolute;
  top: 3px;
  left: 4px;
  z-index: 1;
  font-style: normal;
  font-size: 12px;
  font-family: sans-serif;
  color: #f5eeda;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85), 0 0 3px rgba(0, 0, 0, 0.6);
}
/* 耐久进度条(§耐久进度条,2026-09-15):卡片图片区底部细条,<=30% 红色警示 */
.card-durbar {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 4px;
  height: 5px;
  z-index: 1;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(120, 100, 60, 0.55);
  border-radius: 3px;
  overflow: hidden;
}
.card-durbar i {
  display: block;
  height: 100%;
  background: linear-gradient(180deg, #b8d8a8, #7aa06a);
}
.card-durbar i.low { background: linear-gradient(180deg, #e0705a, #b0402e); }
/* 名称行:图片区外、固定高度,长名省略不撑破卡片 */
.card-name {
  height: 22px;
  line-height: 22px;
  font-size: 14px;
  color: var(--ink);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- 商城:商品卡片(主菜单/卡车安全区共用;.item-row 全局规则不动,repair/submit/tasks 继续用) ---- */
.shop-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.shop-card {
  position: relative;
  padding: 6px;
  background:
    radial-gradient(circle at 50% 35%, rgba(255, 255, 255, 0.25), transparent 70%),
    linear-gradient(180deg, #cbb98d, #b7a171);
  border: 2px solid rgba(125, 99, 32, 0.55);
  border-radius: 4px;
  cursor: pointer;
  transition: box-shadow 0.1s, border-color 0.1s;
}
.shop-card:hover { border-color: var(--gold); box-shadow: 0 0 8px var(--gold-faint); }
.shop-card.selected { border-color: var(--gold-bright); box-shadow: 0 0 10px var(--gold-faint), inset 0 0 8px rgba(201, 162, 39, 0.3); }
/* 数量角标:仅数量 >1 显示,左上角胶囊,与右上角减号按钮区分 */
.shop-card .shop-card-quantity {
  position: absolute;
  top: 4px;
  left: 4px;
  z-index: 3;
  min-width: 24px;
  height: 22px;
  padding: 0 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  font-size: 12px;
  font-weight: bold;
  color: #f5eeda;
  background: linear-gradient(180deg, var(--red-btn), var(--red-btn-dark));
  border: 1px solid rgba(125, 99, 32, 0.55);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
/* 圆形减号:数量 >0 显示,外层卡片右上角,古籍纸底红字 */
.shop-card .shop-card-minus {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 3;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 15px;
  font-weight: bold;
  line-height: 1;
  font-family: sans-serif;
  color: var(--red-btn-dark);
  background: linear-gradient(180deg, var(--paper), var(--paper-dark));
  border: 1.5px solid var(--gold-dim);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  user-select: none;
}
.shop-card .shop-card-minus:hover { color: var(--paper); background: linear-gradient(180deg, var(--red-btn), var(--red-btn-dark)); }
.shop-card .s-icon { width: 80%; height: 80%; object-fit: contain; margin: 0; }
/* 名称:位于图片区域内部底缘,渐变压底保证可读,不遮挡图片主体 */
.shop-card .shop-card-name {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 14px 2px 4px;
  text-align: center;
  font-size: 14px;
  color: #f5eeda;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85), 0 0 3px rgba(0, 0, 0, 0.6);
  background: linear-gradient(180deg, rgba(20, 14, 8, 0), rgba(20, 14, 8, 0.45));
}
/* 价格:图片区外部下方;数字用深褐色保证蓝/紫/金背景上的对比度,coin 图标保持金色 */
.shop-card .shop-card-price {
  margin-top: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 16px;
  font-weight: bold;
  color: var(--ink);
  text-shadow: 0 1px 0 rgba(255, 244, 214, 0.55);
}
.shop-card .shop-card-price .coin {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--gold-bright), #8a6d1d);
  border: 1px solid var(--gold);
}
.shop-ops .btn.btn-disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

/* ---- 物品档案(长按详情浮层):古籍档案风,纯查看,挂在当前面板内部 ----
   高度完全由内容撑开(height:auto),不设 max-height/overflow-y,不允许内部滚动条(§详情尺寸) */
.item-detail-mask { display: flex; align-items: center; justify-content: center; }
.item-detail {
  width: 720px;
  max-width: calc(100vw - 48px);
  padding: 18px 24px 16px;
  background: linear-gradient(180deg, var(--paper), var(--paper-dark));
  border: 2px solid var(--gold-dim);
  border-radius: 6px;
  box-shadow: var(--shadow), 0 0 0 4px var(--wood-dark);
  color: var(--ink);
}
.item-detail h4 { font-size: 15px; letter-spacing: 6px; text-indent: 6px; color: var(--red-btn-dark); text-align: center; margin-bottom: 14px; }
.id-main { display: flex; gap: 18px; align-items: center; }
.id-figure { width: 140px; height: 140px; flex: none; }
.id-glyph { font-size: 56px; font-weight: bold; }
.id-head .id-name { font-size: 24px; letter-spacing: 3px; }
.id-head .id-tag { margin-top: 8px; font-size: 13px; color: var(--ink-light); letter-spacing: 1px; }
.id-stats { margin-top: 14px; display: flex; gap: 18px; flex-wrap: wrap; font-size: 14px; color: var(--ink-light); }
.id-stats b { color: var(--ink); }
.id-sep { margin: 12px 0 10px; border-top: 1px dashed rgba(125, 99, 32, 0.5); }
.id-desc-title { text-align: center; font-size: 14px; letter-spacing: 4px; text-indent: 4px; color: var(--red-btn-dark); margin-bottom: 6px; }
.id-desc { font-size: 14px; line-height: 1.9; color: var(--ink); }
.item-detail .cb-ops { margin-top: 10px; }

/* ---- 物品列表(商城等) ---- */
.item-list { display: flex; flex-direction: column; gap: 10px; }
.item-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  background: rgba(255, 252, 240, 0.35);
  border: 1px solid rgba(125, 99, 32, 0.4);
  border-radius: 5px;
}
.item-row .ic {
  width: 46px; height: 46px;
  flex: none;
  border: 2px solid rgba(125, 99, 32, 0.55);
  border-radius: 4px;
  background: linear-gradient(180deg, #cbb98d, #b7a171);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: var(--ink);
}
.item-row .ic img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 2px;
}
.item-row .info { flex: 1; min-width: 0; }
.item-row .info .n { font-size: 18px; color: var(--ink); letter-spacing: 2px; }
.item-row .info .d { margin-top: 3px; font-size: 13px; color: var(--ink-light); }
.item-row .price { display: flex; align-items: center; gap: 6px; font-size: 17px; color: var(--q-gold); white-space: nowrap; }
.item-row .price .coin { width: 13px; height: 13px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, var(--gold-bright), #8a6d1d); border: 1px solid var(--gold); }

/* ---- 表单/存档槽 ---- */
.slot-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 10px;
  background: rgba(255, 252, 240, 0.35);
  border: 1px solid rgba(125, 99, 32, 0.4);
  border-radius: 5px;
}
.slot-row.active { border-color: var(--gold); box-shadow: 0 0 8px var(--gold-faint); }
.slot-row .sr-name { font-size: 18px; color: var(--ink); letter-spacing: 1px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot-row .sr-meta { font-size: 12px; color: var(--ink-light); text-align: right; line-height: 1.5; white-space: nowrap; }
.slot-row .sr-ops { display: flex; gap: 8px; }

/* ---- 存档备份(导出/导入) ---- */
.save-io {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed rgba(125, 99, 32, 0.5);
}
.save-io .save-io-note { margin-left: auto; font-size: 12px; color: var(--ink-light); letter-spacing: 1px; }

.import-view { display: flex; flex-direction: column; gap: 14px; }
.import-view .import-info {
  padding: 12px 16px;
  background: rgba(255, 252, 240, 0.35);
  border: 1px solid rgba(125, 99, 32, 0.4);
  border-radius: 5px;
}
.import-view .ii-row { font-size: 15px; color: var(--ink); line-height: 1.9; letter-spacing: 1px; }
.import-view .import-slots { display: flex; flex-direction: column; gap: 8px; }
.import-view .import-slot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(255, 252, 240, 0.35);
  border: 1px solid rgba(125, 99, 32, 0.4);
  border-radius: 5px;
  cursor: pointer;
  font-size: 15px;
  color: var(--ink);
  letter-spacing: 1px;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.import-view .import-slot:hover { border-color: var(--gold); }
.import-view .import-slot:has(input:checked) { border-color: var(--gold); box-shadow: 0 0 8px var(--gold-faint); }
.import-view .import-slot input { accent-color: var(--gold); cursor: pointer; }
.import-view .import-slot.occupied em { margin-left: auto; font-style: normal; font-size: 12px; color: var(--red-btn-dark); }
.import-view .import-ops { display: flex; justify-content: flex-end; gap: 12px; }

/* ---- 简介文档 ---- */
.guide-sec { margin-bottom: 18px; }
.guide-sec h3 {
  font-size: 19px;
  color: var(--red-btn-dark);
  letter-spacing: 4px;
  margin-bottom: 8px;
  border-left: 4px solid var(--gold-dim);
  padding-left: 10px;
}
.guide-sec p, .guide-sec li { font-size: 15px; line-height: 1.9; color: var(--ink); }
.guide-sec ul { padding-left: 22px; }
.guide-key { display: inline-block; min-width: 26px; text-align: center; padding: 1px 7px; background: var(--wood); color: var(--gold-bright); border-radius: 3px; font-size: 13px; font-family: sans-serif; margin: 0 3px; }

/* ---- 设置 ---- */
.setting-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 4px; border-bottom: 1px dashed rgba(125, 99, 32, 0.4); }
.setting-row .sn { font-size: 17px; color: var(--ink); letter-spacing: 2px; }
.setting-row .sc { display: flex; align-items: center; gap: 10px; }
.setting-row .placeholder-tag { font-size: 12px; color: var(--ink-light); border: 1px dashed var(--paper-edge); padding: 1px 6px; border-radius: 3px; }

/* ---- 确认框 ---- */
.confirm-box {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 20;
  width: 380px;
  padding: 22px 26px;
  background: linear-gradient(180deg, var(--paper), var(--paper-dark));
  border: 2px solid var(--gold-dim);
  border-radius: 6px;
  box-shadow: var(--shadow), 0 0 0 4px var(--wood-dark);
  color: var(--ink);
}
.confirm-box h4 { font-size: 19px; letter-spacing: 4px; margin-bottom: 10px; color: var(--red-btn-dark); }
.confirm-box p { font-size: 15px; line-height: 1.8; color: var(--ink); }
.confirm-box .cb-ops { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

/* ---- 面板辅助 ---- */
.empty-hint {
  padding: 40px 10px;
  text-align: center;
  font-size: 16px;
  line-height: 2;
  color: var(--ink);
  letter-spacing: 2px;
}
.empty-hint .dim, .dim { font-size: 13px; color: var(--ink-light); letter-spacing: 1px; }
.panel-note {
  margin-bottom: 12px;
  padding: 8px 12px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink-light);
  background: rgba(125, 99, 32, 0.1);
  border-left: 3px solid var(--gold-dim);
  border-radius: 0 4px 4px 0;
}
.panel-note b { color: var(--red-btn-dark); }
.submit-all {
  margin-top: 14px;
  width: 100%;
  text-align: center;
}

/* ============ 局内背包面板(Tab,§10) ============ */
.bag-summary { margin: 4px 0 12px; font-size: 14px; }
.bag-summary b.over { color: var(--danger); }
.bag-zone-title { margin: 14px 0 8px; font-size: 15px; letter-spacing: 2px; }
.bag-zone-title small { margin-left: 10px; font-size: 12px; opacity: 0.6; letter-spacing: 0; }
.bag-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; }
.bag-cell {
  position: relative;
  height: 62px;
  background: rgba(60, 45, 25, 0.12);
  border: 1px dashed rgba(125, 99, 32, 0.45);
  border-radius: 4px;
  cursor: pointer;
}
.bag-cell.sel { border-style: solid; border-color: var(--gold-bright); box-shadow: 0 0 6px rgba(201, 162, 39, 0.5); }
.bag-hot {
  position: absolute; top: 1px; left: 3px;
  font-size: 10px; font-style: normal;
  color: rgba(125, 99, 32, 0.8);
  font-family: sans-serif;
}
.bag-item {
  position: absolute; inset: 4px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 1.5px solid;
  border-radius: 3px;
  background: rgba(255, 252, 240, 0.5);
  text-align: center;
  overflow: hidden;
}
.bag-item span { font-size: 12px; letter-spacing: 1px; }
.bag-item img {
  width: 26px; height: 26px;
  object-fit: contain;
  margin-bottom: 1px;
}
.bag-item em { font-style: normal; font-size: 10px; opacity: 0.65; font-family: sans-serif; }
/* 局内背包耐久进度条(§耐久进度条,2026-09-15):进度条 + 小数字,紧凑不撑破格子 */
.bag-dur {
  font-style: normal;
  width: 70%;
  height: 5px;
  margin-top: 2px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 3px;
  overflow: hidden;
}
.bag-dur i { display: block; height: 100%; background: linear-gradient(180deg, #b8d8a8, #7aa06a); }
.bag-dur i.low { background: linear-gradient(180deg, #e0705a, #b0402e); }
.bag-dur-txt { opacity: 0.6 !important; line-height: 1; margin-top: 1px; }
.bag-tip { margin-top: 14px; font-size: 12px; opacity: 0.6; }

/* ---- 珍宝提交台(§撤离):目标价值 + 双区布局 ---- */
.st-goal { margin: 2px 0 6px; font-size: 15px; letter-spacing: 1px; }
.st-goal b { color: var(--q-gold); font-size: 18px; }
.st-goal b.reached { text-shadow: 0 0 8px rgba(201, 162, 39, 0.6); }
.st-discard {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 180px;
  overflow-y: auto;
  margin-bottom: 4px;
}
