/* ============ 基础 ============ */
:root {
  --ink: #2c3e63;
  --ink-soft: #586a8c;
  --sky-top: #86d5ff;
  --sky-mid: #b9e9ff;
  --sky-low: #ffefc2;
  --yellow: #ffd23f;
  --orange: #ff8a3d;
  --pink: #ff6fa5;
  --green: #4cc38a;
  --purple: #8a7bff;
  --card: rgba(255, 255, 255, 0.78);
  --shadow-soft: 0 18px 45px rgba(44, 62, 99, 0.16);
  --shadow-card: 0 26px 70px rgba(44, 62, 99, 0.22);
  --radius-xl: 36px;
  --radius-lg: 24px;
  --radius-md: 16px;
  --font: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Noto Sans SC",
    "Source Han Sans SC", system-ui, -apple-system, "Segoe UI", sans-serif;
  --emoji: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--sky-top);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
}

button {
  font-family: inherit;
  color: inherit;
  border: 0;
  cursor: pointer;
}

#app {
  position: relative;
  height: 100%;
  height: 100dvh;
  width: 100%;
  overflow: hidden;
}

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

.is-hidden {
  display: none !important;
}

/* ============ 屏幕通用 ============ */
.screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: clamp(16px, 3vw, 36px);
}

/* ============ 开始页 ============ */
.start-screen {
  background:
    radial-gradient(circle at 82% 12%, rgba(255, 255, 255, 0.85) 0 4%, rgba(255, 255, 255, 0) 4.2%),
    radial-gradient(circle at 84% 14%, rgba(255, 236, 150, 0.95) 0 9%, rgba(255, 236, 150, 0) 9.4%),
    linear-gradient(175deg, #7fd2ff 0%, #a8e4ff 34%, #d8f3ff 60%, #fff0c9 100%);
}

.start-screen::before {
  content: "";
  position: fixed;
  inset: auto 0 0 0;
  height: 32vh;
  background:
    radial-gradient(120% 130% at 10% 130%, #6fcf8f 0 58%, transparent 58.5%),
    radial-gradient(130% 140% at 90% 135%, #57c98c 0 62%, transparent 62.5%),
    linear-gradient(180deg, transparent 52%, #b8ecc2 52%, #a5e6b6 100%);
  opacity: 0.75;
  pointer-events: none;
}

.start-screen::after {
  content: "";
  position: fixed;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.55) 1.5px, transparent 1.6px);
  background-size: 46px 46px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.25), transparent 60%);
  pointer-events: none;
}

.brand-bar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: min(1180px, 100%);
  margin: 0 auto clamp(14px, 2.4vw, 28px);
  flex: 0 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
}

.brand-star {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(145deg, #ffcb45, #ff8a3d);
  box-shadow: 0 8px 18px rgba(255, 138, 61, 0.4);
}

.brand-star svg {
  width: 24px;
  height: 24px;
}

.brand-name {
  display: flex;
  flex-direction: column;
  font-weight: 800;
  font-size: 18px;
  line-height: 1.15;
  letter-spacing: 0.02em;
}

.brand-name em {
  font-family: "Segoe UI", var(--font);
  font-style: normal;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.55;
}

.brand-tag {
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.9);
  font-size: 12px;
  font-weight: 700;
  color: #47628f;
  letter-spacing: 0.04em;
  backdrop-filter: blur(8px);
}

.start-card {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1.06fr 0.94fr;
  gap: clamp(16px, 3vw, 44px);
  align-items: center;
  width: min(1180px, 100%);
  margin: auto;
  padding: clamp(24px, 3.4vw, 54px);
  border-radius: var(--radius-xl);
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.62));
  border: 1.5px solid rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(18px);
  flex: 0 0 auto;
}

.start-left {
  min-width: 0;
}

.kicker {
  margin: 0 0 6px;
  font-family: "Segoe UI", var(--font);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.26em;
  color: #e0803b;
}

.game-title {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: clamp(44px, 5.6vw, 80px);
  line-height: 1.04;
  font-weight: 900;
  letter-spacing: 0.01em;
  color: var(--ink);
  text-shadow: 0 3px 0 #fff, 0 14px 30px rgba(44, 62, 99, 0.18);
}

