/* ==========================================================================
   地头蛇王国派对 — 赛博朋克霓虹街区
   移动端优先 / 竖屏铺满 / 原生 CSS
   ========================================================================== */

:root {
  --orange: #FF8A3D;
  --orange-2: #FFC15E;
  --pink: #FF2E9A;
  --cyan: #2EF2FF;
  --violet: #A98BFF;
  --gold: #FFD166;
  --ink: #07040F;
  --text: #FFF6EC;
  --muted: rgba(255, 246, 236, .55);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

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

html { background: #07040F; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  color: var(--text);
  background: #07040F;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

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

ul { list-style: none; margin: 0; padding: 0; }
h1, h2, p { margin: 0; }
img { max-width: 100%; }
[hidden] { display: none !important; }

.svg-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* ==========================================================================
   背景
   ========================================================================== */

.scene-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(120% 78% at 50% 0%, #3B1564 0%, #1B0B33 40%, #0A0515 72%, #07040F 100%),
    #07040F;
}

.bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(52px);
  opacity: .5;
  mix-blend-mode: screen;
  pointer-events: none;
}

.bg-orb-a {
  width: 320px;
  height: 320px;
  left: -120px;
  top: 4%;
  background: #6E1FFF;
  animation: orbFloat 13s ease-in-out infinite;
}

.bg-orb-b {
  width: 260px;
  height: 260px;
  right: -100px;
  top: 24%;
  background: #FF2E9A;
  animation: orbFloat 16s ease-in-out infinite reverse;
}

.bg-orb-c {
  width: 220px;
  height: 220px;
  left: 34%;
  top: 38%;
  background: #0E7C8C;
  opacity: .35;
  animation: orbFloat 18s ease-in-out infinite;
}

.skyline {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 100%;
  height: 58%;
  min-height: 300px;
  transform: translateX(-50%);
  opacity: .96;
  pointer-events: none;
}

.floor-grid {
  position: absolute;
  left: -40%;
  right: -40%;
  bottom: -12%;
  height: 42%;
  background-image:
    linear-gradient(rgba(255, 138, 61, .3) 1px, transparent 1px),
    linear-gradient(90deg, rgba(46, 242, 255, .16) 1px, transparent 1px);
  background-size: 46px 46px;
  transform: perspective(420px) rotateX(64deg);
  transform-origin: 50% 100%;
  -webkit-mask-image: linear-gradient(to top, #000 0%, rgba(0, 0, 0, .55) 55%, transparent 100%);
  mask-image: linear-gradient(to top, #000 0%, rgba(0, 0, 0, .55) 55%, transparent 100%);
  opacity: .7;
  pointer-events: none;
}

.bg-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 30%, transparent 28%, rgba(3, 1, 8, .58) 100%);
  pointer-events: none;
}

.scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(180deg, rgba(255, 255, 255, .035) 0 1px, transparent 1px 3px);
  opacity: .32;
  mix-blend-mode: overlay;
  pointer-events: none;
}

.dust-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.dust-layer span {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 8px 2px rgba(255, 138, 61, .55);
  opacity: 0;
  animation: dustRise 9s linear infinite;
}

.fx-canvas {
  position: fixed;
  inset: 0;
  z-index: 60;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.float-layer {
  position: fixed;
  inset: 0;
  z-index: 62;
  pointer-events: none;
}

.float-text {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 20px;
  font-weight: 900;
  letter-spacing: .02em;
  color: var(--text);
  text-shadow: 0 2px 0 rgba(0, 0, 0, .5), 0 0 18px currentColor;
  white-space: nowrap;
  animation: floatUp .92s cubic-bezier(.2, .7, .3, 1) forwards;
  will-change: transform, opacity;
}

/* ==========================================================================
   屏幕容器
   ========================================================================== */

.game-root {
  position: relative;
  z-index: 10;
  height: 100vh;
  height: 100dvh;
}

.screen {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  margin: 0 auto;
  width: 100%;
  max-width: 520px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .28s ease, visibility .28s ease;
}

.screen.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* ==========================================================================
   开始页
   ========================================================================== */

.screen-start {
  padding: calc(var(--safe-top) + 12px) 16px calc(var(--safe-bottom) + 14px);
  gap: 10px;
  justify-content: space-between;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.start-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex: 0 0 auto;
}

.player-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 5px 12px 5px 5px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(35, 20, 60, .82), rgba(14, 8, 26, .88));
  border: 1px solid rgba(255, 255, 255, .09);
  box-shadow: 0 8px 20px rgba(0, 0, 0, .35);
  text-align: left;
  transition: transform .15s ease, border-color .2s ease;
}

