:root {
  --orange: #FF8A3D;
  --orange-2: #FFC24D;
  --amber: #FFE39A;
  --ink: #050814;
  --panel: rgba(9, 15, 36, .82);
  --panel-solid: #0B112A;
  --line: rgba(132, 172, 255, .17);
  --line-warm: rgba(255, 172, 92, .28);
  --blue: #63E6FF;
  --purple: #C58BFF;
  --red: #FF5A4E;
  --text: #F4F7FF;
  --muted: #95A3C8;
  --num: "SFMono-Regular", "SF Mono", "Roboto Mono", "Courier New", monospace;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

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

body {
  background:
    radial-gradient(80% 60% at 50% 10%, #121b3a 0%, transparent 70%),
    #05070f;
}

[hidden] { display: none !important; }

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

img { display: block; }

.stage {
  position: relative;
  width: 100%;
  max-width: 520px;
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: #050914;
  isolation: isolate;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

@media (min-width: 560px) {
  body {
    background:
      radial-gradient(70% 60% at 50% 45%, #101a38 0%, #05070f 68%),
      #05070f;
  }
  .stage {
    box-shadow: 0 0 90px rgba(0, 0, 0, .85), 0 0 0 1px rgba(120, 160, 255, .08);
  }
}

/* ============ 场景 ============ */

.scene {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(90% 60% at 24% 44%, #24356e 0%, #0d1634 52%, #050914 100%);
}

.scene-art {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 18% 50%;
  opacity: 0;
  transform: scale(1.015);
  transition: opacity .7s ease;
  image-rendering: auto;
}

.scene-art.loaded { opacity: 1; }

.scene-tint {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(110% 65% at 22% 42%, rgba(74, 152, 255, .12) 0%, transparent 58%),
    linear-gradient(180deg,
      rgba(3, 6, 18, .995) 0%,
      rgba(3, 6, 18, .988) 9%,
      rgba(3, 6, 18, .95) 14%,
      rgba(3, 6, 18, .72) 20%,
      rgba(3, 6, 18, .32) 27%,
      rgba(3, 6, 18, 0) 38%,
      rgba(3, 6, 18, 0) 55%,
      rgba(3, 6, 18, .34) 72%,
      rgba(3, 6, 18, .8) 88%,
      rgba(3, 6, 18, .97) 100%);
  pointer-events: none;
}

.scene-glow {
  position: absolute;
  left: 50%;
  bottom: 4%;
  width: 120%;
  height: 46%;
  transform: translateX(-50%);
  background: radial-gradient(52% 62% at 50% 78%, rgba(255, 138, 61, .28) 0%, rgba(255, 138, 61, .1) 42%, transparent 72%);
  mix-blend-mode: screen;
  pointer-events: none;
}

.fx {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  pointer-events: none;
}

.grain {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: .22;
  background: repeating-linear-gradient(0deg,
    rgba(255, 255, 255, .035) 0px,
    rgba(255, 255, 255, .035) 1px,
    transparent 1px,
    transparent 3px);
  mix-blend-mode: soft-light;
}

.vignette {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background: radial-gradient(118% 82% at 50% 54%, transparent 44%, rgba(2, 4, 12, .58) 100%);
}

/* ============ HUD ============ */

.hud {
  position: absolute;
  z-index: 8;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--safe-top) + 14px) 16px 0;
  pointer-events: none;
}

.hud > * { pointer-events: auto; }

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

.pilot-badge {
  position: relative;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  overflow: hidden;
  color: var(--orange-2);
  background: linear-gradient(155deg, #22315F 0%, #0B122B 62%, #070C1E 100%);
  border: 1.5px solid rgba(255, 181, 110, .58);
  box-shadow:
    0 0 0 3px rgba(255, 138, 61, .09),
    inset 0 1px 0 rgba(255, 255, 255, .2),
    0 8px 18px rgba(0, 0, 0, .45);
}

.pilot-badge::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .08);
  pointer-events: none;
}

.pilot-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 45%;
}

.pilot-name {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .04em;
  text-shadow: 0 2px 8px rgba(0, 0, 0, .6);
  white-space: nowrap;
}

.pilot-best {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 3px;
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: .03em;
  white-space: nowrap;
}

.pilot-best .mp-icon {
  width: 12px;
  height: 12px;
  color: var(--orange-2);
}

.pilot-best b {
  font-family: var(--num);
  font-size: 12px;
  color: var(--amber);
}

.icon-btn {
  width: 42px;
  height: 42px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: #DCE7FF;
  background: linear-gradient(160deg, rgba(26, 38, 76, .88), rgba(8, 13, 30, .9));
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .11), 0 6px 16px rgba(0, 0, 0, .35);
  transition: transform .1s ease, border-color .2s;
}

