/* ==========================================================================
   《残明狂刀》肉鸽三选一鎏金卷轴、幕首诗卷、随军铁匠行营、暂停与战报结算弹窗样式
   ========================================================================== */

.modal-layer {
  z-index: var(--z-modals);
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    calc(14px + var(--safe-top))
    calc(20px + var(--safe-right))
    calc(14px + var(--safe-bottom))
    calc(20px + var(--safe-left));
  background: radial-gradient(circle at 50% 45%, rgba(16, 11, 18, 0.84) 0%, rgba(5, 4, 8, 0.95) 100%);
}

/* ======================== 1. 三选一立式鎏金卷轴弹窗 ======================== */
.choice-modal-wrap {
  width: min(1040px, 96vw);
  max-height: 94dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  animation: fadeSlideUp 0.32s var(--ease-out-expo);
}

.choice-modal-header {
  text-align: center;
  width: 100%;
}

.choice-category-pill {
  display: inline-block;
  padding: 2px 12px;
  margin-bottom: 4px;
  background: rgba(185, 28, 28, 0.65);
  border: 1px solid var(--gold-300);
  border-radius: 2px;
  font-family: var(--font-display);
  font-size: 0.8rem;
  letter-spacing: 0.16em;
  color: #fef08a;
}

.choice-modal-title {
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 3.2vw, 2.35rem);
  letter-spacing: 0.18em;
  background: var(--grad-gold-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.95));
}

.choice-modal-sub {
  margin-top: 3px;
  font-size: 0.84rem;
  color: var(--text-secondary);
  letter-spacing: 0.06em;
}

/* 顶部当前六大流派持有进度微缩提示 */
.choice-sect-tracker {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.tracker-sect-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  background: rgba(12, 10, 15, 0.85);
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: 14px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.tracker-sect-chip.has-count {
  border-color: var(--sect-color, var(--gold-400));
  color: var(--text-ivory);
}

.tracker-sect-chip img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

/* 三张立式鎏金卷轴卡并列网格 */
.scroll-cards-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  align-items: stretch;
  min-height: 0;
}

.choice-scroll-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 22px 18px 18px;
  background:
    radial-gradient(circle at 50% 18%, var(--card-glow, rgba(212, 175, 55, 0.14)) 0%, transparent 62%),
    linear-gradient(180deg, #1d1616 0%, #110e13 55%, #171112 100%);
  border: 1.5px solid var(--card-border, rgba(212, 175, 55, 0.5));
  border-radius: 4px;
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.86), inset 0 1px 0 rgba(255, 240, 195, 0.18);
  cursor: pointer;
  transition: transform 0.22s var(--ease-out-expo), box-shadow 0.22s ease, border-color 0.22s ease;
}

/* 立轴上下雕花金边横梁 */
.choice-scroll-card::before,
.choice-scroll-card::after {
  content: "";
  position: absolute;
  left: -4px;
  right: -4px;
  height: 7px;
  background: linear-gradient(90deg, #6b4c14, #e5be55, #6b4c14);
  border-radius: 2px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

.choice-scroll-card::before {
  top: -4px;
}

.choice-scroll-card::after {
  bottom: -4px;
}

.choice-scroll-card:hover {
  transform: translateY(-8px) scale(1.025);
  border-color: #fef08a;
  box-shadow:
    0 22px 48px rgba(0, 0, 0, 0.92),
    0 0 28px var(--card-glow, rgba(245, 158, 11, 0.48));
}

/* 稀有度流光边框定义 */
.choice-scroll-card.rarity-common {
  --card-border: rgba(203, 213, 225, 0.55);
  --card-glow: rgba(203, 213, 225, 0.16);
}

.choice-scroll-card.rarity-rare {
  --card-border: rgba(245, 158, 11, 0.82);
  --card-glow: rgba(245, 158, 11, 0.26);
}

.choice-scroll-card.rarity-legendary {
  --card-border: rgba(192, 132, 252, 0.92);
  --card-glow: rgba(168, 85, 247, 0.34);
}

.choice-scroll-card.rarity-mythic {
  --card-border: #fde047;
  --card-glow: rgba(244, 63, 94, 0.42);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.9), 0 0 26px rgba(244, 63, 94, 0.45);
}

.card-rarity-ribbon {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 2px 8px;
  border-radius: 2px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid var(--card-border);
  color: var(--gold-200);
}

.card-hotkey-pill {
  position: absolute;
  top: 10px;
  left: 10px;
}

/* 顶部镶嵌真实流派徽记圆盘 (sect_*.png) */
.scroll-emblem-medallion {
  position: relative;
  width: 78px;
  height: 78px;
  margin-top: 4px;
  margin-bottom: 12px;
  border-radius: 50%;
  padding: 8px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.08) 0%, rgba(8, 6, 11, 0.92) 75%);
  border: 2px solid var(--card-border, var(--gold-400));
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.8), 0 0 18px var(--card-glow);
  display: flex;
  align-items: center;
  justify-content: center;
}

