/* ==========================================================================
   扫雷小游戏面板
   依赖 style.css 中的主题变量（--text / --glass / --accent ...）
   ========================================================================== */

body.game-open {
  overflow: hidden;
}

/* ---------- 顶部入口按钮 ---------- */

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  min-width: 86px;
  padding: 0 24px;
  border-radius: 999px;
  border: 1px solid rgba(255, 150, 200, 0.75);
  background: linear-gradient(135deg, #ffa1cd, #ff5fa8 62%, #ff4f9d);
  color: #40071f;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.08em;
  box-shadow: 0 8px 22px rgba(255, 79, 157, 0.38);
  cursor: pointer;
  animation: nav-glow 3.2s ease-in-out infinite;
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.nav-button:hover {
  transform: translateY(-1px) scale(1.02);
  filter: brightness(1.06);
  box-shadow: 0 10px 26px rgba(255, 79, 157, 0.5);
}

.nav-button:active {
  transform: translateY(0) scale(0.99);
}

@keyframes nav-glow {
  0%, 100% { box-shadow: 0 8px 22px rgba(255, 79, 157, 0.34); }
  50% { box-shadow: 0 10px 28px rgba(255, 79, 157, 0.58); }
}

.nav-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-button .nav-mine-dot {
  fill: currentColor;
  stroke: none;
}

/* ---------- 面板外壳 ---------- */

.game-panel {
  position: fixed;
  inset: 0;
  z-index: 60;
  overflow: auto;
  overscroll-behavior: contain;
  transform: translateX(100%);
  transition: transform 0.46s cubic-bezier(0.22, 0.9, 0.24, 1);
  background-image:
    radial-gradient(circle at 10% 6%, rgba(109, 109, 246, 0.3), transparent 42%),
    radial-gradient(circle at 88% 10%, rgba(244, 114, 182, 0.2), transparent 40%),
    radial-gradient(circle at 60% 96%, rgba(56, 189, 248, 0.16), transparent 44%),
    url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='78'%20height='78'%20viewBox='0%200%2078%2078'%3E%3Cg%20fill='none'%3E%3Cpath%20d='M0%2039%2039%200%2078%2039%2039%2078Z'%20stroke='%238fe3f2'%20stroke-opacity='0.16'%20stroke-width='3'%20style='filter:blur(1.2px)'/%3E%3Cpath%20d='M0%2039%2039%200%2078%2039%2039%2078Z'%20stroke='%238fe3f2'%20stroke-opacity='0.5'%20stroke-width='1'/%3E%3C/g%3E%3Cg%20fill='%23d6f7ff'%20fill-opacity='0.9'%3E%3Ccircle%20cx='39'%20cy='0'%20r='1.5'/%3E%3Ccircle%20cx='78'%20cy='39'%20r='1.5'/%3E%3Ccircle%20cx='39'%20cy='78'%20r='1.5'/%3E%3Ccircle%20cx='0'%20cy='39'%20r='1.5'/%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(160deg, var(--bg-0) 0%, var(--bg-1) 52%, var(--bg-2) 100%);
  background-size: auto, auto, auto, 78px 78px, auto;
  background-position: center;
}

body[data-theme="light"] .game-panel {
  background-image:
    radial-gradient(circle at 10% 6%, rgba(109, 109, 246, 0.3), transparent 42%),
    radial-gradient(circle at 88% 10%, rgba(244, 114, 182, 0.2), transparent 40%),
    radial-gradient(circle at 60% 96%, rgba(56, 189, 248, 0.16), transparent 44%),
    url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='78'%20height='78'%20viewBox='0%200%2078%2078'%3E%3Cg%20fill='none'%3E%3Cpath%20d='M0%2039%2039%200%2078%2039%2039%2078Z'%20stroke='%23668fc9'%20stroke-opacity='0.14'%20stroke-width='3'%20style='filter:blur(1.2px)'/%3E%3Cpath%20d='M0%2039%2039%200%2078%2039%2039%2078Z'%20stroke='%23668fc9'%20stroke-opacity='0.3'%20stroke-width='1'/%3E%3C/g%3E%3Cg%20fill='%234f7cb8'%20fill-opacity='0.55'%3E%3Ccircle%20cx='39'%20cy='0'%20r='1.5'/%3E%3Ccircle%20cx='78'%20cy='39'%20r='1.5'/%3E%3Ccircle%20cx='39'%20cy='78'%20r='1.5'/%3E%3Ccircle%20cx='0'%20cy='39'%20r='1.5'/%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(160deg, var(--bg-0) 0%, var(--bg-1) 52%, var(--bg-2) 100%);
}

/* 上扫光束：只让"光束附近的网格线"发亮，并随距离渐隐 */
.game-beam {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(143, 226, 246, 0.08), rgba(143, 226, 246, 0.08)),
    url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='78'%20height='78'%20viewBox='0%200%2078%2078'%3E%3Cg%20fill='none'%3E%3Cpath%20d='M0%2039%2039%200%2078%2039%2039%2078Z'%20stroke='%23a9ecff'%20stroke-opacity='0.32'%20stroke-width='5'%20style='filter:blur(2px)'/%3E%3Cpath%20d='M0%2039%2039%200%2078%2039%2039%2078Z'%20stroke='%23e8fbff'%20stroke-opacity='0.95'%20stroke-width='1.5'/%3E%3C/g%3E%3Cg%20fill='%23ffffff'%20fill-opacity='0.95'%3E%3Ccircle%20cx='39'%20cy='0'%20r='2.2'/%3E%3Ccircle%20cx='78'%20cy='39'%20r='2.2'/%3E%3Ccircle%20cx='39'%20cy='78'%20r='2.2'/%3E%3Ccircle%20cx='0'%20cy='39'%20r='2.2'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 78px 78px;
  background-position: center;
  mix-blend-mode: screen;
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.88) 42%, #000 50%, rgba(0, 0, 0, 0.88) 58%, transparent 100%);
  mask-image: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.88) 42%, #000 50%, rgba(0, 0, 0, 0.88) 58%, transparent 100%);
  -webkit-mask-size: 100% 340px;
  mask-size: 100% 340px;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center calc(100% + 180px);
  mask-position: center calc(100% + 180px);
  animation: game-beam-rise 7.5s cubic-bezier(0.45, 0, 0.55, 1) infinite;
  animation-delay: 1.6s;
  will-change: mask-position;
}

