*,
*::before,
*::after { box-sizing: border-box; }

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

body {
  overflow: hidden;
  overscroll-behavior: none;
  background:
    radial-gradient(120% 80% at 50% 0%, #1d0a4e 0%, #0a0322 46%, #050113 100%);
  color: #fff;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

[hidden] { display: none !important; }

button {
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

#app {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  max-width: 560px;
  margin: 0 auto;
  overflow: hidden;
  background: #08021c;
  isolation: isolate;
}

/* ============ 首页 ============ */

.start-screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #0a0324;
  transition: opacity .3s ease, transform .3s ease;
  z-index: 2;
}

.start-screen.leaving {
  opacity: 0;
  transform: scale(1.025);
  pointer-events: none;
}

.start-ambient {
  position: absolute;
  inset: -18%;
  background: url("images/gen/gptimg_1795244054_look.png") center 36% / cover no-repeat;
  filter: blur(42px) saturate(1.45) brightness(.55);
  opacity: .8;
  transform: scale(1.08);
  z-index: 0;
}

.start-hero {
  position: relative;
  flex: 0 0 59%;
  min-height: 0;
  overflow: hidden;
  z-index: 1;
}

.hero-art {
  position: absolute;
  left: 50%;
  top: 0;
  width: 100%;
  height: 127%;
  transform: translateX(-50%);
  object-fit: cover;
  object-position: center top;
  filter: saturate(1.16) contrast(1.04);
  animation: heroDrift 16s ease-in-out infinite alternate;
}

.hero-fade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(7, 2, 24, .26) 0%, rgba(7, 2, 24, 0) 15%, rgba(7, 2, 24, 0) 55%, rgba(12, 4, 35, .2) 72%, rgba(12, 4, 35, .55) 82%, rgba(12, 4, 35, .94) 88%, #0d0529 94%, #0d0529 100%),
    radial-gradient(90% 60% at 50% 105%, rgba(255, 122, 31, .18) 0%, rgba(255, 122, 31, 0) 70%);
}

.start-panel {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  margin-top: -30px;
  padding: 19px 20px calc(12px + env(safe-area-inset-bottom));
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-radius: 30px 30px 0 0;
  border-top: 1px solid rgba(255, 168, 92, .42);
  background:
    linear-gradient(180deg, rgba(27, 12, 62, .95) 0%, rgba(12, 5, 35, .985) 38%, #070216 100%);
  box-shadow:
    0 -20px 55px rgba(255, 110, 30, .14),
    0 -2px 0 rgba(255, 255, 255, .04) inset,
    0 1px 0 rgba(255, 255, 255, .07) inset;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.start-panel::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -1px;
  width: 58%;
  height: 2px;
  transform: translateX(-50%);
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, #ffb45c 34%, #fff1cd 50%, #ffb45c 66%, transparent);
  filter: blur(.4px);
  opacity: .95;
}

.brand-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .28em;
  color: #ffb15c;
  opacity: .92;
  white-space: nowrap;
}

.kicker-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ff8a3d;
  box-shadow: 0 0 9px #ff8a3d, 0 0 20px rgba(255, 138, 61, .55);
  animation: dotPulse 1.8s ease-in-out infinite;
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 1px;
  margin: 7px 0 0;
  font-size: clamp(30px, 9.4vw, 41px);
  line-height: 1.04;
  font-weight: 900;
  letter-spacing: -.035em;
  white-space: nowrap;
}

.brand-title .t-white {
  color: #fff;
  text-shadow:
    0 0 16px rgba(110, 220, 255, .5),
    0 0 34px rgba(90, 130, 255, .25),
    0 2px 0 rgba(31, 12, 75, .9);
}

