/* ===== 竖屏布局（手机满屏 / 电脑居中信箱）===== */
/* 配色：浅银灰 · 冷亮灰 · 近白（Silver Light）—— 纯白面板 + 银灰描边 + 钢蓝点缀 */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #EEF1F4;            /* 页面：极浅冷灰（接近白） */
  --panel: #FFFFFF;         /* 面板/底栏：纯白 */
  --panel-soft: #E6EAEF;    /* 次面板/卡底：浅银灰 */
  --line: #D4DAE1;          /* 分隔线（银灰描边） */
  --ink: #2C333B;           /* 主文字：深石板灰 */
  --ink-soft: #6E7681;      /* 次要文字：中灰 */
  --accent: #5B7E9E;        /* 强调：钢蓝（冷调银蓝） */
  --accent-soft: rgba(91,126,158,.14);
  --accent-deep: #3F5E78;   /* 钢蓝深 */
  --amber: #C9942F;         /* 暖琥珀（阳光费用，淡于暗色版） */
  --danger: #C05545;        /* 危险红（僵尸血/删除） */
  --field-1: #F7F9FB;       /* 战场：近白（上） */
  --field-2: #E4E9EF;       /* 战场：浅银灰（下） */
  --field-line: #D5DBE2;    /* 战场网格线：银灰 */
  --shadow-sm: 0 1px 2px rgba(20,28,40,.10);
  --shadow: 0 4px 14px rgba(20,28,40,.14);
}
html, body { height: 100%; }
body {
  background: #fff;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  overflow: hidden;
  display: flex; flex-direction: column; align-items: center;
}
#stage {
  flex: 1; min-height: 0; width: 100%; max-width: 480px;
  display: flex; flex-direction: column; position: relative;
  background: #fff;
  box-shadow: 0 12px 40px rgba(20,28,40,.18);
}

/* ===== 底部 Tab 导航（刷一刷 / 学习地图 / 书架 / 我的）=====
   设计：图标藏在一枚胶囊高光里，选中时点亮、微微上浮；未选中是低饱和灰图标；
   选中那格的上沿另有一条短指示条滑到它头上 —— 这才说明"你在哪一栏"。
   底部导航不该抢戏，所以去掉整块高亮方块，只留这三点变化。
   --tb-* 是这枚底栏自己的配色：默认冷调（银灰主题）；当前页是暖纸皮肤时，
   由 skin-cream.css 的 body.tab-warm 覆盖成焦糖色，让底栏跟着纸面走。 */
.tabbar {
  --tb-bg: #FFFFFF;
  --tb-line: rgba(20, 28, 40, .07);
  --tb-shadow: rgba(20, 28, 40, .06);
  --tb-on: var(--accent-deep);
  --tb-halo: var(--accent-soft);
  --tb-pad-top: 7px;              /* 上内边距：.tab::before 靠它把指示条顶到栏沿上，别单独改 */

  flex: 0 0 auto; display: flex; align-items: stretch;
  width: 100%; max-width: 480px;
  padding: var(--tb-pad-top) 10px calc(7px + env(safe-area-inset-bottom, 0px));
  background: var(--tb-bg);
  border-top: 1px solid var(--tb-line);
  box-shadow: 0 -6px 20px var(--tb-shadow);
  z-index: 20;
}
.tabbar[hidden] { display: none; }
.tab {
  position: relative; flex: 1 1 0; min-width: 0;
  border: none; background: transparent; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 2px 0 3px;
  font-family: inherit; font-size: 10.5px; font-weight: 700; letter-spacing: .2px;
  color: var(--ink-soft);
  -webkit-tap-highlight-color: transparent;
  transition: color .22s ease;
}
/* 标签宽度自适应内容，但绝不允许撑破自己那一格。
   第三格是动态书名（见 main.js 的 syncBookTabLabel），可能比「刷一刷」长
   （如「思考，快与慢」）——超长时截断成省略号，而不是把整条底栏挤歪；
   完整书名的 tooltip 由 JS 写在那一格的 title 上。 */