.scroll-emblem-medallion img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.scroll-emblem-medallion.is-hero-portrait {
  padding: 3px;
  overflow: hidden;
}

.scroll-emblem-medallion.is-hero-portrait img {
  border-radius: 50%;
  object-fit: cover;
  object-position: center 15%;
}

/* 双流派共鸣双徽记并列光环 */
.scroll-dual-emblems {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 6px 0 12px;
}

.scroll-dual-emblems .dual-emblem-ring {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  padding: 6px;
  background: rgba(10, 8, 14, 0.92);
  border: 1.5px solid #fde047;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.45);
}

.scroll-dual-emblems .dual-emblem-ring img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.dual-plus-glyph {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: #fef08a;
}

.scroll-card-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  width: 100%;
  min-width: 0;
}

.scroll-card-title-row {
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.scroll-slot-tag {
  padding: 2px 10px;
  background: rgba(212, 175, 55, 0.12);
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: 10px;
  font-size: 0.72rem;
  color: var(--gold-300);
  white-space: nowrap;
}

.scroll-card-name {
  font-family: var(--font-display);
  font-size: 1.38rem;
  font-weight: 700;
  color: var(--text-ivory);
  letter-spacing: 0.1em;
}

.scroll-card-desc {
  flex: 1;
  width: 100%;
  font-size: 0.86rem;
  color: var(--text-secondary);
  line-height: 1.56;
  padding: 0 4px;
}

.scroll-card-cta {
  margin-top: 14px;
  width: 100%;
  padding: 8px 0;
  border-top: 1px solid rgba(212, 175, 55, 0.22);
  font-family: var(--font-display);
  font-size: 0.96rem;
  letter-spacing: 0.16em;
  color: var(--gold-200);
  transition: color 0.18s;
}

.choice-scroll-card:hover .scroll-card-cta {
  color: #fef08a;
}

.choice-modal-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

/* ======================== 2. 幕间历史诗卷过场 (act_intro) ======================== */
.act-intro-scroll {
  position: relative;
  width: min(820px, 94vw);
  padding: 46px 42px;
  background: linear-gradient(180deg, rgba(16, 12, 16, 0.94), rgba(9, 7, 11, 0.97));
  border-top: 3px solid var(--gold-400);
  border-bottom: 3px solid var(--gold-400);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.95), 0 0 42px rgba(185, 28, 28, 0.32);
  text-align: center;
  overflow: hidden;
  animation: fadeSlideUp 0.45s var(--ease-out-expo);
}

.act-intro-bg-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.26;
  z-index: 0;
  pointer-events: none;
}

.act-intro-content {
  position: relative;
  z-index: 1;
}

.act-intro-year {
  display: inline-block;
  padding: 3px 14px;
  border: 1px solid rgba(212, 175, 55, 0.5);
  color: var(--gold-300);
  font-family: var(--font-serif);
  font-size: 0.86rem;
  letter-spacing: 0.24em;
  margin-bottom: 14px;
}

.act-intro-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.3rem);
  letter-spacing: 0.22em;
  background: var(--grad-blade-title);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 22px;
}

.act-poem-lines {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 30px;
}

.act-poem-lines p {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 2.2vw, 1.42rem);
  color: var(--text-ivory);
  letter-spacing: 0.16em;
}

/* ======================== 3. 随军铁匠行营 (modal_blacksmith) ======================== */
.blacksmith-modal {
  position: relative;
  width: min(1040px, 96vw);
  max-height: 94dvh;
  display: flex;
  flex-direction: column;
  padding: 20px 24px;
  background: rgba(11, 9, 13, 0.95);
  border: 1.5px solid var(--gold-400);
  border-radius: 4px;
  box-shadow: var(--shadow-deep);
  overflow: hidden;
  animation: fadeSlideUp 0.28s var(--ease-out-expo);
}

.blacksmith-bg-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.24;
  z-index: 0;
  pointer-events: none;
}

.blacksmith-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.smith-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.28);
}

