/* 词遇 · 沉浸式词汇学习平台 - 主样式 */
@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;600;700&family=Noto+Sans+SC:wght@300;400;500&display=swap');

:root {
  --pink:        #F472B6;
  --pink-light:  #FDF2F8;
  --pink-mid:    #FBCFE8;
  --pink-deep:   #EC4899;
  --green:       #10B981;
  --green-light: #ECFDF5;
  --red:         #EF4444;
  --red-light:   #FEF2F2;
  --text:        #1F2937;
  --text-sub:    #6B7280;
  --text-light:  #9CA3AF;
  --bg:          #FAFAFA;
  --card:        #FFFFFF;
  --border:      #F3F4F6;
  --shadow:      0 2px 12px rgba(244,114,182,0.10);
  --radius:      16px;
  --radius-sm:   10px;
  --nav-height:  60px;
  --header-height: 56px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; }
body {
  font-family: 'Noto Sans SC', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: var(--nav-height);
  max-width: 480px;
  margin: 0 auto;
  position: relative;
}

/* ===== 顶部导航 ===== */
.top-bar {
  height: var(--header-height);
  background: #fff;
  display: flex;
  align-items: center;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border);
}
.top-bar h1 { font-size: 18px; font-weight: 700; color: var(--pink-deep); font-family: 'Noto Serif SC', serif; }
.top-bar .back-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--pink-light);
  margin-right: 10px; cursor: pointer; border: none;
  color: var(--pink-deep); font-size: 18px;
}
.top-bar .right { margin-left: auto; }

/* ===== 底部导航 ===== */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%; max-width: 480px;
  height: var(--nav-height);
  background: #fff;
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 200;
}
.bottom-nav a {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-decoration: none; color: var(--text-light);
  font-size: 11px; gap: 3px; transition: color .2s;
}
.bottom-nav a.active, .bottom-nav a:hover { color: var(--pink-deep); }
.bottom-nav a svg { width: 22px; height: 22px; }
.bottom-nav a span { font-size: 11px; }

/* ===== 卡片 ===== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin: 0 12px 12px;
}

/* ===== 按钮 ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 12px 24px; border-radius: 50px;
  font-size: 15px; font-weight: 500;
  border: none; cursor: pointer; transition: all .2s;
  text-decoration: none; gap: 6px;
}
.btn-primary {
  background: linear-gradient(135deg, var(--pink), var(--pink-deep));
  color: #fff; width: 100%;
  box-shadow: 0 4px 14px rgba(236,72,153,.3);
}
.btn-primary:active { transform: scale(.97); }
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--pink);
  color: var(--pink-deep); width: 100%;
}
.btn-ghost { background: var(--pink-light); color: var(--pink-deep); }

/* ===== 表单 ===== */
.form-group { margin-bottom: 14px; }
.form-group label { font-size: 13px; color: var(--text-sub); margin-bottom: 6px; display: block; }
.form-group input, .form-group select {
  width: 100%; padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px; background: var(--bg);
  color: var(--text); transition: border .2s; outline: none;
  font-family: inherit;
}
.form-group input:focus, .form-group select:focus { border-color: var(--pink); }

/* ===== Toast提示 ===== */
#toast {
  position: fixed; top: 70px; left: 50%; transform: translateX(-50%);
  background: rgba(30,30,30,.88); color: #fff;
  padding: 10px 20px; border-radius: 50px;
  font-size: 14px; z-index: 9999;
  opacity: 0; transition: opacity .3s; pointer-events: none;
  white-space: nowrap;
}
#toast.show { opacity: 1; }

/* ===== 加载中 ===== */
.loading {
  display: flex; align-items: center; justify-content: center;
  padding: 40px 0; color: var(--text-light); gap: 8px;
}
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--pink-mid);
  border-top-color: var(--pink-deep);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 首页 ===== */
.home-header {
  background: linear-gradient(135deg, #FDF2F8 0%, #FCE7F3 100%);
  padding: 24px 16px 20px;
  text-align: center;
}
.home-header .logo { font-family: 'Noto Serif SC',serif; font-size: 32px; color: var(--pink-deep); margin-bottom: 4px; }
.home-header .tagline { font-size: 13px; color: var(--text-sub); }
.stat-row { display: flex; gap: 10px; padding: 12px 16px; }
.stat-item {
  flex: 1; background: #fff; border-radius: var(--radius-sm);
  padding: 12px; text-align: center;
  box-shadow: 0 2px 8px rgba(244,114,182,.08);
}
.stat-item .num { font-size: 22px; font-weight: 700; color: var(--pink-deep); }
.stat-item .label { font-size: 11px; color: var(--text-sub); margin-top: 2px; }

.category-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 16px 16px; }
.category-card {
  background: #fff; border-radius: var(--radius);
  padding: 20px 16px; text-align: center;
  box-shadow: var(--shadow); cursor: pointer;
  transition: transform .2s, box-shadow .2s;
  text-decoration: none; color: inherit;
  border: 1.5px solid transparent;
}
.category-card:active { transform: scale(.96); }
.category-card .icon { font-size: 32px; margin-bottom: 8px; }
.category-card .name { font-size: 16px; font-weight: 600; color: var(--text); }
.category-card .sub { font-size: 12px; color: var(--text-sub); margin-top: 3px; }

