/* =============================================
   Bebay - Eternal Baccarat Casino Game
   Casino-style Dark Theme CSS
   ============================================= */

:root {
    --bebay-bg-primary: #0a0e1a;
    --bebay-bg-secondary: #111827;
    --bebay-bg-card: #1a2332;
    --bebay-bg-surface: #1f2937;
    --bebay-gold: #ff1493;
    --bebay-gold-light: #ff69b4;
    --bebay-gold-dim: #c01070;
    --co-gold: #f0c040;
    --bebay-red: #dc2626;
    --bebay-green: #22c55e;
    --bebay-blue: #3b82f6;
    --bebay-purple: #8b5cf6;
    --bebay-text: #e5e7eb;
    --bebay-text-dim: #9ca3af;
    --bebay-border: #374151;
    --bebay-player-color: #3b82f6;
    --bebay-banker-color: #dc2626;
    --bebay-tie-color: #22c55e;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Hide number input spinner buttons */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type="number"] {
    -moz-appearance: textfield;
}

body.bebay-body {
    background: var(--bebay-bg-primary);
    color: var(--bebay-text);
    font-family: "Montserrat", sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ---- Auth Section ---- */
.bebay-auth-section {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.bebay-auth-container {
    background: var(--bebay-bg-secondary);
    border: 1px solid var(--bebay-border);
    border-radius: 0;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.bebay-auth-title {
    text-align: center;
    margin-bottom: 8px;
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--bebay-gold), var(--bebay-gold-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.bebay-auth-subtitle {
    text-align: center;
    color: var(--bebay-text-dim);
    margin-bottom: 30px;
    font-size: 0.9rem;
}

.bebay-auth-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 24px;
    border-radius: 0;
    overflow: hidden;
    border: 1px solid var(--bebay-border);
}

.bebay-auth-tab {
    flex: 1;
    padding: 12px;
    text-align: center;
    cursor: pointer;
    background: var(--bebay-bg-surface);
    color: var(--bebay-text-dim);
    border: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s;
}

.bebay-auth-tab.active {
    background: var(--bebay-gold);
    color: #000;
}

.bebay-auth-form {
    display: none;
    flex-direction: column;
    gap: 16px;
}

.bebay-auth-form.active {
    display: flex;
}

.bebay-auth-form input {
    padding: 14px 16px;
    border-radius: 0;
    border: 1px solid var(--bebay-border);
    background: var(--bebay-bg-primary);
    color: var(--bebay-text);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

.bebay-auth-form input:focus {
    border-color: var(--bebay-gold);
}

.bebay-auth-form input::placeholder {
    color: var(--bebay-text-dim);
}

.bebay-btn-primary {
    padding: 14px;
    border-radius: 0;
    border: none;
    clip-path: polygon(8% 0, 100% 0, 92% 100%, 0% 100%);
    background: linear-gradient(135deg, var(--bebay-gold), #c01070);
    color: #000;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s, clip-path 0.3s ease;
}

.bebay-btn-primary:hover {
    opacity: 0.9;
}

.bebay-btn-primary:active {
    transform: scale(0.98);
}

.bebay-auth-error {
    color: var(--bebay-red);
    font-size: 0.85rem;
    text-align: center;
    min-height: 20px;
}

/* ---- Main Game Layout ---- */
.bebay-game-section {
    display: none;
    min-height: 100vh;
}

.bebay-game-section.active {
    display: block;
}
.bebay-lobby { max-width: 1500px; margin: 0 auto; padding: 20px; }
/* Header / Dashboard */
.bebay-header {
    text-align: center; margin: 30px 0 24px;
}
.bebay-header h1{
    font-size: 2.2rem; font-weight: 800;
    font-family: "Orbitron", sans-serif;
    background: linear-gradient(135deg, var(--bebay-blue), var(--bebay-red));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
}

.bebay-header p { color: var(--bebay-text-dim); margin-top: 6px; font-size: 0.9rem; }

.bebay-logo {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--bebay-gold), var(--bebay-gold-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.bebay-user-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.bebay-username {
    font-weight: 500;
}

.bebay-points {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bebay-bg-card);
    padding: 8px 16px;
    clip-path: polygon(8% 0, 100% 0, 92% 100%, 0% 100%);
    border: 1px solid var(--bebay-border);
}

.bebay-points-icon {
    font-size: 1.1rem;
}

.bebay-points-value {
    font-weight: 600;
    color: var(--bebay-gold);
}

.bebay-btn-logout {
    padding: 8px 16px;
    border-radius: 0;
    border: 1px solid var(--bebay-border);
    clip-path: polygon(8% 0, 100% 0, 92% 100%, 0% 100%);
    background: transparent;
    color: var(--bebay-text-dim);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.bebay-btn-logout:hover {
    border-color: var(--bebay-red);
    color: var(--bebay-red);
}

/* ---- Game Board ---- */
.bebay-game-board {
    max-width: 100%;
    margin: 30px auto;
    padding: 0 10px;
}

/* ═══ Main 3-Column Layout ═══ */
.bebay-main-layout {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.bebay-left-panel {
    width: 230px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bebay-left-panel .bebay-betting-section {
    padding: 16px;
}

.bebay-left-panel .bebay-bet-buttons {
    grid-template-columns: 1fr;
}

.bebay-left-panel .bebay-bet-amount-input {
    flex-direction: column;
}

.bebay-table-wrapper {
    flex: 1;
    min-width: 0;
}

.bebay-right-panel {
    width: 230px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Phase Banner — Stepper Bars */
.bebay-phase-banner {
    text-align: center;
    padding: 16px 20px;
    margin-bottom: 24px;
    background: var(--bebay-bg-card);
    border: 1px solid var(--bebay-border);
    position: relative;
    overflow: hidden;
}

.bebay-phase-sub-label {
    font-size: 0.85rem;
    color: var(--bebay-text-dim);
    margin-top: 10px;
}

/* Phase Stepper — 3 bars in a row */
.bebay-phase-stepper {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.bebay-phase-step {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.bebay-phase-step-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--bebay-text-dim);
    transition: color 0.3s ease;
}

/* Highlight the current phase label */
.bebay-phase-step.active .bebay-phase-step-label {
    color: var(--bebay-gold);
}

.bebay-phase-step.done .bebay-phase-step-label {
    color: var(--bebay-green);
}

/* Fill track */
.bebay-phase-step-track {
    height: 6px;
    background: var(--bebay-bg-primary);
    border: 1px solid var(--bebay-border);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.bebay-phase-step-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--bebay-gold-dim), var(--bebay-gold));
    border-radius: 2px;
}

/* Active phase fill animates smoothly */
.bebay-phase-step.active .bebay-phase-step-fill {
    background: linear-gradient(90deg, var(--bebay-gold), #ffd700);
}

/* Done phase shows full bar */
.bebay-phase-step.done .bebay-phase-step-fill {
    width: 100%;
    background: linear-gradient(90deg, var(--bebay-green), #4ade80);
}

/* Baccarat Table */
.bebay-table {
    background: radial-gradient(ellipse at center, #1a4731 0%, #0d2818 100%);
    padding: 40px 30px;
    border: 2px solid var(--bebay-gold);
    box-shadow: 0 0 40px rgba(212, 168, 67, 0.15);
    margin-bottom: 0;
    position: relative;
}

/* ═══ Table Top Bet Buttons (Player left, Banker right) ═══ */
.bebay-table-top-bets {
    display: flex;
    justify-content: space-between;
    gap: 40px;
    margin-bottom: 20px;
    position: relative;
    z-index: 2;
}

.bebay-table-top-bets .bebay-bet-btn {
    flex: 1;
    max-width: 180px;
    padding: 14px 16px;
}

.bebay-table::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 2px;
    height: 60%;
    background: linear-gradient(to bottom, transparent, var(--bebay-gold), transparent);
}

/* Bonus splash overlay layer */
.bebay-table::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0;
    background-size: cover;
    background-position: center;
    background-blend-mode: overlay;
}

/* Hand Sections */
.bebay-hands {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    position: relative;
    z-index: 1;
}

.bebay-hand-section {
    text-align: center;
}

.bebay-hand-label {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 12px;
    padding: 6px 16px;
    display: inline-block;
}

.bebay-hand-label.player {
    color: var(--bebay-player-color);
}

.bebay-hand-label.banker {
    color: var(--bebay-banker-color);
}

.bebay-cards {
    display: flex;
    justify-content: center;
    gap: 10px;
    min-height: 100px;
    padding: 10px;
}

.bebay-card {
    width: 70px;
    height: 98px;
    clip-path: polygon(8% 0, 100% 0, 92% 100%, 0% 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.3rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    position: relative;
    backface-visibility: hidden;
    transform-style: preserve-3d;
}

/* Card dealing: slide from shoe + flip */
.bebay-card.dealing {
    animation: bebay-deal-card 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes bebay-deal-card {
    0% {
        opacity: 0;
        transform: translateX(-120px) translateY(-60px) scale(0.5) rotateY(90deg);
    }
    40% {
        opacity: 1;
        transform: translateX(-30px) translateY(-15px) scale(0.85) rotateY(90deg);
    }
    100% {
        opacity: 1;
        transform: translateX(0) translateY(0) scale(1) rotateY(0deg);
    }
}

/* Card deal slide variant for banker side (from right) */
.bebay-card.dealing.banker-side {
    animation: bebay-deal-card-banker 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes bebay-deal-card-banker {
    0% {
        opacity: 0;
        transform: translateX(120px) translateY(-60px) scale(0.5) rotateY(-90deg);
    }
    40% {
        opacity: 1;
        transform: translateX(30px) translateY(-15px) scale(0.85) rotateY(-90deg);
    }
    100% {
        opacity: 1;
        transform: translateX(0) translateY(0) scale(1) rotateY(0deg);
    }
}

/* Card glow when it's the latest dealt card */
.bebay-card.just-dealt {
    box-shadow: 0 0 18px rgba(255, 215, 0, 0.5), 0 4px 12px rgba(0, 0, 0, 0.3);
    animation: bebay-card-glow 0.6s ease-out forwards;
}

@keyframes bebay-card-glow {
    0% { box-shadow: 0 0 30px rgba(255, 215, 0, 0.8), 0 4px 12px rgba(0, 0, 0, 0.3); }
    100% { box-shadow: 0 0 0px rgba(255, 215, 0, 0), 0 4px 12px rgba(0, 0, 0, 0.3); }
}

.bebay-card.red {
    background: linear-gradient(135deg, #fff5f5, #ffffff);
    color: #dc2626;
    border: 2px solid #fecaca;
}

.bebay-card.black {
    background: linear-gradient(135deg, #f8fafc, #ffffff);
    color: #1e293b;
    border: 2px solid #e2e8f0;
}

.bebay-card .card-suit {
    font-size: 1.5rem;
}

.bebay-card-empty {
    width: 70px;
    height: 98px;
    clip-path: polygon(8% 0, 100% 0, 92% 100%, 0% 100%);
    border: 2px dashed rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.15);
    font-size: 1.5rem;
}

.bebay-hand-total {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 8px;
}

.bebay-hand-total.player {
    color: var(--bebay-player-color);
}

.bebay-hand-total.banker {
    color: var(--bebay-banker-color);
}

/* Result Display — absolutely positioned overlay on the baccarat table */
.bebay-result-display {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    text-align: center;
    padding: 20px 32px;
    clip-path: polygon(4% 0, 100% 0, 96% 100%, 0% 100%);
    font-size: 1.3rem;
    font-weight: 700;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
    white-space: nowrap;
}

.bebay-result-display.show {
    opacity: 1;
    pointer-events: auto;
    cursor: pointer;
    animation: bebay-result-pop-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes bebay-result-pop-in {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.85);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.bebay-result-display.show:hover {
    filter: brightness(1.2);
    box-shadow: 0 0 16px rgba(255, 215, 0, 0.15);
}

.bebay-result-display.player-win {
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: var(--bebay-player-color);
}

.bebay-result-display.banker-win {
    background: rgba(220, 38, 38, 0.15);
    border: 1px solid rgba(220, 38, 38, 0.3);
    color: var(--bebay-banker-color);
}

.bebay-result-display.tie-win {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: var(--bebay-tie-color);
}

/* ---- Betting Interface ---- */
.bebay-betting-section {
    background: var(--bebay-bg-card);
    border-radius: 0;
    padding: 24px;
    border: 1px solid var(--bebay-border);
}

.bebay-betting-title {
    font-size: 1rem;
    color: var(--bebay-text-dim);
    margin-bottom: 16px;
    text-align: center;
}

.bebay-bet-amount-input {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.bebay-bet-amount-input input {
    flex: 1;
    padding: 12px 16px;
    border-radius: 0;
    border: 1px solid var(--bebay-border);
    background: var(--bebay-bg-primary);
    color: var(--bebay-text);
    font-size: 1rem;
    outline: none;
}

.bebay-bet-amount-input input:focus {
    border-color: var(--bebay-gold);
}

.bebay-bet-presets {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.bebay-bet-preset {
    padding: 8px 14px;
    border-radius: 0;
    clip-path: polygon(8% 0, 100% 0, 92% 100%, 0% 100%);
    border: 1px solid var(--bebay-border);
    background: var(--bebay-bg-surface);
    color: var(--bebay-text);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    transition: all 0.2s;
}

.bebay-bet-preset:hover {
    border-color: var(--bebay-gold);
    color: var(--bebay-gold);
}

.bebay-bet-preset.active {
    border-color: var(--bebay-gold);
    background: rgba(212, 175, 55, 0.15);
    color: var(--bebay-gold);
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.2);
}

.bebay-bet-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

.bebay-bet-btn {
    padding: 18px 12px;
    border-radius: 0;
    clip-path: polygon(8% 0, 100% 0, 92% 100%, 0% 100%);
    border: 2px solid transparent;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    position: relative;
}

.bebay-bet-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.bebay-bet-btn:active:not(:disabled) {
    transform: translateY(0);
}

.bebay-bet-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.bebay-bet-btn .bet-label {
    display: block;
    font-size: 1.1rem;
    margin-bottom: 4px;
}

.bebay-bet-btn .bet-payout {
    display: block;
    font-size: 0.8rem;
    opacity: 0.8;
}

/* Coin indicator — absolutely positioned inside button, right side, vertically centered */
.bebay-bet-coins {
    position: absolute;
    right: 15%;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.25s ease;
    z-index: 2;
}

.bebay-bet-coins.active {
    opacity: 1;
}

/* 3D coin stack — overlapping coin layers, holds the amount overlay */
.bebay-bet-coins .coin-stack {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.bebay-bet-coins .coin-layer {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
    margin-right: -20px;
}

/* Bottom layers get slightly smaller for depth */
.bebay-bet-coins .coin-layer:nth-child(1) { z-index: 5; width: 32px; height: 32px; }
.bebay-bet-coins .coin-layer:nth-child(2) { z-index: 4; width: 30px; height: 30px; }
.bebay-bet-coins .coin-layer:nth-child(3) { z-index: 3; width: 28px; height: 28px; }
.bebay-bet-coins .coin-layer:nth-child(4) { z-index: 2; width: 26px; height: 26px; }
.bebay-bet-coins .coin-layer:nth-child(5) { z-index: 1; width: 24px; height: 24px; }

/* Amount overlay — sits on top of the coin stack */
.bebay-bet-coins .coin-amount {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    font-family: "Montserrat", sans-serif;
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--co-gold);
    text-shadow:
        0 1px 0 #000,
        0 -1px 0 #000,
        1px 0 0 #000,
        -1px 0 0 #000,
        0 0 6px rgba(0, 0, 0, 0.8),
        0 0 12px rgba(0, 0, 0, 0.5);
    line-height: 1;
    pointer-events: none;
}

.bebay-bet-btn.player {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--bebay-player-color);
    color: var(--bebay-player-color);
}

.bebay-bet-btn.player:hover:not(:disabled) {
    background: rgba(59, 130, 246, 0.2);
}

.bebay-bet-btn.banker {
    background: rgba(220, 38, 38, 0.1);
    border-color: var(--bebay-banker-color);
    color: var(--bebay-banker-color);
}

.bebay-bet-btn.banker:hover:not(:disabled) {
    background: rgba(220, 38, 38, 0.2);
}

.bebay-bet-btn.tie {
    background: rgba(34, 197, 94, 0.1);
    border-color: var(--bebay-tie-color);
    color: var(--bebay-tie-color);
}

.bebay-bet-btn.tie:hover:not(:disabled) {
    background: rgba(34, 197, 94, 0.2);
}

.bebay-bet-status {
    text-align: center;
    margin-top: 12px;
    font-size: 0.9rem;
    color: var(--bebay-text-dim);
    min-height: 24px;
}

.bebay-bet-status.success {
    color: var(--bebay-green);
}

.bebay-bet-status.error {
    color: var(--bebay-red);
}

/* ---- Bonus Side Bets ---- */
.bebay-bonus-section {
    background: rgba(0,0,0,0.25);
    border-radius: 0;
    padding: 16px 20px;
    border: 1px solid rgba(255,255,255,0.08);
    margin-top: 24px;
    position: relative;
    z-index: 1;
}

.bebay-bonus-title {
    font-size: 0.85rem;
    color: var(--bebay-gold);
    margin-bottom: 12px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
}

.bebay-bonus-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.bebay-bonus-btn {
    padding: 14px 10px;
    border-radius: 0;
    clip-path: polygon(4% 0, 100% 0, 96% 100%, 0% 100%);
    border: 2px solid var(--bebay-border);
    background-color: var(--bebay-bg-surface);
    background-size: cover;
    background-position: center;
    background-blend-mode: overlay;
    color: var(--bebay-text-dim);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    transition: all 0.2s;
    text-align: center;
    position: relative;
}

.bebay-bonus-btn[data-bet="dragon"] {
    background-image: url('/static/images/bebay/bebay_dragon.png');
}

.bebay-bonus-btn[data-bet="panda"] {
    background-image: url('/static/images/bebay/bebay_bluepanda.png');
}

.bebay-bonus-btn[data-bet="supreme7"] {
    background-image: url('/static/images/bebay/bebay_supreme.png');
    background-position: center 25%;
}

.bebay-bonus-btn[data-bet="divine9"] {
    background-image: url('/static/images/bebay/bebay_divine9.png');
    background-position: center 25%;
}

.bebay-bonus-btn:hover:not(:disabled) {
    border-color: var(--bebay-gold);
    color: var(--bebay-gold);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.bebay-bonus-btn:active:not(:disabled) {
    transform: translateY(0);
}

.bebay-bonus-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.bebay-bonus-btn .bonus-name {
    display: block;
    font-size: 1rem;
    margin-bottom: 2px;
    color: var(--bebay-text);
}

.bebay-bonus-btn .bonus-condition {
    display: block;
    font-size: 0.65rem;
    color: var(--bebay-text-dim);
    margin-bottom: 4px;
}

.bebay-bonus-btn .bonus-payout {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--bebay-gold);
}

/* Bonus bet winner glow + explosion overlay */
.bebay-bonus-btn.bonus-won {
    border-color: var(--bebay-gold) !important;
    animation: bebay-bonus-hit 0.9s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.4);
    z-index: 5;
    position: relative;
}

.bebay-bonus-btn.bonus-won::before {
    content: '';
    position: absolute;
    inset: -6px;
    z-index: -1;
    border-radius: inherit;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.7) 0%, rgba(255, 140, 0, 0.4) 40%, transparent 70%);
    animation: bebay-bonus-ring 0.9s ease-out forwards;
    pointer-events: none;
}

@keyframes bebay-bonus-hit {
    0% { transform: scale(1); filter: brightness(1); }
    20% { transform: scale(1.12); filter: brightness(1.8); }
    40% { transform: scale(1.06); filter: brightness(1.4); }
    70% { transform: scale(1.10); filter: brightness(1.3); }
    100% { transform: scale(1); filter: brightness(1); }
}

@keyframes bebay-bonus-ring {
    0% { opacity: 0; transform: scale(0.8); }
    30% { opacity: 1; transform: scale(1.3); }
    100% { opacity: 0; transform: scale(1.8); }
}

/* Table background swap for bonus hit */
.bebay-table.bonus-bg-dragon::after {
    background-image: url('/static/images/bebay/bebay_dragon.png');
    animation: bebay-bonus-bg-fade 6s ease-out forwards;
}

.bebay-table.bonus-bg-panda::after {
    background-image: url('/static/images/bebay/bebay_bluepanda.png');
    animation: bebay-bonus-bg-fade 6s ease-out forwards;
}

.bebay-table.bonus-bg-supreme7::after {
    background-image: url('/static/images/bebay/bebay_supreme.png');
    background-position: center 25%;
    animation: bebay-bonus-bg-fade 6s ease-out forwards;
}

.bebay-table.bonus-bg-divine9::after {
    background-image: url('/static/images/bebay/bebay_divine9.png');
    background-position: center 25%;
    animation: bebay-bonus-bg-fade 6s ease-out forwards;
}

/* Bonus background splash fade in → hold → fade out */
@keyframes bebay-bonus-bg-fade {
    0% { opacity: 0; }
    8% { opacity: 1; }
    80% { opacity: 1; }
    100% { opacity: 0; }
}

/* Shoe (card dealing source) — decorative */
.bebay-shoe {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    width: 60px;
    height: 30px;
    background: linear-gradient(135deg, #2a1f0e, #3d2b14);
    border: 2px solid var(--bebay-gold);
    clip-path: polygon(10% 0, 90% 0, 100% 100%, 0% 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.55rem;
    color: var(--bebay-gold);
    letter-spacing: 0.05em;
}

/* Dealing indicator pulse on shoe */
.bebay-shoe.active {
    animation: bebay-shoe-pulse 0.4s ease-in-out;
}

@keyframes bebay-shoe-pulse {
    0%, 100% { box-shadow: 0 0 8px rgba(255, 215, 0, 0.3); }
    50% { box-shadow: 0 0 20px rgba(255, 215, 0, 0.7); }
}

/* ---- Recent History ---- */
.bebay-history-section {
    background: var(--bebay-bg-card);
    border: 1px solid var(--bebay-border);
    padding: 16px;
}

.bebay-history-title {
    font-size: 1rem;
    color: var(--bebay-text-dim);
    margin-bottom: 12px;
}

.bebay-history-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.bebay-history-dot {
    width: 32px;
    height: 32px;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.bebay-history-dot.player {
    background: rgba(59, 130, 246, 0.2);
    color: var(--bebay-player-color);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.bebay-history-dot.banker {
    background: rgba(220, 38, 38, 0.2);
    color: var(--bebay-banker-color);
    border: 1px solid rgba(220, 38, 38, 0.3);
}

.bebay-history-dot.tie {
    background: rgba(34, 197, 94, 0.2);
    color: var(--bebay-tie-color);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

/* ---- Result Popup (center screen) ---- */
.bebay-result-popup {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}

.bebay-result-popup.show {
    display: flex;
}

.bebay-result-popup-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
}

.bebay-result-popup-box {
    position: relative;
    background: var(--bebay-bg-card);
    border: 2px solid var(--bebay-gold);
    clip-path: polygon(3% 0, 100% 0, 97% 100%, 0% 100%);
    box-shadow: 0 0 60px rgba(255, 20, 147, 0.2), 0 20px 50px rgba(0, 0, 0, 0.6);
    padding: 0;
    width: 90%;
    max-width: 460px;
    animation: bebay-popup-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes bebay-popup-in {
    0% { opacity: 0; transform: scale(0.7) translateY(30px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

.bebay-result-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 22px;
    border-bottom: 1px solid var(--bebay-border);
    background: rgba(255, 20, 147, 0.08);
}

.bebay-result-popup-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--bebay-gold);
    letter-spacing: 0.04em;
}

.bebay-result-popup-close {
    background: none;
    border: none;
    color: var(--bebay-text-dim);
    font-size: 1.6rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
    transition: color 0.2s;
}

.bebay-result-popup-close:hover {
    color: var(--bebay-red);
}

.bebay-result-popup-body {
    padding: 20px 22px;
    max-height: 320px;
    overflow-y: auto;
}

.bebay-result-popup-body::-webkit-scrollbar {
    width: 4px;
}

.bebay-result-popup-body::-webkit-scrollbar-thumb {
    background: var(--bebay-border);
    border-radius: 2px;
}

/* Each row in the popup: bet_type | wager | result | net */
.bebay-result-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 10px;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.88rem;
}

.bebay-result-row:last-child {
    border-bottom: none;
}

.bebay-result-row-header {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--bebay-text-dim);
    font-weight: 600;
    padding: 8px 0;
    border-bottom: 1px solid var(--bebay-border);
}

.bebay-result-row .col-type {
    font-weight: 600;
    color: var(--bebay-text);
    text-transform: capitalize;
}

.bebay-result-row .col-wager {
    color: var(--bebay-text-dim);
    text-align: center;
}

.bebay-result-row .col-result {
    text-align: center;
    font-weight: 700;
}

.bebay-result-row .col-result.win {
    color: var(--bebay-green);
}

.bebay-result-row .col-result.lose {
    color: var(--bebay-red);
}

.bebay-result-row .col-result.refund {
    color: #f0a500;
}

.bebay-result-row .col-net {
    text-align: right;
    font-weight: 700;
}

.bebay-result-row .col-net.win {
    color: var(--bebay-green);
}

.bebay-result-row .col-net.lose {
    color: var(--bebay-red);
}

.bebay-result-row .col-net.refund {
    color: #f0a500;
}

.bebay-result-popup-footer {
    padding: 16px 22px;
    border-top: 1px solid var(--bebay-border);
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.bebay-result-total {
    display: flex;
    gap: 16px;
    font-size: 0.9rem;
    font-weight: 700;
}

.bebay-result-total .total-win {
    color: var(--bebay-green);
}

.bebay-result-total .total-lose {
    color: var(--bebay-red);
}

.bebay-result-total .total-net {
    color: var(--bebay-gold);
}

.bebay-popup-toggle-btn {
    padding: 6px 14px;
    clip-path: polygon(8% 0, 100% 0, 92% 100%, 0% 100%);
    background: var(--bebay-bg-surface);
    border: 1px solid var(--bebay-border);
    color: var(--bebay-text-dim);
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.bebay-popup-toggle-btn:hover {
    border-color: var(--bebay-gold);
    color: var(--bebay-gold);
}

/* ═══ Coin Shower ═══ */
.bebay-coin-shower {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 999;
    overflow: hidden;
}

.bebay-shower-coin {
    position: absolute;
    top: -60px;
    animation: bebay-coin-fall linear forwards;
    filter: drop-shadow(0 4px 8px rgba(240, 192, 64, 0.5));
    will-change: transform;
}

@keyframes bebay-coin-fall {
    0% {
        transform: translateY(0) rotate(0deg) scale(1);
        opacity: 1;
    }
    80% {
        opacity: 1;
    }
    100% {
        transform: translateY(110vh) rotate(720deg) scale(0.4);
        opacity: 0;
    }
}

/* Sparkle particles */
.bebay-sparkle {
    position: absolute;
    pointer-events: none;
    z-index: 1000;
    width: 8px;
    height: 8px;
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
    background: var(--co-gold);
    animation: bebay-sparkle-pop 1.2s ease-out forwards;
    will-change: transform, opacity;
}

@keyframes bebay-sparkle-pop {
    0% {
        transform: scale(0) rotate(0deg);
        opacity: 1;
    }
    50% {
        transform: scale(1.5) rotate(180deg);
        opacity: 0.8;
    }
    100% {
        transform: scale(0) rotate(360deg) translateY(-80px);
        opacity: 0;
    }
}

/* Small floating result indicator next to bet buttons */
.bebay-round-summary-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding: 6px 14px;
    clip-path: polygon(8% 0, 100% 0, 92% 100%, 0% 100%);
    background: var(--bebay-bg-surface);
    border: 1px solid var(--bebay-gold);
    color: var(--bebay-gold);
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    transition: all 0.2s;
}

.bebay-round-summary-trigger:hover {
    background: rgba(255, 20, 147, 0.1);
    box-shadow: 0 0 16px rgba(255, 20, 147, 0.25);
}

/* ---- Responsive ---- */
@media (max-width: 1100px) {
    .bebay-main-layout {
        flex-direction: column;
    }

    .bebay-left-panel,
    .bebay-right-panel {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .bebay-left-panel .bebay-betting-section {
        flex: 1;
        min-width: 200px;
    }

    .bebay-right-panel .bebay-history-section,
    .bebay-right-panel .bebay-broadcast-box {
        flex: 1;
        min-width: 200px;
    }

    .bebay-table-top-bets {
        gap: 12px;
    }

    .bebay-table-top-bets .bebay-bet-btn {
        max-width: none;
    }
}

@media (max-width: 640px) {
    .bebay-hands {
        grid-template-columns: 1fr;
    }

    .bebay-table::before {
        display: none;
    }

    .bebay-card {
        width: 56px;
        height: 80px;
        font-size: 1rem;
    }

    .bebay-card .card-suit {
        font-size: 1.2rem;
    }

    .bebay-card-empty {
        width: 56px;
        height: 80px;
    }

    .bebay-bet-buttons {
        grid-template-columns: 1fr;
    }

    .bebay-header {
        padding: 10px 16px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .bebay-user-info {
        gap: 10px;
        flex-wrap: wrap;
    }

    .bebay-game-board {
        padding: 0 8px;
    }

    .bebay-table {
        padding: 24px 16px;
        border-radius: 0 0 0 0;
    }

    .bebay-main-layout {
        flex-direction: column;
        gap: 8px;
    }

    .bebay-left-panel,
    .bebay-right-panel {
        width: 100%;
        flex-direction: column;
    }

    .bebay-table-top-bets {
        flex-direction: column;
        gap: 8px;
    }

    .bebay-table-top-bets .bebay-bet-btn {
        max-width: none;
    }
}

/* ---- Broadcast Announcement Box ---- */
.bebay-broadcast-box {
    background: var(--bebay-bg-card);
    border: 1px solid var(--bebay-border);
    overflow: hidden;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.bebay-broadcast-box.highlight {
    border-color: var(--bebay-gold);
    box-shadow: 0 0 20px rgba(255, 20, 147, 0.15);
}

.bebay-broadcast-header {
    background: rgba(255, 20, 147, 0.06);
    border-bottom: 1px solid var(--bebay-border);
    padding: 10px 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.bebay-broadcast-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--bebay-gold);
}

.bebay-broadcast-body {
    padding: 10px 14px;
    font-size: 0.8rem;
    color: var(--bebay-text);
    line-height: 1.5;
    max-height: 180px;
    overflow-y: auto;
    transition: max-height 0.3s ease;
}

.bebay-broadcast-body::-webkit-scrollbar {
    width: 4px;
}

.bebay-broadcast-body::-webkit-scrollbar-thumb {
    background: var(--bebay-border);
    border-radius: 2px;
}

.bebay-broadcast-placeholder {
    color: var(--bebay-text-dim);
    font-style: italic;
}

/* Totals mode: bet type columns */
.bebay-broadcast-totals {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.bebay-broadcast-total-item {
    text-align: center;
    padding: 8px 6px;
    background: var(--bebay-bg-primary);
    border: 1px solid var(--bebay-border);
    clip-path: polygon(6% 0, 100% 0, 94% 100%, 0% 100%);
}

.bebay-broadcast-total-item .total-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--bebay-text-dim);
    margin-bottom: 4px;
}

.bebay-broadcast-total-item .total-amount {
    display: block;
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--bebay-gold);
}

.bebay-broadcast-total-item.empty .total-amount {
    color: var(--bebay-text-dim);
    font-weight: 400;
}

.bebay-broadcast-summary {
    text-align: center;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--bebay-border);
    font-size: 0.78rem;
    color: var(--bebay-text-dim);
}

/* Winners mode */
.bebay-broadcast-winner-group {
    margin-bottom: 10px;
    padding: 8px 12px;
    background: rgba(255, 20, 147, 0.05);
    border: 1px solid rgba(255, 20, 147, 0.15);
}

.bebay-broadcast-winner-group:last-child {
    margin-bottom: 0;
}

.bebay-broadcast-winner-type {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--bebay-gold);
    margin-bottom: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bebay-broadcast-winner-type .type-total {
    font-size: 0.72rem;
    color: var(--bebay-text-dim);
    font-weight: 400;
}

.bebay-broadcast-winner-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.bebay-broadcast-winner-list li {
    padding: 3px 0;
    font-size: 0.8rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bebay-broadcast-winner-list li .user-name {
    color: var(--bebay-text);
    font-weight: 500;
}

.bebay-broadcast-winner-list li .user-win {
    color: var(--bebay-green);
    font-weight: 600;
    font-size: 0.78rem;
}

.bebay-broadcast-no-winners {
    text-align: center;
    color: var(--bebay-text-dim);
    font-style: italic;
    padding: 10px 0;
}
