/* ===== 选择大于努力 · H5 统一样式 ===== */
/* 极简灰白风格 · 品牌绿 #22C55E 点缀 */

/* ========== Reset & Base ========== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: #F5F5F5;
  color: #1F2937;
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ========== App Container ========== */
.app-container {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: #F5F5F5;
  position: relative;
}

/* ========== Header ========== */
.page-header {
  background: #fff;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #E8E8E8;
  position: sticky;
  top: 0;
  z-index: 100;
  min-height: 52px;
}
.page-header .header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 60px;
}
.page-header .header-center {
  flex: 1;
  text-align: center;
}
.page-header .header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 60px;
  justify-content: flex-end;
}
.page-header h1 {
  font-size: 17px;
  font-weight: 600;
  color: #111;
}
.page-header .back-btn {
  background: none;
  border: none;
  font-size: 20px;
  color: #666;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  visibility: hidden;
}
.page-header .back-btn.visible { visibility: visible; }

/* ========== Bottom Nav ========== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-top: 1px solid #E8E8E8;
  display: flex;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0 6px;
  font-size: 11px;
  color: #999;
  transition: color 0.2s;
  gap: 2px;
}
.bottom-nav a .nav-icon { font-size: 22px; line-height: 1; }
.bottom-nav a.active { color: #22C55E; }
.content-with-nav { padding-bottom: 60px; padding-bottom: calc(60px + env(safe-area-inset-bottom, 0)); }

/* ========== Page Content ========== */
.page-content { padding: 16px; }
.page-content.no-pad { padding: 0; }

/* ========== Card ========== */
.card {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  margin-bottom: 12px;
}
.card-title {
  font-size: 14px;
  font-weight: 600;
  color: #666;
  margin-bottom: 12px;
}