/* ===== 小说/章节列表 ===== */
.list-item {
  background: #fff; margin: 0 12px 10px;
  border-radius: var(--radius); padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
  cursor: pointer; box-shadow: var(--shadow);
  text-decoration: none; color: inherit;
  transition: transform .15s;
}
.list-item:active { transform: scale(.98); }
.list-item .info { flex: 1; }
.list-item .title { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.list-item .sub { font-size: 12px; color: var(--text-sub); }
.list-item .arrow { color: var(--text-light); font-size: 18px; }

/* 进度条 */
.progress-bar { height: 4px; background: var(--pink-mid); border-radius: 2px; margin-top: 8px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--pink-deep); border-radius: 2px; transition: width .3s; }

/* 章节状态 */
.chapter-status { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 14px; }
.chapter-status.done { background: var(--green-light); color: var(--green); }
.chapter-status.current { background: var(--pink-light); color: var(--pink-deep); }
.chapter-status.locked { background: var(--border); color: var(--text-light); }

/* ===== 章节阅读页 ===== */
.step-tabs {
  display: flex; background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 0 12px; gap: 4px;
  position: sticky; top: var(--header-height); z-index: 50;
}
.step-tab {
  flex: 1; padding: 12px 4px; text-align: center;
  font-size: 13px; color: var(--text-sub);
  border-bottom: 2px solid transparent; cursor: pointer;
  transition: all .2s; white-space: nowrap;
}
.step-tab.active { color: var(--pink-deep); border-color: var(--pink-deep); font-weight: 600; }

.story-text {
  padding: 20px 16px;
  font-family: 'Noto Serif SC', serif;
  font-size: 16px; line-height: 2.0;
  color: var(--text);
}
.story-text p { margin-bottom: 16px; }

/* 粉色单词胶囊 */
.word-pill {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--pink-light); color: var(--pink-deep);
  padding: 2px 10px; border-radius: 50px;
  font-size: 14px; cursor: pointer;
  border: 1px solid var(--pink-mid);
  font-family: 'Noto Sans SC', sans-serif;
  transition: background .2s;
}
.word-pill:hover { background: var(--pink-mid); }
.word-pill .w { font-weight: 600; }
.word-pill .m { font-size: 12px; opacity: .8; }

/* Step2 填空 */
.fill-word { color: var(--green); font-weight: 600; }
.fill-input {
  display: inline-block;
  border: none; border-bottom: 1.5px solid var(--green);
  width: 80px; margin: 0 4px;
  font-size: 15px; text-align: center;
  background: transparent; outline: none;
  color: var(--text); font-family: inherit;
  padding: 1px 4px;
}
.fill-input.correct { background: var(--green-light); border-color: var(--green); border-radius: 4px; color: var(--green); }
.fill-input.wrong   { background: var(--red-light);   border-color: var(--red);   border-radius: 4px; color: var(--red); }
.fill-hint { font-size: 12px; color: var(--red); margin-left: 2px; }