.brand-title .t-orange {
  background: linear-gradient(178deg, #fff2c0 0%, #ffd264 28%, #ff9d3a 60%, #ff6d15 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 13px rgba(255, 138, 61, .5)) drop-shadow(0 2px 0 rgba(114, 37, 0, .55));
}

.brand-six {
  position: relative;
  margin-left: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 27px;
  height: 32px;
  border-radius: 9px;
  transform: rotate(8deg) translateY(-3px);
  color: #fff6e0;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 0;
  background: linear-gradient(160deg, #ff4fc8 0%, #a43cff 55%, #4e3bff 100%);
  border: 1px solid rgba(255, 255, 255, .55);
  box-shadow: 0 0 16px rgba(255, 79, 200, .55), inset 0 1px 0 rgba(255, 255, 255, .45);
  text-shadow: 0 1px 0 rgba(70, 0, 70, .5);
}

.brand-sub {
  margin: 8px 0 0;
  font-size: 12.5px;
  line-height: 1.5;
  letter-spacing: .01em;
  color: #b7abd9;
}

.brick-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  min-height: 15px;
}

.preview-label {
  flex: 0 0 auto;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .14em;
  color: #8f83b9;
}

.preview-chips {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 1 1 auto;
  min-width: 0;
}

.preview-chips i {
  display: block;
  flex: 1 1 0;
  height: 13px;
  min-width: 0;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--a) 0%, var(--b) 100%);
  box-shadow: 0 0 9px var(--g), inset 0 1px 0 rgba(255, 255, 255, .52);
  transform: skewX(-5deg);
  opacity: .94;
}

.play-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  height: 58px;
  margin-top: 15px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  cursor: pointer;
  color: #fff;
  font-size: 19px;
  font-weight: 900;
  letter-spacing: .09em;
  background: linear-gradient(180deg, #ffcb73 0%, #ffa34a 34%, #ff8124 70%, #ef6011 100%);
  box-shadow:
    0 10px 26px rgba(255, 104, 24, .38),
    0 4px 0 #a83f06,
    0 0 34px rgba(255, 138, 61, .22),
    inset 0 1px 0 rgba(255, 255, 255, .72);
  text-shadow: 0 2px 0 rgba(150, 55, 0, .5);
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}

.play-btn::before {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: inherit;
  border: 1px solid rgba(255, 255, 255, .32);
  pointer-events: none;
}

.play-btn::after {
  content: "";
  position: absolute;
  top: -60%;
  left: -38%;
  width: 34%;
  height: 220%;
  transform: rotate(20deg);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .52), transparent);
  animation: sheen 3.6s ease-in-out infinite;
  pointer-events: none;
}

.play-btn .mp-icon {
  width: 25px;
  height: 25px;
  color: #fff;
  filter: drop-shadow(0 2px 0 rgba(150, 55, 0, .38));
  flex: 0 0 auto;
}

.play-btn:active {
  transform: translateY(2px) scale(.988);
  filter: brightness(.985);
  box-shadow:
    0 4px 14px rgba(255, 104, 24, .3),
    0 1px 0 #a83f06,
    inset 0 1px 0 rgba(255, 255, 255, .55);
}

.start-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-top: 13px;
  padding-top: 0;
  font-size: 10.5px;
  letter-spacing: .04em;
  color: #9186b8;
  white-space: nowrap;
}

.start-meta span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.start-meta b {
  color: #ffd2a0;
  font-weight: 800;
}

.start-meta .mp-icon {
  width: 11px;
  height: 11px;
}

.start-meta .mp-icon-favorite { color: #ff5f8a; }
.start-meta .mp-icon-star { color: #ffd54a; }

.meta-sep {
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: #5b4e85;
}

/* ============ 游戏 ============ */

.game-screen {
  position: absolute;
  inset: 0;
  z-index: 3;
  overflow: hidden;
  background: #070119;
}

.game-screen.entering {
  animation: screenIn .32s ease both;
}

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

.game-hud {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top));
  left: 14px;
  right: 14px;
  z-index: 4;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 8px;
  pointer-events: none;
}

.hud-score {
  justify-self: start;
  min-width: 84px;
  padding: 7px 12px 8px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(43, 22, 93, .84) 0%, rgba(14, 5, 40, .86) 100%);
  border: 1px solid rgba(132, 112, 255, .27);
  box-shadow: 0 8px 20px rgba(0, 0, 0, .32), inset 0 1px 0 rgba(255, 255, 255, .08);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.hud-cap {
  display: block;
  margin-bottom: 1px;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .22em;
  color: #a496d8;
}

