/* =========================================================
   蛋仔奇遇记 · 界面样式
   ========================================================= */
:root {
  --ink: #332350;
  --ink-soft: #6b5d86;
  --cream: #fffdf7;
  --purple: #7c5cff;
  --purple-deep: #4b2ec0;
  --pink: #ff6f9f;
  --pink-deep: #d93d72;
  --yellow: #ffd23f;
  --mint: #59dfb0;
  --line: #3b265f;
  --shadow-soft: 0 16px 50px rgba(48, 29, 105, 0.18);
  --shadow-sticker: 0 8px 0 rgba(59, 38, 95, 0.18);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  background: #f4efff;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", "Hiragino Sans GB", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  user-select: none;
  -webkit-user-select: none;
}

button {
  border: 0;
  font-family: inherit;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible {
  outline: 3px solid #ffd23f;
  outline-offset: 3px;
}

.hidden {
  display: none !important;
}

.global-toast {
  position: fixed;
  left: 50%;
  bottom: 8%;
  z-index: 400;
  max-width: min(560px, 86vw);
  padding: 12px 22px;
  border: 3px solid var(--line);
  border-radius: 999px;
  background: #fffdf7;
  color: #3f2d60;
  font-size: 14px;
  font-weight: 800;
  text-align: center;
  box-shadow: 0 6px 0 rgba(59, 38, 95, 0.2), 0 16px 36px rgba(30, 16, 60, 0.2);
  opacity: 0;
  transform: translate(-50%, 14px);
  transition: opacity 0.22s ease, transform 0.22s ease;
  pointer-events: none;
}

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

/* ---------- 通用按钮 ---------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 12px 28px;
  border: 3px solid var(--line);
  border-radius: 999px;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.03em;
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.2s ease;
}

.btn:hover {
  filter: brightness(1.04);
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(4px);
}

.btn-primary {
  color: #fff;
  background: linear-gradient(180deg, #ff8fae 0%, #ff5f8f 55%, #f0447b 100%);
  box-shadow: 0 6px 0 #b92f5c, 0 12px 24px rgba(212, 55, 108, 0.32);
  text-shadow: 0 2px 0 rgba(138, 20, 60, 0.28);
}

.btn-primary:active {
  box-shadow: 0 2px 0 #b92f5c, 0 6px 14px rgba(212, 55, 108, 0.28);
}

.btn-primary .arrow {
  font-size: 22px;
  transition: transform 0.2s ease;
}

.btn-primary:hover .arrow {
  transform: translateX(4px);
}

.btn-xl {
  min-height: 64px;
  padding: 14px 44px;
  font-size: 22px;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  box-shadow: 0 6px 0 rgba(59, 38, 95, 0.18), 0 10px 22px rgba(59, 38, 95, 0.12);
}

.btn-ghost:active {
  box-shadow: 0 2px 0 rgba(59, 38, 95, 0.18);
}

.btn-danger {
  color: #fff;
  background: linear-gradient(180deg, #ff7a7a, #ef3f56);
  box-shadow: 0 6px 0 #a91f35;
}

.btn-block {
  width: 100%;
}

.icon-btn,
.chip-btn,
.round-back,
.pause-btn,
.text-btn,
.modal-close {
  border: 0;
  background: transparent;
}

.icon-btn {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 3px solid var(--line);
  border-radius: 50%;
  background: #fff;
  font-size: 21px;
  box-shadow: 0 4px 0 rgba(59, 38, 95, 0.2);
  transition: transform 0.15s ease;
}

.icon-btn:active {
  transform: translateY(3px);
  box-shadow: none;
}

.fs-icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.fs-btn.is-fullscreen {
  background: #fff2b0;
  color: #6b4300;
}

.pause-btn .fs-icon {
  width: 16px;
  height: 16px;
}

.fs-rotate {
  position: fixed;
  inset: 0;
  z-index: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 28px;
  background:
    radial-gradient(circle at 50% 34%, rgba(124, 92, 255, 0.35), transparent 38%),
    linear-gradient(160deg, #2d1b58, #120c24);
  color: #fffdf7;
  text-align: center;
}

.fs-rotate .rotate-phone {
  margin-bottom: 10px;
}

.fs-rotate h3 {
  margin: 0;
  font-family: "YouYuan", "Microsoft YaHei", sans-serif;
  font-size: 28px;
  letter-spacing: 0.06em;
}

.fs-rotate p {
  margin: 0 0 8px;
  color: #d7c9f2;
  font-size: 14px;
  line-height: 1.6;
}

.chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 8px 18px;
  border: 3px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 15px;
  font-weight: 800;
  box-shadow: 0 4px 0 rgba(59, 38, 95, 0.18);
  transition: transform 0.15s ease;
}

.chip-btn:hover {
  transform: translateY(-2px);
}

.chip-btn:active {
  transform: translateY(3px);
  box-shadow: none;
}

.badge {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--pink);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.text-btn {
  padding: 8px 10px;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 4px;
  opacity: 0.8;
}

.text-btn:hover {
  opacity: 1;
  color: var(--purple-deep);
}

/* ---------- 屏幕容器 ---------- */
.screen {
  position: fixed;
  inset: 0;
  display: none;
  overflow: hidden;
}

.screen.active {
  display: flex;
}

/* =========================================================
   首页
   ========================================================= */
.screen-home {
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 88% 18%, rgba(255, 232, 128, 0.95) 0 5.5%, transparent 5.7%),
    radial-gradient(circle at 78% 80%, rgba(255, 171, 202, 0.55), transparent 26%),
    linear-gradient(155deg, #7fd5ff 0%, #c6f1ff 42%, #fff3c4 100%);
}

.home-sky {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.home-sky::before {
  content: "";
  position: absolute;
  left: -10%;
  right: -10%;
  bottom: -22%;
  height: 46%;
  border-radius: 50% 50% 0 0;
  background: linear-gradient(180deg, rgba(130, 230, 184, 0.72), rgba(72, 190, 146, 0.85));
  filter: blur(1px);
}

.home-sky::after {
  content: "";
  position: absolute;
  left: -20%;
  right: -20%;
  bottom: -28%;
  height: 38%;
  border-radius: 50% 50% 0 0;
  background: rgba(56, 170, 128, 0.44);
}

.cloud {
  position: absolute;
  width: 140px;
  height: 42px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  filter: drop-shadow(0 8px 14px rgba(63, 135, 185, 0.12));
  animation: cloudDrift 16s ease-in-out infinite alternate;
}

.cloud::before,
.cloud::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: inherit;
}

.cloud::before {
  width: 58px;
  height: 58px;
  left: 22px;
  top: -30px;
}

.cloud::after {
  width: 76px;
  height: 76px;
  right: 18px;
  top: -42px;
}

.cloud-a {
  left: 6%;
  top: 15%;
}

.cloud-b {
  right: 8%;
  top: 31%;
  transform: scale(0.8);
  animation-delay: -4s;
  opacity: 0.82;
}

.cloud-c {
  left: 18%;
  top: 58%;
  transform: scale(0.58);
  animation-delay: -8s;
  opacity: 0.65;
}

.home-star {
  position: absolute;
  color: #fff6a8;
  font-size: 28px;
  text-shadow: 0 0 18px rgba(255, 240, 140, 0.9);
  animation: twinkle 2.6s ease-in-out infinite;
}

.hs-1 { left: 9%; top: 35%; font-size: 20px; animation-delay: -0.4s; }
.hs-2 { right: 14%; top: 12%; font-size: 34px; animation-delay: -1.2s; }
.hs-3 { right: 24%; top: 56%; font-size: 22px; animation-delay: -1.9s; }
.hs-4 { left: 27%; top: 8%; font-size: 16px; animation-delay: -0.9s; }

.home-sticker {
  position: absolute;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 3px solid rgba(59, 38, 95, 0.85);
  border-radius: 18px;
  background: #fffdf4;
  font-size: 28px;
  box-shadow: 0 6px 0 rgba(59, 38, 95, 0.16);
  animation: bob 4.2s ease-in-out infinite;
}

.st-1 { left: 4%; top: 52%; transform: rotate(-9deg); }
.st-2 { right: 5%; top: 46%; transform: rotate(8deg); animation-delay: -1.4s; }
.st-3 { right: 16%; bottom: 14%; transform: rotate(-6deg); animation-delay: -2.5s; }
.st-4 { left: 14%; bottom: 12%; transform: rotate(7deg); animation-delay: -0.7s; }

.home-top {
  position: absolute;
  z-index: 5;
  top: max(18px, env(safe-area-inset-top));
  right: max(20px, env(safe-area-inset-right));
  display: flex;
  align-items: center;
  gap: 10px;
}

.home-main {
  position: relative;
  z-index: 3;
  width: min(1080px, 92vw);
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 0 16px;
}

.logo-wrap {
  text-align: center;
  animation: logoDrop 0.75s cubic-bezier(0.18, 1.35, 0.4, 1) both;
}

.logo-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border: 2px solid rgba(59, 38, 95, 0.75);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  color: #52406f;
  font-size: clamp(12px, 1.4vw, 15px);
  font-weight: 900;
  letter-spacing: 0.14em;
  box-shadow: 0 4px 0 rgba(59, 38, 95, 0.12);
}

