/* =============================================
   ROULETTE ROYALE — style.css
   ============================================= */

:root {
    --gold: #DAA520;
    --gold-light: #FFD700;
    --gold-pale: rgba(218, 165, 32, 0.15);
    --red: #C0392B;
    --red-bright: #E74C3C;
    --green-felt: #0B5E2A;
    --green-dark: #073D1B;
    --black: #111;
    --bg: #0a0a0f;
    --panel: #12121e;
    --border: rgba(218, 165, 32, 0.35);
    --text: #F5ECD7;
    --muted: rgba(245, 236, 215, 0.55);
}

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

body {
    font-family: 'EB Garamond', Georgia, serif;
    background: var(--bg);
    min-height: 100vh;
    color: var(--text);
    overflow-x: hidden;
    background-image:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(218, 165, 32, 0.08) 0%, transparent 70%),
        repeating-linear-gradient(45deg, transparent, transparent 40px, rgba(255, 255, 255, 0.005) 40px, rgba(255, 255, 255, 0.005) 41px);
}

/* ── LAYOUT ── */
.app {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px 16px 40px;
}

header {
    text-align: center;
    padding: 32px 0 24px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 32px;
    position: relative;
}

header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

h1 {
    font-family: 'Cinzel', serif;
    font-size: clamp(2em, 6vw, 3.2em);
    font-weight: 600;
    background: linear-gradient(135deg, #b8860b, #FFD700, #DAA520);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 6px;
    text-transform: uppercase;
}

.subtitle {
    font-family: 'EB Garamond', serif;
    font-style: italic;
    color: var(--muted);
    font-size: 1.05em;
    letter-spacing: 3px;
    margin-top: 6px;
}

.main-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 28px;
    align-items: start;
}

/* ── WHEEL PANEL ── */
.wheel-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.wheel-wrapper {
    position: relative;
    width: 280px;
    height: 280px;
}

canvas#wheelCanvas {
    border-radius: 50%;
    box-shadow:
        0 0 0 6px #1a1a2e,
        0 0 0 10px var(--gold),
        0 0 40px rgba(218, 165, 32, 0.4),
        0 20px 60px rgba(0, 0, 0, 0.7);
    cursor: pointer;
    transition: box-shadow 0.3s;
}

canvas#wheelCanvas:hover {
    box-shadow:
        0 0 0 6px #1a1a2e,
        0 0 0 10px var(--gold-light),
        0 0 60px rgba(255, 215, 0, 0.6),
        0 20px 60px rgba(0, 0, 0, 0.7);
}

/* Gold pointer arrow above wheel */
.wheel-pointer {
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 28px solid var(--gold);
    filter: drop-shadow(0 0 8px rgba(218, 165, 32, 0.8));
    z-index: 10;
}

/* ── RESULT DISPLAY ── */
.result-display {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px 24px;
    text-align: center;
    width: 100%;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.result-number {
    font-family: 'Cinzel', serif;
    font-size: 2.4em;
    font-weight: 600;
    color: #fff;
    line-height: 1;
}

.result-number.red {
    color: #E74C3C;
    text-shadow: 0 0 20px rgba(231, 76, 60, 0.6);
}

.result-number.green {
    color: #2ecc71;
    text-shadow: 0 0 20px rgba(46, 204, 113, 0.6);
}

.result-number.black {
    color: #aaa;
}

.result-label {
    font-size: 0.95em;
    color: var(--muted);
    letter-spacing: 2px;
    font-style: italic;
}

.result-outcome {
    font-family: 'Cinzel', serif;
    font-size: 1em;
    letter-spacing: 1px;
}

.result-outcome.win {
    color: #2ecc71;
}

.result-outcome.lose {
    color: #e74c3c;
}

/* ── BALANCE + BET INFO ── */
.info-bar {
    display: flex;
    gap: 12px;
    width: 100%;
}

.info-card {
    flex: 1;
    background: var(--gold-pale);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    text-align: center;
}

.info-card .ic-label {
    font-size: 0.7em;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--muted);
    display: block;
    margin-bottom: 4px;
}

.info-card .ic-value {
    font-family: 'Cinzel', serif;
    font-size: 1.3em;
    color: var(--gold-light);
    font-weight: 600;
}

/* ── CHIP SELECTOR ── */
.bet-row {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bet-row label {
    font-size: 0.75em;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--muted);
}

.bet-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.chip {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 3px solid;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Cinzel', serif;
    font-size: 0.78em;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    user-select: none;
    position: relative;
}