body[data-theme="light"] .game-beam {
  background-image:
    linear-gradient(rgba(140, 180, 255, 0.16), rgba(140, 180, 255, 0.16)),
    url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='78'%20height='78'%20viewBox='0%200%2078%2078'%3E%3Cg%20fill='none'%3E%3Cpath%20d='M0%2039%2039%200%2078%2039%2039%2078Z'%20stroke='%234a86e8'%20stroke-opacity='0.48'%20stroke-width='6'%20style='filter:blur(2.5px)'/%3E%3Cpath%20d='M0%2039%2039%200%2078%2039%2039%2078Z'%20stroke='%232f5fb0'%20stroke-opacity='0.95'%20stroke-width='2'/%3E%3C/g%3E%3Cg%20fill='%231f4f96'%20fill-opacity='0.95'%3E%3Ccircle%20cx='39'%20cy='0'%20r='2.4'/%3E%3Ccircle%20cx='78'%20cy='39'%20r='2.4'/%3E%3Ccircle%20cx='39'%20cy='78'%20r='2.4'/%3E%3Ccircle%20cx='0'%20cy='39'%20r='2.4'/%3E%3C/g%3E%3C/svg%3E");
  mix-blend-mode: normal;
}

@keyframes game-beam-rise {
  0% {
    -webkit-mask-position: center calc(100% + 180px);
    mask-position: center calc(100% + 180px);
  }
  100% {
    -webkit-mask-position: center calc(0% - 180px);
    mask-position: center calc(0% - 180px);
  }
}

.game-panel[hidden] {
  display: none;
}

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

.game-panel.no-anim {
  transition: none;
}

.game-shell {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 24px 60px;
}

.game-topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.game-eyebrow {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.28em;
  color: var(--muted-2);
}

.game-title {
  margin: 2px 0 0;
  font-family: var(--serif);
  font-size: 26px;
  line-height: 1.2;
}

.game-topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.game-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.game-button:hover {
  transform: translateY(-1px);
  border-color: rgba(109, 109, 246, 0.6);
  background: rgba(109, 109, 246, 0.16);
}

.game-button.primary {
  border-color: rgba(109, 109, 246, 0.7);
  background: linear-gradient(135deg, rgba(109, 109, 246, 0.9), rgba(244, 114, 182, 0.82));
  color: #fff;
  font-weight: 600;
}

.game-button.primary:hover {
  background: linear-gradient(135deg, rgba(126, 126, 255, 0.95), rgba(255, 132, 196, 0.9));
}

.game-button.ghost {
  background: transparent;
}

.game-button[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.game-button[hidden] {
  display: none;
}

.game-statusline {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 22px;
  margin: 10px 4px 0;
  font-size: 12px;
  color: var(--muted-2);
}

.game-statusline .lock-hint {
  display: none;
  align-items: center;
  gap: 7px;
  padding: 2px 12px;
  border-radius: 999px;
  border: 1px solid rgba(109, 109, 246, 0.5);
  background: rgba(109, 109, 246, 0.16);
  color: var(--text);
}

.game-statusline.is-locked .lock-hint {
  display: inline-flex;
  animation: ms-pulse 1.6s ease-in-out infinite;
}

.lock-spinner {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: var(--accent);
  animation: ms-spin 0.9s linear infinite;
}

/* ---------- 主体布局 ---------- */

.game-body {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  margin-top: 16px;
}

.game-sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: 16px;
}

.game-card {
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  padding: 14px 16px;
}

.game-card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 10px;
  font-size: 13px;
  letter-spacing: 0.16em;
  color: var(--muted-2);
  text-transform: uppercase;
}

.game-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

/* ---------- 开局设置 ---------- */

.game-setup summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  list-style: none;
  font-size: 14px;
  font-weight: 600;
}

.game-setup summary::-webkit-details-marker {
  display: none;
}

.game-setup summary::after {
  content: "▾";
  font-size: 12px;
  color: var(--muted-2);
  transition: transform 0.2s ease;
}

.game-setup[open] summary::after {
  transform: rotate(180deg);
}

.setup-block {
  margin-top: 12px;
}

