/* ============================================================
 * 烧心异种成长记 —— 深夜自习室主题
 * 黑板绿打底 + 粉笔白 + 红笔批注
 * ============================================================ */
:root {
  --bg: #0b1a15;
  --bg2: #0e241c;
  --chalk: #e9f6ee;
  --dim: rgba(233, 246, 238, .6);
  --faint: rgba(233, 246, 238, .34);
  --line: rgba(214, 240, 228, .14);
  --red: #e2564d;
  --paper: #f7f2e2;
  --ink: #26261c;
  --serif: "Songti SC", "SimSun", "Noto Serif SC", ui-serif, serif;
  /* 安全区：刘海 / 灵动岛 / 底部横条 */
  --sat: env(safe-area-inset-top, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --stick: 104px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  overscroll-behavior: none;
}

body {
  font-family: ui-sans-serif, system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--chalk);
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}

#app {
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  /* dvh 会跟随地址栏伸缩；100vh 兜底老浏览器 */
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* ============================================================
 * HUD
 * ============================================================ */
#hud {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  padding: calc(var(--sat) + 10px) calc(var(--sar) + 12px) 10px calc(var(--sal) + 12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
  z-index: 5;
}
#hud.is-on { opacity: 1; }

/* 密集怪群冲上来时 HUD 文字会被淹没，垫一层向下淡出的暗色 */
#hud::before {
  content: '';
  position: absolute;
  inset: -8px 0 -30px 0;
  background: linear-gradient(180deg, rgba(4, 14, 10, .74) 0%, rgba(4, 14, 10, .42) 55%, rgba(4, 14, 10, 0) 100%);
  pointer-events: none;
  z-index: -1;
}

#hud .top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hp {
  position: relative;
  flex: 1;
  height: 22px;
  border-radius: 3px;
  background: rgba(6, 20, 15, .78);
  border: 1px solid var(--line);
  overflow: hidden;
}
.hp-fill {
  position: absolute;
  inset: 0;
  transform-origin: left center;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .28), rgba(0, 0, 0, .22)),
    linear-gradient(90deg, #b4271f, #e04a41 55%, #ff7a70);
  box-shadow: inset 0 -6px 10px rgba(0, 0, 0, .18), 0 0 14px rgba(240, 90, 80, .45);
  transition: transform .12s linear;
}
.hp span {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: .3px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .65);
}

.clock {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--chalk);
  min-width: 54px;
  text-align: center;
  text-shadow: 0 0 12px rgba(160, 230, 200, .35);
}

.btns { display: flex; gap: 6px; }
.icon-btn {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  font-size: 13px;
  border-radius: 3px;
  border: 1px solid var(--line);
  background: rgba(6, 20, 15, .78);
  color: var(--chalk);
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
}
.icon-btn:active { transform: scale(.94); }
.icon-btn.is-off { opacity: .45; }

/* 触屏：手指目标至少 40px，30px 在手机上经常点空 */
html.is-touch .icon-btn {
  width: 40px;
  height: 40px;
  font-size: 16px;
}
html.is-touch .btns { gap: 8px; }
html.is-touch .hp { height: 26px; }
html.is-touch .hp span { font-size: 13px; }
html.is-touch .clock { font-size: 21px; }

.xp {
  height: 3px;
  margin-top: 7px;
  border-radius: 2px;
  background: rgba(6, 20, 15, .8);
  overflow: hidden;
}
.xp-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #8fe3bd, #d9f7e6);
  transition: width .16s linear;
}

.meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 5px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .4px;
  color: var(--dim);
}

