/* ========== 英语学习宝 · 全局样式（深色主题 / 三端自适应） ========== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #181828;
  --bg-soft: #1e1e30;
  --bg-raise: #222238;
  --line: #33334d;
  --card-a: #342854;
  --card-b: #242140;
  --accent: #6366f1;
  --accent-soft: #433880;
  --title: #81d4fa;
  --text: #ffffff;
  --muted: #b9b9cf;
  --dim: #8f8fa8;
  --ok: #4ade80;
  --bad: #fb7185;
  --warn: #f59e0b;
  --info: #0ea5e9;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

html { -webkit-text-size-adjust: 100%; overscroll-behavior-y: contain; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  padding: 14px;
  min-height: 100vh;
  min-height: 100dvh;          /* 移动端浏览器地址栏收起/展开时更稳定 */
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;  /* 防止练习中被下拉刷新打断 */
}

/* 移动端：去掉双击缩放 / 300ms 点击延迟 */
button, .btn, .tab, .mode, .letter-input, .modal-x, .auth-tabs button { touch-action: manipulation; }

.wrap { max-width: 1200px; margin: 0 auto; }
.hidden { display: none !important; }

/* ---------- 顶部栏 ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap; margin-bottom: 14px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand h1 {
  font-size: clamp(19px, 4.6vw, 24px); color: var(--title); font-weight: 700;
  letter-spacing: .5px; white-space: nowrap;
}
.brand .sub { font-size: 12px; color: var(--dim); display: block; font-weight: 400; }

.user-box { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chip-user {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-raise); border: 1px solid var(--line);
  padding: 6px 12px; border-radius: 999px; font-size: 13px; color: var(--muted);
  max-width: 100%;
}
.chip-user b { color: var(--title); font-weight: 600; }
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 700; white-space: nowrap;
}
.badge.vip { background: linear-gradient(135deg, #f6c453, #e08b1e); color: #3a2400; }
.badge.free { background: #3a3a55; color: var(--muted); }
.badge.admin { background: var(--accent); color: #fff; }
.badge.global { background: #1f4e6b; color: #8ddcff; }

/* ---------- 标签导航 ---------- */
.tabs {
  display: flex; gap: 6px; margin-bottom: 14px;
  overflow-x: auto; scrollbar-width: none; padding-bottom: 2px;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto; padding: 9px 16px; border-radius: 10px; border: 1px solid transparent;
  background: var(--bg-raise); color: var(--muted); font-size: 14px; font-weight: 600;
  cursor: pointer; white-space: nowrap; transition: .18s;
}
.tab:hover { color: #fff; background: #2c2c46; }
.tab.active { background: var(--accent); color: #fff; box-shadow: 0 4px 14px rgba(99, 102, 241, .35); }

/* ---------- 面板 / 卡片 ---------- */
.panel { display: none; animation: fade .22s ease; }
.panel.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.card {
  background: linear-gradient(135deg, var(--card-a), var(--card-b));
  border-radius: var(--radius); padding: 22px 18px; box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, .05);
}
.card.plain { background: var(--bg-soft); box-shadow: none; }
.card + .card { margin-top: 14px; }

.section-title {
  font-size: 15px; font-weight: 700; color: #d7dcff; margin-bottom: 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
}

/* ---------- 按钮 ---------- */
.btn {
  padding: 9px 16px; border: none; border-radius: 9px; font-size: 14px; font-weight: 600;
  cursor: pointer; background: var(--accent); color: #fff; transition: .16s;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-family: inherit; white-space: nowrap;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 7px; }
.btn.ghost { background: var(--bg-raise); color: var(--muted); border: 1px solid var(--line); }
.btn.success { background: #22c55e; }
.btn.warn { background: var(--warn); color: #2a1a00; }
.btn.danger { background: #ef4444; }
.btn.info { background: var(--info); }
.btn.gold { background: linear-gradient(135deg, #f6c453, #e08b1e); color: #3a2400; }
.btn.block { width: 100%; }

/* ---------- 输入控件 ---------- */
input[type="text"], input[type="password"], input[type="number"], select, textarea {
  width: 100%; padding: 10px 12px; font-size: 15px; font-family: inherit;
  background: #1b1b2c; color: #fff; border: 1px solid #45455f; border-radius: 9px;
  outline: none; transition: .18s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99, 102, 241, .18); }
/* 下拉框：自绘箭头 + 统一深色底，避免手机上被系统样式改成白底 / 字号忽大忽小 */
select {
  -webkit-appearance: none; appearance: none;
  padding-right: 34px; cursor: pointer; font-weight: 500;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%239a9ac4' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 12px 8px;
  text-overflow: ellipsis;
}
select:hover { border-color: #5c5c80; }
select option, select optgroup { background: #1b1b2c; color: #fff; }
select optgroup { font-weight: 700; color: #b9b9d6; }
textarea { resize: vertical; min-height: 140px; line-height: 1.6; }
label.field { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.form-row { margin-bottom: 12px; }

.toolbar {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center; justify-content: center;
  margin-top: 16px;
}
.toolbar.left { justify-content: flex-start; }
.filter-row {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  margin-bottom: 12px; font-size: 14px; color: var(--muted);
}
.filter-row select { width: auto; min-width: 150px; max-width: 100%; }
/* 合集下拉：手机上独占一行，保证「分类 · 合集名」完整显示不截断 */
@media (max-width: 640px) {
  .filter-row select { flex: 1 1 100%; width: 100%; }
}

/* ---------- 分类逐级选择器（背单词 / 汉译英） ---------- */
.cat-picker { margin-bottom: 12px; }
.cp-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; margin-bottom: 9px; }
.cp-crumb {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border: none; border-radius: 7px; background: transparent;
  color: var(--muted); font-size: 12px; font-family: inherit; font-weight: 500;
  cursor: pointer; transition: .15s; max-width: 100%;
}
.cp-crumb:hover { background: #2c2c46; color: #fff; }
.cp-crumb.cur { color: var(--title); font-weight: 700; }
.cp-crumb .n, .cp-chip .n { font-size: 11px; font-weight: 500; opacity: .55; }
.cp-sep { color: #43435f; font-size: 11px; }
.cp-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.cp-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--bg-raise); color: var(--muted);
  font-size: 13px; font-weight: 500; font-family: inherit; cursor: pointer;
  transition: .16s; white-space: nowrap; max-width: 100%;
}
.cp-chip:hover { border-color: #5c5c80; color: #fff; transform: translateY(-1px); }
.cp-chip.active { background: rgba(99, 102, 241, .16); border-color: var(--accent); color: #fff; font-weight: 700; }
.cp-chip-mine { border-style: dashed; }
.cp-empty { font-size: 13px; color: var(--dim); }
@media (max-width: 640px) {
  .cp-chips { gap: 7px; }
  .cp-chip { padding: 9px 14px; font-size: 13px; }
  .cp-crumb { padding: 4px 8px; }
}

/* ---------- 模式选择 ---------- */
.modes { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 12px; }
.mode {
  padding: 7px 16px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--bg-raise); color: var(--muted); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: .16s;
}
.mode.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- 练习区 ---------- */
.practice {
  background: linear-gradient(135deg, var(--card-a), var(--card-b));
  border-radius: var(--radius); padding: 20px 14px; min-height: 340px;
  border: 1px solid rgba(255, 255, 255, .05); box-shadow: var(--shadow);
}
.meta-line {
  text-align: center; font-size: 13px; color: #b4bdfc; margin-bottom: 12px;
  display: flex; justify-content: center; gap: 10px; flex-wrap: wrap;
}
.progress-bar { height: 6px; background: #2b2b44; border-radius: 3px; overflow: hidden; margin-bottom: 16px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), #8b5cf6); transition: width .3s; }

.ask-cn { font-size: clamp(20px, 5.4vw, 30px); text-align: center; font-weight: 700; margin-bottom: 6px; word-break: break-word; }
.ask-meaning { font-size: clamp(20px, 5.4vw, 28px); text-align: center; font-weight: 700; margin-bottom: 8px; word-break: break-word; }
.ask-phonetic { font-size: clamp(15px, 3.8vw, 20px); text-align: center; color: #c4b5fd; font-family: Georgia, serif; margin-bottom: 14px; }

.word-show {
  font-size: clamp(22px, 6vw, 32px); text-align: center; font-weight: 700;
  letter-spacing: 1px; margin-bottom: 10px; word-break: break-word;
}
.word-show > span:not(.w-chunk) { margin: 0 5px; }

/* 汉译英打字模式：显示的英文原句，长句自动缩小换行 */
.sent-show {
  font-size: clamp(17px, 4.6vw, 24px); line-height: 1.65; letter-spacing: .3px;
  font-weight: 600; margin-bottom: 14px; word-break: break-word;
}
.sent-show > span:not(.w-chunk) { margin: 0 4px; }

/* 词下方中文对照：英文在上、汉字在下（汉译英三种模式共用） */
.w-stack { display: inline-flex; flex-direction: column; align-items: center; }
.w-cn {
  font-size: 13px; color: #9a9ec0; margin-top: 4px; line-height: 1.2;
  letter-spacing: 1px; white-space: nowrap; max-width: 180px;
  overflow: hidden; text-overflow: ellipsis; min-height: 17px;
}
.w-cn:empty { visibility: hidden; }

/* 汉译英语法组块：多词合组，组间拉开间距，组下显示整组中文（不加横线） */
.w-chunk { display: inline-flex; flex-direction: column; align-items: center; margin: 0 20px; }
.w-chunk-words { display: inline-flex; align-items: flex-end; }
.w-chunk-words > .w-stack { margin: 0; }
.w-chunk-words > .w-stack + .w-stack { margin-left: 6px; }
.w-cn-chunk { font-size: 13px; color: #9a9ec0; margin-top: 4px; line-height: 1.2;
  letter-spacing: 1px; white-space: nowrap; max-width: 220px;
  overflow: hidden; text-overflow: ellipsis; min-height: 17px; }
.w-cn-chunk:empty { visibility: hidden; }
/* 补缺/默写行里组块也拉开间距 */
.sent-row .w-chunk { margin: 0 14px; }

/* 点「提示」补上的字母 / 单词 */
.letter-input.hinted { color: #ffd479; background: rgba(246, 196, 83, .14); }

.diff-line {
  font-size: clamp(18px, 4.6vw, 26px); text-align: center; letter-spacing: .5px;
  min-height: 40px; line-height: 1.6; margin-bottom: 12px; word-break: break-word;
  font-family: ui-monospace, "Consolas", monospace;
}
.diff-line .c-ok { color: var(--ok); }
.diff-line .c-bad { color: var(--bad); text-decoration: underline wavy rgba(251,113,133,.5); }
.diff-line .c-normal { color: #9a9ab5; }
.diff-line .c-cursor { color: #fff; border-bottom: 2px solid var(--accent); }

.type-input {
  width: 100%; max-width: 640px; margin: 0 auto 10px; display: block;
  font-size: clamp(17px, 4.4vw, 22px); text-align: center; padding: 12px 14px;
  background: #1b1b2c; border: 2px solid #45455f; border-radius: 12px; color: #fff;
  letter-spacing: 1px;
}
.type-input.correct-input { border-color: var(--ok); color: var(--ok); }
.type-input.wrong-input { border-color: var(--bad); color: var(--bad); }

.letter-row {
  display: flex; flex-wrap: wrap; gap: 8px 0; justify-content: center;
  align-items: flex-end; margin: 14px 0 18px; min-height: 52px;
}
.letter-input {
  width: 30px; height: 42px; margin: 0 2px; border: none; border-bottom: 3px solid #6b6b8f;
  background: transparent; color: #fff; text-align: center; font-size: 21px; font-weight: 700;
  outline: none; text-transform: lowercase; caret-color: var(--accent);
  transition: .15s; border-radius: 2px;
}
.letter-input:focus { background: rgba(99, 102, 241, .14); border-bottom-color: var(--accent); }
.letter-input.correct { border-bottom-color: var(--ok); color: var(--ok); }
.letter-input.wrong { border-bottom-color: var(--bad); color: var(--bad); }
.word-gap { display: inline-block; width: 18px; }
.fixed-letter { font-size: 21px; font-weight: 700; margin: 0 1px; color: #dfe3ff; }

/* 汉译英整词空位：词与词之间留一点间隔，横线长度随单词自适应 */
.letter-row.sent-row { gap: 10px 9px; }
.sent-row .letter-input { margin: 0; padding: 0 2px; font-family: inherit; }
.sent-row .fixed-letter { margin: 0; font-size: 19px; }
/* 单词前后的标点固定显示，紧贴输入框（组内无间距） */
.sent-row .word-group { display: inline-flex; align-items: center; gap: 0; }
.sent-row .word-group .fixed-letter { padding: 0 1px; }
/* 句尾标点写在单词基线上（右下角），不跟着输入框垂直居中 */
.sent-row .word-group .fixed-letter.punct-tail { align-self: flex-end; line-height: 1; transform: translateY(3px); }
/* 词首的引号、括号本来就在字的上方，保持居中偏上的观感 */
.sent-row .word-group .fixed-letter.punct-lead { align-self: center; }
/* 带中文对照的词列：底对齐 + 汉字固定占位，保证横线在同一水平线上 */
.sent-row .w-stack { align-self: flex-end; }
@media (max-width: 640px) {
  .w-cn { font-size: 12px; min-height: 15px; max-width: 120px; letter-spacing: .5px; }
  .w-cn-chunk { font-size: 12px; min-height: 15px; max-width: 160px; letter-spacing: .5px; }
  .w-chunk-words > .w-stack + .w-stack { margin-left: 4px; }
  .w-chunk { margin: 0 13px; }
  .sent-row .w-chunk { margin: 0 10px; }
}

.tip { text-align: center; font-size: 15px; min-height: 26px; margin: 8px 0; color: var(--muted); }
.tip.ok { color: var(--ok); font-weight: 700; }
.tip.bad { color: var(--bad); font-weight: 700; }

.kbd-hint { text-align: center; font-size: 12px; color: var(--dim); margin-top: 10px; }

/* ---------- 列表 ---------- */
.list-box {
  background: #1b1b2c; border: 1px solid var(--line); border-radius: 12px;
  max-height: 330px; overflow: auto; padding: 6px;
}
.list-item {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 9px 10px; border-radius: 8px; font-size: 14px; cursor: pointer; flex-wrap: wrap;
  color: #e6e6f5;
}
.list-item:hover { background: #2a2a44; }
.list-item.selected { background: var(--accent-soft); }
.list-item .li-main { flex: 1 1 180px; min-width: 0; word-break: break-word; }
.list-item .li-sub { font-size: 12px; color: var(--dim); }
.list-item .li-ops { display: flex; gap: 5px; flex: 0 0 auto; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.empty-state { text-align: center; color: var(--dim); padding: 26px 10px; font-size: 14px; }

/* ---------- 会员卡片 ---------- */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.plan {
  border: 1px solid var(--line); border-radius: 14px; padding: 18px 14px; text-align: center;
  background: #202034; position: relative; transition: .18s;
}
.plan:hover { border-color: var(--accent); transform: translateY(-2px); }
.plan .p-name { font-size: 16px; font-weight: 700; color: var(--title); margin-bottom: 6px; }
.plan .p-price { font-size: 26px; font-weight: 800; color: #ffd479; }
.plan .p-price small { font-size: 13px; color: var(--muted); font-weight: 400; }
.plan .p-desc { font-size: 12px; color: var(--muted); margin: 8px 0 14px; min-height: 34px; }
.plan .p-flag {
  position: absolute; top: -9px; right: 10px; background: linear-gradient(135deg, #f6c453, #e08b1e);
  color: #3a2400; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px;
}

.member-card {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  background: linear-gradient(120deg, #3a2a5e, #262045); border: 1px solid #4a3f78;
  border-radius: 14px; padding: 16px; margin-bottom: 14px;
}
.member-card .mc-title { font-size: 15px; font-weight: 700; color: #ffd479; }
.member-card .mc-sub { font-size: 13px; color: var(--muted); margin-top: 4px; }
.member-card .mc-main { flex: 1 1 220px; min-width: 0; }
.member-card .mc-side { display: flex; align-items: center; gap: 12px; }
.member-card .mc-count { text-align: center; line-height: 1.15; }
.member-card .cd-num { display: block; font-size: 30px; font-weight: 800; color: #ffd479; letter-spacing: -1px; }
.member-card .cd-num.warn { color: #ff8a7a; }
.member-card .cd-lb { font-size: 11px; color: var(--muted); white-space: nowrap; }
.cd-inline { color: #ffd479; font-weight: 700; }
.cd-inline.warn { color: #ff8a7a; }
/* 续期按钮：临期时轻微呼吸提示 */
.btn.attention { animation: renewPulse 1.9s ease-in-out infinite; }
@keyframes renewPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 180, 80, .55); }
  50% { box-shadow: 0 0 0 8px rgba(255, 180, 80, 0); }
}
/* ---------- 会员到期提醒弹窗 ---------- */
.renew-box { max-width: 430px; text-align: center; position: relative; }
.renew-box .renew-icon { font-size: 34px; line-height: 1; margin-bottom: 8px; }
.renew-box .renew-text { font-size: 14px; line-height: 1.85; color: var(--muted); margin-bottom: 16px; }
.renew-box .renew-text b { color: #ffd479; }
.renew-box .renew-hint { font-size: 11px; color: var(--dim); margin-top: 12px; }
/* ---------- 后台：临期会员行标红 ---------- */
tr.row-expiring { background: rgba(255, 96, 80, .10); }
tr.row-expiring:hover { background: rgba(255, 96, 80, .16); }
tr.row-expiring td { color: #ffb3a8; }
tr.row-expiring .badge.vip { background: rgba(255, 96, 80, .22); color: #ffb3a8; border-color: rgba(255, 96, 80, .5); }
.expire-tip {
  margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; font-size: 13px;
  background: rgba(255, 96, 80, .12); border: 1px solid rgba(255, 96, 80, .35); color: #ffb3a8;
}

/* ---------- 账号信息行 ---------- */
.info-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.info-row:last-child { border-bottom: none; padding-bottom: 0; }
.info-k { flex: 0 0 64px; color: var(--dim); }
.info-v { flex: 1 1 auto; min-width: 0; color: var(--text); word-break: break-all; }
.info-v.dim { color: var(--dim); }
.info-v .badge { margin-right: 6px; }
.info-extra { font-size: 12px; color: var(--muted); }

/* 卡片标题右侧的补充说明、表格里的弱化文字 */
.sub-hint { font-size: 12px; font-weight: 400; color: var(--dim); }
.dim-text { font-size: 12px; color: var(--dim); }

/* 表格里的次要信息（如订单列表中的手机号） */
.sub-line { font-size: 11px; color: var(--dim); margin-top: 2px; }

/* ---------- 表格（后台） ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 560px; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: #232338; color: var(--muted); font-weight: 600; position: sticky; top: 0; z-index: 1; }
tbody tr:hover { background: #222236; }
td.wrap-cell { white-space: normal; max-width: 260px; word-break: break-word; }

/* ---------- 弹窗 ---------- */
.modal {
  display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, .78);
  align-items: center; justify-content: center; padding: 16px; z-index: 1000;
}
.modal.show { display: flex; }
.modal-box {
  background: #27273a; border: 1px solid #3d3d58; border-radius: 14px;
  padding: 22px 18px; width: 100%; max-width: 480px; max-height: 90vh; overflow: auto;
  animation: pop .2s ease;
}
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-box h3 { font-size: 17px; margin-bottom: 14px; color: var(--title); }
.modal-box.wide { max-width: 620px; }
/* 后台「批量修改」：等宽字体 + 不自动换行，方便按「编号 | 内容」逐行核对 */
#askInput.mono {
  font-family: ui-monospace, Consolas, 'Courier New', monospace;
  font-size: 13px; line-height: 1.9; white-space: pre; overflow-x: auto;
  min-height: 46vh; letter-spacing: 0;
}

/* ---------- 收款码 / 卡密兑换 ---------- */
.qr-wrap { text-align: center; margin: 12px 0 2px; }
.qr-wrap img {
  width: 190px; height: 190px; object-fit: contain; background: #fff;
  border-radius: 12px; padding: 8px; display: block; margin: 0 auto;
}
.qr-cap { font-size: 12px; color: var(--dim); margin-top: 6px; }
.pay-code {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 10px; padding: 10px 12px; background: #1b1b2c;
  border: 1px dashed var(--line); border-radius: 10px;
}
.pay-code span { font-size: 12px; color: var(--dim); }
.pay-code b {
  font-family: ui-monospace, Consolas, monospace; font-size: 19px;
  letter-spacing: 2px; color: #ffd479;
}
.pay-code-tip { font-size: 12px; color: var(--dim); margin-top: 6px; line-height: 1.6; }
.pay-note { margin: 10px 0; padding: 10px; background: #1b1b2c; border-radius: 8px; color: #ffd479; font-size: 13px; }

.redeem-tip { font-size: 12px; color: var(--dim); margin-bottom: 10px; line-height: 1.6; }
.redeem-row { display: flex; gap: 8px; flex-wrap: wrap; }
.redeem-row input {
  flex: 1 1 190px; min-width: 0; padding: 11px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: #1b1b2c; color: var(--text);
  font-size: 16px;                    /* ≥16px：避免 iOS 聚焦时自动放大页面 */
  letter-spacing: 1px; text-transform: uppercase;
  font-family: ui-monospace, Consolas, "SF Mono", monospace;
  -webkit-appearance: none; appearance: none;
}
.redeem-row input::placeholder { text-transform: none; letter-spacing: 0; font-family: inherit; }
.redeem-row input:focus { outline: none; border-color: var(--accent); }
.redeem-row .btn { flex: 0 0 auto; white-space: nowrap; }
@media (max-width: 480px) {
  .redeem-row .btn { flex: 1 1 100%; }
  .qr-wrap img { width: 168px; height: 168px; }
}

/* ---------- 提示条 ---------- */
#toastWrap { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 3000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: calc(100% - 32px); max-width: 420px; }
.toast {
  background: #2b2b45; border: 1px solid var(--line); color: #fff; padding: 10px 18px;
  border-radius: 10px; font-size: 14px; box-shadow: var(--shadow); animation: slideUp .25s ease;
  max-width: 100%; text-align: center;
}
.toast.ok { border-color: #1f7a45; background: #17381f; }
.toast.bad { border-color: #8a2c34; background: #3a1a20; }
@keyframes slideUp { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- 登录 / 注册 弹窗 ---------- */
.auth-box { max-width: 400px; position: relative; }
.auth-logo { text-align: center; margin-bottom: 16px; }
.auth-logo h1 { font-size: 23px; color: var(--title); letter-spacing: 1px; }
.auth-logo p { font-size: 12px; color: var(--dim); margin-top: 5px; }
.auth-tabs { display: flex; gap: 6px; margin-bottom: 16px; background: #232338; padding: 4px; border-radius: 10px; }
.auth-tabs button {
  flex: 1; padding: 9px; border: none; border-radius: 8px; background: transparent;
  color: var(--muted); font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.auth-tabs button.active { background: var(--accent); color: #fff; }
.auth-tip { font-size: 12px; color: var(--dim); text-align: center; margin-top: 14px; line-height: 1.7; }

.modal-x {
  position: absolute; top: 8px; right: 10px; width: 32px; height: 32px;
  border: none; border-radius: 50%; background: transparent; color: var(--dim);
  font-size: 24px; line-height: 1; cursor: pointer; font-family: inherit; transition: .15s;
}
.modal-x:hover { background: #34344e; color: #fff; }

/* ---------- 访客引导（未登录） ---------- */
.guest-wrap {
  min-height: calc(100vh - 28px); display: flex;
  min-height: calc(100dvh - 28px);
  align-items: center; justify-content: center; padding: 10px;
}
.guest-card {
  width: 100%; max-width: 380px; text-align: center;
  background: linear-gradient(135deg, var(--card-a), var(--card-b));
  border: 1px solid rgba(255, 255, 255, .06); border-radius: var(--radius);
  padding: 30px 22px; box-shadow: var(--shadow);
}
.guest-card h1 { font-size: clamp(22px, 6vw, 27px); color: var(--title); letter-spacing: 1px; }
.guest-card .guest-sub { font-size: 13px; color: var(--dim); margin: 8px 0 22px; }

/* 头部小工具 */
.icon-line { display: flex; gap: 8px; align-items: center; }
.switch-label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); cursor: pointer; }
input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; }

/* ---------- 平板 ---------- */
@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
  .practice { min-height: 300px; }
}

/* ---------- 手机 ---------- */
@media (max-width: 640px) {
  body {
    padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right))
             max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  }
  /* iOS 上输入框字号 < 16px 会自动放大整个页面，这里统一顶到 16px */
  input[type="text"], input[type="password"], input[type="number"], select, textarea { font-size: 16px; }
  /* 手机端下拉框：更高的点击区、更亮的底和更柔的边框，箭头同步放大 */
  select {
    padding: 13px 42px 13px 14px; min-height: 46px; border-radius: 12px;
    background-color: #212136; border-color: #4d4d6b; font-weight: 600; letter-spacing: .2px;
    background-position: right 14px center; background-size: 13px 9px;
  }
  .filter-row select { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04); }
  select:active { background-color: #2a2a44; }
  .type-input { font-size: 17px; }
  .brand h1 { font-size: 19px; }
  .brand .sub { display: none; }
  .tab { padding: 8px 13px; font-size: 13px; }
  .practice { padding: 16px 10px; }
  .card { padding: 16px 12px; }
  .toolbar { gap: 6px; }
  .toolbar .btn { padding: 10px 12px; font-size: 13px; flex: 1 1 auto; min-height: 42px; }
  .letter-input { width: 26px; height: 38px; font-size: 18px; max-width: 100%; }
  .word-gap { width: 12px; }
  /* 键盘弹出时弹窗整体上移并允许滚动，避免输入框被遮住 */
  .modal { align-items: flex-start; overflow-y: auto; padding: 12px; }
  .modal-box { padding: 18px 14px; margin: auto; max-height: none; }
  .auth-box { margin-top: 6vh; }
  .list-item { font-size: 13px; }
  th, td { padding: 8px 8px; font-size: 12px; }
  /* 手机上没有物理键盘，隐藏「回车 / Tab」类提示，避免误导 */
  .kbd-hint { display: none; }
  #toastWrap { bottom: calc(26px + env(safe-area-inset-bottom)); }
  .list-box { -webkit-overflow-scrolling: touch; }
  .table-wrap { -webkit-overflow-scrolling: touch; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ========== 公共词库分类树 ========== */
.cat-tree { max-height: 330px; padding: 4px; }
.cat-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 14px; color: var(--text);
  transition: background .15s;
}
.cat-row:hover { background: #2a2a44; }
.cat-row.selected { background: var(--accent-soft); }
.cat-row.cat-all { font-weight: 700; color: var(--title); }
.cat-row .cat-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-row .cat-num { flex: 0 0 auto; font-size: 12px; color: var(--dim); }
.cat-row.selected .cat-num { color: #cfd2ff; }

/* ========== 意见反馈 ========== */
.fb-item { padding: 10px 10px 12px; border-bottom: 1px solid var(--line); }
.fb-item:last-child { border-bottom: 0; }
.fb-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.fb-kind { font-size: 12px; color: var(--muted); }
.fb-time { margin-left: auto; font-size: 12px; color: var(--dim); }
.fb-content { font-size: 14px; color: var(--text); line-height: 1.65; white-space: pre-wrap; word-break: break-word; }
.fb-reply {
  margin-top: 8px; padding: 8px 10px; border-left: 3px solid var(--accent);
  background: rgba(99, 102, 241, .12); border-radius: 6px;
  font-size: 13px; color: var(--muted); line-height: 1.65; white-space: pre-wrap; word-break: break-word;
}
.fb-reply b { display: block; margin-bottom: 4px; font-size: 12px; color: #a5b4fc; }

@media (max-width: 480px) {
  /* 5 个主 tab 在手机上一行放不下，允许换行，避免被横向滚动藏住 */
  .tabs { flex-wrap: wrap; overflow-x: visible; }
  .tab { padding: 8px 12px; font-size: 13px; flex: 1 1 auto; text-align: center; }
  .cat-row { font-size: 13px; padding: 8px 8px; }
}

/* ==================== 状元资料 ==================== */
/* 列表：竖版商品卡片（类似拼多多），手机两列，平板 / PC 自动多列 */
.mat-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 12px; }
.mat-item {
  display: flex; flex-direction: column; overflow: hidden; cursor: pointer;
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 12px;
}
.mat-item.owned { border-color: rgba(124, 92, 255, .45); }
.mat-cover {
  position: relative; width: 100%; height: 0; padding-top: 133.33%;   /* 固定 3:4，padding 技巧兼容所有内核 */
  background: rgba(255, 255, 255, .06);
}
.mat-cover-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.mat-cover-empty {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 36px; color: var(--dim);
}
.mat-main {
  flex: 1 1 auto; min-width: 0; padding: 9px 11px 11px;
  display: flex; flex-direction: column; gap: 5px;
}
.mat-title {
  font-weight: 700; color: var(--title); font-size: 14px; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.mat-title .badge { flex: none; }
.mat-intro {
  font-size: 12px; color: var(--muted); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.mat-sold { font-size: 12px; color: var(--dim); }
.mat-foot { margin-top: auto; padding-top: 6px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mat-price { font-weight: 800; font-size: 17px; color: #ffd479; }
.mat-meta { font-size: 12px; color: var(--dim); margin-top: 6px; display: flex; gap: 12px; flex-wrap: wrap; }
.mat-owned { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.mat-owned:last-child { border-bottom: 0; }
.mat-owned .mat-title { margin-bottom: 8px; -webkit-line-clamp: unset; display: block; }
.dl-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.dl-k { flex: 0 0 auto; font-size: 12px; color: var(--dim); }
.dl-link { color: #7cb8ff; font-size: 13px; word-break: break-all; }
.code-mono { font-family: ui-monospace, Consolas, monospace; letter-spacing: 1px; color: var(--title); }
@media (min-width: 561px) {
  .mat-list { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
}

/* ==================== 状元资料：详情页 ==================== */
.mat-detail-box { width: min(680px, 94vw); max-height: 88vh; overflow-y: auto; }

/* 详情画廊：手机单列大图 + 缩略图条 + 左右滑动/箭头切换；平板/PC 同样自适应 */
.mat-gallery { margin-top: 4px; position: relative; }
.mat-gallery-main {
  width: 100%; max-height: 56vh; object-fit: contain;
  border-radius: 10px; border: 1px solid var(--line); background: rgba(0, 0, 0, .25);
  display: block;
}
.mat-nav {
  position: absolute; top: 40%; transform: translateY(-50%);
  width: 34px; height: 34px; border-radius: 50%; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, .5); color: #fff;
  border: 1px solid rgba(255, 255, 255, .3);
  font-size: 20px; line-height: 1; cursor: pointer; z-index: 2;
}
.mat-nav.prev { left: 10px; }
.mat-nav.next { right: 10px; }
.mat-nav:active { background: rgba(0, 0, 0, .75); }
.mat-dthumbs {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px; margin-top: 10px;
}
.mat-dt {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
  border-radius: 8px; border: 2px solid transparent; cursor: pointer; opacity: .75;
}
.mat-dt.active { border-color: #7cb8ff; opacity: 1; }
.mat-dinfo { margin-top: 12px; }

/* ==================== 分享弹窗 ==================== */
.share-box { width: min(360px, 92vw); text-align: center; }
.share-box h3 { margin-bottom: 4px; }
.share-qr { display: flex; justify-content: center; margin: 14px 0 12px; }
.share-qr canvas {
  background: #fff; border-radius: 10px; padding: 8px; box-sizing: content-box;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .3);
}
.share-tip { font-size: 12px; color: var(--muted); line-height: 1.8; margin: 0 0 12px; }
.share-tip b { color: var(--title); }
.share-url-row { display: flex; gap: 8px; }
.share-url-row input {
  flex: 1 1 auto; min-width: 0; font-size: 12px; color: var(--dim);
  background: rgba(255, 255, 255, .05); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px;
}

/* ==================== 资料图片上传控件（后台） ==================== */
.mf-img-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.mf-img-view {
  width: 84px; height: 60px; object-fit: cover;
  border-radius: 8px; border: 1px solid var(--line); background: rgba(255, 255, 255, .06);
}
.mf-img-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.mf-img { position: relative; width: 76px; height: 56px; }
.mf-img img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.mf-img-x {
  position: absolute; top: -7px; right: -7px; width: 20px; height: 20px;
  border-radius: 50%; border: 0; cursor: pointer;
  background: #e05252; color: #fff; font-size: 13px; line-height: 1;
}

/* ==================== 页脚备案信息（后台可配置） ==================== */
.site-footer {
  padding: 22px 16px 26px;
  text-align: center;
  font-size: 12px;
  color: var(--dim);
  line-height: 1.8;
}
.site-footer a {
  color: var(--dim);
  text-decoration: none;
  border-bottom: 1px dashed rgba(143, 143, 168, .5);
  padding-bottom: 1px;
  transition: color .15s;
}
.site-footer a:hover { color: var(--title); border-bottom-color: var(--title); }
.site-footer .foot-sep { margin: 0 8px; opacity: .5; }
.site-footer.hidden { display: none; }