.smith-npc-banner {
  display: flex;
  align-items: center;
  gap: 14px;
}

.smith-npc-avatar {
  width: 82px;
  height: 82px;
  border-radius: 8px;
  border: 2px solid var(--gold-300);
  box-shadow: 0 0 20px rgba(249, 115, 22, 0.5);
  object-fit: cover;
  object-position: center 18%;
  flex-shrink: 0;
}

.smith-npc-title {
  font-family: var(--font-display);
  font-size: 1.45rem;
  color: #fef08a;
  letter-spacing: 0.12em;
}

.smith-npc-quote {
  font-size: 0.82rem;
  color: var(--text-secondary);
  max-width: 480px;
}

.smith-wallet-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.smith-grid {
  flex: 1;
  min-height: 0;
  margin-top: 14px;
  display: grid;
  grid-template-columns: 330px 1fr;
  gap: 18px;
}

.smith-services-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.smith-service-card {
  padding: 15px 16px;
  background: linear-gradient(160deg, rgba(38, 22, 16, 0.9), rgba(15, 11, 14, 0.94));
  border: 1px solid rgba(245, 158, 11, 0.48);
  border-radius: 4px;
}

.smith-service-card h4 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: #fde68a;
  margin-bottom: 6px;
}

.smith-service-card p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin-bottom: 12px;
}

.forge-stars {
  display: flex;
  gap: 5px;
  margin-bottom: 8px;
}

.forge-star {
  padding: 2px 7px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: 2px;
  font-family: var(--font-num);
  font-size: 0.72rem;
  color: var(--text-muted);
}

.forge-star.is-lit {
  background: linear-gradient(135deg, #d97706, #f59e0b);
  border-color: #fef08a;
  color: #fffbeb;
  font-weight: 700;
}

.smith-wares-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-content: start;
}

.smith-ware-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 12px 14px;
  background: rgba(18, 14, 21, 0.92);
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: 4px;
}

.smith-ware-card.is-sold {
  opacity: 0.45;
}

.ware-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.ware-head img {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.ware-name {
  font-family: var(--font-display);
  font-size: 1.08rem;
  color: var(--gold-200);
}

.ware-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin-bottom: 10px;
}

.smith-footer {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(212, 175, 55, 0.25);
  display: flex;
  justify-content: flex-end;
}

/* ======================== 4. 暂停与当前武学构筑面板 (paused) ======================== */
.pause-modal {
  width: min(940px, 95vw);
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
  padding: 22px 26px;
  background: var(--bg-panel-heavy);
  border: 1.5px solid var(--gold-400);
  border-radius: 4px;
  box-shadow: var(--shadow-deep);
}

.pause-grid {
  flex: 1;
  min-height: 0;
  margin: 14px 0;
  display: grid;
  grid-template-columns: 290px 1fr;
  gap: 18px;
}

.pause-settings-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-right: 14px;
  border-right: 1px solid rgba(212, 175, 55, 0.2);
}

.setting-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(212, 175, 55, 0.22);
  border-radius: 3px;
}

.setting-row label {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--gold-200);
}

.volume-range {
  width: 100%;
  accent-color: var(--gold-400);
  cursor: pointer;
}

.pause-build-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-right: 6px;
}

.build-group-title {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--gold-300);
  margin-bottom: 6px;
  border-left: 3px solid var(--crimson-500);
  padding-left: 8px;
}

.build-items-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.build-detail-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: rgba(22, 18, 26, 0.9);
  border: 1px solid rgba(212, 175, 55, 0.34);
  border-radius: 3px;
  font-size: 0.78rem;
}

.build-detail-pill img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.pause-actions-bar {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(212, 175, 55, 0.24);
}

/* ======================== 5. 凯旋 / 阵亡战报结算页 (victory / gameover) ======================== */
.summary-modal {
  width: min(920px, 95vw);
  max-height: 94dvh;
  display: flex;
  flex-direction: column;
  padding: 24px 28px;
  background: linear-gradient(180deg, rgba(18, 13, 18, 0.97), rgba(8, 7, 11, 0.98));
  border: 2px solid var(--gold-400);
  border-radius: 4px;
  box-shadow: var(--shadow-deep);
  animation: fadeSlideUp 0.4s var(--ease-out-expo);
}

.summary-modal.is-defeat {
  border-color: rgba(220, 38, 38, 0.68);
}

.summary-banner {
  text-align: center;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.26);
}

.summary-headline {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.5vw, 3rem);
  letter-spacing: 0.22em;
}

