/* Fun AB — absolute overlay over 1024×768 bg.png reference */

.funab-wrapper {
    position: relative;
    width: 1024px;
    height: 768px;
    background: url('../../../templates/basic/images/funab/bg.png') 0 0 / 1024px 768px no-repeat;
    overflow: hidden;
    font-family: Georgia, 'Times New Roman', serif;
    user-select: none;
    margin: 0 auto;
    flex: none;
    transform: scaleX(var(--funab-scale-x, 1)) scaleY(var(--funab-scale-y, 1));
    transform-origin: center center;
}

/* ── Score / Winner value overlays (right-aligned inside baked gold bars) ── */
.funab-score-panel {
    position: absolute;
    left: 76px; top: 50px;
    width: 128px;
    text-align: right;
    padding-right: 6px;
}
.funab-winner-panel {
    position: absolute;
    left: 814px; top: 50px;
    width: 128px;
    text-align: right;
    padding-right: 6px;
}
.funab-panel-label { display: none; }
.funab-panel-value {
    color: #d5b449;
    font-size: 15px;
    font-weight: bold;
    font-style: italic;
    text-shadow: 0 1px 4px rgba(0,0,0,0.9);
}

/* ── FunAB logo: globe sits behind, overlapping "Fun" and "AB" ── */
.funab-logo {
    position: absolute;
    left: 50%; top: 12px;
    transform: translateX(-50%);
    width: 166px; height: 76px;
    pointer-events: none;
    z-index: 2;
}
.funab-logo img {
    position: absolute;
    width: auto;
    filter: drop-shadow(0 2px 5px rgba(0,0,0,0.85));
}
/* positioned by visible ink, not image bounds (all three PNGs have padding) */
.funab-logo .logo-globe { left: 55px; top:  2px; height: 78px; z-index: 1; }
.funab-logo .logo-fun   { left: -3px; top: 19px; height: 56px; z-index: 2; }
.funab-logo .logo-ab    { left: 88px; top:  6px; height: 59px; z-index: 2; }

/* ── Card strip: 13 cards edge-to-edge in blank blue zone ── */
.funab-card-strip {
    position: absolute;
    top: 122px; left: 45px;
    width: 935px; height: 96px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    pointer-events: none;
    z-index: 3;
}
.strip-card {
    height: 88px;
    flex-shrink: 0;
    width: auto;
    border-radius: 3px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.7);
}

/* Transparent click zone over baked X at top-right of bg */
.funab-close-btn {
    position: absolute;
    right: 6px; top: 6px;
    width: 32px; height: 32px;
    background: transparent; border: none;
    cursor: pointer;
}

/* ── Bet row: transparent click zones over baked bg panels ── */
.funab-bet-row {
    position: absolute;
    top: 256px; left: 11px;
    width: 1006px; height: 84px;
    display: flex;
    align-items: stretch;
    background: none; border: none; padding: 0; gap: 0;
}

.funab-suit-panel {
    width: 362px;
    display: flex;
    background: none; border: none; padding: 0; gap: 0;
}
.funab-color-panel {
    width: 268px;
    margin-left: 7px;
    display: flex;
    background: none; border: none; padding: 0; gap: 0;
}
.funab-range-panel {
    flex: 1;
    margin-left: 3px;
    display: flex;
    background: none; border: none; padding: 0; gap: 0;
}

.funab-suit-btn,
.funab-color-btn,
.funab-range-btn {
    flex: 1;
    cursor: pointer;
    background: transparent;
    border: none;
    transition: background 0.12s;
}
.funab-suit-btn img,
.funab-color-btn img,
.funab-range-btn img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0.85;
    pointer-events: none;
}

.funab-suit-btn.selected,
.funab-color-btn.selected,
.funab-range-btn.selected {
    background: rgba(255, 210, 40, 0.22);
    border-radius: 8px;
    box-shadow: inset 0 0 12px rgba(255, 210, 40, 0.45), 0 0 0 2px rgba(255, 200, 30, 0.7);
}
.funab-suit-btn.selected img,
.funab-color-btn.selected img,
.funab-range-btn.selected img {
    opacity: 1;
    filter: drop-shadow(0 0 4px rgba(255, 220, 60, 0.8));
}

