/* ==========================================================================
   80亿分之1 · 中文增强版 & 爽剧版（穿越者身份 MAX）专属样式（回归修复版）
   ========================================================================== */

:root {
  --max-gold: #D4AF37;
  --max-gold-bright: #F7DF8B;
  --max-gold-deep: #8C6414;
  --max-dark-bg: #141218;
  --max-dark-card: #1D1A24;
  --max-border: rgba(212, 175, 55, 0.45);
  --buff-bg: rgba(15, 110, 104, 0.10);
  --buff-border: rgba(15, 110, 104, 0.35);
  --buff-ink: #0F6E68;
}

html[data-theme="dark"] {
  --buff-bg: rgba(76, 192, 175, 0.14);
  --buff-border: rgba(76, 192, 175, 0.4);
  --buff-ink: #6FE3D3;
}

.cnmax-sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* 首页「先天微光环 & 爽剧版·穿越者身份 MAX」控制舱 */
.cnmax-dock {
  margin: 14px 0 18px;
  padding: 16px 18px;
  border-radius: 12px;
  border: 1.5px solid var(--rule, #C7D2CE);
  background: var(--card, #F7FAF8);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.05);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.cnmax-dock.is-max {
  background: linear-gradient(135deg, #1A1625 0%, #261E35 55%, #1F1829 100%);
  border-color: var(--max-gold);
  color: #F6F1E3;
  box-shadow: 0 8px 28px rgba(212, 175, 55, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

/* 折叠态：大幅压缩高度，让移动端首屏主按钮「出生」无需长滚 */
.cnmax-dock.is-collapsed {
  padding: 11px 14px;
}

.cnmax-dock.is-collapsed .cnmax-collapsible {
  display: none !important;
}

.cnmax-dock-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.cnmax-dock-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.cnmax-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.cnmax-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--buff-bg);
  color: var(--buff-ink);
  border: 1px solid var(--buff-border);
}

.cnmax-dock.is-max .cnmax-badge {
  background: linear-gradient(90deg, #F7DF8B, #D4AF37);
  color: #1A1205;
  border-color: #FFF2B2;
}

.cnmax-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.cnmax-sub {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.55;
  opacity: 0.88;
}

.cnmax-btn-unlock {
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13.5px;
  font-weight: 700;
  background: linear-gradient(135deg, #E6C35C 0%, #C59427 100%);
  color: #1B1304;
  box-shadow: 0 3px 12px rgba(197, 148, 39, 0.35);
  transition: transform 0.15s ease, filter 0.15s ease;
}

.cnmax-btn-unlock:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
}

.cnmax-btn-toggle,
.cnmax-btn-fold {
  cursor: pointer;
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 12.5px;
  font-weight: 600;
  border: 1px solid var(--max-gold);
  background: rgba(212, 175, 55, 0.15);
  color: #F7DF8B;
}

.cnmax-dock:not(.is-max) .cnmax-btn-toggle,
.cnmax-dock:not(.is-max) .cnmax-btn-fold {
  border-color: var(--rule, #C7D2CE);
  background: transparent;
  color: inherit;
}

/* 穿越者定制台选项栅格 */
.cnmax-cfg {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed rgba(212, 175, 55, 0.35);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(195px, 1fr));
  gap: 10px 14px;
}

.cnmax-dock:not(.is-max) .cnmax-cfg {
  border-top-color: var(--rule, #C7D2CE);
}

.cnmax-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cnmax-field label {
  font-size: 12px;
  font-weight: 600;
  opacity: 0.85;
}

.cnmax-field select {
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 13px;
  border: 1px solid rgba(212, 175, 55, 0.45);
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
}

.cnmax-dock:not(.is-max) .cnmax-field select {
  border-color: var(--rule, #C7D2CE);
  background: var(--paper, #fff);
  color: var(--ink, #13212A);
}

.cnmax-dock.is-max .cnmax-field select option {
  background: #1D1A24;
  color: #F6F1E3;
}

/* 光环胶囊展示条 */
.cnmax-buff-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.cnmax-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  background: var(--buff-bg);
  color: var(--buff-ink);
  border: 1px solid var(--buff-border);
  line-height: 1.3;
}

.cnmax-pill.gold {
  background: linear-gradient(135deg, rgba(247, 223, 139, 0.22), rgba(212, 175, 55, 0.14));
  color: #B37E10;
  border: 1px solid rgba(212, 175, 55, 0.65);
}

html[data-theme="dark"] .cnmax-pill.gold,
.cnmax-dock.is-max .cnmax-pill.gold,
.cert.is-max-cert .cnmax-pill.gold,
.idcard.is-max-id .cnmax-pill.gold {
  color: #F7DF8B;
  background: rgba(212, 175, 55, 0.18);
  border-color: rgba(247, 223, 139, 0.55);
}

.cnmax-immortal-chip {
  cursor: pointer;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px dashed var(--max-gold);
  background: rgba(212, 175, 55, 0.12);
  color: inherit;
}

/* 出生证与身份卡的黑金流光主题 */
.cert.is-max-cert {
  border: 2px solid var(--max-gold) !important;
  box-shadow: 0 10px 36px rgba(212, 175, 55, 0.22) !important;
}

.cert.is-max-cert > .band {
  background: linear-gradient(90deg, #1E172B, #3B2B10, #1E172B) !important;
  color: #F7DF8B !important;
  border-bottom: 1px solid var(--max-gold) !important;
}

.idcard.is-max-id {
  border: 1.5px solid var(--max-gold) !important;
  box-shadow: 0 4px 20px rgba(212, 175, 55, 0.16) !important;
}

.idcard.is-max-id .top {
  color: #D4AF37 !important;
  font-weight: 700;
}

/* 抉择弹窗中的【穿越者金手指】专属王炸按钮 */
.cnmax-cheat-choice {
  position: relative;
  display: block;
  width: 100%;
  text-align: left;
  padding: 13px 15px !important;
  margin-top: 10px !important;
  border-radius: 10px !important;
  border: 1.5px solid #D4AF37 !important;
  background: linear-gradient(135deg, rgba(40, 30, 12, 0.94) 0%, rgba(68, 48, 14, 0.94) 100%) !important;
  color: #FFF6D6 !important;
  box-shadow: 0 4px 16px rgba(212, 175, 55, 0.28) !important;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.cnmax-cheat-choice:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(212, 175, 55, 0.42) !important;
}

.cnmax-cheat-choice .k {
  background: linear-gradient(135deg, #F7DF8B, #D4AF37) !important;
  color: #1E1404 !important;
  font-weight: 800 !important;
  padding: 2px 7px !important;
  border-radius: 5px !important;
}

.cnmax-cheat-choice b {
  color: #F7DF8B !important;
  font-size: 15px !important;
}

.cnmax-cheat-choice small {
  display: block;
  margin-top: 4px;
  color: #EBD8A0 !important;
  opacity: 0.92;
  font-size: 12.5px !important;
}

/* 模拟收银台 Modal */
.cnmax-pay-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(10, 12, 16, 0.72);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.cnmax-pay-modal {
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 16px;
  background: linear-gradient(160deg, #181422 0%, #221B30 100%);
  border: 1.5px solid var(--max-gold);
  color: #F5EFE0;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.65);
}

.cnmax-pay-hd {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.cnmax-pay-hd h2 {
  margin: 4px 0 0;
  font-size: 21px;
  color: #F7DF8B;
}

.cnmax-pay-close {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  border-radius: 8px;
  padding: 4px 10px;
  cursor: pointer;
}

.cnmax-pay-perks {
  list-style: none;
  padding: 0;
  margin: 14px 0;
  display: grid;
  gap: 9px;
}

.cnmax-pay-perks li {
  padding: 9px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(212, 175, 55, 0.25);
  font-size: 13px;
  line-height: 1.45;
}

.cnmax-pay-perks li b {
  color: #F7DF8B;
  display: block;
  margin-bottom: 2px;
}

.cnmax-pay-price {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 11px 14px;
  border-radius: 10px;
  background: rgba(212, 175, 55, 0.12);
  border: 1px solid rgba(212, 175, 55, 0.4);
  margin-bottom: 14px;
}

.cnmax-pay-price strong {
  font-size: 24px;
  color: #F7DF8B;
}

.cnmax-pay-actions {
  display: grid;
  gap: 10px;
}

.cnmax-pay-primary {
  cursor: pointer;
  width: 100%;
  padding: 12px 16px;
  border-radius: 10px;
  border: none;
  font-size: 15px;
  font-weight: 800;
  background: linear-gradient(135deg, #F7DF8B 0%, #D4AF37 100%);
  color: #1A1204;
  box-shadow: 0 4px 18px rgba(212, 175, 55, 0.35);
}

.cnmax-pay-code-row {
  display: flex;
  gap: 8px;
  margin: 4px 0 0;
}

.cnmax-pay-code-row input {
  flex: 1;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(0, 0, 0, 0.3);
  color: #fff;
  font-size: 13.5px;
}

.cnmax-pay-code-row button {
  cursor: pointer;
  padding: 9px 14px;
  border-radius: 8px;
  border: 1px solid var(--max-gold);
  background: rgba(212, 175, 55, 0.2);
  color: #F7DF8B;
  font-weight: 600;
}

.cnmax-code-msg {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: #FF9B9B;
}

/* 结局传奇爽剧横幅 */
.cnmax-dead-banner {
  margin: 0 0 18px;
  padding: 16px 20px;
  border-radius: 12px;
  background: linear-gradient(135deg, #1B1528 0%, #2C2112 100%);
  border: 1.5px solid var(--max-gold);
  color: #F6EFE2;
}

.cnmax-dead-banner h3 {
  margin: 0 0 6px;
  color: #F7DF8B;
  font-size: 18px;
}

.cnmax-dead-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.cnmax-dead-grid div {
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(212, 175, 55, 0.25);
}

.cnmax-dead-grid small {
  display: block;
  font-size: 11.5px;
  opacity: 0.78;
}

.cnmax-dead-grid b {
  font-size: 15px;
  color: #F7DF8B;
}

/* 键盘焦点可见性与减弱动态偏好支持 */
.cnmax-dock button:focus-visible,
.cnmax-dock select:focus-visible,
.cnmax-pay-modal button:focus-visible,
.cnmax-pay-modal input:focus-visible,
.cnmax-cheat-choice:focus-visible,
.cnmax-immortal-chip:focus-visible {
  outline: 2px solid var(--max-gold-bright, #F7DF8B) !important;
  outline-offset: 2px !important;
}

@media (max-width: 640px) {
  .cnmax-dock {
    margin: 10px 0 12px;
    padding: 12px 14px;
  }
  .cnmax-title {
    font-size: 14.5px;
  }
  .cnmax-cfg {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cnmax-dock,
  .cnmax-btn-unlock,
  .cnmax-cheat-choice {
    transition: none !important;
    transform: none !important;
  }
}
