/* 骰子容器：设置 3D 透视 */
.dice-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2.5rem;
    margin: 2rem 0;
    min-height: 140px;
    align-items: center;
    perspective: 1400px;
    padding: 0 1rem;
}
/* 单个骰子场景：包裹 3D 骰子，处理滚动 */
.die-scene {
    width: 96px;
    height: 96px;
    perspective: 900px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}
/* 骰子本体：真正的 3D 立方体 */
.die {
    width: 96px;
    height: 96px;
    position: relative;
    transform-style: preserve-3d;
    transform: translateZ(-48px) rotateX(-15deg) rotateY(-20deg);
    transition: transform 0.9s cubic-bezier(0.25, 0.8, 0.3, 1);
}
/* 骰子的六个面 */
.die-face {
    position: absolute;
    width: 96px;
    height: 96px;
    background: linear-gradient(150deg, #ffffff 0%, #f8f8f8 40%, #eaeaea 100%);
    border-radius: 14px;
    box-shadow:
        inset 0 0 0 2px rgba(255,255,255,0.9),
        inset 0 0 24px rgba(0,0,0,0.06),
        inset 0 -4px 8px rgba(0,0,0,0.05);
    border: 1px solid #cccccc;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    padding: 10px;
    gap: 3px;
    backface-visibility: hidden;
    box-sizing: border-box;
}
/* 六个面的定位（边长96px，半边长48px） */
.die-face.front  { transform: rotateY(  0deg) translateZ(48px); }
.die-face.back   { transform: rotateY(180deg) translateZ(48px); }
.die-face.right  { transform: rotateY( 90deg) translateZ(48px); }
.die-face.left   { transform: rotateY(-90deg) translateZ(48px); }
.die-face.top    { transform: rotateX( 90deg) translateZ(48px); }
.die-face.bottom { transform: rotateX(-90deg) translateZ(48px); }
/* 骰子点数圆点 */
.pip {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #4a4a4a, #1a1a1a 80%);
    box-shadow:
        inset 0 -2px 3px rgba(0,0,0,0.5),
        inset 0 2px 3px rgba(255,255,255,0.2),
        0 1px 1px rgba(255,255,255,0.6);
    opacity: 0;
    transition: opacity 0.2s ease;
    align-self: center;
    justify-self: center;
    width: 70%;
    height: 70%;
}
.pip.active {
    opacity: 1;
}
/* 骰子滚动动画：持续旋转 */
.die.rolling {
    animation: rollAnimation 0.5s linear infinite;
}
@keyframes rollAnimation {
    0%   { transform: translateZ(-48px) rotateX(  0deg) rotateY(  0deg) rotateZ(  0deg); }
    25%  { transform: translateZ(-48px) rotateX(180deg) rotateY( 90deg) rotateZ( 45deg); }
    50%  { transform: translateZ(-48px) rotateX(360deg) rotateY(180deg) rotateZ( 90deg); }
    75%  { transform: translateZ(-48px) rotateX(540deg) rotateY(270deg) rotateZ(135deg); }
    100% { transform: translateZ(-48px) rotateX(720deg) rotateY(360deg) rotateZ(180deg); }
}
/* 骰子落定后的弹跳效果 */
.die-scene.settled {
    animation: settleAnimation 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes settleAnimation {
    0%   { transform: scale(1.15) translateY(-12px); }
    50%  { transform: scale(0.94) translateY(3px); }
    75%  { transform: scale(1.03) translateY(-2px); }
    100% { transform: scale(1) translateY(0); }
}
/* 骰子底部阴影 */
.die-scene::after {
    content: '';
    position: absolute;
    bottom: -22px;
    left: 50%;
    transform: translateX(-50%);
    width: 76px;
    height: 14px;
    background: radial-gradient(ellipse at center, rgba(0,0,0,0.28) 0%, rgba(0,0,0,0) 72%);
    border-radius: 50%;
    transition: all 0.4s ease;
    pointer-events: none;
    z-index: -1;
}
.die-scene.rolling::after {
    width: 50px;
    opacity: 0.4;
    bottom: -12px;
}
/* 结果总文字 */
.result-total {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: 1px;
    min-height: 2.6rem;
    color: #0d6efd;
}
.result-total .total-highlight {
    color: #198754;
    font-size: 2rem;
}
/* 骰子数量选择器 */
.dice-count-selector {
    display: flex;
    justify-content: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}
.dice-count-btn {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.25rem;
    border: 2px solid #dee2e6;
    background: #fff;
    color: #495057;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}
.dice-count-btn:hover {
    border-color: #0d6efd;
    color: #0d6efd;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(13,110,253,0.15);
}
.dice-count-btn.active {
    background: #0d6efd;
    border-color: #0d6efd;
    color: #fff;
    box-shadow: 0 6px 14px rgba(13,110,253,0.35);
    transform: translateY(-2px);
}
/* 当前骰子数量提示 */
.dice-count-hint {
    text-align: center;
    font-size: 0.9rem;
    color: #6c757d;
    margin-top: 0.5rem;
}
.dice-count-hint strong {
    color: #0d6efd;
    font-size: 1.05rem;
}
/* 统计卡片 */
.stat-card {
    background: #f8f9fa;
    border-radius: 0.75rem;
    padding: 0.75rem 0.5rem;
    text-align: center;
    border: 1px solid #e9ecef;
    transition: all 0.2s ease;
}
.stat-card:hover {
    border-color: #0d6efd;
    box-shadow: 0 4px 10px rgba(13,110,253,0.08);
}
.stat-number {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.2;
    color: #0d6efd;
}
.stat-label {
    font-size: 0.75rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
/* 历史记录项 */
.history-item {
    transition: background-color 0.15s ease;
    border-left: 3px solid transparent;
}
.history-item:hover {
    background-color: #f1f3f5;
    border-left-color: #0d6efd;
}
.history-total-badge {
    font-weight: 700;
    color: #198754;
    background: #e8f5e9;
    padding: 0.15rem 0.6rem;
    border-radius: 0.375rem;
    font-size: 0.9rem;
}
.history-dice-badge {
    display: inline-block;
    background: #e9ecef;
    color: #495057;
    padding: 0.1rem 0.45rem;
    border-radius: 0.25rem;
    font-size: 0.8rem;
    font-weight: 600;
    margin-right: 0.2rem;
    font-family: 'Courier New', monospace;
}
/* 功能描述卡片 */
.feature-desc {
    background: #f8f9fa;
    border-left: 4px solid #0d6efd;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    color: #495057;
    margin-top: 2rem;
}
.feature-desc i {
    color: #0d6efd;
}
.btn-roll {
    padding: 0.65rem 2.5rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    font-size: 1.1rem;
    transition: all 0.2s ease;
}
.btn-roll:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(13,110,253,0.35);
}
.tip-text {
    font-size: 0.8rem;
    color: #6c757d;
    margin-top: 0.25rem;
}
.result-breakdown {
    font-size: 0.95rem;
    color: #6c757d;
    min-height: 1.5rem;
}
/* 响应式：小屏幕上骰子变小 */
@media (max-width: 576px) {
    .die-scene, .die, .die-face { width: 72px; height: 72px; }
    .die { transform: translateZ(-36px) rotateX(-15deg) rotateY(-20deg); }
    .die-face.front  { transform: rotateY(  0deg) translateZ(36px); }
    .die-face.back   { transform: rotateY(180deg) translateZ(36px); }
    .die-face.right  { transform: rotateY( 90deg) translateZ(36px); }
    .die-face.left   { transform: rotateY(-90deg) translateZ(36px); }
    .die-face.top    { transform: rotateX( 90deg) translateZ(36px); }
    .die-face.bottom { transform: rotateX(-90deg) translateZ(36px); }
    .die-face { padding: 7px; gap: 2px; border-radius: 10px; }
    .dice-container { gap: 1.4rem; }
    .die-scene::after { width: 56px; bottom: -18px; height: 10px; }
    .dice-count-btn { width: 48px; height: 48px; font-size: 1.1rem; }
}
