/* ============================================================
   团子消消乐 — 样式
   ============================================================ */

.game-body {
  min-height: 100svh;
  background:
    radial-gradient(ellipse 120% 60% at 50% -10%, rgba(77, 227, 255, .10), transparent 60%),
    radial-gradient(ellipse 90% 50% at 50% 110%, rgba(255, 77, 141, .10), transparent 60%),
    var(--bg);
  overflow-x: hidden;
}

/* ---------- 顶部条 ---------- */
.ghud {
  position: sticky;
  top: 0;
  z-index: 50;
  max-width: var(--col);
  margin: 0 auto;
  padding: 12px var(--pad);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-family: var(--mono);
  font-size: .68rem;
  letter-spacing: .06em;
  background: linear-gradient(to bottom, rgba(5, 6, 10, .96), rgba(5, 6, 10, .55));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.ghud__back {
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px;
  transition: color .25s, border-color .25s;
}
.ghud__back:hover { color: var(--cyan); border-color: rgba(77, 227, 255, .45); }

.ghud__title { color: var(--ink); font-weight: 700; }
.ghud__title i { color: var(--pink); font-style: normal; margin: 0 4px; }

.ghud__tag {
  padding: 3px 9px;
  border-radius: 3px;
  border: 1px solid var(--line);
  color: var(--lime);
  font-size: .6rem;
}
.ghud__tag.is-alert { color: var(--pink); border-color: rgba(255, 77, 141, .4); }

/* ---------- 主体 ---------- */
.game {
  max-width: var(--col);
  margin: 0 auto;
  padding: 14px var(--pad) 40px;
}

/* 关卡选择 */
.levels {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-bottom: 14px;
}
.lv {
  position: relative;
  padding: 9px 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(10, 13, 20, .7);
  font-family: var(--mono);
  font-size: .68rem;
  color: var(--muted);
  text-align: center;
  transition: color .25s, border-color .25s, background .25s, transform .2s;
}
.lv small {
  display: block;
  font-size: .55rem;
  letter-spacing: .08em;
  opacity: .75;
  margin-top: 2px;
}
.lv:hover:not(:disabled) { transform: translateY(-2px); color: var(--ink); }
.lv.is-active {
  color: #04060a;
  background: var(--cyan);
  border-color: var(--cyan);
  font-weight: 700;
  box-shadow: 0 0 18px rgba(77, 227, 255, .35);
}
.lv.is-locked { opacity: .42; }
.lv.is-locked::after {
  content: "🔒";
  position: absolute;
  top: 3px; right: 4px;
  font-size: .55rem;
  opacity: .8;
}
.lv.is-done::before {
  content: "✓";
  position: absolute;
  top: 2px; left: 5px;
  font-size: .6rem;
  color: var(--lime);
}
.lv.is-active.is-done::before { color: #04060a; }

/* 数据条 */
.game__stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}
.stat {
  padding: 10px 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  text-align: center;
}
.stat b {
  display: block;
  font-family: var(--mono);
  font-size: 1.15rem;
  line-height: 1.2;
  color: var(--cyan);
  font-variant-numeric: tabular-nums;
}
.stat span { font-size: .6rem; color: var(--muted); }
.stat.is-done b { color: var(--lime); }

/* 进度条 */
.progress {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .07);
  overflow: hidden;
  margin-bottom: 14px;
}
.progress__bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--cyan), var(--lime));
  transition: width .35s var(--ease);
}

/* ---------- 棋盘 ---------- */
.board-wrap {
  position: relative;
  margin: 0 auto;
  width: 100%;
}
.board {
  position: relative;
  margin: 0 auto;
  border-radius: 12px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .028), rgba(255, 255, 255, .008)),
    rgba(8, 10, 16, .8);
  box-shadow: inset 0 0 60px rgba(0, 0, 0, .6);
  overflow: hidden;
  touch-action: manipulation;
}