.grade-pill {
  display: inline-block;
  padding: 1px 9px;
  border-radius: 999px;
  background: var(--purple);
  color: #fff;
  letter-spacing: 0.08em;
}

.game-logo {
  margin: 8px 0 0;
  font-family: "YouYuan", "Yuanti SC", "STHupo", "Microsoft YaHei", sans-serif;
  font-size: clamp(58px, 9.2vw, 112px);
  line-height: 1.02;
  letter-spacing: 0.04em;
  color: #fffdf4;
  transform: rotate(-2deg);
  text-shadow:
    0 3px 0 #b39bff,
    0 7px 0 #7d5bf1,
    0 11px 0 #5433bf,
    0 14px 0 #3a1f8c,
    0 22px 34px rgba(49, 26, 110, 0.36);
}

.logo-sub {
  display: inline-block;
  margin-top: 4px;
  padding: 5px 26px;
  border: 3px solid #3b265f;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffe370, #ffc531);
  color: #5b3500;
  font-size: clamp(16px, 2vw, 22px);
  font-weight: 900;
  letter-spacing: 0.32em;
  text-indent: 0.32em;
  transform: rotate(1.5deg);
  box-shadow: 0 5px 0 rgba(59, 38, 95, 0.22);
}

.home-stage {
  position: relative;
  width: min(820px, 86vw);
  height: clamp(250px, 36vh, 380px);
  flex: 0 1 auto;
  margin-top: 4px;
}

.stage-glow {
  position: absolute;
  left: 50%;
  bottom: 10%;
  width: 360px;
  height: 150px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.9), rgba(255, 246, 173, 0.4) 48%, transparent 72%);
  filter: blur(6px);
}

.stage-island {
  position: absolute;
  left: 50%;
  bottom: 26px;
  width: min(320px, 40vw);
  height: 76px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 30%, #fff6b0 0 8%, #8ee2a8 35%, #48b980 70%, #2e8e63 100%);
  box-shadow:
    inset 0 -12px 0 rgba(23, 101, 68, 0.28),
    0 18px 0 rgba(31, 105, 80, 0.16),
    0 26px 44px rgba(31, 105, 80, 0.25);
}

.stage-island::before,
.stage-island::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: #fff7bf;
}

.stage-island::before {
  width: 18px;
  height: 10px;
  left: 18%;
  top: 22%;
}

.stage-island::after {
  width: 10px;
  height: 7px;
  right: 22%;
  top: 38%;
}

#mascot-canvas {
  position: absolute;
  left: 50%;
  bottom: 4px;
  width: clamp(260px, 32vh, 350px);
  height: auto;
  transform: translateX(-50%);
  filter: drop-shadow(0 18px 24px rgba(36, 84, 91, 0.22));
}

.speech-bubble {
  position: absolute;
  left: calc(50% + 108px);
  top: 12%;
  width: 220px;
  padding: 16px 20px;
  border: 3px solid #3b265f;
  border-radius: 20px;
  background: #fffdf7;
  color: #4d3a6d;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.55;
  text-align: left;
  box-shadow: 0 6px 0 rgba(59, 38, 95, 0.16);
  animation: bob 3.8s ease-in-out infinite;
}

.bubble-tail {
  position: absolute;
  left: -15px;
  bottom: 22px;
  width: 24px;
  height: 24px;
  border-left: 3px solid #3b265f;
  border-bottom: 3px solid #3b265f;
  background: #fffdf7;
  transform: rotate(45deg);
  border-radius: 0 0 0 5px;
}

.stage-chip {
  position: absolute;
  padding: 8px 15px;
  border: 3px solid #3b265f;
  border-radius: 999px;
  background: #fff;
  font-size: 14px;
  font-weight: 900;
  box-shadow: 0 4px 0 rgba(59, 38, 95, 0.16);
  animation: bob 4.6s ease-in-out infinite;
}

.chip-left {
  left: 4%;
  top: 30%;
  transform: rotate(-5deg);
}

.chip-right {
  right: 1%;
  bottom: 28%;
  transform: rotate(5deg);
  animation-delay: -2s;
}

.home-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 2px;
}

.home-hint {
  margin: 12px 0 0;
  padding: 5px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  color: #5d4b78;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-align: center;
}

.home-hint b {
  color: #3f2d60;
  font-weight: 900;
}

