/* ============ 全局置中設定 ============ */
.sbi-dice-game {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: default;
    user-select: text;
    font-family: 'Noto Sans TC', sans-serif;
    background-color: #F9F9F9;
    color: #333333;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.sbi-dice-game * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ============ 遊戲容器 ============ */
.sbi-dice-game .game-container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 20px 30px;
    position: relative;
}

@media (max-width: 768px) {
    .sbi-dice-game .game-container {
        padding: 15px 20px;
    }
}

@media (max-width: 480px) {
    .sbi-dice-game .game-container {
        padding: 10px 15px;
    }
}

/* ============ 標題 ============ */
.sbi-dice-game .game-title {
    font-size: 2.5rem;
    font-weight: bold;
    color: #e63946;
    text-align: center;
    margin: 15px 0;
    text-shadow: 0 0 10px rgba(255,215,0,0.4), 0 0 20px rgba(255,215,0,0.3), 0 0 30px rgba(255,215,0,0.2), 2px 2px 4px rgba(0,0,0,0.1);
    animation: sbi-titleGlow 2s ease-in-out infinite alternate;
}

@keyframes sbi-titleGlow {
    0% { text-shadow: 0 0 10px rgba(255,215,0,0.4), 0 0 20px rgba(255,215,0,0.3), 0 0 30px rgba(255,215,0,0.2), 2px 2px 4px rgba(0,0,0,0.1); }
    100% { text-shadow: 0 0 15px rgba(255,215,0,0.6), 0 0 25px rgba(255,215,0,0.5), 0 0 35px rgba(255,215,0,0.4), 2px 2px 4px rgba(0,0,0,0.1); }
}

@media (max-width: 768px) {
    .sbi-dice-game .game-title {
        font-size: 1.8rem;
        margin: 10px 0;
    }
}

/* ============ 遊戲模式選擇 ============ */
.sbi-dice-game .game-mode-selector {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin: 15px auto;
    width: 100%;
    max-width: 800px;
}

.sbi-dice-game .mode-select-btn {
    flex: 1;
    padding: 16px 20px;
    font-size: 1.4rem;
    font-weight: bold;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    -webkit-appearance: none;
    touch-action: manipulation;
    text-align: center;
    white-space: nowrap;
    color: white;
}

.sbi-dice-game .mode-select-btn.active {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.25);
    animation: sbi-modeGlow 2s infinite alternate;
}

@keyframes sbi-modeGlow {
    0% { box-shadow: 0 8px 20px rgba(0,0,0,0.25), 0 0 10px rgba(255,215,0,0.3); }
    100% { box-shadow: 0 8px 20px rgba(0,0,0,0.25), 0 0 20px rgba(255,215,0,0.6), 0 0 30px rgba(255,215,0,0.4); }
}

.sbi-dice-game #modeBig {
    background: linear-gradient(145deg, #e63946, #d62828);
}

.sbi-dice-game #modeBig.active {
    background: linear-gradient(145deg, #e63946, #c1121f);
    box-shadow: 0 8px 20px rgba(230,57,70,0.5);
    animation: sbi-modeBigGlow 2s infinite alternate;
}

@keyframes sbi-modeBigGlow {
    0% { box-shadow: 0 8px 20px rgba(230,57,70,0.5), 0 0 10px rgba(255,100,100,0.3); }
    100% { box-shadow: 0 8px 20px rgba(230,57,70,0.5), 0 0 20px rgba(255,100,100,0.6), 0 0 30px rgba(255,100,100,0.4); }
}

.sbi-dice-game #modeSmall {
    background: linear-gradient(145deg, #FF7A00, #FF5722);
}

.sbi-dice-game #modeSmall.active {
    background: linear-gradient(145deg, #FF7A00, #e56b00);
    box-shadow: 0 8px 20px rgba(255,122,0,0.5);
    animation: sbi-modeSmallGlow 2s infinite alternate;
}

@keyframes sbi-modeSmallGlow {
    0% { box-shadow: 0 8px 20px rgba(255,122,0,0.5), 0 0 10px rgba(255,180,0,0.3); }
    100% { box-shadow: 0 8px 20px rgba(255,122,0,0.5), 0 0 20px rgba(255,180,0,0.6), 0 0 30px rgba(255,180,0,0.4); }
}

.sbi-dice-game #rulesBtnMode {
    background: linear-gradient(145deg, #457b9d, #1d3557);
}

.sbi-dice-game #rulesBtnMode:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.sbi-dice-game #rulesBtnMode:hover:not(:disabled) {
    background: linear-gradient(145deg, #1d3557, #457b9d);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(69,123,157,0.5);
}

