:root {
  --orange: #FF8A3D;
  --orange-deep: #E8601C;
  --amber: #FFC46B;
  --gold: #FFD98F;
  --cream: #FFF7E8;
  --paper: #FFF1DC;
  --ink: #2B1A10;
  --ink-soft: #6B5240;
  --rose: #FF5E7A;
  --line: rgba(120, 78, 40, .16);
  --glass: rgba(43, 24, 12, .36);
  --glass-line: rgba(255, 226, 180, .24);
  --shadow: 0 12px 30px rgba(70, 30, 10, .28);
}

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #150D08;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

body {
  background:
    radial-gradient(120% 70% at 50% 0%, #3A2415 0%, #1B110A 48%, #0E0905 100%);
}

[hidden] { display: none !important; }

button {
  font-family: inherit;
  border: 0;
  background: none;
  padding: 0;
  color: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

.app {
  position: relative;
  width: 100%;
  max-width: 520px;
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: #2A170C;
  isolation: isolate;
  box-shadow: 0 0 80px rgba(0, 0, 0, .65);
}

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

.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  background:
    radial-gradient(120% 85% at 50% 44%, rgba(0, 0, 0, 0) 52%, rgba(28, 12, 4, .34) 100%),
    linear-gradient(180deg, rgba(28, 12, 4, .18) 0%, rgba(0, 0, 0, 0) 18%, rgba(0, 0, 0, 0) 78%, rgba(24, 10, 3, .34) 100%);
}

.shade-top {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 180px;
  z-index: 4;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(30, 14, 5, .52) 0%, rgba(30, 14, 5, .22) 48%, rgba(30, 14, 5, 0) 100%);
}

/* ================= HUD ================= */
.hud {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  z-index: 12;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 0;
  pointer-events: none;
  animation: hudIn .45s ease both;
}

.hud-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.player {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 4px 13px 4px 4px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: 0 6px 16px rgba(30, 12, 4, .22);
}

.avatar {
  position: relative;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(160deg, #FFE3B4, #F0A860);
  border: 2px solid rgba(255, 220, 160, .85);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
  display: grid;
  place-items: center;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.avatar-fallback {
  font-family: "STKaiti", "KaiTi", "Songti SC", serif;
  font-size: 17px;
  font-weight: 700;
  color: #8A3A10;
  line-height: 1;
}

.player-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.player-name {
  font-size: 12.5px;
  font-weight: 700;
  color: #FFF4DE;
  letter-spacing: .4px;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
}

.player-sub {
  font-size: 10px;
  color: rgba(255, 233, 199, .72);
  letter-spacing: .6px;
  white-space: nowrap;
}

.hud-actions {
  display: flex;
  gap: 8px;
  pointer-events: auto;
}

.round-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #FFE9C6;
  box-shadow: 0 6px 16px rgba(30, 12, 4, .2);
  transition: transform .12s ease, background .2s ease;
}

.round-btn .mp-icon { width: 20px; height: 20px; }
.round-btn:active { transform: scale(.9); background: rgba(255, 180, 100, .3); }
.round-btn.dark {
  background: rgba(58, 34, 18, .14);
  border-color: rgba(120, 78, 40, .22);
  color: #7A4B26;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  box-shadow: none;
}

.hud-row-stats {
  margin-top: 9px;
}

.hearts {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.heart {
  position: relative;
  width: 15px;
  height: 13px;
  margin: 5px 1px 1px;
  background: linear-gradient(180deg, #FF97A6, #F03B5B);
  transform: rotate(-45deg);
  border-radius: 2px 2px 1px 2px;
  box-shadow: 0 2px 5px rgba(210, 20, 60, .38);
  transition: background .25s ease, box-shadow .25s ease, transform .2s ease;
}

.heart::before,
.heart::after {
  content: "";
  position: absolute;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: inherit;
}

.heart::before { top: -7px; left: 0; }
.heart::after { top: 0; left: 7px; }

.heart.lost {
  background: rgba(255, 240, 225, .2);
  box-shadow: none;
  transform: rotate(-45deg) scale(.88);
}

.heart.pulse { animation: heartPulse .5s ease; }

.score-badge {
  display: flex;
  align-items: baseline;
  gap: 4px;
  height: 34px;
  padding: 0 15px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 214, 140, .26), rgba(255, 138, 61, .12));
  border: 1px solid rgba(255, 214, 150, .38);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #FFF3DC;
  box-shadow: 0 4px 14px rgba(40, 16, 4, .18);
}

.score-label {
  font-size: 9.5px;
  letter-spacing: 1px;
  color: rgba(255, 226, 185, .72);
}

.score-badge b {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: .5px;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 3px rgba(90, 35, 5, .5);
}

.chase {
  margin-top: 9px;
  padding: 8px 13px 10px;
  border-radius: 16px;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: 0 6px 16px rgba(30, 12, 4, .18);
}

.chase-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 10px;
  letter-spacing: 2px;
  color: rgba(255, 232, 198, .82);
}

