/* 手机网页版（PWA）。样式从小红书小工具版沿用过来，所以仍保持"固定色值 + margin 间距"的写法，
   没用 color-mix / gap 这类新特性——没必要改，也不影响效果。 */
:root {
  --accent: #7b5cc4;
  --accent-2: #d4638a;
  --accent-soft: #f2eff9;
  --accent-soft-2: #e5dff3;
  --accent-ink: #5f4893;
  --ink: #2a2630;
  --ink-2: #6e6979;
  --ink-3: #a29dac;
  --line: rgba(50, 35, 70, 0.1);
  --ok: #3f9a5c;
  --ok-soft: #e6f4ea;
  --bad: #cf4f52;
  --bad-soft: #fbeaea;
  --radius: 14px;
  --shadow: 0 2px 12px rgba(50, 30, 70, 0.08);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
}

html {
  touch-action: manipulation;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: #faf8fc;
  -webkit-font-smoothing: antialiased;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

button {
  font-family: inherit;
  margin: 0;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

button:active {
  opacity: 0.8;
}

button:disabled {
  cursor: default;
}

.ic {
  width: 1.1em;
  height: 1.1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.18em;
  flex: none;
}

/* 小红书版为了躲容器顶部的胶囊按钮，这里原来多留了 64px；网页版没有那条带，只需要避开刘海/灵动岛。 */
#app {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top, 0px);
}

#content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding: 14px 16px 24px;
  padding-bottom: calc(24px + var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)));
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

.screen > * + * {
  margin-top: 12px;
}

.hint {
  margin-bottom: 0; /* 上边距交给 .screen > * + *，别在这里清零 */
  font-size: 12px;
  color: var(--ink-2);
  line-height: 1.6;
}

.hint.center {
  text-align: center;
}

.hint.muted {
  color: var(--ink-3);
}

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}

.screen-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}

.link-btn {
  display: block;
  margin-left: auto;
  margin-right: auto;
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 12.5px;
  padding: 6px 10px;
}

/* ---- 首页 ---- */
#hero {
  position: relative;
  height: 0;
  padding-top: 52%; /* 比例盒：cover.webp 是 1049×545 的横幅裁切，52% ≈ 545/1049 */
  border-radius: 18px;
  overflow: hidden;
  background: #e9def5 url("./cover.webp") center center / cover no-repeat;
  box-shadow: var(--shadow);
}

#hero-shade {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: linear-gradient(90deg, rgba(48, 30, 84, 0.78), rgba(48, 30, 84, 0.42) 55%, rgba(48, 30, 84, 0));
}

#hero-text {
  position: absolute;
  left: 16px;
  top: 16px;
  right: 40%;
  color: #fff;
}

#hero-text h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.25;
  font-weight: 800;
  text-shadow: 0 2px 8px rgba(30, 15, 60, 0.45);
}

#hero-text p {
  margin: 8px 0 0;
  font-size: 11.5px;
  line-height: 1.5;
  opacity: 0.92;
}

/* 首页图片上就直接标出来，不用玩到结果页才看到品牌名 */
#hero-brand {
  display: inline-block;
  margin-top: 10px;
  padding: 3px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.4);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: #fff;
}

#hero-pet {
  position: absolute;
  right: 8px;
  bottom: -2px;
  width: 36%;
  height: 92%;
  object-fit: contain;
  object-position: right bottom;
}

#sfx-btn {
  /* 右上角是小红书容器自己常驻浮着的头像+转发按钮，会盖住这里、点不到（真机截图实测踩过），
     挪到左下角——hero-text 在左上、hero-pet 占右下，左下角是空的，不会跟它们撞。 */
  position: absolute;
  z-index: 2;
  bottom: 8px;
  left: 8px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  color: var(--accent-ink);
  display: flex;
  align-items: center;
  justify-content: center;
}

#sfx-btn .ic {
  width: 17px;
  height: 17px;
}

#session-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--ink-2);
  background: var(--accent-soft);
  border-radius: 12px;
  padding: 9px 10px;
}

.strip-item {
  margin: 0 9px;
  white-space: nowrap;
}

.strip-item .ic {
  color: var(--accent);
  margin-right: 4px;
}

.strip-item b {
  color: var(--accent-ink);
  font-size: 15px;
}