.title-star {
  display: inline-block;
  font-size: 0.62em;
  color: var(--yellow);
  -webkit-text-stroke: 2px #ff9f1c;
  text-shadow: 0 6px 14px rgba(255, 159, 28, 0.5);
  animation: twinkle 2.6s ease-in-out infinite;
}

.tagline {
  margin: 14px 0 22px;
  font-size: clamp(14px, 1.5vw, 18px);
  font-weight: 600;
  color: var(--ink-soft);
  line-height: 1.6;
}

.move-list {
  display: grid;
  gap: 9px;
  margin: 0 0 22px;
  padding: 0;
  list-style: none;
}

.move-list li {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 9px 14px 9px 10px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 6px 16px rgba(44, 62, 99, 0.06);
}

.move-emoji {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  font-family: var(--emoji);
  font-size: 23px;
  background: linear-gradient(145deg, #fff4c9, #ffe6a0);
  box-shadow: inset 0 -3px 0 rgba(255, 180, 60, 0.28);
}

.move-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.35;
  min-width: 0;
}

.move-copy b {
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
}

.move-copy small {
  font-size: 12px;
  color: var(--ink-soft);
  font-weight: 500;
}

.difficulty-block {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

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

.difficulty-picker {
  display: flex;
  gap: 6px;
  padding: 5px;
  border-radius: 999px;
  background: rgba(226, 240, 255, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.9);
}

.difficulty-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 999px;
  background: transparent;
  font-size: 13px;
  font-weight: 800;
  color: #5b6f93;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease,
    box-shadow 0.18s ease;
}

.difficulty-btn:hover {
  background: rgba(255, 255, 255, 0.65);
}

.difficulty-btn.is-active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 5px 14px rgba(44, 62, 99, 0.14);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dot-easy {
  background: var(--green);
}

.dot-normal {
  background: var(--orange);
}

.dot-challenge {
  background: var(--pink);
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 54px;
  padding: 0 24px;
  border-radius: 18px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.02em;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
  will-change: transform;
}

.btn:focus-visible {
  outline: 3px solid #2f6fdd;
  outline-offset: 3px;
}

.btn-primary {
  color: #5a2f00;
  background: linear-gradient(150deg, #ffe066 0%, #ffb23f 54%, #ff8a3d 100%);
  box-shadow: 0 12px 26px rgba(255, 138, 61, 0.42), inset 0 2px 0 rgba(255, 255, 255, 0.65);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 32px rgba(255, 138, 61, 0.5), inset 0 2px 0 rgba(255, 255, 255, 0.65);
}

.btn-primary:active {
  transform: translateY(1px) scale(0.99);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  border: 1.5px solid rgba(44, 62, 99, 0.12);
  box-shadow: 0 8px 18px rgba(44, 62, 99, 0.08);
}

.btn-ghost:hover {
  background: #fff;
  transform: translateY(-2px);
}

.btn-icon {
  font-family: var(--emoji);
  font-size: 20px;
}

.btn-small {
  min-height: 42px;
  padding: 0 18px;
  font-size: 14px;
  border-radius: 14px;
}

.btn-link {
  min-height: 40px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.privacy-note {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin: 16px 0 0;
  font-size: 12px;
  line-height: 1.65;
  color: #66799b;
  font-weight: 500;
}

.privacy-note.small {
  justify-content: center;
  margin-top: 14px;
  font-size: 11px;
}

/* 右侧吉祥物 */
.start-right {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 380px;
}

.mascot-glow {
  position: absolute;
  top: 6%;
  left: 50%;
  width: 78%;
  aspect-ratio: 1;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 240, 170, 0.95), rgba(255, 240, 170, 0) 68%);
  filter: blur(2px);
}

.mascot {
  position: relative;
  width: min(100%, 430px);
  height: auto;
  filter: drop-shadow(0 26px 28px rgba(170, 110, 40, 0.22));
  animation: mascotFloat 4.6s ease-in-out infinite;
}

.mascot-stars path,
.mascot-float path,
.mascot-float circle {
  transform-box: fill-box;
  transform-origin: center;
  animation: starPulse 3.2s ease-in-out infinite;
}