.player-chip:active {
  transform: scale(.97);
  border-color: rgba(255, 138, 61, .5);
}

.avatar {
  position: relative;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 40% 30%, #4A2C74, #170C27);
  border: 1.5px solid var(--orange);
  box-shadow: 0 0 12px rgba(255, 138, 61, .42);
}

.avatar svg,
.avatar img {
  width: 100%;
  height: 100%;
  display: block;
}

.avatar img { object-fit: cover; }

.player-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.15;
}

.player-meta b {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 148px;
}

.player-meta em {
  font-style: normal;
  font-size: 9.5px;
  color: var(--muted);
  margin-top: 3px;
  white-space: nowrap;
}

.best-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px 11px;
  border-radius: 999px;
  background: rgba(12, 7, 22, .74);
  border: 1px solid rgba(255, 209, 102, .28);
  flex: 0 0 auto;
  font-size: 9.5px;
  color: var(--muted);
  letter-spacing: .04em;
}

.best-chip .mp-icon {
  width: 14px;
  height: 14px;
  color: var(--gold);
}

.best-chip b {
  font-size: 13px;
  color: var(--gold);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.hero {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-top: 2px;
}

.hero-copy {
  position: relative;
  z-index: 2;
  text-align: center;
  flex: 0 0 auto;
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 9px;
  letter-spacing: .22em;
  color: rgba(255, 246, 236, .6);
  font-weight: 700;
  text-transform: uppercase;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(10, 5, 20, .55);
  border: 1px solid rgba(255, 255, 255, .08);
  white-space: nowrap;
}

.kicker .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 10px var(--orange);
  animation: blink 1.4s infinite;
}

.logo {
  margin: 10px 0 0;
  font-weight: 900;
  line-height: .95;
  letter-spacing: -.02em;
  font-size: clamp(38px, 11.6vw, 56px);
  display: flex;
  flex-direction: column;
  gap: 2px;
  transform: skewX(-3deg);
}

.logo-line { display: block; }

.l1 {
  color: #FFF6EC;
  text-shadow: 0 2px 0 #3A1C12, 0 0 24px rgba(255, 138, 61, .35);
}