@media (max-width: 768px) {
    .sbi-dice-game .game-mode-selector {
        gap: 10px;
        margin: 12px auto;
    }
    .sbi-dice-game .mode-select-btn {
        padding: 14px 10px;
        font-size: 1.1rem;
        white-space: normal;
        word-break: break-word;
    }
}

@media (max-width: 480px) {
    .sbi-dice-game .mode-select-btn {
        padding: 12px 8px;
        font-size: 1rem;
    }
}

/* ============ 模式描述 ============ */
.sbi-dice-game .mode-description {
    text-align: center;
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 15px;
    padding: 10px 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.sbi-dice-game .mode-description span {
    font-weight: bold;
    color: #e63946;
}

@media (max-width: 768px) {
    .sbi-dice-game .mode-description {
        font-size: 1rem;
        padding: 8px 15px;
        margin-bottom: 12px;
    }
}

/* ============ 骰子區域 - 強制正方形 ============ */
.sbi-dice-game .dice-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
    margin: 20px auto;
    padding: 40px 30px;
    background: linear-gradient(145deg, #ffffff, #f0f0f0);
    border-radius: 35px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.2);
    position: relative;
    border: 15px solid #FFD700;
    max-width: 1000px;
    width: 100%;
}

.sbi-dice-game .dice-container::before {
    content: '';
    position: absolute;
    top: -20px;
    left: -20px;
    right: -20px;
    bottom: -20px;
    border: none;
    border-radius: 50px;
    pointer-events: none;
    box-shadow: 0 0 20px rgba(255,215,0,0.3);
}

.sbi-dice-game .dice {
    width: 180px;
    height: 180px;
    min-width: 180px;
    min-height: 180px;
    background: white;
    border: 10px solid #3498db;
    border-radius: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    aspect-ratio: 1 / 1;
}

.sbi-dice-game .dice.result-glow {
    animation: sbi-diceResultGlow 2s ease-in-out infinite alternate;
    border-color: #FFD700 !important;
}

@keyframes sbi-diceResultGlow {
    0% { box-shadow: inset 0 0 30px rgba(0,0,0,0.2), 0 20px 40px rgba(52,152,219,0.4), 0 0 0 10px rgba(255,255,255,0.8), 0 0 20px rgba(255,215,0,0.5); }
    100% { box-shadow: inset 0 0 30px rgba(0,0,0,0.2), 0 20px 40px rgba(52,152,219,0.4), 0 0 0 10px rgba(255,255,255,0.8), 0 0 40px rgba(255,215,0,0.8), 0 0 60px rgba(255,215,0,0.6); }
}