.party-banner {
  display: flex;
  align-items: center;
  gap: 13px;
  width: min(560px, 90vw);
  margin-top: 12px;
  padding: 9px 20px 9px 14px;
  border: 3px solid var(--line);
  border-radius: 999px;
  background: linear-gradient(100deg, #fff3b0 0%, #ffd35a 45%, #ffb347 100%);
  color: #4b2d00;
  text-align: left;
  box-shadow: 0 6px 0 #a56400, 0 14px 28px rgba(139, 91, 0, 0.24);
  transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}

.party-banner:hover {
  transform: translateY(-3px) rotate(-0.4deg);
  filter: brightness(1.03);
}

.party-banner:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #a56400;
}

.party-burst {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border: 2.5px solid rgba(75, 45, 0, 0.65);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.7);
  font-size: 25px;
}

.party-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.party-copy b {
  font-family: "YouYuan", "Microsoft YaHei", sans-serif;
  font-size: 18px;
  letter-spacing: 0.05em;
}

.party-copy small {
  color: #7c5200;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.party-go {
  margin-left: auto;
  font-size: 24px;
  font-weight: 900;
  transition: transform 0.16s ease;
}

.party-banner:hover .party-go {
  transform: translateX(4px);
}

.home-bottom {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: clamp(12px, 3vw, 36px);
  margin-top: 12px;
  padding: 9px 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(8px);
  font-size: 13px;
  font-weight: 700;
  color: #4d3f68;
}

.home-stat {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.home-stat b {
  font-size: 17px;
  color: #402d65;
}

.stat-ico {
  margin-right: 2px;
}

.home-dots {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #6a5a85;
  font-size: 12px;
  letter-spacing: 0.08em;
}

.home-dots i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #a897c6;
}

/* =========================================================
   关卡地图
   ========================================================= */
.screen-map {
  flex-direction: column;
  background-color: #f4efff;
  background-image:
    radial-gradient(circle at 18% 24%, rgba(255, 255, 255, 0.92), transparent 30%),
    radial-gradient(circle at 82% 8%, rgba(255, 226, 132, 0.3), transparent 26%),
    radial-gradient(#d9ccff 1.2px, transparent 1.3px);
  background-size: auto, auto, 26px 26px;
}

.map-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: max(20px, env(safe-area-inset-top)) clamp(20px, 4vw, 56px) 8px;
}

.round-back {
  width: 50px;
  height: 50px;
  flex: 0 0 auto;
  border: 3px solid var(--line);
  border-radius: 50%;
  background: #fff;
  font-size: 24px;
  font-weight: 900;
  box-shadow: 0 5px 0 rgba(59, 38, 95, 0.18);
  transition: transform 0.15s ease;
}

.round-back:active {
  transform: translateY(3px);
  box-shadow: none;
}

.map-title h2 {
  margin: 0;
  font-family: "YouYuan", "Microsoft YaHei", sans-serif;
  font-size: clamp(26px, 3vw, 38px);
  letter-spacing: 0.04em;
}

.map-title p {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 600;
}

.map-stars {
  margin-left: auto;
  display: flex;
  align-items: baseline;
  gap: 5px;
  padding: 9px 20px;
  border: 3px solid var(--line);
  border-radius: 999px;
  background: #fff9dd;
  box-shadow: 0 5px 0 rgba(59, 38, 95, 0.16);
  font-size: 16px;
  font-weight: 800;
}

.map-stars b {
  font-size: 22px;
  color: #b07800;
}

.map-stars span {
  color: var(--ink-soft);
  font-size: 13px;
}

.skin-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px clamp(20px, 4vw, 56px) 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.skin-bar::-webkit-scrollbar {
  display: none;
}

.skin-label {
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}

.skin-list {
  display: flex;
  gap: 9px;
  flex: 0 0 auto;
}

.skin-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px 5px 7px;
  border: 2.5px solid #cfc3e4;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  font-size: 13px;
  font-weight: 800;
  transition: all 0.15s ease;
}

.skin-chip:hover {
  border-color: var(--purple);
  transform: translateY(-2px);
}

.skin-chip.active {
  border-color: var(--line);
  background: #fff3b5;
  box-shadow: 0 3px 0 rgba(59, 38, 95, 0.16);
}

.skin-chip.locked {
  opacity: 0.62;
}

.skin-lock {
  font-size: 10px;
  color: #8b6c1f;
  white-space: nowrap;
}

.skin-egg {
  position: relative;
  display: inline-block;
  width: 24px;
  height: 29px;
  border: 2px solid #3b265f;
  border-radius: 50% 50% 46% 46% / 58% 58% 42% 42%;
  background: linear-gradient(150deg, var(--s1), var(--s2));
  box-shadow: inset -3px -4px 0 rgba(0, 0, 0, 0.1);
}

.skin-egg::before,
.skin-egg::after {
  content: "";
  position: absolute;
  top: 11px;
  width: 3px;
  height: 4px;
  border-radius: 50%;
  background: #39255e;
}

.skin-egg::before { left: 6px; }
.skin-egg::after { right: 6px; }

.skin-tip {
  flex: 0 0 auto;
  color: #8b7ba5;
  font-size: 12px;
  font-weight: 600;
}

.level-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(12px, 1.5vw, 20px);
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 14px clamp(20px, 4vw, 56px) 10px;
  overflow-y: auto;
  align-content: start;
  scrollbar-width: thin;
}

.level-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 0;
  border: 3px solid var(--line);
  border-radius: 24px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 8px 0 rgba(59, 38, 95, 0.18), 0 16px 30px rgba(59, 38, 95, 0.1);
  text-align: left;
  transition: transform 0.18s cubic-bezier(0.2, 1.2, 0.4, 1), box-shadow 0.18s ease;
}

.level-card:hover {
  transform: translateY(-6px) rotate(-0.6deg);
  box-shadow: 0 12px 0 rgba(59, 38, 95, 0.16), 0 22px 38px rgba(59, 38, 95, 0.16);
}

.level-card:active {
  transform: translateY(2px);
  box-shadow: 0 4px 0 rgba(59, 38, 95, 0.2);
}

.level-card.locked {
  filter: saturate(0.4);
}

.level-card.locked .level-thumb {
  opacity: 0.82;
}

.level-thumb {
  position: relative;
  height: clamp(104px, 15vh, 158px);
  background: linear-gradient(155deg, var(--c1), var(--c2));
  overflow: hidden;
}

.level-thumb::before {
  content: "";
  position: absolute;
  width: 120px;
  height: 120px;
  right: -28px;
  top: -34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
}

.level-thumb::after {
  content: "";
  position: absolute;
  left: -20%;
  right: -20%;
  bottom: -46%;
  height: 74%;
  border-radius: 50% 50% 0 0;
  background: rgba(255, 255, 255, 0.22);
}

.level-index {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 2;
  padding: 3px 10px;
  border: 2px solid rgba(59, 38, 95, 0.78);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.level-icon {
  position: absolute;
  right: 14px;
  bottom: 6px;
  z-index: 2;
  font-size: clamp(44px, 5vw, 64px);
  filter: drop-shadow(0 5px 0 rgba(59, 38, 95, 0.14));
  transform: rotate(-4deg);
}

.thumb-gate {
  position: absolute;
  left: 16px;
  bottom: 14px;
  z-index: 2;
  font-size: 34px;
  opacity: 0.9;
}

.level-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 14px 14px;
}

