/* ===== 消消乐 · 专属样式 ===== */

/* ---- 标题区 ---- */
.m3-head { margin-bottom: 24px; }
.m3-head .detail-title-row { margin-bottom: 14px; }
.m3-head .detail-badges { margin-bottom: 14px; }

/* ---- 游戏区 ---- */
.m3-game {
    background: linear-gradient(160deg, #faf5ff 0%, #f3efff 50%, #eaf3ff 100%);
    border-radius: var(--radius-lg);
    padding: 26px 26px 22px;
    margin-bottom: 36px;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

/* ---- HUD ---- */
.m3-hud {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}
.m3-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 18px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(124, 92, 255, 0.18);
    border-radius: var(--radius-sm);
    backdrop-filter: blur(6px);
    min-width: 90px;
}
.m3-stat-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--c-text-muted);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.m3-stat-value {
    font-size: 22px;
    font-weight: 800;
    color: var(--c-text);
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}
.m3-stat-combo .m3-stat-value { color: var(--c-accent-purple); }
.m3-stat-best .m3-stat-value { color: var(--c-accent-orange); }
.m3-stat-combo.bump .m3-stat-value { animation: m3-bump 0.4s ease; }
@keyframes m3-bump {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); color: var(--c-accent-pink); }
    100% { transform: scale(1); }
}
.m3-actions { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }
.m3-actions .btn { padding: 9px 18px; font-size: 13.5px; }

/* ---- 棋盘容器 ---- */
.m3-board-wrap {
    position: relative;
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}

.m3-board {
    position: relative;
    width: min(90vw, 480px);
    aspect-ratio: 1 / 1;
    background: linear-gradient(180deg, #2a2740 0%, #1f1d33 100%);
    border-radius: var(--radius-md);
    box-shadow: inset 0 2px 12px rgba(0, 0, 0, 0.3), 0 12px 32px rgba(124, 92, 255, 0.22);
    overflow: hidden;
    touch-action: manipulation;
    user-select: none;
}
.m3-board.processing { pointer-events: none; }

/* 棋盘内部网格背景 */
.m3-board::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
    background-size: 12.5% 12.5%;
    border-radius: var(--radius-md);
    pointer-events: none;
}

/* ---- 宝石 ---- */
.m3-gem {
    position: absolute;
    width: 12.5%;
    height: 12.5%;
    top: 0;
    left: 0;
    box-sizing: border-box;
    padding: 3px;
    cursor: pointer;
    transition: transform 0.28s cubic-bezier(0.34, 1.2, 0.64, 1), opacity 0.25s ease;
    will-change: transform, opacity;
    transform: translate(0, 0);
}
/* translate(col*100%, row*100%) 由 JS 设置 */

.m3-gem-inner {
    width: 100%;
    height: 100%;
    border-radius: 30%;
    position: relative;
    box-shadow:
        inset 0 -3px 6px rgba(0, 0, 0, 0.25),
        inset 0 3px 4px rgba(255, 255, 255, 0.45),
        0 2px 4px rgba(0, 0, 0, 0.2);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}
/* 高光 */
.m3-gem-inner::after {
    content: "";
    position: absolute;
    top: 14%;
    left: 18%;
    width: 30%;
    height: 22%;
    border-radius: 50%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0.1));
    pointer-events: none;
}

