:root {
  --orange: #FF8A3D;
  --orange-deep: #F06E1F;
  --orange-soft: #FFF0DE;
  --gold: #F6B84C;
  --ink: #1F3A38;
  --ink-2: #43524E;
  --muted: #988C78;
  --paper: #FFF9EF;
  --paper-2: #FFF3E3;
  --line: #EADBC4;
  --teal: #2E7A72;
  --danger: #C14E37;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

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

body { position: fixed; inset: 0; }

button { font-family: inherit; }

[hidden] { display: none !important; }

.stage {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  overflow: hidden;
  background:
    radial-gradient(85% 60% at 50% 0%, #143F3C 0%, #092A28 60%, #061D1C 100%);
}

.app {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 480px;
  height: 100%;
  overflow: hidden;
  background: #0E3C3A;
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.45);
}

/* ------------------------------------------------------------------ */
/* 仙山场景                                                            */
/* ------------------------------------------------------------------ */

.scene {
  position: relative;
  flex: 0 0 43%;
  min-height: 238px;
  overflow: hidden;
  background: linear-gradient(180deg, #04181D 0%, #0B3436 46%, #1D5B4F 82%, #2C6B55 100%);
  z-index: 0;
}

.scene-art {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.scene::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(2, 16, 18, 0.45) 0%, rgba(2, 16, 18, 0) 32%),
    linear-gradient(0deg, rgba(2, 20, 20, 0.5) 0%, rgba(2, 20, 20, 0) 26%);
  z-index: 1;
}

.scene::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 34%, transparent 40%, rgba(6, 34, 33, 0.34) 100%);
  z-index: 1;
}

.scene-art {
  transition: filter 1.2s ease;
}

.scene.is-low .scene-art {
  filter: saturate(0.72) brightness(0.86) hue-rotate(-6deg);
}

.scene.is-low::after {
  background:
    radial-gradient(ellipse at 50% 34%, transparent 32%, rgba(74, 24, 18, 0.36) 100%);
}

.mist {
  position: absolute;
  left: -30%;
  width: 160%;
  height: 92px;
  pointer-events: none;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(200, 232, 206, 0.3) 0%, rgba(200, 232, 206, 0.12) 40%, rgba(200, 232, 206, 0) 72%);
  filter: blur(6px);
  z-index: 2;
  will-change: transform;
}

.mist-a {
  bottom: 6%;
  animation: mistDrift 26s ease-in-out infinite alternate;
}

.mist-b {
  bottom: 24%;
  opacity: 0.6;
  height: 72px;
  animation: mistDrift 34s ease-in-out infinite alternate-reverse;
}

.motes {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 2;
}

.mote {
  position: absolute;
  width: 3px;
  height: 3px;
  margin: -1px 0 0 -1px;
  border-radius: 50%;
  background: #FFE6B0;
  box-shadow: 0 0 8px rgba(255, 214, 140, 0.9);
  animation: moteFloat var(--dur, 12s) linear infinite;
  animation-delay: var(--delay, 0s);
  opacity: 0;
}

.mote.petal {
  width: 7px;
  height: 4px;
  border-radius: 70% 0 70% 0;
  background: #FFB37C;
  box-shadow: none;
  transform: rotate(24deg);
}

/* 诗句印章 */
.poem {
  position: absolute;
  left: 18px;
  top: 96px;
  bottom: auto;
  z-index: 3;
  writing-mode: vertical-rl;
  font-family: "Songti SC", "STSong", "Noto Serif CJK SC", "Noto Serif SC", serif;
  font-size: 12.5px;
  line-height: 1.95;
  letter-spacing: 0.34em;
  color: rgba(255, 248, 232, 0.82);
  text-shadow: 0 2px 12px rgba(7, 40, 38, 0.6);
  pointer-events: none;
}

.poem span { display: block; }

.poem-seal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin: 9px 0 0 2px;
  border: 1px solid rgba(255, 168, 112, 0.72);
  border-radius: 4px;
  font-size: 8px;
  font-style: normal;
  letter-spacing: 0.06em;
  line-height: 1.05;
  text-indent: 0.06em;
  color: #FFD8B4;
  background: rgba(160, 62, 28, 0.24);
  transform: rotate(3deg);
}

