/* 羊了个羊 · 金牛游戏中心 */
:root {
  --bg: #070d0a;
  --ink: #eef8f0;
  --gold: #e8d5a3;
  --green: #7dff8a;
  --green-deep: #2f9e56;
  --danger: #ff6b8a;
  --muted: rgba(232, 213, 163, 0.7);
  --font: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  --tile: #f7f1e3;
  --tile-ink: #2a2418;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  width: 100%; height: 100%;
  background: var(--bg); color: var(--ink); font-family: var(--font);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
#app {
  position: relative; width: 100vw; height: 100vh;
  display: grid; place-items: center;
  background:
    radial-gradient(900px 500px at 50% 0%, rgba(125, 255, 138, 0.08), transparent 55%),
    radial-gradient(700px 400px at 80% 100%, rgba(232, 213, 163, 0.08), transparent 50%),
    #070d0a;
}
.side-deco {
  position: absolute; top: 10%; bottom: 10%; width: 2px;
  background: linear-gradient(180deg, transparent, rgba(232,213,163,.25), transparent);
  pointer-events: none;
}
.side-deco.a { left: 6vw; }
.side-deco.b { right: 6vw; }

#stage {
  position: relative;
  width: min(100vw, calc(100vh * 0.58));
  height: min(100vh, calc(100vw / 0.58));
  max-width: 520px;
  max-height: 920px;
  background: linear-gradient(180deg, #0c1612 0%, #0a120e 50%, #070d0a 100%);
  border-radius: 18px;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(232, 213, 163, 0.18),
    0 30px 80px rgba(0, 0, 0, 0.65),
    0 0 60px rgba(125, 255, 138, 0.08);
  display: flex;
  flex-direction: column;
}

/* HUD */
.hud {
  flex: 0 0 auto;
  padding: 12px 14px 8px;
  display: flex; justify-content: space-between; align-items: flex-start;
  background: linear-gradient(180deg, rgba(7, 13, 10, 0.9), transparent);
  z-index: 10;
}
.hud-block { min-width: 88px; }
.hud-label {
  font-size: 10px; letter-spacing: 0.14em; color: var(--muted);
  text-transform: uppercase;
}
.hud-value {
  font-size: 22px; font-weight: 800; line-height: 1.15;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 18px rgba(125, 255, 138, 0.3);
}
.hud-right { text-align: right; }

/* 棋盘 */
.board {
  position: relative;
  flex: 1 1 auto;
  margin: 4px 10px;
  min-height: 0;
}
.tile {
  position: absolute;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px;
  background: linear-gradient(160deg, var(--tile), #e8dfc8);
  color: var(--tile-ink);
  font-size: 22px;
  box-shadow:
    0 2px 0 #c9b892,
    0 6px 14px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255,255,255,.65);
  cursor: pointer;
  transition: transform .12s ease, filter .12s ease, opacity .15s ease;
  border: 1px solid rgba(255,255,255,.35);
  z-index: 1;
}
.tile:hover { transform: translateY(-2px); filter: brightness(1.05); }
.tile.is-blocked {
  filter: brightness(0.72) saturate(0.85);
  cursor: default;
}
.tile.is-blocked:hover { transform: none; filter: brightness(0.72) saturate(0.85); }
.tile.is-picked {
  opacity: 0;
  transform: scale(0.6);
  pointer-events: none;
}
.tile .face {
  line-height: 1;
  transform: translateY(1px);
  text-shadow: 0 1px 0 rgba(255,255,255,.5);
}

/* 收集槽 */
.slot-wrap {
  flex: 0 0 auto;
  padding: 8px 12px 4px;
}
.slot-bar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  padding: 8px;
  border-radius: 12px;
  background: rgba(232, 213, 163, 0.08);
  border: 1px solid rgba(232, 213, 163, 0.18);
  min-height: 56px;
}
.slot {
  aspect-ratio: 1;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px dashed rgba(232, 213, 163, 0.22);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}
