/* ============================================================
   共享视觉组件
   ============================================================ */

/* ------------------------------------------------------------
   顶部导航栏
   ------------------------------------------------------------ */
.topbar {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: max(14px, calc(env(safe-area-inset-top) + 8px)) clamp(18px, 3vw, 36px) 12px;
}

.topbar-logo {
  font-size: clamp(18px, 1.8vw, 22px);
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--gold);
  text-shadow: 0 0 14px rgba(200, 160, 90, 0.4);
}

.topbar-tabs {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2vw, 26px);
}

.topbar-tabs .tab {
  color: rgba(196, 192, 182, 0.7);
  font-size: clamp(12px, 1.1vw, 14px);
  letter-spacing: 0.1em;
  text-decoration: none;
  padding-bottom: 3px;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
  cursor: pointer;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: inherit;
}

.topbar-tabs .tab:hover {
  color: var(--moon);
}

.topbar-tabs .tab.is-current {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

.nav-back {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  background-image: url("../assets/game/导航栏_返回_button.webp");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  background-color: transparent;
  border: none;
  cursor: pointer;
  margin-top: 6px;
  color: transparent; /* 隐藏残留文字 */
  font-size: 0;
  padding: 0;
}

.nav-back:hover {
  filter: brightness(1.15);
}

/* ------------------------------------------------------------
   红色印章
   ------------------------------------------------------------ */
.seal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--seal);
  color: rgba(255, 236, 226, 0.95);
  font-family: "KaiTi", "STKaiti", "SimKai", serif;
  font-weight: 700;
  border: 1px solid rgba(160, 40, 30, 0.9);
  box-shadow: inset 0 0 0 2px rgba(255, 236, 226, 0.22), 0 0 10px rgba(168, 53, 43, 0.35);
  transform: rotate(-4deg);
  line-height: 1;
  user-select: none;
}

.seal--round {
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 20px;
}

.seal--rect {
  border-radius: 3px;
  padding: 6px 10px;
  font-size: 15px;
}

/* ------------------------------------------------------------
   进度条（修为）
   ------------------------------------------------------------ */
.progress-bar {
  position: relative;
  height: 14px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(178, 140, 84, 0.35);
  overflow: hidden;
}

.progress-bar::before {
  content: "";
  position: absolute;
  inset: 0;
  width: var(--pct, 50%);
  background: linear-gradient(to right, rgba(120, 92, 46, 0.7), var(--gold));
  box-shadow: 0 0 10px rgba(200, 160, 90, 0.5);
  transition: width 0.6s ease;
}

.progress-bar .pbar-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--moon);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

/* ------------------------------------------------------------
   卡片
   ------------------------------------------------------------ */
.card {
  background: var(--paper);
  border: 1px solid var(--line-gold);
  border-radius: 8px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4), 0 10px 34px rgba(0, 0, 0, 0.45);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

/* ------------------------------------------------------------
   金色描边文字按钮
   ------------------------------------------------------------ */
.btn-gold {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: none;
  border: 1px solid rgba(200, 160, 90, 0.85);
  border-radius: 4px;
  color: var(--gold);
  font-family: inherit;
  font-size: clamp(13px, 1.1vw, 14px);
  letter-spacing: 0.14em;
  padding: 9px 22px;
  cursor: pointer;
  transition: box-shadow 0.2s ease, background 0.2s ease, transform 0.12s ease;
}

.btn-gold:hover {
  box-shadow: 0 0 16px rgba(200, 160, 90, 0.35), inset 0 0 10px rgba(200, 160, 90, 0.12);
}

.btn-gold:active {
  transform: scale(0.98);
}

/* 幽灵按钮：无描边弱化 */
.btn-ghost {
  background: none;
  border: none;
  color: rgba(196, 192, 182, 0.6);
  font-family: inherit;
  font-size: clamp(11px, 1vw, 12px);
  letter-spacing: 0.1em;
  padding: 4px 8px;
  cursor: pointer;
  transition: color 0.2s ease;
}