#mode-switch {
  display: flex;
  padding: 4px;
  background: rgba(50, 35, 70, 0.07);
  border-radius: 14px;
}

#mode-switch button {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  padding: 11px 0;
  border-radius: 11px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-2);
}

#mode-switch button + button {
  margin-left: 4px;
}

#mode-switch button .ic {
  margin-right: 5px;
}

#mode-switch button.active {
  background: #fff;
  color: var(--accent-ink);
  box-shadow: 0 1px 6px rgba(50, 30, 70, 0.14);
}

#category-list > * + * {
  margin-top: 10px;
}

.category-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow);
}

.category-btn:active {
  opacity: 1;
  background: var(--accent-soft);
}

.cat-main {
  flex: 1;
  min-width: 0;
}

.cat-label {
  display: block;
  font-size: 17px;
  font-weight: 700;
}

.cat-sub {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--ink-2);
}

.cat-bar {
  display: block;
  height: 5px;
  margin-top: 9px;
  border-radius: 3px;
  background: var(--accent-soft-2);
  overflow: hidden;
}

.cat-bar i {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.cat-side {
  margin-left: 14px;
  text-align: right;
  font-size: 12.5px;
  color: var(--ink-3);
  white-space: nowrap;
}

.cat-side.has-record {
  color: var(--accent-ink);
  font-weight: 700;
}

.cat-side .ic {
  margin-right: 3px;
}

/* ---- 答题页（竞速/爬塔共用） ---- */
.quiz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.quiz-progress {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-2);
}

.quiz-header .link-btn {
  /* 返回/退出按钮现在排在标题前面（左上角）——小红书容器自己在右上角常驻浮着头像+转发两个按钮，
     会整个盖住页面右上角，按钮放那儿点不到（真机截图实测踩过），所以固定放左边，别挪回右边。 */
  margin: 0;
  padding: 6px 12px 6px 0;
}

.hud-row {
  display: flex;
  align-items: center;
}

.hud-main {
  flex: 1;
  min-width: 0;
}

.hud-pet {
  flex: none;
  width: 68px;
  height: 68px;
  margin-left: 10px;
  object-fit: contain;
}

.bump {
  animation: bump 0.35s ease-out;
}

#race-timer {
  font-size: 38px;
  line-height: 1.1;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--accent-ink);
}

#race-timer.on-pace {
  color: var(--ok);
}

#race-pips {
  display: flex;
  margin-top: 9px;
}

.pip {
  width: 16px;
  height: 6px;
  margin-right: 5px;
  border-radius: 3px;
  background: var(--accent-soft-2);
}

.pip.done {
  background: var(--accent);
}

.pip.current {
  background: var(--accent-2);
  animation: blink 0.9s ease-in-out infinite;
}

#race-record-line,
#tower-best-line {
  margin-top: 9px;
  font-size: 12px;
  color: var(--ink-2);
}

#race-record-line b,
#tower-best-line b {
  color: var(--accent-ink);
}

.quiz-word {
  margin: 20px 0 4px;
  min-height: 44px;
  text-align: center;
  font-size: 38px;
  font-weight: 800;
  letter-spacing: 0.5px;
  word-break: break-all;
  color: var(--ink);
}

.quiz-word.long {
  font-size: 30px;
}

.quiz-word.xlong {
  font-size: 23px;
}

.quiz-word-wrap {
  position: relative;
}

/* 绝对定位叠在词的右侧，不占布局空间，词本身还是完整居中（不受按钮存在与否影响） */
.speak-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  margin-top: -16px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-ink);
  display: flex;
  align-items: center;
  justify-content: center;
}

.speak-btn .ic {
  width: 16px;
  height: 16px;
}

.race-hint {
  margin: 0;
  min-height: 18px;
  text-align: center;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--accent);
}

.race-hint.urgent {
  color: var(--accent-2);
}

#race-options > * + *,
#tower-options > * + * {
  margin-top: 10px;
}

.option-btn {
  display: block;
  width: 100%;
  min-height: 54px;
  text-align: left;
  padding: 13px 15px;
  border: 1.5px solid var(--line);
  border-radius: 13px;
  background: #fff;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
  box-shadow: var(--shadow);
}

.option-btn:active {
  opacity: 1;
  background: var(--accent-soft);
}

.option-btn:disabled {
  color: var(--ink);
}

