/* ============================================================
   星核 · Stellar Merge — 视觉层
   ============================================================ */

:root {
  --bg: #04060b;
  --ink: #e8f0ff;
  --muted: rgba(170, 198, 230, 0.56);
  --line: rgba(110, 180, 240, 0.12);
  --glass: rgba(12, 20, 34, 0.62);
  --gap: 12px;
  --pad: 12px;
  --radius: 8px;
  --cyan: #4fe6ff;
  --violet: #a879ff;
  --amber: #ffb35c;
  --font: "Avenir Next", "Optima", "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Roboto Mono",
          Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(18px + env(safe-area-inset-top)) 16px calc(20px + env(safe-area-inset-bottom));
  overflow-x: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid rgba(150, 195, 255, 0.75);
  outline-offset: 2px;
}

/* ---------- 背景 ---------- */

.stars,
.nebula,
.vignette {
  position: fixed;
  pointer-events: none;
  z-index: 0;
}

.stars {
  inset: 0;
}

.nebula {
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.55;
  will-change: transform;
  transition: opacity 0.4s ease;
}

/* 合成时背景星云跟着亮一下 */
body.is-flare .nebula-a {
  opacity: 0.85;
}

body.is-flare .nebula-b {
  opacity: 0.8;
}

.nebula-a {
  width: 60vmax;
  height: 46vmax;
  top: -16vmax;
  left: -14vmax;
  background: radial-gradient(circle, rgba(92, 70, 255, 0.55), transparent 62%);
  animation: drift 28s ease-in-out infinite alternate;
}

.nebula-b {
  width: 54vmax;
  height: 44vmax;
  right: -16vmax;
  bottom: -20vmax;
  background: radial-gradient(circle, rgba(0, 186, 196, 0.3), transparent 64%);
  animation: drift 34s ease-in-out infinite alternate-reverse;
}

.vignette {
  inset: 0;
  background: radial-gradient(ellipse at 50% 18%, transparent 42%, rgba(0, 0, 0, 0.6) 100%);
}

@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(6vmax, 4vmax, 0) scale(1.12); }
}

/* ---------- 布局 ---------- */

.app {
  position: relative;
  z-index: 1;
  width: min(94vw, 480px);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

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

.brand-orb {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex: none;
  background:
    radial-gradient(circle at 34% 30%, #fffced 0%, #ffc95c 32%, #ff7a2f 58%, rgba(255, 122, 47, 0) 74%);
  box-shadow: 0 0 18px rgba(255, 186, 78, 0.7), 0 0 44px rgba(255, 120, 60, 0.35);
  position: relative;
}

.brand-orb::after {
  content: "";
  position: absolute;
  inset: -32%;
  border-radius: 50%;
  border: 1px solid rgba(255, 210, 140, 0.35);
  transform: rotate(-18deg) scaleY(0.55);
}

.brand-text h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 0.14em;
  line-height: 1.05;
  background: linear-gradient(120deg, #ffffff 10%, #cfe0ff 52%, #c4a6ff 92%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-text p {
  margin: 3px 0 0;
  font-size: 8px;
  letter-spacing: 0.42em;
  color: rgba(200, 214, 255, 0.45);
}

.bump {
  animation: bump 0.34s cubic-bezier(0.2, 1.6, 0.35, 1);
}

@keyframes bump {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.18); }
  100% { transform: scale(1); }
}

.score-addition {
  position: absolute;
  left: 50%;
  top: -2px;
  font-size: 11px;
  font-weight: 600;
  color: #9ff0cd;
  pointer-events: none;
  animation: scoreFloat 0.75s ease-out forwards;
}

@keyframes scoreFloat {
  0%   { opacity: 0; transform: translate(-50%, 2px); }
  20%  { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -16px); }
}

/* ---------- 状态条 ---------- */

.statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 32px;
}

.max-tier {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: var(--muted);
  min-width: 0;
}

.max-tier-label {
  letter-spacing: 0.1em;
  white-space: nowrap;
}

.max-tier-orb {
  flex: none;
}

.max-tier-name {
  color: rgba(232, 240, 255, 0.82);
  font-size: 12px;
  white-space: nowrap;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--glass);
  color: rgba(214, 226, 255, 0.75);
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.icon-btn:hover {
  color: #fff;
  border-color: rgba(180, 205, 255, 0.35);
  background: rgba(255, 255, 255, 0.08);
}

.icon-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-btn.is-muted .wave {
  opacity: 0.25;
}

.ghost-btn {
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--glass);
  color: rgba(222, 232, 255, 0.7);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.ghost-btn:hover {
  color: #fff;
  border-color: rgba(180, 205, 255, 0.35);
  background: rgba(255, 255, 255, 0.08);
}

.solid-btn {
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #0a0e1c;
  background: linear-gradient(135deg, #fff6d6, #a9dcff 52%, #d3b6ff);
  box-shadow: 0 10px 26px -12px rgba(150, 200, 255, 0.9);
  transition: transform 0.16s ease, box-shadow 0.2s ease;
}

.solid-btn:hover {
  transform: translateY(-1px);
}

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

.solid-btn:disabled {
  opacity: 0.5;
  cursor: default;
  transform: none;
}

/* ---------- 棋盘 ---------- */

.board {
  --gap: 12px;
  --pad: 12px;
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  padding: var(--pad);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 22% 8%, rgba(72, 96, 190, 0.25), transparent 55%),
    linear-gradient(158deg, rgba(22, 29, 58, 0.9), rgba(8, 11, 24, 0.94));
  box-shadow:
    0 40px 80px -40px rgba(0, 0, 0, 0.95),
    0 0 60px -20px rgba(90, 110, 255, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  isolation: isolate;
}

.board::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(140deg, rgba(160, 185, 255, 0.4), rgba(255, 255, 255, 0.02) 38%, rgba(186, 128, 255, 0.32));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  pointer-events: none;
}

.board-inner {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.grid {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: var(--gap);
}

.cell {
  border-radius: 20%;
  background: radial-gradient(circle at 50% 38%, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.012));
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.045),
    inset 0 -10px 20px rgba(0, 0, 0, 0.35);
}

.tile-container {
  position: absolute;
  inset: 0;
}

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

/* ---------- 天体瓦片 ---------- */

.tile {
  position: absolute;
  top: 0;
  left: 0;
  width: calc((100% - 3 * var(--gap)) / 4);
  height: calc((100% - 3 * var(--gap)) / 4);
  transform:
    translate(
      calc(var(--x, 0) * (100% + var(--gap))),
      calc(var(--y, 0) * (100% + var(--gap)))
    );
  transition: transform 122ms cubic-bezier(0.25, 0.9, 0.3, 1);
  will-change: transform;
}

.tile.is-merged {
  z-index: 3;
}

.tile-inner {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3%;
  border-radius: 24%;
  container-type: inline-size;
}

.tile-inner::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 44%;
  width: 104%;
  height: 104%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, var(--glow) 0%, transparent 64%);
  opacity: 0.26;
  filter: blur(7px);
  pointer-events: none;
}

.tile.is-new .tile-inner {
  animation: tileIn 0.28s cubic-bezier(0.2, 1.5, 0.4, 1) backwards;
}

.tile.is-merged .tile-inner {
  animation: tileMerge 0.4s cubic-bezier(0.2, 1.5, 0.35, 1) 0.05s backwards;
}

.tile.is-upgraded .tile-inner {
  animation: tileUpgrade 0.6s cubic-bezier(0.2, 1.2, 0.3, 1) backwards;
}

@keyframes tileIn {
  from { opacity: 0; transform: scale(0.3); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes tileMerge {
  0%   { transform: scale(0.82); }
  45%  { transform: scale(1.13); }
  100% { transform: scale(1); }
}

@keyframes tileUpgrade {
  0%   { transform: scale(1); filter: brightness(1); }
  30%  { transform: scale(1.2); filter: brightness(2.4) saturate(1.4); }
  100% { transform: scale(1); filter: brightness(1); }
}

.tile-name {
  position: relative;
  z-index: 2;
  font-size: 10px;
  font-size: 10cqw;
  letter-spacing: 0.04em;
  line-height: 1;
  white-space: nowrap;
  color: rgba(238, 245, 255, 0.86);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.75);
}

.tile.is-legend .tile-name {
  color: #fff;
  text-shadow: 0 0 12px rgba(255, 150, 240, 0.9);
}

/* ---------- 天体本体 ---------- */

.orb {
  position: relative;
  width: calc(var(--orb-size, 64%) * var(--orb-scale, 1));
  height: calc(var(--orb-size, 64%) * var(--orb-scale, 1));
  border-radius: 50%;
  background:
    radial-gradient(circle at 33% 27%, var(--c1) 0%, transparent 58%),
    radial-gradient(circle at 64% 74%, var(--c2) 0%, transparent 62%),
    radial-gradient(circle at 50% 50%, var(--c2) 0%, var(--c2) 72%);
  box-shadow:
    inset -14% -18% 30% rgba(0, 0, 0, 0.5),
    inset 10% 12% 24% rgba(255, 255, 255, 0.18);
}

.orb::before {
  content: "";
  position: absolute;
  left: 17%;
  top: 11%;
  width: 36%;
  height: 27%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.9), transparent 72%);
  filter: blur(1.5px);
  opacity: 0.65;
  pointer-events: none;
}