.tab .tab-label {
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* 顶部指示条：贴住底栏上沿，选中哪一格就落在哪一格的正上方。
   用负 top 抵消 .tabbar 的上内边距，让它与栏沿严丝合缝。 */
.tab::before {
  content: ""; position: absolute; left: 50%; top: calc(-1 * var(--tb-pad-top));
  width: 24px; height: 3px; border-radius: 0 0 3px 3px;
  background: var(--tb-on);
  opacity: 0; transform: translateX(-50%) scaleX(0);
  pointer-events: none;
  transition: transform .3s cubic-bezier(.34, 1.4, .64, 1), opacity .2s ease;
}
.tab.on::before { opacity: 1; transform: translateX(-50%) scaleX(1); }
/* 图标位：44×27 的胶囊，选中时 ::before 亮起作底。
   2026-10-13 图标由 emoji 换成**实心几何 SVG**（用户给的参考风格）：
   所以这里不再用 grayscale 去饱和 —— 那会把焦糖色滤成脏灰，而且 emoji 是各家
   系统自己画的（同一份代码在 Android/iOS/Windows 上长得不一样）。
   现在只压透明度，颜色交给 currentColor：未选中 = 第 65 行的 --ink-soft（暖灰），
   选中 = .tab.on 的 --tb-on（暖纸皮肤下是焦糖 #8A5B3C）。 */
.tab .tab-ico {
  position: relative; display: grid; place-items: center;
  width: 44px; height: 27px; font-style: normal; line-height: 1;
  opacity: .58;
  transition: opacity .25s ease, transform .3s cubic-bezier(.34, 1.56, .64, 1);
}
.tab .tab-ico svg { width: 21px; height: 21px; display: block; fill: currentColor; }
.tab .tab-ico::before {
  content: ""; position: absolute; inset: 0; border-radius: 999px;
  background: var(--tb-halo);
  opacity: 0; transform: scale(.5);
  transition: opacity .22s ease, transform .32s cubic-bezier(.34, 1.56, .64, 1);
}
.tab.on { color: var(--tb-on); }
.tab.on .tab-ico { opacity: 1; transform: translateY(-1px) scale(1.08); }
.tab.on .tab-ico::before { opacity: 1; transform: scale(1); }
.tab:active .tab-ico { transform: scale(.92); }
.tab.on:active .tab-ico { transform: translateY(-1px) scale(1); }
/* 窄屏：四个中文标签会挤，缩小图标与字号（文字不隐藏，保持可读） */
@media (max-width: 360px) {
  .tabbar { padding-left: 4px; padding-right: 4px; }
  .tab { font-size: 10px; letter-spacing: 0; }
  .tab .tab-ico { width: 40px; height: 25px; }
  .tab .tab-ico svg { width: 19px; height: 19px; }
}
@media (prefers-reduced-motion: reduce) {
  .tab, .tab .tab-ico, .tab .tab-ico::before, .tab::before { transition: none; }
}

/* 顶部状态条 */
.status {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px; color: var(--ink);
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  z-index: 10; position: relative;
}
.status .stat {
  display: flex; align-items: center; gap: 4px;
  background: var(--panel-soft); border: 1px solid var(--line);
  border-radius: 20px; padding: 3px 11px 3px 7px;
  font-size: 15px; font-weight: 800; color: var(--ink);
}
.status .level {
  flex: 1; text-align: center; font-size: 13px; font-weight: 700;
  color: var(--ink); letter-spacing: 1px;
}
.status .mini {
  background: var(--panel-soft); color: var(--ink);
  border: 1px solid var(--line); padding: 5px 12px; border-radius: 8px;
  font-weight: 700; cursor: pointer; transition: background .12s;
}
.status .mini:hover { background: var(--line); }
.status .mini:active { transform: translateY(1px); }
.status .mini.on { background: var(--accent); color: #fff; border-color: var(--accent); }

/* 设置菜单（收纳 自动/速度/音效，减少头部拥挤） */
.settings-overlay {
  position: absolute; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: rgba(20,28,40,.32); backdrop-filter: blur(2px);
}
.settings-overlay.hidden { display: none; }
.settings-panel {
  width: min(86%, 340px); background: var(--panel);
  border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 16px 50px rgba(20,28,40,.28);
  padding: 18px 18px 16px; color: var(--ink);
  transform-origin: center; animation: setPop .16s ease-out;
  max-height: calc(100dvh - 40px); overflow-y: auto;
}
@keyframes setPop { from { transform: scale(.94); opacity: 0 } to { transform: scale(1); opacity: 1 } }
.settings-head { font-size: 17px; font-weight: 800; margin-bottom: 6px; letter-spacing: .5px; }
.settings-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 2px; border-bottom: 1px solid var(--panel-soft);
}
.settings-label { font-size: 14px; font-weight: 700; color: var(--ink); }
/* 开关 */
.toggle {
  width: 48px; height: 28px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--panel-soft); position: relative; cursor: pointer; padding: 0;
  transition: background .15s, border-color .15s;
}
.toggle i {
  position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: left .15s;
}
.toggle.on { background: var(--accent); border-color: var(--accent); }
.toggle.on i { left: 23px; }
/* 速度分段选择 */
.seg { display: flex; gap: 4px; }
.seg button {
  border: 1px solid var(--line); background: var(--panel-soft); color: var(--ink-soft);
  font-size: 12px; font-weight: 700; padding: 6px 8px; border-radius: 7px; cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.seg button.on { background: var(--accent); color: #fff; border-color: var(--accent); }
/* hidden 属性必须显式兜底：.settings-row 的 display:flex 会覆盖 UA 的 [hidden]{display:none}，
   否则「震动反馈」行在不支持触觉的设备上藏不住 */
.settings-row[hidden] { display: none; }
/* 反馈强度说明：三档差异用文字讲清楚，否则用户只能靠猜 */
.settings-hint {
  font-size: 11.5px; line-height: 1.55; color: var(--ink-soft);
  padding: 9px 2px 0; opacity: .9;
}
.settings-done {
  width: 100%; margin-top: 16px; padding: 11px; border: none; border-radius: 10px;
  background: var(--accent); color: #fff; font-size: 15px; font-weight: 800; cursor: pointer;
}
.settings-done:active { transform: translateY(1px); }

/* 战场：暗暖棕地面 + 极淡琥珀顶光 + 淡线网格 */
.battlefield {
  --head: 8px;
  position: relative; flex: 1; margin: 6px; border-radius: 14px;
  overflow: hidden; user-select: none; touch-action: manipulation;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(91,126,158,.10) 0%, transparent 55%),
    linear-gradient(180deg, var(--field-1) 0%, var(--field-2) 100%);
  border: 1px solid var(--field-line);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.6);
}
.grid {
  position: absolute; inset: var(--head) 0 0 0; display: grid;
  /* grid-template-columns/rows 由 render.js 按 GRID 数据动态设置 */
}
.cell {
  position: relative; overflow: visible; cursor: pointer;
  background: rgba(20,28,40,.012);
  border-right: 1px solid var(--field-line);
  border-bottom: 1px solid var(--field-line);
  transition: background .12s;
}
.cell:hover { background: rgba(91,126,158,.05); }
.cell.armed { background: rgba(91,126,158,.045); box-shadow: inset 0 0 0 1px rgba(91,126,158,.16); }   /* 可种植：仅极淡提示 */