.mascot-stars path:nth-child(2) {
  animation-delay: 0.5s;
}

.mascot-stars path:nth-child(3) {
  animation-delay: 1.1s;
}

.mascot-float path {
  animation-delay: 0.8s;
}

.tip-card {
  position: relative;
  display: flex;
  gap: 10px;
  width: min(100%, 370px);
  padding: 13px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 10px 24px rgba(44, 62, 99, 0.1);
}

.tip-emoji {
  font-family: var(--emoji);
  font-size: 20px;
  line-height: 1.2;
}

.tip-card p {
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink-soft);
}

.tip-card b {
  color: var(--ink);
}

.float-chip {
  position: absolute;
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  color: #7a4c00;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 20px rgba(44, 62, 99, 0.12);
  animation: chipFloat 5s ease-in-out infinite;
}

.chip-1 {
  top: 8%;
  left: 0;
  transform: rotate(-7deg);
}

.chip-2 {
  top: 20%;
  right: 0;
  transform: rotate(6deg);
  animation-delay: 1.4s;
  color: #8a3d68;
}

.start-footer {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  width: min(1180px, 100%);
  margin: clamp(12px, 2vw, 22px) auto 0;
  padding: 0 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: rgba(44, 62, 99, 0.58);
  flex: 0 0 auto;
}

/* ============ HUD ============ */
.hud {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  padding: clamp(12px, 2vw, 24px);
  display: flex;
  flex-direction: column;
  font-family: var(--font);
}

.hud-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.score-pill {
  display: flex;
  align-items: baseline;
  gap: 9px;
  padding: 9px 20px 9px 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.78);
  border: 1.5px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 22px rgba(44, 62, 99, 0.12);
  backdrop-filter: blur(10px);
}

.score-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: #7b8aa8;
}

.score-value {
  font-family: "Segoe UI", var(--font);
  font-size: clamp(26px, 3.4vw, 38px);
  font-weight: 900;
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  min-width: 2ch;
}

.timer-wrap {
  position: relative;
  display: grid;
  place-items: center;
  width: clamp(62px, 8vw, 82px);
  aspect-ratio: 1;
  flex: 0 0 auto;
}

.timer-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.timer-ring circle {
  fill: rgba(255, 255, 255, 0.7);
  stroke-width: 6;
}

.ring-bg {
  stroke: rgba(255, 255, 255, 0.55);
}

.ring-fg {
  fill: none;
  stroke: #ff9f1c;
  stroke-linecap: round;
  stroke-dasharray: 182.2;
  stroke-dashoffset: 0;
  transition: stroke 0.3s ease;
}