.option-btn.correct {
  border-color: var(--ok);
  background: var(--ok-soft);
  color: #206b3b;
}

.option-btn.wrong {
  border-color: var(--bad);
  background: var(--bad-soft);
  color: #9c2f32;
}

.option-btn.pop {
  animation: pop 0.3s ease-out;
}

/* 词性小标签：照桌宠 DLC 的 .pos-tag——强调色淡底 + 深色粗体，字号比释义小一档，词性和释义一眼分开 */
.pos-tag {
  display: inline-block;
  margin-right: 5px;
  padding: 0 5px;
  border-radius: 5px;
  font-style: normal;
  font-size: 0.72em;
  font-weight: 700;
  line-height: 1.7;
  letter-spacing: 0.2px;
  color: var(--accent-ink);
  background: var(--accent-soft-2);
  vertical-align: 0.12em;
}

.m-g + .m-g {
  margin-left: 12px;
}

/* 选项答对/答错变色之后，标签也跟着换成同色系，别在绿/红底上留一块紫 */
.option-btn.correct .pos-tag {
  color: #206b3b;
  background: rgba(63, 154, 92, 0.18);
}

.option-btn.wrong .pos-tag,
.result-fail .pos-tag {
  color: #9c2f32;
  background: rgba(207, 79, 82, 0.16);
}

.tower-floor-row {
  display: flex;
  align-items: baseline;
}

.tower-floor-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-2);
}

#tower-floor {
  margin: 0 4px;
  font-size: 44px;
  line-height: 1.05;
  font-weight: 800;
  color: var(--accent-ink);
}

#tower-timebar {
  height: 8px;
  margin-top: 10px;
  border-radius: 4px;
  background: var(--accent-soft-2);
  overflow: hidden;
}

#tower-timebar-fill {
  width: 100%;
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-transform-origin: left center;
  transform-origin: left center;
}

#tower-timebar.urgent #tower-timebar-fill {
  background: var(--bad);
}

.tower-time-row {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 12px;
  color: var(--ink-2);
}

#tower-timeleft {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ---- 结果页 ---- */
#result-card {
  text-align: center;
  padding: 18px 14px 14px;
}

#result-pet {
  display: block;
  width: 112px;
  height: 112px;
  margin: 0 auto;
  object-fit: contain;
}

#result-caption {
  margin: 6px 0 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-2);
}

#result-big {
  margin: 2px 0 0;
  font-size: 50px;
  line-height: 1.15;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--accent-ink);
}

#result-card.record #result-big {
  color: var(--accent-2);
}

#result-card.fail #result-big {
  color: var(--ink);
}

#result-sub {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.55;
}

.result-fail {
  margin-top: 12px;
  padding: 9px 12px;
  border-radius: 11px;
  background: var(--bad-soft);
  font-size: 13.5px;
  line-height: 1.5;
  color: #7f2a2d;
}

.result-fail-label {
  margin-right: 8px;
  padding: 1px 7px;
  border-radius: 6px;
  background: var(--bad);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

#result-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 12px;
}

.chip {
  margin: 3px 4px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 12px;
  font-weight: 600;
}

.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  border: none;
  border-radius: 14px;
  padding: 15px 0;
  font-size: 17px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 4px 14px rgba(123, 92, 196, 0.35);
}

.btn-primary .ic {
  margin-right: 7px;
  width: 1.15em;
  height: 1.15em;
}

.btn-primary.soft {
  padding: 12px 0;
  font-size: 15px;
  box-shadow: none;
}

.btn-primary:disabled {
  opacity: 0.6;
}

.btn-row {
  display: flex;
}

.btn-row > * + * {
  margin-left: 8px;
}

.btn-ghost {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--accent-ink);
  font-size: 13.5px;
  font-weight: 700;
}

.btn-ghost .ic {
  margin-right: 4px;
}

.btn-ghost.wide {
  width: 100%;
}

.btn-ghost:disabled {
  opacity: 0.55;
  color: var(--ink-3);
}

/* ---- 今日学习报告 ---- */
.seg {
  display: flex;
  padding: 4px;
  background: rgba(50, 35, 70, 0.07);
  border-radius: 14px;
}

.seg button {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px 0;
  border-radius: 11px;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink-2);
}

.seg button + button {
  margin-left: 4px;
}