.level-body h3 {
  margin: 0;
  font-family: "YouYuan", "Microsoft YaHei", sans-serif;
  font-size: clamp(18px, 1.6vw, 22px);
  letter-spacing: 0.03em;
}

.level-body p {
  margin: 0;
  min-height: 34px;
  color: var(--ink-soft);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.45;
}

.level-stars {
  display: flex;
  gap: 3px;
  margin-top: 4px;
  font-size: 17px;
  letter-spacing: 1px;
}

.mini-star {
  color: #d9d2e6;
}

.mini-star.on {
  color: #ffbe1a;
  text-shadow: 0 2px 0 #d08c00;
}

.lock-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 2.5px solid var(--line);
  border-radius: 50%;
  background: #ede7fa;
  font-size: 17px;
}

.map-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px clamp(20px, 4vw, 56px) max(16px, env(safe-area-inset-bottom));
}

.map-tips {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 4px clamp(20px, 4vw, 56px) 0;
}

.map-tip-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 2px solid #ded3f0;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 3px 0 rgba(59, 38, 95, 0.06);
}

.tip-ico {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: #fff3c5;
  font-size: 19px;
}

.map-tip-card b {
  display: block;
  margin-bottom: 1px;
  font-size: 12px;
  color: #4b356d;
}

.map-tip-card p {
  margin: 0;
  color: #7d6d95;
  font-size: 11px;
  line-height: 1.5;
}

.map-footer .text-btn {
  margin-left: auto;
}

/* =========================================================
   游戏画面
   ========================================================= */
.screen-game {
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 50% 20%, #3c2b6e 0%, #1d1338 58%, #120c24 100%);
}

.rotate-hint {
  display: none;
}

@media (max-width: 900px) and (orientation: portrait) {
  .screen-game:not(.portrait-ok) .rotate-hint {
    display: flex;
  }

  .screen-game:not(.portrait-ok) .game-shell {
    visibility: hidden;
  }

  .screen-game.portrait-ok .rotate-hint {
    display: none;
  }

  .screen-game.portrait-ok .mobile-controls {
    bottom: 2px;
    padding: 0 8px;
  }

  .screen-game.portrait-ok .ctrl-btn {
    width: 46px;
    height: 46px;
    font-size: 17px;
    border-width: 2px;
  }

  .screen-game.portrait-ok .toast {
    top: 6%;
    font-size: 9px;
    padding: 5px 9px;
  }
}

.rotate-hint {
  position: absolute;
  inset: 0;
  z-index: 60;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 32px;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.16), transparent 34%),
    linear-gradient(160deg, #38236b, #17102f);
  color: #fffdf7;
  text-align: center;
}

.rotate-hint::before,
.rotate-hint::after {
  content: "✦";
  position: absolute;
  color: #ffe27a;
  font-size: 28px;
  animation: twinkle 2.4s ease-in-out infinite;
}

.rotate-hint::before {
  left: 18%;
  top: 22%;
}

.rotate-hint::after {
  right: 18%;
  bottom: 24%;
  animation-delay: -1.2s;
}

.rotate-phone {
  position: relative;
  width: 58px;
  height: 96px;
  margin-bottom: 8px;
  border: 5px solid #fffdf7;
  border-radius: 14px;
  background: linear-gradient(160deg, #8f6bff, #ff8fbc);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.35);
  animation: phoneTurn 2.4s ease-in-out infinite;
}

.rotate-phone::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 7px;
  width: 15px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  transform: translateX(-50%);
}

.rotate-phone::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 6px;
  width: 18px;
  height: 3px;
  border-radius: 999px;
  background: rgba(59, 38, 95, 0.5);
  transform: translateX(-50%);
}

.rotate-phone span {
  position: absolute;
  inset: 16px 6px 14px;
  border-radius: 5px;
  background:
    radial-gradient(circle at 30% 30%, #fff3a8 0 18%, transparent 19%),
    radial-gradient(circle at 70% 68%, #8ff0cd 0 16%, transparent 17%),
    rgba(255, 255, 255, 0.18);
}

.rotate-hint h3 {
  margin: 4px 0 0;
  font-family: "YouYuan", "Microsoft YaHei", sans-serif;
  font-size: 26px;
  letter-spacing: 0.06em;
}

.rotate-hint p {
  margin: 0 0 8px;
  color: #d7c9f2;
  font-size: 14px;
}

@keyframes phoneTurn {
  0%, 24% { transform: rotate(0deg); }
  55%, 80% { transform: rotate(90deg); }
  100% { transform: rotate(0deg); }
}

.game-shell {
  position: relative;
  width: min(100vw, calc(100dvh * 16 / 9));
  aspect-ratio: 16 / 9;
  max-height: 100dvh;
  background: #8edcff;
  overflow: hidden;
  border-radius: clamp(0px, 1.4vw, 22px);
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.45);
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.hud {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: max(14px, 2.1vh) clamp(14px, 2vw, 26px);
  pointer-events: none;
}

.hud-left {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.hud-level {
  align-self: flex-start;
  padding: 6px 15px;
  border: 2.5px solid rgba(59, 38, 95, 0.86);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  font-size: clamp(12px, 1.2vw, 15px);
  font-weight: 900;
  letter-spacing: 0.04em;
  box-shadow: 0 4px 0 rgba(59, 38, 95, 0.16);
  backdrop-filter: blur(5px);
}

.hearts {
  align-self: flex-start;
  display: flex;
  gap: 2px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  font-size: clamp(14px, 1.5vw, 20px);
  line-height: 1.25;
  box-shadow: 0 3px 0 rgba(59, 38, 95, 0.12);
}

.hud-center {
  position: absolute;
  left: 50%;
  top: max(14px, 2.1vh);
  width: min(31vw, 340px);
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
}

.progress-track {
  width: 100%;
  height: 11px;
  padding: 2px;
  border: 2px solid rgba(59, 38, 95, 0.72);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.64);
  overflow: hidden;
  box-shadow: 0 3px 0 rgba(59, 38, 95, 0.14);
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #ffd23f, #ff8fb1, #8b6bff);
  transition: width 0.2s linear;
}

.gate-dots {
  display: flex;
  align-items: center;
  gap: 5px;
}

.gate-dot {
  display: grid;
  place-items: center;
  width: clamp(19px, 1.8vw, 24px);
  height: clamp(19px, 1.8vw, 24px);
  border: 2px solid rgba(255, 255, 255, 0.86);
  border-radius: 50%;
  background: rgba(59, 38, 95, 0.34);
  color: #fff;
  font-size: clamp(9px, 0.85vw, 11px);
  font-weight: 900;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.16);
}

.gate-dot.ok {
  background: #35c983;
  border-color: #d9ffe9;
}

.gate-dot.warn {
  background: #ffa62b;
  border-color: #fff0c9;
}

.hud-right {
  display: flex;
  align-items: center;
  gap: 7px;
}

.hud-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 7px 12px;
  border: 2.5px solid rgba(59, 38, 95, 0.84);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  font-size: clamp(11px, 1vw, 14px);
  font-weight: 800;
  box-shadow: 0 3px 0 rgba(59, 38, 95, 0.14);
  backdrop-filter: blur(5px);
}