.timer-value {
  position: relative;
  font-family: "Segoe UI", var(--font);
  font-size: clamp(22px, 2.6vw, 30px);
  font-weight: 900;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.timer-wrap.is-low .timer-value {
  color: #e4453a;
}

.timer-wrap.is-low .ring-fg {
  stroke: #ff5a4d;
}

.timer-wrap.is-low {
  animation: pulse 1s ease-in-out infinite;
}

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

.hearts {
  display: flex;
  gap: 3px;
  padding: 8px 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
  border: 1.5px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 22px rgba(44, 62, 99, 0.1);
  font-family: var(--emoji);
  font-size: clamp(18px, 2.2vw, 24px);
  line-height: 1;
}

.heart {
  display: inline-block;
  color: #ff5c7a;
  text-shadow: 0 2px 0 #d8375c, 0 4px 10px rgba(255, 92, 122, 0.4);
  transition: transform 0.2s ease, opacity 0.2s ease, filter 0.2s ease;
}

.heart.is-empty {
  opacity: 0.28;
  filter: grayscale(1);
}

.heart.is-breaking {
  animation: heartBreak 0.45s ease;
}

.icon-btn {
  pointer-events: auto;
  height: 44px;
  padding: 0 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  border: 1.5px solid rgba(255, 255, 255, 0.9);
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
  box-shadow: 0 8px 22px rgba(44, 62, 99, 0.1);
  backdrop-filter: blur(10px);
  transition: background 0.15s ease, transform 0.15s ease;
}

.icon-btn:hover {
  background: #fff;
  transform: translateY(-1px);
}

.combo-badge {
  position: absolute;
  top: clamp(86px, 12vw, 118px);
  left: 50%;
  transform: translateX(-50%) scale(0.8);
  padding: 7px 18px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ffe57a, #ffb03a);
  border: 2px solid #fff;
  font-size: clamp(14px, 1.6vw, 18px);
  font-weight: 900;
  color: #7a3f00;
  box-shadow: 0 10px 24px rgba(255, 159, 28, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.combo-badge.is-on {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

.combo-badge.is-pop {
  animation: comboPop 0.32s ease;
}

.hud-bottom {
  margin-top: auto;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: clamp(4px, 1vw, 10px);
}

.magic-chip {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 178px;
  padding: 9px 16px 10px 10px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  border: 1.5px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 10px 26px rgba(44, 62, 99, 0.14);
  overflow: hidden;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.magic-chip.is-ready {
  border-color: rgba(255, 210, 63, 0.95);
  box-shadow: 0 10px 26px rgba(255, 176, 58, 0.32), 0 0 0 3px rgba(255, 210, 63, 0.18);
}

.magic-chip.is-active {
  border-color: #ffd23f;
  box-shadow: 0 0 0 4px rgba(255, 210, 63, 0.26), 0 12px 30px rgba(255, 159, 28, 0.4);
}

.magic-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 13px;
  font-family: var(--emoji);
  font-size: 21px;
  background: linear-gradient(145deg, #fff0b0, #ffd76b);
}

.magic-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.magic-text b {
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.magic-text small {
  font-size: 11px;
  font-weight: 600;
  color: #7b8aa8;
  white-space: nowrap;
}

.magic-timer {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, #ffd23f, #ff9f1c);
  transform-origin: left center;
  transform: scaleX(0);
  transition: transform 0.1s linear;
}

.hint-text {
  margin: 0 0 8px;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(44, 62, 99, 0.32);
  color: #fff;
  font-size: clamp(11px, 1.2vw, 13px);
  font-weight: 700;
  letter-spacing: 0.03em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(6px);
  text-align: center;
  white-space: nowrap;
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.hint-text.is-faded {
  opacity: 0;
  transform: translateY(6px);
}

.preview-wrap {
  position: absolute;
  right: clamp(12px, 2vw, 24px);
  top: clamp(78px, 10vw, 104px);
  width: clamp(132px, 17vw, 214px);
  aspect-ratio: 4 / 3;
  border-radius: 16px;
  overflow: hidden;
  border: 2.5px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 12px 30px rgba(44, 62, 99, 0.22);
  background: rgba(30, 45, 70, 0.5);
  transform: scaleX(-1);
}

.preview-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.preview-hint {
  position: absolute;
  left: 50%;
  bottom: 6px;
  transform: translateX(-50%) scaleX(-1);
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.42);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  transition: opacity 0.3s ease;
}

.preview-hint.is-hidden {
  opacity: 0;
}

.lost-hint {
  position: absolute;
  left: 50%;
  top: 40%;
  transform: translateX(-50%);
  padding: 12px 22px;
  border-radius: 16px;
  background: rgba(44, 62, 99, 0.78);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(8px);
}

/* ============ 加载页 ============ */
.loading-screen {
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 50% 32%, rgba(255, 246, 196, 0.9), rgba(255, 246, 196, 0) 55%),
    linear-gradient(170deg, #7fd2ff, #c9efff 55%, #fff1c8);
  z-index: 30;
}

.loading-card {
  width: min(440px, 92vw);
  padding: 38px 32px 30px;
  border-radius: 32px;
  text-align: center;
  background: rgba(255, 255, 255, 0.85);
  border: 1.5px solid #fff;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(16px);
}

.loading-basket {
  position: relative;
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  margin: 0 auto 18px;
  border-radius: 30px;
  background: linear-gradient(145deg, #ffe9a8, #ffbf5c);
  box-shadow: 0 14px 28px rgba(255, 159, 28, 0.32);
  animation: loadingBob 1.8s ease-in-out infinite;
}

.loading-star {
  font-size: 52px;
  color: #fff;
  text-shadow: 0 4px 0 #ff9f1c, 0 10px 18px rgba(255, 159, 28, 0.5);
  animation: twinkle 1.6s ease-in-out infinite;
}

.loading-card h2 {
  margin: 0 0 8px;
  font-size: 24px;
  font-weight: 900;
}

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

.progress-track {
  height: 14px;
  margin: 22px 0 10px;
  border-radius: 999px;
  background: rgba(44, 62, 99, 0.1);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ffd23f, #ff9f1c, #ff7b8a);
  box-shadow: 0 0 14px rgba(255, 159, 28, 0.5);
  transition: width 0.25s ease;
}

.loading-pct {
  font-family: "Segoe UI", var(--font);
  font-size: 13px;
  font-weight: 800;
  color: #e0803b;
  margin-bottom: 20px !important;
}

/* ============ 倒计时 ============ */
.countdown-layer {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  background: radial-gradient(circle, rgba(255, 248, 214, 0.18), rgba(44, 62, 99, 0.08));
}

.countdown-text {
  font-family: "Segoe UI", var(--font);
  font-size: clamp(110px, 22vw, 220px);
  font-weight: 900;
  color: #fff;
  line-height: 1;
  text-shadow: 0 8px 0 #ffb03a, 0 22px 50px rgba(255, 138, 61, 0.55);
  animation: countPop 0.7s cubic-bezier(0.2, 1.4, 0.4, 1);
}

.countdown-text.is-go {
  color: #fff7c9;
  text-shadow: 0 8px 0 #ff7b4d, 0 22px 50px rgba(255, 123, 77, 0.6);
}

.countdown-tip {
  margin: 14px 0 0;
  padding: 9px 22px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  font-size: clamp(13px, 1.5vw, 16px);
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(44, 62, 99, 0.16);
}

/* ============ 暂停 ============ */
.pause-screen {
  z-index: 35;
  align-items: center;
  justify-content: center;
  background: rgba(44, 62, 99, 0.32);
  backdrop-filter: blur(10px);
}

.pause-card {
  width: min(400px, 92vw);
  padding: 32px;
  border-radius: 30px;
  text-align: center;
  background: #fff;
  box-shadow: var(--shadow-card);
}

.pause-card h2 {
  margin: 0 0 6px;
  font-size: 30px;
  font-weight: 900;
}

.pause-card > p {
  margin: 0 0 22px;
  color: var(--ink-soft);
  font-size: 14px;
}

.pause-actions {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
}

.pause-toggles {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 18px;
  padding-top: 18px;
  border-top: 1px dashed rgba(44, 62, 99, 0.16);
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
}

.switch input {
  width: 16px;
  height: 16px;
  accent-color: #ff9f1c;
}

.pause-tip {
  margin: 16px 0 0 !important;
  font-size: 11px !important;
  color: #94a2ba !important;
}

/* ============ 结算 ============ */
.result-screen {
  z-index: 38;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 248, 200, 0.55), rgba(255, 248, 200, 0) 60%),
    rgba(44, 62, 99, 0.3);
  backdrop-filter: blur(9px);
}

.result-card {
  width: min(520px, 94vw);
  padding: clamp(28px, 4vw, 44px) clamp(22px, 4vw, 44px) 30px;
  border-radius: 32px;
  text-align: center;
  background: linear-gradient(165deg, #fff, #fff9ea);
  border: 1.5px solid #fff;
  box-shadow: var(--shadow-card);
  animation: resultIn 0.5s cubic-bezier(0.2, 1.2, 0.4, 1);
}

.result-card .kicker {
  color: #d99a3a;
}

.result-card h2 {
  margin: 4px 0 6px;
  font-size: clamp(28px, 4vw, 38px);
  font-weight: 900;
}

.result-stars {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin: 4px 0 2px;
  font-family: "Segoe UI", var(--font);
  font-size: clamp(44px, 7vw, 64px);
  line-height: 1.1;
}

.result-star {
  color: rgba(44, 62, 99, 0.14);
  transition: color 0.25s ease, transform 0.25s ease;
  transform: scale(0.86);
  display: inline-block;
}

.result-star.is-filled {
  color: #ffc531;
  text-shadow: 0 4px 0 #f59b1c, 0 10px 22px rgba(245, 155, 28, 0.45);
  transform: scale(1);
  animation: starPop 0.55s cubic-bezier(0.2, 1.6, 0.4, 1) both;
}

.result-star.is-filled:nth-child(2) {
  animation-delay: 0.12s;
}

.result-star.is-filled:nth-child(3) {
  animation-delay: 0.24s;
}

.result-score {
  margin: 2px 0 4px;
  font-family: "Segoe UI", var(--font);
  font-size: clamp(48px, 8vw, 70px);
  font-weight: 900;
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.result-score small {
  font-family: var(--font);
  font-size: 0.26em;
  font-weight: 800;
  color: #8b9ab5;
}

.result-comment {
  margin: 6px 0 20px;
  color: #e0803b;
  font-size: 14px;
  font-weight: 800;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 14px;
  border-radius: 20px;
  background: rgba(255, 240, 200, 0.5);
  border: 1px solid rgba(255, 224, 150, 0.7);
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat b {
  font-family: "Segoe UI", var(--font);
  font-size: clamp(22px, 3vw, 28px);
  font-weight: 900;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.stat span {
  font-size: 11px;
  font-weight: 700;
  color: #8b8f9d;
}

.best-line {
  margin: 14px 0 18px;
  font-size: 12px;
  font-weight: 700;
  color: #8b9ab5;
}

.best-line.is-new {
  color: #e0803b;
  animation: pulse 0.8s ease-in-out 2;
}

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

.result-actions .btn {
  flex: 1 1 150px;
}

/* ============ 错误页 ============ */
.error-screen {
  z-index: 40;
  align-items: center;
  justify-content: center;
  background: rgba(44, 62, 99, 0.36);
  backdrop-filter: blur(10px);
}

.error-card {
  width: min(430px, 92vw);
  padding: 34px 30px;
  border-radius: 30px;
  text-align: center;
  background: #fff;
  box-shadow: var(--shadow-card);
}

.error-emoji {
  font-family: var(--emoji);
  font-size: 54px;
  line-height: 1;
  margin-bottom: 12px;
}

.error-card h2 {
  margin: 0 0 8px;
  font-size: 26px;
  font-weight: 900;
}

.error-card > p {
  margin: 0;
  font-size: 13px;
  line-height: 1.65;
  color: var(--ink-soft);
}

.error-actions {
  display: grid;
  gap: 10px;
  margin: 22px 0 10px;
}

.error-tip {
  margin-top: 14px !important;
  font-size: 11px !important;
  color: #94a2ba !important;
}

/* ============ Toast ============ */
.toast {
  position: fixed;
  left: 50%;
  bottom: clamp(180px, 26vh, 280px);
  z-index: 50;
  transform: translateX(-50%) translateY(8px);
  padding: 10px 20px;
  border-radius: 999px;
  background: rgba(44, 62, 99, 0.86);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.24);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  max-width: min(90vw, 480px);
  text-align: center;
}

.toast.is-on {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.file-warning {
  position: fixed;
  top: 14px;
  left: 50%;
  z-index: 60;
  transform: translateX(-50%);
  width: min(720px, calc(100vw - 28px));
  padding: 12px 18px;
  border-radius: 14px;
  background: #fff4d6;
  border: 1.5px solid #ffce6a;
  color: #81510b;
  font-size: 13px;
  line-height: 1.65;
  text-align: center;
  box-shadow: 0 12px 30px rgba(129, 81, 11, 0.18);
}

.file-warning b {
  margin-right: 6px;
}

.file-warning code {
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.75);
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
}

/* ============ 动画 ============ */
@keyframes twinkle {
  0%,
  100% {
    transform: scale(1) rotate(0deg);
  }
  50% {
    transform: scale(1.14) rotate(8deg);
  }
}

@keyframes mascotFloat {
  0%,
  100% {
    transform: translateY(0) rotate(-1deg);
  }
  50% {
    transform: translateY(-12px) rotate(1deg);
  }
}

@keyframes starPulse {
  0%,
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
  50% {
    transform: scale(1.14) rotate(10deg);
    opacity: 0.9;
  }
}

@keyframes chipFloat {
  0%,
  100% {
    translate: 0 0;
  }
  50% {
    translate: 0 -8px;
  }
}

@keyframes loadingBob {
  0%,
  100% {
    transform: translateY(0) rotate(-3deg);
  }
  50% {
    transform: translateY(-10px) rotate(3deg);
  }
}

@keyframes countPop {
  0% {
    transform: scale(0.4);
    opacity: 0;
  }
  60% {
    transform: scale(1.08);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.55;
  }
}

@keyframes comboPop {
  0% {
    transform: translateX(-50%) scale(0.8);
  }
  60% {
    transform: translateX(-50%) scale(1.12);
  }
  100% {
    transform: translateX(-50%) scale(1);
  }
}

@keyframes heartBreak {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.35) rotate(-10deg);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes resultIn {
  from {
    transform: translateY(24px) scale(0.94);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@keyframes starPop {
  from {
    transform: scale(0.2) rotate(-30deg);
    opacity: 0;
  }
  to {
    transform: scale(1) rotate(0);
    opacity: 1;
  }
}

/* ============ 响应式 ============ */
@media (max-width: 960px) {
  .start-card {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: clamp(22px, 4vw, 34px);
  }

  .start-right {
    display: none;
  }

  .game-title {
    font-size: clamp(42px, 10vw, 64px);
  }

  .start-screen::after {
    background-size: 38px 38px;
  }
}

@media (max-width: 640px) {
  .screen {
    padding: 14px;
  }

  .brand-tag {
    display: none;
  }

  .brand-star {
    width: 36px;
    height: 36px;
    border-radius: 12px;
  }

  .brand-name {
    font-size: 16px;
  }

  .start-card {
    border-radius: 26px;
    padding: 22px 18px;
  }

  .tagline {
    margin: 10px 0 16px;
  }

  .move-list li {
    padding: 8px 10px 8px 8px;
  }

  .move-emoji {
    width: 36px;
    height: 36px;
    font-size: 20px;
  }

  .move-copy b {
    font-size: 14px;
  }

  .move-copy small {
    font-size: 11px;
  }

  .difficulty-block {
    margin-bottom: 16px;
  }

  .difficulty-btn {
    padding: 7px 13px;
    font-size: 12px;
  }

  .cta-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .btn {
    min-height: 50px;
    font-size: 15px;
  }

  .privacy-note {
    font-size: 11px;
  }

  .hud {
    padding: 10px;
  }

  .score-pill {
    padding: 7px 14px 7px 12px;
    border-radius: 16px;
  }

  .hearts {
    padding: 7px 9px;
    border-radius: 14px;
  }

  .icon-btn {
    height: 38px;
    padding: 0 12px;
    font-size: 12px;
  }

  .hud-right {
    gap: 6px;
  }

  .preview-wrap {
    width: 108px;
    border-radius: 12px;
    top: 118px;
  }

  .preview-hint {
    font-size: 8px;
    bottom: 4px;
  }

  .magic-chip {
    min-width: 0;
    padding: 7px 12px 8px 7px;
    gap: 7px;
  }

  .magic-icon {
    width: 32px;
    height: 32px;
    font-size: 17px;
    border-radius: 10px;
  }

  .magic-text b {
    font-size: 12px;
  }

  .magic-text small {
    font-size: 9px;
  }

  .hint-text {
    font-size: 10px;
    padding: 7px 10px;
    margin-bottom: 5px;
  }

  .combo-badge {
    top: 74px;
  }

  .result-stats {
    padding: 11px;
  }

  .stat span {
    font-size: 10px;
  }
}

@media (max-height: 700px) and (min-width: 961px) {
  .start-card {
    padding-top: 26px;
    padding-bottom: 26px;
  }

  .game-title {
    font-size: clamp(40px, 4.6vw, 62px);
  }

  .tagline {
    margin: 8px 0 14px;
  }

  .move-list {
    margin-bottom: 14px;
  }

  .move-list li {
    padding-top: 7px;
    padding-bottom: 7px;
  }

  .mascot {
    width: min(100%, 330px);
  }
}

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