/* ========== Stats Bar ========== */
.stats-bar {
  background: #fff;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-around;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.stats-bar .stat-item { text-align: center; }
.stats-bar .num { font-size: 20px; font-weight: 700; color: #22C55E; }
.stats-bar .label { font-size: 11px; color: #999; margin-top: 2px; }

/* ========== Buttons ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  gap: 6px;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-primary { background: #22C55E; color: #fff; }
.btn-secondary { background: #F0F0F0; color: #666; }
.btn-danger { background: #FEF2F2; color: #EF4444; }
.btn-ghost { background: none; color: #666; }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 14px 24px; font-size: 16px; }
.btn-group { display: flex; gap: 10px; }
.btn-group .btn { flex: 1; }

/* ========== Form Inputs ========== */
.input-group { margin-bottom: 14px; }
.input-group label {
  display: block;
  font-size: 13px;
  color: #666;
  margin-bottom: 6px;
  font-weight: 500;
}
.input-group input, .input-group textarea, .input-group select {
  width: 100%;
  padding: 11px 14px;
  border: 2px solid #E8E8E8;
  border-radius: 10px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
  background: #fff;
  color: #1F2937;
}
.input-group input:focus, .input-group textarea:focus, .input-group select:focus {
  border-color: #22C55E;
}
.input-group textarea { resize: vertical; min-height: 80px; }

.input-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.input-row .input-group { flex: 1; margin-bottom: 0; }

/* ========== Search Box ========== */
.search-box {
  display: flex;
  align-items: center;
  background: #F5F5F5;
  border-radius: 10px;
  padding: 0 14px;
  gap: 8px;
  border: 1.5px solid #E8E8E8;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-box:focus-within {
  border-color: #22C55E;
  box-shadow: 0 0 0 3px rgba(34,197,94,0.12);
}
.search-box input {
  flex: 1;
  border: none;
  background: none;
  padding: 10px 0;
  font-size: 14px;
  outline: none;
  font-family: inherit;
  color: #1F2937;
}
.search-box input::placeholder { color: #bbb; }
.search-box .search-icon { font-size: 16px; color: #999; }
.search-box:focus-within .search-icon { color: #22C55E; }

/* ========== Section Title ========== */
.section-title {
  font-size: 13px;
  font-weight: 600;
  color: #999;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ========== Subject Grid ========== */
.subject-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.subject-card {
  background: #fff;
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  transition: all 0.15s;
  border: 2px solid transparent;
}
.subject-card:active { transform: scale(0.97); }
.subject-card .subject-icon { font-size: 24px; margin-bottom: 6px; }
.subject-card .subject-name { font-size: 15px; font-weight: 600; color: #111; }
.subject-card .subject-meta { font-size: 12px; color: #999; margin-top: 3px; }

/* ========== Stage / Grade Tabs ========== */
.tab-scroll {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tab-scroll::-webkit-scrollbar { display: none; }
.tab-btn {
  padding: 7px 18px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  background: #E8E8E8;
  color: #666;
  cursor: pointer;
  white-space: nowrap;
  border: none;
  transition: all 0.2s;
  flex-shrink: 0;
  font-family: inherit;
}
.tab-btn.active { background: #22C55E; color: #fff; }

/* ========== Question / Practice ========== */
.question-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.q-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  font-size: 12px;
  color: #999;
}
.q-meta .q-kp { background: #F0F0F0; padding: 2px 10px; border-radius: 10px; font-size: 11px; }
.q-text { font-size: 16px; line-height: 1.7; color: #1F2937; margin-bottom: 18px; }
.options { display: grid; gap: 10px; }
.option {
  padding: 12px 14px;
  border: 2px solid #E8E8E8;
  border-radius: 10px;
  cursor: pointer;
  font-size: 15px;
  color: #1F2937;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 10px;
}
.option:active { transform: scale(0.98); }
.option .opt-label {
  width: 24px; height: 24px; border-radius: 50%; background: #F0F0F0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: #666; flex-shrink: 0;
}
.option.selected { border-color: #22C55E; background: #F0FDF4; }
.option.selected .opt-label { background: #22C55E; color: #fff; }
.option.correct { border-color: #16A34A; background: #F0FDF4; }
.option.correct .opt-label { background: #16A34A; color: #fff; }
.option.wrong { border-color: #EF4444; background: #FEF2F2; }
.option.wrong .opt-label { background: #EF4444; color: #fff; }
.option.disabled { pointer-events: none; }

.explanation {
  background: #FEF9C3;
  border-radius: 10px;
  padding: 12px 14px;
  margin-top: 14px;
  display: none;
}
.explanation.show { display: block; }
.explanation .exp-title { font-size: 12px; font-weight: 600; color: #A16207; margin-bottom: 6px; }
.explanation .exp-text { font-size: 14px; color: #713F12; line-height: 1.6; }

/* ========== Practice Header ========== */
.practice-header {
  background: #fff;
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  font-size: 13px;
}
.practice-header .progress-text { color: #666; }
.practice-header .score-text { color: #22C55E; font-weight: 700; }

/* ========== Result ========== */
.result-card {
  background: #fff;
  border-radius: 16px;
  padding: 28px 20px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  margin-bottom: 16px;
}
.result-card .big-score { font-size: 56px; font-weight: 700; color: #22C55E; line-height: 1; }
.result-card .big-label { font-size: 16px; color: #999; margin-top: 8px; }
.result-card .rating-badge {
  display: inline-block;
  padding: 6px 20px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  margin-top: 12px;
}
.rating-S { background: #F0FDF4; color: #16A34A; }
.rating-A { background: #F0FDF4; color: #22C55E; }
.rating-B { background: #FEF9C3; color: #A16207; }
.rating-C { background: #FFF7ED; color: #EA580C; }
.rating-D { background: #FEF2F2; color: #EF4444; }
.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 20px 0; }
.result-stat { padding: 10px; border-radius: 8px; background: #F9FAFB; }
.result-stat .val { font-size: 20px; font-weight: 600; }
.result-stat .txt { font-size: 11px; color: #999; margin-top: 3px; }

/* ========== Loading ========== */
.loading-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255,255,255,0.85);
  z-index: 999;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 10px;
}
.loading-overlay.show { display: flex; }
.loading-spinner {
  width: 32px; height: 32px;
  border: 3px solid #E8E8E8;
  border-top-color: #22C55E;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { font-size: 13px; color: #999; }

/* ========== Toast ========== */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #1F2937;
  color: #fff;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 14px;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  max-width: 90%;
  text-align: center;
}
.toast.show { opacity: 1; }
.toast.error { background: #EF4444; }
.toast.success { background: #22C55E; }

/* ========== Empty State ========== */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: #999;
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state .empty-title { font-size: 16px; font-weight: 500; color: #666; margin-bottom: 6px; }
.empty-state .empty-desc { font-size: 13px; color: #999; }

/* ========== List ========== */
.list-item {
  background: #fff;
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 12px;
}
.list-item:active { transform: scale(0.98); }
.list-item .item-icon { font-size: 28px; flex-shrink: 0; width: 40px; text-align: center; }
.list-item .item-body { flex: 1; min-width: 0; }
.list-item .item-title { font-size: 15px; font-weight: 500; color: #111; }
.list-item .item-desc { font-size: 12px; color: #999; margin-top: 2px; }
.list-item .item-right { font-size: 12px; color: #999; text-align: right; flex-shrink: 0; }

/* ========== Modal ========== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal-box {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  width: 90%;
  max-width: 380px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  max-height: 80vh;
  overflow-y: auto;
}
.modal-box h3 { font-size: 16px; font-weight: 600; margin-bottom: 16px; }
.modal-close {
  float: right;
  background: none;
  border: none;
  font-size: 24px;
  color: #999;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

/* ========== Badge / Tag ========== */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
}
.badge-green { background: #F0FDF4; color: #22C55E; }
.badge-red { background: #FEF2F2; color: #EF4444; }
.badge-gray { background: #F0F0F0; color: #666; }
.badge-yellow { background: #FEF9C3; color: #A16207; }

/* ========== Login Page ========== */
.login-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 32px 24px;
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo .logo-icon {
  width: 64px; height: 64px;
  background: #22C55E;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin: 0 auto 14px;
  box-shadow: 0 4px 16px rgba(34,197,94,0.3);
}
.login-logo h1 { font-size: 22px; font-weight: 700; color: #111; }
.login-logo p { font-size: 13px; color: #999; margin-top: 4px; }
.login-form { width: 100%; max-width: 340px; }
.login-error {
  background: #FEF2F2;
  color: #EF4444;
  font-size: 13px;
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 14px;
  display: none;
}
.login-error.show { display: block; }
.login-error.success { background: #F0FDF4; color: #16A34A; }
.code-btn {
  padding: 11px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  background: #F0FDF4;
  color: #22C55E;
  font-family: inherit;
  height: 44px;
}
.code-btn:disabled { background: #F0F0F0; color: #999; cursor: not-allowed; }

/* ===== 微信登录分隔线 ===== */
.login-divider {
  display: flex; align-items: center; gap: 12px; margin: 18px 0;
  font-size: 12px; color: #999;
}
.login-divider::before,
.login-divider::after {
  content: ''; flex: 1; height: 1px; background: #E8E8E8;
}
/* ===== 微信登录按钮 ===== */
.btn-wx {
  width: 100%; justify-content: center;
  background: #07C160; color: white;
  padding: 13px 24px; border-radius: 10px; font-size: 14px; font-weight: 600;
  text-decoration: none; display: inline-flex; align-items: center; gap: 10px;
  transition: all 0.15s; cursor: pointer; border: none; font-family: inherit;
}
.btn-wx:active { opacity: 0.9; transform: scale(0.97); }
.btn-wx svg { width: 20px; height: 20px; flex-shrink: 0; }

/* ========== Creator Dashboard ========== */
.bank-card {
  background: #fff;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.bank-card .bank-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.bank-card .bank-name { font-size: 15px; font-weight: 600; color: #111; }
.bank-card .bank-status { font-size: 12px; }
.bank-card .bank-meta { font-size: 12px; color: #999; }
.bank-card .bank-actions { display: flex; gap: 8px; margin-top: 10px; }

/* ========== Marketplace ========== */
.market-item {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.market-item .item-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}
.market-item .item-name { font-size: 16px; font-weight: 600; color: #111; }
.market-item .item-price {
  font-size: 18px;
  font-weight: 700;
  color: #EF4444;
}
.market-item .item-desc { font-size: 13px; color: #666; margin-bottom: 8px; line-height: 1.5; }
.market-item .item-author { font-size: 12px; color: #999; }
.market-item .item-actions { margin-top: 12px; }

/* ========== Dashboard Stats ========== */
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.dash-card {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.dash-card .dash-num { font-size: 24px; font-weight: 700; color: #22C55E; }
.dash-card .dash-label { font-size: 12px; color: #999; margin-top: 4px; }

/* ========== Progress Bar ========== */
.progress-bar { height: 6px; background: #E8E8E8; border-radius: 3px; overflow: hidden; }
.progress-bar .fill { height: 100%; background: #22C55E; border-radius: 3px; transition: width 0.3s; }

/* ========== Misc ========== */
.text-center { text-align: center; }
.text-muted { color: #999; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ========== App 模式适配（Capacitor Shell） ========== */
/* 页面切换动画 */
.is-app .app-container {
  animation: slideIn 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
@keyframes slideIn {
  from { transform: translateX(24px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
/* 模态/覆盖层不参与动画 */
.is-app .app-container .modal-overlay,
.is-app .app-container .loading-overlay {
  animation: none;
}

/* App 模式底部安全区适配 */
.is-app .bottom-nav {
  padding-bottom: max(env(safe-area-inset-bottom, 0px), 8px);
}
.is-app .content-with-nav {
  padding-bottom: calc(60px + max(env(safe-area-inset-bottom, 0px), 8px));
}

/* App 模式版本号显示 */
.is-app .app-version {
  display: block !important;
  text-align: center;
  padding: 12px 16px 4px;
  font-size: 11px;
  color: #bbb;
  line-height: 1.4;
}