#scoreVal {
  display: block;
  font-size: 22px;
  line-height: 1;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: .01em;
  color: #fff;
  text-shadow: 0 0 16px rgba(255, 170, 90, .45);
}

.hud-wave {
  align-self: start;
  margin-top: 3px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: .16em;
  color: #ffcf9b;
  background: rgba(16, 6, 42, .62);
  border: 1px solid rgba(255, 154, 71, .3);
  box-shadow: 0 0 16px rgba(255, 138, 61, .13);
  white-space: nowrap;
}

.hud-lives {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px 11px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(43, 22, 93, .84) 0%, rgba(14, 5, 40, .86) 100%);
  border: 1px solid rgba(255, 95, 138, .28);
  box-shadow: 0 8px 20px rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255, 255, 255, .07);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.life {
  display: flex;
  width: 17px;
  height: 17px;
  transition: transform .2s ease;
}

.life .mp-icon {
  width: 17px;
  height: 17px;
  color: #ff5f8a;
  filter: drop-shadow(0 0 6px rgba(255, 70, 130, .72));
  transition: color .2s ease, filter .2s ease, opacity .2s ease;
}

.life.lost {
  transform: scale(.84);
}

.life.lost .mp-icon {
  color: #3c2d62;
  filter: none;
  opacity: .6;
}

.combo-badge {
  position: absolute;
  top: calc(76px + env(safe-area-inset-top));
  left: 50%;
  z-index: 4;
  display: flex;
  align-items: baseline;
  gap: 4px;
  padding: 5px 13px 6px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 169, 75, .2), rgba(255, 83, 18, .12));
  border: 1px solid rgba(255, 168, 70, .5);
  box-shadow: 0 0 22px rgba(255, 120, 30, .2), inset 0 1px 0 rgba(255, 255, 255, .14);
  color: #ffd08b;
  opacity: 0;
  transform: translate(-50%, -6px) scale(.82);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s cubic-bezier(.2, .9, .3, 1.4);
}

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

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

.combo-badge b {
  font-size: 17px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: #fff0cd;
  text-shadow: 0 0 12px rgba(255, 170, 80, .8);
}

.combo-badge span {
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .18em;
  opacity: .8;
}

.wave-toast {
  position: absolute;
  left: 50%;
  top: 38%;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transform: translate(-50%, -50%);
  opacity: 0;
  pointer-events: none;
  text-align: center;
}

.wave-toast.show {
  animation: toastIn 1.7s ease both;
}

.wave-toast b {
  font-size: clamp(30px, 9vw, 40px);
  font-weight: 900;
  letter-spacing: .12em;
  background: linear-gradient(180deg, #fff6d9 0%, #ffd166 38%, #ff8a3d 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 18px rgba(255, 145, 55, .65));
  white-space: nowrap;
}

.wave-toast span {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .24em;
  color: #ffc891;
  text-shadow: 0 0 12px rgba(255, 120, 30, .6);
}

.serve-hint {
  position: absolute;
  left: 50%;
  bottom: calc(17px + env(safe-area-inset-bottom));
  z-index: 4;
  transform: translateX(-50%);
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(15, 6, 38, .76);
  border: 1px solid rgba(255, 150, 70, .34);
  box-shadow: 0 0 20px rgba(255, 120, 40, .13), inset 0 1px 0 rgba(255, 255, 255, .07);
  color: #ffcf95;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .08em;
  white-space: nowrap;
  pointer-events: none;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: opacity .22s ease, transform .22s ease;
}

.serve-hint.hide {
  opacity: 0;
  transform: translate(-50%, 9px);
}

/* ============ 结算 ============ */

.result {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 44%, rgba(80, 34, 148, .58) 0%, rgba(6, 2, 20, .9) 68%);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}

.result.show {
  opacity: 1;
  pointer-events: auto;
}

.result-card {
  width: 100%;
  max-width: 328px;
  padding: 23px 21px 19px;
  border-radius: 26px;
  text-align: center;
  background: linear-gradient(180deg, rgba(38, 18, 83, .97) 0%, rgba(11, 4, 30, .99) 100%);
  border: 1px solid rgba(255, 150, 80, .4);
  box-shadow:
    0 26px 60px rgba(0, 0, 0, .62),
    0 0 50px rgba(255, 120, 40, .14),
    inset 0 1px 0 rgba(255, 255, 255, .12);
  transform: translateY(14px) scale(.97);
  transition: transform .28s cubic-bezier(.2, .9, .3, 1.15);
}

