/**
 * H5 预览外壳样式 —— 手机边框、导航栏、TabBar、Toast / Modal。
 *
 * 这里只负责「容器」，小程序自身的样式全部来自 app.wxss 与各页 wxss。
 * 外壳宽度固定 375px，与 rpx 换算基准一致（750rpx = 375px）。
 */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 32px;
  padding: 32px 24px;
  background: #eef0f4;
  font-family: 'Microsoft YaHei', 'PingFang SC', 'Hiragino Sans GB', sans-serif;
  color: #1f2430;
}

/* ── 手机外壳 ── */

.phone {
  width: 375px;
  height: 720px;
  flex: 0 0 375px;
  display: flex;
  flex-direction: column;
  background: #f5f6fa;
  border: 1px solid #d5d9e0;
  box-shadow: 0 12px 40px rgba(27, 42, 74, 0.12);
  overflow: hidden;
}

.statusbar {
  height: 22px;
  flex: 0 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  background: #1b2a4a;
  color: #fff;
  font-size: 11px;
  letter-spacing: 0.4px;
}

.navbar {
  height: 44px;
  flex: 0 0 44px;
  display: flex;
  align-items: center;
  background: #1b2a4a;
  color: #fff;
  position: relative;
}

.nav-back {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  user-select: none;
}

.nav-back:active {
  opacity: 0.6;
}

.nav-title {
  position: absolute;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  pointer-events: none;
}

.page-host {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  background: #f5f6fa;
}

.page-host::-webkit-scrollbar {
  width: 0;
}

.page {
  min-height: 100%;
  background: #f5f6fa;
}

.page-enter {
  animation: pageIn 0.22s ease;
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateX(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ── TabBar ── */

.tabbar {
  flex: 0 0 54px;
  height: 54px;
  display: flex;
  background: #fff;
  border-top: 1px solid #e6e9ef;
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: #8a94a6;
  font-size: 11px;
  cursor: pointer;
}

.tab-on {
  color: #1b2a4a;
  font-weight: 600;
}

.tab-ico {
  width: 20px;
  height: 20px;
  position: relative;
}

.tab-ico::before {
  content: '';
  position: absolute;
  inset: 0;
  border: 1.5px solid currentColor;
  border-radius: 2px;
}

.tab-ico-index::before {
  border-radius: 50%;
}

.tab-ico-tools::before {
  transform: rotate(45deg) scale(0.8);
}

.tab-ico-mine::before {
  border-radius: 50% 50% 3px 3px;
}

.tab-on .tab-ico::before {
  background: currentColor;
}

/* ── 右侧说明 ── */

.hint {
  max-width: 320px;
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 13px;
  line-height: 1.75;
  color: #5b6478;
}

.hint b {
  font-size: 15px;
  color: #1b2a4a;
}

/* ── Toast / Modal / Loading ── */

.h5-toast {
  position: fixed;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%) scale(0.96);
  max-width: 260px;
  padding: 12px 18px;
  background: rgba(28, 32, 40, 0.88);
  color: #fff;
  font-size: 13px;
  line-height: 1.6;
  text-align: center;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 9000;
  pointer-events: none;
}

.h5-toast.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.h5-toast-icon {
  font-size: 20px;
  margin-bottom: 2px;
}

.h5-loading {
  position: fixed;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%);
  padding: 12px 18px;
  background: rgba(28, 32, 40, 0.88);
  color: #fff;
  font-size: 13px;
  border-radius: 4px;
  z-index: 9000;
  display: none;
}

.h5-mask {
  position: fixed;
  inset: 0;
  background: rgba(20, 24, 32, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9100;
}

.h5-modal {
  width: 300px;
  background: #fff;
  border-radius: 4px;
  overflow: hidden;
}

.h5-modal-title {
  padding: 18px 20px 6px;
  font-size: 16px;
  font-weight: 600;
  color: #1b2a4a;
}

.h5-modal-body {
  padding: 4px 20px 20px;
  font-size: 14px;
  line-height: 1.7;
  color: #5b6478;
  white-space: pre-wrap;
}

.h5-modal-actions {
  display: flex;
  border-top: 1px solid #eef0f4;
}

.h5-btn {
  flex: 1;
  height: 46px;
  border: 0;
  background: #fff;
  font-size: 15px;
  color: #1b2a4a;
  cursor: pointer;
  font-family: inherit;
}

.h5-btn-ok {
  color: #1b2a4a;
  font-weight: 600;
}

.h5-btn-cancel {
  color: #8a94a6;
  border-right: 1px solid #eef0f4;
}

.h5-btn:active {
  background: #f5f6fa;
}

.h5-sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 375px;
  background: #fff;
}

.h5-sheet-item {
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  border-bottom: 1px solid #f0f2f6;
  cursor: pointer;
}

.h5-sheet-cancel {
  color: #8a94a6;
  border-bottom: 0;
}

.h5-note {
  padding: 24px;
  font-size: 13px;
  color: #8a94a6;
  line-height: 1.8;
}

/* 编译产物里的 canvas（证书页）需要显式宽度，否则按默认 300px 画 */
canvas {
  max-width: 100%;
}

.tab-ico::before,.tab-ico::after {display:none}
.tab[data-tab="pages/home/index"] .tab-ico {background:transparent url("./assets/tabs/grid.png") center / contain no-repeat}
.tab.tab-on[data-tab="pages/home/index"] .tab-ico {background:transparent url("./assets/tabs/grid-on.png") center / contain no-repeat}
.tab[data-tab="pages/courses/index"] .tab-ico {background:transparent url("./assets/tabs/book.png") center / contain no-repeat}
.tab.tab-on[data-tab="pages/courses/index"] .tab-ico {background:transparent url("./assets/tabs/book-on.png") center / contain no-repeat}
.tab[data-tab="pages/exams/index"] .tab-ico {background:transparent url("./assets/tabs/award.png") center / contain no-repeat}
.tab.tab-on[data-tab="pages/exams/index"] .tab-ico {background:transparent url("./assets/tabs/award-on.png") center / contain no-repeat}
.tab[data-tab="pages/mine/index"] .tab-ico {background:transparent url("./assets/tabs/user.png") center / contain no-repeat}
.tab.tab-on[data-tab="pages/mine/index"] .tab-ico {background:transparent url("./assets/tabs/user-on.png") center / contain no-repeat}
.phone:has(.notice-layer),.phone:has(.tools-menu) { transform: translateZ(0); }

.page[data-page="pages/qa/index"],.page[data-page="pages/qa/index"] .chat {height:100%;min-height:0}