.setup-label {
  margin: 0 0 7px;
  font-size: 12px;
  color: var(--muted-2);
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.segmented button {
  flex: 1 1 auto;
  min-width: 62px;
  padding: 7px 10px;
  border-radius: 11px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.16s ease;
}

.segmented button:hover {
  border-color: rgba(109, 109, 246, 0.5);
  color: var(--text);
}

.segmented button.is-active {
  border-color: rgba(109, 109, 246, 0.85);
  background: rgba(109, 109, 246, 0.22);
  color: var(--text);
  font-weight: 600;
}

.setup-note {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted-2);
}

.fx-picker-group {
  margin-top: 10px;
}

.fx-picker-group h4 {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--muted-2);
  font-weight: 600;
}

.fx-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.fx-choice {
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.fx-choice:hover {
  color: var(--text);
}

.fx-choice.is-selected {
  color: var(--text);
  border-color: rgba(56, 189, 248, 0.7);
  background: rgba(56, 189, 248, 0.18);
}

.fx-choice.is-debuff.is-selected {
  border-color: rgba(251, 113, 133, 0.7);
  background: rgba(251, 113, 133, 0.18);
}

.fx-choice.is-placeholder {
  border-style: dashed;
  opacity: 0.72;
}

/* ---------- 生效效果卡 ---------- */

.fx-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.fx-empty {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted-2);
}

.fx-card {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  padding: 9px 10px;
  border-radius: 13px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.05);
  overflow: hidden;
  animation: fx-drop 0.34s cubic-bezier(0.22, 0.9, 0.24, 1) both;
}

.fx-card::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.28), transparent);
  transform: translateX(-100%);
}

.fx-card.is-buff {
  border-color: rgba(56, 189, 248, 0.42);
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.16), rgba(56, 189, 248, 0.04));
}

.fx-card.is-debuff {
  border-color: rgba(251, 113, 133, 0.42);
  background: linear-gradient(135deg, rgba(251, 113, 133, 0.16), rgba(251, 113, 133, 0.04));
}

.fx-card.is-placeholder {
  border-style: dashed;
  opacity: 0.68;
}

.fx-card.is-firing {
  animation: fx-fire 0.6s ease;
}

.fx-card.is-firing::after {
  animation: fx-sheen 0.6s ease;
}

.fx-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.22);
}

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

.fx-card.is-buff .fx-icon {
  color: #7dd3fc;
}

.fx-card.is-debuff .fx-icon {
  color: #fda4af;
}

.fx-name {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
}

.fx-desc {
  margin: 2px 0 0;
  font-size: 11px;
  line-height: 1.45;
  color: var(--muted-2);
}

.fx-count {
  min-width: 30px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: rgba(0, 0, 0, 0.2);
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}

.fx-count.is-hot {
  color: var(--text);
  animation: fx-badge 0.5s ease;
}

.fx-float {
  position: absolute;
  top: 6px;
  right: 12px;
  font-size: 12px;
  font-weight: 700;
  pointer-events: none;
  animation: fx-float 0.9s ease forwards;
}

.fx-truncate-note {
  margin: 8px 0 0;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px dashed rgba(251, 191, 36, 0.7);
  background: rgba(251, 191, 36, 0.14);
  font-size: 11.5px;
  color: var(--text);
  animation: fx-drop 0.3s ease both;
}

/* ---------- HUD ---------- */

.game-hud {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.hud-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 78px;
}

.hud-label {
  font-size: 10.5px;
  letter-spacing: 0.16em;
  color: var(--muted-2);
  text-transform: uppercase;
}

.hud-value {
  font-size: 19px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.hud-spacer {
  flex: 1 1 auto;
}

.hud-badge {
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: rgba(109, 109, 246, 0.18);
  font-size: 12px;
}

.hud-badge.is-free {
  background: rgba(148, 163, 184, 0.18);
}

.hud-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.16s ease;
}

.hud-toggle.is-active {
  border-color: rgba(251, 191, 36, 0.75);
  background: rgba(251, 191, 36, 0.2);
  color: var(--text);
  font-weight: 600;
}

.hud-toggle svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linejoin: round;
}

/* 提示按钮（每局 3 次，射一道光翻开一个安全格） */
.hud-hint {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid rgba(250, 204, 21, 0.5);
  background: rgba(250, 204, 21, 0.16);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.16s ease;
}

.hud-hint:hover:not(:disabled) {
  background: rgba(250, 204, 21, 0.28);
  transform: translateY(-1px);
}

.hud-hint:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.hud-hint svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linejoin: round;
}

.hud-hint .hint-count {
  font-variant-numeric: tabular-nums;
  color: #fbbf24;
}

body[data-theme="light"] .hud-hint {
  border-color: rgba(180, 83, 9, 0.42);
  background: rgba(253, 230, 138, 0.75);
  color: #7c2d12;
}

body[data-theme="light"] .hud-hint .hint-count {
  color: #b45309;
}

/* 提示射出的那道光（从按钮射向目标格） */
.hint-ray {
  position: fixed;
  height: 3px;
  margin-top: -1.5px;
  border-radius: 999px;
  transform-origin: 0 50%;
  background: linear-gradient(
    90deg,
    rgba(253, 224, 71, 0) 0%,
    rgba(253, 224, 71, 0.55) 45%,
    rgba(255, 251, 235, 0.95) 92%,
    rgba(255, 255, 255, 1) 100%
  );
  box-shadow: 0 0 16px rgba(250, 204, 21, 0.85);
  pointer-events: none;
  z-index: 70;
}

