/* =============================================
   超级上上签 · 框架层 (framework.css)
   独立文件，修改框架不影响业务层
   ============================================= */

/* ===== 1. CSS 变量 ===== */
:root {
  /* 主色系 - 中国传统朱砂红+金色 */
  --gold: #d4a017;
  --gold-light: #f0d488;
  --gold-dark: #b8860b;
  --red: #c62828;
  --red-light: #ef5350;
  --red-dark: #8e0000;

  /* 暗色背景 */
  --bg: #0d0d0d;
  --bg-card: #1a0a0a;
  --bg-surface: #161010;
  --bg-hover: rgba(212, 160, 23, 0.06);

  /* 文字 */
  --text: #e0d5c0;
  --text-bright: #f5efe0;
  --text-dim: #887a6a;

  /* 间距 */
  --gap-sm: 4px;
  --gap-md: 8px;
  --gap-lg: 12px;
  --gap-xl: 16px;

  /* 圆角 */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  /* 阴影 */
  --shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* ===== 2. 基础重置 ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%;
  background: var(--bg);
  background-image: radial-gradient(1px 1px at 12% 16%, rgba(232,195,106,0.5), transparent 60%), radial-gradient(1px 1px at 31% 7%, rgba(232,195,106,0.35), transparent 60%), radial-gradient(1.5px 1.5px at 54% 20%, rgba(212,160,23,0.45), transparent 60%), radial-gradient(1px 1px at 76% 10%, rgba(232,195,106,0.3), transparent 60%), radial-gradient(1px 1px at 90% 28%, rgba(212,160,23,0.4), transparent 60%), radial-gradient(1.5px 1.5px at 19% 40%, rgba(212,160,23,0.3), transparent 60%), radial-gradient(1px 1px at 43% 32%, rgba(232,195,106,0.26), transparent 60%), radial-gradient(1px 1px at 65% 48%, rgba(212,160,23,0.32), transparent 60%), radial-gradient(1.5px 1.5px at 84% 58%, rgba(212,160,23,0.3), transparent 60%), radial-gradient(1px 1px at 28% 66%, rgba(232,195,106,0.24), transparent 60%), radial-gradient(1px 1px at 57% 76%, rgba(212,160,23,0.3), transparent 60%), radial-gradient(1.5px 1.5px at 79% 86%, rgba(212,160,23,0.26), transparent 60%);
  color: var(--text);
  font-family: 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  touch-action: pan-y;
}

/* ===== 3. 应用容器 ===== */
#app {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  background: var(--bg);
}

/* ===== 4. 页面系统 ===== */
.page {
  display: none;
  flex-direction: column;
  height: calc(100vh - 50px);
  height: calc(100dvh - 50px);
  overflow-y: auto;
  background: var(--bg);
}

.page.active {
  display: flex;
}

.page-header {
  display: flex;
  align-items: center;
  padding: 10px var(--gap-xl);
  background: var(--bg-surface);
  border-bottom: 1px solid rgba(212, 160, 23, 0.1);
  position: sticky;
  top: 0;
  z-index: 10;
}

.page-header h2 {
  flex: 1;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  color: var(--gold);
  margin: 0;
  letter-spacing: 2px;
}

.back-btn {
  background: none;
  border: none;
  color: var(--gold);
  font-size: 28px;
  cursor: pointer;
  padding: 8px 12px;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
}

.back-btn:hover {
  background: rgba(212, 160, 23, 0.1);
}

.header-spacer {
  width: 30px;
}

.page-body {
  flex: 1;
  padding: var(--gap-lg) var(--gap-xl);
  overflow-x: hidden;
  overflow-y: auto;
}

/* ===== 5. 底部导航栏 ===== */
.bottom-tab-bar {
  display: flex;
  background: rgba(0, 0, 0, 0.85);
  border-top: 1px solid rgba(212, 160, 23, 0.12);
  position: fixed;
  bottom: 0;
  width: 100%;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  /* blur removed for iOS scroll perf */
  background: rgba(10, 8, 4, 0.97);
}

.bottom-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 0;
  cursor: pointer;
  color: #666;
  font-size: 10px;
  transition: color 0.2s;
  position: relative;
}

.bottom-tab:hover {
  color: #999;
}

.bottom-tab.active {
  color: var(--gold);
}

.bottom-tab .tab-icon {
  font-size: 20px;
  margin-bottom: 2px;
  transition: transform 0.2s;
}

.bottom-tab.active .tab-icon {
  transform: scale(1.1);
}

/* ===== 6. 标签页系统 ===== */
.tab-page {
  display: none;
  flex-direction: column;
  height: calc(100vh - 50px);
  height: calc(100dvh - 50px);
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--bg);
}

.tab-page.active {
  display: flex;
}

.tab-header {
  padding: 12px 16px;
  background: var(--bg-surface);
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid rgba(212, 160, 23, 0.08);
  display: flex;
  align-items: center;
  gap: 8px;
}

.tab-header .back-btn {
  background: rgba(212, 160, 23, 0.1);
  border: 1px solid rgba(212, 160, 23, 0.2);
  color: var(--gold);
  font-size: 22px;
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s;
  flex-shrink: 0;
}

.tab-header .back-btn:hover {
  background: rgba(212, 160, 23, 0.2);
}

.tab-header-title {
  font-size: 17px;
  font-weight: bold;
  color: var(--gold);
  letter-spacing: 1px;
  flex: 1;
}

.tab-body {
  flex: 1;
  padding: var(--gap-lg) var(--gap-xl);
  overflow-x: hidden;
  overflow-y: auto;
}