/* ---------- 校园活动条：HUD 里唯一会「跳出来」的一行 ---------- */
.ev-bar {
  display: none;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  padding: 4px 9px;
  max-width: max-content;
  border-radius: 4px;
  border: 1px solid rgba(214, 240, 228, .22);
  background: rgba(4, 16, 12, .74);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .3px;
  color: var(--c, #4ade80);
}
.ev-bar.is-on { display: flex; }
.ev-bar b { font-size: 11.5px; color: var(--c, #4ade80); }
.ev-bar em {
  font-style: normal;
  color: var(--dim);
  font-weight: 700;
  max-width: 44vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ev-bar span {
  font-variant-numeric: tabular-nums;
  color: var(--c, #4ade80);
  min-width: 26px;
  text-align: right;
}
.ev-bar.win { border-color: rgba(134, 239, 172, .55); --c: #86efac; }
.ev-bar.fail { border-color: rgba(251, 113, 133, .55); --c: #fb7185; }

.mains {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}.mchip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid rgba(214, 240, 228, .12);
  background: rgba(6, 20, 15, .6);
  color: var(--dim);
}
.mchip b {
  color: var(--c, var(--chalk));
  font-size: 11.5px;
  font-weight: 800;
}

.subjects {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;}
.slot {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 7px;
  border-radius: 3px;
  border: 1px dashed rgba(214, 240, 228, .22);
  background: rgba(6, 20, 15, .45);
  font-size: 11px;
  color: var(--faint);
}
.slot em { font-style: normal; }
.slot.on {
  border-style: solid;
  border-color: color-mix(in srgb, var(--c) 55%, transparent);
  background: rgba(6, 20, 15, .8);
  color: var(--chalk);
}
.slot.on em { color: var(--c, var(--chalk)); font-weight: 700; }
.slot.on b { font-size: 10.5px; color: var(--dim); }
.lock {
  align-self: center;
  font-size: 10px;
  letter-spacing: .6px;
  color: rgba(226, 86, 77, .85);
  border: 1px solid rgba(226, 86, 77, .35);
  border-radius: 3px;
  padding: 2px 5px;
}

/* 已获得的教辅：和选科挤一行，只显示图标和层数 */
.bk {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  height: 24px;
  padding: 0 5px;
  border-radius: 3px;
  border: 1px solid color-mix(in srgb, var(--c) 45%, transparent);
  background: rgba(6, 20, 15, .8);
  font-size: 11px;
  line-height: 1;
}
.bk b {
  font-size: 9.5px;
  font-weight: 800;
  color: var(--c, var(--chalk));
}

/* ============================================================
 * 难度选择（首页）
 * ============================================================ */
.diffs {
  display: flex;
  gap: 8px;
  margin: 20px auto 0;
  max-width: 340px;
}
.diff {
  flex: 1;
  min-width: 0;
  padding: 9px 4px 8px;
  border-radius: 3px;
  border: 1px solid var(--line);
  background: rgba(6, 20, 15, .55);
  color: var(--dim);
  cursor: pointer;
  transition: border-color .14s ease, background .14s ease, transform .08s ease;
  touch-action: manipulation;
}
.diff b {
  display: block;
  font-family: var(--serif);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .04em;
  color: var(--chalk);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.diff em {
  display: block;
  margin-top: 3px;
  font-style: normal;
  font-size: 10px;
  letter-spacing: .12em;
  color: var(--faint);
}
.diff:active { transform: scale(.97); }
.diff.is-on {
  border-color: rgba(143, 227, 189, .6);
  background: rgba(143, 227, 189, .13);
  box-shadow: inset 0 0 0 1px rgba(143, 227, 189, .16);
}
.diff.is-on em { color: #a9f0cd; }

.diff-desc {
  margin: 9px 0 0;
  font-size: 11px;
  line-height: 1.55;
  color: var(--faint);
  min-height: 17px;
}

/* 地图选择：五张卡（随机 + 四张图），比难度那排更窄一些 */
.maps {
  max-width: 430px;
  margin: 18px auto 0;
  gap: 6px;
}
.maps .diff {
  padding: 8px 2px 7px;
  border-radius: 4px;
}
.maps .diff b {
  font-size: 12px;
  letter-spacing: 0;
}
.maps .diff em {
  font-size: 9px;
  letter-spacing: .04em;
}
.maps .diff[data-m="night"].is-on {
  border-color: rgba(129, 140, 248, .65);
  background: rgba(129, 140, 248, .16);
}
.maps .diff[data-m="autumn"].is-on {
  border-color: rgba(251, 191, 36, .6);
  background: rgba(251, 191, 36, .14);
}
.maps .diff[data-m="snow"].is-on {
  border-color: rgba(147, 197, 253, .6);
  background: rgba(147, 197, 253, .14);
}

/* ============================================================
 * 提示条
 * ============================================================ */
.toast {
  position: absolute;
  left: 50%;
  top: 21%;
  transform: translate(-50%, -8px);
  padding: 7px 14px;
  border-radius: 3px;
  background: rgba(6, 20, 15, .92);
  border: 1px solid var(--line);
  border-left: 3px solid var(--red);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 6;
  white-space: nowrap;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* 窄屏 HUD 会多折两三行，21% 正好压住活动条 —— 往下让一让 */
@media (max-width: 560px) {
  .toast { top: max(30%, calc(var(--sat) + 140px)); }
}

/* ============================================================
 * 摇杆
 * ============================================================ */
.stick {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--stick);
  height: var(--stick);
  margin: calc(var(--stick) / -2) 0 0 calc(var(--stick) / -2);
  border-radius: 50%;
  border: 1px solid rgba(214, 240, 228, .22);
  background: radial-gradient(circle, rgba(20, 60, 48, .18), rgba(10, 30, 24, .34));
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease;
  z-index: 4;
  will-change: transform, opacity;
}
.stick.is-on { opacity: 1; }
/* 手指正下方留一块透明观察窗，别把主角和贴身的怪全挡住 */
.stick::after {
  content: '';
  position: absolute;
  inset: 18%;
  border-radius: 50%;
  border: 1px dashed rgba(214, 240, 228, .14);
}
.knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(var(--stick) * .4);
  height: calc(var(--stick) * .4);
  margin: calc(var(--stick) * -.2) 0 0 calc(var(--stick) * -.2);
  border-radius: 50%;
  background: rgba(233, 246, 238, .82);
  box-shadow: 0 0 18px rgba(190, 255, 225, .35);
  will-change: transform;
}

/* ============================================================
 * 通用界面
 * ============================================================ */
.screen {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  /* 横屏 / 小屏时内容会超过视口，必须能滚，不能裁掉「进考场」按钮 */
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  /* body 上是 touch-action:none，弹窗自己要能纵向滚（小屏/横屏会超长） */
  touch-action: pan-y;
  padding: calc(var(--sat) + 18px) calc(var(--sar) + 16px) calc(var(--sab) + 18px) calc(var(--sal) + 16px);
  z-index: 8;
}
.screen.is-on { display: flex; }
/* flex 居中 + 溢出时顶部会被裁掉，margin:auto 的写法可正确滚动 */
.screen > * { margin: auto; }

#home {
  background:
    radial-gradient(58% 46% at 50% 34%, rgba(5, 14, 11, .78), rgba(5, 14, 11, .34) 72%, rgba(5, 14, 11, 0) 100%),
    linear-gradient(180deg, rgba(6, 16, 13, .58) 0%, rgba(6, 16, 13, .4) 40%, rgba(5, 14, 11, .85) 70%, rgba(4, 9, 7, .97) 100%),
    url("assets/tex/home-room.jpg") center 46% / cover no-repeat,
    #071310;
}

.modal.is-on {
  background: rgba(4, 12, 9, .8);
  backdrop-filter: blur(6px);
}

.home-inner,
.modal-inner {
  width: 100%;
  max-width: 460px;
  text-align: center;
}

.modal-inner.narrow { max-width: 400px; }

.eyebrow {
  margin: 0 0 10px;
  font-size: 11px;
  letter-spacing: .32em;
  color: var(--faint);
  text-transform: uppercase;
}

.logo {
  margin: 0;
  font-family: var(--serif);
  /* 六字标题（烧心异种成长记）不能换行，字号按宽度收一点 */
  font-size: clamp(30px, 10.4vw, 54px);
  font-weight: 900;
  letter-spacing: .04em;
  line-height: 1.06;
  white-space: nowrap;
  color: var(--chalk);
  text-shadow: 0 0 26px rgba(160, 230, 200, .28), 0 2px 0 rgba(0, 0, 0, .45);
}
.logo span { color: #8fe3bd; }

.tagline {
  margin: 12px 0 0;
  font-size: 13px;
  line-height: 1.7;
  color: var(--dim);
}

.howto {
  margin: 22px auto 0;
  max-width: 320px;
  display: grid;
  gap: 7px;
}
.howto .row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  color: var(--dim);
}
.howto em { font-style: normal; margin-left: 4px; color: var(--faint); }
kbd {
  display: inline-block;
  min-width: 24px;
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  background: rgba(10, 30, 24, .8);
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  color: var(--chalk);
}
.badge {
  padding: 2px 7px;
  border-radius: 3px;
  background: rgba(226, 86, 77, .16);
  border: 1px solid rgba(226, 86, 77, .4);
  color: #f3a49e;
  font-size: 10.5px;
  font-weight: 700;
}

.btn-primary {
  width: 100%;
  max-width: 300px;
  margin: 24px auto 0;
  display: block;
  padding: 14px 24px;
  border: 0;
  border-radius: 4px;
  background-color: var(--chalk);
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, .9), rgba(226, 236, 228, .06) 46%, rgba(0, 0, 0, .07)),
    url("assets/tex/paper.jpg");
  background-size: auto, 300px 300px;
  background-blend-mode: normal, multiply;
  color: #0a1c15;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 900;
  letter-spacing: .2em;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .75),
    inset 0 -1px 0 rgba(0, 0, 0, .18),
    0 5px 0 rgba(0, 0, 0, .38),
    0 14px 30px rgba(140, 230, 195, .16);
  transition: transform .08s ease, box-shadow .08s ease;
}
.btn-primary:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, .35);
}

.btn-ghost {
  width: 100%;
  max-width: 300px;
  margin: 10px auto 0;
  display: block;
  padding: 11px 20px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--dim);
  font-size: 13px;
  cursor: pointer;
}
.btn-ghost:active { background: rgba(233, 246, 238, .06); }