.sbi-dice-game .dice-slot {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.sbi-dice-game .dice-face-container {
    position: relative;
    width: 100%;
    height: 100%;
}

.sbi-dice-game .dice-face {
    width: 100%;
    height: 180px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    padding: 25px;
    gap: 8px;
    align-items: center;
    justify-items: center;
    position: absolute;
    top: 0;
    left: 0;
    background: white;
}

.sbi-dice-game .dot {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background: #333;
    box-shadow: 0 3px 6px rgba(0,0,0,0.4);
}

.sbi-dice-game .dot.red {
    background: #e63946;
    box-shadow: 0 3px 6px rgba(230,57,70,0.6);
}

.sbi-dice-game .dot.black {
    background: #333;
}

/* 骰子點數布局 */
.sbi-dice-game .face-1 .dot { grid-area: 2 / 2; }
.sbi-dice-game .face-2 .dot:nth-child(1) { grid-area: 1 / 1; }
.sbi-dice-game .face-2 .dot:nth-child(2) { grid-area: 3 / 3; }
.sbi-dice-game .face-3 .dot:nth-child(1) { grid-area: 1 / 1; }
.sbi-dice-game .face-3 .dot:nth-child(2) { grid-area: 2 / 2; }
.sbi-dice-game .face-3 .dot:nth-child(3) { grid-area: 3 / 3; }
.sbi-dice-game .face-4 .dot:nth-child(1) { grid-area: 1 / 1; }
.sbi-dice-game .face-4 .dot:nth-child(2) { grid-area: 1 / 3; }
.sbi-dice-game .face-4 .dot:nth-child(3) { grid-area: 3 / 1; }
.sbi-dice-game .face-4 .dot:nth-child(4) { grid-area: 3 / 3; }
.sbi-dice-game .face-5 .dot:nth-child(1) { grid-area: 1 / 1; }
.sbi-dice-game .face-5 .dot:nth-child(2) { grid-area: 1 / 3; }
.sbi-dice-game .face-5 .dot:nth-child(3) { grid-area: 2 / 2; }
.sbi-dice-game .face-5 .dot:nth-child(4) { grid-area: 3 / 1; }
.sbi-dice-game .face-5 .dot:nth-child(5) { grid-area: 3 / 3; }
.sbi-dice-game .face-6 .dot:nth-child(1) { grid-area: 1 / 1; }
.sbi-dice-game .face-6 .dot:nth-child(2) { grid-area: 1 / 3; }
.sbi-dice-game .face-6 .dot:nth-child(3) { grid-area: 2 / 1; }
.sbi-dice-game .face-6 .dot:nth-child(4) { grid-area: 2 / 3; }
.sbi-dice-game .face-6 .dot:nth-child(5) { grid-area: 3 / 1; }
.sbi-dice-game .face-6 .dot:nth-child(6) { grid-area: 3 / 3; }

/* 響應式調整 - 只調整大小，不改變形狀 */
@media (max-width: 992px) {
    .sbi-dice-game .dice {
        width: 120px;
        height: 120px;
        min-width: 120px;
        min-height: 120px;
        border-width: 8px;
        border-radius: 22px;
    }
    .sbi-dice-game .dice-face {
        height: 120px;
        padding: 18px;
        gap: 5px;
    }
    .sbi-dice-game .dot {
        width: 18px;
        height: 18px;
    }
}

@media (max-width: 768px) {
    .sbi-dice-game .dice-container {
        gap: 20px;
        padding: 25px 15px;
        margin: 15px auto;
        border-width: 10px;
    }
    .sbi-dice-game .dice {
        width: 100px;
        height: 100px;
        min-width: 100px;
        min-height: 100px;
        border-width: 6px;
        border-radius: 18px;
    }
    .sbi-dice-game .dice-face {
        height: 100px;
        padding: 15px;
        gap: 4px;
    }
    .sbi-dice-game .dot {
        width: 14px;
        height: 14px;
    }
}

@media (max-width: 480px) {
    .sbi-dice-game .dice-container {
        gap: 12px;
        padding: 20px 10px;
        border-width: 8px;
    }
    .sbi-dice-game .dice {
        width: 85px;
        height: 85px;
        min-width: 85px;
        min-height: 85px;
        border-width: 5px;
        border-radius: 15px;
    }
    .sbi-dice-game .dice-face {
        height: 85px;
        padding: 12px;
        gap: 3px;
    }
    .sbi-dice-game .dot {
        width: 12px;
        height: 12px;
    }
}

/* ============ 對戰區域 ============ */
.sbi-dice-game .battle-area {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 15px auto;
    padding: 15px 20px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    max-width: 800px;
    width: 100%;
}

.sbi-dice-game .player-area {
    flex: 1;
    text-align: center;
    padding: 5px;
}

.sbi-dice-game .vs-text {
    font-size: 2rem;
    font-weight: bold;
    color: #FF7A00;
    margin: 0 15px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.sbi-dice-game .player-name {
    font-size: 1.2rem;
    font-weight: bold;
    color: #e63946;
    padding: 8px 16px;
    background: #f8f9fa;
    border-radius: 10px;
    display: inline-block;
    margin-bottom: 5px;
}

.sbi-dice-game .player-score {
    font-size: 2.5rem;
    font-weight: 900;
    color: #2a9d8f;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 768px) {
    .sbi-dice-game .battle-area {
        padding: 12px 15px;
        margin: 12px auto;
    }
    .sbi-dice-game .vs-text {
        font-size: 1.5rem;
        margin: 0 10px;
    }
    .sbi-dice-game .player-name {
        font-size: 1rem;
        padding: 6px 12px;
    }
    .sbi-dice-game .player-score {
        font-size: 1.8rem;
        min-height: 40px;
    }
}

/* ============ 緊張話語區域 ============ */
.sbi-dice-game #tensionMessageArea {
    display: none;
    justify-content: center;
    align-items: center;
    margin: 10px auto;
    padding: 12px 20px;
    background: linear-gradient(145deg, #FFE5B4, #FFD700);
    border-radius: 50px;
    max-width: 600px;
    width: 100%;
    text-align: center;
    box-shadow: 0 5px 15px rgba(255,215,0,0.3);
    border: 2px solid #FF8C00;
    animation: sbi-pulseMessage 1.5s infinite alternate;
}

@keyframes sbi-pulseMessage {
    0% { transform: scale(1); box-shadow: 0 5px 15px rgba(255,215,0,0.3); }
    100% { transform: scale(1.02); box-shadow: 0 8px 25px rgba(255,215,0,0.6); }
}

.sbi-dice-game .message-text {
    font-size: 1.3rem;
    font-weight: bold;
    color: #e63946;
    text-shadow: 1px 1px 2px rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sbi-dice-game .message-text i {
    font-size: 1.6rem;
    color: #FF8C00;
}

/* ============ 海報按鈕 ============ */
.sbi-dice-game #sbi-poster-container {
    display: none;
    justify-content: center;
    align-items: center;
    margin: 15px auto;
    width: 100%;
    max-width: 600px;
}

.sbi-dice-game .sbi-poster-btn {
    background: linear-gradient(145deg, #FFD700, #FFC800);
    color: white !important;
    border: none;
    padding: 14px 35px;
    border-radius: 50px;
    font-size: 1.3rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    box-shadow: 0 8px 0 #b8860b, 0 8px 20px rgba(255,215,0,0.5);
    transition: all 0.2s ease;
    width: auto;
    min-width: 240px;
    letter-spacing: 2px;
    border-bottom: 3px solid #b8860b;
    margin: 0 auto;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
    animation: sbi-posterGoldPulse 2s ease-in-out infinite alternate;
}

@keyframes sbi-posterGoldPulse {
    0% {
        box-shadow: 0 8px 0 #b8860b, 0 8px 20px rgba(255,215,0,0.5);
        text-shadow: 0 1px 2px rgba(0,0,0,0.2);
    }
    100% {
        box-shadow: 0 8px 0 #b8860b, 0 15px 30px rgba(255,215,0,0.9), 0 0 20px rgba(255,215,0,0.6);
        text-shadow: 0 0 10px rgba(255,255,255,0.8);
    }
}

.sbi-dice-game .sbi-poster-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 13px 0 #b8860b, 0 18px 35px rgba(255,215,0,1);
}

.sbi-dice-game .sbi-poster-btn i {
    font-size: 1.4rem;
    color: white;
}

@media (max-width: 768px) {
    .sbi-dice-game #sbi-poster-container {
        margin: 12px auto;
    }
    .sbi-dice-game .sbi-poster-btn {
        padding: 12px 30px;
        font-size: 1.1rem;
        min-width: 220px;
    }
}

/* ============ 對決按鈕區域 ============ */
.sbi-dice-game .battle-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin: 15px auto;
    width: 100%;
    max-width: 900px;
}