.chase-title {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 700;
}

.chase-title::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #FFB35C;
  box-shadow: 0 0 8px #FFB35C;
}

.chase-head b {
  font-size: 11.5px;
  color: #FFE2AC;
  font-variant-numeric: tabular-nums;
  letter-spacing: .5px;
}

.chase-track {
  position: relative;
  height: 9px;
  border-radius: 999px;
  background: rgba(28, 12, 4, .42);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .35);
  overflow: hidden;
}

.chase-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  border-radius: 999px;
  background:
    linear-gradient(90deg, #FFD166 0%, #FFA24D 55%, #FF6C7E 100%);
  box-shadow: 0 0 12px rgba(255, 150, 80, .65);
  transition: width .18s linear;
}

.chase-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, .38) 50%, transparent 80%);
  animation: chaseShine 2.2s linear infinite;
}

.chase-spark {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 7px;
  height: 7px;
  margin-left: -3px;
  border-radius: 50%;
  background: #FFF6DF;
  box-shadow: 0 0 10px 3px rgba(255, 190, 110, .8);
  transform: translateY(-50%);
  transition: left .18s linear;
  opacity: 0;
}

/* ================= 开始页 ================= */
.screen {
  position: absolute;
  inset: 0;
  z-index: 10;
}

.start {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 6.5vh) 20px calc(env(safe-area-inset-bottom, 0px) + 16px);
  background:
    linear-gradient(180deg, rgba(22, 10, 4, 0) 0%, rgba(22, 10, 4, 0) 34%, rgba(22, 10, 4, .1) 50%, rgba(22, 10, 4, .5) 66%, rgba(20, 9, 4, .87) 84%, rgba(18, 8, 3, .93) 100%);
  animation: fadeIn .4s ease both;
}

.start-top { text-align: center; flex: 0 0 auto; }

.title-wrap {
  position: relative;
  display: inline-block;
  padding: 0 10px;
}