.footnote {
  margin: 16px 0 0;
  font-size: 11px;
  line-height: 1.7;
  color: var(--faint);
}
.footnote.dim { margin-top: 6px; opacity: .72; }

/* ============================================================
 * 升级：三张小试卷
 * ============================================================ */
.lv-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 16px;
}
.lv-badge {
  padding: 3px 9px;
  border-radius: 3px;
  border: 1px solid rgba(226, 86, 77, .45);
  background: rgba(226, 86, 77, .14);
  font-size: 12px;
  font-weight: 700;
  color: #f3a49e;
}
.lv-badge b { font-size: 13px; }
.lv-head h2,
.modal-inner > h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 900;
  letter-spacing: .1em;
  color: var(--chalk);
}

.cards {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 11px;
  width: 100%;
  padding: 12px 14px 12px 17px;
  text-align: left;
  border: 1px solid rgba(120, 90, 60, .28);
  border-radius: 3px;
  background-color: var(--paper);
  background-image:
    repeating-linear-gradient(180deg, transparent 0 21px, rgba(120, 150, 200, .16) 21px 22px),
    url("assets/tex/paper.jpg");
  background-size: auto, 260px 260px;
  background-blend-mode: normal, multiply;
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(0, 0, 0, .3), 0 10px 20px rgba(0, 0, 0, .3);
  transition: transform .08s ease, box-shadow .08s ease;
  overflow: hidden;
}
.card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--c, var(--red));
}
.card:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, .3);
}

.card .ico {
  flex: none;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  font-size: 19px;
  border-radius: 2px;
  background: rgba(0, 0, 0, .05);
  border: 1px solid rgba(0, 0, 0, .08);
}
.card .body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.card .name {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-family: var(--serif);
  font-size: 15.5px;
  font-weight: 900;
  letter-spacing: .04em;
  color: #1f1f16;
}
.card .desc {
  font-size: 11.5px;
  line-height: 1.55;
  color: #5c5b4a;
}
.card .pips {
  display: flex;
  gap: 3px;
  margin-top: 3px;
}
.card .pips i {
  width: 14px;
  height: 3px;
  border-radius: 2px;
  background: rgba(0, 0, 0, .13);
}
.card .pips i.on { background: var(--c, var(--red)); }
.card .key {
  position: absolute;
  right: 8px;
  bottom: 6px;
  font-size: 10px;
  font-weight: 800;
  color: rgba(38, 38, 28, .3);
}
.card .tag {
  padding: 1px 5px;
  border-radius: 2px;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: .02em;
}
.card .tag.new {
  background: rgba(226, 86, 77, .14);
  border: 1px solid rgba(226, 86, 77, .4);
  color: #b03a33;
}
.card .tag.up {
  background: rgba(40, 80, 60, .1);
  border: 1px solid rgba(40, 80, 60, .28);
  color: #3c5c47;
}
.card .tag.heal {
  background: rgba(134, 239, 172, .22);
  border: 1px solid rgba(22, 101, 52, .34);
  color: #15803d;
}