.hud-pill b {
  font-size: clamp(13px, 1.2vw, 17px);
}

.race-hud {
  position: absolute;
  left: clamp(14px, 2vw, 26px);
  top: clamp(98px, 14vh, 126px);
  z-index: 6;
  width: clamp(156px, 15vw, 190px);
  padding: 8px 10px 9px;
  border: 2.5px solid rgba(59, 38, 95, 0.82);
  border-radius: 17px;
  background: rgba(255, 253, 247, 0.9);
  box-shadow: 0 4px 0 rgba(59, 38, 95, 0.18);
  backdrop-filter: blur(6px);
  pointer-events: none;
}

.race-rank-line {
  padding-bottom: 5px;
  border-bottom: 1.5px dashed rgba(59, 38, 95, 0.2);
  color: #4b356d;
  font-size: clamp(10px, 0.9vw, 12px);
  font-weight: 900;
  white-space: nowrap;
}

.race-rank-line b {
  display: inline-block;
  min-width: 18px;
  color: #e04472;
  font-size: clamp(15px, 1.4vw, 19px);
  text-align: center;
}

.race-rank-line span {
  color: #8b7ba5;
  font-size: 10px;
}

.race-rank-line i {
  font-style: normal;
}

.race-list {
  display: grid;
  gap: 2px;
  margin-top: 5px;
}

.race-row {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 2px 4px;
  border-radius: 7px;
  color: #5d4b78;
  font-size: clamp(9px, 0.82vw, 11px);
  font-weight: 700;
  line-height: 1.35;
}

.race-row.me {
  background: #fff1a8;
  color: #4a2e00;
}

.race-row .race-pos {
  width: 13px;
  flex: 0 0 auto;
  color: #9b8bb2;
  font-size: 9px;
  font-weight: 900;
  text-align: center;
}

.race-row .race-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border: 1.5px solid #3b265f;
  border-radius: 50%;
}

.race-row .race-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.race-row .race-state {
  flex: 0 0 auto;
  color: #1f9b62;
  font-size: 9px;
  font-weight: 900;
}

.race-row.finished .race-name {
  color: #1f9b62;
}

.pause-btn {
  display: grid;
  place-items: center;
  width: clamp(36px, 3.1vw, 44px);
  height: clamp(36px, 3.1vw, 44px);
  border: 2.5px solid rgba(59, 38, 95, 0.84);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  font-size: clamp(13px, 1.2vw, 17px);
  box-shadow: 0 3px 0 rgba(59, 38, 95, 0.16);
  pointer-events: auto;
}

.pause-btn:active {
  transform: translateY(2px);
  box-shadow: none;
}

.toast {
  position: absolute;
  left: 50%;
  top: 15%;
  z-index: 8;
  max-width: min(680px, 86%);
  padding: 11px 22px;
  border: 2.5px solid rgba(59, 38, 95, 0.86);
  border-radius: 999px;
  background: rgba(255, 253, 247, 0.96);
  color: #3f2d60;
  font-size: clamp(12px, 1.15vw, 15px);
  font-weight: 800;
  text-align: center;
  box-shadow: 0 5px 0 rgba(59, 38, 95, 0.16);
  opacity: 0;
  transform: translate(-50%, -12px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}

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

.mobile-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 6;
  display: none;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0 18px;
  pointer-events: none;
}

.pad-group {
  display: flex;
  gap: 10px;
  pointer-events: auto;
}

.ctrl-btn {
  display: grid;
  place-items: center;
  width: clamp(54px, 8vh, 72px);
  height: clamp(54px, 8vh, 72px);
  border: 3px solid rgba(59, 38, 95, 0.9);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.84);
  color: #3d2b5e;
  font-size: clamp(20px, 3vh, 28px);
  font-weight: 900;
  box-shadow: 0 5px 0 rgba(59, 38, 95, 0.28);
  touch-action: none;
  backdrop-filter: blur(4px);
}

.ctrl-btn:active,
.ctrl-btn.pressed {
  transform: translateY(4px);
  box-shadow: 0 1px 0 rgba(59, 38, 95, 0.3);
  background: rgba(255, 224, 110, 0.92);
}

.ctrl-jump {
  background: rgba(255, 220, 92, 0.9);
}

.ctrl-dash {
  font-size: clamp(18px, 2.6vh, 24px);
}

/* =========================================================
   弹窗与答题
   ========================================================= */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(36, 22, 68, 0.58);
  backdrop-filter: blur(7px);
}

.modal.open {
  display: flex;
  animation: fadeIn 0.2s ease both;
}

.quiz-card {
  position: relative;
  width: min(760px, 94vw);
  max-height: 92dvh;
  overflow-y: auto;
  padding: clamp(20px, 3vw, 34px);
  border: 4px solid var(--line);
  border-radius: 30px;
  background:
    radial-gradient(circle at 100% 0, rgba(255, 221, 92, 0.22), transparent 28%),
    var(--cream);
  box-shadow: 0 14px 0 rgba(37, 21, 72, 0.24), 0 34px 90px rgba(0, 0, 0, 0.32);
  animation: popIn 0.36s cubic-bezier(0.18, 1.35, 0.4, 1) both;
  scrollbar-width: thin;
}

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

.quiz-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border: 2.5px solid var(--line);
  border-radius: 999px;
  background: var(--tag-soft, #e5f5ff);
  color: var(--tag-color, #1d6fa8);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.quiz-progress {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 800;
}

.quiz-gate-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  color: #8b78a8;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.18em;
}