.l2 {
  background: linear-gradient(92deg, #FF8A3D 0%, #FFC15E 42%, #FF2E9A 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 14px rgba(255, 46, 154, .35));
}

.tagline {
  margin-top: 10px;
  font-size: 12.5px;
  color: rgba(255, 246, 236, .66);
  letter-spacing: .02em;
}

.mascot-wrap {
  position: relative;
  width: 100%;
  flex: 1 1 auto;
  min-height: 145px;
  max-height: 330px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

.mascot {
  height: 100%;
  width: auto;
  max-width: 100%;
  max-height: 330px;
  filter: drop-shadow(0 18px 26px rgba(0, 0, 0, .55));
  animation: bob 4.6s ease-in-out infinite;
}

.mascot-tag {
  position: absolute;
  right: 1%;
  top: 20%;
  z-index: 3;
  transform: rotate(4deg);
  padding: 7px 10px;
  border-radius: 10px 10px 10px 2px;
  background: linear-gradient(180deg, #FFE7C2, #FFB347);
  color: #2A1010;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.25;
  box-shadow: 0 8px 18px rgba(0, 0, 0, .35);
  pointer-events: none;
}

.mascot-tag::after {
  content: "";
  position: absolute;
  left: 10px;
  bottom: -4px;
  width: 9px;
  height: 9px;
  background: #FFB347;
  transform: rotate(45deg);
  border-radius: 2px;
}

.start-bottom {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(22, 12, 40, .74), rgba(8, 4, 16, .92));
  border: 1px solid rgba(255, 255, 255, .08);
  box-shadow: 0 18px 40px rgba(0, 0, 0, .45);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.legend {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.legend li {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 6px;
  border-radius: 11px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .05);
  min-width: 0;
}

.legend .mp-icon {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  color: var(--cyan);
}

.legend li.danger .mp-icon { color: #FF5C7A; }
.legend li.gold .mp-icon { color: var(--gold); }

.legend span {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
}

.legend b {
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.legend small {
  font-size: 9px;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
}

.btn-primary {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 62px;
  border-radius: 16px;
  background: linear-gradient(180deg, #FFB347 0%, #FF8A3D 52%, #F56A12 100%);
  color: #241007;
  font-weight: 900;
  box-shadow:
    0 7px 0 #8F3A08,
    0 14px 30px rgba(255, 122, 0, .35),
    inset 0 1px 0 rgba(255, 255, 255, .55);
  overflow: hidden;
  transition: transform .12s ease, box-shadow .12s ease;
}

.btn-primary:active {
  transform: translateY(4px);
  box-shadow:
    0 3px 0 #8F3A08,
    0 8px 18px rgba(255, 122, 0, .3),
    inset 0 1px 0 rgba(255, 255, 255, .4);
}

.btn-primary .mp-icon {
  width: 28px;
  height: 28px;
  color: #241007;
  flex: 0 0 28px;
}

.btn-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.1;
  position: relative;
  z-index: 2;
}

.btn-label small {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .12em;
  opacity: .68;
}

.btn-label b {
  font-size: 22px;
  letter-spacing: .08em;
  margin-top: 1px;
}

.btn-sheen {
  position: absolute;
  top: -120%;
  left: -30%;
  width: 24%;
  height: 340%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .6), transparent);
  transform: rotate(20deg);
  animation: sheen 3.6s ease-in-out infinite;
  pointer-events: none;
}

.start-meta {
  text-align: center;
  font-size: 9.5px;
  color: rgba(255, 246, 236, .42);
  letter-spacing: .05em;
}

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

.screen-game {
  padding: calc(var(--safe-top) + 8px) 14px calc(var(--safe-bottom) + 10px);
  gap: 7px;
  overflow: hidden;
}

.screen-game::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 46%, rgba(255, 46, 154, .16), transparent 62%);
  opacity: 0;
  transition: opacity .35s ease;
  pointer-events: none;
  z-index: -1;
}

.screen-game.is-frenzy::before { opacity: 1; }

.game-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex: 0 0 auto;
}

.score-box {
  display: flex;
  flex-direction: column;
  min-width: 88px;
}

.hud-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 8.5px;
  letter-spacing: .13em;
  color: var(--muted);
  font-weight: 700;
}

.hud-label .mp-icon {
  width: 12px;
  height: 12px;
  color: var(--gold);
}

.score-box strong {
  font-size: 30px;
  line-height: 1;
  font-weight: 900;
  color: var(--text);
  text-shadow: 0 0 16px rgba(255, 138, 61, .35);
  font-variant-numeric: tabular-nums;
  margin-top: 3px;
}

.combo-box {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px 5px 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 138, 61, .22);
  transition: border-color .2s ease, background .2s ease;
}

.combo-box .mp-icon {
  width: 18px;
  height: 18px;
  color: var(--orange);
}

.combo-box div {
  display: flex;
  align-items: baseline;
  gap: 3px;
}

