* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #fff;
  background: #141a36;
  -webkit-tap-highlight-color: transparent;
}

.view { display: none; min-height: 100vh; padding: 24px 16px 40px; flex-direction: column; align-items: center; }
.view.active { display: flex; }
#view-home, #view-match3 { background: linear-gradient(160deg, #243b6b 0%, #1a2347 55%, #141a36 100%); }
#view-wheel {
  background:
    radial-gradient(2px 2px at 20% 15%, #fff, transparent),
    radial-gradient(2px 2px at 70% 25%, #cfe3ff, transparent),
    radial-gradient(2px 2px at 40% 60%, #fff, transparent),
    radial-gradient(2px 2px at 85% 70%, #ffe9b0, transparent),
    radial-gradient(2px 2px at 55% 85%, #fff, transparent),
    linear-gradient(160deg, #1b1145 0%, #2a1a5e 50%, #160d33 100%);
}

/* ---------- 大厅 ---------- */
.hero { text-align: center; margin: 30px 0 34px; }
.hero h1 { font-size: 30px; letter-spacing: 4px; text-shadow: 0 0 14px rgba(120,160,255,.6); }
.hero p { color: #9fb0d6; font-size: 14px; margin-top: 8px; letter-spacing: 2px; }
.cards { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 14px; }
.card {
  display: flex; align-items: center; cursor: pointer;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12);
  border-radius: 16px; padding: 16px; box-shadow: 0 6px 18px rgba(0,0,0,.25);
  transition: transform .12s ease;
}
.card:active { transform: scale(.98); }
.card-icon {
  width: 58px; height: 58px; border-radius: 50%; flex: 0 0 auto;
  background: radial-gradient(circle at 32% 26%, #fff 0%, #ffe9a8 42%, #d99a1f 100%);
  border: 2px solid #fff3c4;
  box-shadow: inset 0 3px 6px rgba(255,255,255,.8), inset 0 -5px 7px rgba(120,70,0,.5), 0 4px 8px rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
}
.card-icon span { font-size: 30px; }
.card-body { flex: 1; margin: 0 14px; display: flex; flex-direction: column; gap: 4px; }
.card-name { font-size: 19px; font-weight: 800; }
.card-desc { color: #aeb9dd; font-size: 12px; }
.card-best { color: #ffd166; font-size: 12px; font-weight: 700; margin-top: 2px; }
.card-go { color: #8fa0cc; font-size: 26px; font-weight: 700; }

/* ---------- 消消乐 HUD ---------- */
.hud {
  width: 100%; max-width: 420px; display: flex; align-items: center; justify-content: space-between;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1);
  border-radius: 14px; padding: 10px 14px; margin-bottom: 10px;
}
.hud-item { display: flex; flex-direction: column; }
.hud-item.center { flex: 1; align-items: center; margin: 0 12px; }
.hud-item.right { align-items: flex-end; }
.hud-label { color: #9fb0d6; font-size: 12px; }
.hud-value { color: #ffd166; font-size: 22px; font-weight: 800; line-height: 1.1; }
.hud-value.low { color: #ff6b6b; }
.hud-sub { color: #c7d2ee; font-size: 11px; margin-top: 3px; }
.progress { width: 100%; max-width: 170px; height: 8px; background: rgba(255,255,255,.12); border-radius: 99px; overflow: hidden; margin: 5px 0 2px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #4ade80, #22d3ee); border-radius: 99px; transition: width .35s ease; }
.status-row { width: 100%; max-width: 420px; margin-bottom: 12px; }
.status-pill {
  display: inline-block; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1);
  color: #aab8dc; font-size: 12px; padding: 6px 12px; border-radius: 99px;
}
.status-pill.active {
  background: linear-gradient(135deg, #f59e0b, #ef4444); color: #fff; border-color: transparent;
  box-shadow: 0 3px 10px rgba(239,68,68,.4);
}

/* ---------- 棋盘 ---------- */
.board {
  position: relative;
  background: rgba(0,0,0,.25);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: inset 0 4px 14px rgba(0,0,0,.35), 0 8px 22px rgba(0,0,0,.3);
}
.tile {
  position: absolute; top: 0; left: 0;
  width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px; font-size: 28px; line-height: 1; cursor: pointer;
  box-shadow: inset 0 1px 3px rgba(255,255,255,.5), 0 2px 4px rgba(0,0,0,.2);
  transition: transform .19s cubic-bezier(.2,.8,.3,1);
  will-change: transform; user-select: none;
}
.tile.sel { box-shadow: 0 0 0 3px #ffd166, 0 3px 8px rgba(0,0,0,.35); z-index: 5; }
.tile.clearing { box-shadow: 0 0 0 2px #fff; z-index: 4; }
.tile.scatter { box-shadow: 0 0 0 2px #fff3b0, 0 0 10px #ffd84d, inset 0 1px 3px rgba(255,255,255,.6); }
.tile.shake { animation: shake .3s; }
@keyframes shake { 0%,100% { margin-left: 0; } 25% { margin-left: -4px; } 75% { margin-left: 4px; } }

.fx-layer { position: absolute; inset: 0; pointer-events: none; z-index: 10; overflow: hidden; }
.popup {
  position: absolute; left: 50%; top: 38%; transform: translate(-50%, 0);
  color: #ffd166; font-size: 19px; font-weight: 800; white-space: nowrap;
  text-shadow: 0 2px 4px rgba(0,0,0,.5);
  animation: floatUp .72s ease-out forwards;
}
.popup.combo { color: #ff8fab; font-size: 22px; }
@keyframes floatUp {
  0% { opacity: 0; transform: translate(-50%, 6px) scale(.7); }
  25% { opacity: 1; transform: translate(-50%, -6px) scale(1.1); }
  100% { opacity: 0; transform: translate(-50%, -42px) scale(1); }
}
.particle {
  position: absolute; width: 7px; height: 7px; border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: particleFly .62s ease-out forwards;
}
@keyframes particleFly {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, 0px))) scale(.4); }
}
.combo-banner {
  position: absolute; left: 50%; top: 44%; transform: translateX(-50%);
  color: #fff; font-size: 28px; font-weight: 900; pointer-events: none; z-index: 11;
  text-shadow: 0 0 10px #ff8fab, 0 2px 6px rgba(0,0,0,.5);
  animation: comboPop .82s ease-out forwards;
}
@keyframes comboPop {
  0% { opacity: 0; transform: translateX(-50%) scale(.4); }
  30% { opacity: 1; transform: translateX(-50%) scale(1.15); }
  100% { opacity: 0; transform: translateX(-50%) scale(1); }
}
.mult-badge {
  position: absolute; right: 8px; top: 8px; z-index: 12;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  border-radius: 8px; padding: 4px 9px;
  display: flex; flex-direction: column; align-items: center;
  box-shadow: 0 3px 8px rgba(0,0,0,.35);
  animation: popIn .2s ease-out;
}
.mult-x { color: #fff; font-size: 20px; font-weight: 900; line-height: 1; }
.mult-label { color: #ffe9c2; font-size: 10px; }
@keyframes popIn { 0% { transform: scale(.5); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.bigwin {
  position: absolute; inset: 0; z-index: 13;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(circle, rgba(255,215,0,.18), rgba(0,0,0,.35));
  animation: fadeIn .3s ease-out; pointer-events: none;
}
.bigwin-text {
  color: #ffd166; font-size: 52px; font-weight: 900;
  text-shadow: 0 0 16px #ff8fab, 0 3px 8px rgba(0,0,0,.6);
  animation: pulse .6s ease-in-out infinite alternate;
}
.bigwin-sub { color: #fff; font-size: 18px; font-weight: 700; margin-top: 6px; }
@keyframes fadeIn { 0% { opacity: 0; } 100% { opacity: 1; } }
@keyframes pulse { from { transform: scale(1); } to { transform: scale(1.12); } }

/* ---------- 按钮 / 底部 ---------- */
.btn {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff; font-size: 16px; font-weight: 700;
  padding: 10px 34px; border-radius: 999px; border: none;
  line-height: 1.4; cursor: pointer;
}
.btn.ghost { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.2); }
.btn[disabled] { opacity: .6; cursor: default; }
.footer, .nav-row { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.btn-row, .nav-row { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 18px; }
.footer { margin-top: 18px; }
.hint { color: #8294bd; font-size: 12px; text-align: center; margin-top: 12px; max-width: 400px; line-height: 1.6; }

/* ---------- 弹窗 ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(8,12,28,.72); z-index: 50;
  display: flex; align-items: center; justify-content: center;
}
.modal {
  width: 300px; background: linear-gradient(160deg, #2b3a66, #1c2547);
  border: 1px solid rgba(255,255,255,.12); border-radius: 18px;
  padding: 30px 24px; display: flex; flex-direction: column; align-items: center; gap: 10px;
  box-shadow: 0 16px 40px rgba(0,0,0,.5);
}
.modal-emoji { font-size: 46px; }
.modal-title { font-size: 22px; font-weight: 800; }
.modal-sub { color: #c7d2ee; font-size: 14px; margin-bottom: 10px; }

/* ---------- 轮回十二转 ---------- */
.topbar { width: 100%; max-width: 420px; display: flex; align-items: center; justify-content: space-between; }
.back { color: #b9c4ff; font-size: 15px; cursor: pointer; padding: 6px; }
.title { font-size: 21px; font-weight: 800; letter-spacing: 3px; text-shadow: 0 0 10px rgba(180,160,255,.7); }
.score-box { display: flex; flex-direction: column; align-items: flex-end; }
.score-label { color: #b9c4ff; font-size: 11px; }
.score-value { color: #ffd166; font-size: 19px; font-weight: 800; }
.best-line { color: #9aa6e0; font-size: 12px; margin: 4px 0 14px; }

.wheel-wrap { position: relative; width: 320px; height: 320px; display: flex; align-items: center; justify-content: center; }
.pointer {
  position: absolute; top: -4px; left: 50%; transform: translateX(-50%); z-index: 20;
  width: 0; height: 0;
  border-left: 14px solid transparent; border-right: 14px solid transparent;
  border-top: 26px solid #ffd166;
  filter: drop-shadow(0 3px 4px rgba(0,0,0,.4));
}
.wheel {
  position: absolute; width: 300px; height: 300px; border-radius: 50%;
  border: 6px solid #ffd166;
  box-shadow: 0 0 0 4px rgba(255,209,102,.3), 0 10px 26px rgba(0,0,0,.5), inset 0 0 18px rgba(0,0,0,.25);
  transition: transform 3.6s cubic-bezier(.17,.67,.12,.99);
  will-change: transform;
}
.sector { position: absolute; inset: 0; transform-origin: center; }
.sector-inner { position: absolute; top: 13px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; width: 62px; gap: 4px; }
.token {
  width: 46px; height: 46px; border-radius: 50%;
  background: radial-gradient(circle at 32% 26%, #fff 0%, #ffe9a8 42%, #d99a1f 100%);
  border: 2px solid #fff3c4;
  box-shadow: inset 0 3px 5px rgba(255,255,255,.8), inset 0 -5px 7px rgba(120,70,0,.5), 0 4px 7px rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
}
.sector-emoji { font-size: 25px; line-height: 1; filter: drop-shadow(0 1px 1px rgba(0,0,0,.35)); }
.sector-name { color: #fff; font-size: 12px; font-weight: 700; text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.hub {
  position: absolute; width: 74px; height: 74px; border-radius: 50%; z-index: 15; cursor: pointer;
  background: radial-gradient(circle at 35% 30%, #fff3c4, #f59e0b 60%, #b45309);
  border: 3px solid #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 16px rgba(245,158,11,.7), 0 4px 9px rgba(0,0,0,.4);
}
.hub-text { color: #5b2c00; font-size: 19px; font-weight: 900; letter-spacing: 1px; }
.wheel-wrap .popup { font-size: 26px; font-weight: 900; animation-duration: .9s; }

.actions { margin-top: 22px; }
.result { margin-top: 18px; display: flex; flex-direction: column; align-items: center; gap: 10px; min-height: 160px; }
.flip-card { width: 116px; height: 138px; perspective: 600px; }
.flip-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .6s ease; }
.flip-inner.flipped { transform: rotateY(180deg); }
.face {
  position: absolute; inset: 0; backface-visibility: hidden; border-radius: 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  box-shadow: 0 8px 18px rgba(0,0,0,.45); padding: 8px;
}
.face.front { background: linear-gradient(160deg, #3b2d7a, #251a52); border: 1px solid #ffd166; }
.face.back { background: linear-gradient(160deg, #0e7490, #155e75); border: 1px solid #67e8f9; transform: rotateY(180deg); }
.face-emoji { font-size: 34px; line-height: 1; }
.mini-token {
  width: 62px; height: 62px; border-radius: 50%;
  background: radial-gradient(circle at 32% 26%, #fff 0%, #ffe9a8 42%, #d99a1f 100%);
  border: 2px solid #fff3c4;
  box-shadow: inset 0 3px 5px rgba(255,255,255,.8), inset 0 -5px 7px rgba(120,70,0,.5), 0 4px 7px rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
}
.face-symbol { font-size: 42px; color: #a5f3fc; line-height: 1; }
.face-name { font-size: 16px; font-weight: 800; }
.face-tip { color: #c9b8ff; font-size: 11px; }
.face.back .face-tip { color: #a5f3fc; }
.result-line { color: #ffd166; font-size: 15px; font-weight: 700; }
.result-hint { color: #9aa6e0; font-size: 12px; }

/* 模拟金币 */
.coins-big { margin-top: 12px; font-size: 15px; color: #ffd166; }
.coins-big b { font-size: 22px; }
.coins-pill {
  display: inline-block; margin-left: 6px;
  background: rgba(255, 209, 102, .12); border: 1px solid rgba(255, 209, 102, .3);
  color: #ffd166; font-size: 12px; padding: 6px 12px; border-radius: 99px;
}
.status-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stake-row { display: flex; align-items: center; gap: 10px; justify-content: center; margin-top: 16px; }
.stake-row .lbl { color: #9aa6e0; font-size: 12px; }
.stake-btn {
  background: rgba(255, 255, 255, .08); color: #c7d2ee;
  border: 1px solid rgba(255, 255, 255, .15);
  font-size: 15px; font-weight: 700; padding: 8px 22px; border-radius: 99px; cursor: pointer;
}
.stake-btn.active { background: linear-gradient(135deg, #f59e0b, #ef4444); color: #fff; border-color: transparent; }