.seg button.active {
  background: #fff;
  color: var(--accent-ink);
  box-shadow: 0 1px 6px rgba(50, 30, 70, 0.14);
}

.seg.small button {
  padding: 7px 0;
  font-size: 13px;
}

/* 预览：一张图一个圆角卡，宽度撑满，高度按 3:4 自然算出来 */
#report-pages img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 14px;
  box-shadow: var(--shadow);
  background: #fff;
}

#report-pages img + img {
  margin-top: 12px;
}

.report-loading {
  padding: 40px 0;
  text-align: center;
  font-size: 13px;
  color: var(--ink-3);
}

.hook {
  background: linear-gradient(160deg, #f6f2fc, #fdf0f5);
  border-color: var(--accent-soft-2);
}

.hook-title {
  margin: 0;
  font-size: 15.5px;
  font-weight: 800;
  color: var(--accent-ink);
}

.hook-body {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-2);
}

.hook-feats {
  margin: 12px 0;
  padding: 0;
  list-style: none;
}

.hook-feats li {
  display: flex;
  align-items: flex-start;
  padding: 7px 0;
}

.hook-feats li + li {
  border-top: 1px dashed var(--accent-soft-2);
}

/* "即将推出"预告：低调一行，不抢完整版卖点的风头 */
.hook-soon {
  margin: 0 0 12px;
  text-align: center;
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink-2);
}

.soon-tag {
  display: inline-block;
  margin-right: 7px;
  padding: 1px 9px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.hook-feats .ic {
  margin: 2px 10px 0 0;
  width: 18px;
  height: 18px;
  color: var(--accent);
}

.hook-feats span {
  flex: 1;
  min-width: 0;
}

.hook-feats b {
  display: block;
  font-size: 13.5px;
  color: var(--ink);
}

.hook-feats small {
  display: block;
  margin-top: 1px;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--ink-2);
}

.hook-fallback {
  margin-top: 10px;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px dashed var(--accent);
  background: #fff;
  text-align: center;
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink-2);
}

.hook-fallback b {
  display: block;
  font-size: 20px;
  letter-spacing: 1px;
  color: var(--accent-ink);
}

.license {
  margin: 0;
  padding: 12px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 11px;
  line-height: 1.55;
  color: var(--ink-2);
  white-space: pre-wrap;
  word-break: break-word;
  -webkit-user-select: text;
  user-select: text;
}

/* ---- 3-2-1-GO 倒计时 ---- */
#race-countdown {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(30, 20, 50, 0.6);
}

#race-countdown.go {
  background: transparent;
  pointer-events: none;
}

#race-countdown-num {
  font-size: 120px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}

#race-countdown-num.pop {
  animation: cd-pop 0.72s ease-out;
}

/* ---- 庆祝遮罩 ---- */
#celebrate {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(30, 20, 50, 0.74);
}

#confetti {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.celebrate-body {
  position: relative;
  width: 86%;
  max-width: 340px;
  padding: 0 24px 22px;
  text-align: center;
  border-radius: 24px;
  background: linear-gradient(160deg, #ffffff, #f6f0fc);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

#celebrate.show .celebrate-body {
  animation: cel-in 0.5s cubic-bezier(0.2, 1.2, 0.4, 1);
}

#celebrate-badge {
  width: 46px;
  height: 46px;
  margin: 0 auto;
  position: relative;
  top: -23px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffd166, #ff9eb5);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(255, 158, 181, 0.5);
}

#celebrate-badge .ic {
  width: 24px;
  height: 24px;
}

#celebrate-pet {
  display: block;
  width: 128px;
  height: 128px;
  margin: -14px auto 0;
  object-fit: contain;
}

#celebrate-title {
  margin: 4px 0 0;
  font-size: 22px;
  font-weight: 800;
  color: var(--accent-ink);
}

#celebrate-big {
  margin: 2px 0;
  font-size: 50px;
  font-weight: 900;
  color: var(--accent-2);
}

#celebrate-sub {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--ink-2);
}

#celebrate-close {
  border: none;
  border-radius: 13px;
  padding: 12px 40px;
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

/* ---- 轻提示 ---- */
#toast {
  position: fixed;
  left: 50%;
  bottom: 12%;
  z-index: 70;
  max-width: 82%;
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(30, 24, 40, 0.88);
  color: #fff;
  font-size: 13.5px;
  line-height: 1.5;
  text-align: center;
  -webkit-transform: translateX(-50%);
  transform: translateX(-50%);
  animation: toast-in 0.2s ease-out;
}

