/* ============================================================
   仓库全屏覆盖层  overlays.css
   ============================================================ */
.storage-overlay {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translate(-50%, 100%);
  width: 100%;
  max-width: 430px;
  display: flex;
  flex-direction: column;
  background: #f8fafc;
  z-index: 200;
  transition: transform .22s ease;
  box-shadow: 0 0 50px rgba(40, 60, 90, .35);
}
.storage-overlay.show {
  transform: translate(-50%, 0);
}

.storage-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  background: linear-gradient(180deg, #ffffff, #eef2f8);
  border-bottom: 1px solid #d8dee9;
}
.storage-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 3px;
  color: #a8761a;
}
.storage-close {
  padding: 4px 12px;
  font-size: 14px;
  min-height: 0;
}

.storage-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
}

.storage-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  box-shadow: 0 1px 2px rgba(60, 80, 110, .05);
}
.storage-item-name {
  color: #2c3444;
  font-weight: 600;
}
.storage-item-count {
  color: #4a90d9;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.storage-empty {
  color: #9aa6b8;
  text-align: center;
  padding: 40px 0;
  font-size: 13.5px;
}


/* ============================================================
   转生弹窗
   ============================================================ */
.rebirth-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(20, 30, 50, .55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 20px;
}
.rebirth-overlay.show { display: flex; }

.rebirth-box {
  width: 100%;
  max-width: 340px;
  max-height: 78vh;
  background: #f8fafc;
  border-radius: 14px;
  padding: 18px 16px 16px;
  box-shadow: 0 12px 40px rgba(20, 30, 50, .35);
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: rebirthPop .22s ease-out;
}
@keyframes rebirthPop {
  from { transform: scale(.94); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.rebirth-title {
  flex: 0 0 auto;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 4px;
  color: #a8761a;
  text-align: center;
}

.rebirth-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 2px 2px 4px;
}

.rebirth-empty {
  color: #9aa6b8;
  text-align: center;
  padding: 30px 0;
  font-size: 13.5px;
}

.rebirth-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rebirth-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 14px;
  line-height: 1.2;
}
.rebirth-name {
  font-weight: 600;
  color: #2c3444;
}
.rebirth-level {
  color: #4a90d9;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.rebirth-bar {
  height: 6px;
  border-radius: 3px;
  background: #e4ebf5;
  overflow: hidden;
}
.rebirth-bar > i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 3px;
  background: #307bf5;
}

#btnRebirth {
  flex: 0 0 auto;
  padding: 11px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 4px;
  color: #fff;
  background: linear-gradient(180deg, #4a90d9, #307bf5);
  border: none;
  border-radius: 9px;
  box-shadow: 0 2px 6px rgba(48, 123, 245, .3);
}
#btnRebirth:hover { background: linear-gradient(180deg, #5a9ce5, #3d88f7); }
#btnRebirth:active { transform: translateY(1px); box-shadow: none; }

/* ===== 设置弹窗 ===== */
.settings-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 30, 50, .55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.settings-overlay.show { display: flex; }

.settings-box {
  width: 100%;
  max-width: 320px;              /* 比主页面窄 */
  min-height: 400px;             /* 让按钮能靠下 */
  background: #f8fafc;
  color: #2c3444;
  border-radius: 14px;
  padding: 18px 16px 16px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 40px rgba(20, 30, 50, .35);
  animation: rebirthPop .22s ease-out;
}

.settings-title {
  flex: 0 0 auto;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 4px;
  color: #a8761a;
  text-align: center;
  margin-bottom: 10px;
}

.settings-actions {
  margin-top: auto;              /* ★ 把按钮推到下方 */
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}
.settings-actions .btn {
  width: 100%;
  padding: 12px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 2px;
}

.settings-btn-danger {
  background: linear-gradient(180deg, #e05a5a, #c0392b);
  color: #fff;
  border: 1px solid #a93226;
  box-shadow: 0 2px 6px rgba(192, 57, 43, .25);
}
.settings-btn-danger:hover {
  background: linear-gradient(180deg, #e86a6a, #d0442f);
  border-color: #a93226;
}
.settings-btn-danger:active {
  background: #b03325;
  box-shadow: none;
}

.settings-foot {
  display: flex;
  justify-content: flex-end;
  border-top: 1px solid #e2e8f0;
  padding-top: 12px;
}
.settings-foot .btn {
  padding: 6px 18px;
  font-size: 14px;
}

/* ---- 设置弹窗里「自动设置」按钮：贴在标题下方，
        下方三个按钮靠 .settings-actions 的 margin-top:auto 自动被推到底部，
        两块之间天然隔开。 ---- */
.settings-actions-auto {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}
.settings-actions-auto .btn {
  width: 100%;
  padding: 12px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 2px;
}

/* ---- 自动设置 覆盖层 ---- */
.auto-settings-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 30, 50, .55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1200;                 /* 比设置弹窗的 1000 高，盖在它上面 */
  padding: 20px;
}
.auto-settings-overlay.show { display: flex; }

.auto-settings-box {
  width: 100%;
  max-width: 448px;
  height: min(680px, 90vh);
  background: #f8fafc;
  color: #2c3444;
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 40px rgba(20, 30, 50, .35);
  animation: rebirthPop .22s ease-out;
}

.auto-settings-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.auto-settings-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 4px;
  color: #a8761a;
}
.auto-settings-close {
  padding: 4px 12px;
  font-size: 14px;
}

.auto-settings-chapters {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.auto-chapter-btn {
  flex: 1;
  padding: 8px 0;
  font-size: 14px;
  font-weight: 600;
}
.auto-chapter-btn.active {
  background: #a8761a;
  color: #fff;
  border-color: #a8761a;
}

.auto-settings-cols {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  min-height: 0;
}
.auto-settings-col {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.auto-settings-col-title {
  flex: 0 0 auto;
  font-size: 13px;
  color: #6b7686;
  letter-spacing: 2px;
  text-align: center;
  margin-bottom: 6px;
}
.auto-settings-col-body {
  flex: 1 1 auto;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
/* 面板里的行避开游戏右栏那套固定行高逻辑 */
.auto-settings-col-body .action-row {
  height: auto;
  min-height: 34px;
}

/* ---- 手机竖屏 / 窄屏适配 ---- */
@media (max-width: 600px) {
  .auto-settings-overlay {
    padding: 0;
  }
  .auto-settings-box {
    max-width: 100%;
    width: 100%;
    height: 100%;
    border-radius: 0;
    padding: 12px 10px;
  }
  .auto-settings-title { letter-spacing: 2px; font-size: 15px; }
  .auto-settings-chapters { gap: 6px; margin-bottom: 10px; }
  .auto-chapter-btn { padding: 6px 0; font-size: 13px; }
  .auto-settings-cols { gap: 8px; }
  .auto-settings-col-title { font-size: 12px; letter-spacing: 1px; }
  .auto-settings-col-body .action-row { min-height: 30px; }
}