/* ── Card slots: aligned to baked gold-bracket frames ── */
.funab-side-area.left {
    position: absolute;
    left: 179px; top: 366px;
    width: 108px;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.funab-side-area.right {
    position: absolute;
    left: 737px; top: 366px;
    width: 108px;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.funab-center-area {
    position: absolute;
    left: 461px; top: 366px;
    width: 101px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.funab-deal-box {
    width: 108px;
    height: 153px;
    background: none; border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3px;
    overflow: hidden;
}
.funab-dealt-cards {
    display: flex;
    width: 100%; height: 100%;
    align-items: center;
    justify-content: center;
    position: relative;
}
.dealt-card {
    position: absolute;
    width: 84px;
    border-radius: 3px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.6);
    animation: dealIn 0.25s ease-out forwards;
}
.dealt-card:nth-child(1) { transform: translateX(-8px) rotate(-4deg); z-index: 1; }
.dealt-card:nth-child(2) { transform: translateX(0px) rotate(0deg);   z-index: 2; }
.dealt-card:nth-child(3) { transform: translateX(8px) rotate(4deg);    z-index: 3; }
.dealt-card:nth-child(4) { transform: translateX(16px) rotate(6deg);   z-index: 4; }
.dealt-card:nth-child(5) { transform: translateX(24px) rotate(8deg);   z-index: 5; }
@keyframes dealIn {
    from { transform: translateY(-16px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

/* Andar / Bahar labels — bg.png already bakes the ring, so draw text only */
.funab-side-label {
    position: absolute;
    width: 52px; height: 52px;
    top: 531px;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: #fff;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 13px;
    font-weight: bold;
    text-shadow: 0 1px 3px rgba(0,0,0,0.9);
    padding: 0;
    transition: background 0.15s, box-shadow 0.15s;
}
#andarBtn { left: 200px; }
#baharBtn { left: 771px; }
.funab-side-label:hover { background: rgba(120, 170, 255, 0.18); }
.funab-side-label.active {
    background: rgba(255, 200, 0, 0.28);
    box-shadow: 0 0 12px rgba(255, 210, 60, 0.65);
}

/* Center reference card — fills baked gold frame */
.funab-reference-frame {
    width: 101px; height: 150px;
    background: none; border: none; box-shadow: none;
    display: flex; align-items: center; justify-content: center;
}
.funab-reference-frame::before { display: none; }
.result-card { width: 100%; }
.result-card img { width: 100%; height: auto; border-radius: 3px; }

/* Circular timer below center card */
.funab-timer-wrap {
    position: relative;
    width: 62px; height: 62px;
    margin-top: 40px;
    flex-shrink: 0;
}
.funab-timer-svg {
    width: 62px; height: 62px;
    transform: rotate(-90deg);
}
.timer-track {
    fill: rgba(6, 20, 60, 0.35);
    stroke: #24408c;
    stroke-width: 6;
}
.timer-fill {
    fill: none;
    stroke: #f0c020;
    stroke-width: 6;
    stroke-linecap: butt;
    stroke-dasharray: 150.8;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear;
}
.timer-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-style: italic;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 6px rgba(0,0,0,0.9);
}

/* ── Chip arc: click zones over baked chips ── */
.funab-chip-rail {
    position: absolute;
    inset: 0;
    pointer-events: none;
}
.funab-chips-left,
.funab-chips-right { display: contents; }

.funab-chip {
    position: absolute;
    width: 56px; height: 56px;
    transform: translate(-50%, -50%);
    cursor: pointer;
    pointer-events: all;
    border-radius: 50%;
    background: transparent;
    transition: background 0.12s;
}
.funab-chip img { display: none; }
.funab-chip.selected {
    background: rgba(255, 220, 50, 0.3);
    box-shadow: 0 0 0 3px rgba(255, 210, 30, 0.85), 0 0 18px rgba(255, 220, 50, 0.6);
}

.chip-10    { left:  48px; top: 547px; }
.chip-25    { left: 107px; top: 595px; }
.chip-50    { left: 190px; top: 636px; }
.chip-100   { left: 278px; top: 660px; }
.chip-500   { left: 744px; top: 661px; }
.chip-1000  { left: 836px; top: 637px; }
.chip-5000  { left: 918px; top: 597px; }
.chip-10000 { left: 977px; top: 549px; }

/* ── Last 5 Data: 5 full-size cards over the baked label ── */
.funab-history-row {
    position: absolute;
    left: 370px; top: 648px;
    width: 280px; height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-around;
    overflow: visible;
}
.funab-history-card img {
    width: 44px;
    height: auto;
    border-radius: 3px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.7);
    display: block;
}

/* ── Action bar ── */
.funab-action-bar {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 73px;
    background: none; border: none; padding: 0;
}
.funab-action-bar form {
    position: relative;
    height: 100%;
    margin: 0; padding: 0;
}

.funab-btn-img img { display: none; }

/* Take button: transparent zone over baked Take pill (game x 154–279) */
#takeBtn {
    position: absolute;
    left: 155px; top: 11px;
    width: 120px; height: 29px;
    background: transparent; border: none;
    cursor: pointer; padding: 0;
}
#takeBtn:hover { background: rgba(255,255,255,0.07); border-radius: 16px; }

#cancelBtn {
    position: absolute;
    left: 155px; top: 11px;
    width: 120px; height: 29px;
    background: transparent; border: none;
    cursor: pointer; padding: 0; opacity: 0;
}

/* Message strip at very bottom */
.funab-message-bar {
    position: absolute;
    left: 0; right: 0; top: 46px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #cfcfcf;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}

/* "Take" / "Bet OK" labels — game-space coords, inside baked pills */
.funab-take-label,
.funab-betok-label {
    position: absolute;
    height: 30px;
    display: flex;
    align-items: center;
    color: #e8a020;
    font-size: 13px;
    font-weight: bold;
    font-style: italic;
    text-shadow: 0 1px 3px rgba(0,0,0,0.9);
    pointer-events: none;
    letter-spacing: 0.3px;
    z-index: 10;
}
.funab-take-label  { left: 215px; top: 705px; }
.funab-betok-label { left: 771px; top: 705px; }

/* Bet OK submit: zone over baked BetOK pill (game x 745–870) */
#betOkBtn {
    position: absolute;
    left: 749px; top: 11px;
    width: 118px; height: 29px;
    background: transparent; border: none;
    cursor: pointer; padding: 0;
}
#betOkBtn:hover { background: rgba(255,255,255,0.07); border-radius: 16px; }
#betOkBtn:disabled { opacity: 0.4; cursor: not-allowed; }

/* X close button only — no Exit pill (original has none) */
.funab-exit-x {
    position: absolute;
    left: 992px; top: 674px;
    width: 25px; height: 25px;
    background: radial-gradient(circle at 35% 30%, #e8d9b4, #b99f6d 70%, #8d7443);
    border: 1px solid rgba(120, 100, 60, 0.9);
    border-radius: 50%;
    color: #1a1a1a;
    font-size: 15px;
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
    z-index: 20;
}

/* Total Bet overlay on baked box */
.funab-total-bet-box {
    position: absolute;
    left: 905px; top: 6px;
    width: 101px; height: 40px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: space-between;
    padding: 0;
}
.funab-actions-left, .funab-actions-right { display: none; }
.funab-total-label {
    height: 15px;
    line-height: 15px;
    font-size: 11px;
    font-weight: bold;
    color: #e8e0c8;
    text-align: center;
}
.funab-total-value {
    height: 25px;
    line-height: 25px;
    padding-right: 7px;
    font-size: 14px;
    font-weight: bold;
    color: #ffd700;
    text-align: right;
}

/* ── Portrait mobile: rotate entire body -90° so ALL content (toasts, popups) rotate correctly ── */
@media screen and (orientation: portrait) and (max-width: 1024px) {
    html { overflow: hidden; }
    body {
        width: 100vh !important;
        height: 100vw !important;
        position: fixed;
        top: calc((100vh - 100vw) / 2);
        left: calc((100vw - 100vh) / 2);
        transform: rotate(-90deg);
        transform-origin: center center;
    }
    /* wrapper: non-uniform scale fills full rotated body — edge to edge */
    .funab-wrapper {
        transform: scaleX(var(--funab-scale-x, 1)) scaleY(var(--funab-scale-y, 1)) !important;
    }
}

/* ── Login overlay on the same FunAB table ── */
.funab-login-panel {
    position: absolute;
    left: 50%;
    top: 268px;
    transform: translateX(-50%);
    width: 420px;
    padding: 22px 28px 24px;
    background: linear-gradient(180deg, rgba(8, 28, 72, 0.92) 0%, rgba(4, 16, 48, 0.96) 100%);
    border: 2px solid #c9a227;
    border-radius: 10px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.65), inset 0 0 18px rgba(201, 162, 39, 0.12);
    z-index: 8;
    pointer-events: auto;
}
.funab-login-title {
    text-align: center;
    color: #f0c020;
    font-size: 22px;
    font-weight: bold;
    font-style: italic;
    letter-spacing: 0.6px;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.85);
    margin-bottom: 16px;
}
.funab-login-label {
    display: block;
    color: #e8d9b4;
    font-size: 13px;
    font-style: italic;
    margin: 8px 0 5px;
}
.funab-login-input,
.funab-login-form .form--control,
.funab-login-form input[type="text"],
.funab-login-form input[type="password"] {
    width: 100%;
    height: 40px;
    border: 1px solid #8a7030;
    border-radius: 6px;
    background: rgba(6, 18, 48, 0.9);
    color: #ffe9a0;
    font-size: 15px;
    padding: 0 12px;
    outline: none;
    font-family: Georgia, 'Times New Roman', serif;
}
.funab-login-input:focus,
.funab-login-form input:focus {
    border-color: #f0c020;
    box-shadow: 0 0 8px rgba(240, 192, 32, 0.35);
}
.funab-login-btn {
    display: block;
    width: 100%;
    margin-top: 18px;
    height: 42px;
    border: 1px solid #8d7443;
    border-radius: 21px;
    cursor: pointer;
    color: #1a1408;
    font-size: 16px;
    font-weight: bold;
    font-style: italic;
    letter-spacing: 0.5px;
    font-family: Georgia, 'Times New Roman', serif;
    background: linear-gradient(180deg, #f3d56a 0%, #c9a227 52%, #8d7443 100%);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}
.funab-login-btn:hover {
    filter: brightness(1.08);
}
.funab-login-screen .funab-message-bar {
    top: auto;
    bottom: 10px;
    z-index: 8;
    color: #f0c020;
    font-style: italic;
}
body:has(.funab-login-screen) {
    touch-action: auto;
}
.funab-login-form .form-group,
.funab-login-form .mb-3 {
    margin-top: 10px;
}
.funab-login-form .form-label,
.funab-login-form label {
    color: #e8d9b4;
}