.btn-ghost:hover {
  color: var(--gold);
}

/* ------------------------------------------------------------
   背景占位原语（纯 CSS，后续可替换为真实素材）
   素材替换点：在每个原语下方注释标注
   ------------------------------------------------------------ */

/* 右上月牙 */
.bg-moon {
  position: absolute;
  right: 8%;
  top: 7%;
  width: clamp(64px, 9vh, 110px);
  height: clamp(64px, 9vh, 110px);
  border-radius: 50%;
  background: rgba(238, 226, 198, 0.9);
  box-shadow: 0 0 40px 14px rgba(238, 226, 198, 0.35), inset -18px -10px 0 rgba(180, 170, 150, 0.5);
  opacity: 0.92;
  pointer-events: none;
}
/* 素材替换点：<div class="bg-moon" style="background:url(...) center/contain no-repeat"></div> */

/* 星点 */
.bg-stars {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1.2px 1.2px at 18% 22%, rgba(238, 226, 198, 0.7) 50%, transparent 51%),
    radial-gradient(1px 1px at 32% 14%, rgba(238, 226, 198, 0.45) 50%, transparent 51%),
    radial-gradient(1.4px 1.4px at 62% 8%, rgba(238, 226, 198, 0.6) 50%, transparent 51%),
    radial-gradient(1px 1px at 78% 26%, rgba(238, 226, 198, 0.4) 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 46% 32%, rgba(238, 226, 198, 0.5) 50%, transparent 51%);
  background-repeat: repeat;
  pointer-events: none;
  animation: twinkle 4.5s ease-in-out infinite;
}

@keyframes twinkle {
  0%, 100% { opacity: 0.75; }
  50% { opacity: 0.4; }
}

/* 底部山峦剪影（2 层） */
.bg-mountains {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 32%;
  pointer-events: none;
}

.bg-mountains::before {
  content: "";
  position: absolute;
  inset: 0 0 0 0;
  background: linear-gradient(to top, rgba(10, 14, 20, 0.92), rgba(10, 14, 20, 0.55) 62%, transparent);
  clip-path: polygon(0 62%, 8% 40%, 16% 56%, 24% 28%, 34% 52%, 44% 34%, 54% 58%, 64% 36%, 74% 54%, 84% 30%, 92% 50%, 100% 40%, 100% 100%, 0 100%);
}

.bg-mountains::after {
  content: "";
  position: absolute;
  inset: 24% 0 0 0;
  background: linear-gradient(to top, rgba(8, 12, 18, 0.85), rgba(8, 12, 18, 0.35) 70%, transparent);
  clip-path: polygon(0 70%, 12% 44%, 22% 64%, 32% 36%, 44% 60%, 56% 40%, 68% 62%, 80% 30%, 90% 56%, 100% 38%, 100% 100%, 0 100%);
}

/* 云带 */
.bg-clouds {
  position: absolute;
  left: -20%;
  width: 140%;
  height: 60px;
  filter: blur(14px);
  background: linear-gradient(90deg, transparent, rgba(140, 150, 170, 0.14), rgba(180, 190, 210, 0.2), rgba(140, 150, 170, 0.14), transparent);
  border-radius: 50%;
  pointer-events: none;
  animation: drift 26s linear infinite;
}

@keyframes drift {
  from { transform: translateX(0); }
  to { transform: translateX(14%); }
}

/* ------------------------------------------------------------
   浮层选择器（创建角色 picker 通用）
   ------------------------------------------------------------ */
.picker-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, 0.62);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s ease, visibility 0.22s;
}