.orb-extra {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
}

/* 星尘 */
.orb[data-shape="dust"] {
  --orb-scale: 0.52;
  background:
    radial-gradient(circle at 50% 50%, #ffffff 0%, var(--c1) 34%, var(--c2) 66%, rgba(90, 110, 210, 0) 78%),
    radial-gradient(circle at 82% 18%, #fff 0 3%, transparent 4%),
    radial-gradient(circle at 18% 76%, #fff 0 2.4%, transparent 3.4%),
    radial-gradient(circle at 64% 86%, #fff 0 1.8%, transparent 2.6%);
  box-shadow: 0 0 14px rgba(169, 188, 255, 0.85), 0 0 34px rgba(120, 140, 255, 0.4);
}

/* 陨石 */
.orb[data-shape="rock"] {
  --orb-scale: 0.68;
  border-radius: 48% 52% 55% 45% / 53% 46% 54% 47%;
  background:
    radial-gradient(circle at 30% 26%, var(--c1) 0%, transparent 46%),
    radial-gradient(circle at 66% 30%, rgba(0, 0, 0, 0.32) 0 8%, transparent 9%),
    radial-gradient(circle at 36% 68%, rgba(0, 0, 0, 0.28) 0 11%, transparent 12%),
    radial-gradient(circle at 72% 68%, rgba(0, 0, 0, 0.24) 0 6%, transparent 7%),
    radial-gradient(circle at 52% 54%, var(--c2) 0%, #241a14 88%);
  box-shadow:
    inset -6% -8% 22% rgba(0, 0, 0, 0.6),
    inset 6% 6% 16% rgba(255, 236, 210, 0.22),
    0 0 18px rgba(216, 169, 122, 0.35);
}

/* 卫星 */
.orb[data-shape="moon"] {
  --orb-scale: 0.72;
  background:
    radial-gradient(circle at 34% 32%, rgba(0, 0, 0, 0.16) 0 9%, transparent 10%),
    radial-gradient(circle at 62% 44%, rgba(0, 0, 0, 0.13) 0 6%, transparent 7%),
    radial-gradient(circle at 44% 70%, rgba(0, 0, 0, 0.1) 0 8%, transparent 9%),
    radial-gradient(circle at 30% 24%, #ffffff 0%, var(--c1) 30%, var(--c2) 74%, #596180 100%);
  box-shadow:
    inset -10% -12% 26% rgba(0, 0, 0, 0.55),
    0 0 18px rgba(185, 196, 230, 0.35);
}

/* 行星 */
.orb[data-shape="planet"] {
  --orb-scale: 0.76;
  background:
    radial-gradient(ellipse 34% 22% at 32% 72%, rgba(146, 255, 214, 0.85) 0%, transparent 70%),
    radial-gradient(ellipse 26% 20% at 68% 34%, rgba(146, 255, 214, 0.7) 0%, transparent 70%),
    radial-gradient(ellipse 18% 12% at 50% 52%, rgba(146, 255, 214, 0.55) 0%, transparent 70%),
    radial-gradient(circle at 32% 26%, #d6fff2 0%, var(--c1) 26%, var(--c2) 76%, #0a3a46 100%);
  box-shadow:
    inset -12% -14% 28% rgba(0, 0, 0, 0.6),
    0 0 20px rgba(82, 216, 189, 0.4);
}

/* 气态巨星 */
.orb[data-shape="gas"] {
  --orb-scale: 0.82;
  background:
    repeating-linear-gradient(
      172deg,
      rgba(255, 255, 255, 0.16) 0 5%,
      rgba(0, 0, 0, 0.09) 5% 10%
    ),
    radial-gradient(circle at 32% 26%, #ffeccb 0%, var(--c1) 24%, var(--c2) 78%, #3d1a10 100%);
  box-shadow:
    inset -12% -14% 30% rgba(0, 0, 0, 0.55),
    inset 8% 10% 20% rgba(255, 240, 210, 0.2),
    0 0 22px rgba(255, 171, 84, 0.4);
}

/* 恒星 */
.orb[data-shape="star"] {
  --orb-scale: 0.78;
  background:
    radial-gradient(circle at 50% 50%, #ffffff 0 14%, var(--c1) 32%, var(--c2) 62%, rgba(255, 120, 0, 0.5) 80%, transparent 86%);
  box-shadow:
    0 0 22px rgba(255, 198, 74, 0.95),
    0 0 55px rgba(255, 150, 40, 0.55),
    0 0 90px rgba(255, 120, 40, 0.25);
  animation: starPulse 3.6s ease-in-out infinite;
}

.orb[data-shape="star"] .orb-extra {
  opacity: 0.55;
  background: conic-gradient(
    from 0deg,
    transparent 0 8%, rgba(255, 214, 120, 0.5) 9%, transparent 12%,
    transparent 22%, rgba(255, 214, 120, 0.35) 23%, transparent 26%,
    transparent 38%, rgba(255, 214, 120, 0.45) 39%, transparent 42%,
    transparent 56%, rgba(255, 214, 120, 0.3) 57%, transparent 60%,
    transparent 72%, rgba(255, 214, 120, 0.42) 73%, transparent 76%,
    transparent 88%, rgba(255, 214, 120, 0.32) 89%, transparent 92%
  );
  filter: blur(2px);
  animation: spin 26s linear infinite;
}

@keyframes starPulse {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  50%      { transform: scale(1.04); filter: brightness(1.16); }
}

/* 红巨星 */
.orb[data-shape="giant"] {
  --orb-scale: 0.92;
  background:
    radial-gradient(circle at 36% 30%, #fff2e2 0 5%, var(--c1) 22%, var(--c2) 66%, #5e0c0a 90%, #2a0403 100%);
  box-shadow:
    inset -14% -16% 32% rgba(0, 0, 0, 0.55),
    0 0 26px rgba(255, 106, 77, 0.85),
    0 0 70px rgba(255, 70, 60, 0.35);
  animation: giantPulse 5.2s ease-in-out infinite;
}

@keyframes giantPulse {
  0%, 100% { transform: scale(1); opacity: 0.96; }
  50%      { transform: scale(1.05); opacity: 1; }
}

/* 脉冲星 */
.orb[data-shape="pulsar"] {
  --orb-scale: 0.6;
  background:
    radial-gradient(circle at 46% 42%, #ffffff 0 12%, #dff6ff 24%, #6fb8ff 46%, var(--c2) 66%, #06122e 100%);
  box-shadow:
    0 0 18px rgba(99, 201, 255, 0.9),
    0 0 54px rgba(60, 130, 255, 0.45);
  animation: starPulse 3.2s ease-in-out infinite;
}

.orb[data-shape="pulsar"] .orb-extra {
  opacity: 0.9;
  inset: auto;
  left: 50%;
  top: 50%;
  width: 210%;
  height: 72%;
  border-radius: 50%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(140, 220, 255, 0) 8%,
    rgba(150, 225, 255, 0.7) 38%,
    #ffffff 50%,
    rgba(150, 225, 255, 0.7) 62%,
    rgba(140, 220, 255, 0) 92%,
    transparent 100%
  );
  filter: blur(3px);
  mix-blend-mode: screen;
  transform: translate(-50%, -50%) rotate(0deg) scaleY(0.18);
  animation: beamSweep 7.5s linear infinite, beamFade 1.9s ease-in-out infinite alternate;
}

@keyframes beamSweep {
  from { transform: translate(-50%, -50%) rotate(0deg) scaleY(0.18); }
  to   { transform: translate(-50%, -50%) rotate(360deg) scaleY(0.18); }
}

@keyframes beamFade {
  from { opacity: 0.38; }
  to   { opacity: 0.95; }
}

/* 中子星 */
.orb[data-shape="neutron"] {
  --orb-scale: 0.58;
  background:
    radial-gradient(circle at 50% 50%, #ffffff 0 30%, #eefbff 44%, var(--c2) 64%, rgba(90, 160, 255, 0) 84%);
  box-shadow:
    0 0 10px #ffffff,
    0 0 32px rgba(200, 240, 255, 0.95),
    0 0 72px rgba(90, 160, 255, 0.5);
  animation: starPulse 2.8s ease-in-out infinite;
}

.orb[data-shape="neutron"] .orb-extra {
  opacity: 0.95;
  inset: auto;
  left: 50%;
  top: 50%;
  width: 165%;
  height: 165%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background:
    conic-gradient(from 0deg, transparent 0 44%, rgba(255, 255, 255, 0.95) 45.5%, transparent 47%, transparent 95%, rgba(255, 255, 255, 0.95) 96.5%, transparent 98%),
    conic-gradient(from 90deg, transparent 0 44%, rgba(190, 235, 255, 0.9) 45.5%, transparent 47%, transparent 95%, rgba(190, 235, 255, 0.9) 96.5%, transparent 98%);
  filter: blur(1px);
  animation: spin 26s linear infinite;
}

/* 黑洞 */
.orb[data-shape="hole"] {
  --orb-scale: 0.64;
  background: radial-gradient(circle at 50% 50%, #000000 0 56%, #150828 74%, #000 88%);
  box-shadow:
    0 0 24px rgba(138, 75, 255, 0.55),
    0 0 64px rgba(100, 40, 220, 0.35),
    inset 0 0 18px #000;
}

.orb[data-shape="hole"] .orb-extra {
  opacity: 0.95;
  inset: auto;
  left: 50%;
  top: 50%;
  width: 156%;
  height: 156%;
  background: conic-gradient(
    from 0deg,
    rgba(180, 120, 255, 0.95),
    rgba(255, 190, 110, 0.95),
    rgba(120, 60, 255, 0.25),
    rgba(255, 140, 220, 0.8),
    rgba(180, 120, 255, 0.95)
  );
  -webkit-mask: radial-gradient(circle, transparent 0 44%, #000 48%, #000 64%, transparent 70%);
  mask: radial-gradient(circle, transparent 0 44%, #000 48%, #000 64%, transparent 70%);
  transform: translate(-50%, -50%) rotateX(74deg) rotate(0deg);
  animation: ringSpin 7s linear infinite;
  filter: blur(1px) saturate(1.2);
}

@keyframes ringSpin {
  from { transform: translate(-50%, -50%) rotateX(74deg) rotate(0deg); }
  to   { transform: translate(-50%, -50%) rotateX(74deg) rotate(360deg); }
}

/* 类星体 */
.orb[data-shape="quasar"] {
  --orb-scale: 0.6;
  background:
    radial-gradient(circle at 50% 50%, #ffffff 0 18%, #ffd9fb 32%, var(--c1) 48%, var(--c2) 76%, rgba(80, 20, 130, 0) 88%);
  box-shadow:
    0 0 26px rgba(255, 107, 230, 0.9),
    0 0 76px rgba(200, 60, 255, 0.5);
  animation: starPulse 3s ease-in-out infinite;
}

.orb[data-shape="quasar"] .orb-extra {
  opacity: 0.95;
  inset: auto;
  left: 38%;
  top: -46%;
  width: 24%;
  height: 192%;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(255, 150, 240, 0.55) 22%,
    rgba(255, 255, 255, 0.98) 50%,
    rgba(255, 150, 240, 0.55) 78%,
    transparent 100%
  );
  filter: blur(3.5px);
  mix-blend-mode: screen;
  animation: jetPulse 2.6s ease-in-out infinite;
}

@keyframes jetPulse {
  0%, 100% { opacity: 0.4; transform: scaleY(0.86); }
  50%      { opacity: 0.95; transform: scaleY(1.04); }
}

/* 星系 */
.orb[data-shape="galaxy"] {
  --orb-scale: 1;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22%3E%3Cdefs%3E%3Cfilter id=%22b%22 x=%22-30%25%22 y=%22-30%25%22 width=%22160%25%22 height=%22160%25%22%3E%3CfeGaussianBlur stdDeviation=%222.6%22/%3E%3C/filter%3E%3C/defs%3E%3Cg filter=%22url(%23b)%22%3E%3Cpolyline points=%2256.0,50.0 57.4,51.0 58.1,52.2 58.5,53.5 58.7,55.0 58.5,56.5 58.0,58.0 57.3,59.5 56.3,60.9 55.0,62.2 53.6,63.3 51.9,64.2 50.0,64.8 48.0,65.2 45.9,65.3 43.7,65.1 41.6,64.6 39.5,63.7 37.4,62.6 35.5,61.1 33.8,59.4 32.3,57.3 31.0,55.1 30.1,52.6 29.5,50.0 29.2,47.3 29.4,44.5 29.9,41.7 30.8,38.9 32.0,36.2 33.7,33.7 35.7,31.4 38.1,29.3 40.7,27.6 43.6,26.2 46.7,25.2 50.0,24.6 53.4,24.4 56.8,24.7 60.2,25.4 63.5,26.7 66.6,28.3 69.6,30.4 72.3,32.9 74.6,35.8 76.6,39.0 78.2,42.4 79.3,46.1 79.9,50.0 80.0,53.9 79.6,57.9 78.6,61.8 77.1,65.7 75.1,69.3 72.6,72.6 69.7,75.7 66.4,78.3 62.6,80.5 58.6,82.2 54.4,83.4 50.0,84.1 45.5,84.1 41.0,83.6 36.6,82.4 32.3,80.7 28.3,78.3 24.5,75.5 21.1,72.1 18.2,68.4 15.8,64.2 13.9,59.7 12.6,54.9 12.0,50.0%22 fill=%22none%22 stroke=%22%23cfe2ff%22 stroke-opacity=%220.55%22 stroke-width=%224.6%22 stroke-linecap=%22round%22/%3E%3Cpolyline points=%2256.0,50.0 57.4,51.0 58.1,52.2 58.5,53.5 58.7,55.0 58.5,56.5 58.0,58.0 57.3,59.5 56.3,60.9 55.0,62.2 53.6,63.3 51.9,64.2 50.0,64.8 48.0,65.2 45.9,65.3 43.7,65.1 41.6,64.6 39.5,63.7 37.4,62.6 35.5,61.1 33.8,59.4 32.3,57.3 31.0,55.1 30.1,52.6 29.5,50.0 29.2,47.3 29.4,44.5 29.9,41.7 30.8,38.9 32.0,36.2 33.7,33.7 35.7,31.4 38.1,29.3 40.7,27.6 43.6,26.2 46.7,25.2 50.0,24.6 53.4,24.4 56.8,24.7 60.2,25.4 63.5,26.7 66.6,28.3 69.6,30.4 72.3,32.9 74.6,35.8 76.6,39.0 78.2,42.4 79.3,46.1 79.9,50.0 80.0,53.9 79.6,57.9 78.6,61.8 77.1,65.7 75.1,69.3 72.6,72.6 69.7,75.7 66.4,78.3 62.6,80.5 58.6,82.2 54.4,83.4 50.0,84.1 45.5,84.1 41.0,83.6 36.6,82.4 32.3,80.7 28.3,78.3 24.5,75.5 21.1,72.1 18.2,68.4 15.8,64.2 13.9,59.7 12.6,54.9 12.0,50.0%22 fill=%22none%22 stroke=%22%23b18cff%22 stroke-opacity=%220.9%22 stroke-width=%222%22 stroke-linecap=%22round%22/%3E%3Cpolyline points=%2244.0,50.0 42.6,49.0 41.9,47.8 41.5,46.5 41.3,45.0 41.5,43.5 42.0,42.0 42.7,40.5 43.7,39.1 45.0,37.8 46.4,36.7 48.1,35.8 50.0,35.2 52.0,34.8 54.1,34.7 56.3,34.9 58.4,35.4 60.5,36.3 62.6,37.4 64.5,38.9 66.2,40.6 67.7,42.7 69.0,44.9 69.9,47.4 70.5,50.0 70.8,52.7 70.6,55.5 70.1,58.3 69.2,61.1 68.0,63.8 66.3,66.3 64.3,68.6 61.9,70.7 59.3,72.4 56.4,73.8 53.3,74.8 50.0,75.4 46.6,75.6 43.2,75.3 39.8,74.6 36.5,73.3 33.4,71.7 30.4,69.6 27.7,67.1 25.4,64.2 23.4,61.0 21.8,57.6 20.7,53.9 20.1,50.0 20.0,46.1 20.4,42.1 21.4,38.2 22.9,34.3 24.9,30.7 27.4,27.4 30.3,24.3 33.6,21.7 37.4,19.5 41.4,17.8 45.6,16.6 50.0,15.9 54.5,15.9 59.0,16.4 63.4,17.6 67.7,19.3 71.7,21.7 75.5,24.5 78.9,27.9 81.8,31.6 84.2,35.8 86.1,40.3 87.4,45.1 88.0,50.0%22 fill=%22none%22 stroke=%22%23ffcdf6%22 stroke-opacity=%220.45%22 stroke-width=%224.2%22 stroke-linecap=%22round%22/%3E%3Cpolyline points=%2244.0,50.0 42.6,49.0 41.9,47.8 41.5,46.5 41.3,45.0 41.5,43.5 42.0,42.0 42.7,40.5 43.7,39.1 45.0,37.8 46.4,36.7 48.1,35.8 50.0,35.2 52.0,34.8 54.1,34.7 56.3,34.9 58.4,35.4 60.5,36.3 62.6,37.4 64.5,38.9 66.2,40.6 67.7,42.7 69.0,44.9 69.9,47.4 70.5,50.0 70.8,52.7 70.6,55.5 70.1,58.3 69.2,61.1 68.0,63.8 66.3,66.3 64.3,68.6 61.9,70.7 59.3,72.4 56.4,73.8 53.3,74.8 50.0,75.4 46.6,75.6 43.2,75.3 39.8,74.6 36.5,73.3 33.4,71.7 30.4,69.6 27.7,67.1 25.4,64.2 23.4,61.0 21.8,57.6 20.7,53.9 20.1,50.0 20.0,46.1 20.4,42.1 21.4,38.2 22.9,34.3 24.9,30.7 27.4,27.4 30.3,24.3 33.6,21.7 37.4,19.5 41.4,17.8 45.6,16.6 50.0,15.9 54.5,15.9 59.0,16.4 63.4,17.6 67.7,19.3 71.7,21.7 75.5,24.5 78.9,27.9 81.8,31.6 84.2,35.8 86.1,40.3 87.4,45.1 88.0,50.0%22 fill=%22none%22 stroke=%22%23d3b6ff%22 stroke-opacity=%220.85%22 stroke-width=%221.9%22 stroke-linecap=%22round%22/%3E%3C/g%3E%3Ccircle cx=%2250%22 cy=%2250%22 r=%226.5%22 fill=%22%23ffffff%22 opacity=%22.95%22/%3E%3Ccircle cx=%2250%22 cy=%2250%22 r=%2212%22 fill=%22%23ffffff%22 opacity=%22.18%22/%3E%3C/svg%3E"),
    radial-gradient(circle at 50% 50%, rgba(190, 160, 255, 0.34), rgba(90, 60, 160, 0.12) 46%, transparent 70%);
  background-size: 100% 100%, 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  filter: drop-shadow(0 0 16px rgba(150, 120, 255, 0.55));
  animation: galaxySpin 64s linear infinite;
  will-change: transform;
}

@keyframes galaxySpin {
  from { transform: scaleY(0.86) rotate(0deg); }
  to   { transform: scaleY(0.86) rotate(360deg); }
}

/* 宇宙 */
.orb[data-shape="cosmos"] {
  --orb-scale: 0.98;
  background:
    radial-gradient(circle at 28% 26%, #fff 0 1.6%, transparent 2.6%),
    radial-gradient(circle at 66% 20%, #d9ecff 0 1.2%, transparent 2.2%),
    radial-gradient(circle at 44% 58%, #fff 0 1.8%, transparent 2.8%),
    radial-gradient(circle at 76% 62%, #ffd9f5 0 1.4%, transparent 2.4%),
    radial-gradient(circle at 24% 72%, #cfe4ff 0 1.1%, transparent 2.1%),
    radial-gradient(circle at 58% 82%, #fff 0 0.9%, transparent 1.9%),
    radial-gradient(circle at 84% 42%, #fff 0 0.9%, transparent 1.9%),
    radial-gradient(ellipse 42% 30% at 30% 68%, rgba(90, 200, 255, 0.3), transparent 70%),
    radial-gradient(ellipse 34% 26% at 72% 34%, rgba(255, 120, 220, 0.24), transparent 70%),
    radial-gradient(circle at 50% 46%, #5b3fae 0 24%, #2c1a5e 56%, #0a0518 92%);
  box-shadow:
    0 0 26px rgba(211, 182, 255, 0.6),
    0 0 78px rgba(120, 80, 220, 0.45),
    inset -10% -12% 30% rgba(0, 0, 0, 0.6);
  animation: cosmosSpin 48s linear infinite;
}

/* 暗物质 */
.orb[data-shape="dark"] {
  --orb-scale: 0.66;
  background:
    radial-gradient(circle at 32% 26%, rgba(176, 126, 255, 0.7) 0%, transparent 44%),
    radial-gradient(circle at 68% 74%, rgba(96, 34, 180, 0.65) 0%, transparent 48%),
    radial-gradient(circle at 50% 50%, #22103c 0%, #0a0416 64%, #000 100%);
  box-shadow:
    0 0 20px rgba(143, 75, 255, 0.55),
    inset 0 0 22px rgba(120, 50, 220, 0.4);
  animation: darkWobble 9s ease-in-out infinite;
}

.orb[data-shape="dark"] .orb-extra {
  opacity: 0.8;
  background:
    conic-gradient(from 0deg, transparent 0 12%, rgba(150, 90, 255, 0.75) 22%, transparent 34%, rgba(90, 40, 190, 0.55) 58%, transparent 70%, rgba(160, 100, 255, 0.6) 84%, transparent 96%);
  -webkit-mask: radial-gradient(circle, transparent 0 40%, #000 52%, transparent 72%);
  mask: radial-gradient(circle, transparent 0 40%, #000 52%, transparent 72%);
  animation: spin 11s linear infinite reverse;
  filter: blur(2px);
}

@keyframes darkWobble {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50%      { transform: scale(1.06) rotate(8deg); }
}

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

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

/* 棋盘震动 */
.board.shake-soft .board-inner {
  animation: shakeSoft 0.32s ease;
}

.board.shake-strong .board-inner {
  animation: shakeStrong 0.44s ease;
}

@keyframes shakeSoft {
  0%, 100% { transform: translate3d(0, 0, 0); }
  35%      { transform: translate3d(-2px, 1px, 0); }
  70%      { transform: translate3d(2px, -1px, 0); }
}

@keyframes shakeStrong {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  18%      { transform: translate3d(-5px, 3px, 0) scale(1.004); }
  42%      { transform: translate3d(4px, -3px, 0) scale(1.004); }
  68%      { transform: translate3d(-3px, 2px, 0) scale(1.002); }
  86%      { transform: translate3d(2px, -1px, 0); }
}

/* ---------- 结局 / 胜利面板 ---------- */

.game-message {
  position: absolute;
  inset: 0;
  z-index: 9;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6%;
  border-radius: var(--radius);
  background: rgba(5, 8, 18, 0.74);
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.28s ease, visibility 0.28s ease;
}

.game-message.is-visible {
  opacity: 1;
  visibility: visible;
}

.message-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  transform: translateY(12px) scale(0.96);
  transition: transform 0.4s cubic-bezier(0.2, 1.3, 0.4, 1);
}

.game-message.is-visible .message-card {
  transform: none;
}

.message-orb {
  margin-bottom: 2px;
}

.message-title {
  margin: 0;
  font-size: 25px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.game-won .message-title {
  background: linear-gradient(100deg, #fff6c9, #ff9ce9 55%, #a9b6ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.message-sub {
  margin: 0;
  max-width: 30ch;
  font-size: 12px;
  line-height: 1.75;
  color: var(--muted);
}

.message-stats {
  display: flex;
  gap: 22px;
  margin: 4px 0 6px;
}

.message-stats div {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.message-stats b {
  font-size: 17px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.message-stats i {
  font-style: normal;
  font-size: 9px;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.message-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

/* ---------- 能量条 ---------- */

.energy {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 6px 12px;
  padding: 11px 14px;
  border-radius: 18px;
  background: var(--glass);
  border: 1px solid var(--line);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.energy.is-ready {
  border-color: rgba(180, 150, 255, 0.4);
  box-shadow: 0 0 34px -12px rgba(160, 110, 255, 0.75);
}

.energy-info {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.energy-name {
  color: rgba(226, 236, 255, 0.8);
}

.energy-count {
  font-variant-numeric: tabular-nums;
}

.energy-track {
  position: relative;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}

.energy-fill {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #63c9ff, #a98bff 55%, #ff8de0);
  box-shadow: 0 0 12px rgba(169, 139, 255, 0.9);
  transition: width 0.34s cubic-bezier(0.2, 0.9, 0.3, 1);
}

.energy.is-ready .energy-fill {
  animation: energyGlow 1.8s ease-in-out infinite;
}

@keyframes energyGlow {
  0%, 100% { filter: brightness(1); }
  50%      { filter: brightness(1.5); }
}

.singularity {
  grid-row: 1 / span 2;
  grid-column: 2;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.16em;
  color: rgba(224, 232, 255, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  transition: all 0.26s ease;
  white-space: nowrap;
}

.singularity:disabled {
  cursor: default;
}

.energy.is-ready .singularity {
  color: #0b0e1c;
  background: linear-gradient(135deg, #b6f0ff, #c6aaff 55%, #ffb0ea);
  border-color: transparent;
  box-shadow: 0 0 24px -4px rgba(170, 130, 255, 0.9);
  animation: readyPulse 2.4s ease-in-out infinite;
}

@keyframes readyPulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.045); }
}

/* ---------- 页脚 ---------- */

.foot {
  margin: 2px 2px 0;
  font-size: 11px;
  line-height: 1.8;
  color: rgba(198, 212, 250, 0.45);
}

.foot p {
  margin: 0;
}

.foot b {
  color: rgba(226, 236, 255, 0.72);
  font-weight: 600;
}

.foot em {
  font-style: normal;
  color: rgba(190, 170, 255, 0.9);
}

.foot-hint {
  margin-top: 2px;
}

/* ---------- 首次发现提示 ---------- */

.toast-stack {
  position: fixed;
  bottom: calc(16px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: min(92vw, 380px);
}

.toast {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 16px 10px 12px;
  border-radius: 16px;
  background: rgba(12, 16, 34, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 24px 60px -24px #000;
  backdrop-filter: blur(14px);
  opacity: 0;
  transform: translateY(14px) scale(0.96);
  transition: opacity 0.4s ease, transform 0.45s cubic-bezier(0.2, 1.25, 0.35, 1);
}

.toast.is-in {
  opacity: 1;
  transform: none;
}

.toast-orb {
  flex: none;
}

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

.toast-tag {
  font-size: 8.5px;
  letter-spacing: 0.22em;
  color: rgba(150, 195, 255, 0.9);
}

.toast-body strong {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.toast-body p {
  margin: 1px 0 0;
  font-size: 10.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- 图鉴 ---------- */

.codex {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(18px + env(safe-area-inset-top)) 16px calc(18px + env(safe-area-inset-bottom));
  background: rgba(3, 5, 12, 0.72);
  backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity 0.24s ease;
  overflow: auto;
}

.codex.is-open {
  opacity: 1;
}

.codex-panel {
  width: min(700px, 100%);
  max-height: min(86vh, 780px);
  overflow: auto;
  padding: 20px 20px 16px;
  border-radius: 26px;
  background: linear-gradient(158deg, rgba(24, 30, 58, 0.97), rgba(8, 11, 24, 0.99));
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 50px 100px -30px #000;
  transform: translateY(18px) scale(0.98);
  transition: transform 0.3s cubic-bezier(0.2, 1.1, 0.3, 1);
  scrollbar-width: thin;
}

.codex.is-open .codex-panel {
  transform: none;
}

.codex-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.codex-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.12em;
}

.codex-head p {
  margin: 4px 0 0;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.codex-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(146px, 1fr));
  gap: 9px;
}

.codex-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 14px 12px 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.06);
  text-align: center;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.codex-card:hover {
  background: rgba(255, 255, 255, 0.06);
}

.codex-card strong {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.codex-latin {
  font-size: 7.5px;
  letter-spacing: 0.2em;
  color: rgba(190, 208, 255, 0.45);
}

.codex-card p {
  margin: 3px 0 0;
  font-size: 10.5px;
  line-height: 1.65;
  color: var(--muted);
}

.codex-orb {
  margin-bottom: 2px;
}

.codex-card.is-locked {
  opacity: 0.5;
}

.codex-card.is-locked .orb {
  --orb-scale: 0.7;
  filter: grayscale(1) brightness(0.5);
}

.codex-card.is-goal {
  border-color: rgba(255, 120, 230, 0.28);
  box-shadow: inset 0 0 34px rgba(255, 120, 230, 0.08);
}

.codex-card.is-goal strong {
  color: #ffc4f4;
}

.codex-foot {
  margin: 14px 0 2px;
  text-align: center;
  font-size: 10.5px;
  letter-spacing: 0.12em;
  color: rgba(190, 206, 250, 0.4);
}

/* ---------- 合成反馈 ---------- */

/* 被吞并的源天体：只保留运动，不显示名字，避免两层名字重叠 */
.tile.is-ghost {
  z-index: 1;
}

.tile.is-ghost .tile-name {
  opacity: 0;
}

.tile.is-ghost .tile-inner {
  opacity: 0.92;
}

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

.float-text {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 14px;
  font-weight: 600;
  color: #eaf3ff;
  white-space: nowrap;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.75), 0 0 14px rgba(160, 190, 255, 0.5);
  animation: floatUp 0.95s cubic-bezier(0.2, 0.9, 0.3, 1) forwards;
}

.float-text.is-big {
  font-size: 18px;
  color: #fff3c4;
  text-shadow: 0 2px 10px #000, 0 0 20px rgba(255, 190, 90, 0.85);
}

@keyframes floatUp {
  0%   { opacity: 0; transform: translate(-50%, -30%) scale(0.8); }
  18%  { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -145%) scale(1.06); }
}

.chain-banner {
  position: absolute;
  left: 50%;
  top: 32%;
  z-index: 7;
  transform: translate(-50%, -50%);
  font-size: 34px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: #fff;
  pointer-events: none;
  opacity: 0;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.85), 0 0 30px rgba(255, 170, 90, 0.85);
}

.chain-banner.is-show {
  animation: chainPop 0.9s cubic-bezier(0.2, 1.2, 0.3, 1) forwards;
}

@keyframes chainPop {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.6); }
  25%  { opacity: 1; transform: translate(-50%, -56%) scale(1.06); }
  70%  { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -84%) scale(1); }
}

/* 整盘闪白 */
.board-inner::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 5;
  border-radius: 20%;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.35), transparent 64%);
}

.board.flash-soft .board-inner::after {
  animation: boardFlash 0.5s ease-out;
}

.board.flash-strong .board-inner::after {
  animation: boardFlashStrong 0.62s ease-out;
}

@keyframes boardFlash {
  0%   { opacity: 0; }
  22%  { opacity: 0.55; }
  100% { opacity: 0; }
}

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

/* 奇点涡流 */
.board-inner::before {
  content: "";
  position: absolute;
  inset: -25%;
  z-index: 4;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  background: conic-gradient(
    from 0deg,
    rgba(150, 90, 255, 0) 0%,
    rgba(150, 90, 255, 0.55) 18%,
    rgba(255, 210, 120, 0.45) 34%,
    rgba(80, 40, 180, 0) 54%,
    rgba(180, 120, 255, 0.5) 74%,
    rgba(255, 255, 255, 0) 100%
  );
  filter: blur(14px);
  mix-blend-mode: screen;
}

.board.is-vortex .board-inner::before {
  animation: vortexSpin 1.05s ease-out;
}

@keyframes vortexSpin {
  0%   { opacity: 0; transform: scale(0.2) rotate(0deg); }
  35%  { opacity: 0.8; }
  100% { opacity: 0; transform: scale(1.25) rotate(220deg); }
}

/* ---------- 体力 / 激励视频 ---------- */

.stamina {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 26px;
  padding: 0 4px;
  font-size: 10px;
  color: var(--muted);
}

.stamina-label {
  letter-spacing: 0.14em;
  white-space: nowrap;
}

.hearts {
  display: flex;
  flex: none;
  gap: 3px;
}

.pip {
  width: 14px;
  height: 7px;
  border-radius: 1px;
  border: 1px solid rgba(120, 200, 255, 0.22);
  background: rgba(80, 140, 200, 0.08);
  transition: background 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.pip.is-full {
  border-color: rgba(94, 234, 255, 0.7);
  background: linear-gradient(180deg, #9ff6ff, #2bd0e8);
  box-shadow: 0 0 10px rgba(70, 220, 255, 0.55);
}

.stamina-timer {
  flex: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.ad-btn {
  flex: none;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(226, 236, 255, 0.8);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease;
}

.ad-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.ad-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.gate {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(3, 5, 12, 0.76);
  backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity 0.24s ease;
}

.gate.is-open {
  opacity: 1;
}

.gate-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: min(340px, 100%);
  padding: 24px 20px 20px;
  border-radius: 24px;
  text-align: center;
  background: linear-gradient(158deg, rgba(26, 32, 62, 0.98), rgba(8, 11, 24, 0.99));
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 40px 90px -30px #000;
  transform: translateY(14px) scale(0.97);
  transition: transform 0.3s cubic-bezier(0.2, 1.1, 0.3, 1);
}

.gate.is-open .gate-card {
  transform: none;
}

.gate-orb {
  width: 58px;
  height: 58px;
}

.gate-card h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.1em;
}

.gate-sub {
  margin: 0;
  font-size: 11.5px;
  color: var(--muted);
}

.gate-hearts {
  display: flex;
  gap: 6px;
  margin: 2px 0;
}

.gate-hearts .pip {
  width: 18px;
  height: 9px;
}

.gate-timer {
  margin: 0;
  font-size: 11px;
  color: rgba(190, 206, 255, 0.6);
  font-variant-numeric: tabular-nums;
}

.ad-screen {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 100%;
  height: 96px;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(120deg, rgba(70, 50, 140, 0.7), rgba(20, 30, 70, 0.9));
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.ad-screen .ad-tag {
  position: absolute;
  left: 9px;
  top: 7px;
  font-size: 8px;
  letter-spacing: 0.14em;
  color: rgba(200, 215, 255, 0.6);
}

.ad-screen .ad-count {
  font-size: 22px;
  font-weight: 600;
  color: #fff;
}

.ad-screen p {
  margin: 0;
  font-size: 10px;
  color: rgba(200, 214, 255, 0.55);
}

.gate-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
}

/* ---------- 道具 ---------- */

.ability-group {
  display: flex;
  flex: none;
  gap: 6px;
}

.ability-btn {
  display: flex;
  flex: none;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(226, 236, 255, 0.82);
  font-size: 10.5px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.ability-btn svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ability-btn .cost {
  font-style: normal;
  font-size: 9px;
  padding: 1px 4px;
  border-radius: 6px;
  background: rgba(255, 120, 140, 0.16);
  color: #ffb3c0;
}

.ability-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.ability-btn.is-armed {
  border-color: rgba(150, 195, 255, 0.6);
  background: rgba(120, 160, 255, 0.18);
  color: #fff;
  box-shadow: 0 0 18px -6px rgba(140, 180, 255, 0.9);
}

.ability-btn.is-empty {
  opacity: 0.45;
}

.ability-hint {
  position: absolute;
  left: 50%;
  top: 8px;
  z-index: 8;
  transform: translateX(-50%);
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(10, 14, 30, 0.9);
  border: 1px solid rgba(150, 195, 255, 0.35);
  color: #dce8ff;
  font-size: 10.5px;
  letter-spacing: 0.04em;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 10px 30px -12px #000;
  animation: hintIn 0.2s ease;
}

@keyframes hintIn {
  from { opacity: 0; transform: translate(-50%, -4px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

.board.is-targeting {
  outline: 1px solid rgba(150, 195, 255, 0.35);
  outline-offset: 3px;
}

.board.is-targeting .tile-inner {
  animation: targetPulse 1.5s ease-in-out infinite;
}

@keyframes targetPulse {
  0%, 100% { filter: brightness(1); }
  50%      { filter: brightness(1.28); }
}

.tile.is-selected .tile-inner::after {
  content: "";
  position: absolute;
  inset: -3%;
  border-radius: 26%;
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 22px rgba(150, 195, 255, 0.9);
  pointer-events: none;
}

/* ---------- 排行榜 ---------- */

.board-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 52vh;
  overflow: auto;
}

.board-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  font-size: 12px;
}

.board-row.is-me {
  background: rgba(120, 160, 255, 0.1);
  border: 1px solid rgba(140, 180, 255, 0.35);
}

.board-rank {
  width: 22px;
  color: rgba(190, 206, 255, 0.5);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.board-rank.top {
  color: #ffd479;
}

.board-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.board-tier {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
}

.board-score {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.board-empty {
  padding: 34px 0;
  text-align: center;
  font-size: 11.5px;
  color: var(--muted);
}

.board-me {
  display: flex;
  gap: 8px;
  margin: 14px 0 4px;
}

.board-me input {
  flex: 1;
  min-width: 0;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  outline: none;
}

.board-me input:focus {
  border-color: rgba(150, 195, 255, 0.5);
}

/* 直播模式：去掉页脚，画面更干净 */
body.is-stream .foot {
  display: none;
}

body.is-stream .app {
  width: min(92vw, 540px, 58vh);
}

/* ---------- 界面里的天体尺寸（覆盖形状的相对缩放） ---------- */

.orb.max-tier-orb {
  width: 22px;
  height: 22px;
}

.orb.message-orb {
  width: 78px;
  height: 78px;
}

.orb.toast-orb {
  width: 34px;
  height: 34px;
}

.orb.codex-orb {
  width: 54px;
  height: 54px;
}

.orb.gate-orb {
  width: 58px;
  height: 58px;
}

/* ============================================================
   科技感层：仪表盘 / 细线 / 数码读数
   ============================================================ */

body {
  background:
    radial-gradient(1100px 760px at 50% -12%, rgba(28, 82, 130, 0.22), transparent 70%),
    linear-gradient(180deg, #05080f 0%, #03050a 100%);
}

/* 全屏扫描线 + 竖向刻度 */
.vignette::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(0deg, rgba(120, 200, 255, 0.026) 0 1px, transparent 1px 4px),
    repeating-linear-gradient(90deg, rgba(120, 200, 255, 0.05) 0 1px, transparent 1px 96px);
  opacity: 0.55;
  pointer-events: none;
}

/* 品牌：把发光球改成带十字刻度的观测靶 */
.brand-orb {
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255, 190, 110, 0.45);
  background: radial-gradient(circle at 50% 50%,
    #fffbe8 0 15%, #ffc35a 26%, rgba(255, 140, 50, 0.55) 46%, transparent 62%);
  box-shadow: 0 0 14px rgba(255, 170, 60, 0.45), inset 0 0 12px rgba(255, 205, 130, 0.3);
}

.brand-orb::after {
  inset: -26%;
  border-color: rgba(110, 220, 255, 0.3);
  transform: rotate(-24deg) scaleY(0.42);
}

.brand-orb::before {
  content: "";
  position: absolute;
  inset: -40%;
  background:
    linear-gradient(rgba(120, 220, 255, 0.55), rgba(120, 220, 255, 0.55)) 50% 0 / 1px 26% no-repeat,
    linear-gradient(rgba(120, 220, 255, 0.55), rgba(120, 220, 255, 0.55)) 50% 100% / 1px 26% no-repeat,
    linear-gradient(rgba(120, 220, 255, 0.55), rgba(120, 220, 255, 0.55)) 0 50% / 26% 1px no-repeat,
    linear-gradient(rgba(120, 220, 255, 0.55), rgba(120, 220, 255, 0.55)) 100% 50% / 26% 1px no-repeat;
  opacity: 0.7;
}

.brand-text h1 {
  font-size: 23px;
  font-weight: 500;
  letter-spacing: 0.3em;
  color: #f3f9ff;
  background: none;
  -webkit-background-clip: initial;
  background-clip: initial;
  -webkit-text-fill-color: currentColor;
  text-shadow: 0 0 20px rgba(90, 200, 255, 0.35);
}

.brand-text p {
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.44em;
  color: rgba(120, 210, 255, 0.55);
}

/* 读数 */
.score-addition {
  font-family: var(--mono);
  color: #8ff0c4;
  text-shadow: 0 0 10px rgba(90, 255, 190, 0.6);
}

/* 状态条 */
.max-tier-label,
.stamina-label {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.18em;
}

.max-tier-name {
  font-size: 11px;
  color: rgba(215, 235, 255, 0.85);
}

.icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 2px;
  border: 1px solid rgba(105, 175, 235, 0.18);
  background: linear-gradient(180deg, rgba(17, 29, 46, 0.85), rgba(7, 12, 21, 0.85));
  color: #9fc6e8;
}

.icon-btn:hover {
  color: #eafaff;
  border-color: rgba(79, 230, 255, 0.55);
  background: rgba(20, 42, 62, 0.9);
  box-shadow: 0 0 16px -4px rgba(79, 230, 255, 0.75), inset 0 0 12px rgba(79, 230, 255, 0.1);
}

/* 按钮 */
.ghost-btn {
  padding: 7px 14px;
  border-radius: 2px;
  border: 1px solid rgba(105, 175, 235, 0.22);
  background: rgba(11, 21, 34, 0.7);
  color: rgba(190, 225, 245, 0.86);
  letter-spacing: 0.1em;
}

.ghost-btn:hover {
  color: #fff;
  border-color: rgba(79, 230, 255, 0.5);
  background: rgba(20, 42, 62, 0.85);
  box-shadow: 0 0 14px -6px rgba(79, 230, 255, 0.8);
}

.solid-btn {
  padding: 9px 18px;
  border-radius: 2px;
  border: 1px solid rgba(160, 250, 255, 0.75);
  color: #062028;
  letter-spacing: 0.12em;
  background: linear-gradient(180deg, #a6f6ff, #45d8f0);
  box-shadow:
    0 0 22px -8px rgba(79, 230, 255, 0.95),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.solid-btn:hover {
  transform: translateY(-1px);
  box-shadow:
    0 0 28px -6px rgba(79, 230, 255, 1),
    inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

/* 棋盘：仪表盘 */
.board {
  --gap: 10px;
  --pad: 10px;
  border-radius: 3px;
  border: 1px solid rgba(100, 170, 230, 0.18);
  background:
    radial-gradient(circle at 50% 0%, rgba(40, 110, 180, 0.18), transparent 62%),
    linear-gradient(180deg, #070d17, #04070d);
  box-shadow:
    0 30px 70px -40px #000,
    inset 0 0 70px rgba(20, 70, 120, 0.22);
}

.board::before {
  inset: 0;
  padding: 0;
  border-radius: inherit;
  background:
    linear-gradient(90deg, transparent, rgba(79, 230, 255, 0.6), transparent) top / 100% 1px no-repeat,
    linear-gradient(90deg, transparent, rgba(168, 121, 255, 0.35), transparent) bottom / 100% 1px no-repeat;
  -webkit-mask: none;
  mask: none;
  opacity: 0.8;
}

/* 四角定位角标 */
.board::after {
  content: "";
  position: absolute;
  inset: 3px;
  pointer-events: none;
  background:
    linear-gradient(var(--cyan), var(--cyan)) 0 0 / 14px 1px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) 0 0 / 1px 14px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) 100% 0 / 14px 1px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) 100% 0 / 1px 14px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) 0 100% / 14px 1px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) 0 100% / 1px 14px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) 100% 100% / 14px 1px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) 100% 100% / 1px 14px no-repeat;
  opacity: 0.4;
}

.cell {
  border-radius: 2px;
  background: linear-gradient(180deg, rgba(16, 28, 44, 0.55), rgba(8, 14, 24, 0.55));
  border: 1px solid rgba(96, 160, 220, 0.12);
  box-shadow: inset 0 0 18px rgba(0, 20, 40, 0.55);
}

.tile-name {
  letter-spacing: 0.08em;
  color: rgba(232, 246, 255, 0.9);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85);
}

/* 能量条：分段刻度 */
.energy {
  padding: 10px 13px;
  border-radius: 3px;
  background: linear-gradient(180deg, rgba(16, 28, 44, 0.8), rgba(7, 12, 21, 0.82));
  border: 1px solid rgba(105, 175, 235, 0.16);
}

.energy-name,
.energy-count {
  font-family: var(--mono);
  letter-spacing: 0.2em;
  font-size: 9px;
}

.energy-track {
  height: 6px;
  border-radius: 0;
  background: repeating-linear-gradient(90deg, rgba(90, 150, 200, 0.22) 0 5px, transparent 5px 7px);
  box-shadow: inset 0 0 0 1px rgba(90, 160, 220, 0.14);
}

.energy-fill {
  border-radius: 0;
  background: linear-gradient(90deg, #2ad3c8, #4fe6ff 52%, #a879ff);
  box-shadow: 0 0 14px rgba(79, 230, 255, 0.7);
}

.singularity {
  border-radius: 2px;
  font-family: var(--mono);
  letter-spacing: 0.24em;
  border: 1px solid rgba(105, 175, 235, 0.2);
}

.stamina-timer,
.ad-btn {
  font-family: var(--mono);
}

.ad-btn,
.ability-btn {
  border-radius: 2px;
  border: 1px solid rgba(105, 175, 235, 0.2);
  background: linear-gradient(180deg, rgba(17, 30, 48, 0.85), rgba(7, 12, 21, 0.85));
}

.ability-btn .cost {
  border-radius: 1px;
  font-family: var(--mono);
  background: rgba(79, 230, 255, 0.14);
  color: #8fefff;
}

.ability-btn.is-armed {
  border-color: rgba(79, 230, 255, 0.65);
  background: rgba(20, 56, 76, 0.88);
  box-shadow: 0 0 18px -6px rgba(79, 230, 255, 0.9);
}

.ability-hint {
  border-radius: 2px;
  border: 1px solid rgba(79, 230, 255, 0.4);
  background: rgba(5, 12, 20, 0.94);
  font-family: var(--mono);
  letter-spacing: 0.06em;
}

/* 结局面板 */
.game-message {
  border-radius: 3px;
  border: 1px solid rgba(79, 230, 255, 0.12);
  background: rgba(3, 7, 13, 0.84);
}

.message-title {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: 0.16em;
  color: #eef9ff;
}

.game-won .message-title {
  color: #fff2c9;
  background: none;
  -webkit-text-fill-color: currentColor;
  text-shadow: 0 0 26px rgba(255, 200, 90, 0.45);
}

.message-sub {
  font-size: 11.5px;
  color: rgba(168, 200, 232, 0.62);
}

.message-stats b {
  font-family: var(--mono);
}

.message-stats i {
  font-family: var(--mono);
  letter-spacing: 0.18em;
}

/* 图鉴 / 面板 */
.codex {
  background: rgba(2, 5, 10, 0.82);
}

.codex-panel {
  position: relative;
  border-radius: 3px;
  background: linear-gradient(160deg, rgba(14, 24, 40, 0.98), rgba(5, 9, 16, 0.99));
  border: 1px solid rgba(79, 230, 255, 0.16);
  box-shadow: 0 40px 100px -30px #000, inset 0 0 60px rgba(20, 70, 120, 0.12);
}

.codex-panel::before,
.gate-card::before {
  content: "";
  position: absolute;
  inset: 4px;
  pointer-events: none;
  background:
    linear-gradient(var(--cyan), var(--cyan)) 0 0 / 12px 1px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) 0 0 / 1px 12px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) 100% 100% / 12px 1px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) 100% 100% / 1px 12px no-repeat;
  opacity: 0.35;
}

.codex-head {
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(105, 175, 235, 0.14);
}

.codex-head h2 {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.26em;
}

.codex-head p {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
}

.codex-card {
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(105, 175, 235, 0.1);
}

.codex-card:hover {
  background: rgba(30, 62, 90, 0.24);
  border-color: rgba(79, 230, 255, 0.35);
}

.codex-latin,
.codex-foot {
  font-family: var(--mono);
}

/* 弹窗 */
.gate {
  background: rgba(2, 5, 10, 0.82);
}

.gate-card {
  position: relative;
  border-radius: 3px;
  background: linear-gradient(160deg, rgba(14, 24, 40, 0.99), rgba(5, 9, 16, 0.99));
  border: 1px solid rgba(79, 230, 255, 0.18);
}

.gate-card h2 {
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.2em;
}

.gate-sub {
  font-size: 11px;
  line-height: 1.75;
  color: rgba(168, 200, 232, 0.62);
}

.gate-timer {
  font-family: var(--mono);
}

.dark-gate .gate-card {
  border-color: rgba(168, 121, 255, 0.38);
  box-shadow: 0 40px 90px -30px #000, 0 0 70px -24px rgba(168, 121, 255, 0.8);
}

.dark-gate .gate-orb {
  width: 66px;
  height: 66px;
}

/* 提示条 */
.toast {
  border-radius: 2px;
  border: 1px solid rgba(105, 175, 235, 0.16);
  border-left: 2px solid var(--cyan);
  background: rgba(7, 14, 24, 0.95);
}

.toast-tag {
  font-family: var(--mono);
  letter-spacing: 0.18em;
  color: rgba(110, 220, 255, 0.75);
}

.toast-body strong {
  letter-spacing: 0.08em;
}

.toast-body p {
  color: rgba(168, 200, 232, 0.6);
}

/* 排行榜：数据表 */
.board-list {
  gap: 0;
  border-top: 1px solid rgba(105, 175, 235, 0.12);
}

.board-row {
  padding: 9px 6px;
  border-radius: 0;
  border-bottom: 1px solid rgba(105, 175, 235, 0.07);
  background: transparent;
  font-size: 12px;
}

.board-row:nth-child(odd) {
  background: rgba(120, 180, 240, 0.028);
}

.board-row.is-me {
  border: 0;
  border-bottom: 1px solid rgba(79, 230, 255, 0.24);
  background: rgba(79, 230, 255, 0.07);
  box-shadow: inset 2px 0 0 var(--cyan);
}

.board-rank {
  font-family: var(--mono);
  color: rgba(140, 180, 215, 0.55);
}

.board-rank.top {
  color: var(--amber);
  text-shadow: 0 0 10px rgba(255, 180, 90, 0.5);
}

.board-name {
  letter-spacing: 0.04em;
}

.board-score {
  font-family: var(--mono);
  font-size: 14px;
  color: #e9f8ff;
}

.board-me input {
  border-radius: 2px;
  border: 1px solid rgba(105, 175, 235, 0.18);
  background: rgba(9, 17, 28, 0.85);
  font-family: var(--mono);
}

.board-me input:focus {
  border-color: rgba(79, 230, 255, 0.55);
  box-shadow: 0 0 16px -6px rgba(79, 230, 255, 0.8);
}

/* 页脚 */
.foot {
  font-size: 10.5px;
  color: rgba(150, 185, 220, 0.5);
}

.foot b {
  font-weight: 500;
  color: rgba(150, 228, 255, 0.85);
}

.foot em {
  color: rgba(182, 150, 255, 0.9);
}

/* ============================================================
   排版精修：右上角读数重排 + 削减多余线条
   ============================================================ */

/* 右上角：分数为主读数，纪录退成一行小字 */
.scoreboard {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex: none;
  text-align: right;
}

.score-main {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 7px;
}

.score-label {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.24em;
  color: rgba(140, 185, 225, 0.5);
}

.score-value {
  font-family: var(--mono);
  font-size: 30px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  color: #f2fbff;
  text-shadow: 0 0 22px rgba(79, 230, 255, 0.3);
}

.score-best {
  display: flex;
  align-items: baseline;
  gap: 5px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  color: rgba(140, 185, 225, 0.42);
}

.score-best b {
  font-size: 11px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: rgba(198, 224, 250, 0.78);
}

/* 加分数字贴着分数右上角浮起 */
.score-main .score-addition {
  top: -6px;
  left: auto;
  right: 0;
  transform: none;
  animation: scoreFloatRight 0.76s ease-out forwards;
}

@keyframes scoreFloatRight {
  0%   { opacity: 0; transform: translateY(5px); }
  20%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(-9px); }
}

/* 第二行：最高天体 + 连锁，右边是工具 */
.status-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.streak-chip {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  color: rgba(140, 185, 225, 0.4);
  opacity: 0.7;
  transition: opacity 0.2s ease, color 0.2s ease;
}

.streak-chip .streak-value {
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: rgba(200, 226, 250, 0.82);
}

.streak-chip.is-hot {
  opacity: 1;
  color: rgba(255, 200, 120, 0.7);
}

.streak-chip.is-hot .streak-value {
  color: #ffd479;
  text-shadow: 0 0 14px rgba(255, 190, 90, 0.8);
}

/* 背景：去掉全屏扫描线与竖刻度 */
.vignette::before {
  content: none;
}

/* 棋盘：只留一条极淡的顶边光，角标只画对角线两端 */
.board {
  border-color: rgba(90, 160, 220, 0.12);
  box-shadow:
    0 30px 70px -40px #000,
    inset 0 0 90px rgba(20, 70, 120, 0.14);
}

.board::before {
  background:
    linear-gradient(90deg, transparent, rgba(79, 230, 255, 0.3), transparent) top / 100% 1px no-repeat;
  opacity: 0.6;
}

.board::after {
  inset: 2px;
  background:
    linear-gradient(var(--cyan), var(--cyan)) 0 0 / 16px 1px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) 0 0 / 1px 16px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) 100% 100% / 16px 1px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) 100% 100% / 1px 16px no-repeat;
  opacity: 0.22;
}

/* 空格：不描边，只靠一点点底色差分隔 */
.cell {
  border-color: transparent;
  background: linear-gradient(180deg, rgba(14, 25, 40, 0.6), rgba(7, 13, 22, 0.55));
  box-shadow: none;
}

/* 长条与按钮：硬描边降到几乎看不见 */
.energy {
  border-color: rgba(105, 175, 235, 0.1);
}

.energy-track {
  box-shadow: none;
}

.singularity,
.ad-btn,
.ability-btn,
.icon-btn,
.ghost-btn {
  border-color: rgba(105, 175, 235, 0.12);
}

.pip {
  border-color: rgba(120, 200, 255, 0.14);
}

/* 排行榜：去掉隔行底色 */
.board-list {
  border-top: 0;
}

.board-row {
  border-bottom-color: rgba(105, 175, 235, 0.06);
}

.board-row:nth-child(odd) {
  background: transparent;
}

/* 页脚：减轻视觉重量 */
.foot {
  color: rgba(150, 185, 220, 0.42);
}

/* ---------- 响应式 ---------- */

@media (max-width: 430px) {
  body {
    padding: calc(12px + env(safe-area-inset-top)) 12px calc(14px + env(safe-area-inset-bottom));
  }

  .app {
    gap: 10px;
    width: min(96vw, 460px);
  }

  .board {
    --gap: 8px;
    --pad: 8px;
    border-radius: 2px;
  }

  .brand-orb {
    width: 30px;
    height: 30px;
  }

  .brand-text h1 {
    font-size: 22px;
  }

  .score-value {
    font-size: 26px;
  }

  .score-label {
    font-size: 8px;
    letter-spacing: 0.2em;
  }

  .score-best {
    font-size: 8.5px;
  }

  .tile-name {
    font-size: 9px;
    font-size: 11.4cqw;
    letter-spacing: 0.01em;
  }

  .foot {
    font-size: 10.5px;
  }

  .stamina {
    gap: 6px;
    padding: 0;
  }

  .stamina-label,
  .stamina-timer {
    display: none;
  }

  .ability-btn {
    padding: 4px 6px;
    gap: 3px;
  }

  .ability-btn span {
    font-size: 10px;
  }

  .ad-btn {
    padding: 5px 8px;
    font-size: 10px;
  }

  .message-title {
    font-size: 21px;
  }
}

@media (max-height: 820px) and (min-width: 431px) {
  .app {
    width: min(94vw, 460px, 60vh);
  }
}

@media (max-width: 430px) and (max-height: 700px) {
  body {
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
  }

  .app {
    gap: 8px;
  }

  .foot-hint {
    display: none;
  }
}

@media (max-width: 340px) {
  .app {
    gap: 8px;
  }

  .foot {
    display: none;
  }
}

@media (max-height: 560px) and (orientation: landscape) {
  body {
    padding-top: calc(10px + env(safe-area-inset-top));
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
  }

  .app {
    width: min(94vw, 700px);
    display: grid;
    grid-template-columns: auto minmax(180px, 1fr);
    grid-template-rows: auto auto 1fr auto;
    grid-template-areas:
      "board topbar"
      "board status"
      "board energy"
      "board stamina";
    align-items: start;
    gap: 10px 16px;
  }

  .board {
    grid-area: board;
    width: min(52vh, 320px);
  }

  .topbar {
    grid-area: topbar;
    align-items: center;
  }

  .statusbar {
    grid-area: status;
  }

  .energy {
    grid-area: energy;
    align-self: end;
  }

  .stamina {
    grid-area: stamina;
  }

  .foot {
    display: none;
  }

  .brand-text p {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nebula,
  .orb,
  .orb-extra,
  .brand-orb {
    animation: none !important;
  }

  .board.shake-soft .board-inner,
  .board.shake-strong .board-inner {
    animation: none !important;
  }
}
