/* ============================================================
   单词过关王 · 首页
   设计稿基准 375px；rem 适配：1rem = 10px（375 宽时）
   所有视觉数值 = 设计稿 px / 10 rem
   ============================================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: calc(min(100vw, 540px) / 37.5);
  /* html 底色 = 动画天空最顶色：下拉回弹/顶部过卷时露出的也是天空色，
     永远看不到白色区域 */
  background: #a1dcff;
  overscroll-behavior-y: none;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  /* body 保持白色：页面自身盖住 html 底色，仅过卷区域露天空色 */
  background: #ffffff;
  color: #222222;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

button {
  font-family: inherit;
  border: none;
  background: none;
  cursor: pointer;
}

#app {
  max-width: 540px;
  margin: 0 auto;
  min-height: 100vh;
  background: #ffffff;
}

/* ===== 顶部天空区（整块预留给 Lottie 飞机动画） =====
   动画内容实际占 540×448 中的 37.7~448 段（天空上沿溢出、
   波浪下沿溢出）；外框高 28.4rem（409px），动画底部对齐外框底，
   顶部 39px 白条被 overflow:hidden 裁掉，画面完整不裁切 */
.sky {
  position: relative;
  height: 28.4rem;
  background: transparent;
  overflow: hidden;
}

/* Lottie 动画容器：高度保持完整渲染区 31.11rem，整体上移 8%（3.11-0.62=2.49rem），
   顶部溢出部分被外框裁掉，底部腾出的空隙由上移的内容区盖住 */
.lottie-container {
  position: absolute;
  bottom: 2.49rem;
  left: 0;
  right: 0;
  height: 31.11rem;
  pointer-events: none;
}