.tile {
  position: absolute;
  top: 0; left: 0;
  border-radius: 10px;
  background-size: cover;
  background-position: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .45), inset 0 0 0 1px rgba(255, 255, 255, .14);
  transition: transform .18s cubic-bezier(.3, 1.4, .5, 1), opacity .18s,
              box-shadow .2s, filter .2s;
  will-change: transform;
  cursor: pointer;
}
.tile::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at 32% 26%, rgba(255, 255, 255, .3), transparent 58%);
  pointer-events: none;
}
.tile.is-sel {
  box-shadow: 0 0 0 2px var(--cyan), 0 0 18px rgba(77, 227, 255, .6);
  filter: brightness(1.12) saturate(1.15);
  z-index: 4;
}
.tile.is-pop {
  transform-origin: center;
  animation: pop .22s ease forwards;
  z-index: 5;
}
@keyframes pop {
  0%   { filter: brightness(1); }
  45%  { filter: brightness(1.9) saturate(1.4); }
  100% { filter: brightness(2.4); opacity: 0; }
}
.tile.is-hint {
  animation: hintPulse .7s ease-in-out 3;
}
@keyframes hintPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(200, 255, 61, 0); }
  50%      { box-shadow: 0 0 0 3px rgba(200, 255, 61, .85), 0 0 20px rgba(200, 255, 61, .6); }
}

/* 棋盘提示层 */
.board__msg {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity .3s var(--ease);
  z-index: 8;
}
.board__msg.is-show { opacity: 1; }
.board__msg span {
  padding: 10px 22px;
  border-radius: 999px;
  background: rgba(5, 7, 12, .92);
  border: 1px solid rgba(77, 227, 255, .4);
  font-family: var(--mono);
  font-size: .76rem;
  color: var(--cyan);
  letter-spacing: .06em;
}

/* 飘分 */
.float-score {
  position: absolute;
  font-family: var(--mono);
  font-size: .8rem;
  font-weight: 700;
  color: var(--lime);
  text-shadow: 0 0 12px rgba(200, 255, 61, .7);
  pointer-events: none;
  z-index: 9;
  animation: floatUp .9s ease-out forwards;
}
@keyframes floatUp {
  0%   { opacity: 0; transform: translate(-50%, 0) scale(.85); }
  25%  { opacity: 1; transform: translate(-50%, -10px) scale(1.05); }
  100% { opacity: 0; transform: translate(-50%, -46px) scale(.95); }
}

/* ---------- 按钮 ---------- */
.game__bar {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 6px;
  margin-top: 14px;
}
.gbtn {
  padding: 11px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(10, 13, 20, .8);
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--ink);
  letter-spacing: .04em;
  transition: border-color .25s, color .25s, background .25s, transform .2s;
}
.gbtn:hover:not(:disabled) { border-color: rgba(77, 227, 255, .5); color: var(--cyan); transform: translateY(-2px); }
.gbtn--solid { background: var(--cyan); color: #04060a; font-weight: 700; border-color: var(--cyan); }
.gbtn--solid:hover { background: var(--lime); border-color: var(--lime); color: #04060a; }
.gbtn:disabled { opacity: .4; }
.gbtn.is-armed {
  border-color: var(--pink);
  color: var(--pink);
  background: rgba(255, 77, 141, .12);
  animation: armedPulse 1s ease-in-out infinite;
}
@keyframes armedPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 77, 141, .5); }
  50%      { box-shadow: 0 0 0 4px rgba(255, 77, 141, 0); }
}

.game__tip {
  margin: 14px 0 0;
  font-size: .74rem;
  line-height: 1.75;
  color: var(--muted);
  text-align: center;
}

/* ---------- 连击奖励闪光 ---------- */
.flash {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 200;
  opacity: 0;
  background: radial-gradient(circle at center, rgba(200, 255, 61, .34), transparent 60%);
}
.flash.is-on { animation: flashPop .55s ease-out; }
@keyframes flashPop {
  0%   { opacity: 0; }
  18%  { opacity: 1; }
  100% { opacity: 0; }
}

.reward {
  position: fixed;
  left: 50%; top: 38%;
  transform: translate(-50%, -50%) scale(.6);
  z-index: 210;
  pointer-events: none;
  font-family: var(--mono);
  font-weight: 700;
  letter-spacing: .04em;
  text-align: center;
  opacity: 0;
  white-space: nowrap;
}
.reward.is-on { animation: rewardPop 1.1s cubic-bezier(.2, 1.5, .4, 1) forwards; }
.reward__big { font-size: clamp(1.6rem, 8vw, 2.6rem); color: var(--lime); text-shadow: 0 0 26px rgba(200, 255, 61, .8); }
.reward__sub { display: block; margin-top: 6px; font-size: .74rem; color: var(--cyan); }
@keyframes rewardPop {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(.5) rotate(-6deg); }
  22%  { opacity: 1; transform: translate(-50%, -50%) scale(1.12) rotate(2deg); }
  40%  { transform: translate(-50%, -50%) scale(1) rotate(0deg); }
  78%  { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -62%) scale(1); }
}