.hint-impact {
  position: fixed;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border-radius: 50%;
  border: 2px solid rgba(253, 224, 71, 0.9);
  box-shadow: 0 0 24px rgba(250, 204, 21, 0.8), inset 0 0 12px rgba(255, 255, 255, 0.6);
  pointer-events: none;
  z-index: 70;
  animation: hint-impact 0.68s ease-out forwards;
}

@keyframes hint-impact {
  0% { transform: scale(0.35); opacity: 1; }
  65% { transform: scale(2.4); opacity: 0.4; }
  100% { transform: scale(3.2); opacity: 0; }
}

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

.board-wrap {
  position: relative;
  display: flex;
  justify-content: center;
  padding: 10px;
}

.board-glow {
  position: absolute;
  inset: 0;
  border-radius: 22px;
  opacity: 0;
  pointer-events: none;
  background: conic-gradient(from 0deg, transparent 0deg, rgba(109, 109, 246, 0.55) 90deg, transparent 200deg, rgba(56, 189, 248, 0.45) 300deg, transparent 360deg);
  filter: blur(14px);
  transition: opacity 0.3s ease;
}

.board-wrap.is-locked .board-glow {
  opacity: 0.85;
  animation: ms-spin 3.6s linear infinite;
}

.game-board {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(16, minmax(0, 1fr));
  gap: 3px;
  width: 100%;
  max-width: 566px;
  aspect-ratio: 1 / 1;
  padding: 9px;
  border-radius: 18px;
  border: 1px solid var(--glass-border);
  background: rgba(6, 8, 20, 0.4);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  container-type: inline-size;
  touch-action: manipulation;
  grid-auto-rows: minmax(0, 1fr);
}

body[data-theme="light"] .game-board {
  background: rgba(255, 255, 255, 0.42);
  box-shadow: 0 20px 44px rgba(90, 95, 160, 0.2);
}

.ms-cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.04));
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.12s ease;
}

@supports (font-size: 1cqw) {
  .ms-cell {
    font-size: 3.3cqw;
    border-radius: 5.5cqw;
    border-radius: clamp(3px, 1.1cqw, 7px);
  }
}

body[data-theme="light"] .ms-cell {
  border-color: rgba(60, 65, 105, 0.16);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.95), rgba(226, 230, 248, 0.85));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 1px 2px rgba(60, 65, 105, 0.12);
}

.ms-cell:hover:not(.is-revealed) {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.26), rgba(255, 255, 255, 0.08));
  transform: translateY(-1px);
}