/* ===== 7. 菜单项 ===== */
.wx-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: var(--radius-md);
  cursor: pointer;
  margin-bottom: 4px;
  transition: background 0.2s, transform 0.15s;
  border: 1px solid transparent;
}

.wx-menu-item:hover {
  background: rgba(212, 160, 23, 0.04);
  border-color: rgba(212, 160, 23, 0.08);
}

.wx-menu-item:active {
  transform: scale(0.98);
}

.wx-menu-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.wx-menu-body {
  flex: 1;
  min-width: 0;
}

.wx-menu-title {
  font-size: 14px;
  color: var(--text-bright);
  font-weight: 500;
}

.wx-menu-desc {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 1px;
}

.wx-menu-arrow {
  color: #555;
  font-size: 16px;
  transition: transform 0.2s;
}

.back-btn:hover {
  background: rgba(212, 160, 23, 0.1);
}

.wx-menu-item:hover .wx-menu-arrow {
  transform: translateX(3px);
}

/* ===== 8. 按钮 ===== */
.btn {
  display: block;
  width: 100%;
  padding: 14px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 2px;
  border: none;
  transition: all 0.2s;
  text-align: center;
  box-sizing: border-box;
}

.btn-gold {
  background: linear-gradient(135deg, rgba(212, 160, 23, 0.2), rgba(212, 160, 23, 0.08));
  border: 1px solid var(--gold);
  color: var(--gold);
}

.btn-gold:hover {
  background: linear-gradient(135deg, rgba(212, 160, 23, 0.3), rgba(212, 160, 23, 0.15));
  box-shadow: 0 0 20px rgba(212, 160, 23, 0.1);
}

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

.btn-primary {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, rgba(212, 160, 23, 0.15), rgba(212, 160, 23, 0.08));
  border: 1px solid var(--gold);
  border-radius: var(--radius-md);
  color: var(--gold);
  font-size: 15px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
  letter-spacing: 1px;
}

.btn-primary:hover {
  background: linear-gradient(135deg, rgba(212, 160, 23, 0.25), rgba(212, 160, 23, 0.15));
  box-shadow: 0 0 20px rgba(212, 160, 23, 0.1);
}

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

/* ===== 9. 输入框和下拉框 ===== */
input, select, textarea {
  font-family: inherit;
  font-size: 14px;
  color: var(--text-bright);
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(212, 160, 23, 0.15);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.2s;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(212, 160, 23, 0.1);
}

select {
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='6'%3E%3Cpath d='M0 0l6 6 6-6' fill='%23d4a017'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 28px;
}

select option {
  background: var(--bg-card);
  color: var(--text-bright);
}

/* ===== 10. 卡片 ===== */
.setup-card {
  background: var(--bg-card);
  border: 1px solid rgba(212, 160, 23, 0.1);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
  margin-bottom: var(--gap-xl);
}

.setup-card h3 {
  font-size: 16px;
  color: var(--gold);
  margin: 4px 0 var(--gap-md);
  letter-spacing: 1px;
}

.setup-card p {
  font-size: 13px;
  color: #999;
  margin: 0 0 var(--gap-xl);
  line-height: 1.6;
}

.setup-icon {
  font-size: 40px;
  margin-bottom: var(--gap-md);
}

/* ===== 11. 五行颜色 ===== */
.wx-mu { color: #4CAF50; }
.wx-huo { color: #FF5722; }
.wx-tu { color: #FFC107; }
.wx-jin { color: #9E9E9E; }
.wx-shui { color: #2196F3; }

/* ===== 12. 排版 ===== */
.section {
  margin-bottom: var(--gap-xl);
}

/* 结果返回条 */
.result-back {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
  padding: 6px 0;
}

.result-back button {
  background: rgba(212, 160, 23, 0.08);
  border: 1px solid rgba(212, 160, 23, 0.15);
  color: var(--gold);
  font-size: 22px;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  margin-right: 10px;
  transition: all 0.2s;
}

.result-back button:hover {
  background: rgba(212, 160, 23, 0.15);
}

.result-back span {
  font-size: 14px;
  color: var(--text-dim);
}

.wx-section-title {
  font-size: 13px;
  color: var(--gold);
  font-weight: bold;
  padding: var(--gap-md) 0 var(--gap-sm);
}

.bz-section {
  background: rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(212, 160, 23, 0.06);
  border-radius: var(--radius-md);
  padding: var(--gap-lg);
  margin-bottom: var(--gap-md);
}

.bz-section h3 {
  font-size: 15px;
  color: var(--gold);
  font-weight: 600;
  margin-bottom: var(--gap-md);
  padding-bottom: var(--gap-sm);
  border-bottom: 1px solid rgba(212, 160, 23, 0.08);
}

.bz-section p {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text);
}

.empty-state {
  font-size: 14px;
  color: var(--text-dim);
  text-align: center;
  padding: 30px 20px;
}

/* ===== 13. 动画 ===== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.page.active {
  /* 去掉切换闪一下 */
}

/* ===== 14. 响应式微调 ===== */

/* 会员专属遮罩（解锁后显示内容） */
html.kb-open,
html.kb-open body {
  position: static;
  height: auto;
  overflow: visible;
}

/* ===== iOS home-screen standalone: clear the top notch so headers/back buttons are tappable ===== */
@media (display-mode: standalone) {
  body {
    padding-top: env(safe-area-inset-top, 0px);
  }
  .tab-page {
    height: calc(100vh - 50px - env(safe-area-inset-top, 0px));
    height: calc(100dvh - 50px - env(safe-area-inset-top, 0px));
  }
}