/* 注入的 Lottie svg 带内联宽高，需强制铺满容器 */
.lottie-container svg {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* ===== 主内容区 =====
   负外边距把整块内容上移 20%（相对原起始位置 28.4rem），
   盖住动画底部波浪一段，顶部圆角呈“内容页上浮”效果 */
.content {
  position: relative;
  z-index: 1;
  margin-top: -5.7rem;
  padding: 0 2rem;
  background: #ffffff;
  border-radius: 0.8rem 0.8rem 0 0; /* 顶部两角小圆角 */
}

/* --- 词书信息卡（竖版封面 + 信息 + 进度） --- */
.book-card {
  display: flex;
  align-items: stretch;
  gap: 1.4rem;
  padding-top: 1.6rem;
}

.book-cover {
  flex: none;
  width: 8.3rem;
  height: 11.1rem;
  object-fit: cover;
  border-radius: 0.6rem;
  box-shadow: 0 0.2rem 0.6rem rgba(0, 0, 0, 0.12);
  background: #f2f4f7;
}

.book-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* 徽章、标题、“修改”同行：徽章紧挨标题，修改靠右；整行已缩小 15%（各尺寸×0.85） */
.book-row {
  display: flex;
  align-items: center;
  gap: 0.68rem;
}

.book-left {
  flex: none;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.book-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* 高度 = 标题行高（1.53rem × 1.3 ≈ 1.99rem），与文字高度一致 */
  height: 1.99rem;
  padding: 0 0.85rem;
  background: #3bce8c;
  color: #ffffff;
  font-size: 1.1rem;
  font-weight: 700;
  border-radius: 0.5rem;
  letter-spacing: 0.04rem;
  line-height: 1;
}

.book-note {
  display: none; /* “精选高频词”已按需求移除 */
  font-size: 1.2rem;
  color: #9aa3ae;
  padding-bottom: 0.35rem;
}

.book-right {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.book-title {
  flex: none;
  font-size: 1.53rem;
  font-weight: 700;
  color: #1f1f1f;
  line-height: 1.3;
}

.book-change {
  font-size: 1.02rem;
  color: #4a90e2;
  padding: 0;
  line-height: 1.3;
}

.book-change:active {
  opacity: 0.6;
}

/* --- 学习进度 --- */
.progress-wrap {
  margin-top: 1.6rem;
}

.progress-num {
  margin-top: 0.8rem;
  text-align: center;
  font-size: 1.3rem;
  color: #a8afb9;
}

.progress-bar {
  height: 0.7rem;
  background: #edeff2;
  border-radius: 0.35rem;
  overflow: hidden;
}

.progress-fill {
  width: 0%;
  height: 100%;
  background: #6b5ce7;
  border-radius: 0.35rem;
  transition: width 0.6s ease;
}

/* --- 今日计划 / 今日积分 --- */
.today {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: 3.2rem;
}

.today-col {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.today-label {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1f1f1f;
}

.today-value {
  margin-top: 1.4rem;
  font-size: 4.6rem;
  font-weight: 800;
  color: #16181d;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.today-unit {
  margin-top: 0.6rem;
  font-size: 1.3rem;
  color: #a0a7b1;
}

/* --- 主操作按钮 --- */
.btn-main {
  display: block;
  width: 100%;
  margin-top: 4.2rem;
  height: 5.8rem;
  border-radius: 1.2rem;
  background: #ff4b4b;
  color: #ffffff;
  font-size: 2.1rem;
  font-weight: 700;
  letter-spacing: 0.1rem;
  box-shadow: 0 0.6rem 1.6rem rgba(255, 75, 75, 0.35);
  transition: transform 0.12s ease, filter 0.12s ease;
}

.btn-main:active {
  transform: scale(0.98);
  filter: brightness(0.95);
}

/* --- 四宫格功能入口 --- */
.entry-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
  margin-top: 1.8rem;
}

.entry-card {
  position: relative;
  height: 10.8rem;
  border-radius: 1.4rem;
  padding: 1.5rem 1.6rem;
  color: #ffffff;
  overflow: hidden;
  text-align: left;
  transition: transform 0.12s ease, filter 0.12s ease;
}

.entry-card:active {
  transform: scale(0.97);
  filter: brightness(0.96);
}

.entry-card.theme-green  { background: #21c48c; }
.entry-card.theme-orange { background: #ffad26; }
.entry-card.theme-blue   { background: #3e8ef7; }
.entry-card.theme-red    { background: #ff5e5e; }

.entry-card.centered {
  display: flex;
  align-items: center;
  justify-content: center;
}

.entry-title {
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1.3;
}

.entry-card.centered .entry-title {
  font-size: 1.5rem;
  font-weight: 500;
}

.entry-desc {
  margin-top: 0.5rem;
  font-size: 1.1rem;
  line-height: 1.7;
  opacity: 0.95;
}

.entry-icon {
  position: absolute;
  right: 1.2rem;
  top: 50%;
  transform: translateY(-50%);
  width: 4.6rem;
  height: 4.6rem;
  opacity: 0.9;
  pointer-events: none;
}

/* ===== 底部 Tab Bar ===== */
.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 540px;
  display: flex;
  background: #ffffff;
  border-top: 1px solid #f0f1f3;
  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;
  gap: 0.2rem;
  padding: 0.8rem 0 0.7rem;
  color: #9aa2ac;
}

.tab-item svg {
  width: 2.4rem;
  height: 2.4rem;
  display: block;
}

.tab-label {
  font-size: 1rem;
  line-height: 1.2;
}

.tab-item.active {
  color: #29be8b;
}

.tab-item:active {
  opacity: 0.65;
}

/* 底部安全区占位，避免内容被 Tab Bar 遮挡 */
.safe-spacer {
  height: calc(6.4rem + env(safe-area-inset-bottom));
}

/* ===== Toast 轻提示 ===== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 9rem;
  transform: translateX(-50%) translateY(1rem);
  max-width: 70vw;
  padding: 1rem 1.6rem;
  background: rgba(30, 32, 38, 0.82);
  color: #ffffff;
  font-size: 1.3rem;
  line-height: 1.4;
  border-radius: 1rem;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 200;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