.hint {
  margin: 14px 0 0;
  font-size: 11px;
  color: var(--faint);
  letter-spacing: .04em;
}

/* ============================================================
 * 暂停 / 结算
 * ============================================================ */
.pause-stats {
  display: grid;
  gap: 8px;
  margin: 18px 0 4px;
  font-size: 12px;
  color: var(--dim);
}
.pause-stats div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 7px;
  border-bottom: 1px dashed rgba(214, 240, 228, .12);
}
.pause-stats b {
  font-family: var(--serif);
  font-size: 19px;
  color: var(--chalk);
}
.pause-stats b.sm { font-size: 14px; }

.over-tag {
  display: inline-block;
  margin-bottom: 10px;
  padding: 3px 10px;
  border-radius: 3px;
  border: 1px solid rgba(226, 86, 77, .5);
  background: rgba(226, 86, 77, .13);
  font-size: 11px;
  letter-spacing: .1em;
  color: #f3a49e;
}
.over-tag.win {
  border-color: rgba(143, 227, 189, .5);
  background: rgba(143, 227, 189, .12);
  color: #a9f0cd;
}

.over-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 20px 0 4px;
}
.over-grid div {
  padding: 10px 8px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: rgba(10, 30, 24, .55);
}
.over-grid div.wide { grid-column: span 2; }
.over-grid b {
  display: block;
  font-family: var(--serif);
  font-size: 19px;
  color: var(--chalk);
}
.over-grid span {
  display: block;
  margin-top: 2px;
  font-size: 10.5px;
  color: var(--faint);
  letter-spacing: .1em;
}

/* ============================================================
 * 移动端适配
 * ============================================================ */

/* 触屏才显示的提示行 */
@media (hover: hover) and (pointer: fine) {
  .touch-only { display: none; }
}

/* 触屏设备没有键盘，键盘提示别占地方 */
html.is-touch .key-only { display: none; }
html.is-touch .howto { margin-top: 18px; }
html.is-touch .card .key { display: none; }

/* 触屏卡片：加大点击高度，手指更好按 */
html.is-touch .card {
  padding-top: 14px;
  padding-bottom: 14px;
}
html.is-touch .card .name { font-size: 16px; }
html.is-touch .card .desc { font-size: 12.5px; line-height: 1.6; }
html.is-touch .card .ico { width: 38px; height: 38px; font-size: 21px; }
html.is-touch .cards { gap: 9px; }
html.is-touch .hint { font-size: 11.5px; }

/* 手机横屏 / 矮视口：整套排版压扁，保证三张卡 + 按钮都进屏 */
@media (max-height: 520px) {
  .screen { padding-top: calc(var(--sat) + 12px); padding-bottom: calc(var(--sab) + 12px); }
  .logo { font-size: clamp(28px, 6vh, 38px); }
  .eyebrow { margin-bottom: 6px; font-size: 10px; }
  .tagline { margin-top: 6px; font-size: 12px; line-height: 1.5; }
  .howto { margin-top: 10px; gap: 4px; }
  .howto .row { font-size: 11px; }
  .btn-primary { margin-top: 14px; padding: 11px 20px; font-size: 15px; }
  .btn-ghost { margin-top: 7px; padding: 9px 16px; }
  .footnote { margin-top: 9px; font-size: 10px; line-height: 1.5; }
  .footnote.dim { margin-top: 3px; }
  .diffs { margin-top: 10px; gap: 6px; }
  .diff { padding: 6px 3px 5px; }
  .diff b { font-size: 11px; }
  .diff em { font-size: 9px; margin-top: 1px; }
  .diff-desc { margin-top: 5px; font-size: 10px; min-height: 14px; }
  .lv-head { margin-bottom: 10px; }
  .lv-head h2, .modal-inner > h2 { font-size: 18px; }
  .card { padding-top: 9px; padding-bottom: 9px; }
  .card .ico { width: 28px; height: 28px; font-size: 16px; }
  .card .desc { font-size: 11px; line-height: 1.45; }
  .hint { margin-top: 9px; }
  .over-grid { margin-top: 12px; }
  .pause-stats { margin-top: 12px; gap: 5px; }
  .pause-stats b { font-size: 16px; }
}

/* 手机横屏：竖向只有 390 左右，HUD 必须瘦下来给战场让位 */
@media (max-height: 520px) and (orientation: landscape) {
  #hud { padding-top: calc(var(--sat) + 6px); }
  html.is-touch .icon-btn { width: 32px; height: 32px; font-size: 14px; }
  html.is-touch .btns { gap: 5px; }
  html.is-touch .hp { height: 19px; }
  html.is-touch .hp span { font-size: 10.5px; }
  html.is-touch .clock { font-size: 16px; min-width: 46px; }
  .xp { margin-top: 4px; }
  .meta { margin-top: 3px; font-size: 10px; }
  .mains { margin-top: 3px; gap: 4px; }
  .mchip { font-size: 10px; padding: 1px 5px; gap: 2px; }
  .mchip b { font-size: 10px; }
  .subjects { margin-top: 3px; gap: 4px; }
  .slot { height: 19px; padding: 0 5px; font-size: 10px; }
  .slot.on b { font-size: 9.5px; }
  .lock { font-size: 9px; padding: 1px 4px; }
  .bk { height: 19px; padding: 0 4px; font-size: 10px; }
}