.sbi-dice-game .player-turn-btn, 
.sbi-dice-game .game-btn {
    flex: 1;
    padding: 16px 20px;
    font-size: 1.3rem;
    font-weight: bold;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    -webkit-appearance: none;
    touch-action: manipulation;
    text-align: center;
    white-space: nowrap;
    color: white;
}

.sbi-dice-game #playerRollBtn {
    background: linear-gradient(145deg, #FF7A00, #FF5722);
}

.sbi-dice-game #computerRollBtn {
    background: linear-gradient(145deg, #e63946, #d62828);
}

.sbi-dice-game #resetBtn {
    background: linear-gradient(145deg, #9d4edd, #7b2cbf);
}

.sbi-dice-game .player-turn-btn.active {
    animation: sbi-pulseBorder 1.5s infinite;
    box-shadow: 0 0 0 4px rgba(255,215,0,0.5), 0 8px 20px rgba(0,0,0,0.2);
}

@keyframes sbi-pulseBorder {
    0% { box-shadow: 0 0 0 0 rgba(255,215,0,0.7), 0 8px 20px rgba(0,0,0,0.2); }
    70% { box-shadow: 0 0 0 15px rgba(255,215,0,0), 0 8px 20px rgba(0,0,0,0.2); }
    100% { box-shadow: 0 0 0 0 rgba(255,215,0,0), 0 8px 20px rgba(0,0,0,0.2); }
}

@media (max-width: 768px) {
    .sbi-dice-game .battle-buttons {
        gap: 12px;
        margin: 12px auto;
    }
    .sbi-dice-game .player-turn-btn, 
    .sbi-dice-game .game-btn {
        padding: 14px 12px;
        font-size: 1.1rem;
        white-space: normal;
        word-break: break-word;
    }
}

/* ============ 遊戲結果訊息 ============ */
.sbi-dice-game #gameResult {
    font-size: 1.4rem;
    font-weight: bold;
    text-align: center;
    margin: 15px auto;
    padding: 15px 20px;
    border-radius: 12px;
    background: linear-gradient(145deg, #e63946, #d62828);
    color: white;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.4;
    max-width: 700px;
    width: 100%;
    box-shadow: 0 4px 15px rgba(230,57,70,0.4);
    text-shadow: 0 0 10px rgba(255,255,255,0.5), 0 0 20px rgba(255,255,255,0.3), 2px 2px 4px rgba(0,0,0,0.3);
    border: 2px solid rgba(255,255,255,0.3);
    animation: sbi-messageGlow 2s ease-in-out infinite alternate;
}