.slot.filled {
  background: linear-gradient(160deg, var(--tile), #e8dfc8);
  border: 1px solid rgba(255,255,255,.35);
  box-shadow: 0 2px 0 #c9b892, 0 4px 10px rgba(0,0,0,.3);
  animation: pop .18s ease;
}
.slot.match {
  animation: flash .35s ease;
}
@keyframes pop {
  from { transform: scale(0.7); opacity: .4; }
  to { transform: scale(1); opacity: 1; }
}
@keyframes flash {
  0%, 100% { box-shadow: 0 0 0 rgba(125,255,138,0); }
  50% { box-shadow: 0 0 18px rgba(125,255,138,.85); }
}
.slot-hint {
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
  letter-spacing: .02em;
}

/* 道具 */
.props {
  flex: 0 0 auto;
  display: flex; gap: 8px; justify-content: center;
  padding: 8px 12px 14px;
}
.prop-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(232, 213, 163, 0.28);
  background: rgba(232, 213, 163, 0.08);
  color: var(--ink);
  font-size: 12px;
  cursor: pointer;
  transition: background .15s, border-color .15s, opacity .15s;
}
.prop-btn:hover { background: rgba(232, 213, 163, 0.16); border-color: rgba(232, 213, 163, 0.5); }
.prop-btn:disabled { opacity: .4; cursor: not-allowed; }
.prop-btn em {
  font-style: normal;
  font-size: 11px;
  color: var(--gold);
  background: rgba(0,0,0,.3);
  border-radius: 999px;
  padding: 1px 6px;
}
.prop-ico { font-size: 14px; }