/* 未开放车道：斜纹封锁，不响应交互，卡牌尺寸仍按满列布局故不变形 */
.cell.lane-off {
  cursor: not-allowed; pointer-events: none;
  background:
    repeating-linear-gradient(-45deg, rgba(20,28,40,.05) 0 8px, rgba(20,28,40,.02) 8px 16px);
  box-shadow: inset 0 0 0 1px rgba(20,28,40,.05);
}
.cell.lane-off:hover { background:
  repeating-linear-gradient(-45deg, rgba(20,28,40,.05) 0 8px, rgba(20,28,40,.02) 8px 16px); }
.cell .lane-lock {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; font-size: 20px; color: rgba(20,28,40,.28); pointer-events: none;
}
.cell .lane-lock em { font-style: normal; font-size: 10px; letter-spacing: 1px; }

.entities { position: absolute; inset: var(--head) 0 0 0; pointer-events: none; }

/* 种植模式：已选卡准备落子时，阳光不再拦截点击（否则点格子会误收阳光、种不上）；
   同时把网格层抬到实体层之上，使"可种植"高亮与植物不被僵尸/阳光视觉盖住。 */
.battlefield.planting .sun { pointer-events: none; }
.battlefield.planting .grid { z-index: 4; }

/* 僵尸：仅 emoji 角色，行走颠簸 + 投影 */
.zombie { position: absolute; display: flex; align-items: center; justify-content: center; transform: translate(-50%,-50%); }
.zombie .zbody { position: relative; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.zombie .zemoji {
  position: relative; font-size: clamp(26px, 8.5vmin, 42px); line-height: 1;
  filter: drop-shadow(0 3px 3px rgba(0,0,0,.5));
  animation: zwalk .5s steps(2) infinite;
}
.zombie .zhp { position: absolute; top: calc(50% - 30px); left: 50%; transform: translateX(-50%); width: 44px; height: 5px; background: rgba(0,0,0,.4); border-radius: 3px; overflow: hidden; z-index: 3; }
.zombie .zhpfill { display: block; height: 100%; width: 100%; background: var(--danger); }

/* 迷雾怪：隐身状态呈现为半透明雾气（血条/标签隐藏，轮廓若隐若现） */
.zombie.z-hidden { opacity: .28; filter: grayscale(.4) blur(.4px); }
.zombie.z-hidden .zhp, .zombie.z-hidden .ztag { visibility: hidden; }
.zombie.z-hidden .zemoji { animation: zwalk .5s steps(2) infinite, zfog 2.2s ease-in-out infinite; }
@keyframes zfog { 0%,100% { opacity: .55; } 50% { opacity: .95; } }

/* 僵尸头顶的书中概念标签：深色胶囊，一眼认出这是哪个认知陷阱 */
.zombie .ztag {
  position: absolute; top: -26px; left: 50%; transform: translateX(-50%);
  white-space: nowrap; font-size: 10px; font-weight: 800; letter-spacing: .3px;
  padding: 2px 8px; border-radius: 999px;
  background: rgba(20,28,40,.82); color: #fff;
  border: 1px solid rgba(255,255,255,.3);
  box-shadow: 0 2px 6px rgba(0,0,0,.3); z-index: 4; pointer-events: none;
}
/* 僵尸机制徽章（右上角纯图标，无外框） */
.zombie .zbadge {
  position: absolute; top: -24px; right: 2px; z-index: 5;
  font-size: clamp(10px, 2vmin, 14px); line-height: 1;
  pointer-events: none;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.35));
}
.zombie.boss .ztag {
  top: -34px; font-size: 13px; padding: 4px 12px;
  background: linear-gradient(135deg, #7B2D8E, #B14CC9);
  border-color: rgba(255,255,255,.5); box-shadow: 0 4px 12px rgba(123,45,142,.5);
}

/* 子弹 */
.pea {
  position: absolute; width: 16px; height: 16px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #b6ff7a, #4caf50);
  box-shadow: 0 0 4px rgba(0,0,0,.5);
}
.pea.ice { background: radial-gradient(circle at 35% 30%, #cfefff, #4fc3f7); }

/* 阳光：尺寸 +50%，金色光晕 */
.sun {
  position: absolute; width: 63px; height: 63px;
  margin-left: -31px; margin-top: -31px;
  cursor: pointer; pointer-events: auto;
  display: flex; align-items: center; justify-content: center;
}
.sun::before {
  content: ''; position: absolute; inset: -35%; border-radius: 50%;
  background: radial-gradient(circle,
    rgba(255,242,196,.95) 0%, rgba(255,216,95,.55) 42%, rgba(255,216,95,0) 72%);
}
.sun span { position: relative; font-size: 32px; transition: transform .15s;
  filter: drop-shadow(0 0 4px rgba(255,200,60,.85)); }
.sun { animation: sunBreathe 1.1s ease-in-out infinite; }
.sun:hover span { transform: scale(1.1); }
.sun.collecting { animation: none; pointer-events: none; }   /* 自动收集飞行中：关呼吸、禁点击 */

/* 底部植物卡托盘 */
.seedtray {
  display: flex; gap: 8px; padding: 10px 8px;
  background: var(--panel);
  border-top: 1px solid var(--line);
  position: relative; overflow-x: auto;
}
.seed {
  position: relative; flex: 0 0 auto; width: 64px; height: 82px;
  border-radius: 10px; cursor: pointer;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  transition: transform .12s, border-color .12s, box-shadow .12s;
}
.seed:hover { border-color: #B9C2CC; box-shadow: var(--shadow-sm); }
.seed.selected { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(86,120,101,.35); }
.seed.disabled { filter: grayscale(.6) opacity(.55); cursor: not-allowed; }
.seed .emoji { font-size: 30px; }
.seed .name { font-size: 11px; font-weight: 700; color: var(--ink); text-align: center; letter-spacing: .5px; }
.seed .cost {
  position: absolute; top: 4px; right: 6px; font-size: 12px; font-weight: 900; color: var(--accent);
}
/* 冷却遮罩：半透明银罩 + 剩余秒数 */
.seed .seed-role {
  font-size: 11px; line-height: 1; white-space: nowrap; margin-top: 1px;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.15));
}
.seed .cd {
  position: absolute; inset: 0; border-radius: 10px;
  background: rgba(44,51,59,.55); color: #fff; font-size: 20px; font-weight: 800;
  display: none; align-items: center; justify-content: center; z-index: 4;
}
.seed.cooling .cd { display: flex; }

/* 结算横幅 */
.banner {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px;
  background: rgba(244,246,249,.9); color: var(--ink); font-size: 26px; font-weight: 800; z-index: 5;
  backdrop-filter: blur(3px);
}
.banner.hidden { display: none; }

/* 暂停遮罩 */
.pause-cover {
  position: absolute; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 800; color: var(--ink); letter-spacing: 2px;
  background: rgba(244,246,249,.85); backdrop-filter: blur(3px);
}
.pause-cover.hidden { display: none; }
.banner button { margin-top: 12px; padding: 9px 20px; font-size: 16px; border: none; border-radius: 8px; background: var(--accent); color: #fff; font-weight: 700; cursor: pointer; }

/* ===== 设置菜单内的参数微调 ===== */
.settings-params { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.settings-params .tgroup { margin-bottom: 12px; }
.settings-params .tgroup h4 { font-size: 13px; color: var(--accent); margin-bottom: 6px; border-bottom: 1px solid var(--line); padding-bottom: 3px; }
.settings-params .tgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; }
.settings-params .tgrid label { display: flex; align-items: center; justify-content: space-between; gap: 6px; color: var(--ink-soft); font-size: 12px; }
.settings-params .tgrid input {
  width: 64px; background: var(--panel-soft); color: var(--ink); border: 1px solid var(--line);
  border-radius: 6px; padding: 3px 6px; font-size: 13px; text-align: right;
}
.settings-params .tactions { display: flex; gap: 8px; margin-top: 6px; }
.settings-params .tactions button { flex: 1; border: none; border-radius: 8px; padding: 9px 0; font-weight: 700; cursor: pointer; }
.settings-params .tactions .apply { background: var(--accent); color: #fff; }
.settings-params .tactions .reset { background: var(--panel-soft); color: var(--ink); border: 1px solid var(--line); }

/* 波次编辑器 */
.settings-params .waves { display: flex; flex-direction: column; gap: 4px; }
.settings-params .wrow { display: grid; grid-template-columns: 1fr 1fr 1.4fr 26px; gap: 5px; align-items: center; }
.settings-params .wrow.whead { color: var(--accent); font-size: 11px; }
.settings-params .wrow input, .settings-params .wrow select {
  width: 100%; background: var(--panel-soft); color: var(--ink); border: 1px solid var(--line);
  border-radius: 6px; padding: 4px 5px; font-size: 12px;
}
.settings-params .wrow .wdel { background: #F3E5E2; color: var(--danger); border: none; border-radius: 6px; height: 26px; cursor: pointer; }
.settings-params .wadd { margin-top: 6px; width: 100%; background: var(--panel-soft); color: var(--accent); border: 1px dashed var(--accent);
  border-radius: 8px; padding: 6px 0; font-weight: 700; cursor: pointer; }

/* ===== 选关界面 ===== */
.levelselect { flex: 1; overflow-y: auto; padding: 18px 16px 24px; }
.ls-head h1 { font-size: 20px; color: var(--ink); letter-spacing: .5px; }
.ls-head p { font-size: 13px; color: var(--ink-soft); line-height: 1.6; margin: 8px 0 16px; }
.lv-list { display: flex; flex-direction: column; gap: 10px; }
.lvcard {
  display: flex; align-items: center; gap: 12px; text-align: left;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 14px; cursor: pointer; transition: transform .12s, border-color .12s, box-shadow .12s;
}
.lvcard:hover:not(.locked) { border-color: var(--accent); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.lvcard.locked { filter: grayscale(.7) opacity(.6); cursor: not-allowed; }
.lv-emoji { font-size: 34px; width: 44px; text-align: center; flex: 0 0 auto; }
.lv-info { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.lv-info b { font-size: 15px; color: var(--ink); }
.lv-info small { font-size: 12px; color: var(--ink-soft); }
.lv-check { color: #3F9D5A; font-size: 22px; font-weight: 800; }
.lv-lock { font-size: 18px; }
.ls-reset { margin-top: 18px; width: 100%; background: transparent; color: var(--ink-soft);
  border: 1px dashed var(--line); border-radius: 10px; padding: 9px 0; font-size: 12px; cursor: pointer; }
.ls-reset:active { transform: translateY(1px); }

/* ===== 关卡剧情 / 补给站 ===== */
.intro { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 24px; text-align: center; }
.intro-emoji { font-size: 64px; filter: drop-shadow(0 4px 6px rgba(0,0,0,.25)); }
.intro h2 { font-size: 22px; color: var(--ink); }
.intro-enemy { font-size: 14px; color: var(--accent); font-weight: 700; }
.intro-key { font-size: 13px; font-weight: 800; color: var(--amber);
  background: rgba(201,148,47,.14); border: 1px dashed var(--amber); border-radius: 10px; padding: 8px 12px; max-width: 340px; }
.intro-narr { font-size: 14px; color: var(--ink-soft); line-height: 1.7; max-width: 320px; }
.intro-go { margin-top: 8px; padding: 11px 30px; border: none; border-radius: 10px;
  background: var(--accent); color: #fff; font-size: 16px; font-weight: 800; cursor: pointer; }
.intro-go:active { transform: translateY(1px); }
.intro-back { background: transparent; color: var(--ink-soft); border: none; font-size: 13px; cursor: pointer; }

/* ===== 结算按钮（覆盖默认 banner button 样式，支持主/次）===== */
.banner { gap: 14px; }
.banner .btns { display: flex; gap: 12px; }
.banner button { margin-top: 0; }
.banner button.ghost { background: var(--panel-soft); color: var(--accent); border: 1px solid var(--line); }

/* ===== BOSS 血条 ===== */
.bossbar {
  position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  width: min(86%, 360px); display: flex; align-items: center; gap: 8px;
  background: rgba(20,28,40,.55); border: 1px solid rgba(255,255,255,.25);
  border-radius: 999px; padding: 5px 12px; z-index: 6; color: #fff;
  box-shadow: 0 4px 14px rgba(0,0,0,.3); pointer-events: none;   /* 纯展示，不挡顶部格子点击 */
}
.bossbar.hidden { display: none; }
.bossbar .bossemoji { font-size: 22px; }
.bossbar .bosshp { flex: 1; height: 10px; background: rgba(0,0,0,.45); border-radius: 6px; overflow: hidden; }
.bossbar .bossfill { display: block; height: 100%; width: 100%;
  background: linear-gradient(90deg, #C05545, #E0894B); transition: width .15s; }
.bossbar.enraged { box-shadow: 0 0 0 2px #E0552E, 0 4px 14px rgba(0,0,0,.4); }
.bossbar.enraged .bossfill { background: linear-gradient(90deg, #E0552E, #F2C14E); }
.bossbar .bossname { font-size: 12px; font-weight: 800; white-space: nowrap; }

/* ===== 飞入飞出通知框（最后一波 / BOSS 登场 / 概念提示）：毛玻璃质感 ===== */
.toasts { position: absolute; inset: 0; pointer-events: none; z-index: 8; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
.toast {
  position: relative;
  transform: translateX(-110vw);
  padding: 11px 20px; border-radius: 12px; white-space: nowrap;
  font-weight: 600; font-size: 15.5px; letter-spacing: .3px; color: #fff;
  background: rgba(22,30,42,.78);
  backdrop-filter: blur(16px) saturate(1.4); -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid rgba(255,255,255,.1);
  box-shadow: 0 6px 24px rgba(0,0,0,.25);
  animation: toastSlide 2.8s cubic-bezier(.22,.61,.36,1) forwards;
}
.toast.warn { background: rgba(130,38,32,.82); border-left: 3px solid #E87060; }
.toast.boss { background: rgba(86,32,96,.82); border-left: 3px solid #C277D8; font-size: 16.5px; }

/* concept 长提示：小字换行、5秒停顿、倒计时条、hover暂停、移出关闭 */
.toast.concept {
  font-size: 13.5px; font-weight: 600; letter-spacing: 0; line-height: 1.6;
  white-space: normal; max-width: 86%; padding: 13px 18px 16px; pointer-events: auto;
  background: rgba(28,46,70,.82);
  backdrop-filter: blur(16px) saturate(1.4); -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid rgba(255,255,255,.1); border-left: 3px solid #6BA3D6;
  box-shadow: 0 6px 24px rgba(0,0,0,.25);
  animation: none; opacity: 0;
  transform: translateX(-110vw);
  transition: transform .45s cubic-bezier(.22,.61,.36,1), opacity .45s;
}
.toast.concept.show { transform: translateX(0); opacity: 1; }
.toast.concept.out  { transform: translateX(110vw); opacity: 0; }
.toast.concept .toast-bar {
  position: absolute; bottom: 0; left: 0; height: 2px; width: 100%;
  background: linear-gradient(90deg, #6BA3D6, rgba(107,163,214,.1));
  border-radius: 0 0 12px 12px;
}
.toast.concept.show .toast-bar { animation: toastBar 5s linear forwards; }
.toast.concept.paused .toast-bar { animation-play-state: paused; }
@keyframes toastBar { from { width: 100%; } to { width: 0%; } }

/* 失败复盘页（问题4：失败不是终点，是认知）*/
.defeat {
  max-width: 420px; margin: 0 auto; padding: 48px 24px 32px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
}
.defeat-emoji { font-size: 56px; filter: grayscale(.3); }
.defeat h2 { font-size: 22px; color: var(--ink); margin: 0; }
.defeat-diag {
  background: var(--panel-soft); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; font-size: 14px; line-height: 1.7; color: var(--ink-soft);
  text-align: left; width: 100%;
}
.defeat-diag b { color: var(--ink); font-weight: 700; }
.defeat-quote {
  font-size: 15px; line-height: 1.7; color: var(--accent-deep); font-style: italic;
  padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  width: 100%;
}
.defeat-hint {
  font-size: 13.5px; line-height: 1.7; color: var(--ink-soft);
  background: rgba(224,169,59,.08); border: 1px solid rgba(224,169,59,.25); border-radius: 10px;
  padding: 12px 14px; text-align: left; width: 100%;
}
.defeat-retry {
  margin-top: 8px; padding: 12px 32px; border: none; border-radius: 10px;
  background: var(--accent); color: #fff; font-size: 16px; font-weight: 800; cursor: pointer;
}
.defeat-retry:active { transform: translateY(1px); }
.defeat-back {
  padding: 10px 24px; border: 1px solid var(--line); border-radius: 10px;
  background: transparent; color: var(--ink-soft); font-size: 14px; cursor: pointer;
}

/* 战前对位卡（精简版场景详情：情境 + 敌人vs武器对位，3秒可读）*/
.scene-detail-min { max-width: 440px; margin: 0 auto; padding: 24px 20px; }
.sd-sit-min { font-size: 15px; line-height: 1.7; color: var(--ink-soft); margin: 16px 0 24px; }
.sd-versus { display: flex; align-items: stretch; gap: 10px; margin-bottom: 28px; }
.sd-vs-enemy, .sd-vs-weapon {
  flex: 1; border-radius: 14px; padding: 16px 12px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.sd-vs-enemy { background: rgba(130,38,32,.1); border: 1px solid rgba(130,38,32,.25); }
.sd-vs-weapon { background: rgba(28,46,70,.1); border: 1px solid rgba(28,46,70,.25); }
.sd-vs-lbl { font-size: 11px; font-weight: 700; opacity: .65; }
.sd-vs-emoji { font-size: 36px; }
.sd-vs-name { font-size: 15px; font-weight: 700; color: var(--ink); }
.sd-vs-tag { font-size: 12px; color: var(--ink-soft); line-height: 1.5; }
.sd-vs-arrow { display: flex; align-items: center; font-size: 22px; }

/* 深入了解本关（模态弹窗）*/
.sd-detail-btn {
  width: 100%; margin-bottom: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel-soft); color: var(--ink-soft); font-size: 13.5px; cursor: pointer;
}
.sd-detail-btn:active { transform: translateY(1px); }
.sd-full-overlay {
  position: absolute; inset: 0; z-index: 40; overflow-y: auto;
  background: rgba(0,0,0,.5);
  display: flex; justify-content: center; padding: 20px 16px;
}
.sd-full {
  width: 100%; max-width: 440px; background: var(--panel); border-radius: 16px;
  padding: 24px 20px; box-shadow: 0 18px 50px rgba(20,28,40,.4); height: fit-content; position: relative;
}
.sd-full-close {
  position: absolute; top: 14px; right: 14px; width: 32px; height: 32px;
  border: none; border-radius: 50%; background: var(--panel-soft); color: var(--ink-soft);
  font-size: 16px; cursor: pointer;
}
.sd-full-title { font-size: 18px; color: var(--ink); margin: 0 0 16px; padding-right: 40px; }

/* 首次种下后植物的"可点击"脉冲暗示 */
.plant.hintable .plant-3d { animation: hintPulse 1.8s ease-in-out infinite; }
@keyframes hintPulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.1)} }
/* 概念气泡的机制绑定语 */
.concept-bubble em { display: block; margin-top: 4px; font-size: 12px; font-style: normal; color: #6BA3D6; }
@keyframes toastSlide {
  0%   { transform: translateX(-110vw); opacity: 0; }
  12%  { transform: translateX(0);      opacity: 1; }
  88%  { transform: translateX(0);      opacity: 1; }
  100% { transform: translateX(110vw);  opacity: 0; }
}
/* BOSS 登场 / 暴怒：战场抖一记，强化"威力"观感 */
.battlefield.shake { animation: bshake .5s ease; }
@keyframes bshake {
  0%, 100% { transform: translateX(0); }
  18% { transform: translateX(-9px); }
  38% { transform: translateX(8px); }
  58% { transform: translateX(-6px); }
  78% { transform: translateX(4px); }
}
.flash.hidden { display: none; }
.flash.show { animation: flashPop 2.4s ease-out forwards; }
@keyframes flashPop {
  0% { opacity: 0; transform: scale(.85); background: rgba(20,28,40,0); }
  8% { opacity: 1; transform: scale(1); background: rgba(20,28,40,.38); }
  88% { opacity: 1; background: rgba(20,28,40,.38); }
  100% { opacity: 0; transform: scale(1.04); background: rgba(20,28,40,0); }
}

/* ===== 通关高光时刻：战场内居中的卡牌演出（非全屏）===== */
.hl-overlay {
  position: absolute; inset: 0; z-index: 30;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 20px; padding: 24px; text-align: center;
  background: rgba(20,28,40,.30); backdrop-filter: blur(2px);
}
.hl-overlay .hl-kicker { font-size: 13px; letter-spacing: 3px; color: #F4C84E; font-weight: 800;
  text-shadow: 0 1px 6px rgba(0,0,0,.5); }
.hl-overlay .hl-reveal-hint { font-size: 13px; color: #fff; opacity: .92;
  animation: hintPulse 1.4s ease-in-out infinite; text-shadow: 0 1px 6px rgba(0,0,0,.5); }

/* 阶段一：居中飞入的卡牌（卡牌尺寸，置于战场中央）*/
.hl-card {
  width: 150px; height: 198px; border-radius: 16px;
  background: linear-gradient(180deg, #FFFFFF 0%, #F1F4F7 100%);
  border: 2px solid #E0A93B; box-shadow: 0 14px 34px rgba(224,169,59,.45);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer; outline: none; user-select: none;
  animation: cardReveal 1s cubic-bezier(.2,.9,.3,1.12) both;
  transition: transform .14s ease;
}
.hl-card:active { transform: scale(.96); }
.hl-card:focus-visible { box-shadow: 0 0 0 3px rgba(224,169,59,.6), 0 14px 34px rgba(224,169,59,.45); }
.hl-card-emoji { font-size: 64px; line-height: 1; filter: drop-shadow(0 4px 8px rgba(20,28,40,.22)); }
.hl-card-name { font-size: 18px; font-weight: 800; color: var(--ink); }
.hl-card-cost { font-size: 13px; font-weight: 700; color: #C9912B; }

/* 阶段二：卡牌详解（战场中央的卡片式面板，非全屏）*/
.hl-detail {
  width: min(92%, 360px); max-height: calc(100dvh - 60px); overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 18px 50px rgba(20,28,40,.35);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 20px 18px; text-align: center; color: var(--ink);
  animation: hlPop .4s cubic-bezier(.2,.9,.3,1.2);
}
.hl-detail .hl-kicker { color: #E0A93B; text-shadow: none; }
.hl-detail .hl-emoji { font-size: 72px; filter: drop-shadow(0 6px 14px rgba(224,169,59,.5));
  animation: hlPop .6s cubic-bezier(.2,.9,.3,1.2); }
.hl-detail .hl-name { font-size: 24px; color: var(--ink); }
.hl-detail .hl-stats { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.hl-detail .hl-stats span { font-size: 12px; color: var(--ink-soft); background: var(--panel-soft);
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; }
.hl-detail .hl-block { width: 100%; text-align: left; border-radius: 12px; padding: 12px 14px; }
.hl-detail .hl-concept { background: rgba(74,124,163,.10); border: 1px solid rgba(74,124,163,.3); }
.hl-detail .hl-ability { background: rgba(224,169,59,.12); border: 1px solid rgba(224,169,59,.4); }
.hl-detail .hl-tag { font-size: 12px; font-weight: 800; margin-bottom: 6px; }
.hl-detail .hl-concept .hl-tag { color: #4A7CA3; }
.hl-detail .hl-ability .hl-tag { color: #C9912B; }
.hl-detail .hl-block p { font-size: 13.5px; line-height: 1.7; color: var(--ink-soft); margin: 0; }
.hl-detail .hl-block b { color: var(--ink); }
.hl-detail .hl-bonus { font-size: 14px; font-weight: 800; color: #C9912B;
  background: rgba(224,169,59,.15); border: 1px dashed #C9912B; border-radius: 12px; padding: 10px 14px; }
.hl-detail .hl-go { margin-top: 4px; padding: 11px 30px; border: none; border-radius: 10px;
  background: var(--accent); color: #fff; font-size: 16px; font-weight: 800; cursor: pointer; }
.hl-detail .hl-go:active { transform: translateY(1px); }

/* 本关学习总结 + 晒朋友圈（卡牌详解内，强化成就感与分享） */
.hl-detail .hl-summary { background: rgba(74,124,163,.08); border: 1px solid rgba(74,124,163,.3); }
.hl-detail .hl-summary .hl-tag { color: #4A7CA3; }
.hl-detail .hl-sum-text { font-size: 13.5px; line-height: 1.7; color: var(--ink-soft); }
.hl-detail .hl-sum-text b { color: var(--ink); }
.hl-detail .hl-sum-bridge { font-size: 13px; line-height: 1.7; color: var(--ink);
  background: var(--panel-soft); border-left: 3px solid var(--accent);
  border-radius: 0 10px 10px 0; padding: 9px 11px; margin-top: 10px; }
.hl-detail .hl-sum-bridge .hl-em { color: var(--accent-deep); font-weight: 800; }
.hl-detail .hl-sum-quote { font-size: 13px; line-height: 1.6; color: #4A7CA3; font-style: italic; margin-top: 6px; }
.hl-detail .hl-chapter-prog { font-size: 12px; font-weight: 700; color: var(--accent-deep); margin-top: 8px; }
.hl-detail .hl-share { width: 100%; margin-top: 12px; padding: 11px; border: 1px solid #4A7CA3;
  border-radius: 10px; background: var(--panel-soft); color: #4A7CA3; font-size: 14px; font-weight: 800; cursor: pointer; }
.hl-detail .hl-share:active { transform: translateY(1px); }
.hl-detail .hl-share-tip { font-size: 12px; color: var(--accent-deep); text-align: center; margin-top: 8px; }

/* 阶段一·五：主动提取锁（微问题，答对才解锁详解）*/
.hl-extract {
  width: min(92%, 360px);
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 24px 60px rgba(20,28,40,.28);
  padding: 24px 22px 20px;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  animation: hlPop .5s cubic-bezier(.2,.9,.3,1.2);
}
.hl-extract .hl-kicker {
  display: inline-block;
  font-size: 12px; letter-spacing: 1.5px; font-weight: 800;
  color: var(--accent-deep);
  background: var(--accent-soft);
  padding: 5px 12px; border-radius: 6px;
  margin-bottom: 14px;
}
.hl-extract-card { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 14px 0 18px; }
.hl-extract-emoji { font-size: 56px; filter: drop-shadow(0 4px 10px rgba(224,169,59,.4)); }
.hl-extract-name { font-size: 20px; color: var(--ink); font-weight: 800; }
.hl-extract-q {
  font-size: 16px; line-height: 1.85; color: var(--ink);
  font-weight: 600; letter-spacing: .3px;
  margin-bottom: 18px;
}
.hl-extract-opts { display: flex; flex-direction: column; gap: 10px; }
.hl-extract-opt {
  width: 100%; padding: 13px 15px;
  border: 1.5px solid var(--line); border-radius: 6px;
  background: var(--panel-soft); color: var(--ink);
  font-size: 14.5px; font-weight: 500; line-height: 1.6; letter-spacing: .2px;
  cursor: pointer; text-align: left;
  transition: border-color .15s, background .15s, transform .1s, box-shadow .15s;
}
.hl-extract-opt:hover { border-color: var(--accent); background: #fff; box-shadow: var(--shadow-sm); }
.hl-extract-opt:active { transform: translateY(1px); }
.hl-extract-opt.is-locked { pointer-events: none; opacity: .5; }
.hl-extract-opt.ok { border-color: #4CA572; background: #E6F4EA; color: #2F7A52; font-weight: 600; }
.hl-extract-opt.no { border-color: var(--danger); background: rgba(192,85,69,.12); color: #a83f33; animation: hlShake .35s; }
.hl-extract-hint {
  font-size: 14px; line-height: 1.75; margin-top: 16px;
  font-weight: 600; letter-spacing: .2px; padding: 0 2px;
}
.hl-extract-hint.ok { color: #1f7a52; }
.hl-extract-hint.no { color: #a83f33; }
.hl-extract-next {
  width: 100%; margin-top: 16px; padding: 12px 16px;
  border: none; border-radius: 6px;
  background: var(--accent); color: #fff;
  font-size: 15px; font-weight: 700; letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(63,94,120,.28);
  transition: background .15s, transform .1s, box-shadow .15s;
}
.hl-extract-next:hover { background: var(--accent-deep); box-shadow: 0 6px 16px rgba(63,94,120,.34); }
.hl-extract-next:active { transform: translateY(1px); }
@keyframes hlShake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-4px)} 75%{transform:translateX(4px)} }

@keyframes cardReveal {
  0%   { transform: translateY(45vh) scale(.25) rotate(-12deg); opacity: 0; }
  60%  { opacity: 1; }
  100% { transform: translateY(0) scale(1) rotate(0); opacity: 1; }
}
@keyframes hintPulse { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }
@keyframes hlPop { 0% { transform: scale(.4) rotate(-8deg); opacity: 0; } 100% { transform: scale(1) rotate(0); opacity: 1; } }

/* ===== 开战倒计时（PVZ 式「准备」提醒）===== */
.countdown {
  position: absolute; inset: 0; z-index: 25; pointer-events: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 96px; font-weight: 900; color: #fff;
  text-shadow: 0 4px 18px rgba(20,28,40,.6); opacity: 0;
}
.countdown.pop { animation: cdPop .8s ease-out; }
.countdown.hold { animation: cdHold .8s ease-out forwards; }
.countdown.done { animation: cdFade .42s ease-out forwards; }
@keyframes cdPop {
  0%   { transform: scale(.3); opacity: 0; }
  30%  { transform: scale(1.1); opacity: 1; }
  70%  { transform: scale(1); opacity: 1; }
  100% { transform: scale(.92); opacity: 0; }
}
@keyframes cdHold {
  0%   { transform: scale(.3); opacity: 0; }
  25%  { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes cdFade { from { opacity: 1; } to { opacity: 0; } }