@keyframes sbi-messageGlow {
    0% { text-shadow: 0 0 10px rgba(255,255,255,0.5), 0 0 20px rgba(255,255,255,0.3), 2px 2px 4px rgba(0,0,0,0.3); box-shadow: 0 4px 15px rgba(230,57,70,0.4); }
    100% { text-shadow: 0 0 15px rgba(255,255,255,0.7), 0 0 25px rgba(255,255,255,0.5), 2px 2px 4px rgba(0,0,0,0.3); box-shadow: 0 4px 20px rgba(230,57,70,0.6); }
}

.sbi-dice-game .win-result {
    background: linear-gradient(145deg, #2a9d8f, #21867a) !important;
}

.sbi-dice-game .lose-result {
    background: linear-gradient(145deg, #e63946, #d62828) !important;
}

.sbi-dice-game .draw-result {
    background: linear-gradient(145deg, #457b9d, #1d3557) !important;
}

@media (max-width: 768px) {
    .sbi-dice-game #gameResult {
        font-size: 1.1rem;
        padding: 12px 15px;
        min-height: 50px;
        margin: 12px auto;
    }
}

/* ============ 遊戲統計 ============ */
.sbi-dice-game .game-stats {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin: 15px auto;
    flex-wrap: wrap;
    width: 100%;
    max-width: 900px;
}

.sbi-dice-game .stat-item {
    flex: 1;
    text-align: center;
    background: white;
    padding: 12px;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
    min-width: 120px;
    border: 2px solid #FF7A00;
}

.sbi-dice-game .stat-value {
    font-size: 2.2rem;
    font-weight: bold;
    color: #FF7A00;
    min-height: 55px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sbi-dice-game .stat-label {
    font-size: 0.95rem;
    color: #666;
    margin-top: 5px;
    text-align: center;
}

@media (max-width: 768px) {
    .sbi-dice-game .game-stats {
        gap: 10px;
        margin: 12px auto;
    }
    .sbi-dice-game .stat-item {
        padding: 10px 5px;
        min-width: 0;
    }
    .sbi-dice-game .stat-value {
        font-size: 1.8rem;
        min-height: 45px;
    }
    .sbi-dice-game .stat-label {
        font-size: 0.8rem;
    }
}

/* ============ 店家資訊展示 ============ */
.sbi-dice-game .store-info-display {
    background: white;
    padding: 20px;
    border-radius: 20px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
    margin: 20px auto;
    max-width: 900px;
    width: 100%;
    border: 3px solid #FF7A00;
}

.sbi-dice-game .store-info-row {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    gap: 15px;
    width: 100%;
}

.sbi-dice-game .store-info-label-display {
    font-weight: bold;
    color: #FF7A00;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 110px;
    flex-shrink: 0;
}

.sbi-dice-game .store-info-value-display {
    flex: 1;
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 2px solid #e0e0e0;
    font-size: 16px;
    line-height: 1.5;
    word-break: break-word;
    min-height: 45px;
    display: flex;
    align-items: center;
}

@media (max-width: 768px) {
    .sbi-dice-game .store-info-display {
        padding: 15px;
        margin: 15px auto;
    }
    .sbi-dice-game .store-info-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        margin-bottom: 10px;
    }
    .sbi-dice-game .store-info-label-display {
        min-width: auto;
        width: 100%;
    }
    .sbi-dice-game .store-info-value-display {
        width: 100%;
        padding: 10px;
        min-height: 40px;
        font-size: 14px;
    }
}

/* ============ 店家設定按鈕 ============ */
.sbi-dice-game .store-setting-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin: 20px auto;
    width: 100%;
    max-width: 600px;
}

.sbi-dice-game #storeInfoBtn,
.sbi-dice-game #prizeSettingBtn {
    color: white !important;
    flex: 1;
    padding: 14px 20px;
    font-size: 1.2rem;
    border-radius: 40px;
}

.sbi-dice-game #storeInfoBtn {
    background: linear-gradient(145deg, #2a9d8f, #21867a);
}

.sbi-dice-game #prizeSettingBtn {
    background: linear-gradient(145deg, #9d4edd, #7b2cbf);
}

@media (max-width: 768px) {
    .sbi-dice-game .store-setting-container {
        gap: 15px;
        margin: 15px auto;
    }
    .sbi-dice-game #storeInfoBtn,
    .sbi-dice-game #prizeSettingBtn {
        padding: 12px 15px;
        font-size: 1rem;
    }
}

/* ============ 返回頂部按鈕 ============ */
.sbi-dice-game #backToTop {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: linear-gradient(145deg, #FF7A00, #FF5722);
    color: white;
    border: none;
    border-radius: 50%;
    box-shadow: 0 5px 15px rgba(255,122,0,0.5);
    cursor: pointer;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: all 0.3s ease;
    -webkit-appearance: none;
    touch-action: manipulation;
}

