/* 苦荞题库 Web 版样式（红主题，遵循全端统一视觉规范） */
:root {
  --brand: #cf4b45;
  --brand-dark: #b83e38;
  --brand-soft: #fff3f1;
  --brand-border: #f0c9c5;
  --text: #333333;
  --text-2: #6b6b6b;
  --text-3: #9a9a9a;
  --bg: #f7f5f4;
  --card: #ffffff;
  --border: #ebe4e2;
  --green: #2e8b57;
  --green-soft: #eef7f1;
  --radius-card: 16px;
  --radius-ctrl: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
}

button { font-family: inherit; cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--text-3); }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1080px; margin: 0 auto; padding: 0 20px;
  height: 60px; display: flex; align-items: center; gap: 28px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand-icon { width: 30px; height: 30px; }
.brand-name { font-size: 19px; font-weight: 550; letter-spacing: 0; }

.tabs { display: flex; gap: 4px; height: 60px; }
.tab {
  height: 60px; padding: 0 16px; border: 0; background: transparent;
  font-size: 16px; color: var(--text-2); font-weight: 400;
  border-bottom: 2px solid transparent; border-radius: 0;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--brand); font-weight: 550; border-bottom-color: var(--brand); }

.user-area { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.user-chip { display: flex; align-items: center; gap: 8px; color: var(--text-2); }
.user-chip img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.logout-btn {
  border: 0; background: transparent; color: var(--text-3);
  font-size: 15px; padding: 4px 6px;
}
.logout-btn:hover { color: var(--brand); }

/* ---------- 布局 ---------- */
.page { max-width: 1080px; margin: 0 auto; padding: 24px 20px 60px; }
.view-head { margin-bottom: 18px; }
.page-title { font-size: 24px; font-weight: 550; }
.page-sub { color: var(--text-2); margin-top: 4px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 20px;
}

.banner {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: var(--brand-soft); border: 1px solid var(--brand-border);
  border-radius: var(--radius-card); padding: 14px 20px; margin-bottom: 18px;
}
.banner-text { color: var(--text); }

/* ---------- 控件 ---------- */
.btn {
  height: 44px; padding: 0 22px; border-radius: var(--radius-ctrl);
  font-size: 16px; font-weight: 500; border: 1px solid transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary { background: var(--card); color: var(--brand); border-color: var(--brand-border); }
.btn-secondary:hover { background: var(--brand-soft); }
.btn-text { background: transparent; color: var(--text-2); border: 0; height: 36px; padding: 0 8px; }
.btn-text:hover { color: var(--brand); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.input {
  height: 44px; width: 100%; padding: 0 14px;
  border: 1px solid var(--border); border-radius: var(--radius-ctrl);
  font-size: 16px; color: var(--text); background: var(--card); outline: none;
}
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(207, 75, 69, .12); }

.chip {
  height: 40px; padding: 0 18px; border-radius: 20px;
  border: 1px solid var(--border); background: var(--card);
  font-size: 16px; color: var(--text-2);
}
.chip:hover { border-color: var(--brand-border); color: var(--brand); }
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 550; }

.chip-group { display: flex; flex-wrap: wrap; gap: 10px; }
.cascade-row { display: flex; gap: 16px; align-items: flex-start; padding: 8px 0; }
.cascade-row + .cascade-row { border-top: 1px dashed var(--border); }
.cascade-label { flex: 0 0 52px; color: var(--text-2); padding-top: 8px; }

/* ---------- 首页 ---------- */
.cascade { margin-bottom: 20px; }
.subject-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.subject-card { display: flex; flex-direction: column; gap: 10px; }
.subject-name { font-size: 18px; font-weight: 550; }
.subject-meta { color: var(--text-2); font-size: 15px; }
.subject-card .btn { align-self: flex-start; }

.qtype-bar { margin-top: 20px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.qtype-bar .cascade-label { padding-top: 8px; }

/* ---------- 做题 ---------- */
/* 顶部信息并入题卡：返回图标 + 面包屑在左，数据/入口在右上 */
.q-top {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 14px; padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap; row-gap: 6px;
}
.back-icon {
  width: 32px; height: 32px; flex: 0 0 32px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); background: var(--card); color: var(--text-2);
  transition: color .15s, border-color .15s, background .15s;
}
.back-icon:hover { color: var(--brand); border-color: var(--brand-border); background: var(--brand-soft); }
.crumbs { display: flex; align-items: center; flex-wrap: nowrap; overflow: hidden; font-size: 14px; line-height: 1.4; }
.crumb { color: var(--text-3); white-space: nowrap; flex: 0 0 auto; }
.crumb-last { color: var(--text); font-weight: 550; font-size: 15px; }
.crumb-sep { display: inline-flex; align-items: center; color: var(--text-3); opacity: .55; margin: 0 7px; flex: 0 0 auto; }
.crumbs .tag { margin-left: 10px; flex: 0 0 auto; }
.q-top-right { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.practice-meta {
  display: flex; align-items: center; flex-wrap: wrap; row-gap: 2px;
  color: var(--text-2); font-size: 13px; line-height: 1.5;
}
.meta-item { display: inline-flex; align-items: baseline; gap: 4px; padding: 0 10px; border-right: 1px solid var(--border); white-space: nowrap; }
.meta-item:first-child { padding-left: 0; }
.meta-item:last-child { border-right: 0; padding-right: 0; }
.meta-item b { color: var(--text); font-weight: 600; font-size: 13.5px; }
.practice-cta { font-size: 13px; white-space: nowrap; }
.stat-hint {
  color: var(--brand); cursor: pointer; white-space: nowrap;
  border-bottom: 1px dashed var(--brand-border);
}
.stat-hint:hover { opacity: 0.75; }

.practice-body { display: grid; grid-template-columns: 260px 1fr; gap: 14px; align-items: start; }
.practice-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.navigator {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 6px; align-content: start;
  padding: 12px;
  max-height: calc(100vh - 140px); overflow-y: auto;
}
.nav-cell {
  height: 36px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--card); font-size: 14px; color: var(--text-2); font-weight: 400;
}
.nav-cell.answered { background: var(--brand-soft); border-color: var(--brand-border); color: var(--brand); }
.nav-cell.right { background: var(--green-soft); border-color: #cde8d8; color: var(--green); }
.nav-cell.wrong { background: #fdeeee; border-color: #f0c9c5; color: var(--brand); text-decoration: none; }
.nav-cell.current { outline: 2px solid var(--brand); outline-offset: 1px; font-weight: 550; }

.question-card { min-height: 340px; }
.q-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.q-badge {
  height: 26px; padding: 0 10px; display: inline-flex; align-items: center;
  border-radius: 13px; background: var(--brand-soft); color: var(--brand);
  font-size: 14px; font-weight: 550;
}
.q-index { color: var(--text-3); font-size: 15px; }
.q-content { font-size: 17px; line-height: 1.7; margin-bottom: 18px; }
.q-content img { max-width: 100%; }
.q-passage {
  background: var(--bg); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px; font-size: 16px; line-height: 1.75; margin-bottom: 16px; max-height: 320px; overflow: auto;
}

.option {
  display: flex; gap: 12px; align-items: flex-start; width: 100%; text-align: left;
  border: 1px solid var(--border); border-radius: var(--radius-ctrl);
  background: var(--card); padding: 10px 14px; margin-bottom: 8px;
  font-size: 16px; color: var(--text); line-height: 1.5;
}
.option:hover { border-color: var(--brand-border); background: var(--brand-soft); }
.option.selected { border-color: var(--brand); background: var(--brand-soft); }
.option .opt-letter { font-weight: 550; color: var(--brand); flex: 0 0 auto; }

.text-answer { margin: 6px 0 4px; }
.text-answer textarea {
  width: 100%; min-height: 96px; padding: 12px 14px; resize: vertical;
  border: 1px solid var(--border); border-radius: var(--radius-ctrl);
  font-size: 16px; font-family: inherit; color: var(--text); outline: none; line-height: 1.6;
}
.text-answer textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(207, 75, 69, .12); }

.q-actions { margin-top: 16px; display: flex; gap: 12px; align-items: center; }
.key-hint { margin-top: 12px; font-size: 12.5px; color: var(--text-3); }
.q-result { margin-top: 16px; border-radius: var(--radius-ctrl); padding: 14px 16px; font-size: 16px; }
.q-result.right { background: var(--green-soft); color: var(--green); }
.q-result.wrong { background: #fdeeee; color: var(--brand-dark); }
.q-result .ans-line { font-weight: 550; margin-bottom: 4px; }
.q-analysis { margin-top: 10px; color: var(--text); line-height: 1.7; }
.q-analysis .ana-title { font-weight: 550; color: var(--text-2); }

.practice-nav { display: flex; gap: 12px; margin-top: 16px; justify-content: space-between; }

.lock-tip {
  text-align: center; padding: 40px 20px; color: var(--text-2);
}
.lock-tip .big { font-size: 18px; font-weight: 550; color: var(--text); margin-bottom: 8px; }

/* ---------- 错题本 / 记录 ---------- */
.wrong-list, .record-list { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.record-item {
  display: flex; align-items: center; gap: 16px; padding: 16px 20px;
}
.record-main { flex: 1; min-width: 0; }
.record-title { font-size: 16px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.record-sub { color: var(--text-3); font-size: 14px; margin-top: 2px; }
.load-more { text-align: center; margin-top: 16px; }

.empty-tip { text-align: center; color: var(--text-3); padding: 48px 0; }

/* ---------- 首页：搜索（输入框与按钮一体式）+ 题库选项卡 ---------- */
.search-card { padding: 14px 20px; margin-bottom: 20px; }
.search-row {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--border); border-radius: 22px;
  padding: 0 4px 0 16px; height: 46px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-row:focus-within { border-color: var(--brand-border); box-shadow: 0 0 0 3px var(--brand-soft); }
.search-icon { width: 20px; height: 20px; color: var(--text-3); flex: none; }
.search-input {
  flex: 1; height: 42px; padding: 0 4px;
  border: 0; outline: none; background: transparent;
  font-size: 16px; color: var(--text); font-family: inherit;
}
.search-input::placeholder { color: var(--text-3); }
.search-btn { flex: none; min-width: 88px; height: 38px; font-size: 15px; border-radius: 19px; margin-left: auto; }

.cat-title {
  font-size: 20px; font-weight: 550; color: var(--text);
  margin: 26px 0 6px; display: flex; align-items: baseline; gap: 10px;
}
.cat-count { font-size: 14px; font-weight: 400; color: var(--text-3); }

/* 类目选项卡：大厂目录页风格，下划线高亮，可横向滑动 */
.cat-tabs {
  display: flex; gap: 28px; margin: 2px 0 12px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto; scrollbar-width: none;
}
.cat-tabs::-webkit-scrollbar { display: none; }
.cat-tab {
  flex: none; height: 48px; padding: 0 2px;
  border: 0; border-bottom: 2px solid transparent; border-radius: 0;
  background: transparent;
  font-size: 17px; color: var(--text-2); font-family: inherit;
  white-space: nowrap;
}
.cat-tab:hover { color: var(--text); }
.cat-tab.active { color: var(--brand); font-weight: 550; border-bottom-color: var(--brand); }

/* 考试胶囊筛选条：一行放不下自动换行 */
.exam-chip-row {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin: 0 0 14px; padding-bottom: 2px;
}
.exam-chip-row .chip { flex: none; white-space: nowrap; height: 34px; padding: 0 14px; font-size: 14px; border-radius: 17px; }
.exam-chip-row .chip-n { font-size: 12px; color: var(--text-3); margin-left: 2px; }
.exam-chip-row .chip.active .chip-n { color: rgba(255, 255, 255, 0.85); }

.bank-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 10px;
}
.bank-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  padding: 12px 14px; text-align: left;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-ctrl);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.bank-card:hover {
  border-color: var(--brand);
  box-shadow: 0 4px 14px rgba(207, 75, 69, 0.1);
  transform: translateY(-1px);
}
.bank-name-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  width: 100%; min-width: 0;
}
.bank-name {
  font-size: 15px; font-weight: 550; color: var(--text);
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bank-price { color: var(--brand); font-weight: 600; font-size: 15px; line-height: 1; white-space: nowrap; flex: 0 0 auto; }
.bank-price i { font-style: normal; font-size: 0.5em; font-weight: 550; margin-right: 1px; }
.bank-meta { font-size: 13px; color: var(--text-3); }
.bank-tags { display: flex; gap: 6px; margin-top: 2px; flex-wrap: wrap; }
.tag {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  font-size: 12px; line-height: 20px;
}
.tag-price { background: var(--brand-soft); color: var(--brand); border: 1px solid var(--brand-border); }
.tag-go { background: var(--green-soft); color: var(--green); border: 1px solid transparent; }
/* 免费题库标识：绿色描边突出，提示用户去小程序可免费使用 */
.tag-free { background: var(--green-soft); color: var(--green); border: 1px solid var(--green); font-weight: 550; }

/* ---------- 做题页：小程序引导卡（免费库，左栏紧凑版） ---------- */
.mp-guide {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px;
  padding: 12px;
  border: 1px solid var(--green);
  background: var(--green-soft);
}
.mp-guide-qr { width: 104px; height: 104px; flex: none; border-radius: 8px; background: #fff; }
.mp-guide-big { font-size: 14px; font-weight: 550; color: var(--green); }
.mp-guide-path, .mp-guide-note { color: var(--text-2); font-size: 12.5px; line-height: 1.6; }
.mp-guide-path b { color: var(--text); font-weight: 550; }

/* ---------- 锁题提示与支付弹窗 ---------- */
.lock-note { margin-top: 10px; font-size: 14px; color: var(--text-3); }

.pay-sub { text-align: center; color: var(--text-2); margin-bottom: 12px; }
.pay-channel-row { display: flex; gap: 10px; justify-content: center; margin-bottom: 14px; }
.pay-channel-row .btn { flex: 1; }
.pay-area { display: flex; flex-direction: column; align-items: center; gap: 10px; min-height: 200px; justify-content: center; }
.pay-area img { border: 1px solid var(--border); border-radius: 8px; }
.pay-tip { font-size: 14px; color: var(--text-2); text-align: center; line-height: 1.7; }
.pay-status { text-align: center; font-size: 14px; color: var(--text-3); margin-top: 10px; }

/* ---------- 登录弹层 ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(40, 30, 28, .45);
  display: flex; align-items: center; justify-content: center;
}
.modal {
  width: 400px; max-width: calc(100vw - 32px);
  background: var(--card); border-radius: var(--radius-card);
  padding: 24px; box-shadow: 0 12px 40px rgba(0, 0, 0, .12);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-title { font-size: 19px; font-weight: 550; }
.icon-btn { border: 0; background: transparent; color: var(--text-3); padding: 6px; }
.icon-btn:hover { color: var(--text); }

/* 小程序码弹窗 */
.mp-qr-box { text-align: center; }
.mp-qr-box .modal-head { margin-bottom: 6px; }
.mp-qr-img { width: 240px; height: 240px; display: block; margin: 10px auto; border-radius: 12px; background: var(--bg); }
.mp-qr-sub { color: var(--text-2); font-size: 14px; }

.login-tabs { display: flex; gap: 20px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.ltab {
  height: 44px; border: 0; background: transparent; font-size: 16px; color: var(--text-2);
  border-bottom: 2px solid transparent; border-radius: 0;
}
.ltab.active { color: var(--brand); font-weight: 550; border-bottom-color: var(--brand); }

.login-panel { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.qr-box { position: relative; width: 208px; height: 208px; }
.qr-img { width: 208px; height: 208px; display: block; }
.qr-mask {
  position: absolute; inset: 0; background: rgba(255, 255, 255, .94);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  color: var(--text-2); border-radius: 8px;
}
.qr-tip { text-align: center; color: var(--text-2); font-size: 15px; line-height: 1.7; }

.email-form { width: 100%; display: flex; flex-direction: column; gap: 12px; }
.code-row { display: flex; gap: 10px; }
.code-row .input { flex: 1; }
.code-row .btn { flex: 0 0 auto; }
.email-login-btn { width: 100%; }
.form-msg { min-height: 22px; font-size: 14px; color: var(--brand-dark); text-align: center; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 48px; transform: translateX(-50%);
  background: rgba(51, 51, 51, .92); color: #fff; font-size: 15px;
  padding: 10px 20px; border-radius: 10px; z-index: 200; max-width: 80vw;
}

@media (max-width: 900px) {
  .practice-body { grid-template-columns: 1fr; }
  .navigator { order: 2; }
  .tabs { gap: 0; }
  .tab { padding: 0 10px; }
}