.combo-box b {
  font-size: 19px;
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.combo-box small {
  font-size: 8px;
  color: var(--muted);
}

.combo-box > span {
  font-size: 10px;
  font-weight: 900;
  color: var(--orange);
  padding: 3px 5px;
  border-radius: 6px;
  background: rgba(255, 138, 61, .13);
  font-variant-numeric: tabular-nums;
}

.combo-box.pulse {
  animation: comboPop .22s ease;
  border-color: rgba(255, 138, 61, .65);
  background: rgba(255, 138, 61, .1);
}

.time-box {
  display: flex;
  align-items: center;
  gap: 7px;
}

.time-ring {
  --p: 100;
  position: relative;
  width: 50px;
  height: 50px;
  flex: 0 0 50px;
  border-radius: 50%;
  background: conic-gradient(var(--orange) calc(var(--p) * 1%), rgba(255, 255, 255, .08) 0);
  display: grid;
  place-items: center;
  filter: drop-shadow(0 0 8px rgba(255, 138, 61, .2));
}

.time-ring::before {
  content: "";
  position: absolute;
  inset: 3.5px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, #241239, #0E071B);
  border: 1px solid rgba(255, 255, 255, .06);
}

.time-ring span {
  position: relative;
  font-size: 17px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.time-ring.danger {
  background: conic-gradient(#FF3B5C calc(var(--p) * 1%), rgba(255, 255, 255, .08) 0);
  animation: dangerPulse .9s infinite;
}

.time-ring.danger span { color: #FF8095; }

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .09);
  color: var(--text);
  transition: transform .12s ease, background .12s ease;
}

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

.icon-btn:active {
  transform: scale(.93);
  background: rgba(255, 255, 255, .1);
}

.time-track {
  height: 5px;
  flex: 0 0 auto;
  border-radius: 3px;
  background: rgba(255, 255, 255, .07);
  overflow: hidden;
  transition: background .2s ease;
}

.time-track span {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, #FF8A3D, #FF2E9A);
  box-shadow: 0 0 10px rgba(255, 46, 154, .5);
}

.time-track.danger span {
  background: linear-gradient(90deg, #FFB347, #FF3B5C);
  box-shadow: 0 0 10px rgba(255, 59, 92, .55);
}

.arena {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 7px;
}

.arena-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 9px;
  letter-spacing: .16em;
  font-weight: 700;
  color: var(--muted);
  padding: 0 3px;
  flex: 0 0 auto;
}

.live {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--orange);
}

.live i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #FF3B5C;
  box-shadow: 0 0 8px #FF3B5C;
  animation: blink 1.2s infinite;
}

.turf {
  color: rgba(255, 246, 236, .6);
  letter-spacing: .08em;
  font-variant-numeric: tabular-nums;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: min(100%, calc(100vh - 282px), 420px);
  width: min(100%, calc(100dvh - 282px), 420px);
  margin: 0 auto;
  flex: 0 0 auto;
}

.tile {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(37, 22, 62, .9), rgba(11, 6, 22, .96));
  border: 1px solid rgba(255, 255, 255, .07);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), 0 8px 16px rgba(0, 0, 0, .32);
  overflow: hidden;
  text-align: center;
  color: var(--text);
  transition: transform .1s ease, border-color .15s ease, box-shadow .2s ease;
  isolation: isolate;
  -webkit-tap-highlight-color: transparent;
}

.tile::before {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, .045);
  pointer-events: none;
  z-index: 1;
}

.tile::after {
  content: "";
  position: absolute;
  top: 0;
  left: 14%;
  right: 14%;
  height: 2px;
  border-radius: 2px;
  background: var(--c);
  opacity: .35;
  box-shadow: 0 0 8px var(--c);
  pointer-events: none;
  z-index: 1;
}

.tile:active { transform: scale(.95); }

.tile-code {
  position: absolute;
  left: 9px;
  top: 8px;
  z-index: 2;
  font-size: 8px;
  letter-spacing: .12em;
  color: rgba(255, 255, 255, .22);
  font-weight: 700;
}

.tile-name {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 8px;
  z-index: 2;
  font-size: 9.5px;
  letter-spacing: .12em;
  color: rgba(255, 246, 236, .38);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 4px;
}