.scene-seal {
  position: absolute;
  right: 18px;
  bottom: 30px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  padding: 3px;
  border: 1.5px solid rgba(255, 143, 92, 0.55);
  border-radius: 5px;
  background: rgba(150, 48, 26, 0.22);
  font-family: "Songti SC", "STSong", "Noto Serif CJK SC", "Noto Serif SC", serif;
  font-size: 9px;
  line-height: 1.05;
  letter-spacing: 0.04em;
  text-align: center;
  color: #FFC9A6;
  transform: rotate(-4deg);
  text-shadow: 0 1px 5px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

/* 顶部状态 */
.hud {
  position: absolute;
  top: calc(var(--safe-top) + 14px);
  left: 16px;
  right: 16px;
  z-index: 5;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
}

.stat {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 108px;
  padding: 7px 12px 7px 7px;
  border-radius: 16px;
  background: rgba(255, 250, 240, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.78);
  box-shadow: 0 8px 22px rgba(13, 59, 57, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  -webkit-backdrop-filter: blur(12px) saturate(1.15);
  backdrop-filter: blur(12px) saturate(1.15);
  transition: background 0.3s, box-shadow 0.3s;
}

.stat-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 138, 61, 0.14);
  color: #EF7A28;
}

.stat-icon .mp-icon { width: 18px; height: 18px; }

.stat-copy { display: block; min-width: 0; }

.stat-label {
  display: block;
  font-size: 9px;
  line-height: 1;
  letter-spacing: 0.16em;
  color: #8C8170;
  font-weight: 600;
}

