/* ============================================================
 * 12 面骰子：快乐图第一格 / 摇骰动画 / 骰子消息气泡
 * 配合 dice.v1.js 使用
 * ============================================================ */

/* ---------- 1. 「快」→「快乐图」第一格：固定骰子 ---------- */
/* 一行 6 格：骰子 + 5 张我的图（或添加格），「快乐图」与「我的图」共用 */
.my-emoji-grid.my-emoji-grid-dice { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }

.my-emoji-item.my-dice-cell {
    background: linear-gradient(135deg, #fffdf5 0%, #ffeed0 60%, #ffd89b 100%);
    border: 1px solid #f0d9a8;
    cursor: pointer;
    transition: transform .12s ease, box-shadow .2s ease;
}
.my-emoji-item.my-dice-cell:active { transform: scale(.94); }
.my-emoji-item.my-dice-cell::after {
    content: ''; position: absolute; inset: 0; border-radius: 8px;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.6);
    pointer-events: none;
}
.my-dice-cell .my-dice-face {
    position: absolute; left: 0; right: 0; top: 0;
    height: 76%;
    display: flex; align-items: center; justify-content: center;
}
.my-dice-cell .my-dice-face .dice-svg { width: 100%; height: 100%; display: block; }
.my-dice-cell .my-dice-tag {
    position: absolute; left: 50%; bottom: 2px; transform: translateX(-50%);
    padding: 1px 6px; border-radius: 7px;
    background: rgba(255, 255, 255, .82);
    font-size: 9px; line-height: 1.25;
    color: #a5761b; font-weight: 700; letter-spacing: .5px;
    white-space: nowrap;
}

/* ---------- 2. 摇骰动画层 ---------- */
.dice-overlay {
    position: fixed; inset: 0; z-index: 10050;
    display: flex; align-items: center; justify-content: center;
    background: rgba(12, 16, 14, .46);
    -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
    opacity: 0; pointer-events: none;
    transition: opacity .18s ease;
}
.dice-overlay.show { opacity: 1; pointer-events: auto; }

.dice-stage {
    position: relative;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 14px; padding: 26px 30px;
    transform: translateY(8px) scale(.94);
    transition: transform .22s cubic-bezier(.2,.9,.3,1.2);
    perspective: 760px;
}
.dice-overlay.show .dice-stage { transform: none; }

/* 背后的暖光 */
.dice-glow {
    position: absolute; top: 50%; left: 50%; width: 210px; height: 210px;
    margin: -118px 0 0 -105px; border-radius: 50%;
    background: radial-gradient(circle, rgba(255,206,110,.55) 0%, rgba(255,206,110,.12) 55%, rgba(255,206,110,0) 72%);
    animation: diceGlowPulse 1.2s ease-in-out infinite;
    pointer-events: none;
}

.dice-box {
    position: relative; width: 138px; height: 138px;
    transform-style: preserve-3d;
    filter: drop-shadow(0 16px 22px rgba(0,0,0,.28));
    animation: diceTumble 1.15s cubic-bezier(.22,.68,.3,1) both;
}
.dice-box .dice-svg { width: 100%; height: 100%; display: block; }
.dice-box.settle { animation: diceSettle .5s cubic-bezier(.2,1.5,.4,1) both; }
/* 定格后的光圈 */
.dice-box.settle::after {
    content: ''; position: absolute; inset: -14px; border-radius: 50%;
    border: 2px solid rgba(255,196,64,.8);
    animation: diceRing .75s ease-out forwards;
    pointer-events: none;
}

.dice-tip {
    font-size: 14px; color: #fff; letter-spacing: .5px;
    text-shadow: 0 1px 3px rgba(0,0,0,.4);
    min-height: 20px;
}
.dice-tip strong { font-size: 19px; color: #ffd75e; margin: 0 2px; }

@keyframes diceTumble {
    0%   { transform: rotate3d(1, .8, .2, 0deg) scale(.72); }
    15%  { transform: rotate3d(1, .8, .2, 130deg) scale(1.06); }
    35%  { transform: rotate3d(.6, 1, -.3, 255deg) scale(.93); }
    55%  { transform: rotate3d(1, -.4, .6, 395deg) scale(1.08); }
    75%  { transform: rotate3d(.5, 1, .4, 525deg) scale(.96); }
    100% { transform: rotate3d(0, 0, 0, 720deg) scale(1); }
}
@keyframes diceSettle {
    0%   { transform: scale(1.22) rotate(-6deg); }
    55%  { transform: scale(.94) rotate(2deg); }
    100% { transform: scale(1) rotate(0deg); }
}
@keyframes diceRing {
    0%   { transform: scale(.7); opacity: .95; }
    100% { transform: scale(1.5); opacity: 0; }
}
@keyframes diceGlowPulse {
    0%, 100% { opacity: .75; transform: scale(.95); }
    50%      { opacity: 1; transform: scale(1.06); }
}

/* ---------- 3. 聊天里的骰子气泡 ---------- */
.msg-dice {
    width: 134px; padding: 9px 9px 6px;
    display: flex; flex-direction: column; align-items: center; gap: 1px;
    background: #fffdf7;
    border: 1px solid #f1e2c4;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(180, 140, 60, .12);
    cursor: default;
    animation: diceBubbleIn .32s cubic-bezier(.2,.9,.3,1.1) both;
}
.msg-dice .dice-svg { width: 100px; height: 100px; display: block; }
.msg-dice-label { font-size: 11px; color: #a07a2c; line-height: 1.4; }
.msg-item.self .msg-dice { background: #fffdf7; }

@keyframes diceBubbleIn {
    from { transform: scale(.82); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

@media (max-width: 360px) {
    .my-emoji-grid.my-emoji-grid-dice { gap: 5px; }
    .my-dice-cell .my-dice-tag { font-size: 8px; }
    .dice-box { width: 120px; height: 120px; }
    .msg-dice .dice-svg { width: 84px; height: 84px; }
}