/* ---------- 遮罩弹窗 ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(3, 4, 8, .82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s var(--ease);
}
.modal.is-open { opacity: 1; pointer-events: auto; }

.panel {
  width: 100%;
  max-width: 380px;
  max-height: 88svh;
  overflow-y: auto;
  padding: 26px 22px;
  border-radius: 14px;
  border: 1px solid rgba(77, 227, 255, .28);
  background: linear-gradient(180deg, rgba(12, 16, 26, .98), rgba(6, 8, 14, .98));
  box-shadow: 0 30px 80px rgba(0, 0, 0, .7), 0 0 0 1px rgba(77, 227, 255, .08);
  text-align: center;
  transform: translateY(14px) scale(.97);
  transition: transform .35s var(--ease);
}
.modal.is-open .panel { transform: none; }

.panel__kicker {
  font-family: var(--mono);
  font-size: .64rem;
  letter-spacing: .2em;
  color: var(--cyan);
  text-transform: uppercase;
  margin: 0 0 8px;
}
.panel__title {
  margin: 0 0 6px;
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.panel__sub { margin: 0 0 18px; color: var(--muted); font-size: .84rem; line-height: 1.7; }

.panel__stats {
  display: flex;
  justify-content: center;
  gap: 22px;
  margin: 0 0 20px;
}
.panel__stats div { font-family: var(--mono); }
.panel__stats b { display: block; font-size: 1.25rem; color: var(--lime); }
.panel__stats span { font-size: .62rem; color: var(--muted); }

.panel__actions { display: grid; gap: 8px; }

/* ---------- 通关：阿布 ---------- */
.abby-stage {
  position: relative;
  margin: 0 auto 18px;
  width: min(300px, 74vw);
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
}
.abby-glow {
  position: absolute;
  inset: -8%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 77, 141, .35), rgba(77, 227, 255, .22) 45%, transparent 68%);
  filter: blur(18px);
  animation: abbyGlow 3.2s ease-in-out infinite;
}
@keyframes abbyGlow {
  0%, 100% { opacity: .55; transform: scale(.96); }
  50%      { opacity: 1; transform: scale(1.06); }
}

.abby-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px dashed rgba(77, 227, 255, .4);
  animation: abbySpin 18s linear infinite;
}
.abby-ring::after {
  content: "";
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  border: 1px solid rgba(255, 77, 141, .3);
}
@keyframes abbySpin { to { transform: rotate(360deg); } }

.abby {
  position: relative;
  width: 88%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid rgba(255, 255, 255, .9);
  box-shadow: 0 0 0 6px rgba(77, 227, 255, .18), 0 20px 50px rgba(0, 0, 0, .6);
  animation: abbyFloat 3.4s ease-in-out infinite, abbyTilt 5.5s ease-in-out infinite;
  background: #f3ece2;
}
.abby img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: 50% 22%;
  display: block;
  animation: abbyBreath 3.4s ease-in-out infinite;
}
@keyframes abbyFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-12px); }
}
@keyframes abbyTilt {
  0%, 100% { rotate: -3deg; }
  50%      { rotate: 3deg; }
}
@keyframes abbyBreath {
  0%, 100% { scale: 1; }
  50%      { scale: 1.06; }
}

/* 环绕闪点 */
.abby-spark {
  position: absolute;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 12px var(--lime);
  animation: spark 2.4s ease-in-out infinite;
}
.abby-spark:nth-child(4) { background: var(--pink); box-shadow: 0 0 12px var(--pink); animation-delay: .5s; }
.abby-spark:nth-child(5) { background: var(--cyan); box-shadow: 0 0 12px var(--cyan); animation-delay: 1s; }
.abby-spark:nth-child(6) { background: var(--violet); box-shadow: 0 0 12px var(--violet); animation-delay: 1.5s; }
@keyframes spark {
  0%, 100% { opacity: .3; transform: scale(.7); }
  50%      { opacity: 1; transform: scale(1.25); }
}

.abby-name {
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: .04em;
  margin: 0 0 2px;
  background: linear-gradient(120deg, #fff, var(--lime) 55%, var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.abby-en {
  font-family: var(--mono);
  font-size: .62rem;
  letter-spacing: .32em;
  color: var(--muted);
  margin: 0 0 12px;
}

@media (max-width: 420px) {
  .game__stats { grid-template-columns: repeat(2, 1fr); }
  .levels { grid-template-columns: repeat(5, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .abby, .abby img, .abby-glow, .abby-ring, .abby-spark, .gbtn.is-armed { animation: none !important; }
  .tile { transition-duration: .001ms !important; }
}