/* 超窄屏（iPhone SE 一代 / 小屏安卓横置前） */
@media (max-width: 350px) {
  .logo { font-size: clamp(30px, 11.5vw, 44px); }
  .tagline { font-size: 12px; }
  .mchip { padding: 2px 5px; font-size: 10px; }
  .slot { padding: 0 5px; font-size: 10px; }
}

/* ============================================================
 * 图鉴（主界面入口）
 * ============================================================ */
.home-links {
  margin: 10px auto 0;
  max-width: 360px;
  display: flex;
  gap: 6px;
}
.link-btn {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
  padding: 9px 6px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: rgba(10, 30, 24, .72);
  color: var(--dim);
  font-family: var(--serif);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .06em;
  cursor: pointer;
  touch-action: manipulation;
}
.link-btn span { font-size: 13px; }
.link-btn:active { background: rgba(233, 246, 238, .08); color: var(--chalk); }

#codex {
  background:
    radial-gradient(80% 60% at 50% 0%, rgba(126, 206, 170, .10), transparent 70%),
    linear-gradient(180deg, #0a1913, #06110d);
  z-index: 12;
}

.codex-inner {
  width: 100%;
  max-width: 900px;
  height: auto;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.codex-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.codex-title .eyebrow { margin: 0 0 3px; font-size: 10px; }
.codex-title h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 20px;
  letter-spacing: .12em;
}

.codex-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.ctab {
  flex: 1 1 auto;
  min-width: 44px;
  padding: 8px 4px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: rgba(9, 26, 20, .6);
  color: var(--faint);
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: .08em;
  cursor: pointer;
  touch-action: manipulation;
}
.ctab.is-on {
  color: #0a1c15;
  background: var(--chalk);
  border-color: var(--chalk);
}

.codex-body {
  flex: 0 1 auto;
  min-height: 0;
  display: grid;
  gap: 9px;
  grid-template-areas: "stage" "side" "list";
  grid-template-rows: auto auto minmax(74px, 1fr);
}

.codex-stage {
  grid-area: stage;
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 34dvh;
  border-radius: 6px;
  border: 1px solid var(--line);
  overflow: hidden;
  background: #08150f;
  margin: 0 auto;
}
#codexCvs { display: block; width: 100%; height: 100%; }

.codex-cap {
  position: absolute;
  left: 9px;
  bottom: 7px;
  display: flex;
  align-items: baseline;
  gap: 7px;
  pointer-events: none;
  text-shadow: 0 1px 4px rgba(0, 0, 0, .7);
}
.codex-cap b {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 900;
  letter-spacing: .06em;
  color: var(--chalk);
}
.codex-cap span {
  padding: 1px 6px;
  border-radius: 3px;
  border: 1px solid var(--faint);
  font-size: 10px;
  font-weight: 700;
  color: var(--chalk);
}