.quiz-gate-line i {
  flex: 1;
  height: 2px;
  background: repeating-linear-gradient(90deg, #ded4ef 0 8px, transparent 8px 14px);
}

.gate-mark {
  display: inline-grid;
  place-items: center;
  width: 17px;
  height: 17px;
  margin-right: 3px;
  border-radius: 5px;
  background: #ffc43d;
  color: #5a3500;
  font-size: 10px;
  font-weight: 900;
  vertical-align: -3px;
}

.quiz-stem {
  margin: 12px 0 18px;
  font-size: clamp(19px, 2.2vw, 25px);
  font-weight: 900;
  line-height: 1.62;
  letter-spacing: 0.01em;
}

.quiz-stem b {
  color: #d63570;
  background: linear-gradient(180deg, transparent 62%, #ffe49c 62%);
  padding: 0 2px;
}

.dot {
  position: relative;
  font-style: normal;
  font-weight: inherit;
}

.dot::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -0.12em;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #e83e6d;
  transform: translateX(-50%);
}

.quiz-options {
  display: grid;
  gap: 10px;
}

.quiz-option {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  padding: 12px 16px;
  border: 2.5px solid #d9d0eb;
  border-radius: 16px;
  background: #fff;
  color: #38264f;
  font-size: clamp(15px, 1.6vw, 18px);
  font-weight: 700;
  line-height: 1.45;
  text-align: left;
  transition: border-color 0.14s ease, transform 0.14s ease, background 0.14s ease, opacity 0.14s ease;
}

.quiz-option:hover:not(:disabled) {
  border-color: var(--purple);
  background: #faf7ff;
  transform: translateX(3px);
}

.quiz-option:disabled {
  cursor: default;
}

.opt-letter {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border: 2px solid #cdbfe6;
  border-radius: 10px;
  background: #f7f3ff;
  color: #6e57a0;
  font-size: 14px;
  font-weight: 900;
}

.quiz-option.correct {
  border-color: #1fae6b;
  background: #e2fbee;
  box-shadow: 0 3px 0 rgba(31, 174, 107, 0.2);
}

.quiz-option.correct .opt-letter {
  border-color: #1fae6b;
  background: #1fae6b;
  color: #fff;
}

.quiz-option.wrong {
  border-color: #ef476f;
  background: #ffe8ed;
  box-shadow: 0 3px 0 rgba(239, 71, 111, 0.18);
}

.quiz-option.wrong .opt-letter {
  border-color: #ef476f;
  background: #ef476f;
  color: #fff;
}

.quiz-option.dim {
  opacity: 0.5;
}

.quiz-feedback {
  margin-top: 16px;
  padding: 16px 18px;
  border: 2.5px solid #c9b9e9;
  border-radius: 18px;
  background: #f4eeff;
  animation: slideUp 0.28s ease both;
}

.quiz-feedback.correct {
  border-color: #63d69d;
  background: #e9fff3;
}

.quiz-feedback.wrong {
  border-color: #f29aae;
  background: #fff0f3;
}

.feedback-title {
  margin-bottom: 4px;
  font-size: 18px;
  font-weight: 900;
}

.quiz-feedback.correct .feedback-title {
  color: #117d4b;
}

.quiz-feedback.wrong .feedback-title {
  color: #c22a4d;
}

.feedback-explain {
  margin: 0 0 14px;
  color: #56446f;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.7;
}

.feedback-explain b {
  color: #b0244d;
}

.quiz-hint {
  margin-top: 13px;
  color: #a396b8;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.08em;
}

/* ---------- 小型弹窗 ---------- */
.mini-card {
  width: min(400px, 92vw);
  padding: 30px 28px 24px;
  border: 4px solid var(--line);
  border-radius: 28px;
  background: var(--cream);
  box-shadow: 0 14px 0 rgba(37, 21, 72, 0.24), 0 30px 70px rgba(0, 0, 0, 0.3);
  text-align: center;
  animation: popIn 0.34s cubic-bezier(0.18, 1.35, 0.4, 1) both;
}

.mini-emoji {
  font-size: 48px;
  line-height: 1;
  margin-bottom: 6px;
}

.mini-card h3 {
  margin: 0 0 8px;
  font-family: "YouYuan", "Microsoft YaHei", sans-serif;
  font-size: 26px;
}

.mini-card p {
  margin: 0 0 20px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.65;
}

.mini-actions {
  display: grid;
  gap: 10px;
}

/* =========================================================
   结算画面
   ========================================================= */
.screen-result {
  align-items: center;
  justify-content: center;
  padding: 16px;
  background:
    radial-gradient(circle at 20% 18%, rgba(255, 255, 255, 0.55), transparent 28%),
    radial-gradient(circle at 82% 22%, rgba(255, 232, 128, 0.38), transparent 26%),
    linear-gradient(150deg, var(--r1, #8fdcff), var(--r2, #fff3c4));
}

.result-card {
  position: relative;
  z-index: 3;
  width: min(760px, 94vw);
  max-height: 94dvh;
  overflow-y: auto;
  padding: clamp(22px, 3.4vw, 36px);
  border: 4px solid var(--line);
  border-radius: 32px;
  background: var(--cream);
  box-shadow: 0 16px 0 rgba(37, 21, 72, 0.22), 0 34px 90px rgba(0, 0, 0, 0.28);
  text-align: center;
  animation: popIn 0.5s cubic-bezier(0.18, 1.35, 0.4, 1) both;
  scrollbar-width: thin;
}

.result-eyebrow {
  display: inline-block;
  padding: 4px 15px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: #ffe897;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.result-card h2 {
  margin: 12px 0 4px;
  font-family: "YouYuan", "Microsoft YaHei", sans-serif;
  font-size: clamp(28px, 3.8vw, 42px);
  letter-spacing: 0.04em;
}

.result-fs-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 2.5px solid #3b265f;
  border-radius: 50%;
  background: #fff;
  color: #3b265f;
  box-shadow: 0 3px 0 rgba(59, 38, 95, 0.16);
}

.result-fs-btn:hover {
  background: #fff3b5;
}

.result-sub {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.6;
}

.party-result {
  margin: 10px 0 0;
}

.party-verdict {
  display: inline-block;
  padding: 6px 16px;
  border: 2.5px solid #3b265f;
  border-radius: 999px;
  background: #fff2ad;
  color: #664000;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.5;
  box-shadow: 0 3px 0 rgba(59, 38, 95, 0.14);
}

.party-podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(7px, 1.4vw, 16px);
  min-height: 158px;
  margin: 8px 0 0;
}

.podium-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: clamp(78px, 9vw, 112px);
}

