/* 川渝麻研社 PWA — 样式（从小程序 WXSS 移植改写） */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --green: #1a6b3c;
  --green-light: #2e8b57;
  --gold: #c9a45c;
  --bg: #f7f6f2;
  --card: #ffffff;
  --text: #333;
  --muted: #999;
  --red: #d9534f;
}

html, body { height: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "Helvetica Neue", sans-serif;
  background: radial-gradient(140% 90% at 50% -12%, #faf8f1 0%, #f0ede3 42%, #e6e1d2 100%);
  background-attachment: fixed;
  color: var(--text);
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: calc(60px + env(safe-area-inset-bottom));
}

#view { padding-bottom: 12px; }
.page { padding: 16px; }
.page.center { display: flex; align-items: center; justify-content: center; min-height: 60vh; }

/* 头部 */
.page-header { padding: 12px 0 8px; }
.page-header h1 { font-size: 22px; }
.page-header .subtitle { color: var(--muted); font-size: 13px; margin-top: 4px; }
.question-header { display: flex; align-items: center; gap: 10px; }
.question-header h1 { font-size: 16px; flex: 1; }
.q-index { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* 免费提示 */
.free-tip {
  background: #fff8e6; border: 1px solid #f0dfa8; border-radius: 10px;
  padding: 10px 14px; font-size: 12px; color: #8a6d1f; margin-bottom: 12px;
}

/* 题型卡片 */
.cards { display: flex; flex-direction: column; gap: 14px; }
.question-card {
  background: var(--card); border-radius: 18px; padding: 20px;
  box-shadow: 0 2px 14px rgba(0,0,0,0.06); border: 1px solid rgba(0,0,0,0.03);
}
.question-card.easy { border-top: 4px solid var(--green-light); }
.question-card.hard { border-top: 4px solid var(--red); }
.card-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.card-title { font-size: 17px; font-weight: 600; }
.card-count { font-size: 12px; color: var(--muted); }
.progress-bar { height: 6px; background: #eee; border-radius: 3px; overflow: hidden; margin-bottom: 14px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--green-light), var(--green)); border-radius: 3px; transition: width .4s; }

/* 按钮 */
.btn-start {
  width: 100%; padding: 10px; border: none; border-radius: 9px;
  background: var(--green); color: #fff; font-size: 15px; font-weight: 600;
  cursor: pointer;
}
.btn-start:disabled { background: #ccc; }
.btn-start:active { opacity: .85; }
.btn-back {
  padding: 6px 12px; border: none; border-radius: 8px;
  background: #eee; color: var(--text); font-size: 13px; cursor: pointer;
}

/* 答题页 */
.q-desc { font-size: 13px; color: #666; margin-bottom: 12px; }
.tiles {
  background: radial-gradient(ellipse at 50% 35%, #3a8a5e 0%, #2a6b49 55%, #1f5238 100%);
  border-radius: 18px; padding: 14px 16px; margin: 0 auto 16px;
  display: flex; flex-direction: column; gap: 10px; align-items: center;
  width: 100%; max-width: 100%;
  box-shadow: inset 0 2px 14px rgba(0,0,0,0.30), 0 2px 10px rgba(0,0,0,0.08);
}
.tile-row { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; min-width: 0; max-width: 100%; }
.tile-img {
  width: clamp(24px, 7.5vw, 42px); height: auto; aspect-ratio: 44 / 61; border-radius: 6px;
  box-shadow: 0 3px 7px rgba(0,0,0,0.38), 0 1px 2px rgba(0,0,0,0.25);
  flex: 0 1 auto; min-width: 0; object-fit: contain;
}
.q-prompt { font-size: 14px; font-weight: 600; color: #4a4a40; margin: 0 0 12px; }
.options {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 12px;
}
.option-btn {
  width: clamp(64px, 18vw, 92px); flex: 0 0 auto;
  position: relative; border-radius: 12px; overflow: hidden; cursor: pointer;
  /* 象牙白材质：微渐变 + 细边，替代死白 */
  background: linear-gradient(160deg, #fffef9 0%, #f7f0de 100%);
  border: 1px solid #d9d0bc;
  box-shadow: 0 4px 10px rgba(70, 58, 32, 0.16), 0 1px 2px rgba(0,0,0,0.10);
  transition: transform .1s, box-shadow .1s;
}
.option-btn:not(:disabled):hover { transform: translateY(-3px); box-shadow: 0 8px 18px rgba(70,58,32,0.22); }
.option-btn:active { transform: translateY(-1px) scale(.98); }
.option-btn:disabled { cursor: default; }
/* 状态用 outline，不挤布局 */
.option-btn.wrong { outline: 3px solid var(--red); outline-offset: -3px; opacity: .45; }
.option-btn.right { outline: 3px solid var(--green-light); outline-offset: -3px; }
.option-img {
  width: 100%; display: block; height: auto; aspect-ratio: 44 / 61;
  /* 白底 JPG 融进象牙渐变底，白块感消失 */
  mix-blend-mode: multiply;
}

.option-label {
  position: absolute; top: 7px; left: 7px;
  width: 24px; height: 24px; line-height: 24px; text-align: center;
  background: rgba(20, 40, 28, 0.72); color: #fff;
  border-radius: 50%; font-size: 12px; font-weight: 600;
  backdrop-filter: blur(2px);
}

/* 结果区 */
.answer-result { margin-top: 12px; }
.result { text-align: center; padding: 14px 16px; border-radius: 14px;
  background: linear-gradient(160deg, #fdfcf7 0%, #f6f1e3 100%);
  border: 1px solid #e6ddc8;
  box-shadow: 0 2px 12px rgba(70,58,32,0.10);
  animation: pop-in .25s ease-out; }
@keyframes pop-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.result.correct { border-color: #c4dfc9; background: linear-gradient(160deg, #f6fbf4 0%, #eaf4e8 100%); }
.result.wrong { border-color: #ecd2cf; background: linear-gradient(160deg, #fdf5f4 0%, #f9ecea 100%); }
.result-icon { display: none; }  /* 紧凑模式：去掉大圆图标 */
.result-text { font-weight: 600; margin-bottom: 8px; font-size: 14px; }
.explanation { text-align: left; font-size: 12px; color: #555; background: #f5f3ec;
  border-radius: 8px; padding: 9px 11px; margin-bottom: 10px; line-height: 1.55; }
.result.wrong .result-text { color: var(--red); }

/* 弹窗卡 */
.modal-card { background: var(--card); border-radius: 16px; padding: 28px 22px; text-align: center;
  max-width: 320px; box-shadow: 0 4px 24px rgba(0,0,0,0.1); }
.modal-card h2 { font-size: 17px; margin-bottom: 8px; }
.modal-card p { font-size: 13px; color: #666; margin-bottom: 16px; line-height: 1.6; }
.modal-card .btn-start { margin-bottom: 10px; }
.modal-icon { font-size: 40px; margin-bottom: 10px; }

/* 我的页 */
.profile-card { display: flex; align-items: center; gap: 14px; background: var(--card);
  border-radius: 18px; padding: 20px; margin-bottom: 14px;
  box-shadow: 0 2px 14px rgba(0,0,0,0.06); }
.avatar { width: 56px; height: 56px; border-radius: 50%; flex: 0 0 auto;
  background: linear-gradient(135deg, #2a6b49 0%, #1d5038 100%);
  display: flex; align-items: center; justify-content: center; font-size: 28px;
  box-shadow: 0 2px 8px rgba(29,80,56,0.25); }
.muted { color: var(--muted); font-size: 12px; }
.stats-row { display: flex; gap: 12px; margin-bottom: 14px; }
.stat { flex: 1; background: var(--card); border-radius: 16px; padding: 18px 14px; text-align: center;
  box-shadow: 0 2px 12px rgba(0,0,0,0.05); border: 1px solid rgba(0,0,0,0.03); }
.stat b { font-size: 20px; display: block; }
.stat span { font-size: 12px; color: var(--muted); }
.version { text-align: center; color: var(--muted); font-size: 11px; margin-top: 24px; }
.quota-row { display: flex; gap: 12px; margin-bottom: 14px; }
.disclaimer {
  margin-top: 24px; padding: 14px 16px; border-radius: 14px;
  background: rgba(0,0,0,0.035); font-size: 11px; line-height: 1.8; color: #8a8a7e;
  text-align: center; letter-spacing: .3px;
}

/* 导航栏：手机底部墨绿条，iPad/桌面切换为顶栏 */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; display: flex;
  background: linear-gradient(180deg, #266146 0%, #1d5038 100%);
  box-shadow: 0 -2px 12px rgba(0,0,0,0.18);
  padding-bottom: env(safe-area-inset-bottom); z-index: 100;
}
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 0 7px; font-size: 11px; color: rgba(255,255,255,0.68); cursor: pointer;
  transition: color .15s; }
.tab svg { width: 22px; height: 22px; }
.tab.active { color: #e8c98a; font-weight: 600; }
.brand { display: none; }

/* ============ 响应式适配 ============ */

/* 手机横屏 / 小平板：放宽内容列，牌面放大 */
@media (min-width: 520px) {
  body { max-width: 560px; }
  .tile-img { width: clamp(30px, 7.5vw, 50px); border-radius: 7px; }
  .page { padding: 16px 20px; }
}

/* 平板（iPad 竖屏及以上）：导航改顶栏 + 布局放宽 */
@media (min-width: 768px) {
  .options { gap: 16px; }
  .option-btn { width: clamp(76px, 10vw, 104px); border-radius: 14px; }
  body { display: flex; flex-direction: column; max-width: 760px; }
  #view { flex: 1; width: 100%; }
  .tabbar {
    position: relative; transform: none; width: 100%; max-width: none;
    order: -1; display: flex; align-items: center; justify-content: flex-start;
    padding: 0 18px; box-shadow: 0 2px 12px rgba(0,0,0,0.22);
  }
  .brand {
    display: block; color: #f0e6cd; font-size: 15px; font-weight: 600; letter-spacing: 1px;
    margin: 0 10px 0 4px; white-space: nowrap;
  }
  .tab {
    flex: 0 0 auto; flex-direction: row; gap: 7px; align-items: center;
    padding: 9px 15px; margin: 8px 1px; border-radius: 22px; font-size: 14px;
  }
  .tab.active { background: rgba(255,255,255,0.13); }
  .tab-extra { display: flex; }
  .tab-profile { margin-left: auto; }

  .page { padding: 16px 20px; }
  .page-header h1 { font-size: 26px; }
  .page-header .subtitle { font-size: 14px; }
  .cards { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
  .tiles { padding: 18px 24px; }
  .tile-img { width: clamp(40px, 7vw, 60px); border-radius: 8px; }

  .q-desc { font-size: 15px; }
  .q-nav-btn { padding: 13px 30px; font-size: 15px; }
  .stat b { font-size: 24px; }
}

/* iPad 横屏 / 桌面：再加宽，题型卡内部留白加大 */
@media (min-width: 1024px) {
  body { max-width: 900px; }
  .tile-img { width: clamp(44px, 6vw, 64px); }
  .cards { grid-template-columns: 1fr 1fr; gap: 24px; }
  .question-card { padding: 24px; }

}

/* 超小屏（iPhone SE 级别）压缩留白 */
@media (max-width: 360px) {
  .page { padding: 12px; }

  .options { gap: 8px; }
  .option-btn { width: clamp(60px, 20vw, 72px); }
  .tile-img { width: clamp(20px, 7vw, 30px); }
}

/* 上一题/下一题导航 */
.q-nav {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 16px; gap: 12px;
}
.q-nav-btn {
  padding: 11px 22px; border: 1.5px solid #ddd9cf; border-radius: 10px;
  background: var(--card); color: var(--text); font-size: 14px; font-weight: 500; cursor: pointer;
}
.q-nav-btn.primary {
  background: var(--green); border-color: var(--green); color: #fff; font-weight: 600;
}
.q-nav-btn:active { opacity: .85; }
.q-nav-end { font-size: 12px; color: var(--muted); }

/* 答题页垂直分布：内容不满屏时均匀撑开，消除大片底部空白 */
.q-flow {
  display: flex; flex-direction: column; justify-content: center;
  min-height: calc(100dvh - 140px);
}
.q-flow .q-nav { margin-top: 20px; }

/* 首页版本号徽标 */
.home-head { display: flex; justify-content: space-between; align-items: flex-start; }
.home-head .ver {
  font-size: 13px; font-weight: 700; color: #f7f4ea;
  background: linear-gradient(135deg, #2a6b49 0%, #1d5038 100%);
  padding: 5px 12px; border-radius: 999px; white-space: nowrap; margin-top: 2px;
  border: 1px solid rgba(255,255,255,.18);
  box-shadow: 0 2px 8px rgba(31,80,56,.18);
}

/* ============ 茶馆 hub ============ */
.daily-card {
  display: flex; justify-content: space-between; align-items: center;
  background: linear-gradient(135deg, #2a6b49 0%, #1d5038 100%);
  border-radius: 18px; padding: 18px 20px; margin-bottom: 16px;
  color: #fff; cursor: pointer; box-shadow: 0 4px 16px rgba(29,80,56,0.35);
  transition: transform .12s; }
.daily-card:active { transform: scale(.98);
}
.daily-card.done { background: linear-gradient(135deg, #4c8a63 0%, #356b4c 100%); }
.daily-left { display: flex; flex-direction: column; gap: 3px; }
.daily-label { font-size: 11px; color: #e8c98a; letter-spacing: 2px; }
.daily-left b { font-size: 15px; }
.daily-go { font-size: 13px; color: #e8c98a; white-space: nowrap; }

.hub-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; }
.pillar-card {
  position: relative; overflow: hidden;
  background: var(--card); border-radius: 18px; padding: 18px;
  display: flex; flex-direction: column; cursor: pointer;
  border: 1px solid rgba(0,0,0,0.05);
  box-shadow: 0 3px 14px rgba(70,58,32,0.10);
  transition: transform .18s ease, box-shadow .18s ease;
}
.pillar-card:active { transform: scale(.97); box-shadow: 0 2px 8px rgba(70,58,32,0.08); }
/* 彩色光晕：右下角，跟 DaoBox 首页同手法 */
.pillar-card::before {
  content: ''; position: absolute;
  right: -50px; bottom: -60px; width: 140px; height: 140px;
  background: var(--accent, var(--green));
  opacity: .10; filter: blur(40px); border-radius: 50%;
  pointer-events: none;
}
.pillar-icon {
  width: 48px; height: 48px; flex: 0 0 auto;
  display: grid; place-items: center;
  color: var(--accent, var(--green));
  background: color-mix(in srgb, var(--accent, var(--green)) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent, var(--green)) 30%, transparent);
  border-radius: 14px; margin-bottom: 8px;
}
.pillar-icon svg { width: 26px; height: 26px; }
.pillar-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pillar-card b { font-size: 17px; font-weight: 700; letter-spacing: .2px; }
.pillar-desc { font-size: 12px; color: #6b6b60; line-height: 1.7; margin-top: 2px; }
.pillar-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.pillar-arrow {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  font-size: 20px; color: color-mix(in srgb, var(--accent, var(--green)) 45%, transparent);
  font-weight: 300; opacity: .6;
}
@media (min-width: 768px) {
  .hub-cards { gap: 18px; }
  .pillar-card { padding: 22px; }
  .pillar-icon { width: 56px; height: 56px; border-radius: 16px; }
  .pillar-icon svg { width: 30px; height: 30px; }
  .pillar-card b { font-size: 19px; }
}

.term-daily {
  background: linear-gradient(160deg, #fdfcf7 0%, #f6f1e3 100%);
  border: 1px solid #e6ddc8; border-radius: 16px; padding: 14px 16px;
  cursor: pointer; display: flex; gap: 14px; align-items: flex-start;
  box-shadow: 0 2px 10px rgba(70,58,32,0.08);
}
.term-tag {
  flex: 0 0 auto; background: #8a2f2b; color: #f5e6c8;
  font-size: 11px; padding: 4px 8px; border-radius: 6px; letter-spacing: 2px;
  writing-mode: vertical-lr; padding: 10px 5px;
}
.term-body b { font-size: 15px; margin-right: 8px; }
.term-py { font-size: 11px; color: var(--muted); }
.term-body p { font-size: 12px; color: #666; margin-top: 5px; line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ============ 牌谱图鉴 ============ */
.paipu-list { display: grid; grid-template-columns: 1fr; gap: 12px; }
.paipu-card {
  background: var(--card); border-radius: 14px; padding: 12px; cursor: pointer;
  border: 1px solid rgba(0,0,0,0.04); box-shadow: 0 2px 10px rgba(70,58,32,0.08);
  transition: transform .12s; border: 1px solid rgba(0,0,0,0.03);
}
.paipu-card:active { transform: scale(.97); }
.paipu-preview { display: flex; gap: 6px; margin-bottom: 10px; overflow: hidden; }
.paipu-preview img { width: min(calc((100% - 18px) / 4), 72px); max-height: 92px; aspect-ratio: 44/61;
  border-radius: 4px; box-shadow: 0 1px 3px rgba(0,0,0,0.2); mix-blend-mode: multiply;
  object-fit: contain; }
.paipu-info { display: flex; justify-content: space-between; align-items: center; }
.paipu-info b { font-size: 14px; }
.fan-badge {
  background: #8a2f2b; color: #f5e6c8; font-size: 11px;
  padding: 3px 9px; border-radius: 10px; white-space: nowrap;
}
.fan-badge.small { padding: 2px 7px; font-size: 10px; }
.paipu-desc { font-size: 13px; color: #555; line-height: 1.7; margin-top: 14px;
  background: linear-gradient(160deg, #fdfcf7 0%, #f6f1e3 100%);
  border: 1px solid #e6ddc8; border-radius: 12px; padding: 14px; }
.coming-tip { text-align: center; color: var(--muted); font-size: 12px; margin-top: 18px; }

/* ============ 牌经 ============ */
.lesson-list { display: flex; flex-direction: column; gap: 10px; }
.lesson-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border-radius: 14px; padding: 14px; cursor: pointer;
  border: 1px solid rgba(0,0,0,0.04); box-shadow: 0 2px 10px rgba(70,58,32,0.08);
}
.lesson-no { flex: 0 0 auto; font-size: 11px; color: #8a2f2b; background: #f7ecda;
  padding: 5px 8px; border-radius: 8px; white-space: nowrap; }
.lesson-info { flex: 1; }
.lesson-info b { font-size: 14px; display: block; margin-bottom: 3px; }
.lesson-info p { font-size: 12px; color: #777; line-height: 1.5; }
.lesson-arrow { color: var(--muted); font-size: 18px; }
.lesson-detail h2 { font-size: 17px; margin-bottom: 12px; }
.lesson-detail p { font-size: 14px; color: #444; line-height: 1.8; margin-bottom: 10px; }

/* ============ 书场 ============ */
.video-list { display: flex; flex-direction: column; gap: 12px; }
.video-card {
  display: flex; gap: 12px; background: var(--card); border-radius: 14px; padding: 12px;
  border: 1px solid rgba(0,0,0,0.04); box-shadow: 0 2px 10px rgba(70,58,32,0.08);
}
.video-card.pending { opacity: .75; }
.video-thumb {
  flex: 0 0 96px; height: 62px; border-radius: 9px;
  background: radial-gradient(ellipse at 50% 35%, #3a8a5e 0%, #1f5238 100%);
  display: flex; align-items: center; justify-content: center;
}
.video-thumb span { color: rgba(255,255,255,0.85); font-size: 20px; }
.video-info b { font-size: 14px; display: block; margin-bottom: 3px; }
.video-info p { font-size: 12px; color: #777; margin-bottom: 4px; }
.video-meta { font-size: 11px; color: var(--muted); }

/* ============ 行话 ============ */
.search-box {
  width: 100%; padding: 11px 14px; border-radius: 12px; border: 1px solid #ddd5c2;
  background: var(--card); font-size: 14px; margin-bottom: 14px; outline: none;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.04);
}
.search-box:focus { border-color: var(--green-light); }
.term-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 520px) { .term-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 900px) { .term-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.term-card {
  background: var(--card); border-radius: 14px; padding: 12px 14px; cursor: pointer;
  border: 1px solid rgba(0,0,0,0.04); box-shadow: 0 2px 10px rgba(70,58,32,0.08);
  transition: transform .12s;
}
.term-card:active { transform: scale(.98); }
.term-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.term-no { flex: 0 0 auto; width: 24px; height: 24px; border-radius: 8px; background: #f7ecda;
  color: #8a2f2b; font-size: 11px; display: flex; align-items: center; justify-content: center; }
.term-head b { font-size: 15px; }
.term-card .term-py { font-size: 11px; color: #8a7f68; }
.term-detail { margin-top: 12px; padding: 16px; border-radius: 14px;
  background: linear-gradient(160deg, #fdfcf7 0%, #f6f1e3 100%);
  border: 1px solid #e6ddc8; }
.term-detail .term-py { font-size: 12px; color: #8a7f68; margin-bottom: 8px; }
.term-detail p { font-size: 14px; color: #444; line-height: 1.8; }

/* ============ 导航：手机隐藏扩展 tab ============ */
.tab-extra { display: none; }
.tab-profile { margin-left: auto; }

/* v0.4.0 牌谱结构卡扩展 */
.paipu-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.paipu-tags span {
  background: #efe7d4; color: #6d5a35; font-size: 11px;
  padding: 4px 8px; border-radius: 8px; border: 1px solid #e2d7c0;
}
.paipu-points { margin: 12px 0 0; padding: 14px 14px 14px 30px; color: #555;
  background: linear-gradient(160deg, #fdfcf7 0%, #f6f1e3 100%);
  border: 1px solid #e6ddc8; border-radius: 12px; font-size: 13px; line-height: 1.7; }
.paipu-note { margin-top: 10px; color: var(--muted); font-size: 11px; text-align: center; }

/* v0.5.1 行话短卡 + 详情页 */