.picker-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.picker-sheet {
  width: min(92vw, 460px);
  max-height: 62vh;
  overflow-y: auto;
  margin-bottom: max(16px, calc(env(safe-area-inset-bottom) + 8px));
  padding: 18px 16px;
  border-radius: 10px;
  /* 隐藏滚动条但保留滚动能力 */
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.picker-sheet::-webkit-scrollbar {
  display: none;
}

/* ---------- 通用弹层（modal-overlay）：固定全屏遮罩 + 底部卡片 ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, 0.68);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s ease, visibility 0.22s;
}
.modal-overlay.is-open {
  opacity: 1;
  visibility: visible;
}
.modal-sheet {
  width: min(88vw, 400px);
  margin-bottom: max(20px, calc(env(safe-area-inset-bottom) + 12px));
  padding: 18px 16px;
  border-radius: 10px;
  max-height: 62vh;
  overflow-y: auto;
}
.modal-sheet h3 {
  color: var(--gold);
  font-size: 14px;
  letter-spacing: 0.14em;
  margin-bottom: 12px;
  text-align: center;
}
.modal-body {
  color: rgba(232, 228, 218, 0.85);
  font-size: 13px;
  line-height: 1.9;
  letter-spacing: 0.05em;
}
.modal-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 14px;
}
.modal-actions .btn-gold {
  font-size: 13px;
  padding: 8px 24px;
}
.modal-actions .btn-ghost {
  font-size: 13px;
}

.picker-sheet h3 {
  color: var(--gold);
  font-size: 14px;
  letter-spacing: 0.14em;
  margin-bottom: 12px;
  text-align: center;
}

.picker-option {
  display: block;
  width: 100%;
  text-align: center;
  background: none;
  border: 1px solid transparent;
  color: rgba(232, 228, 218, 0.88);
  font-family: inherit;
  font-size: 14px;
  letter-spacing: 0.1em;
  padding: 11px 8px;
  border-radius: 5px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.picker-option:hover,
.picker-option.is-selected {
  color: var(--gold);
  border-color: rgba(200, 160, 90, 0.5);
  background: rgba(200, 160, 90, 0.1);
}

.picker-close {
  display: block;
  margin: 8px auto 0;
  background: none;
  border: none;
  color: rgba(196, 192, 182, 0.55);
  font-family: inherit;
  font-size: 12px;
  letter-spacing: 0.12em;
  cursor: pointer;
  padding: 6px 16px;
}

/* 人生目标自定义输入 */
.picker-custom {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 10px 12px;
  background: rgba(20, 18, 15, 0.8);
  border: 1px solid rgba(178, 140, 84, 0.35);
  border-radius: 5px;
  color: rgba(236, 232, 222, 0.92);
  font-family: inherit;
  font-size: 14px;
  letter-spacing: 0.08em;
  outline: none;
  transition: border-color 0.15s;
}
.picker-custom:focus {
  border-color: var(--gold);
}
.picker-custom::placeholder {
  color: rgba(154, 150, 141, 0.55);
}

.picker-close:hover {
  color: var(--moon);
}

/* 年龄步进器 */
.stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 12px 0;
}

.stepper button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(200, 160, 90, 0.6);
  background: rgba(200, 160, 90, 0.08);
  color: var(--gold);
  font-size: 20px;
  cursor: pointer;
  font-family: inherit;
}

.stepper .stepper-val {
  font-size: 26px;
  color: var(--moon);
  min-width: 48px;
  text-align: center;
  letter-spacing: 0.1em;
}

/* Toast */
.toast {
  position: fixed;
  top: max(18px, calc(env(safe-area-inset-top) + 10px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  background: var(--paper);
  border: 1px solid var(--line-gold);
  border-radius: 6px;
  color: var(--moon);
  font-size: 13px;
  letter-spacing: 0.08em;
  padding: 10px 22px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s;
}

.toast.is-show {
  opacity: 1;
  visibility: visible;
}

/* ============================================================
   全局定制滚动条（水墨金风）
   统一替换所有页面的原生滚动条：细轨、透明底、鎏金滑块
   ============================================================ */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(200, 160, 90, 0.45) transparent;
}
*::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
*::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(200, 160, 90, 0.55), rgba(168, 134, 76, 0.55));
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.25);
}
*::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(216, 180, 130, 0.8), rgba(200, 160, 90, 0.8));
}
*::-webkit-scrollbar-corner {
  background: transparent;
}