.title-seal {
  position: absolute;
  right: -16px;
  top: -14px;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: linear-gradient(160deg, #D6392B, #9E1E16);
  color: #FFEFD2;
  font-family: "STKaiti", "KaiTi", "Songti SC", serif;
  font-size: 23px;
  line-height: 1;
  border: 1.5px solid rgba(255, 219, 160, .8);
  box-shadow: 0 6px 16px rgba(80, 12, 4, .5), inset 0 0 10px rgba(255, 160, 90, .3);
  transform: rotate(7deg);
}

.game-title {
  margin: 0;
  font-family: "STKaiti", "KaiTi", "Kaiti SC", "Songti SC", "Noto Serif SC", serif;
  font-size: clamp(46px, 14.5vw, 70px);
  font-weight: 900;
  line-height: 1.04;
  letter-spacing: 3px;
  background: linear-gradient(180deg, #FFF7CF 0%, #FFE29A 34%, #FFB44F 64%, #F4761F 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter:
    drop-shadow(0 2px 0 #8E2A0F)
    drop-shadow(0 4px 0 #5E1608)
    drop-shadow(0 14px 22px rgba(50, 16, 2, .55));
  padding-left: 3px;
}

.title-banner {
  display: inline-block;
  margin: 15px auto 0;
  padding: 7px 20px 8px;
  border-radius: 7px;
  background: linear-gradient(180deg, #C9342A 0%, #93190F 100%);
  border: 1px solid rgba(255, 214, 150, .5);
  color: #FFE7B8;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 4px;
  text-indent: 4px;
  box-shadow: 0 8px 20px rgba(70, 10, 0, .45), inset 0 1px 0 rgba(255, 200, 140, .35);
  transform: rotate(-1.6deg);
}

.start-mid { flex: 1 1 auto; min-height: 10px; }

.start-bottom {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.best-line {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px;
  max-width: 330px;
  font-size: 11.5px;
  color: rgba(255, 235, 207, .74);
  letter-spacing: .8px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, .45);
}

.best-line b {
  font-size: 13px;
  color: #FFD98F;
  font-variant-numeric: tabular-nums;
  letter-spacing: .5px;
}

.best-line .home-name {
  max-width: 92px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #FFEAC8;
  font-weight: 700;
  font-size: 11.5px;
  letter-spacing: .4px;
}

.home-avatar {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(160deg, #FFE3B4, #F0A860);
  border: 1px solid rgba(255, 220, 160, .7);
  display: grid;
  place-items: center;
  margin-top: -1px;
}

.home-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.home-avatar-fallback {
  font-family: "STKaiti", "KaiTi", "Songti SC", serif;
  font-size: 10px;
  font-weight: 700;
  color: #8A3A10;
  line-height: 1;
}

.dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(255, 226, 185, .45);
  margin: 0 2px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 0 26px;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: #3A1606;
  transition: transform .12s ease, box-shadow .15s ease, opacity .2s ease;
  -webkit-user-select: none;
  user-select: none;
}

.btn:active { transform: scale(.965); }
.btn .mp-icon { width: 21px; height: 21px; flex: 0 0 auto; }
.btn[disabled] { opacity: .5; }

.btn.primary {
  background: linear-gradient(180deg, #FFCF7B 0%, #FF9F4E 48%, #F26C1D 100%);
  border: 1px solid rgba(255, 228, 176, .7);
  box-shadow:
    0 10px 24px rgba(226, 82, 14, .48),
    inset 0 1px 0 rgba(255, 255, 255, .6),
    inset 0 -2px 0 rgba(160, 55, 5, .25);
  text-shadow: 0 1px 0 rgba(255, 245, 220, .45);
}

.btn.ghost {
  background: rgba(255, 244, 224, .09);
  border: 1px solid rgba(255, 224, 180, .32);
  color: #FFEBCB;
  box-shadow: 0 6px 16px rgba(20, 8, 2, .2);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  font-weight: 700;
}

.btn.text {
  background: transparent;
  color: rgba(120, 82, 52, .85);
  font-weight: 600;
  font-size: 13px;
  min-height: 40px;
  letter-spacing: 1px;
  box-shadow: none;
}

.btn-block { width: 100%; }

.btn-play {
  position: relative;
  width: min(286px, 80vw);
  min-height: 58px;
  font-size: 19.5px;
  letter-spacing: 3px;
  padding-left: 18px;
  animation: playBreath 2.8s ease-in-out infinite;
}

.btn-play .mp-icon { width: 24px; height: 24px; }

.btn-play::before {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 999px;
  border: 1px solid rgba(255, 206, 140, .38);
  opacity: .8;
  animation: ringPulse 2.8s ease-out infinite;
  pointer-events: none;
}

.start-links { display: flex; gap: 10px; }

.start-links .btn {
  min-height: 40px;
  padding: 0 16px;
  font-size: 12.5px;
  letter-spacing: 1px;
  gap: 6px;
}

.start-links .mp-icon { width: 17px; height: 17px; }

.start-links b {
  color: #FFD98F;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.howto {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  max-width: 340px;
}

.howto span {
  padding: 6px 11px;
  border-radius: 999px;
  background: rgba(255, 240, 214, .07);
  border: 1px solid rgba(255, 224, 180, .16);
  font-size: 10.5px;
  letter-spacing: .6px;
  color: rgba(255, 238, 213, .68);
  white-space: nowrap;
}

.howto b { color: #FFD08A; font-weight: 700; }

/* ================= 遮罩与卡片 ================= */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(env(safe-area-inset-top, 0px) + 22px) 20px calc(env(safe-area-inset-bottom, 0px) + 22px);
  background: rgba(26, 13, 5, .58);
  -webkit-backdrop-filter: blur(7px) saturate(1.05);
  backdrop-filter: blur(7px) saturate(1.05);
  animation: fadeIn .22s ease both;
  overflow-y: auto;
}

.sheet {
  position: relative;
  width: 100%;
  max-width: 356px;
  margin: auto;
  padding: 26px 22px 20px;
  border-radius: 26px;
  background:
    radial-gradient(120% 80% at 50% 0%, #FFFDF6 0%, #FFF6E6 55%, #FFEDD3 100%);
  border: 1px solid rgba(255, 232, 196, .9);
  box-shadow:
    0 28px 60px rgba(34, 12, 0, .55),
    inset 0 0 0 1px rgba(255, 255, 255, .65),
    inset 0 -20px 40px rgba(255, 190, 120, .12);
  animation: popIn .32s cubic-bezier(.2, 1.25, .4, 1) both;
}

.sheet::before {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  top: 9px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, rgba(255, 170, 90, .55), transparent);
}

.story-card { text-align: center; }

.story-kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 14px;
  border-radius: 999px;
  background: #FFE6CE;
  border: 1px solid rgba(226, 118, 48, .28);
  color: #B55318;
  font-size: 10.5px;
  letter-spacing: 2px;
  font-weight: 700;
}

.story-kicker b {
  color: #8E2F0A;
  letter-spacing: 1px;
}

.story-medal {
  width: 52px;
  height: 52px;
  margin: 15px auto 6px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #FF5E7A;
  background: radial-gradient(circle at 35% 30%, #FFF0EA, #FFD3CE 75%);
  border: 1px solid rgba(255, 140, 140, .38);
  box-shadow: 0 8px 18px rgba(226, 100, 90, .22), inset 0 1px 2px #fff;
}

.story-medal .mp-icon { width: 27px; height: 27px; }

.story-title {
  margin: 4px 0 12px;
  font-family: "STKaiti", "KaiTi", "Songti SC", serif;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 3px;
  color: #3E1E0B;
  text-shadow: 0 2px 0 rgba(255, 255, 255, .7);
}

.story-text {
  margin: 0;
  padding: 14px 4px 15px;
  font-size: 14.5px;
  line-height: 1.95;
  letter-spacing: .3px;
  color: #6A4B33;
  text-align: center;
  border-top: 1px dashed rgba(150, 100, 55, .18);
  border-bottom: 1px dashed rgba(150, 100, 55, .18);
}

.story-rewards {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  margin: 14px 0 17px;
}

.story-rewards span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 11px;
  border-radius: 999px;
  background: #FFF0D9;
  border: 1px solid rgba(226, 150, 80, .26);
  color: #A8571B;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .5px;
}

.story-rewards span.new { background: #FFE6D8; color: #C23A2A; border-color: rgba(220, 100, 80, .3); }

.over-card { text-align: center; }

.over-kicker {
  font-size: 10.5px;
  letter-spacing: 3px;
  color: #B26B39;
  font-weight: 700;
}

.over-title {
  margin: 8px 0 2px;
  font-family: "STKaiti", "KaiTi", "Songti SC", serif;
  font-size: 28px;
  letter-spacing: 3px;
  color: #3E1E0B;
}

.score-big {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  margin: 6px 0 2px;
}

.score-big b {
  font-size: 56px;
  line-height: 1.05;
  font-weight: 900;
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #FFB24F 0%, #F26C1D 60%, #D9440A 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 3px 0 rgba(255, 255, 255, .55));
}

.score-big span {
  font-size: 12px;
  color: #A57A55;
  letter-spacing: 1px;
}

.over-meta {
  font-size: 12px;
  color: #8A6A4D;
  letter-spacing: .4px;
}

.over-meta b { color: #6B3A18; font-size: 13.5px; font-variant-numeric: tabular-nums; }

.over-best {
  margin: 12px auto 16px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(255, 196, 120, .16);
  border: 1px dashed rgba(200, 130, 70, .3);
  color: #8F5D2F;
  font-size: 11px;
  letter-spacing: .5px;
  line-height: 1.6;
}

.over-card .btn + .btn { margin-top: 9px; }
.over-card .btn.primary { margin-top: 2px; }
.over-card .revive-note + .btn { margin-top: 9px; }

.revive-note {
  margin-top: 7px;
  font-size: 10px;
  color: #A98A6B;
  letter-spacing: .4px;
}

.pause-card { text-align: center; max-width: 320px; }
.pause-title {
  margin: 8px 0 6px;
  font-family: "STKaiti", "KaiTi", "Songti SC", serif;
  font-size: 28px;
  letter-spacing: 2px;
  color: #3E1E0B;
}
.pause-text { margin: 0 0 18px; font-size: 12.5px; color: #8A6A4D; letter-spacing: .4px; }
.pause-card .btn + .btn { margin-top: 9px; }

/* ================= 图鉴 ================= */
.codex-card {
  padding: 22px 18px 18px;
  display: flex;
  flex-direction: column;
  max-height: min(78vh, 640px);
}

.codex-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex: 0 0 auto;
}

.codex-title {
  margin: 0;
  font-family: "STKaiti", "KaiTi", "Songti SC", serif;
  font-size: 25px;
  letter-spacing: 2px;
  color: #3E1E0B;
}

.codex-sub {
  margin: 4px 0 0;
  font-size: 10.5px;
  color: #96714F;
  letter-spacing: .5px;
}

.codex-sub b { color: #C25A1B; }

.codex-list {
  margin-top: 12px;
  padding-right: 4px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  flex: 1 1 auto;
}

.codex-list::-webkit-scrollbar { width: 3px; }
.codex-list::-webkit-scrollbar-thumb { background: rgba(190, 120, 60, .35); border-radius: 3px; }

.codex-item {
  display: flex;
  gap: 11px;
  padding: 11px 12px;
  border-radius: 14px;
  background: #FFF9EE;
  border: 1px solid rgba(190, 130, 70, .16);
  text-align: left;
}

.codex-item .cno {
  flex: 0 0 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, #FFD79B, #F4A558);
  color: #6B2E07;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .5px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55);
}

.codex-item .cbody { min-width: 0; }

.codex-item .ctitle {
  display: block;
  font-size: 13.5px;
  font-weight: 800;
  color: #46260F;
  letter-spacing: 1px;
  margin-bottom: 3px;
}

.codex-item .ctext {
  display: block;
  font-size: 11px;
  line-height: 1.65;
  color: #8B6C50;
  letter-spacing: .2px;
}

.codex-item.locked {
  background: rgba(255, 249, 238, .55);
  border-style: dashed;
}

.codex-item.locked .cno {
  background: rgba(190, 160, 130, .22);
  color: rgba(120, 90, 60, .55);
  box-shadow: none;
}

.codex-item.locked .ctitle { color: rgba(90, 62, 38, .5); }
.codex-item.locked .ctext { color: rgba(120, 95, 70, .42); }

/* ================= 操作提示 ================= */
.tip {
  position: absolute;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 14px);
  z-index: 14;
  transform: translateX(-50%);
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(38, 20, 8, .58);
  border: 1px solid rgba(255, 224, 180, .22);
  color: rgba(255, 238, 213, .86);
  font-size: 11px;
  letter-spacing: 1px;
  white-space: nowrap;
  pointer-events: none;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 20px rgba(20, 8, 2, .25);
  animation: tipIn .45s ease both;
}

@keyframes tipIn {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ================= Toast ================= */
.toast {
  position: absolute;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 96px);
  z-index: 60;
  max-width: 82%;
  padding: 9px 18px;
  border-radius: 999px;
  background: rgba(38, 20, 8, .88);
  border: 1px solid rgba(255, 214, 150, .26);
  color: #FFE9C6;
  font-size: 12px;
  letter-spacing: .5px;
  white-space: nowrap;
  transform: translate(-50%, 8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  box-shadow: 0 10px 26px rgba(0, 0, 0, .4);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ================= 动画 ================= */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

@keyframes popIn {
  from { opacity: 0; transform: translateY(14px) scale(.94); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes hudIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes heartPulse {
  0% { transform: rotate(-45deg) scale(1); }
  40% { transform: rotate(-45deg) scale(1.3); }
  100% { transform: rotate(-45deg) scale(1); }
}

@keyframes chaseShine {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

@keyframes playBreath {
  0%, 100% { box-shadow: 0 10px 24px rgba(226, 82, 14, .48), inset 0 1px 0 rgba(255, 255, 255, .6); }
  50% { box-shadow: 0 14px 30px rgba(255, 120, 30, .6), inset 0 1px 0 rgba(255, 255, 255, .65); }
}

@keyframes ringPulse {
  0% { transform: scale(.98); opacity: .55; }
  70% { transform: scale(1.12); opacity: 0; }
  100% { transform: scale(1.12); opacity: 0; }
}

@media (max-height: 680px) {
  .start { padding-top: calc(env(safe-area-inset-top, 0px) + 3.2vh); }
  .game-title { font-size: clamp(40px, 12.5vw, 56px); }
  .title-banner { margin-top: 11px; }
  .start-bottom { gap: 9px; }
  .btn-play { min-height: 52px; }
  .howto { display: none; }
  .story-text { font-size: 13.5px; padding: 11px 2px 12px; }
  .score-big b { font-size: 48px; }
}

@media (min-width: 540px) {
  .app { border-radius: 22px; }
  .hud { padding-left: 20px; padding-right: 20px; }
}