/* 每个街区的霓虹色 */
.tone-cyan   { --c: #2EF2FF; --glow: rgba(46, 242, 255, .3); }
.tone-orange { --c: #FF8A3D; --glow: rgba(255, 138, 61, .3); }
.tone-pink   { --c: #FF2E9A; --glow: rgba(255, 46, 154, .3); }
.tone-violet { --c: #A98BFF; --glow: rgba(169, 139, 255, .3); }

.tile-state {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding-bottom: 8px;
  opacity: 0;
  transform: scale(.7);
  transition: opacity .15s ease, transform .2s cubic-bezier(.2, .8, .3, 1);
  pointer-events: none;
}

.tile-state .mp-icon {
  width: 36px;
  height: 36px;
  color: var(--c);
  filter: drop-shadow(0 0 9px var(--c));
}

.tile-state b {
  font-size: 9.5px;
  letter-spacing: .12em;
  color: var(--c);
  font-weight: 800;
  white-space: nowrap;
}

.tile.is-gang {
  border-color: var(--c);
  background:
    radial-gradient(circle at 50% 38%, var(--glow), transparent 68%),
    linear-gradient(160deg, rgba(28, 20, 48, .95), rgba(9, 5, 20, .98));
  box-shadow: 0 0 0 1px var(--c), 0 0 22px var(--glow), inset 0 0 18px var(--glow);
  animation: tileIn .18s ease;
}

.tile.is-gang .state-gang { opacity: 1; transform: none; }

.tile.is-drone {
  border-color: #FF3B5C;
  background:
    repeating-linear-gradient(135deg, rgba(255, 59, 92, .1) 0 8px, transparent 8px 16px),
    linear-gradient(160deg, #30101D, #0E050B);
  box-shadow: 0 0 0 1px #FF3B5C, 0 0 22px rgba(255, 59, 92, .35), inset 0 0 18px rgba(255, 59, 92, .2);
  animation: dronePulse .65s infinite alternate;
}

.tile.is-drone .state-drone { opacity: 1; transform: none; }
.tile.is-drone .state-drone .mp-icon,
.tile.is-drone .state-drone b { color: #FF5C7A; filter: drop-shadow(0 0 9px #FF3B5C); }
.tile.is-drone::after { background: #FF3B5C; opacity: .9; box-shadow: 0 0 10px #FF3B5C; }

.tile.is-boss {
  border-color: var(--gold);
  background:
    radial-gradient(circle at 50% 38%, rgba(255, 209, 102, .42), transparent 68%),
    linear-gradient(160deg, #33210E, #150B05);
  box-shadow: 0 0 0 1px var(--gold), 0 0 26px rgba(255, 209, 102, .45), inset 0 0 20px rgba(255, 209, 102, .22);
  animation: bossPulse .8s infinite alternate;
}

.tile.is-boss .state-boss { opacity: 1; transform: none; }
.tile.is-boss .state-boss .mp-icon,
.tile.is-boss .state-boss b { color: var(--gold); filter: drop-shadow(0 0 10px #FFB347); }
.tile.is-boss::after { background: var(--gold); opacity: 1; box-shadow: 0 0 12px var(--gold); }

.tile.is-hit { animation: hitPop .18s ease; }

.tile.is-tap { animation: emptyTap .18s ease; }

.owned-tag {
  position: absolute;
  top: 7px;
  right: 7px;
  z-index: 4;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .04em;
  color: #2A1010;
  background: linear-gradient(180deg, #FFE39A, #FFB347);
  padding: 2px 5px;
  border-radius: 5px;
  opacity: 0;
  transform: scale(.6);
  transition: opacity .2s ease, transform .2s ease;
}

.tile.is-owned .owned-tag { opacity: 1; transform: none; }
.tile.is-owned .tile-name { color: rgba(255, 209, 102, .68); }
.tile.is-owned::before { border-color: rgba(255, 209, 102, .16); }
.tile.is-gang .owned-tag,
.tile.is-drone .owned-tag,
.tile.is-boss .owned-tag { opacity: 0; }

.hype-row {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 2px;
}

.hype-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 9px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .1em;
}

.hype-label .mp-icon {
  width: 13px;
  height: 13px;
  color: var(--orange);
}

.hype-label b {
  margin-left: auto;
  color: var(--orange);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.hype-track {
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, .07);
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(255, 255, 255, .05);
}

.hype-track span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 4px;
  background: linear-gradient(90deg, #FF8A3D, #FF2E9A, #A98BFF);
  box-shadow: 0 0 10px rgba(255, 46, 154, .6);
  transition: width .18s linear;
}

.hype-track.full span { animation: hypeFlash .5s infinite alternate; }

.boss-line {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: rgba(255, 246, 236, .55);
  padding: 0 3px;
  min-height: 14px;
  line-height: 1.3;
  flex: 0 0 auto;
}

.boss-line .mp-icon {
  width: 13px;
  height: 13px;
  color: var(--pink);
  flex: 0 0 13px;
}

.boss-line span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.game-foot {
  flex: 0 0 auto;
  text-align: center;
  font-size: 8.5px;
  color: rgba(255, 246, 236, .32);
  letter-spacing: .04em;
  padding-bottom: 2px;
}

.game-foot b {
  color: rgba(255, 209, 102, .72);
  font-weight: 700;
}

/* 事件横幅 */
.event-banner {
  position: absolute;
  left: 50%;
  top: 38%;
  z-index: 20;
  transform: translate(-50%, -50%) scale(.8);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 12px 26px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(40, 16, 60, .95), rgba(16, 6, 28, .97));
  border: 1px solid var(--orange);
  box-shadow: 0 0 30px rgba(255, 138, 61, .4), inset 0 0 20px rgba(255, 46, 154, .18);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
}

.event-banner b {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: .08em;
  background: linear-gradient(90deg, #FFD166, #FF8A3D, #FF2E9A);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.event-banner span {
  font-size: 10px;
  color: rgba(255, 246, 236, .72);
  letter-spacing: .08em;
}

.event-banner.show { animation: bannerPop 1.55s ease forwards; }

.event-banner.danger {
  border-color: #FF3B5C;
  box-shadow: 0 0 30px rgba(255, 59, 92, .4), inset 0 0 20px rgba(255, 59, 92, .16);
}

.event-banner.danger b {
  background: none;
  -webkit-text-fill-color: #FF8095;
  color: #FF8095;
}

/* 暂停 */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(4, 2, 10, .78);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s ease, visibility .2s ease;
}

.overlay.show {
  opacity: 1;
  visibility: visible;
}

.modal {
  width: 100%;
  max-width: 320px;
  padding: 22px;
  border-radius: 22px;
  text-align: center;
  background: linear-gradient(180deg, #1C1030, #0C0618);
  border: 1px solid rgba(255, 255, 255, .1);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .6);
}

.modal-kicker {
  font-size: 9px;
  letter-spacing: .25em;
  color: var(--orange);
  font-weight: 800;
}

.modal h2 {
  margin-top: 6px;
  font-size: 24px;
  font-weight: 900;
}

.modal p {
  margin-top: 7px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
}

.modal .btn-primary {
  min-height: 52px;
  margin-top: 16px;
}

.modal .btn-primary .btn-label b { font-size: 17px; }

.btn-ghost {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  border-radius: 13px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(255, 255, 255, .04);
  color: rgba(255, 246, 236, .7);
  font-size: 13px;
  font-weight: 700;
  transition: transform .12s ease, background .12s ease;
}

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

.modal .btn-ghost { margin-top: 10px; }

/* ==========================================================================
   结束页
   ========================================================================== */

.screen-end {
  padding: calc(var(--safe-top) + 20px) 20px calc(var(--safe-bottom) + 20px);
  justify-content: center;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.end-wrap {
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.rank-badge {
  position: relative;
  width: 104px;
  height: 104px;
  display: grid;
  place-items: center;
  margin-bottom: 12px;
}

.rank-badge::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 30px;
  background: conic-gradient(from 0deg, #FF8A3D, #FF2E9A, #A98BFF, #2EF2FF, #FF8A3D);
  animation: spin 6s linear infinite;
  filter: blur(1px);
}

.rank-badge::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 26px;
  background: linear-gradient(160deg, #241239, #0A0514);
  border: 1px solid rgba(255, 255, 255, .1);
}

.rank-badge span {
  position: relative;
  z-index: 2;
  font-size: 56px;
  font-weight: 900;
  line-height: 1;
  background: linear-gradient(180deg, #FFF3C4, #FFB347 55%, #FF6B00);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 18px rgba(255, 179, 71, .45));
  font-family: "Arial Black", Arial, sans-serif;
}

.screen-end .kicker { margin-top: 2px; }

.end-title {
  margin-top: 8px;
  font-size: 30px;
  font-weight: 900;
  letter-spacing: .04em;
  background: linear-gradient(100deg, #FFF6EC, #FFC15E 55%, #FF8A3D);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.end-line {
  margin-top: 6px;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--muted);
  max-width: 290px;
}

.result-card {
  width: 100%;
  margin-top: 18px;
  padding: 16px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(30, 18, 52, .84), rgba(10, 5, 20, .92));
  border: 1px solid rgba(255, 255, 255, .08);
  box-shadow: 0 18px 40px rgba(0, 0, 0, .4);
}

.result-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px dashed rgba(255, 255, 255, .09);
}

.result-main small {
  font-size: 9px;
  letter-spacing: .2em;
  color: var(--muted);
  font-weight: 700;
}

.result-main strong {
  font-size: 46px;
  font-weight: 900;
  line-height: 1.05;
  background: linear-gradient(180deg, #FFF6EC, #FFB347);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-variant-numeric: tabular-nums;
  font-family: "Arial Black", Arial, sans-serif;
}

.new-record {
  display: none;
  margin-top: 4px;
  font-size: 9px;
  font-weight: 800;
  color: #2A1010;
  background: linear-gradient(180deg, #FFE39A, #FFB347);
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: .06em;
}

.new-record.show {
  display: inline-block;
  animation: popIn .4s ease;
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.result-grid div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
  padding: 7px 4px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .035);
}

.result-grid b {
  font-size: 16px;
  font-weight: 900;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.result-grid span {
  font-size: 9px;
  color: var(--muted);
}

.end-wrap .btn-primary {
  margin-top: 16px;
  min-height: 58px;
}

.end-wrap .btn-primary .btn-label b { font-size: 19px; }

.end-wrap .btn-ghost { margin-top: 10px; }

/* ==========================================================================
   动效
   ========================================================================== */

@keyframes orbFloat {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(18px, -26px, 0) scale(1.1); }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: .25; }
}

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

@keyframes sheen {
  0%, 62% { left: -40%; opacity: 0; }
  70% { opacity: 1; }
  100% { left: 130%; opacity: 0; }
}

@keyframes comboPop {
  0% { transform: scale(1); }
  40% { transform: scale(1.12) rotate(-1.5deg); }
  100% { transform: scale(1); }
}

@keyframes tileIn {
  0% { transform: scale(.82); }
  60% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

@keyframes hitPop {
  0% { transform: scale(1); filter: brightness(1); }
  45% { transform: scale(.9); filter: brightness(1.9); }
  100% { transform: scale(1); filter: brightness(1); }
}

@keyframes emptyTap {
  0% { transform: scale(1); }
  50% { transform: scale(.96); }
  100% { transform: scale(1); }
}

@keyframes dronePulse {
  0% { box-shadow: 0 0 0 1px #FF3B5C, 0 0 14px rgba(255, 59, 92, .25), inset 0 0 12px rgba(255, 59, 92, .14); }
  100% { box-shadow: 0 0 0 2px #FF3B5C, 0 0 30px rgba(255, 59, 92, .58), inset 0 0 24px rgba(255, 59, 92, .3); }
}

@keyframes bossPulse {
  0% { box-shadow: 0 0 0 1px var(--gold), 0 0 16px rgba(255, 209, 102, .3), inset 0 0 14px rgba(255, 209, 102, .16); }
  100% { box-shadow: 0 0 0 2px var(--gold), 0 0 34px rgba(255, 209, 102, .65), inset 0 0 26px rgba(255, 209, 102, .3); }
}

@keyframes dangerPulse {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(255, 59, 92, .3)); }
  50% { filter: drop-shadow(0 0 14px rgba(255, 59, 92, .85)); }
}

@keyframes hypeFlash {
  0% { filter: brightness(1); }
  100% { filter: brightness(1.6); }
}

@keyframes bannerPop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.72); }
  14% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
  26% { transform: translate(-50%, -50%) scale(1); }
  78% { opacity: 1; transform: translate(-50%, -52%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -62%) scale(.98); }
}

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

@keyframes popIn {
  0% { opacity: 0; transform: scale(.6); }
  70% { opacity: 1; transform: scale(1.08); }
  100% { transform: scale(1); }
}

@keyframes floatUp {
  0% { opacity: 0; transform: translate(-50%, -40%) scale(.6); }
  18% { opacity: 1; transform: translate(-50%, -62%) scale(1.05); }
  100% { opacity: 0; transform: translate(-50%, -190%) scale(.98); }
}

@keyframes dustRise {
  0% { opacity: 0; transform: translate3d(0, 20px, 0) scale(.6); }
  18% { opacity: .8; }
  80% { opacity: .45; }
  100% { opacity: 0; transform: translate3d(var(--dx, 8px), -90px, 0) scale(1); }
}

@keyframes shake {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-6px, 2px); }
  40% { transform: translate(5px, -2px); }
  60% { transform: translate(-4px, 1px); }
  80% { transform: translate(3px, 0); }
}

.arena.shake { animation: shake .38s ease; }

/* ==========================================================================
   适配
   ========================================================================== */

@media (max-height: 720px) {
  .screen-start { gap: 8px; }
  .tile { aspect-ratio: 1 / 1; }
  .screen-end { justify-content: flex-start; }
  .mascot-wrap { max-height: 232px; min-height: 130px; }
  .mascot { max-height: 232px; }
  .logo { font-size: clamp(32px, 10vw, 44px); }
  .tagline { margin-top: 7px; }
  .start-bottom { padding: 10px; gap: 8px; }
  .legend li { padding: 6px 5px; gap: 5px; }
  .btn-primary { min-height: 56px; }
  .btn-label b { font-size: 20px; }
  .score-box strong { font-size: 26px; }
  .time-ring { width: 46px; height: 46px; flex-basis: 46px; }
  .time-ring span { font-size: 16px; }
  .grid {
    width: min(100%, calc(100vh - 262px), 420px);
    width: min(100%, calc(100dvh - 262px), 420px);
  }
  .game-foot { display: none; }
}

@media (max-height: 620px) {
  .mascot-tag { display: none; }
  .tagline { display: none; }
  .mascot-wrap { min-height: 112px; max-height: 172px; }
  .mascot { max-height: 172px; }
  .legend small { display: none; }
  .legend b { font-size: 9.5px; }
  .screen-start { padding-top: calc(var(--safe-top) + 8px); }
  .logo { font-size: clamp(30px, 9.6vw, 40px); }
  .kicker { font-size: 8px; padding: 4px 9px; }
  .grid {
    width: min(100%, calc(100vh - 238px), 420px);
    width: min(100%, calc(100dvh - 238px), 420px);
  }
  .combo-box small { display: none; }
  .boss-line { font-size: 9px; }
  .end-title { font-size: 25px; }
  .rank-badge { width: 86px; height: 86px; }
  .rank-badge span { font-size: 46px; }
  .result-main strong { font-size: 38px; }
}

@media (max-width: 360px) {
  .combo-box small { display: none; }
  .score-box { min-width: 78px; }
  .score-box strong { font-size: 26px; }
  .hud-label { font-size: 8px; letter-spacing: .08em; }
  .time-box { gap: 5px; }
  .icon-btn { width: 34px; height: 34px; }
  .time-ring { width: 46px; height: 46px; flex-basis: 46px; }
  .time-ring span { font-size: 16px; }
}

@media (min-width: 521px) {
  .screen-start {
    padding-left: 22px;
    padding-right: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}