/* ---- 动画 ---- */
@-webkit-keyframes pop {
  0% { -webkit-transform: scale(0.97); transform: scale(0.97); }
  55% { -webkit-transform: scale(1.03); transform: scale(1.03); }
  100% { -webkit-transform: scale(1); transform: scale(1); }
}
@keyframes pop {
  0% { -webkit-transform: scale(0.97); transform: scale(0.97); }
  55% { -webkit-transform: scale(1.03); transform: scale(1.03); }
  100% { -webkit-transform: scale(1); transform: scale(1); }
}

@-webkit-keyframes bump {
  0% { -webkit-transform: scale(0.85); transform: scale(0.85); }
  60% { -webkit-transform: scale(1.1); transform: scale(1.1); }
  100% { -webkit-transform: scale(1); transform: scale(1); }
}
@keyframes bump {
  0% { -webkit-transform: scale(0.85); transform: scale(0.85); }
  60% { -webkit-transform: scale(1.1); transform: scale(1.1); }
  100% { -webkit-transform: scale(1); transform: scale(1); }
}

@-webkit-keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

@-webkit-keyframes cd-pop {
  0% { -webkit-transform: scale(1.7); transform: scale(1.7); opacity: 0; }
  35% { -webkit-transform: scale(1); transform: scale(1); opacity: 1; }
  100% { -webkit-transform: scale(0.92); transform: scale(0.92); opacity: 1; }
}
@keyframes cd-pop {
  0% { -webkit-transform: scale(1.7); transform: scale(1.7); opacity: 0; }
  35% { -webkit-transform: scale(1); transform: scale(1); opacity: 1; }
  100% { -webkit-transform: scale(0.92); transform: scale(0.92); opacity: 1; }
}

@-webkit-keyframes cel-in {
  0% { -webkit-transform: scale(0.7); transform: scale(0.7); opacity: 0; }
  100% { -webkit-transform: scale(1); transform: scale(1); opacity: 1; }
}
@keyframes cel-in {
  0% { -webkit-transform: scale(0.7); transform: scale(0.7); opacity: 0; }
  100% { -webkit-transform: scale(1); transform: scale(1); opacity: 1; }
}

@-webkit-keyframes toast-in {
  0% { opacity: 0; }
  100% { opacity: 1; }
}
@keyframes toast-in {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

/* ---- 自定义词库 ---- */
.cat-side.locked {
  color: var(--ink-3);
}

.cat-side.locked .ic {
  color: var(--ink-3);
}

/* 词库名旁边的"自定义"小标签，跟官方词库区分来源 */
.cat-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--accent-soft-2);
  color: var(--accent-ink);
  font-size: 10.5px;
  font-weight: 700;
  vertical-align: 1px;
}

#customlib-list > * + * {
  margin-top: 10px;
}

.customlib-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}

.customlib-row .cat-main {
  flex: 1;
  min-width: 120px;
  margin-right: 14px;
}

.customlib-row .cat-side {
  margin-top: 6px;
}

.customlib-row .link-btn.danger {
  margin-top: 6px;
  margin-left: 14px;
}

.link-btn.danger {
  color: var(--bad);
  margin: 0;
  padding: 4px 0;
  align-self: auto;
}

.card-title {
  margin-bottom: 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

#customlib-name,
#customlib-text {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #faf8fc;
  color: var(--ink);
  font-size: 14px;
  font-family: inherit;
  box-sizing: border-box;
}

#customlib-text {
  resize: vertical;
  line-height: 1.6;
}

#customlib-name:focus,
#customlib-text:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
}

#customlib-parse {
  margin-top: 12px;
}

#customlib-preview {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

#customlib-preview-list {
  max-height: 260px;
  overflow-y: auto;
  margin: 10px 0;
  border-radius: 12px;
  background: #faf8fc;
}

.customlib-preview-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 8px 12px;
  font-size: 13px;
  border-bottom: 1px solid var(--line);
}

.customlib-preview-row b {
  margin-right: 10px;
}

.customlib-preview-row:last-child {
  border-bottom: none;
}

.customlib-preview-row b {
  flex: none;
  color: var(--ink);
}