.chip::after {
    content: '';
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.chip:hover {
    transform: scale(1.15) translateY(-3px);
}

.chip:active {
    transform: scale(0.95);
}

.chip.active {
    transform: scale(1.15) translateY(-3px);
    box-shadow: 0 0 20px currentColor !important;
}

.chip-1 {
    background: #e74c3c;
    border-color: #c0392b;
    color: #fff;
    box-shadow: 0 4px 10px rgba(231, 76, 60, 0.4);
}

.chip-5 {
    background: #3498db;
    border-color: #2980b9;
    color: #fff;
    box-shadow: 0 4px 10px rgba(52, 152, 219, 0.4);
}

.chip-10 {
    background: #2ecc71;
    border-color: #27ae60;
    color: #fff;
    box-shadow: 0 4px 10px rgba(46, 204, 113, 0.4);
}

.chip-25 {
    background: #9b59b6;
    border-color: #8e44ad;
    color: #fff;
    box-shadow: 0 4px 10px rgba(155, 89, 182, 0.4);
}

.chip-50 {
    background: linear-gradient(135deg, #DAA520, #FFD700);
    border-color: #b8860b;
    color: #1a1a2e;
    box-shadow: 0 4px 10px rgba(218, 165, 32, 0.5);
}

/* ── BUTTONS ── */
.btn-spin {
    width: 100%;
    padding: 16px;
    font-family: 'Cinzel', serif;
    font-size: 1.1em;
    font-weight: 600;
    letter-spacing: 4px;
    text-transform: uppercase;
    background: linear-gradient(135deg, #8b6914, #DAA520, #FFD700, #DAA520, #8b6914);
    background-size: 200% 100%;
    border: none;
    border-radius: 10px;
    color: #1a1a2e;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 20px rgba(218, 165, 32, 0.4);
    position: relative;
    overflow: hidden;
}

.btn-spin:hover {
    background-position: 100% 0;
    box-shadow: 0 6px 30px rgba(218, 165, 32, 0.6);
    transform: translateY(-2px);
}

.btn-spin:active {
    transform: translateY(0);
}

.btn-spin:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-clear {
    background: rgba(231, 76, 60, 0.15);
    border: 1px solid rgba(231, 76, 60, 0.4);
    color: #e74c3c;
    border-radius: 8px;
    padding: 8px 16px;
    cursor: pointer;
    font-family: 'EB Garamond', serif;
    font-size: 0.9em;
    transition: all 0.2s;
    letter-spacing: 1px;
}

.btn-clear:hover {
    background: rgba(231, 76, 60, 0.25);
}

/* ── BETTING TABLE ── */
.table-panel {
    background: var(--green-felt);
    border-radius: 18px;
    padding: 20px;
    border: 3px solid #27ae60;
    box-shadow:
        inset 0 4px 20px rgba(0, 0, 0, 0.4),
        0 8px 32px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
}

/* Subtle grid texture on the felt */
.table-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(90deg, transparent, transparent 49px, rgba(255, 255, 255, 0.04) 49px, rgba(255, 255, 255, 0.04) 50px),
        repeating-linear-gradient(0deg, transparent, transparent 49px, rgba(255, 255, 255, 0.04) 49px, rgba(255, 255, 255, 0.04) 50px);
    pointer-events: none;
}

.table-label {
    font-family: 'Cinzel', serif;
    font-size: 0.65em;
    letter-spacing: 3px;
    color: rgba(255, 255, 255, 0.45);
    text-align: center;
    margin-bottom: 10px;
    text-transform: uppercase;
}

/* Zero row */
.board-zero {
    display: flex;
    justify-content: center;
    margin-bottom: 6px;
}

/* Number grid: 3 rows × 12 columns */
.board-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 3px;
    margin-bottom: 6px;
}

/* Dozens row */
.board-dozens {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3px;
    margin-bottom: 6px;
}

/* Six outside bets */
.board-sixths {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 3px;
}

/* ── CELL BASE ── */
.cell {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 4px;
    padding: 8px 4px;
    text-align: center;
    cursor: pointer;
    font-family: 'Cinzel', serif;
    font-size: 0.82em;
    font-weight: 600;
    color: #fff;
    transition: all 0.15s;
    user-select: none;
    position: relative;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cell:hover {
    filter: brightness(1.4);
    transform: scale(1.05);
    z-index: 2;
}

.cell.red-cell {
    background: rgba(192, 57, 43, 0.75);
}

.cell.black-cell {
    background: rgba(20, 20, 20, 0.8);
}

.cell.green-cell {
    background: rgba(39, 174, 96, 0.8);
}

.cell.outside-cell {
    background: rgba(0, 0, 0, 0.3);
    font-size: 0.7em;
    letter-spacing: 1px;
    font-family: 'EB Garamond', serif;
    font-style: italic;
}

.cell.col-cell {
    background: rgba(0, 0, 0, 0.25);
    font-size: 0.65em;
}

/* Gold chip badge shown on a cell that has a bet */
.cell.has-bet::after {
    content: attr(data-bet);
    position: absolute;
    top: -10px;
    right: -8px;
    background: linear-gradient(135deg, #DAA520, #FFD700);
    color: #1a1a2e;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 0.65em;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Cinzel', serif;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(218, 165, 32, 0.6);
    z-index: 5;
    border: 1px solid #8b6914;
}

/* ── HISTORY DOTS ── */
.history {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.history-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6em;
    font-family: 'Cinzel', serif;
    font-weight: 600;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.history-dot.red {
    background: #c0392b;
}

.history-dot.black {
    background: #222;
}

.history-dot.green {
    background: #27ae60;
}

/* ── TOAST NOTIFICATION ── */
#toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(15, 15, 25, 0.95);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 28px;
    font-family: 'Cinzel', serif;
    font-size: 1em;
    color: var(--gold-light);
    letter-spacing: 2px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 1000;
    text-align: center;
}

#toast.show {
    transform: translateX(-50%) translateY(0);
}

#toast.win {
    border-color: #2ecc71;
    color: #2ecc71;
}

#toast.lose {
    border-color: #e74c3c;
    color: #e74c3c;
}

/* ── SPINNING OVERLAY ── */
/* Invisible div that blocks all clicks while the wheel spins */
.spinning-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.0);
    z-index: 100;
    pointer-events: none;
}

.spinning-overlay.active {
    pointer-events: all;
}

/* ── RESPONSIVE ── */
@media (max-width: 780px) {
    .main-grid {
        grid-template-columns: 1fr;
    }

    .wheel-panel {
        align-items: center;
    }

    .wheel-wrapper {
        width: 240px;
        height: 240px;
    }

    canvas#wheelCanvas {
        width: 240px !important;
        height: 240px !important;
    }
}