@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700&family=Roboto:wght@400;700;900&display=swap');

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

/* ═══════════════════════════════════════════════════════════
   ROOT CONTAINER
   ═══════════════════════════════════════════════════════════ */
#arrays-roulette-root {
    font-family: 'Roboto', sans-serif;
    color: #fff;
    background-color: #174f20;
    position: relative;
    overflow: hidden;
    max-width: 1100px;
    /* Total: wheel(400) + gap(20) + chips(54) + gap(8) + table(210) + hud(35) + padding(23) = 750 */
    height: 750px;
    margin: 20px auto;
}

/* ═══════════════════════════════════════════════════════════
   WHEEL  (top-center, does NOT interfere with chips/table)
   ═══════════════════════════════════════════════════════════ */
.ar-wheel-wrapper {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 390px;
    height: 390px;
    border-radius: 50%;
    z-index: 5;
    box-shadow: 0 40px 60px rgba(0,0,0,0.6), inset 0 0 20px rgba(0,0,0,0.9);
    overflow: hidden;
}
.ar-wheel-img {
    width: 100%; height: 100%;
    border-radius: 50%;
}
#ar-wheel-canvas {
    width: 100%; height: 100%;
    border-radius: 50%;
    will-change: transform;
}

/* Ball wrapper sits exactly over the wheel */
.ar-ball-wrapper {
    position: absolute;
    top: 20px; left: 50%;
    transform: translateX(-50%) rotate(0deg);
    width: 390px; height: 390px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 6;
}
.ar-ball-target {
    position: absolute;
    top: 50%; left: 50%;
    width: 330px; height: 330px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    transition: width 1.2s cubic-bezier(0.5,0,0.8,1), height 1.2s cubic-bezier(0.5,0,0.8,1);
}
.ar-ball-target.dropping { width: 230px; height: 230px; }
.ar-ball-dot {
    position: absolute;
    top: -6px; left: calc(50% - 6px);
    width: 12px; height: 12px;
    background: radial-gradient(circle at 30% 30%, #fff, #b3b3b3, #444);
    border-radius: 50%;
    box-shadow: 0 4px 6px rgba(0,0,0,0.9);
    opacity: 0;
    transition: opacity 0.3s;
}

/* ═══════════════════════════════════════════════════════════
   TABLE COVERAGE BADGE  (below wheel, above chip rail)
   ═══════════════════════════════════════════════════════════ */
.ar-table-coverage {
    position: absolute;
    /* 35px HUD + 210px table + 54px chips + 8px gap = 307px from bottom */
    bottom: 307px;
    left: 50%;
    transform: translateX(-50%);
    background: #111;
    border-radius: 12px;
    padding: 3px 20px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    border: 1px solid #444;
    z-index: 15;
    white-space: nowrap;
    text-transform: uppercase;
}
.ar-table-coverage span { font-weight: 400; color: #aaa; margin-right: 8px; }

/* ═══════════════════════════════════════════════════════════
   LIMITS BOX  (left of wheel, z-index low)
   ═══════════════════════════════════════════════════════════ */
.ar-limits {
    position: absolute;
    top: 130px; left: 60px;
    background: #cba873;
    border: 1px solid #7c5f35;
    border-radius: 4px;
    padding: 10px 14px;
    font-size: 0.75rem;
    font-weight: 900;
    color: #1a1005;
    text-align: center;
    box-shadow: 0 8px 15px rgba(0,0,0,0.4);
    z-index: 4;
}
.ar-limits span { font-weight: 400; font-size: 0.65rem; display: block; margin-top: 2px; }

/* ═══════════════════════════════════════════════════════════
   ZOOM CAM
   ═══════════════════════════════════════════════════════════ */
.ar-zoom-cam {
    position: absolute;
    top: 20px; left: 60px;
    width: 120px; height: 90px;
    border: 3px solid #dcd7ad;
    border-radius: 8px;
    background: #000;
    overflow: hidden;
    z-index: 20;
    box-shadow: 0 10px 20px rgba(0,0,0,0.8);
    display: flex; align-items: center; justify-content: center;
    opacity: 0;
    transition: opacity 0.4s;
}
.ar-zoom-cam.show { opacity: 1; }
.ar-zoom-wheel {
    width: 400px; height: 400px;
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    border-radius: 50%;
    transform: scale(3.2) rotate(0deg);
    transform-origin: center center;
    margin-top: 260px;
}
.ar-zoom-ball {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 20px; height: 20px;
    background: radial-gradient(circle at 30% 30%, #fff, #b3b3b3, #444);
    border-radius: 50%;
    box-shadow: 0 5px 10px rgba(0,0,0,0.9);
    z-index: 2;
}

/* ═══════════════════════════════════════════════════════════
   ACTION BUTTONS  (right side, vertically centered on wheel)
   ═══════════════════════════════════════════════════════════ */
.ar-right-controls {
    position: absolute;
    top: 230px; right: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 20;
}
.ar-side-btn {
    width: 80px; height: 80px;
    background: radial-gradient(circle at center, #eee, #aaa);
    border: 4px solid #3d4a3d;
    border-radius: 50%;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    font-size: 0.6rem;
    font-family: 'Roboto', sans-serif;
    font-weight: 900;
    color: #111;
    cursor: pointer;
    box-shadow: 0 5px 10px rgba(0,0,0,0.6);
    transition: transform 0.1s;
}
.ar-side-btn:hover { filter: brightness(1.1); }
.ar-side-btn:active { transform: scale(0.95); }
.ar-side-btn svg { width: 20px; height: 20px; fill: #111; margin-bottom: 4px; }
.ar-side-btn.dark { background: radial-gradient(circle at center, #ecebc3, #7a7657); border-color: #2a2a2a; }

/* ═══════════════════════════════════════════════════════════
   CHIP RAIL
   ── Horizontal centered row sitting BETWEEN the table-coverage
      badge and the betting table.  z-index:30 so it is always
      visible and clickable, but we set the rail container itself
      to pointer-events:none so only the chip <divs> receive clicks.
   Position: bottom = hud(35) + table(210) + gap(4) = 249px
   Height: 54px → top of rail at 750-249-54 = 447px  (table top = 750-35-210 = 505px) ✓
   ═══════════════════════════════════════════════════════════ */
.ar-chip-rail {
    position: absolute;
    bottom: 249px;
    left: 50%;
    transform: translateX(-50%);
    /* auto-width: wide enough for 8×(44+10)=432px */
    width: auto;
    height: 54px;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 10px;
    z-index: 30;
    pointer-events: none;  /* container transparent – chips get clicks */
}

/* Individual chip */
.ar-chip-selector {
    position: relative;          /* NOT absolute – flows inside flex row */
    top: auto; left: auto;
    width: 44px; height: 44px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-weight: 900;
    font-size: 13px;
    color: #111;
    cursor: pointer;
    box-shadow: 0 5px 8px rgba(0,0,0,0.5);
    transition: transform 0.2s, box-shadow 0.2s;
    pointer-events: auto;        /* chips ARE clickable */
}
.ar-chip-selector::after {
    content: '';
    position: absolute;
    top: 3px; left: 3px; right: 3px; bottom: 3px;
    border: 3px dashed rgba(255,255,255,0.7);
    border-radius: 50%;
}
.ar-chip-selector:hover  { transform: scale(1.12); }
.ar-chip-selector.active { transform: scale(1.22); box-shadow: 0 0 20px rgba(255,255,255,0.7); z-index: 35; }

/* Chip colour variants */
.ar-c1 { background: #e2e2e2; border: 4px solid #d3165b; }
.ar-c2 { background: #e2e2e2; border: 4px solid #1c88d8; }
.ar-c3 { background: #e2e2e2; border: 4px solid #8c2db7; }
.ar-c4 { background: #e2e2e2; border: 4px solid #e5871b; }
.ar-c5 { background: #e2e2e2; border: 4px solid #369c4f; }
.ar-c6 { background: #111; color: #fff; border: 4px solid #555; }
.ar-c7 { background: #111; color: #fff; border: 4px solid #b32424; }
.ar-c8 { background: #111; color: #d4af37; border: 4px solid #d4af37; }

/* ═══════════════════════════════════════════════════════════
   BETTING TABLE  +  GRID
   z-index:7  <  chip-rail:30   →  no overlap possible
   ═══════════════════════════════════════════════════════════ */
.ar-table-area {
    position: absolute;
    bottom: 35px;          /* sits just above the HUD */
    left: 50%;
    transform: translateX(-50%);
    width: 840px;
    height: 210px;
    z-index: 7;
}

.ar-main-grid {
    display: grid;
    width: 100%; height: 100%;
    grid-template-columns: repeat(14, 1fr);
    grid-template-rows: repeat(5, 1fr);
    border: 1px solid #dcd7ad;
    border-radius: 4px;
    background: transparent;
    user-select: none;
}

.ar-cell {
    border: 1px solid #dcd7ad;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    font-weight: 700;
    cursor: pointer;
    background: #174f20;
    color: #fff;
    transition: background 0.1s;
    position: relative;
    z-index: 2;
    /* Ensure every cell receives pointer events */
    pointer-events: auto;
}
.ar-cell:hover { background: rgba(255, 215, 0, 0.4) !important; z-index: 5; }

/* ZERO cell — raised z-index so nothing can block it */
.ar-cell-zero {
    font-size: 1.8rem;
    border-top-left-radius: 4px;
    border-bottom-left-radius: 4px;
    z-index: 15 !important;
    pointer-events: auto !important;
    cursor: pointer !important;
    background: #174f20 !important;
}
.ar-cell-zero:hover { background: rgba(255, 215, 0, 0.4) !important; }

.ar-cell-num.red   { background: #b1161d; }
.ar-cell-num.black { background: #18191b; }
.ar-cell-2to1      { font-family: 'Roboto', sans-serif; font-size: 0.8rem; font-weight: 700; }
.ar-grid-2to1-top  { border-top-right-radius: 4px; }
.ar-cell-outside   { font-family: 'Roboto', sans-serif; font-size: 0.95rem; font-weight: 500; }
.ar-diamond        { width: 34px; height: 34px; transform: rotate(45deg); border: 2px solid #dcd7ad; margin: 0 auto; pointer-events: none; }
.ar-dia-red        { background: #b1161d; }
.ar-dia-black      { background: #18191b; }

/* Split / corner / street hitboxes */
.ar-hitboxes { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 20; }
.ar-hitbox   { position: absolute; width: 24px; height: 24px; background: transparent; transform: translate(-50%,-50%); pointer-events: auto; border-radius: 50%; cursor: pointer; }
.ar-hitbox:hover { background: rgba(255,215,0,0.5); }

/* Placed chip visual */
.ar-chip-placed {
    position: absolute;
    transform: translate(-50%,-50%);
    width: 28px; height: 28px;
    border-radius: 50%;
    background: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 10px; font-weight: 900;
    color: #000;
    font-family: 'Roboto', sans-serif;
    pointer-events: none;
    box-shadow: 0 2px 3px rgba(0,0,0,0.8);
    z-index: 30;
}
.ar-chip-placed::after { content:''; position: absolute; top:2px; left:2px; right:2px; bottom:2px; border: 2px dashed #fff; border-radius: 50%; }

/* ═══════════════════════════════════════════════════════════
   HUD BOTTOM BAR
   ═══════════════════════════════════════════════════════════ */
.ar-hud-bottom {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 35px;
    background: #131413;
    display: flex; justify-content: space-between; align-items: center;
    padding: 0 20px;
    font-size: 0.75rem;
    color: #e9b360;
    font-family: 'Roboto', sans-serif;
    font-weight: bold;
    z-index: 40;
}
.ar-hud-bottom strong { font-size: 1rem; color: #fff; }
.ar-hud-msg { text-align: center; color: #78a76e; }
.ar-hud-msg span { display: block; font-size: 0.6rem; color: #888; }

/* ═══════════════════════════════════════════════════════════
   RESULT OVERLAY
   ═══════════════════════════════════════════════════════════ */
.ar-result-overlay {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8);
    display: flex; align-items: center; justify-content: center;
    z-index: 100;
    opacity: 0; pointer-events: none;
    transition: opacity 0.3s;
}
.ar-result-overlay.show { opacity: 1; pointer-events: auto; }
.ar-res-box { text-align: center; transform: scale(0.8); transition: transform 0.4s cubic-bezier(0.175,0.885,0.32,1.275); }
.ar-result-overlay.show .ar-res-box { transform: scale(1); }
.ar-res-num { font-size: 5rem; font-family: 'Playfair Display', serif; font-weight: 900; color: #fff; width: 120px; height: 120px; line-height: 120px; text-align: center; margin: 0 auto 10px; border-radius: 50%; background: #000; border: 4px solid #dcd7ad; }
.ar-res-num.red   { background: #b1161d; }
.ar-res-num.green { background: #174f20; }
.ar-res-win { color: #dcd7ad; font-size: 1.2rem; font-weight: bold; margin-bottom: 20px; text-transform: uppercase; }
.ar-btn-main { background: #e0d08e; border: 1px solid #7c5f35; border-radius: 4px; padding: 10px 30px; font-weight: 900; color: #111; cursor: pointer; text-transform: uppercase; }

/* ═══════════════════════════════════════════════════════════
   SPIN BACKDROP (mobile fullscreen wheel overlay)
   ═══════════════════════════════════════════════════════════ */
.ar-spin-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 990;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}
.ar-spin-backdrop.show {
    opacity: 1;
    pointer-events: auto;
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE — medium desktop (861–1100px)
   Table scales to viewport width; chip rail auto-centres.
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 1000px) and (min-width: 861px) {
    .ar-table-area { width: 92vw; }
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE — mobile (≤ 860px)
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 860px) {
    /* Hide wheel, zoom, limits, coverage on mobile (shown via overlay on spin) */
    .ar-wheel-wrapper, .ar-ball-wrapper, .ar-zoom-cam, .ar-limits, .ar-table-coverage {
        display: none !important;
    }
    #arrays-roulette-root {
        position: relative !important;
        display: flex;
        flex-direction: column;
        align-items: center;
        height: auto !important;
        overflow: visible !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 10px 0 50px !important;
    }
    /* Chip rail: horizontal wrap row */
    .ar-chip-rail {
        position: relative !important;
        bottom: auto !important;
        left: auto !important;
        transform: none !important;
        width: 100% !important;
        height: auto !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        margin-bottom: 10px !important;
        z-index: 20 !important;
        order: 2 !important;
    }
    .ar-chip-selector {
        position: relative !important;
        top: auto !important; left: auto !important;
        width: 38px !important; height: 38px !important;
        font-size: 11px !important;
    }
    /* Betting table: rotated 90° to fill vertical phone screen — shown FIRST */
    .ar-table-area {
        position: relative !important;
        bottom: auto !important; left: auto !important;
        transform: rotate(90deg) !important;
        transform-origin: center center !important;
        width: 700px !important;
        height: auto !important;
        margin-top: 70vw !important;
        margin-bottom: 75vw !important;
        z-index: 5 !important;
        order: 1 !important;
    }
    .ar-main-grid {
        height: auto !important;
    }
    .ar-cell {
        min-height: 28px !important;
    }
    .ar-hitbox {
        width: 20px !important;
        height: 20px !important;
    }
    /* Action buttons: horizontal row */
    .ar-right-controls {
        position: relative !important;
        top: auto !important; right: auto !important;
        flex-direction: row !important;
        justify-content: center !important;
        gap: 16px !important;
        margin-top: 12px !important;
        z-index: 20 !important;
        order: 3 !important;
    }
    .ar-side-btn { width: 64px !important; height: 64px !important; font-size: 0.5rem !important; }
    .ar-hud-bottom {
        position: fixed !important;
        bottom: 0 !important; left: 0 !important; right: 0 !important;
        z-index: 50 !important;
    }

    /* ── Mobile spinning state: fullscreen wheel overlay ──────────── */
    .ar-mobile-spinning .ar-wheel-wrapper {
        display: block !important;
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        width: 85vmin !important;
        height: 85vmin !important;
        z-index: 995 !important;
        box-shadow: 0 0 80px rgba(0,0,0,0.9) !important;
    }
    .ar-mobile-spinning .ar-result-overlay {
        position: fixed !important;
        z-index: 1000 !important;
    }
}