@media (max-width: 768px) {
    .sbi-dice-game #backToTop {
        display: flex;
    }
    .sbi-dice-game #backToTop.show {
        opacity: 1;
        visibility: visible;
    }
}

@media (min-width: 769px) {
    .sbi-dice-game #backToTop {
        display: none !important;
    }
}

/* ============ 彈窗基礎樣式 ============ */
.sbi-dice-game .modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    justify-content: center;
    align-items: center;
    z-index: 20000;
    padding: 15px;
    box-sizing: border-box;
    backdrop-filter: blur(5px);
}

.sbi-dice-game .modal-content {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 500px;
    width: 90%;
    background: white;
    border-radius: 32px !important;
    padding: 30px 25px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.5);
    animation: sbi-modalPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid rgba(255,255,255,0.2);
    max-height: 90vh;
    overflow-y: auto;
}

@keyframes sbi-modalPop {
    0% { opacity: 0; transform: translate(-50%, -45%); }
    100% { opacity: 1; transform: translate(-50%, -50%); }
}

/* ============ 勝利/失敗彈窗 ============ */
.sbi-dice-game .win-modal .modal-emoji,
.sbi-dice-game .lose-modal .modal-emoji,
.sbi-dice-game .draw-modal .modal-emoji {
    font-size: 80px !important;
    margin-bottom: 20px;
    text-align: center;
    line-height: 1.2;
}

.sbi-dice-game .win-modal .modal-title,
.sbi-dice-game .lose-modal .modal-title,
.sbi-dice-game .draw-modal .modal-title {
    font-size: 32px !important;
    font-weight: 900;
    text-align: center;
    margin-bottom: 20px;
    letter-spacing: 2px;
}

.sbi-dice-game .win-modal .modal-text,
.sbi-dice-game .lose-modal .modal-text,
.sbi-dice-game .draw-modal .modal-text {
    font-size: 20px;
    margin-bottom: 20px;
    line-height: 1.8;
    text-align: center;
    letter-spacing: 1px;
}

.sbi-dice-game .win-modal .modal-prize,
.sbi-dice-game .lose-modal .modal-prize,
.sbi-dice-game .draw-modal .modal-prize {
    font-size: 22px;
    font-weight: bold;
    color: #e63946;
    text-align: center;
    margin: 20px 0;
    padding: 15px;
    background: rgba(255,215,0,0.15);
    border-radius: 50px;
    border: 2px dashed #FFD700;
    letter-spacing: 1px;
}

.sbi-dice-game .modal-highlight {
    font-size: 28px;
    font-weight: 900;
    color: #e63946;
    display: inline-block;
    margin: 0 8px;
}

/* ============ 資訊彈窗標題 ============ */
.sbi-dice-game .info-modal .modal-title {
    color: #3498db !important;
    font-size: 28px !important;
    font-weight: 900;
    text-align: center;
    margin-bottom: 18px;
    letter-spacing: 1px;
}

/* 規則彈窗 */
.sbi-dice-game .rules-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 20px 0;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 8px;
}

.sbi-dice-game .rules-list::-webkit-scrollbar {
    width: 6px;
}

.sbi-dice-game .rules-list::-webkit-scrollbar-thumb {
    background: #FF7A00;
    border-radius: 10px;
}

.sbi-dice-game .rules-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 12px;
    border-left: 6px solid #FF7A00;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.sbi-dice-game .rules-icon {
    font-size: 28px;
    min-width: 48px;
    text-align: center;
}

.sbi-dice-game .rules-desc {
    font-size: 17px;
    color: #2c3e50;
    font-weight: 500;
    line-height: 1.5;
    flex: 1;
}

/* ============ 統一按鈕樣式 ============ */
.sbi-dice-game .modal-btn {
    border: none;
    border-radius: 40px !important;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.25s ease;
    -webkit-appearance: none;
    touch-action: manipulation;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px !important;
    font-size: 16px !important;
    min-width: 100px !important;
    border-bottom: 2px solid rgba(0,0,0,0.2);
    box-shadow: 0 4px 0 rgba(0,0,0,0.1);
    line-height: 1.2;
    text-decoration: none;
    letter-spacing: 0.5px;
}

.sbi-dice-game .btn-group {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
    width: 100%;
}

/* 按鈕顏色 */
.sbi-dice-game .btn-primary {
    background: linear-gradient(145deg, #3498db, #2980b9);
    color: white;
    box-shadow: 0 4px 0 #1f4e6f;
}

.sbi-dice-game .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #1f4e6f;
}