.result.show .result-card {
  transform: translateY(0) scale(1);
}

.result-kicker {
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: .25em;
  color: #ffb168;
}

.result-card h2 {
  margin: 7px 0 15px;
  font-size: 28px;
  line-height: 1.1;
  font-weight: 900;
  letter-spacing: .02em;
  color: #fff;
  text-shadow: 0 0 22px rgba(255, 150, 70, .35);
}

.result-score span {
  display: block;
  font-size: 10px;
  letter-spacing: .16em;
  color: #a99bce;
}

.result-score b {
  display: block;
  margin-top: 2px;
  font-size: 54px;
  line-height: 1;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
  background: linear-gradient(180deg, #fff5d8 0%, #ffd166 42%, #ff8124 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 18px rgba(255, 138, 50, .4));
}

.record-badge {
  display: inline-block;
  margin-top: 9px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .1em;
  color: #ffdf9e;
  background: rgba(255, 138, 61, .16);
  border: 1px solid rgba(255, 175, 90, .45);
}

.result-best {
  margin: 9px 0 17px;
  font-size: 11px;
  letter-spacing: .05em;
  color: #9588bd;
}

.result-play {
  height: 52px;
  margin-top: 0;
  font-size: 17px;
}

.result-play .mp-icon {
  width: 20px;
  height: 20px;
}

.ghost-btn {
  width: 100%;
  height: 43px;
  margin-top: 9px;
  border-radius: 999px;
  border: 1px solid rgba(160, 140, 220, .3);
  background: rgba(255, 255, 255, .045);
  color: #b9addb;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .1em;
  cursor: pointer;
  transition: transform .12s ease, background .12s ease;
}

.ghost-btn:active {
  transform: scale(.985);
  background: rgba(255, 255, 255, .09);
}

/* ============ 动画 ============ */

@keyframes heroDrift {
  from { transform: translateX(-50%) scale(1.005); }
  to { transform: translateX(-50%) scale(1.05); }
}

@keyframes dotPulse {
  0%, 100% { opacity: .65; transform: scale(.82); }
  50% { opacity: 1; transform: scale(1.15); }
}

@keyframes sheen {
  0%, 58% { left: -38%; }
  78%, 100% { left: 128%; }
}

@keyframes screenIn {
  from { opacity: 0; transform: scale(1.015); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes comboPop {
  0% { transform: translate(-50%, 0) scale(1); }
  38% { transform: translate(-50%, 0) scale(1.14); }
  100% { transform: translate(-50%, 0) scale(1); }
}

@keyframes toastIn {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.82); }
  16% { opacity: 1; transform: translate(-50%, -50%) scale(1.04); }
  28% { transform: translate(-50%, -50%) scale(1); }
  72% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -58%) scale(.98); }
}

/* ============ 短屏适配 ============ */

@media (max-height: 720px) {
  .start-hero { flex-basis: 55%; }
  .start-panel { padding-top: 15px; }
  .brand-title { font-size: clamp(27px, 8.7vw, 35px); margin-top: 5px; }
  .brand-six { width: 24px; height: 28px; font-size: 17px; }
  .brand-sub { margin-top: 6px; font-size: 11.5px; }
  .brick-preview { margin-top: 11px; }
  .play-btn { height: 54px; margin-top: 12px; font-size: 18px; }
  .start-meta { padding-top: 8px; }
}

@media (max-height: 620px) {
  .start-hero { flex-basis: 50%; }
  .brand-kicker { font-size: 8px; }
  .brand-sub { display: none; }
  .brick-preview { margin-top: 9px; }
  .preview-chips i { height: 11px; }
  .play-btn { height: 50px; margin-top: 10px; }
  .start-meta { font-size: 9.5px; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-art,
  .kicker-dot,
  .play-btn::after { animation: none; }
  .start-screen,
  .result,
  .result-card,
  .play-btn { transition: none; }
}