.icon-btn:active { transform: scale(.92); border-color: var(--line-warm); }
.icon-btn .mp-icon { width: 21px; height: 21px; }

.stats {
  position: absolute;
  z-index: 8;
  top: calc(var(--safe-top) + 72px);
  left: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 7px;
  pointer-events: none;
}

.chip {
  height: 34px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 9px;
  border-radius: 11px;
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: .02em;
  background: rgba(7, 13, 31, .74);
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 5px 14px rgba(0, 0, 0, .28);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.chip .mp-icon { width: 15px; height: 15px; flex: 0 0 15px; }

.chip b {
  margin-left: auto;
  font-family: var(--num);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -.02em;
  color: #FFF;
}

.chip-ore, .chip-gem { flex: 1 1 0; min-width: 0; }
.chip-ore .mp-icon { color: var(--orange-2); }
.chip-gem .mp-icon { color: var(--purple); }

.chip-time {
  flex: 0 0 auto;
  min-width: 76px;
  justify-content: center;
  color: #FFD58A;
  border-color: rgba(255, 178, 90, .26);
  background: linear-gradient(180deg, rgba(52, 32, 16, .82), rgba(18, 13, 24, .86));
}

.chip-time .mp-icon { color: #FFC24D; }

.chip-time b {
  margin: 0;
  font-size: 16px;
  color: #FFE2A6;
}

.chip-time span { font-size: 9px; color: rgba(255, 214, 150, .7); }

.chip-time.low {
  border-color: rgba(255, 90, 78, .6);
  background: linear-gradient(180deg, rgba(88, 24, 24, .86), rgba(30, 9, 16, .9));
  animation: lowPulse .9s ease-in-out infinite;
}

.chip-time.low .mp-icon, .chip-time.low b { color: #FF8A7C; }

.time-track {
  position: absolute;
  z-index: 8;
  top: calc(var(--safe-top) + 112px);
  left: 16px;
  right: 16px;
  height: 4px;
  border-radius: 4px;
  overflow: hidden;
  background: rgba(255, 255, 255, .09);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .4);
  pointer-events: none;
}

.time-track i {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #FF8A3D 0%, #FFC24D 72%, #FFE9A8 100%);
  box-shadow: 0 0 10px rgba(255, 170, 70, .6);
  transform-origin: left center;
  transition: background .3s;
}

.time-track.low i {
  background: linear-gradient(90deg, #FF3F3F 0%, #FF7A45 100%);
  box-shadow: 0 0 12px rgba(255, 70, 60, .75);
}

/* ============ 连击 ============ */

.combo {
  position: absolute;
  z-index: 8;
  top: calc(var(--safe-top) + 126px);
  left: 50%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 12px 8px;
  border-radius: 12px;
  background: rgba(7, 13, 31, .8);
  border: 1px solid rgba(255, 178, 90, .32);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .08);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, -7px) scale(.96);
  transition: opacity .18s ease, transform .18s ease, visibility .18s;
  pointer-events: none;
  white-space: nowrap;
}

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

.combo.hot { border-color: rgba(255, 210, 120, .7); }

.combo-main { display: flex; align-items: baseline; gap: 5px; }
.combo-main span { font-size: 9.5px; color: var(--muted); letter-spacing: .12em; }
.combo-main b {
  font-family: var(--num);
  font-size: 18px;
  font-weight: 900;
  color: #FFF2C9;
  text-shadow: 0 0 12px rgba(255, 190, 80, .7);
}

.combo-mult {
  padding: 2px 7px;
  border-radius: 7px;
  font-family: var(--num);
  font-size: 13px;
  font-weight: 900;
  color: #3A1A05;
  background: linear-gradient(180deg, #FFE28A, #FFAE3F);
  box-shadow: 0 2px 0 #8C4A0C, inset 0 1px 0 rgba(255, 255, 255, .65);
}

.combo-mult.pop { animation: multPop .3s cubic-bezier(.2, 1.6, .4, 1); }

.combo-track {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 3px;
  height: 2px;
  overflow: hidden;
  border-radius: 2px;
  background: rgba(255, 255, 255, .1);
}

.combo-track i {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #FF9A44, #FFD66E);
}

/* ============ 矿脉战场 ============ */

.field {
  position: absolute;
  z-index: 6;
  left: 0;
  right: 0;
  top: 32%;
  bottom: 11%;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .25s ease, visibility .25s;
}

.stage.playing .field {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.ore {
  position: absolute;
  width: var(--s, 72px);
  height: var(--s, 72px);
  padding: 0;
  border: 0;
  background: none;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  cursor: pointer;
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, .5));
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.ore-body {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  animation: bob 3.4s ease-in-out infinite;
  animation-delay: var(--d, 0s);
  will-change: transform;
}

.ore-glow {
  position: absolute;
  inset: -30%;
  border-radius: 50%;
  background: radial-gradient(circle, var(--glow, rgba(90, 220, 255, .5)) 0%, transparent 66%);
  opacity: .9;
  animation: oreGlow 2.1s ease-in-out infinite;
  pointer-events: none;
}

.ore-art {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  transform-origin: 50% 82%;
  overflow: visible;
}

.ore--blue { --glow: rgba(84, 220, 255, .55); --bar: #63E6FF; }
.ore--gold { --glow: rgba(255, 194, 60, .62); --bar: #FFC24D; }
.ore--gas  { --glow: rgba(255, 74, 64, .58); --bar: #FF6B5E; }

.ore--gold .ore-body { animation-duration: 2.7s; }
.ore--gas .ore-glow { animation-duration: 1.15s; }

.ore.hit .ore-art { animation: oreHit .17s ease-out; }
.ore.hit .ore-glow { opacity: 1; }

.ore.spawn .ore-art { animation: oreSpawn .34s cubic-bezier(.2, 1.5, .4, 1); }

.ore.dead {
  opacity: 0;
  transform: translate(-50%, -50%) scale(1.45) rotate(6deg);
  transition: opacity .16s ease, transform .18s ease;
  pointer-events: none;
}

.ore:focus-visible {
  outline: 2px solid rgba(255, 205, 130, .9);
  outline-offset: 4px;
  border-radius: 12px;
}

.ore-hp {
  position: absolute;
  left: 50%;
  bottom: -7px;
  display: flex;
  gap: 2px;
  padding: 2.5px 4px;
  transform: translateX(-50%);
  border-radius: 5px;
  background: rgba(4, 8, 20, .74);
  border: 1px solid rgba(255, 255, 255, .12);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .4);
}

.ore-hp i {
  display: block;
  width: 8px;
  height: 3px;
  border-radius: 2px;
  background: var(--bar, #63E6FF);
  box-shadow: 0 0 5px var(--bar, #63E6FF);
  transition: background .12s, box-shadow .12s;
}

.ore-hp i.dead { background: rgba(255, 255, 255, .16); box-shadow: none; }

.ore-tag {
  position: absolute;
  top: -5px;
  right: -7px;
  padding: 3px 4px;
  border-radius: 4px;
  font-family: var(--num);
  font-size: 8px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: .06em;
  color: #3A1A05;
  background: linear-gradient(180deg, #FFEAA0, #FFC24D);
  border: 1px solid rgba(90, 45, 5, .55);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .35);
}

.ore-warn {
  position: absolute;
  top: -7px;
  right: -5px;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: #FFE9DA;
  background: linear-gradient(180deg, #FF6A4E, #C21F26);
  border: 1px solid rgba(255, 190, 150, .5);
  box-shadow: 0 0 12px rgba(255, 70, 55, .6), 0 2px 5px rgba(0, 0, 0, .35);
  animation: warnBlink 1.1s ease-in-out infinite;
}

.ore-warn .mp-icon { width: 13px; height: 13px; }

/* ============ 浮动反馈 ============ */

.float-text {
  position: absolute;
  z-index: 900;
  transform: translate(-50%, -50%);
  font-family: var(--num);
  font-size: 19px;
  font-weight: 900;
  color: #FFE39A;
  text-shadow: 0 2px 0 #491F04, 0 0 14px rgba(255, 190, 70, .9);
  pointer-events: none;
  white-space: nowrap;
  animation: floatUp .8s cubic-bezier(.15, .7, .3, 1) forwards;
}

.float-text.bonus { color: #9BF1FF; font-size: 15px; text-shadow: 0 2px 0 #073B57, 0 0 14px rgba(90, 225, 255, .9); }
.float-text.bad { color: #FF7A6A; font-size: 17px; text-shadow: 0 2px 0 #490A06, 0 0 14px rgba(255, 70, 50, .9); }

.burst-ring {
  position: absolute;
  z-index: 880;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--c, #FFD36B);
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: burstRing .48s ease-out forwards;
}

.flash {
  position: absolute;
  inset: 0;
  z-index: 9;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(90% 70% at 50% 60%, rgba(255, 120, 40, .34), transparent 68%);
}

.flash.fire { animation: flashFire .34s ease-out; }
.flash.danger { background: radial-gradient(90% 75% at 50% 55%, rgba(255, 40, 40, .45), transparent 70%); animation: flashFire .4s ease-out; }
.flash.win { background: radial-gradient(90% 75% at 50% 55%, rgba(255, 205, 90, .32), transparent 70%); animation: flashFire .5s ease-out; }

.stage.shake .scene,
.stage.shake .field { animation: shake .22s ease-out; }

/* ============ 开始面板 ============ */

.deck {
  position: absolute;
  z-index: 10;
  left: 12px;
  right: 12px;
  bottom: calc(var(--safe-bottom) + 12px);
  padding: 12px;
  border-radius: 20px;
  background:
    radial-gradient(120% 100% at 18% 0%, rgba(255, 138, 61, .13) 0%, transparent 58%),
    linear-gradient(180deg, rgba(17, 24, 53, .93) 0%, rgba(6, 10, 25, .975) 100%);
  border: 1px solid rgba(255, 172, 92, .24);
  box-shadow:
    0 -16px 44px rgba(0, 0, 0, .56),
    inset 0 1px 0 rgba(255, 255, 255, .1),
    inset 0 0 0 1px rgba(255, 255, 255, .02);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: transform .38s cubic-bezier(.2, .85, .3, 1), opacity .26s ease;
  will-change: transform;
}

.deck::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 22px;
  right: 22px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 198, 120, .75), transparent);
  pointer-events: none;
}

.deck.out {
  transform: translateY(calc(100% + 40px));
  opacity: 0;
  pointer-events: none;
}

.deck-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 5px 10px;
  padding: 0 2px;
}

.deck-brand {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .18em;
  color: rgba(255, 196, 130, .82);
  text-transform: uppercase;
  white-space: nowrap;
}

.brand-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 8px var(--orange);
  animation: brandPulse 1.8s ease-in-out infinite;
}

.brand-sep { color: rgba(255, 196, 130, .35); }

.deck-rules {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rule {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 9px;
  color: #8492B6;
  white-space: nowrap;
}

.rule b {
  font-family: var(--num);
  font-size: 9.5px;
  font-weight: 700;
  color: #D7E2FF;
}

.rule .warn-text { color: #FF8A7C; }

.rule .mp-icon {
  width: 10px;
  height: 10px;
  color: #FF7A6A;
}

.legend-ore {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  clip-path: polygon(50% 0%, 100% 45%, 76% 100%, 24% 100%, 0% 45%);
}

.legend-ore.blue { background: linear-gradient(160deg, #C9FBFF, #36B9F0 55%, #1249A2); box-shadow: 0 0 6px rgba(90, 220, 255, .8); }
.legend-ore.gold { background: linear-gradient(160deg, #FFF4B0, #FFC24D 55%, #B5640C); box-shadow: 0 0 6px rgba(255, 190, 60, .8); }

/* 主按钮 */

.start-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  height: 60px;
  margin-top: 9px;
  padding: 0 18px;
  border: 0;
  border-radius: 15px;
  overflow: hidden;
  color: #3E1B04;
  background: linear-gradient(180deg, #FFDE8B 0%, #FFB44C 42%, #F47B21 100%);
  box-shadow:
    0 6px 0 #8C3D0B,
    0 14px 30px rgba(255, 128, 40, .34),
    inset 0 2px 0 rgba(255, 255, 255, .72),
    inset 0 -2px 0 rgba(130, 55, 5, .28);
  transition: transform .1s ease, box-shadow .1s ease, filter .2s;
  -webkit-tap-highlight-color: transparent;
}

.start-btn::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 11px;
  border: 1px solid rgba(255, 244, 200, .42);
  pointer-events: none;
}

.start-btn:active {
  transform: translateY(4px);
  filter: saturate(1.08);
  box-shadow:
    0 2px 0 #8C3D0B,
    0 7px 16px rgba(255, 128, 40, .26),
    inset 0 2px 0 rgba(255, 255, 255, .6),
    inset 0 -1px 0 rgba(130, 55, 5, .28);
}

.start-btn .pick {
  position: relative;
  z-index: 1;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  filter: drop-shadow(0 2px 2px rgba(96, 40, 0, .45));
}

.btn-copy {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1;
}

.btn-copy b {
  font-size: 21px;
  font-weight: 900;
  letter-spacing: .14em;
  text-shadow: 0 1px 0 rgba(255, 245, 205, .8);
}

.btn-copy small {
  margin-top: 4px;
  font-family: var(--num);
  font-size: 7.5px;
  font-weight: 700;
  letter-spacing: .26em;
  color: rgba(87, 39, 4, .58);
}

.btn-shine {
  position: absolute;
  top: -40%;
  left: -30%;
  width: 26%;
  height: 180%;
  transform: rotate(24deg);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .68), transparent);
  animation: shine 3.4s ease-in-out infinite;
  pointer-events: none;
}

.start-btn.small {
  height: 55px;
  margin-top: 15px;
  border-radius: 14px;
}

.start-btn.small .btn-copy { align-items: center; }
.start-btn.small .btn-copy b { font-size: 18px; }

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

.result {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(2, 5, 14, .66);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .26s ease, visibility .26s;
}

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

.result:not(.show) { pointer-events: none; }

.result-card {
  position: relative;
  width: 100%;
  max-width: 340px;
  padding: 26px 19px 17px;
  border-radius: 24px;
  text-align: center;
  background:
    radial-gradient(120% 70% at 50% 0%, rgba(255, 170, 70, .14) 0%, transparent 55%),
    linear-gradient(180deg, #161F42 0%, #080D22 100%);
  border: 1px solid rgba(255, 180, 100, .3);
  box-shadow:
    0 26px 60px rgba(0, 0, 0, .64),
    inset 0 1px 0 rgba(255, 255, 255, .12),
    inset 0 0 0 1px rgba(255, 255, 255, .02);
  transform: translateY(14px) scale(.95);
  transition: transform .32s cubic-bezier(.2, .9, .3, 1.18);
}

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

.result-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 26px;
  right: 26px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 205, 130, .8), transparent);
}

.grade {
  width: 66px;
  height: 66px;
  margin: -49px auto 10px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  font-family: var(--num);
  font-size: 36px;
  font-weight: 900;
  color: #3E1B04;
  background: linear-gradient(160deg, #FFE695, #FFB13F 52%, #E9771D);
  border: 3px solid #2B1606;
  box-shadow:
    0 0 0 4px rgba(255, 170, 70, .12),
    0 12px 28px rgba(255, 130, 40, .3),
    inset 0 2px 0 rgba(255, 255, 255, .6);
  transform: rotate(-4deg);
  text-shadow: 0 1px 0 rgba(255, 245, 205, .7);
}

.grade.grade-s {
  background: linear-gradient(160deg, #FFF7CF, #FFD35E 48%, #FF9A24);
  color: #4A2002;
  box-shadow: 0 0 0 4px rgba(255, 200, 90, .16), 0 0 34px rgba(255, 190, 70, .55), inset 0 2px 0 rgba(255, 255, 255, .7);
  animation: gradePop .55s cubic-bezier(.2, 1.5, .4, 1);
}

.grade.grade-a {
  background: linear-gradient(160deg, #D8FBFF, #65DDF6 50%, #2496D4);
  color: #052A3C;
  box-shadow: 0 0 0 4px rgba(90, 220, 255, .14), 0 0 30px rgba(90, 220, 255, .4), inset 0 2px 0 rgba(255, 255, 255, .7);
}

.grade.grade-b {
  background: linear-gradient(160deg, #E3ECFF, #9FB5E6 50%, #6079B8);
  color: #101F42;
  box-shadow: 0 0 0 4px rgba(140, 170, 255, .12), 0 10px 24px rgba(80, 110, 200, .28), inset 0 2px 0 rgba(255, 255, 255, .6);
}

.grade.grade-c {
  background: linear-gradient(160deg, #C3CCE2, #8494B8 55%, #586688);
  color: #101728;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .5);
}

.result-kicker {
  font-size: 10px;
  letter-spacing: .26em;
  color: #8F9CC0;
  text-transform: uppercase;
}

.result-score {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 7px;
  margin-top: 3px;
}

.result-score b {
  font-family: var(--num);
  font-size: 44px;
  font-weight: 900;
  letter-spacing: -.03em;
  line-height: 1.08;
  color: #FFF;
  text-shadow: 0 0 24px rgba(255, 180, 80, .35);
}

.result-score span {
  font-size: 11px;
  color: #A9B6D8;
}

.newbest {
  display: none;
  width: fit-content;
  margin: 4px auto 0;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .08em;
  color: #3E1B04;
  background: linear-gradient(180deg, #FFE99A, #FFC24D);
  box-shadow: 0 2px 8px rgba(255, 190, 70, .35);
}

.newbest.show { display: block; animation: newBest .5s cubic-bezier(.2, 1.5, .4, 1); }

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 13px;
  padding: 10px 0;
  border-radius: 12px;
  background: rgba(4, 8, 20, .55);
  border: 1px solid rgba(255, 255, 255, .07);
}

.result-grid > div {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.result-grid > div + div::before {
  content: "";
  position: absolute;
  left: 0;
  top: 3px;
  bottom: 3px;
  width: 1px;
  background: rgba(255, 255, 255, .08);
}

.result-grid span { font-size: 9px; color: #8492B6; letter-spacing: .04em; }
.result-grid b { font-family: var(--num); font-size: 17px; color: #EAF0FF; }

.result-foot {
  margin-top: 9px;
  font-size: 9.5px;
  line-height: 1.5;
  color: #7784A8;
}

/* ============ 提示 / 启动 ============ */

.toast {
  position: absolute;
  z-index: 25;
  top: 24%;
  left: 50%;
  transform: translate(-50%, -8px);
  padding: 8px 15px;
  border-radius: 10px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .04em;
  color: #FFE6B8;
  background: rgba(8, 14, 34, .9);
  border: 1px solid rgba(255, 180, 100, .34);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .08);
  opacity: 0;
  visibility: hidden;
  transition: opacity .18s ease, transform .18s ease, visibility .18s;
  pointer-events: none;
  white-space: nowrap;
}

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

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

.boot {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background:
    radial-gradient(75% 55% at 50% 45%, rgba(8, 14, 34, .48) 0%, rgba(5, 9, 24, .88) 62%, rgba(3, 6, 16, .97) 100%),
    url("images/gen/gptimg_1795324850_look.png") center / cover no-repeat,
    #04060F;
  color: #B7C4E6;
  font-size: 11px;
  letter-spacing: .18em;
  transition: opacity .32s ease, visibility .32s;
  text-shadow: 0 1px 8px rgba(0, 0, 0, .8);
}

.boot.done { opacity: 0; visibility: hidden; pointer-events: none; }

.boot-ore {
  width: 34px;
  height: 44px;
  background: linear-gradient(160deg, #DAFFFF 0%, #65E5FF 38%, #2C8FE8 72%, #12449C 100%);
  clip-path: polygon(50% 0%, 100% 42%, 72% 100%, 28% 100%, 0% 42%);
  filter: drop-shadow(0 0 18px rgba(95, 225, 255, .7));
  animation: bootFloat 1.5s ease-in-out infinite;
}

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

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

@keyframes oreGlow {
  0%, 100% { opacity: .68; transform: scale(.94); }
  50% { opacity: 1; transform: scale(1.06); }
}

@keyframes oreHit {
  0% { transform: scale(1) rotate(0); }
  35% { transform: scale(1.12) rotate(-4deg); }
  70% { transform: scale(.94) rotate(2deg); }
  100% { transform: scale(1) rotate(0); }
}

@keyframes oreSpawn {
  0% { transform: scale(.3) translateY(10px); opacity: 0; }
  60% { transform: scale(1.08) translateY(0); opacity: 1; }
  100% { transform: scale(1); }
}

@keyframes floatUp {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(.7); }
  18% { opacity: 1; transform: translate(-50%, -55%) scale(1.12); }
  100% { opacity: 0; transform: translate(-50%, -170%) scale(1); }
}

@keyframes burstRing {
  0% { width: 14px; height: 14px; opacity: 1; border-width: 3px; }
  100% { width: 92px; height: 92px; opacity: 0; border-width: 1px; }
}

@keyframes flashFire {
  0% { opacity: 0; }
  16% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes shake {
  0%, 100% { transform: translate(0, 0); }
  15% { transform: translate(-4px, 2px); }
  32% { transform: translate(4px, -3px); }
  48% { transform: translate(-3px, -1px); }
  66% { transform: translate(3px, 2px); }
  84% { transform: translate(-1px, 1px); }
}

@keyframes shine {
  0%, 58% { left: -32%; }
  80%, 100% { left: 120%; }
}

@keyframes brandPulse {
  0%, 100% { opacity: .55; transform: scale(.85); }
  50% { opacity: 1; transform: scale(1.15); }
}

@keyframes lowPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 80, 70, .35); }
  50% { box-shadow: 0 0 0 5px rgba(255, 80, 70, 0); }
}

@keyframes warnBlink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .65; transform: scale(.92); }
}

@keyframes multPop {
  0% { transform: scale(.7) rotate(-5deg); }
  55% { transform: scale(1.18) rotate(2deg); }
  100% { transform: scale(1); }
}

@keyframes gradePop {
  0% { transform: rotate(-4deg) scale(.4); }
  60% { transform: rotate(-4deg) scale(1.14); }
  100% { transform: rotate(-4deg) scale(1); }
}

@keyframes newBest {
  0% { opacity: 0; transform: scale(.6); }
  60% { transform: scale(1.1); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes bootFloat {
  0%, 100% { transform: translateY(-4px) scale(.95); }
  50% { transform: translateY(5px) scale(1.05); }
}


@media (max-width: 350px) {
  .chip-ore span, .chip-gem span { display: none; }
  .chip { padding: 0 7px; gap: 4px; }
  .chip-ore, .chip-gem { justify-content: center; }
  .chip-ore b, .chip-gem b { margin-left: 0; }
  .deck-brand { display: none; }
  .deck-rules { width: 100%; justify-content: center; gap: 8px; }
}

@media (max-height: 730px) {
  .deck { padding: 10px 12px; border-radius: 18px; }
  .start-btn { height: 56px; margin-top: 8px; border-radius: 14px; }
  .btn-copy b { font-size: 19px; }
  .deck-brand { font-size: 9px; }
  .rule { font-size: 8.5px; }
  .pilot-badge { width: 42px; height: 42px; flex-basis: 42px; }
  .hud { padding-top: calc(var(--safe-top) + 11px); }
  .stats { top: calc(var(--safe-top) + 66px); }
  .time-track { top: calc(var(--safe-top) + 105px); }
  .combo { top: calc(var(--safe-top) + 118px); }
}

@media (max-height: 660px) {
  .deck { padding: 9px 12px; }
  .start-btn { height: 52px; margin-top: 7px; }
  .btn-copy b { font-size: 18px; }
  .btn-copy small { display: none; }
  .result-card { padding-top: 22px; }
  .result-score b { font-size: 38px; }
  .result-grid { margin-top: 10px; padding: 8px 0; }
}

@media (hover: hover) and (pointer: fine) {
  .icon-btn:hover { border-color: var(--line-warm); }
  .start-btn:hover { filter: brightness(1.04); }
  .ore:hover .ore-art { filter: brightness(1.12); }
}

@media (prefers-reduced-motion: reduce) {
  .ore-body, .ore-glow, .btn-shine, .brand-dot, .ore-warn, .boot-ore {
    animation: none !important;
  }
}