/* 覆盖层 */
.overlay {
  position: absolute; inset: 0;
  display: none;
  place-items: center;
  padding: 18px;
  background: rgba(4, 8, 6, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 30;
}
.overlay.show { display: grid; }
.panel-box {
  width: min(100%, 380px);
  background: linear-gradient(165deg, #142018, #0c1410);
  border: 1px solid rgba(232, 213, 163, 0.22);
  border-radius: 16px;
  padding: 22px 20px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0,0,0,.5);
}
.panel-box .kicker {
  font-size: 10px; letter-spacing: .18em; color: var(--gold);
  opacity: .85; margin-bottom: 10px; text-transform: uppercase;
}
.panel-box h1 { font-size: 28px; margin-bottom: 10px; letter-spacing: .04em; }
.panel-box h2 { font-size: 22px; margin-bottom: 10px; }
.panel-box p {
  font-size: 13px; line-height: 1.7; color: rgba(238, 248, 240, 0.82);
  margin-bottom: 12px;
}
.panel-box .muted { color: var(--muted); font-size: 12px; }
.panel-box .best-line { font-size: 13px; color: var(--muted); margin: 8px 0 12px; }
.panel-box .best-line b { color: var(--gold); font-size: 18px; }
.panel-box .score-line {
  font-size: 40px; font-weight: 800; line-height: 1.1;
  color: var(--green);
  text-shadow: 0 0 24px rgba(125, 255, 138, 0.35);
  margin: 8px 0;
  font-variant-numeric: tabular-nums;
}
.panel-box .best {
  font-size: 12px; color: var(--muted); margin: 4px 0;
}
.panel-box .best span { color: var(--gold); font-weight: 700; }
.btn-row {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: center;
  margin-top: 14px;
}
.btn {
  appearance: none; border: none; cursor: pointer;
  padding: 11px 18px; border-radius: 999px;
  font-size: 14px; font-weight: 600;
  transition: transform .12s, filter .12s, opacity .12s;
  text-decoration: none;
}
.btn:active { transform: scale(.97); }
.btn-primary {
  background: linear-gradient(135deg, var(--gold), #c4a86a);
  color: #1a1408;
  box-shadow: 0 8px 24px rgba(232, 213, 163, 0.28);
}
.btn-primary:disabled {
  opacity: .45; cursor: not-allowed; transform: none;
}
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid rgba(232, 213, 163, 0.35);
}

/* 规则 */
.rules-box { text-align: left; width: min(100%, 420px); }
.rules-box .kicker, .rules-box h2, .rules-box .rules-count, .rules-box .btn-row {
  text-align: center;
}
.rules-list {
  margin: 8px 4px 12px 18px;
  font-size: 12.5px;
  line-height: 1.75;
  color: rgba(238, 248, 240, 0.88);
}
.rules-list li { margin-bottom: 4px; }
.rules-list b { color: var(--gold); font-weight: 700; }
.rules-count {
  font-size: 12px; color: var(--muted);
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(232, 213, 163, 0.08);
  border: 1px solid rgba(232, 213, 163, 0.15);
  margin-bottom: 6px;
}
.rules-count b {
  color: var(--green);
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

/* 窄屏 */
@media (max-width: 420px) {
  #stage { border-radius: 0; max-height: 100vh; height: 100vh; width: 100vw; }
  .hud-value { font-size: 18px; }
  .tile { font-size: 18px; border-radius: 8px; }
  .panel-box { padding: 18px 14px; }
}

/* ── 三消震撼动画 ── */
.tile.is-blast {
  animation: tileBlast .42s cubic-bezier(.2,1.4,.3,1) forwards;
  z-index: 50 !important;
}
@keyframes tileBlast {
  0%   { transform: scale(1) rotate(0); filter: brightness(1); opacity: 1; }
  35%  { transform: scale(1.35) rotate(-8deg); filter: brightness(1.8) saturate(1.6); box-shadow: 0 0 40px #7dff8a, 0 0 80px #ffd76a; }
  70%  { transform: scale(0.5) rotate(12deg); filter: brightness(2.2); opacity: .85; }
  100% { transform: scale(0) rotate(25deg); opacity: 0; }
}
.slot.match {
  animation: slotBlast .45s ease forwards;
}
@keyframes slotBlast {
  0%   { transform: scale(1); box-shadow: 0 0 0 #7dff8a; }
  30%  { transform: scale(1.28); box-shadow: 0 0 28px #7dff8a, 0 0 56px #e8d5a3; filter: brightness(1.5); }
  100% { transform: scale(0); opacity: 0; box-shadow: 0 0 40px #7dff8a; }
}
.burst {
  pointer-events: none;
  position: absolute;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0%, #7dff8a 40%, transparent 70%);
  box-shadow: 0 0 16px #7dff8a, 0 0 32px #ffd76a;
  z-index: 60;
  animation: burstFly .55s cubic-bezier(.1,.8,.2,1) forwards;
}
@keyframes burstFly {
  0%   { transform: translate(0,0) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0); opacity: 0; }
}
.shockwave {
  pointer-events: none;
  position: absolute;
  border-radius: 50%;
  border: 2px solid rgba(125,255,138,.8);
  box-shadow: 0 0 30px rgba(125,255,138,.6), inset 0 0 30px rgba(232,213,163,.3);
  z-index: 55;
  animation: shock .5s ease-out forwards;
}
@keyframes shock {
  0%   { width: 20px; height: 20px; opacity: 1; }
  100% { width: 160px; height: 160px; opacity: 0; margin: -70px; }
}

/* ── 洗牌旋涡 ── */
.board.is-shuffling .tile {
  animation: swirlIn .55s cubic-bezier(.3,1,.3,1);
}
@keyframes swirlIn {
  0%   { transform: rotate(0deg) scale(1); filter: blur(0) brightness(1); }
  40%  { transform: rotate(8deg) scale(.88); filter: blur(1.5px) brightness(1.3); }
  100% { transform: rotate(0deg) scale(1); filter: blur(0) brightness(1); }
}
.board.is-shuffling::after {
  content: "";
  position: absolute; inset: 10%;
  border-radius: 50%;
  border: 2px dashed rgba(232,213,163,.55);
  animation: spin .55s linear;
  pointer-events: none;
  z-index: 40;
}
@keyframes spin {
  from { transform: rotate(0); opacity: .9; }
  to   { transform: rotate(360deg); opacity: 0; }
}

/* ── 告警 ── */
.hud.is-warn .hud-value {
  color: #ff6b8a !important;
  text-shadow: 0 0 20px rgba(255,107,138,.7);
  animation: warnPulse .7s ease infinite;
}
@keyframes warnPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}
.slot-bar.is-warn {
  border-color: rgba(255,107,138,.7) !important;
  box-shadow: 0 0 24px rgba(255,107,138,.35);
  animation: barPulse .8s ease infinite;
}
@keyframes barPulse {
  0%, 100% { box-shadow: 0 0 12px rgba(255,107,138,.2); }
  50% { box-shadow: 0 0 28px rgba(255,107,138,.55); }
}

/* 连击角标 */
.combo-pop {
  position: absolute;
  left: 50%; top: 38%;
  transform: translate(-50%, -50%);
  font-size: 28px;
  font-weight: 900;
  color: #ffd76a;
  text-shadow: 0 0 20px #7dff8a, 0 2px 0 #2a1c00;
  pointer-events: none;
  z-index: 70;
  animation: comboPop .7s cubic-bezier(.2,1.5,.3,1) forwards;
}
@keyframes comboPop {
  0%   { transform: translate(-50%, -50%) scale(.4); opacity: 0; }
  40%  { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
  100% { transform: translate(-50%, -80%) scale(1); opacity: 0; }
}