.summary-modal.is-victory .summary-headline {
  background: var(--grad-gold-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 22px rgba(245, 158, 11, 0.55));
}

.summary-modal.is-defeat .summary-headline {
  color: var(--crimson-400);
  text-shadow: 0 4px 18px rgba(185, 28, 28, 0.7);
}

.summary-body-grid {
  flex: 1;
  min-height: 0;
  margin: 16px 0;
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 22px;
}

.summary-hero-card {
  border: 1.5px solid var(--gold-400);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  background: #120d10;
  max-height: 270px;
}

.summary-hero-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 15%;
}

.summary-hero-card-label {
  position: absolute;
  inset: auto 0 0 0;
  padding: 8px;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.92));
  text-align: center;
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--gold-200);
}

.summary-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.summary-stat-box {
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: 3px;
}

.summary-stat-box span {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.summary-stat-box strong {
  font-family: var(--font-num);
  font-size: 1.32rem;
  color: var(--text-ivory);
}

.summary-merit-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(90deg, rgba(120, 53, 15, 0.55), rgba(30, 20, 15, 0.85));
  border: 1px solid var(--gold-300);
  border-radius: 4px;
  margin-bottom: 12px;
}

.summary-merit-bar strong {
  font-family: var(--font-num);
  font-size: 1.55rem;
  color: #fef08a;
}

.summary-footer {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(212, 175, 55, 0.25);
}

/* ======================== 弹窗移动端横竖屏自适应 ======================== */
@media (max-width: 820px) {
  .choice-modal-wrap {
    gap: 10px;
  }
  .choice-modal-title {
    font-size: 1.5rem;
  }
  .choice-modal-sub {
    font-size: 0.78rem;
  }
  .choice-sect-tracker {
    display: none;
  }
  .scroll-cards-grid {
    grid-template-columns: 1fr;
    overflow-y: auto;
    padding: 4px 2px;
    gap: 10px;
  }
  .choice-scroll-card {
    flex-direction: row;
    align-items: center;
    text-align: left;
    padding: 26px 14px 12px;
    gap: 12px;
  }
  .card-hotkey-pill {
    top: 6px;
    left: 10px;
  }
  .card-rarity-ribbon {
    top: 6px;
    right: 10px;
  }
  .scroll-emblem-medallion {
    width: 54px;
    height: 54px;
    margin: 0;
    flex-shrink: 0;
  }
  .scroll-dual-emblems {
    margin: 0;
    flex-shrink: 0;
    gap: 3px;
  }
  .scroll-dual-emblems .dual-emblem-ring {
    width: 38px;
    height: 38px;
    padding: 4px;
  }
  .scroll-card-body {
    align-items: flex-start;
    text-align: left;
    flex: 1;
    min-width: 0;
  }
  .scroll-card-title-row {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
  }
  .scroll-card-name {
    font-size: 1.1rem;
  }
  .scroll-slot-tag {
    font-size: 0.68rem;
    padding: 1px 7px;
  }
  .scroll-card-desc {
    font-size: 0.79rem;
    line-height: 1.42;
    padding: 0;
  }
  .scroll-card-cta {
    display: none;
  }
  .choice-modal-footer button {
    font-size: 0.88rem;
    padding: 9px 14px;
    white-space: nowrap;
  }
  .smith-grid,
  .pause-grid,
  .summary-body-grid {
    grid-template-columns: 1fr;
  }
  .smith-wares-grid {
    grid-template-columns: 1fr;
  }
  .summary-hero-card {
    display: none;
  }
}

@media (max-height: 480px) {
  .choice-modal-wrap {
    gap: 6px;
  }
  .choice-sect-tracker {
    display: none;
  }
  .scroll-cards-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    overflow-y: visible;
  }
  .choice-scroll-card {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 22px 10px 8px;
    gap: 4px;
  }
  .scroll-emblem-medallion {
    width: 44px;
    height: 44px;
    margin: 0 0 4px;
  }
  .scroll-card-body {
    align-items: center;
    text-align: center;
  }
  .scroll-card-title-row {
    flex-direction: column-reverse;
    align-items: center;
    gap: 3px;
    margin-bottom: 4px;
  }
  .scroll-card-name {
    font-size: 1.05rem;
  }
  .scroll-card-desc {
    font-size: 0.74rem;
    line-height: 1.35;
  }
  .scroll-card-cta {
    display: block;
    margin-top: 6px;
    padding: 4px 0;
    font-size: 0.8rem;
  }
}