body[data-theme="light"] .ms-cell:hover:not(.is-revealed) {
  background: linear-gradient(160deg, #ffffff, #dfe4fb);
}

.ms-cell.is-pressed {
  transform: scale(0.9);
}

.ms-cell.is-revealed {
  cursor: default;
  border-color: rgba(255, 255, 255, 0.07);
  background: rgba(8, 10, 24, 0.42);
  box-shadow: none;
}

body[data-theme="light"] .ms-cell.is-revealed {
  border-color: rgba(60, 65, 105, 0.1);
  background: rgba(255, 255, 255, 0.6);
  box-shadow: none;
}

.ms-cell.is-flagged {
  background: linear-gradient(160deg, rgba(251, 191, 36, 0.28), rgba(251, 191, 36, 0.1));
  border-color: rgba(251, 191, 36, 0.6);
}

.ms-cell.is-misted {
  color: #d8b4fe;
  background: linear-gradient(160deg, rgba(168, 85, 247, 0.34), rgba(88, 28, 135, 0.28));
  border-color: rgba(192, 132, 252, 0.55);
  text-shadow: 0 0 10px rgba(216, 180, 254, 0.8);
}

body[data-theme="light"] .ms-cell.is-misted {
  color: #7e22ce;
  background: linear-gradient(160deg, rgba(233, 213, 255, 0.95), rgba(216, 180, 254, 0.7));
}

.ms-cell.is-mine {
  background: radial-gradient(circle at 40% 35%, rgba(248, 113, 113, 0.9), rgba(127, 29, 29, 0.85));
  border-color: rgba(248, 113, 113, 0.7);
}

.ms-cell.is-exploded {
  background: radial-gradient(circle at 45% 40%, #fff1f2, #ef4444 65%, #7f1d1d);
  animation: ms-blast 0.5s ease;
}

.ms-cell.is-wrong {
  background: rgba(248, 113, 113, 0.2);
  border-color: rgba(248, 113, 113, 0.6);
}

.ms-cell.is-wrong::after {
  content: "×";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fca5a5;
  font-size: 1.1em;
}

.ms-cell.is-revealing {
  animation: ms-open 0.26s ease both;
}

.ms-cell.is-flagging {
  animation: ms-flag 0.28s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.ms-cell.is-misting {
  animation: ms-mist 0.34s ease both;
}

.ms-cell.is-hinting {
  animation: ms-hint 0.5s ease both;
}

.ms-cell.is-dissolving {
  animation: ms-dissolve 0.42s ease both;
}

/* 效果触发的额外揭格（九格 / 十二格馈赠） */
.ms-cell.is-blessed {
  animation: ms-bless 0.7s ease;
}

/* 免死的赐福：护盾展开 */
.ms-cell.is-shielded {
  animation: ms-shield 0.7s ease;
}

.ms-cell svg {
  width: 62%;
  height: 62%;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ms-cell .glyph-flag {
  stroke: #fde68a;
  stroke-width: 1.9;
}

.ms-cell .glyph-mine {
  stroke: #fee2e2;
  stroke-width: 1.6;
}

.ms-cell .glyph-mist {
  stroke: none;
  fill: currentColor;
  font-weight: 700;
}

.num-1 { color: #93c5fd; }
.num-2 { color: #86efac; }
.num-3 { color: #fca5a5; }
.num-4 { color: #c4b5fd; }
.num-5 { color: #fdba74; }
.num-6 { color: #67e8f9; }
.num-7 { color: #f9a8d4; }
.num-8 { color: #e2e8f0; }

body[data-theme="light"] .num-1 { color: #1d4ed8; }
body[data-theme="light"] .num-2 { color: #15803d; }
body[data-theme="light"] .num-3 { color: #b91c1c; }
body[data-theme="light"] .num-4 { color: #6d28d9; }
body[data-theme="light"] .num-5 { color: #b45309; }
body[data-theme="light"] .num-6 { color: #0e7490; }
body[data-theme="light"] .num-7 { color: #a21caf; }
body[data-theme="light"] .num-8 { color: #334155; }

.radar-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
  overflow: visible;
}

.radar-layer .radar-path {
  fill: none;
  stroke: rgba(125, 211, 252, 0.75);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 6 8;
  animation: radar-dash 0.7s linear infinite;
}

.radar-layer .radar-dot {
  fill: #bae6fd;
  filter: drop-shadow(0 0 6px rgba(125, 211, 252, 0.95));
}

.radar-layer .radar-ring {
  fill: none;
  stroke: rgba(125, 211, 252, 0.9);
  stroke-width: 2;
}

/* ---------- 效果提示条 / 护盾圆环 ---------- */

.hud-badge[hidden] {
  display: none;
}

.hud-badge.is-immune {
  border-color: rgba(125, 211, 252, 0.6);
  background: rgba(56, 189, 248, 0.24);
  color: #bae6fd;
  font-weight: 600;
}

/* 天下劫 / 雷脉的框选 */
.select-box {
  position: absolute;
  z-index: 6;
  border: 2px solid rgba(125, 211, 252, 0.9);
  border-radius: 12px;
  background: rgba(56, 189, 248, 0.12);
  box-shadow: 0 0 22px rgba(56, 189, 248, 0.45), inset 0 0 18px rgba(56, 189, 248, 0.18);
  pointer-events: none;
  animation: box-select 0.43s ease both;
}

.select-box.is-done {
  transition: opacity 0.2s ease;
  opacity: 0;
}

/* 全雷标记后的光扫 */
.sweep-beam {
  position: absolute;
  top: -6px;
  bottom: -6px;
  width: 42px;
  z-index: 9;
  border-radius: 40px;
  background: linear-gradient(90deg, rgba(186, 230, 253, 0), rgba(224, 242, 254, 0.95), rgba(186, 230, 253, 0));
  filter: blur(2px);
  pointer-events: none;
  animation: sweep-run 0.7s cubic-bezier(0.4, 0, 0.2, 1) both;
}

/* 大数字对策Ⅱ的冲击波 */
.danger-flash {
  position: absolute;
  inset: 0;
  z-index: 8;
  border-radius: 22px;
  background: radial-gradient(circle at 50% 50%, rgba(248, 113, 113, 0.08), rgba(239, 68, 68, 0.42));
  box-shadow: inset 0 0 70px rgba(239, 68, 68, 0.6);
  pointer-events: none;
  animation: danger-flash 0.68s ease-out forwards;
}

.hud-value.is-negative {
  color: #fca5a5;
}

.shock-wave {
  position: absolute;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border-radius: 50%;
  border: 2px solid rgba(253, 224, 71, 0.85);
  box-shadow: 0 0 26px rgba(250, 204, 21, 0.7);
  pointer-events: none;
  z-index: 7;
  animation: shock-out 1s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
}

.ms-cell.is-sanding {
  animation: ms-sand 0.5s ease both;
}

/* 锁魂链：被锁住的格子不能点也不能标 */
.ms-cell.is-locked {
  cursor: not-allowed;
  color: rgba(253, 224, 71, 0.9);
  border-color: rgba(250, 204, 21, 0.42);
  background:
    repeating-linear-gradient(45deg, rgba(250, 204, 21, 0.16) 0 4px, rgba(15, 18, 36, 0.3) 4px 9px),
    linear-gradient(160deg, rgba(120, 90, 20, 0.34), rgba(22, 18, 36, 0.55));
  box-shadow: inset 0 0 10px rgba(250, 204, 21, 0.2);
}

body[data-theme="light"] .ms-cell.is-locked {
  color: #b45309;
  border-color: rgba(180, 83, 9, 0.42);
  background:
    repeating-linear-gradient(45deg, rgba(180, 83, 9, 0.16) 0 4px, rgba(255, 255, 255, 0.62) 4px 9px),
    linear-gradient(160deg, rgba(253, 230, 138, 0.9), rgba(233, 213, 255, 0.62));
  box-shadow: inset 0 0 10px rgba(180, 83, 9, 0.14);
}

.ms-cell.is-chaining {
  animation: ms-chain-lock 0.52s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.ms-cell.is-unlocking {
  animation: ms-chain-break 0.62s ease both;
}

.ms-cell.is-locked-hit {
  animation: ms-locked-hit 0.4s ease;
}

.ms-cell.is-stolen {
  animation: ms-stolen 0.55s ease both;
}

.ms-cell.is-meteor-hit {
  animation: ms-meteor-hit 0.62s ease both;
}

.ms-cell.is-hinted {
  animation: ms-hinted 0.8s ease both;
}

@keyframes ms-hinted {
  0% { box-shadow: 0 0 0 rgba(250, 204, 21, 0); }
  28% { box-shadow: 0 0 22px rgba(250, 204, 21, 0.8); filter: brightness(1.5); }
  100% { box-shadow: none; filter: brightness(1); }
}

/* 命数已到：多重流星打击 */
.meteor-streak {
  position: absolute;
  width: 3px;
  height: 78px;
  margin: -78px 0 0 -1.5px;
  border-radius: 999px;
  transform-origin: 50% 100%;
  background: linear-gradient(
    180deg,
    rgba(253, 224, 71, 0) 0%,
    rgba(253, 224, 71, 0.3) 42%,
    rgba(255, 255, 255, 0.95) 84%,
    rgba(255, 251, 235, 1) 100%
  );
  box-shadow: 0 0 18px rgba(250, 204, 21, 0.8);
  pointer-events: none;
  z-index: 7;
  animation: meteor-fall 0.62s cubic-bezier(0.35, 0, 0.6, 1) both;
}

.meteor-impact {
  position: absolute;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border-radius: 50%;
  border: 2px solid rgba(253, 224, 71, 0.9);
  box-shadow: 0 0 26px rgba(250, 204, 21, 0.85), inset 0 0 12px rgba(255, 255, 255, 0.6);
  pointer-events: none;
  z-index: 8;
  animation: meteor-impact 0.72s ease-out forwards;
}

.board-toasts {
  position: absolute;
  top: 2px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  z-index: 8;
  pointer-events: none;
}

.board-toast {
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: rgba(8, 12, 24, 0.74);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 8px 20px rgba(2, 6, 18, 0.35);
  animation: toast-float 1.7s ease forwards;
}

.board-toast.is-buff {
  color: #7dd3fc;
}

.board-toast.is-debuff {
  color: #fda4af;
}

.shield-ring {
  position: absolute;
  width: 26px;
  height: 26px;
  margin: -13px 0 0 -13px;
  border-radius: 50%;
  border: 2px solid rgba(125, 211, 252, 0.9);
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.8), inset 0 0 12px rgba(186, 230, 253, 0.55);
  pointer-events: none;
  z-index: 7;
  animation: shield-pop 0.85s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
}

/* ---------- 结算层 ---------- */

.game-board[data-size="small"] {
  max-width: 520px;
}

.game-board[data-size="large"] {
  max-width: 760px;
}

@supports (font-size: 1cqw) {
  .game-board[data-size="small"] .ms-cell {
    font-size: 4.4cqw;
  }

  .game-board[data-size="large"] .ms-cell {
    font-size: 2.5cqw;
  }
}

/* ---------- 更换雷区大小的确认弹窗 ---------- */

.game-confirm {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(4, 6, 16, 0.58);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  animation: ms-fade 0.24s ease both;
}

.game-confirm[hidden] {
  display: none;
}

.confirm-card {
  width: min(360px, 100%);
  padding: 22px;
  border-radius: 20px;
  border: 1px solid var(--glass-border);
  background: var(--glass-strong);
  box-shadow: var(--shadow);
  text-align: center;
  animation: ms-rise 0.32s cubic-bezier(0.22, 0.9, 0.24, 1) both;
}

.confirm-text {
  margin: 0 0 16px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
}

.confirm-actions {
  display: flex;
  gap: 8px;
}

.confirm-actions .game-button {
  flex: 1 1 0;
}

.game-result {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(4, 6, 16, 0.62);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  animation: ms-fade 0.32s ease both;
}

.game-result[hidden] {
  display: none;
}

.result-card {
  width: min(430px, 100%);
  padding: 24px;
  border-radius: 22px;
  border: 1px solid var(--glass-border);
  background: var(--glass-strong);
  box-shadow: var(--shadow);
  text-align: center;
  animation: ms-rise 0.4s cubic-bezier(0.22, 0.9, 0.24, 1) both;
}

.result-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 28px;
}

.result-title.is-win {
  color: #86efac;
}

.result-title.is-lose {
  color: #fca5a5;
}

.result-sub {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.result-stats {
  display: flex;
  justify-content: center;
  gap: 26px;
  margin: 18px 0;
}

.result-stat-label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--muted-2);
  text-transform: uppercase;
}

.result-stat-value {
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.result-effects {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-bottom: 16px;
}

.result-chip {
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  font-size: 11.5px;
  color: var(--muted);
}

.result-chip.is-buff {
  border-color: rgba(56, 189, 248, 0.5);
  color: #7dd3fc;
}

.result-chip.is-debuff {
  border-color: rgba(251, 113, 133, 0.5);
  color: #fda4af;
}

.score-form {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.score-form[hidden] {
  display: none;
}

.score-form input {
  flex: 1 1 auto;
  min-width: 0;
  height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
}

.score-form input:focus {
  outline: none;
  border-color: rgba(109, 109, 246, 0.75);
}

.result-actions {
  display: flex;
  gap: 8px;
}

.result-actions .game-button {
  flex: 1 1 0;
}

.result-status {
  min-height: 18px;
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--muted-2);
}

/* ---------- 粒子 ---------- */

.particle-layer {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  overflow: visible;
}

.burst-particle {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fde68a, #f472b6);
  box-shadow: 0 0 10px rgba(244, 114, 182, 0.8);
}

/* ---------- 记录榜 ---------- */

.score-tabs {
  display: flex;
  gap: 6px;
}

.score-tab {
  padding: 5px 14px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.score-tab.is-active {
  border-color: rgba(109, 109, 246, 0.8);
  background: rgba(109, 109, 246, 0.22);
  color: var(--text);
  font-weight: 600;
}

.score-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 12px;
  max-height: 340px;
  overflow: auto;
}

.score-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.04);
  font-size: 13px;
  animation: ms-fade 0.3s ease both;
}

.score-row.is-first {
  border-color: rgba(251, 191, 36, 0.55);
  background: rgba(251, 191, 36, 0.12);
}

.score-rank {
  font-weight: 700;
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
}

.score-row.is-first .score-rank {
  color: #fbbf24;
}

.score-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-time {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.score-tier {
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  font-size: 11px;
  color: var(--muted);
}

.score-tier.tier-easy {
  border-color: rgba(134, 239, 172, 0.5);
  color: #86efac;
}

.score-tier.tier-normal {
  border-color: rgba(147, 197, 253, 0.5);
  color: #93c5fd;
}

.score-tier.tier-hard {
  border-color: rgba(252, 165, 165, 0.55);
  color: #fca5a5;
}

.score-meta {
  margin: 10px 0 0;
  font-size: 11.5px;
  color: var(--muted-2);
}

.score-state {
  margin: 12px 0 0;
  font-size: 12.5px;
  color: var(--muted-2);
}

/* ---------- 动画关键帧 ---------- */

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

@keyframes ms-pulse {
  0%, 100% { opacity: 0.75; }
  50% { opacity: 1; }
}

@keyframes ms-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes ms-rise {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to { opacity: 1; transform: none; }
}

@keyframes ms-open {
  0% { transform: scale(1); filter: brightness(1); }
  45% { transform: scale(0.9); filter: brightness(1.7); background: rgba(255, 255, 255, 0.32); }
  100% { transform: scale(1); filter: brightness(1); }
}

@keyframes ms-flag {
  0% { transform: scale(0.4) rotate(-16deg); }
  60% { transform: scale(1.16) rotate(4deg); }
  100% { transform: scale(1) rotate(0); }
}

@keyframes ms-mist {
  0% { transform: rotateY(0deg); }
  50% { transform: rotateY(90deg); filter: brightness(1.4); }
  100% { transform: rotateY(0deg); }
}

@keyframes ms-hint {
  0%, 100% { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0); }
  40% { box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.45); }
}

@keyframes ms-dissolve {
  0% { transform: rotateY(90deg); filter: brightness(1.6); opacity: 0.35; }
  60% { transform: rotateY(0deg); filter: brightness(1.15); opacity: 1; }
  100% { transform: rotateY(0deg); filter: brightness(1); opacity: 1; }
}

@keyframes ms-bless {
  0% { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.7); filter: brightness(1.7); }
  100% { box-shadow: 0 0 0 14px rgba(56, 189, 248, 0); filter: brightness(1); }
}

@keyframes ms-shield {
  0% { transform: scale(0.88); box-shadow: 0 0 0 0 rgba(186, 230, 253, 0.9); }
  45% { transform: scale(1.06); box-shadow: 0 0 20px 6px rgba(56, 189, 248, 0.55); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(56, 189, 248, 0); }
}

@keyframes toast-float {
  0% { opacity: 0; transform: translateY(6px) scale(0.94); }
  16% { opacity: 1; transform: translateY(0) scale(1); }
  76% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-12px) scale(0.98); }
}

@keyframes shield-pop {
  0% { transform: scale(0.35); opacity: 0; }
  30% { opacity: 1; }
  100% { transform: scale(4.4); opacity: 0; }
}

@keyframes ms-sand {
  0% { transform: scale(1); filter: brightness(1); }
  40% { transform: scale(0.9); filter: brightness(1.35) saturate(1.4); }
  100% { transform: scale(1); filter: brightness(1); }
}

@keyframes ms-chain-lock {
  0% { transform: scale(1.1) rotate(-3deg); filter: brightness(1.5); }
  60% { transform: scale(0.95) rotate(2deg); }
  100% { transform: scale(1) rotate(0); filter: brightness(1); }
}

@keyframes ms-chain-break {
  0% { transform: scale(1); filter: brightness(1); }
  40% { transform: scale(1.14); filter: brightness(1.9) saturate(1.4); }
  100% { transform: scale(1); filter: brightness(1); }
}

@keyframes ms-locked-hit {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-2px); }
  75% { transform: translateX(2px); }
}

@keyframes ms-stolen {
  0% { transform: scale(1); opacity: 1; }
  38% { transform: scale(0.84) rotate(-9deg); opacity: 0.3; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes ms-meteor-hit {
  0% { box-shadow: 0 0 0 rgba(250, 204, 21, 0); }
  32% { box-shadow: 0 0 24px rgba(250, 204, 21, 0.75); }
  100% { box-shadow: none; }
}

@keyframes meteor-fall {
  0% { opacity: 0; transform: translate(-66px, -58px) rotate(20deg) scaleY(0.8); }
  16% { opacity: 1; }
  78% { opacity: 1; }
  100% { opacity: 0; transform: translate(0, 0) rotate(20deg) scaleY(1); }
}

@keyframes meteor-impact {
  0% { transform: scale(0.4); opacity: 1; }
  68% { transform: scale(2.7); opacity: 0.36; }
  100% { transform: scale(3.5); opacity: 0; }
}

@keyframes box-select {
  0% { transform: scale(1.06); opacity: 0; }
  30% { opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes sweep-run {
  0% { left: -8%; opacity: 0; }
  12% { opacity: 1; }
  88% { opacity: 1; }
  100% { left: 100%; opacity: 0; }
}

@keyframes shock-out {
  0% { transform: scale(0.5); opacity: 0; }
  25% { opacity: 1; }
  100% { transform: scale(14); opacity: 0; }
}

@keyframes danger-flash {
  0% { opacity: 0; }
  16% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes ms-blast {
  0% { transform: scale(0.7); filter: brightness(2.4); }
  60% { transform: scale(1.12); }
  100% { transform: scale(1); filter: brightness(1); }
}

@keyframes radar-dash {
  to { stroke-dashoffset: -28; }
}

@keyframes fx-drop {
  from { opacity: 0; transform: translateY(-10px) scale(0.96); }
  to { opacity: 1; transform: none; }
}

@keyframes fx-fire {
  0% { transform: scale(1); }
  40% { transform: scale(1.045); }
  100% { transform: scale(1); }
}

@keyframes fx-sheen {
  0% { opacity: 0; transform: translateX(-100%); }
  40% { opacity: 1; }
  100% { opacity: 0; transform: translateX(100%); }
}

@keyframes fx-badge {
  0% { transform: scale(1); }
  45% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

@keyframes fx-float {
  0% { opacity: 0; transform: translateY(6px); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-22px); }
}

@keyframes ms-shake {
  0%, 100% { transform: translate3d(0, 0, 0); }
  15% { transform: translate3d(-7px, 3px, 0); }
  30% { transform: translate3d(6px, -4px, 0); }
  45% { transform: translate3d(-5px, -3px, 0); }
  60% { transform: translate3d(4px, 3px, 0); }
  80% { transform: translate3d(-2px, -1px, 0); }
}

@keyframes ms-vignette {
  0% { opacity: 0; }
  30% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes ms-winpulse {
  0% { box-shadow: 0 0 0 0 rgba(134, 239, 172, 0); }
  45% { box-shadow: 0 0 40px 6px rgba(134, 239, 172, 0.5); }
  100% { box-shadow: 0 0 0 0 rgba(134, 239, 172, 0); }
}

.board-wrap.is-shaking {
  animation: ms-shake 0.42s ease;
}

.board-wrap.is-winning .game-board {
  animation: ms-winpulse 0.9s ease;
}

.damage-vignette {
  position: fixed;
  inset: 0;
  z-index: 65;
  pointer-events: none;
  background: radial-gradient(circle at 50% 50%, transparent 35%, rgba(239, 68, 68, 0.42) 100%);
  animation: ms-vignette 0.7s ease forwards;
}

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

@media (max-width: 960px) {
  .game-body {
    /* 必须是 minmax(0, 1fr)：写成 1fr 时轨道最小宽度取内容的 min-content，
       窄屏上会被内部元素撑到 1200px 以上，棋盘和右侧按钮直接跑到屏幕外。 */
    grid-template-columns: minmax(0, 1fr);
  }

  .game-sidebar {
    position: static;
  }

  .fx-list {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 4px;
    scroll-snap-type: x mandatory;
  }

  .fx-card {
    flex: 0 0 232px;
    scroll-snap-align: start;
  }
}

@media (max-width: 620px) {
  .game-shell {
    padding: 14px 12px 48px;
  }

  .game-topbar {
    padding: 12px 14px;
  }

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

  .game-button {
    padding: 0 12px;
    font-size: 13px;
  }

  .nav-button {
    padding: 0;
    width: 40px;
    justify-content: center;
  }

  .nav-button {
    min-width: 74px;
    padding: 0 16px;
    font-size: 14px;
  }

  .game-hud {
    padding: 10px 12px;
    gap: 8px;
  }

  .hud-item {
    min-width: 64px;
  }

  .hud-value {
    font-size: 16px;
  }

  .game-board {
    gap: 2px;
    padding: 6px;
    max-width: 100%;
    min-width: 316px;
  }

  .board-wrap {
    justify-content: flex-start;
    overflow-x: auto;
  }

  .score-row {
    grid-template-columns: 30px minmax(0, 1fr) auto;
    row-gap: 2px;
  }

  .score-tier {
    grid-column: 2 / -1;
    justify-self: start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .game-panel,
  .ms-cell,
  .fx-card,
  .board-glow,
  .board-toast,
  .shield-ring {
    transition-duration: 0.01ms !important;
  }
}