.sbi-dice-game .btn-orange {
    background: linear-gradient(145deg, #FF7A00, #FF5722);
    color: white;
    box-shadow: 0 4px 0 #b23c00;
}

.sbi-dice-game .btn-orange:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #b23c00;
}

.sbi-dice-game .btn-save {
    background: linear-gradient(145deg, #457b9d, #1d3557);
    color: white;
    box-shadow: 0 4px 0 #0f1a2b;
}

.sbi-dice-game .btn-save:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #0f1a2b;
}

.sbi-dice-game .btn-cancel {
    background: linear-gradient(145deg, #95a5a6, #7f8c8d);
    color: white;
    box-shadow: 0 4px 0 #5a6263;
}

.sbi-dice-game .btn-cancel:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #5a6263;
}

.sbi-dice-game .btn-confirm-yes {
    background: linear-gradient(145deg, #e63946, #d62828);
    color: white;
    box-shadow: 0 4px 0 #921a1a;
}

.sbi-dice-game .btn-confirm-yes:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #921a1a;
}

.sbi-dice-game .btn-confirm-no {
    background: linear-gradient(145deg, #457b9d, #1d3557);
    color: white;
    box-shadow: 0 4px 0 #0f1a2b;
}

.sbi-dice-game .btn-confirm-no:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #0f1a2b;
}

.sbi-dice-game .btn-download {
    background: linear-gradient(145deg, #FF7A00, #FF5722);
    color: white;
    box-shadow: 0 4px 0 #b23c00;
}

.sbi-dice-game .btn-download:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #b23c00;
}

.sbi-dice-game .btn-close {
    background: linear-gradient(145deg, #95a5a6, #7f8c8d);
    color: white;
    box-shadow: 0 4px 0 #5a6263;
}

.sbi-dice-game .btn-close:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #5a6263;
}

/* ============ 點數結果彈窗 ============ */
.sbi-dice-game .result-modal {
    border: 8px solid #FFD700 !important;
    box-shadow: 0 20px 40px rgba(255,215,0,0.3);
    max-width: 400px !important;
    padding: 20px 18px !important;
}

.sbi-dice-game .result-modal .modal-emoji {
    font-size: 50px;
    margin-bottom: 10px;
    animation: sbi-emojiBounce 1s infinite alternate;
}

@keyframes sbi-emojiBounce {
    0% { transform: translateY(0) scale(1); }
    100% { transform: translateY(-8px) scale(1.1); }
}

.sbi-dice-game .result-modal .modal-title {
    color: #2c3e50;
    font-size: 22px;
    font-weight: 900;
    margin-bottom: 8px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

.sbi-dice-game .result-player-name,
.sbi-dice-game .result-computer-name {
    font-size: 18px;
    font-weight: bold;
    color: #3498db;
    text-align: center;
    margin-bottom: 3px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.05);
}

.sbi-dice-game .result-computer-name {
    color: #e63946;
}

.sbi-dice-game .result-score {
    font-size: 48px !important;
    font-weight: 900;
    color: #FFD700;
    text-align: center;
    margin: 5px 0;
    text-shadow: 3px 3px 0 rgba(0,0,0,0.15);
}

.sbi-dice-game .result-dice-box {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin: 15px 0;
}

.sbi-dice-game .result-dice-item {
    width: 48px !important;
    height: 48px !important;
    background: white;
    border: 4px solid #3498db !important;
    border-radius: 14px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px !important;
    font-weight: bold;
    color: #2c3e50;
    box-shadow: 0 8px 0 rgba(52,152,219,0.3) !important;
    transform: rotate(2deg);
}

.sbi-dice-game .result-dice-item.red {
    border-color: #e63946 !important;
    color: #e63946;
    box-shadow: 0 8px 0 rgba(230,57,70,0.3) !important;
}

.sbi-dice-game .result-total {
    font-size: 18px;
    font-weight: bold;
    color: #2c3e50;
    text-align: center;
    margin: 10px 0;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 30px;
}

.sbi-dice-game .result-modal .btn-orange {
    margin-top: 15px;
}

