/* ===== 全局样式 热卜国学 H5 ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --primary: #e8533f;
  --primary-light: #ff6b57;
  --text-main: #333;
  --text-sub: #666;
  --text-light: #999;
  --bg-page: #f5f6f8;
  --bg-card: #fff;
  --border: #eee;
  --tab-active: #17a2b8;
  --tab-normal: #999;
  /* 应用容器宽度（桌面端按断点放大） */
  --app-max: 480px;
  --app-half: 240px;
}

/* 根字号：所有 rem 字号以此为基准，随屏幕尺寸与用户字体设置缩放 */
html {
  font-size: 100%;
  height: 100%;
}
@media (min-width: 900px) {
  html { font-size: 106.25%; }
}
@media (min-width: 1280px) {
  html { font-size: 112.5%; }
}

html, body {
  width: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text-main);
  background: var(--bg-page);
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* 正文基准字号：不写在 html 上，避免覆盖根字号 */
body {
  font-size: 0.875rem;
}

button, input, select, textarea {
  font-family: inherit;
  color: inherit;
}

/* iOS 聚焦输入框不自动放大页面 */
@supports (-webkit-touch-callout: none) {
  input, select, textarea {
    font-size: 1rem;
  }
}

/* 平板 / 电脑：容器按断点放大并居中，模拟应用面板 */
@media (min-width: 768px) {
  body {
    background: #e9eaec;
  }
  .status-bar {
    display: none;
  }
  .app-container {
    box-shadow: 0 0 28px rgba(0,0,0,0.12);
  }
}

/* 状态栏占位 */
.status-bar {
  width: 100%;
  height: env(safe-area-inset-top);
  min-height: 20px;
  background: #fff;
}

/* 主容器 */
.app-container {
  position: relative;
  width: 100%;
  max-width: var(--app-max);
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg-page);
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* 页面内容 */
.page-content {
  flex: 1;
  padding-bottom: calc(56px + env(safe-area-inset-bottom));
  overflow-y: auto;
}

.page {
  display: none;
}
.page.active {
  display: block;
  animation: pageIn 0.22s ease;
}
@keyframes pageIn {
  from { opacity: 0.55; }
  to { opacity: 1; }
}

.page-header {
  padding: 16px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.page-header h2 {
  font-size: 1.125rem;
  font-weight: 600;
}

/* 空状态 */
.empty-tip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  color: var(--text-light);
}
.empty-icon {
  font-size: 3.75rem;
  margin-bottom: 16px;
}
.empty-tip p {
  font-size: 0.875rem;
}

/* ===== 底部导航栏 ===== */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--app-max);
  height: calc(56px + env(safe-area-inset-bottom));
  background: #fff;
  display: flex;
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 100;
}
.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--tab-normal);
  font-size: 0.6875rem;
  cursor: pointer;
  transition: color 0.2s;
}
.tab-item .tab-icon {
  font-size: 1.375rem;
  margin-bottom: 2px;
  opacity: 0.7;
}
.tab-item .tab-svg {
  width: 22px;
  height: 22px;
  margin-bottom: 3px;
  flex-shrink: 0;
}
.tab-item.active {
  color: var(--tab-active);
  font-weight: 500;
}
.tab-item.active .tab-icon {
  opacity: 1;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.75);
  color: #fff;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 0.875rem;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  max-width: 80%;
  text-align: center;
}
.toast.show {
  opacity: 1;
}

/* ===== 弹窗 ===== */
.modal-mask {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: none;
}
.modal-mask.show {
  display: block;
  animation: maskIn 0.18s ease;
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 85%;
  max-width: 360px;
  background: #fff;
  border-radius: 12px;
  z-index: 1001;
  display: none;
  overflow: hidden;
}
.modal.show {
  display: block;
  animation: popIn 0.2s ease;
}
@keyframes maskIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes popIn {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.92); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-title {
  font-size: 1rem;
  font-weight: 600;
}
.modal-close {
  font-size: 1.375rem;
  color: var(--text-light);
  cursor: pointer;
  line-height: 1;
}
.modal-body {
  padding: 16px;
  max-height: 60vh;
  overflow-y: auto;
}

/* ===== 电脑端容器尺寸断点 ===== */
@media (min-width: 900px) {
  :root {
    --app-max: 600px;
    --app-half: 300px;
  }
  .modal {
    max-width: 400px;
  }
  .modal-body {
    max-height: 66vh;
  }
}
@media (min-width: 1280px) {
  :root {
    --app-max: 720px;
    --app-half: 360px;
  }
  .modal {
    max-width: 440px;
  }
}