/* Step3 单词表 */
.word-table { width: 100%; border-collapse: collapse; }
.word-table th { font-size: 12px; color: var(--text-sub); padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border); }
.word-table td { padding: 10px; font-size: 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.word-table .word-en { font-weight: 600; color: var(--text); }
.word-table .phonetic { font-size: 12px; color: var(--text-sub); }
.star-btn { background: none; border: none; cursor: pointer; font-size: 20px; color: var(--text-light); transition: color .2s, transform .2s; }
.star-btn.active { color: #F59E0B; transform: scale(1.1); }

/* Step4 默写表 */
.review-item {
  background: #fff; border-radius: var(--radius-sm);
  margin-bottom: 10px; padding: 14px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.review-word { flex: 1; }
.review-word .en { font-weight: 600; font-size: 15px; }
.review-word .zh { font-size: 13px; color: var(--text-sub); margin-top: 2px; }
.check-boxes { display: flex; gap: 6px; }
.check-box {
  width: 26px; height: 26px; border-radius: 6px;
  border: 1.5px solid var(--border); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; transition: all .15s; background: #fff;
}
.check-box.checked { background: var(--green); border-color: var(--green); color: #fff; }

/* ===== 单词详情弹窗 ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.4);
  z-index: 500; display: flex; align-items: flex-end;
  opacity: 0; pointer-events: none; transition: opacity .25s;
}
.modal-overlay.show { opacity: 1; pointer-events: all; }
.modal-sheet {
  background: #fff; border-radius: 24px 24px 0 0;
  padding: 24px 20px 40px; width: 100%;
  transform: translateY(100%); transition: transform .3s ease;
}
.modal-overlay.show .modal-sheet { transform: translateY(0); }
.modal-handle { width: 36px; height: 4px; background: var(--border); border-radius: 2px; margin: 0 auto 20px; }
.modal-word { font-size: 28px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.modal-phonetic { font-size: 15px; color: var(--text-sub); margin-bottom: 12px; }
.modal-meaning { font-size: 18px; color: var(--pink-deep); font-weight: 500; margin-bottom: 20px; }

/* ===== 章节完成页 ===== */
.complete-page {
  text-align: center; padding: 40px 24px;
}
.complete-emoji { font-size: 64px; margin-bottom: 16px; animation: bounce .6s ease infinite alternate; }
@keyframes bounce { to { transform: translateY(-8px); } }
.complete-title { font-family: 'Noto Serif SC',serif; font-size: 24px; font-weight: 700; color: var(--pink-deep); margin-bottom: 8px; }
.complete-sub { font-size: 14px; color: var(--text-sub); margin-bottom: 28px; }
.complete-stats { display: flex; gap: 12px; margin-bottom: 28px; }
.complete-stat { flex: 1; background: var(--pink-light); border-radius: var(--radius-sm); padding: 14px; }
.complete-stat .n { font-size: 24px; font-weight: 700; color: var(--pink-deep); }
.complete-stat .l { font-size: 12px; color: var(--text-sub); margin-top: 3px; }

/* ===== 收藏页 ===== */
.fav-item {
  background: #fff; margin: 0 12px 8px;
  border-radius: var(--radius-sm); padding: 14px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.fav-item .word-info { flex: 1; }
.fav-item .word-en { font-weight: 600; font-size: 15px; }
.fav-item .word-zh { font-size: 13px; color: var(--text-sub); }
.fav-item .word-from { font-size: 11px; color: var(--text-light); margin-top: 3px; }
.del-btn { color: var(--text-light); background: none; border: none; font-size: 18px; cursor: pointer; padding: 4px; }
.del-btn:hover { color: var(--red); }

/* ===== 登录/注册页 ===== */
.auth-page { padding: 0 20px; }
.auth-logo { text-align: center; padding: 40px 0 28px; }
.auth-logo .logo-text { font-family: 'Noto Serif SC',serif; font-size: 40px; color: var(--pink-deep); }
.auth-logo .sub { font-size: 13px; color: var(--text-sub); margin-top: 6px; }
.auth-tabs { display: flex; background: var(--pink-light); border-radius: 50px; padding: 4px; margin-bottom: 24px; }
.auth-tab { flex: 1; text-align: center; padding: 8px; border-radius: 50px; font-size: 14px; cursor: pointer; transition: all .2s; color: var(--text-sub); }
.auth-tab.active { background: #fff; color: var(--pink-deep); font-weight: 600; box-shadow: 0 2px 8px rgba(0,0,0,.08); }

/* ===== 空状态 ===== */
.empty {
  text-align: center; padding: 60px 20px;
  color: var(--text-sub);
}
.empty .icon { font-size: 48px; margin-bottom: 12px; opacity: .5; }
.empty p { font-size: 14px; }

/* ===== 个人中心 ===== */
.profile-header {
  background: linear-gradient(135deg, var(--pink-light), var(--pink-mid));
  padding: 28px 20px;
}
.profile-phone { font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.profile-expire { font-size: 13px; color: var(--text-sub); }
.menu-item {
  background: #fff; margin: 0 12px 8px;
  border-radius: var(--radius-sm); padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
  cursor: pointer; text-decoration: none; color: var(--text);
}
.menu-item .label { flex: 1; font-size: 15px; }
.menu-item .icon { font-size: 20px; }
.menu-item .arrow { color: var(--text-light); }

/* ===== 工具类 ===== */
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.p-16 { padding: 16px; }
.text-center { text-align: center; }
.text-sm { font-size: 13px; }
.text-sub { color: var(--text-sub); }
.text-pink { color: var(--pink-deep); }
.section-title { font-size: 13px; font-weight: 600; color: var(--text-sub); padding: 12px 16px 8px; text-transform: uppercase; letter-spacing: .5px; }
.divider { height: 8px; background: var(--bg); }