/* 6 色宝石渐变 */
.m3-gem.c-0 .m3-gem-inner { background: linear-gradient(135deg, #ff6b9d 0%, #c9184a 100%); }
.m3-gem.c-1 .m3-gem-inner { background: linear-gradient(135deg, #ffb347 0%, #f6731c 100%); }
.m3-gem.c-2 .m3-gem-inner { background: linear-gradient(135deg, #ffe066 0%, #f0a800 100%); }
.m3-gem.c-3 .m3-gem-inner { background: linear-gradient(135deg, #4dd4ac 0%, #0a9d6e 100%); }
.m3-gem.c-4 .m3-gem-inner { background: linear-gradient(135deg, #4dabf7 0%, #1c7ed6 100%); }
.m3-gem.c-5 .m3-gem-inner { background: linear-gradient(135deg, #b197fc 0%, #7048e8 100%); }

/* 选中态 */
.m3-gem.selected .m3-gem-inner {
    transform: scale(1.12);
    box-shadow:
        inset 0 -3px 6px rgba(0, 0, 0, 0.25),
        inset 0 3px 4px rgba(255, 255, 255, 0.55),
        0 0 0 3px #fff,
        0 0 16px rgba(255, 255, 255, 0.7);
    animation: m3-selected-pulse 1.1s ease-in-out infinite;
}
@keyframes m3-selected-pulse {
    0%, 100% { box-shadow: inset 0 -3px 6px rgba(0,0,0,0.25), inset 0 3px 4px rgba(255,255,255,0.55), 0 0 0 3px #fff, 0 0 12px rgba(255,255,255,0.5); }
    50% { box-shadow: inset 0 -3px 6px rgba(0,0,0,0.25), inset 0 3px 4px rgba(255,255,255,0.55), 0 0 0 3px #fff, 0 0 22px rgba(255,255,255,0.85); }
}

/* 提示态 */
.m3-gem.hint .m3-gem-inner {
    animation: m3-hint-pulse 0.8s ease-in-out infinite;
}
@keyframes m3-hint-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.18); box-shadow: 0 0 18px rgba(124, 92, 255, 0.8); }
}

/* 消除动画 */
.m3-gem.clearing { pointer-events: none; }
.m3-gem.clearing .m3-gem-inner {
    animation: m3-clear 0.32s ease-in forwards;
}
@keyframes m3-clear {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.35); opacity: 1; box-shadow: 0 0 22px rgba(255, 255, 255, 0.8); }
    100% { transform: scale(0); opacity: 0; }
}

/* 新生宝石出现淡入 */
.m3-gem.spawning .m3-gem-inner {
    animation: m3-spawn 0.3s ease-out;
}
@keyframes m3-spawn {
    from { transform: scale(0); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* ---- 连消闪现 ---- */
.m3-combo-flash {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    font-size: 48px;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 4px 24px rgba(124, 92, 255, 0.9), 0 0 8px rgba(255, 255, 255, 0.5);
    pointer-events: none;
    z-index: 10;
    opacity: 0;
    letter-spacing: -0.02em;
}
.m3-combo-flash.show {
    animation: m3-flash 0.9s ease-out forwards;
}
@keyframes m3-flash {
    0% { transform: translate(-50%, -50%) scale(0.3); opacity: 0; }
    30% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
    70% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    100% { transform: translate(-50%, -120%) scale(0.9); opacity: 0; }
}

/* ---- 忙碌遮罩 ---- */
.m3-busy {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(31, 29, 51, 0.25);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.m3-busy[hidden] { display: none; }
.m3-busy:not([hidden]) { opacity: 1; }
.m3-busy-dot {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.25);
    border-top-color: #fff;
    animation: m3-spin 0.8s linear infinite;
}
@keyframes m3-spin { to { transform: rotate(360deg); } }

/* ---- 底部提示 ---- */
.m3-foot {
    text-align: center;
}
.m3-tip {
    display: inline-block;
    font-size: 13px;
    color: var(--c-text-sub);
    background: rgba(255, 255, 255, 0.6);
    padding: 6px 16px;
    border-radius: 999px;
    border: 1px solid rgba(124, 92, 255, 0.15);
}
.m3-tip.flash {
    animation: m3-tip-flash 0.5s ease;
}
@keyframes m3-tip-flash {
    0%, 100% { background: rgba(255, 255, 255, 0.6); }
    50% { background: rgba(124, 92, 255, 0.25); color: var(--c-accent-purple); }
}

/* ---- 响应式 ---- */
@media (max-width: 768px) {
    .m3-game { padding: 18px 14px; }
    .m3-hud { gap: 8px; }
    .m3-stat { padding: 8px 12px; min-width: 72px; }
    .m3-stat-value { font-size: 19px; }
    .m3-actions { margin-left: 0; width: 100%; justify-content: center; }
    .m3-combo-flash { font-size: 36px; }
}
@media (max-width: 480px) {
    .m3-stat-label { font-size: 10px; }
    .m3-stat-value { font-size: 17px; }
    .m3-gem { padding: 2px; }
}