.customlib-preview-row span {
  flex: 1;
  min-width: 0;
  text-align: right;
  color: var(--ink-2);
}

.customlib-preview-row.err {
  display: block;
}

.customlib-preview-row.err span {
  display: block;
  text-align: left;
  color: #9c2f32;
}

.customlib-preview-row.err small {
  display: block;
  margin-top: 2px;
  color: var(--ink-3);
  font-size: 11.5px;
}

.from-dict {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-style: normal;
  font-size: 10.5px;
  font-weight: 700;
}

/* 窄屏微调（小屏手机 / 大字号） */
@media (max-width: 340px) {
  #hero-text h1 { font-size: 19px; }
  .quiz-word { font-size: 32px; }
  #race-timer { font-size: 32px; }
}

/* ================= 网页版新增 ================= */

/* ---- 安装到桌面：首页顶部醒目横幅 ---- */
#install-banner {
  display: flex;
  align-items: center;
  padding: 12px;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 4px 14px rgba(123, 92, 196, 0.35);
}

#install-banner .ib-ic {
  flex: none;
  width: 38px;
  height: 38px;
  margin-right: 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
}

#install-banner .ib-ic .ic {
  width: 22px;
  height: 22px;
}

#install-banner .ib-text {
  flex: 1;
  min-width: 0;
}

#install-banner b {
  display: block;
  font-size: 14.5px;
}

#install-banner small {
  display: block;
  margin-top: 1px;
  font-size: 11.5px;
  line-height: 1.45;
  opacity: 0.93;
}

#install-banner button {
  flex: none;
  margin-left: 8px;
  padding: 8px 14px;
  border: none;
  border-radius: 999px;
  background: #fff;
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 800;
}

/* ---- 安装教程页 ---- */
.steps {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  position: relative;
  padding: 4px 0 14px 38px;
  font-size: 14px;
  line-height: 1.65;
  color: var(--ink);
  counter-increment: step;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 2px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  line-height: 26px;
}

.steps li small {
  display: block;
  font-size: 12px;
  color: var(--ink-2);
}

.steps .ic {
  width: 1.3em;
  height: 1.3em;
  padding: 2px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.warn-box {
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid #f0c987;
  background: #fff7e6;
  font-size: 13px;
  line-height: 1.65;
  color: #7a5200;
}

.tip-box {
  padding: 11px 12px;
  border-radius: 12px;
  background: var(--accent-soft);
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--ink-2);
}

/* ---- 完整版介绍页 ---- */
.pro-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11.5px;
  font-weight: 800;
  vertical-align: 2px;
}

.plan-row {
  display: flex;
  flex-wrap: wrap;
  margin: 0 -4px;
}

.plan {
  flex: 1 1 40%;
  margin: 4px;
  padding: 10px 6px;
  border-radius: 12px;
  border: 1px solid var(--accent-soft-2);
  background: #fff;
  text-align: center;
  font-size: 13px;
  font-weight: 800;
  color: var(--accent-ink);
}

.plan small {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-3);
}

/* ---- 图片预览浮层（系统分享用不了时，长按图片保存） ---- */
#img-overlay {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  z-index: 80;
  background: rgba(20, 14, 30, 0.92);
  display: flex;
  flex-direction: column;
}

#img-overlay-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 10px;
  color: #fff;
  font-size: 13px;
  line-height: 1.5;
}

#img-overlay-head button {
  flex: none;
  margin-left: 12px;
  padding: 7px 16px;
  border: none;
  border-radius: 999px;
  background: #fff;
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 800;
}

#img-overlay-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 16px calc(20px + env(safe-area-inset-bottom, 0px));
}

#img-overlay-body img {
  display: block;
  width: 100%;
  margin: 0 0 12px;
  border-radius: 10px;
  -webkit-touch-callout: default;
  -webkit-user-select: auto;
  user-select: auto;
}

/* ---- 选择 txt 文件（自定义词库） ---- */
.file-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 12px 0;
  border: 1px dashed var(--accent);
  border-radius: 12px;
  background: #fff;
  color: var(--accent-ink);
  font-size: 13.5px;
  font-weight: 700;
}

.file-btn .ic {
  margin-right: 5px;
}

.file-btn input {
  display: none;
}

textarea,
input[type="text"] {
  -webkit-user-select: text;
  user-select: text;
}

#install-body > * + * {
  margin-top: 12px;
}