.codex-side { grid-area: side; text-align: left; min-width: 0; }
.codex-desc {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--dim);
}
.codex-stats {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.codex-stats span {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 3px 7px;
  border-radius: 3px;
  border: 1px solid var(--line);
  background: rgba(10, 30, 24, .7);
  font-size: 11.5px;
  color: var(--chalk);
}
.codex-stats b { font-size: 10px; font-weight: 700; color: var(--faint); }
.codex-tip {
  margin: 8px 0 0;
  font-size: 11.5px;
  line-height: 1.6;
  color: #a9f0cd;
}
.codex-tip:empty { display: none; }

.codex-list {
  grid-area: list;
  min-height: 0;
  max-height: 34dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  align-content: start;
  padding-right: 2px;
}
.codex-item {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 8px 9px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: rgba(9, 26, 20, .72);
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  touch-action: manipulation;
}
.codex-item i {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 2px;
  opacity: .9;
}
.codex-item b {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  font-weight: 800;
  color: var(--chalk);
}
.codex-item em {
  margin-left: auto;
  font-style: normal;
  font-size: 10px;
  color: var(--faint);
  white-space: nowrap;
}
.codex-item.is-on {
  border-color: rgba(143, 227, 189, .6);
  background: rgba(143, 227, 189, .13);
}
.codex-item.is-on em { color: #a9f0cd; }

/* 宽屏：左边一列列表，右边大图 + 说明 */
@media (min-width: 720px) {
  .codex-inner { max-width: 820px; }
  .codex-tabs { max-width: 360px; }
  .codex-body {
    grid-template-areas: "list stage" "list side";
    grid-template-columns: 198px minmax(0, 1fr);
    grid-template-rows: auto auto;
  }
  .codex-list { grid-template-columns: 1fr; max-height: none; }
  .codex-stage {
    aspect-ratio: 16 / 9;
    max-height: none;
    min-height: 0;
  }
  .codex-desc { font-size: 13px; }
}

/* 手机横屏：竖直空间只有 390，演示区必须让位 */
@media (max-height: 560px) {
  .codex-inner { gap: 7px; }
  .codex-title .eyebrow { display: none; }
  .codex-title h2 { font-size: 16px; }
  .ctab { padding: 5px 4px; font-size: 11.5px; }
  .codex-body { gap: 7px; }
  .codex-stage { max-height: 42dvh; }
  .codex-desc {
    font-size: 11px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .codex-tip { font-size: 10.5px; margin-top: 5px; }
  .codex-stats { margin-top: 5px; }
  .codex-stats span { padding: 2px 6px; font-size: 11px; }
}

/* 横屏 + 宽屏：列表 / 演示 / 说明 排成三列，竖直方向才有空间放说明 */
@media (max-height: 560px) and (min-width: 720px) {
  .codex-body {
    grid-template-areas: "list stage side";
    grid-template-columns: 178px minmax(0, 1fr) 208px;
    grid-template-rows: minmax(0, 1fr);
  }
  .codex-stage {
    aspect-ratio: auto;
    height: 100%;
    max-height: none;
  }
  .codex-side {
    align-self: start;
    max-height: 100%;
    overflow-y: auto;
  }
  .codex-desc { display: block; -webkit-line-clamp: unset; }
}

/* ============================================================
 * 角色：首页卡片 / 角色图鉴里的选择器
 * ============================================================ */
.hero-card {
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: 340px;
  margin: 12px auto 0;
  padding: 8px 9px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: rgba(8, 24, 18, .62);
  text-align: left;
  cursor: pointer;
}
.hero-face {
  flex: none;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  background: rgba(143, 227, 189, .12);
  border: 1px solid rgba(143, 227, 189, .22);
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
}
.hero-txt { min-width: 0; flex: 1; }
.hero-txt b {
  display: block;
  font-family: var(--serif);
  font-size: 13.5px;
  font-weight: 900;
  letter-spacing: .05em;
  color: var(--chalk);
}
.hero-txt em {
  display: block;
  margin-top: 2px;
  font-style: normal;
  font-size: 10.5px;
  line-height: 1.4;
  color: var(--faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hero-btn {
  flex: none;
  padding: 5px 9px;
  border-radius: 3px;
  border: 1px solid rgba(143, 227, 189, .34);
  background: rgba(143, 227, 189, .1);
  color: #a9f0cd;
  font-family: var(--serif);
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: .08em;
  cursor: pointer;
  touch-action: manipulation;
}
.hero-btn:active { background: rgba(143, 227, 189, .22); }

/* 图鉴里只在「角色」页出现 */
.hero-actions { display: none; margin-top: 9px; }
.hero-actions.is-on { display: block; }

.hero-pick {
  width: 100%;
  padding: 9px 10px;
  border-radius: 4px;
  border: 1px solid rgba(143, 227, 189, .55);
  background: rgba(143, 227, 189, .16);
  color: var(--chalk);
  font-family: var(--serif);
  font-size: 12.5px;
  font-weight: 900;
  letter-spacing: .1em;
  cursor: pointer;
  touch-action: manipulation;
}
.hero-pick:active { background: rgba(143, 227, 189, .3); }
.hero-pick.is-on {
  border-color: rgba(143, 227, 189, .3);
  background: rgba(143, 227, 189, .07);
  color: #a9f0cd;
}
.hero-pick:disabled {
  opacity: .45;
  border-style: dashed;
  cursor: not-allowed;
}

.hero-pre {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}
.hero-pre:empty { display: none; }
.hero-pre::before {
  content: '预选一门（开局白送 1 级，占一个选修位）';
  flex: 1 0 100%;
  font-size: 10.5px;
  color: var(--faint);
  letter-spacing: .04em;
}
.hero-pre .chip {
  flex: 1 1 auto;
  min-width: 0;
  padding: 5px 7px;
  border-radius: 3px;
  border: 1px solid var(--line);
  background: rgba(9, 26, 20, .7);
  color: var(--dim);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  white-space: nowrap;
}
.hero-pre .chip.is-on {
  color: #0a1c15;
  background: var(--c, var(--chalk));
  border-color: var(--c, var(--chalk));
}

/* 结算里「新角色解锁」那一行 */
.over-grid div.unlock {
  border-color: rgba(196, 181, 253, .55);
  background: rgba(196, 181, 253, .13);
}
.over-grid div.unlock b { color: #c4b5fd; }

/* 矮屏（横屏手机 / 小笔记本）：首页元素太多，角色卡压扁 */
@media (max-height: 560px) {
  .hero-card { margin-top: 8px; padding: 6px 8px; }
  .hero-face { width: 26px; height: 26px; font-size: 14px; }
  .hero-txt b { font-size: 12px; }
  .hero-txt em { font-size: 9.5px; }
  .hero-btn { padding: 4px 7px; font-size: 10.5px; }
  .hero-actions { margin-top: 6px; }
  .hero-pick { padding: 7px 8px; font-size: 11.5px; }
  .hero-pre .chip { padding: 4px 6px; font-size: 10px; }
  .hero-pre::before { font-size: 9.5px; }
}

/* 小竖屏（320×568 这类）：整页内容比视口高，
 * 之前 grid 行会被压缩，说明文字被演示画面盖住。
 * 这里让面板回到自适应高度，交给 .screen 自己滚。 */
@media (max-height: 700px) and (orientation: portrait) {
  .codex-inner { height: auto; max-height: none; }
  .codex-body { flex: none; grid-template-rows: auto auto auto; }
  .codex-stage { max-height: 28dvh; }
  .codex-list { max-height: 30dvh; }
}

/* ============================================================
 * 小地图（右上角）
 * ============================================================ */
.mini {
  position: absolute;
  top: calc(var(--sat) + 46px);
  right: calc(var(--sar) + 10px);
  width: 94px;
  height: 69px;            /* 和地图 3000×2200 同比例，画面不浪费 */
  border-radius: 9px;
  background: rgba(6, 20, 16, .82);
  border: 1px solid rgba(214, 240, 228, .26);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .34);
  z-index: 2;
  pointer-events: none;
}

/* 主科 / 选修 / 活动条给右边的小地图让位 */
#hud .meta,
#hud .mains,
#hud .subjects { padding-right: 104px; }

@media (min-width: 900px) {
  .mini { width: 132px; height: 97px; top: calc(var(--sat) + 50px); }
  #hud .meta, #hud .mains, #hud .subjects { padding-right: 146px; }
}

@media (max-width: 360px) {
  .mini { width: 78px; height: 57px; top: calc(var(--sat) + 42px); }
  #hud .meta, #hud .mains, #hud .subjects { padding-right: 86px; }
}

/* ============================================================
 * 换科目（马玉亮）
 * ============================================================ */
.swap-inner { max-width: 560px; }
.swap-hint {
  margin: 0 0 10px;
  font-size: 12.5px;
  color: var(--dim);
  text-align: center;
}
.swap-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.swap-col h3 {
  margin: 0 0 6px;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: .12em;
  color: var(--faint);
  text-align: center;
}
.swap-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.swap-item {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 6px;
  border: 1px solid rgba(214, 240, 228, .16);
  background: rgba(8, 26, 20, .8);
  color: var(--chalk);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .16s, background .16s, transform .12s;
}
.swap-item .si { font-size: 15px; text-align: center; }
.swap-item b { font-size: 13px; font-weight: 800; color: var(--c, var(--chalk)); }
.swap-item em { font-style: normal; font-size: 11px; color: var(--dim); }
.swap-item:hover { border-color: rgba(214, 240, 228, .34); transform: translateY(-1px); }
.swap-item.is-on {
  border-color: var(--c, var(--chalk));
  background: rgba(126, 206, 170, .14);
  box-shadow: inset 0 0 0 1px rgba(126, 206, 170, .28);
}
.swap-empty {
  margin: 0;
  padding: 12px 6px;
  font-size: 12px;
  color: var(--faint);
  text-align: center;
}
@media (max-width: 400px) {
  .swap-item { grid-template-columns: 22px 1fr auto; padding: 6px 7px; gap: 6px; }
  .swap-item b { font-size: 12px; }
  .swap-item em { font-size: 10px; }
}

/* ================= 金币 / 状态（HUD meta 里） ================= */
#hud .meta .coin {
  color: #fbbf24;
  font-weight: 800;
  white-space: nowrap;
}
#hud .meta .buff {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 0;
}
#hud .meta .bf {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: .04em;
  padding: 1px 5px;
  border-radius: 3px;
  white-space: nowrap;
}
#hud .meta .bf.mij {
  color: #451a03;
  background: #fbbf24;
}
#hud .meta .bf.slow {
  color: #1f0a16;
  background: #f9a8d4;
}
#hud .meta .bf.hand {
  color: #0b1a15;
  background: #bef264;
}
#hud .meta .bf.conf {
  color: #1e1b4b;
  background: #c4b5fd;
}
#hud .meta .bf.bawan {
  color: #450a0a;
  background: #fb7185;
}
#hud .meta .bf.p2 {
  color: #0b1a15;
  background: #cbd5e1;
}
#hud .meta .bf.cos {
  color: #500724;
  background: #f9a8d4;
}
#hud .meta .bf.wet {
  color: #082f49;
  background: #7dd3fc;
}