.podium-egg {
  position: relative;
  width: clamp(40px, 4.4vw, 56px);
  height: clamp(48px, 5.3vw, 68px);
  margin-bottom: -2px;
  border: 3px solid #3b265f;
  border-radius: 50% 50% 45% 45% / 58% 58% 42% 42%;
  background: linear-gradient(150deg, var(--e1, #fff4a8), var(--e2, #ffd23f));
  box-shadow: inset -5px -7px 0 rgba(0, 0, 0, 0.08), 0 4px 0 rgba(59, 38, 95, 0.12);
}

.podium-egg::before,
.podium-egg::after {
  content: "";
  position: absolute;
  top: 42%;
  width: 5px;
  height: 7px;
  border-radius: 50%;
  background: #342049;
}

.podium-egg::before { left: 31%; }
.podium-egg::after { right: 31%; }

.podium-slot.place-1 .podium-egg {
  width: clamp(52px, 5.7vw, 72px);
  height: clamp(62px, 6.8vw, 88px);
}

.podium-slot.is-player .podium-egg {
  outline: 4px solid #ffd23f;
  outline-offset: 3px;
  animation: winnerPop 1.8s ease-in-out infinite;
}

.podium-slot.place-1 .podium-egg {
  box-shadow: inset -5px -7px 0 rgba(0, 0, 0, 0.08), 0 0 0 5px rgba(255, 210, 63, 0.36), 0 6px 0 rgba(59, 38, 95, 0.14);
}

.podium-name {
  width: 100%;
  margin-top: 5px;
  overflow: hidden;
  color: #4b356d;
  font-size: 10.5px;
  font-weight: 900;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.podium-block {
  display: grid;
  place-items: center;
  width: 100%;
  margin-top: 4px;
  border: 2.5px solid #3b265f;
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
  background: linear-gradient(180deg, #e8dcff, #c9b6f2);
  color: #4a2e78;
  font-size: 16px;
  font-weight: 900;
  box-shadow: inset 0 5px 0 rgba(255, 255, 255, 0.4);
}

.podium-slot.place-1 .podium-block {
  height: 72px;
  background: linear-gradient(180deg, #ffe98f, #ffc21a);
  color: #6b4300;
}

.podium-slot.place-2 .podium-block {
  height: 52px;
}

.podium-slot.place-3 .podium-block {
  height: 38px;
}

.podium-slot.empty {
  visibility: hidden;
  opacity: 0;
}

@keyframes winnerPop {
  0%, 100% { transform: translateY(0) rotate(-1.5deg); }
  50% { transform: translateY(-5px) rotate(1.5deg); }
}

.big-stars {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
  min-height: 86px;
  margin: 8px 0 2px;
}

.big-stars .star {
  display: inline-block;
  font-size: clamp(48px, 6vw, 68px);
  line-height: 1;
  color: #dcd5e8;
  transform: scale(0.75);
  opacity: 0.7;
  text-shadow: 0 4px 0 rgba(59, 38, 95, 0.1);
}

.big-stars .star.on {
  color: #ffc21a;
  opacity: 1;
  text-shadow: 0 5px 0 #d48b00, 0 10px 20px rgba(212, 139, 0, 0.3);
  animation: starPop 0.55s cubic-bezier(0.18, 1.6, 0.4, 1) both;
  animation-delay: var(--d, 0s);
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 14px 0;
}

.rs-item {
  padding: 12px 8px;
  border: 2.5px solid #e2d9f0;
  border-radius: 16px;
  background: #fbf8ff;
}

.rs-item span {
  display: block;
  margin-bottom: 3px;
  color: #8d7da7;
  font-size: 11px;
  font-weight: 700;
}

.rs-item b {
  font-size: clamp(17px, 2vw, 22px);
  color: #402d65;
}

.result-wrong {
  margin: 6px 0 14px;
  text-align: left;
}

.result-wrong-title {
  margin: 0 0 8px;
  color: #9d3150;
  font-size: 13px;
  font-weight: 900;
}

.wrong-mini {
  margin-bottom: 7px;
  padding: 10px 13px;
  border: 2px solid #ffd2db;
  border-radius: 13px;
  background: #fff5f7;
  font-size: 12px;
  line-height: 1.55;
}

.wrong-mini b {
  color: #b52b4d;
}

.wrong-mini span {
  color: #6c587d;
}

.result-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.result-total {
  margin-top: 14px;
  color: #8d7da7;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.result-confetti {
  position: fixed;
  inset: 0;
  z-index: 2;
  overflow: hidden;
  pointer-events: none;
}

.confetti-piece {
  position: absolute;
  top: -24px;
  width: 10px;
  height: 16px;
  border-radius: 3px;
  animation: confettiFall linear forwards;
}

/* =========================================================
   语文图鉴 / 错题本
   ========================================================= */
.guide-card {
  position: relative;
  width: min(880px, 94vw);
  max-height: 90dvh;
  overflow-y: auto;
  padding: clamp(22px, 3vw, 34px);
  border: 4px solid var(--line);
  border-radius: 30px;
  background:
    radial-gradient(circle at 92% 4%, rgba(255, 225, 112, 0.3), transparent 24%),
    var(--cream);
  box-shadow: 0 14px 0 rgba(37, 21, 72, 0.22), 0 34px 80px rgba(0, 0, 0, 0.3);
  animation: popIn 0.36s cubic-bezier(0.18, 1.35, 0.4, 1) both;
  scrollbar-width: thin;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 2.5px solid var(--line);
  border-radius: 50%;
  background: #fff;
  font-size: 15px;
  font-weight: 900;
  box-shadow: 0 3px 0 rgba(59, 38, 95, 0.16);
}

.guide-kicker {
  color: #8d7da7;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.18em;
}

.guide-card h3 {
  margin: 4px 0 6px;
  font-family: "YouYuan", "Microsoft YaHei", sans-serif;
  font-size: clamp(26px, 3vw, 34px);
}

.guide-intro {
  margin: 0 0 18px;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.7;
}

.guide-list {
  display: grid;
  gap: 10px;
}

.guide-item {
  display: flex;
  gap: 13px;
  padding: 14px 16px;
  border: 2.5px solid #e2d9f0;
  border-radius: 18px;
  background: #fff;
}

.guide-num {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: var(--g-soft, #f1ebff);
  font-size: 23px;
}

.guide-item h4 {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 900;
}

.guide-item ul {
  margin: 0;
  padding-left: 17px;
  color: #5f4d78;
  font-size: 12.5px;
  line-height: 1.7;
}

.guide-item li::marker {
  color: var(--g-color, #7c5cff);
}

.review-card {
  width: min(820px, 94vw);
}

.review-list {
  display: grid;
  gap: 10px;
  margin: 4px 0 12px;
}

.review-item {
  padding: 13px 16px;
  border: 2.5px solid #f2d9a2;
  border-radius: 16px;
  background: #fffaf0;
}

.review-item .review-tag {
  display: inline-block;
  margin-bottom: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  background: #ffe7a6;
  color: #855900;
  font-size: 10px;
  font-weight: 900;
}

.review-item h4 {
  margin: 0 0 6px;
  font-size: 14px;
  line-height: 1.6;
}

.review-item .answer-line {
  color: #1c7f53;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.6;
}

.review-item .review-explain {
  margin: 4px 0 0;
  color: #6c587d;
  font-size: 11.5px;
  line-height: 1.65;
}

.review-empty {
  padding: 34px 20px;
  border: 2.5px dashed #d9cdef;
  border-radius: 18px;
  color: #9384aa;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
}

.review-actions {
  display: flex;
  justify-content: flex-end;
}

/* =========================================================
   动画
   ========================================================= */
@keyframes cloudDrift {
  from { transform: translateX(-12px); }
  to { transform: translateX(24px); }
}

@keyframes bob {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -9px; }
}

@keyframes twinkle {
  0%, 100% { opacity: 0.45; transform: scale(0.85) rotate(0deg); }
  50% { opacity: 1; transform: scale(1.15) rotate(12deg); }
}

@keyframes logoDrop {
  from { opacity: 0; transform: translateY(-28px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

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

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

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

@keyframes starPop {
  from { opacity: 0; transform: scale(0.2) rotate(-24deg); }
  70% { transform: scale(1.2) rotate(6deg); }
  to { opacity: 1; transform: scale(1) rotate(0); }
}

@keyframes confettiFall {
  to { transform: translate3d(var(--dx, 0px), 108vh, 0) rotate(var(--rot, 540deg)); }
}

/* =========================================================
   响应式
   ========================================================= */
@media (pointer: coarse), (max-width: 900px) {
  .mobile-controls {
    display: flex;
  }

  .race-hud {
    top: 104px;
    left: 10px;
    width: auto;
    padding: 4px 9px;
    border-radius: 999px;
  }

  .race-rank-line {
    padding-bottom: 0;
    border-bottom: 0;
  }

  .race-list {
    display: none;
  }
}

@media (max-width: 1100px) {
  .level-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .speech-bubble {
    left: calc(50% + 82px);
    width: 190px;
    font-size: 15px;
  }
}

@media (max-width: 760px) {
  .screen-home {
    overflow-y: auto;
  }

  .home-main {
    width: 94vw;
    height: auto;
    min-height: 100%;
    justify-content: flex-start;
    padding-top: max(56px, env(safe-area-inset-top));
    padding-bottom: 18px;
  }

  .game-logo {
    font-size: clamp(50px, 15vw, 72px);
  }

  .logo-kicker {
    font-size: 11px;
    letter-spacing: 0.08em;
  }

  .home-stage {
    width: 100%;
    height: 240px;
    margin-top: 0;
  }

  #mascot-canvas {
    width: 230px;
  }

  .stage-island {
    width: 220px;
    height: 54px;
    bottom: 22px;
  }

  .speech-bubble {
    left: auto;
    right: 2%;
    top: 8%;
    width: 148px;
    padding: 10px 12px;
    font-size: 12px;
    border-width: 2.5px;
  }

  .bubble-tail {
    width: 18px;
    height: 18px;
    left: -12px;
    bottom: 16px;
    border-width: 0 0 2.5px 2.5px;
  }

  .stage-chip {
    font-size: 11px;
    padding: 5px 9px;
    border-width: 2.5px;
  }

  .chip-left { left: 0; top: 40%; }
  .chip-right { right: 0; bottom: 18%; }

  .home-actions {
    flex-direction: column;
    width: 100%;
    gap: 10px;
  }

  .home-actions .btn {
    width: min(320px, 88vw);
  }

  .home-hint {
    max-width: 88vw;
    font-size: 9.5px;
    line-height: 1.6;
    border-radius: 12px;
    margin-top: 9px;
  }

  .party-banner {
    width: 88vw;
    margin-top: 9px;
    padding: 7px 13px 7px 9px;
    gap: 9px;
  }

  .party-burst {
    width: 38px;
    height: 38px;
    font-size: 21px;
  }

  .party-copy b {
    font-size: 15px;
  }

  .party-copy small {
    font-size: 9px;
  }

  .party-go {
    font-size: 20px;
  }

  .home-bottom {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 88vw;
    border-radius: 18px;
    gap: 7px 10px;
    padding: 11px 14px;
    font-size: 12px;
  }

  .home-stat {
    justify-content: center;
  }

  .home-stat:last-child {
    grid-column: 1 / -1;
  }

  .home-dots {
    display: none;
  }

  .home-top {
    top: 12px;
    right: 12px;
  }

  .icon-btn {
    width: 42px;
    height: 42px;
  }

  .chip-btn {
    min-height: 42px;
    font-size: 13px;
    padding: 6px 12px;
  }

  .map-header {
    gap: 12px;
    padding: 16px 16px 4px;
  }

  .map-title h2 {
    font-size: 24px;
  }

  .map-title p {
    display: none;
  }

  .map-stars {
    padding: 6px 12px;
  }

  .map-stars b {
    font-size: 18px;
  }

  .skin-bar {
    padding: 6px 16px 2px;
  }

  .skin-tip {
    display: none;
  }

  .level-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 10px 16px;
  }

  .level-thumb {
    height: 104px;
  }

  .level-body {
    padding: 9px 10px 11px;
  }

  .level-body p {
    font-size: 10.5px;
    min-height: 30px;
  }

  .level-icon {
    font-size: 42px;
  }

  .map-footer {
    padding: 8px 16px max(12px, env(safe-area-inset-bottom));
    flex-wrap: wrap;
  }

  .map-tips {
    display: none;
  }

  .map-footer .text-btn {
    margin-left: 0;
  }

  .hud {
    padding: 9px 10px;
  }

  .hud-level {
    padding: 4px 10px;
    border-width: 2px;
    font-size: 11px;
  }

  .hearts {
    font-size: 12px;
    padding: 2px 7px;
  }

  .hud-center {
    top: 10px;
    width: 34vw;
  }

  .progress-track {
    height: 8px;
    border-width: 1.5px;
  }

  .gate-dots {
    display: none;
  }

  .hud-right {
    gap: 4px;
  }

  .hud-pill {
    padding: 4px 7px;
    font-size: 10px;
    border-width: 2px;
    gap: 2px;
  }

  .hud-pill b {
    font-size: 11px;
  }

  .pause-btn {
    width: 30px;
    height: 30px;
    font-size: 11px;
    border-width: 2px;
  }

  .toast {
    top: 13%;
    padding: 8px 13px;
    font-size: 11px;
  }

  .quiz-card {
    border-width: 3px;
    border-radius: 22px;
    padding: 18px 16px;
  }

  .quiz-stem {
    font-size: 18px;
  }

  .quiz-option {
    padding: 10px 11px;
    gap: 9px;
    font-size: 15px;
  }

  .opt-letter {
    width: 27px;
    height: 27px;
    font-size: 12px;
  }

  .quiz-hint {
    display: none;
  }

  .result-card {
    border-width: 3px;
    border-radius: 24px;
    padding: 20px 16px;
  }

  .result-stats {
    gap: 6px;
  }

  .rs-item {
    padding: 9px 4px;
  }

  .result-actions {
    gap: 8px;
  }

  .result-actions .btn {
    flex: 1 1 100%;
  }

  .guide-card {
    border-width: 3px;
    padding: 20px 16px;
  }

  .guide-item {
    padding: 11px;
  }
}

@media (max-height: 740px) and (min-width: 761px) {
  .home-main {
    padding-top: 12px;
  }

  .game-logo {
    font-size: clamp(48px, 7vw, 72px);
  }

  .home-stage {
    height: 240px;
  }

  #mascot-canvas {
    width: 230px;
  }

  .stage-island {
    width: 240px;
    height: 58px;
  }

  .speech-bubble {
    top: 6%;
    padding: 11px 15px;
    font-size: 14px;
    width: 190px;
  }

  .home-bottom {
    margin-top: 4px;
    padding: 6px 16px;
  }

  .btn-xl {
    min-height: 54px;
    font-size: 20px;
  }
}

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