/* ============ 勝利/平手/失敗彈窗 ============ */
.sbi-dice-game .win-modal {
    background: linear-gradient(145deg, #fff9e6, #ffefb0);
    border: 8px solid #FFD700;
}

.sbi-dice-game .draw-modal,
.sbi-dice-game .lose-modal {
    background: linear-gradient(145deg, #f5f5f5, #e8e8e8);
    border: 8px solid #95a5a6;
}

.sbi-dice-game .win-modal .modal-title {
    color: #e63946;
    font-size: 32px;
    text-shadow: 2px 2px 0 rgba(255,215,0,0.3);
}

.sbi-dice-game .draw-modal .modal-title,
.sbi-dice-game .lose-modal .modal-title {
    color: #2c3e50;
    font-size: 32px;
}

.sbi-dice-game .modal-text {
    font-size: 20px;
    margin-bottom: 20px;
    line-height: 1.8;
    letter-spacing: 1px;
}

.sbi-dice-game .modal-highlight {
    font-size: 28px;
    font-weight: 900;
    color: #e63946;
    display: inline-block;
    margin: 0 8px;
}

.sbi-dice-game .modal-prize {
    font-size: 22px;
    font-weight: bold;
    color: #e63946;
    text-align: center;
    margin: 20px 0;
    padding: 15px;
    background: rgba(255,215,0,0.15);
    border-radius: 50px;
    border: 2px dashed #FFD700;
    letter-spacing: 1px;
}

/* ============ 店家/獎項設定彈窗 ============ */
.sbi-dice-game .info-modal {
    max-width: 520px !important;
}

.sbi-dice-game .form-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 10px 0 20px 0;
}

.sbi-dice-game .form-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.sbi-dice-game .form-label {
    font-size: 16px;
    font-weight: bold;
    color: #FF7A00;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 95px;
    flex-shrink: 0;
}

.sbi-dice-game .form-input-wrapper {
    position: relative;
    flex: 1;
    width: 100%;
}

.sbi-dice-game .form-input {
    width: 100%;
    padding: 10px 70px 10px 16px;
    font-size: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 40px;
    outline: none;
    transition: all 0.3s;
    background: #f8f9fa;
}

.sbi-dice-game .form-input:focus {
    border-color: #FF7A00;
    box-shadow: 0 0 0 3px rgba(255,122,0,0.15);
    background: white;
}

.sbi-dice-game .input-char-count {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: #666;
    background: rgba(255,255,255,0.9);
    padding: 2px 8px;
    border-radius: 30px;
    pointer-events: none;
    z-index: 2;
    border: 1px solid #e0e0e0;
}

@media (max-width: 480px) {
    .sbi-dice-game .form-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    .sbi-dice-game .form-label {
        min-width: auto;
        width: 100%;
    }
    .sbi-dice-game .form-input-wrapper {
        width: 100%;
    }
}

/* ============ 確認歸零彈窗 ============ */
.sbi-dice-game .confirm-modal {
    border: 6px solid #FF7A00;
    max-width: 500px !important;
}

.sbi-dice-game .confirm-modal .modal-emoji {
    font-size: 80px !important;
    margin-bottom: 15px;
    text-align: center;
    animation: sbi-shake 1.2s infinite alternate;
}

@keyframes sbi-shake {
    from { transform: rotate(-10deg); }
    to { transform: rotate(10deg); }
}

.sbi-dice-game .confirm-modal .modal-title {
    font-size: 28px;
    color: #e63946;
    margin-bottom: 15px;
}

.sbi-dice-game .confirm-modal .modal-text {
    font-size: 20px;
    margin-bottom: 25px;
    line-height: 1.6;
}

/* ============ 成功彈窗 ============ */
.sbi-dice-game .success-modal {
    background: linear-gradient(145deg, #e8f8f5, #d1f2eb);
    border: 5px solid #2a9d8f;
}

/* ============ ★★★ 海報預覽彈窗 - 修正按鈕置中和自適應 ★★★ ============ */
.sbi-dice-game .poster-modal {
    border: 8px solid #FFD700;
    max-width: 550px;
    width: 95%;
    padding: 20px 15px;
}

.sbi-dice-game .poster-preview {
    text-align: center;
    padding: 0;
    margin: 0 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* 海報內容自適應 */
.sbi-dice-game #posterContent {
    max-width: 100% !important;
    width: auto !important;
    height: auto !important;
    margin: 0 auto !important;
    transform: scale(1);
    display: inline-block;
}

/* 確保所有海報內容不超出 */
.sbi-dice-game #posterContent * {
    max-width: 100%;
    height: auto;
}

/* 按鈕容器置中 */
.sbi-dice-game .poster-modal .btn-group {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 25px;
    width: 100%;
    padding: 0 10px;
}

/* 按鈕本身置中 */
.sbi-dice-game .poster-modal .btn-group .modal-btn {
    margin: 0;
    flex: 0 1 auto;
    min-width: 120px;
}

/* 手機版調整 */
@media (max-width: 480px) {
    .sbi-dice-game .poster-modal {
        padding: 15px 10px;
    }
    
    .sbi-dice-game .poster-modal .btn-group {
        gap: 10px;
        flex-wrap: wrap;
    }
    
    .sbi-dice-game .poster-modal .btn-group .modal-btn {
        min-width: 100px;
        padding: 10px 15px !important;
        font-size: 14px !important;
    }
}