/* ================= 学友超市 ================= */
.shop-inner { max-width: 520px; }
.shop-wallet {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--dim);
  text-align: center;
}
.shop-wallet b {
  font-size: 15px;
  color: #fbbf24;
  font-weight: 900;
}
.shop-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 9px;
  max-height: 54vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 2px;
  margin-bottom: 12px;
}
.shop-card .cost {
  display: block;
  margin-top: 5px;
  font-size: 12px;
  font-weight: 800;
  color: #b45309;
  letter-spacing: .04em;
}
.shop-card.is-poor { opacity: .52; }
.shop-card.is-poor .cost { color: #b91c1c; }
.shop-card.is-free {
  border-color: rgba(252, 211, 77, .75);
  background: linear-gradient(180deg, rgba(252, 211, 77, .14), rgba(252, 211, 77, .04));
}
.shop-card.is-free .cost {
  color: #f59e0b;
  font-weight: 900;
}
.shop-card.is-max {
  opacity: .38;
  cursor: default;
}
.shop-card:disabled { pointer-events: none; }
.shop-empty {
  margin: 0;
  padding: 26px 8px;
  font-size: 13px;
  color: var(--faint);
  text-align: center;
}

@media (min-width: 560px) {
  .shop-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-height: 560px) {
  .shop-grid { max-height: 46vh; }
}

/* ============================================================
 * 开发者模式（工号 114514 解锁）
 * ============================================================ */
.dev-open {
  margin: 14px auto 0;
  display: block;
  padding: 7px 16px;
  border-radius: 4px;
  border: 1px dashed rgba(125, 211, 252, .42);
  background: rgba(8, 24, 34, .6);
  color: #7dd3fc;
  font-family: var(--serif);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  cursor: pointer;
  touch-action: manipulation;
}
.dev-open[hidden] { display: none; }
.dev-open:active { background: rgba(125, 211, 252, .14); }

.dev-gate-inner .dev-hint { margin-bottom: 10px; }
.dev-code {
  width: 100%;
  margin: 0 0 6px;
  padding: 12px 14px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: rgba(10, 30, 24, .88);
  color: var(--chalk);
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 22px;
  letter-spacing: .34em;
  text-align: center;
  outline: none;
  -webkit-user-select: text;
  user-select: text;
}
.dev-code:focus { border-color: rgba(125, 211, 252, .6); }
.dev-code::placeholder {
  font-size: 13px;
  letter-spacing: .1em;
  color: var(--faint);
}
.dev-err {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--red);
  opacity: 0;
  transition: opacity .16s;
}
.dev-err.is-on { opacity: 1; }
.dev-gate-inner.is-shake { animation: devShake .26s; }
@keyframes devShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-7px); }
  75% { transform: translateX(7px); }
}