.stat strong {
  display: block;
  margin-top: 4px;
  font-size: 15px;
  line-height: 1.15;
  font-weight: 700;
  color: #1E3A38;
  letter-spacing: 0.02em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.stat strong em {
  font-style: normal;
  font-size: 9.5px;
  font-weight: 600;
  color: #8C8170;
  margin-left: 2px;
}

.stat-life .stat-icon { color: #D97A2E; }

.stat-life.is-low {
  background: rgba(255, 238, 230, 0.92);
  box-shadow: 0 8px 24px rgba(178, 66, 38, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  animation: lowPulse 1.5s ease-in-out infinite;
}

.stat-life.is-low .stat-icon { background: rgba(193, 78, 55, 0.14); color: var(--danger); }
.stat-life.is-low strong { color: #B6402B; }

/* ------------------------------------------------------------------ */
/* 下方手札                                                            */
/* ------------------------------------------------------------------ */

.sheet {
  position: relative;
  z-index: 4;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin-top: -20px;
  padding: 11px 16px calc(13px + var(--safe-bottom));
  border-radius: 26px 26px 0 0;
  background:
    radial-gradient(120% 70% at 50% 0%, #FFFDF8 0%, rgba(255, 253, 248, 0) 58%),
    repeating-linear-gradient(0deg, rgba(190, 167, 132, 0.028) 0 1px, transparent 1px 4px),
    linear-gradient(180deg, #FFFBF3 0%, #FFF6E8 58%, #FFF3E1 100%);
  border-top: 1px solid rgba(255, 255, 255, 0.92);
  box-shadow: 0 -18px 42px rgba(8, 38, 36, 0.34), inset 0 1px 0 #FFFFFF;
}

.sheet::before {
  content: "";
  position: absolute;
  top: 6px;
  left: 50%;
  width: 132px;
  height: 1px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, rgba(199, 168, 118, 0), rgba(199, 168, 118, 0.55), rgba(199, 168, 118, 0));
  pointer-events: none;
}

.sheet.shake { animation: sheetShake 0.42s ease; }

.grip {
  flex: 0 0 auto;
  position: relative;
  width: 44px;
  height: 4px;
  margin: 0 auto 9px;
  border-radius: 999px;
  background: linear-gradient(90deg, #EBD7B9, #D8B888, #EBD7B9);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.log-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.log-title { display: flex; align-items: center; gap: 9px; min-width: 0; }

.log-ico {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 31px;
  height: 31px;
  border-radius: 50%;
  background: var(--orange-soft);
  border: 1px solid #FFE1C5;
  color: #EE7A2B;
}

.log-ico .mp-icon { width: 17px; height: 17px; }

.log-copy { display: block; min-width: 0; }

.log-copy strong {
  display: block;
  font-size: 15px;
  line-height: 1.1;
  font-weight: 700;
  color: #233D3A;
  letter-spacing: 0.03em;
}

.log-copy small {
  display: block;
  margin-top: 3px;
  font-size: 10px;
  line-height: 1;
  color: #A0927C;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tap-count {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  background: #FBF0DF;
  border: 1px solid rgba(226, 207, 180, 0.55);
  font-size: 9.5px;
  line-height: 1;
  color: #A08F79;
  letter-spacing: 0.02em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.log-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 64px;
  display: flex;
  min-width: 0;
}

.log-top-fade {
  position: absolute;
  top: 1px;
  left: 1px;
  right: 1px;
  height: 27px;
  z-index: 2;
  border-radius: 14px 14px 0 0;
  background: linear-gradient(to bottom, rgba(255, 253, 248, 1) 0%, rgba(255, 253, 248, 0.96) 44%, rgba(255, 253, 248, 0.62) 70%, rgba(255, 253, 248, 0) 100%);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.log-wrap.is-scrolled .log-top-fade { opacity: 1; }

.log {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 11px 13px;
  border: 1px solid rgba(226, 207, 180, 0.68);
  border-radius: 15px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 250, 242, 0.46)),
    repeating-linear-gradient(90deg, rgba(196, 172, 136, 0.05) 0 1px, transparent 1px 3px);
  box-shadow: inset 0 1px 0 #FFFFFF, inset 3px 0 0 rgba(255, 138, 61, 0.09), inset 0 -10px 20px rgba(203, 176, 138, 0.05);
  scrollbar-width: none;
}

.log::-webkit-scrollbar { display: none; }

.log-wrap.is-scrolled .log {
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 20px);
  mask-image: linear-gradient(to bottom, transparent 0, #000 20px);
}

.entry {
  position: relative;
  padding-left: 13px;
  font-family: "Songti SC", "STSong", "Noto Serif CJK SC", "Noto Serif SC", serif;
  font-size: 13.5px;
  line-height: 1.78;
  color: #465450;
  letter-spacing: 0.012em;
  white-space: pre-line;
  animation: entryIn 0.34s ease both;
}

.entry + .entry { margin-top: 4px; }

.entry::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.78em;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #CEB996;
}

.entry.gain {
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  color: #237068;
  letter-spacing: 0.02em;
}

.entry.gain::before { background: #4C9A90; }

.entry.crit {
  color: #B95F16;
  font-weight: 600;
}

.entry.crit::before { background: #F0953E; box-shadow: 0 0 6px rgba(240, 149, 62, 0.6); }

.entry.epic {
  color: #A9520E;
  font-weight: 700;
  font-size: 14.5px;
}

.entry.epic::before { background: #E8751E; box-shadow: 0 0 8px rgba(232, 117, 30, 0.55); }

.entry.warn { color: #AE4A38; }
.entry.warn::before { background: #C56552; }

.entry.system {
  font-family: inherit;
  font-size: 11.5px;
  color: #96886F;
  padding-left: 0;
}

.entry.system::before { display: none; }

.entry.hint {
  font-family: inherit;
  font-size: 11.5px;
  color: #9C7A45;
}

.entry.hint::before { background: #D6B370; }

/* 修为进度 */
.cultivate {
  flex: 0 0 auto;
  padding-top: 11px;
}

.progress-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.progress-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 700;
  color: #6E6557;
  letter-spacing: 0.08em;
}

.progress-label .mp-icon {
  width: 13px;
  height: 13px;
  color: #F08030;
}

.progress-num {
  font-size: 11px;
  color: #A19786;
  font-variant-numeric: tabular-nums;
}

.progress-num strong {
  display: inline-block;
  font-size: 19px;
  font-weight: 700;
  color: #E9761F;
  letter-spacing: 0.01em;
  transition: color 0.25s;
}

#lifeVal { display: inline-block; }

.bump { animation: numPop 0.32s ease; }

.bar {
  position: relative;
  height: 10px;
  margin-top: 7px;
  border-radius: 999px;
  background: #EFE0CB;
  box-shadow: inset 0 1px 3px rgba(129, 99, 63, 0.2), 0 1px 0 rgba(255, 255, 255, 0.75);
}

.bar-fill {
  position: relative;
  width: 0%;
  height: 100%;
  border-radius: 999px;
  overflow: hidden;
  background: linear-gradient(90deg, #FFC46B 0%, #FF8A3D 58%, #F4711F 100%);
  box-shadow: 0 0 12px rgba(255, 138, 61, 0.38);
  transition: width 0.48s cubic-bezier(0.22, 1, 0.36, 1);
}

.bar-shine {
  position: absolute;
  top: 0;
  left: -45%;
  width: 38%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.62), transparent);
  transform: skewX(-20deg);
  animation: barShine 3.1s ease-in-out infinite;
}

.bar-spark {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 13px;
  height: 13px;
  margin: -6.5px 0 0 -6.5px;
  border-radius: 50%;
  background: #FFF4CC;
  box-shadow: 0 0 10px 2px rgba(255, 190, 90, 0.72);
  opacity: 0;
  transition: left 0.48s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s;
  pointer-events: none;
}

.cultivate.has-progress .bar-spark { opacity: 0.95; }

.progress-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
  font-size: 10px;
  line-height: 1.3;
  color: #9C8E78;
  letter-spacing: 0.015em;
}

#progressHint { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

#nextRealm {
  flex: 0 0 auto;
  color: #B07A3A;
  font-weight: 600;
  white-space: nowrap;
}

.cultivate.ready .bar-fill {
  background: linear-gradient(90deg, #FFB444 0%, #FF7A2E 52%, #FF9E3D 100%);
  animation: barBreathe 1.8s ease-in-out infinite;
}

.cultivate.ready .bar-spark {
  opacity: 1;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  animation: sparkPulse 1.4s ease-in-out infinite;
}

.cultivate.ready #progressHint { color: #CF611A; font-weight: 700; }
.cultivate.ready #nextRealm { color: #CF611A; }

/* 主按钮 */
.action {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 62px;
  margin-top: 11px;
  padding: 9px 13px 9px 9px;
  border: 0;
  border-radius: 19px;
  overflow: hidden;
  text-align: left;
  color: #FFFFFF;
  background: linear-gradient(135deg, #FFA45A 0%, #FF8A3D 46%, #F2711F 100%);
  box-shadow: 0 14px 26px -9px rgba(235, 102, 28, 0.72), inset 0 1px 0 rgba(255, 255, 255, 0.48), inset 0 -2px 0 rgba(180, 70, 10, 0.16);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s ease, box-shadow 0.2s ease, filter 0.2s ease;
  isolation: isolate;
}

.action::before {
  content: "";
  position: absolute;
  top: -60%;
  left: -18%;
  width: 42%;
  height: 220%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transform: rotate(18deg);
  pointer-events: none;
  z-index: 0;
}

.action > * { position: relative; z-index: 1; }

.action:active {
  transform: translateY(2px) scale(0.986);
  box-shadow: 0 6px 14px -6px rgba(235, 102, 28, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.38);
}

.action:focus-visible {
  outline: 3px solid rgba(255, 138, 61, 0.45);
  outline-offset: 2px;
}

.action-orb {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 43px;
  height: 43px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.34);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
  color: #FFFFFF;
}

.action-orb .mp-icon { width: 25px; height: 25px; }

.action-copy { display: block; flex: 1 1 auto; min-width: 0; }

.action-copy strong {
  display: block;
  font-size: 17.5px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0.06em;
  text-shadow: 0 1px 2px rgba(162, 66, 12, 0.2);
}

.action-copy small {
  display: block;
  margin-top: 3px;
  font-size: 10px;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.86);
}

.action-arrow {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.12);
}

.action-arrow .mp-icon { width: 18px; height: 18px; }

.action.ready {
  background: linear-gradient(135deg, #FFC45E 0%, #FF8A3D 42%, #EF6418 100%);
  animation: actionBreathe 2.3s ease-in-out infinite;
  box-shadow: 0 14px 30px -8px rgba(239, 100, 24, 0.74), 0 0 0 1px rgba(255, 207, 128, 0.35) inset, inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.action.ready .action-orb {
  background: rgba(255, 255, 255, 0.27);
  animation: orbGlow 1.8s ease-in-out infinite;
}

.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.48);
  transform: scale(0);
  animation: rippleOut 0.55s ease-out forwards;
  pointer-events: none;
  z-index: 2;
}

/* 飘字与粒子 */
.float-txt {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 80;
  transform: translate(-50%, -100%);
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 6px 14px rgba(18, 66, 62, 0.2);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #D96A1D;
  white-space: nowrap;
  pointer-events: none;
  animation: floatUp 1.15s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.float-txt.blue { color: #26766D; }
.float-txt.red { color: #B8432D; }
.float-txt.gold { color: #B8791E; }

.spark {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 79;
  width: var(--size, 6px);
  height: var(--size, 6px);
  margin: calc(var(--size, 6px) / -2) 0 0 calc(var(--size, 6px) / -2);
  border-radius: 50%;
  background: var(--color, #FFD37E);
  pointer-events: none;
  animation: sparkFly 0.85s cubic-bezier(0.15, 0.8, 0.35, 1) forwards;
}

/* ------------------------------------------------------------------ */
/* 结局                                                                */
/* ------------------------------------------------------------------ */

.end-mask {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(9, 38, 36, 0.58);
  -webkit-backdrop-filter: blur(9px);
  backdrop-filter: blur(9px);
  animation: maskIn 0.35s ease both;
}

.end-card {
  position: relative;
  width: 100%;
  max-width: 330px;
  max-height: 90%;
  overflow: auto;
  padding: 28px 20px 20px;
  border-radius: 26px;
  text-align: center;
  background: linear-gradient(180deg, #FFFCF5 0%, #FFF4E3 100%);
  border: 1px solid rgba(255, 255, 255, 0.92);
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.5), inset 0 1px 0 #FFFFFF;
  animation: cardIn 0.48s cubic-bezier(0.2, 1.1, 0.4, 1) both;
  scrollbar-width: none;
}

.end-card::-webkit-scrollbar { display: none; }
.end-card:focus { outline: none; }

.end-card.is-win {
  background: linear-gradient(180deg, #FFFDF2 0%, #FFF1CB 100%);
  border-color: rgba(255, 215, 140, 0.96);
}

.end-card.is-win::before {
  content: "";
  position: absolute;
  top: -30%;
  left: 50%;
  width: 340px;
  height: 260px;
  transform: translateX(-50%);
  background: radial-gradient(circle at center, rgba(255, 197, 83, 0.36) 0%, rgba(255, 197, 83, 0) 65%);
  pointer-events: none;
}

.end-seal {
  position: relative;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin: 0 auto 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FFB05E, #F4711F);
  border: 2px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 8px 18px rgba(240, 110, 30, 0.35);
  color: #FFFFFF;
  font-family: "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  font-size: 20px;
  line-height: 1;
}

.end-card.is-win .end-seal {
  background: linear-gradient(135deg, #FFD37E, #E9A02A);
  box-shadow: 0 8px 22px rgba(210, 148, 35, 0.42);
}

.end-kicker {
  position: relative;
  margin: 0 0 3px;
  font-size: 9.5px;
  letter-spacing: 0.34em;
  color: #B08B60;
  text-indent: 0.34em;
}

.end-card.is-win .end-kicker { color: #A87A22; }

.end-card h2 {
  position: relative;
  margin: 0 0 10px;
  font-family: "Songti SC", "STSong", "Noto Serif CJK SC", "Noto Serif SC", serif;
  font-size: 26px;
  line-height: 1.2;
  letter-spacing: 0.08em;
  color: #243E3B;
}

.end-card.is-win h2 { color: #8A5E12; }

.end-text {
  position: relative;
  margin: 0 0 15px;
  font-family: "Songti SC", "STSong", "Noto Serif CJK SC", "Noto Serif SC", serif;
  font-size: 13px;
  line-height: 1.9;
  color: #6E6A5C;
  white-space: pre-line;
}

.end-stats {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 16px;
  padding: 11px 0;
  border-top: 1px solid #EDDFC9;
  border-bottom: 1px solid #EDDFC9;
}

.end-stats > div + div { border-left: 1px solid #EDDFC9; }

.end-stats span {
  display: block;
  font-size: 9.5px;
  letter-spacing: 0.14em;
  color: #A08F76;
}

.end-stats strong {
  display: block;
  margin-top: 4px;
  font-size: 14px;
  font-weight: 700;
  color: #2E4A46;
  font-variant-numeric: tabular-nums;
}

.end-card.is-win .end-stats strong { color: #7A5310; }

.end-btn {
  position: relative;
  width: 100%;
  height: 50px;
  border: 0;
  border-radius: 15px;
  background: linear-gradient(135deg, #FFA45A, #F4711F);
  color: #FFFFFF;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-indent: 0.14em;
  box-shadow: 0 10px 20px -6px rgba(235, 102, 28, 0.62), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.2s ease;
}

.end-btn:active {
  transform: translateY(2px) scale(0.99);
  box-shadow: 0 5px 12px -5px rgba(235, 102, 28, 0.5);
}

.end-btn:focus-visible { outline: 3px solid rgba(255, 138, 61, 0.45); outline-offset: 2px; }

/* ------------------------------------------------------------------ */
/* 动效                                                                */
/* ------------------------------------------------------------------ */

.qi-ring {
  transform-box: fill-box;
  transform-origin: 50% 50%;
  animation: qiSpin 22s linear infinite;
}

@keyframes qiSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes mistDrift {
  from { transform: translate3d(-4%, 0, 0) scaleX(0.96); }
  to { transform: translate3d(4%, 0, 0) scaleX(1.06); }
}

@keyframes moteFloat {
  0% { transform: translate3d(0, 12px, 0) scale(0.55); opacity: 0; }
  14% { opacity: 0.85; }
  72% { opacity: 0.55; }
  100% { transform: translate3d(var(--drift, 18px), -120px, 0) scale(1.05); opacity: 0; }
}

@keyframes barShine {
  0%, 42% { left: -45%; }
  62%, 100% { left: 118%; }
}

@keyframes barBreathe {
  0%, 100% { box-shadow: 0 0 12px rgba(255, 138, 61, 0.38); filter: saturate(1); }
  50% { box-shadow: 0 0 20px rgba(255, 176, 74, 0.72); filter: saturate(1.12); }
}

@keyframes sparkPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(0.9); opacity: 0.8; }
  50% { transform: translate(-50%, -50%) scale(1.16); opacity: 1; }
}

@keyframes actionBreathe {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.06); }
}

@keyframes orbGlow {
  0%, 100% { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 0 0 0 rgba(255, 224, 160, 0.3); }
  50% { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 0 0 7px rgba(255, 224, 160, 0); }
}

@keyframes entryIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes numPop {
  0% { transform: scale(1); }
  38% { transform: scale(1.14); }
  100% { transform: scale(1); }
}

@keyframes rippleOut {
  to { transform: scale(1); opacity: 0; }
}

@keyframes floatUp {
  0% { opacity: 0; transform: translate(-50%, -74%) scale(0.88); }
  16% { opacity: 1; }
  72% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -188%) scale(1.04); }
}

@keyframes sparkFly {
  0% { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx, 0px), var(--dy, -60px)) scale(0.18); opacity: 0; }
}

@keyframes lowPulse {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-1px); }
}

@keyframes sheetShake {
  0%, 100% { transform: translateX(0); }
  18% { transform: translateX(-5px); }
  36% { transform: translateX(5px); }
  54% { transform: translateX(-3px); }
  72% { transform: translateX(3px); }
}

@keyframes maskIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(18px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ------------------------------------------------------------------ */
/* 适配                                                                */
/* ------------------------------------------------------------------ */

@media (max-height: 720px) {
  .scene { flex-basis: 42%; min-height: 250px; }
  .sheet { padding-top: 9px; }
  .grip { margin-bottom: 7px; }
  .log-head { margin-bottom: 6px; }
  .log { padding: 9px 12px; }
  .entry { font-size: 13px; line-height: 1.7; }
  .cultivate { padding-top: 9px; }
  .action { min-height: 58px; margin-top: 9px; }
  .action-copy strong { font-size: 16.5px; }
  .action-orb { width: 40px; height: 40px; }
  .poem { font-size: 11px; top: 92px; }
}

@media (max-height: 640px) {
  .scene { flex-basis: 42%; min-height: 248px; }
  .poem { display: none; }
  .stat { min-width: 98px; padding: 6px 10px 6px 6px; }
  .stat-icon { width: 27px; height: 27px; }
  .stat strong { font-size: 14px; }
  .log { min-height: 52px; }
  .log-copy strong { font-size: 14px; }
  .action-copy small { font-size: 9.5px; }
  .progress-foot { font-size: 9.5px; }
}

@media (max-width: 365px) {
  .hud { left: 12px; right: 12px; gap: 8px; }
  .stat { min-width: 96px; padding: 6px 9px 6px 6px; }
  .stat-icon { width: 27px; height: 27px; }
  .stat strong { font-size: 14px; }
  .sheet { padding-left: 13px; padding-right: 13px; }
  .action-copy strong { font-size: 16px; }
  .action-copy small { font-size: 9.5px; }
  .tap-count { font-size: 9px; padding: 3px 6px; }
  .end-card { padding: 24px 16px 16px; }
}

@media (min-width: 700px) {
  .app { max-width: 460px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