.dev-inner { max-width: 520px; }
.dev-hint {
  margin: 0 0 12px;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--faint);
}
.dev-body {
  max-height: 74vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  text-align: left;
  padding-right: 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(125, 211, 252, .34) transparent;
}
.dev-body::-webkit-scrollbar { width: 6px; }
.dev-body::-webkit-scrollbar-track { background: transparent; }
.dev-body::-webkit-scrollbar-thumb {
  border-radius: 3px;
  background: rgba(125, 211, 252, .3);
}
.dev-body::-webkit-scrollbar-thumb:hover { background: rgba(125, 211, 252, .5); }
.dev-body > .dev-group:last-child { margin-bottom: 4px; }
.dev-group {
  margin: 0 0 9px;
  padding: 9px 11px 3px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(6, 20, 16, .5);
}
.dev-group > h3 {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .18em;
  color: var(--dim);
}
.dev-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 2px 8px;
  margin-bottom: 3px;
}
.dev-row > label {
  font-size: 12px;
  color: var(--dim);
}
.dev-row > label b {
  color: #7dd3fc;
  font-family: ui-monospace, monospace;
  font-size: 12px;
}
.dev-row > input[type="range"] {
  grid-column: 1 / -1;
  width: 100%;
  height: 20px;
  margin: 0;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
}
.dev-row > input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 3px;
  background: rgba(125, 211, 252, .22);
}
.dev-row > input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -6px;
  border-radius: 50%;
  background: #7dd3fc;
  border: 1px solid rgba(4, 14, 10, .6);
}
.dev-row > input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 3px;
  background: rgba(125, 211, 252, .22);
}
.dev-row > input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 1px solid rgba(4, 14, 10, .6);
  border-radius: 50%;
  background: #7dd3fc;
}
.dev-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 2px;
}
.dev-quick button {
  flex: 1 1 46%;
  padding: 6px 8px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: rgba(10, 30, 24, .7);
  color: var(--dim);
  font-family: var(--serif);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
}
.dev-quick button:active { background: rgba(233, 246, 238, .1); color: var(--chalk); }
.dev-foot {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.dev-foot > * { flex: 1; margin-top: 0; }

/* ============================================================
 * 滚动条：默认那条白底灰块在暗色面板上非常廉价，统一换细
 * ============================================================ */
.shop-grid,
.cards,
.codex-list,
.over-grid,
.dev-body {
  scrollbar-width: thin;
  scrollbar-color: rgba(214, 240, 228, .26) transparent;
}
.shop-grid::-webkit-scrollbar,
.cards::-webkit-scrollbar,
.codex-list::-webkit-scrollbar,
.over-grid::-webkit-scrollbar,
.dev-body::-webkit-scrollbar { width: 7px; }
.shop-grid::-webkit-scrollbar-track,
.cards::-webkit-scrollbar-track,
.codex-list::-webkit-scrollbar-track,
.over-grid::-webkit-scrollbar-track,
.dev-body::-webkit-scrollbar-track { background: transparent; }
.shop-grid::-webkit-scrollbar-thumb,
.cards::-webkit-scrollbar-thumb,
.codex-list::-webkit-scrollbar-thumb,
.over-grid::-webkit-scrollbar-thumb,
.dev-body::-webkit-scrollbar-thumb {
  border-radius: 4px;
  background: rgba(214, 240, 228, .22);
}
.shop-grid::-webkit-scrollbar-thumb:hover,
.cards::-webkit-scrollbar-thumb:hover,
.codex-list::-webkit-scrollbar-thumb:hover { background: rgba(214, 240, 228, .38); }

/* ============================================================
 * 单字图标：原来的 emoji 全部换成「色块里的一个字」。
 * emoji 在不同系统上画风不一致，整套界面会立刻显得廉价。
 * ============================================================ */
.ic {
  font-style: normal;
  font-weight: 800;
  line-height: 1;
  display: inline-block;
  letter-spacing: 0;
}
.mchip { display: inline-flex; align-items: center; gap: 3px; }
.mchip .ic { color: var(--c); font-size: 10px; }
.slot .ic { color: var(--c); font-size: 10px; opacity: .92; }
.bk .ic { color: var(--c); font-size: 10px; }
.bk b { margin-left: 1px; }
.evdot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 5px;
  border-radius: 2px;
  background: var(--c);
  box-shadow: 0 0 7px color-mix(in srgb, var(--c) 65%, transparent);
  vertical-align: baseline;
}
/* 卡片 / 商店格里的图标块 */
.card .ico .ic,
.hero-card .ico .ic { font-size: 15px; color: var(--c, #0a1c15); }
.swap-item .si .ic { font-size: 15px; color: var(--c); }
.shop-item .si .ic { font-size: 16px; color: var(--c); }
.shop-item .si,
.swap-item .si {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin: 0 auto 6px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--c) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 34%, transparent);
}

/* 白纸卡片上的图标块：淡彩底 + 深色彩字，浅色字压在白纸上根本看不见 */
.card .ico,
.hero-card .ico {
  background: color-mix(in srgb, var(--c) 24%, #f7f5ec);
  border-color: color-mix(in srgb, var(--c) 42%, transparent);
}
.card .ico .ic,
.hero-card .ico .ic {
  color: color-mix(in srgb, var(--c) 38%, #16211c);
  font-size: 15px;
}
/* HUD 主科：字和数字别挤成一坨 */
.mchip { gap: 5px; }
.mchip .ic { font-size: 11px; }
.mchip b { font-size: 12px; }
