/* Roulette Emerald Classic — Monte Carlo Classic Style */

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

:root {
    /* ===== PALETTE (clonable) ===== */
    --felt-deep:    #051a14;
    --felt-mid:     #0a2a22;
    --felt-bright:  #0e5240;
    --felt-edge:    #08322a;
    --wood-dark:    #2a1810;
    --wood-mid:     #4a2a18;

    --pocket-red:   #c61f2a;
    --pocket-black: #0d0d0d;
    --pocket-green: #1a8a4e;

    --gold:         #d4af37;
    --gold-bright:  #f0d063;
    --gold-soft:    rgba(212, 175, 55, 0.55);
    --gold-glow:    rgba(212, 175, 55, 0.45);

    --text-cream:   #f5f1e8;
    --text-soft:    rgba(245, 241, 232, 0.7);
    --text-muted:   rgba(245, 241, 232, 0.45);

    --panel-bg:     rgba(8, 36, 28, 0.85);
    --panel-border: rgba(212, 175, 55, 0.4);

    --danger:       #c61f2a;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Georgia', 'Segoe UI', Tahoma, serif;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    background:
        radial-gradient(ellipse at 50% 0%, #0c3a30 0%, var(--felt-mid) 45%, var(--felt-deep) 100%);
    min-height: calc(100dvh - 3.5rem);
    color: var(--text-cream);
}

/* ============ SCREENS ============ */
.screen {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: var(--felt-deep);
    color: var(--text-cream);
    z-index: 1000;
}

.screen.hidden { display: none; }

.loading-spinner {
    width: 3.25rem;
    height: 3.25rem;
    border: 3px solid rgba(212, 175, 55, 0.18);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spinAnim 1s linear infinite;
}

@keyframes spinAnim { to { transform: rotate(360deg); } }

#loading-screen p {
    margin-top: 1rem;
    color: var(--gold);
    font-size: 0.95rem;
    letter-spacing: 0.06rem;
}

.login-content { text-align: center; }
.login-icon { font-size: 3.5rem; margin-bottom: 1rem; }
.login-content h2 { color: var(--gold); margin-bottom: 0.5rem; }
.login-content p { color: var(--text-muted); }

/* ============ GAME CONTAINER ============ */
#game-container {
    width: 100%;
    max-width: 28.75rem;
    height: 100%;
    max-height: 51.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem 0.75rem;
    position: relative;
    z-index: 1;
}

#game-container.hidden { display: none; }

/* ============ HEADER / BALANCE ============ */
#game-header {
    width: 100%;
    padding: 0.4rem 0;
    display: flex;
    justify-content: center;
}

.balance-display {
    background: linear-gradient(180deg, rgba(212,175,55,0.16) 0%, rgba(212,175,55,0.06) 100%);
    border: 1px solid var(--gold-soft);
    border-radius: 1.25rem;
    padding: 0.45rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    box-shadow:
        0 0 1.1rem rgba(212,175,55,0.15),
        inset 0 1px 0 rgba(255,255,255,0.06);
}

.balance-label {
    color: var(--text-soft);
    font-size: 0.75rem;
    letter-spacing: 0.03rem;
}

#balance-value {
    color: var(--gold-bright);
    font-size: 1.25rem;
    font-weight: 700;
    min-width: 4.4rem;
    text-align: right;
    text-shadow: 0 0 0.6rem rgba(240,208,99,0.4);
    font-family: 'Georgia', serif;
}

.balance-currency {
    color: var(--gold-soft);
    font-size: 0.7rem;
    letter-spacing: 0.02rem;
}

/* ============ WHEEL SECTION ============ */
#wheel-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 0.5rem 0;
    position: relative;
}

/* Pointer */
.wheel-pointer {
    position: relative;
    z-index: 20;
    margin-bottom: -0.6rem;
}

.pointer-arrow {
    width: 0;
    height: 0;
    border-left: 0.65rem solid transparent;
    border-right: 0.65rem solid transparent;
    border-top: 1.1rem solid var(--gold-bright);
    filter:
        drop-shadow(0 2px 4px rgba(0,0,0,0.7))
        drop-shadow(0 0 0.4rem rgba(240,208,99,0.6));
}

/* Wheel Outer ring (decorative wooden bezel) */
.wheel-outer {
    position: relative;
    width: 17rem;
    height: 17rem;
    border-radius: 50%;
    background:
        radial-gradient(circle at 50% 50%, var(--wood-mid) 0%, var(--wood-dark) 70%, #1a0d08 100%);
    padding: 0.55rem;
    box-shadow:
        0 0 0 1px rgba(0,0,0,0.7),
        0 1.25rem 2.5rem rgba(0,0,0,0.7),
        inset 0 1px 0 rgba(212,175,55,0.2),
        inset 0 -3px 8px rgba(0,0,0,0.6);
}

/* Gold rim */
.wheel-rim {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background:
        conic-gradient(
            from 0deg,
            #b88e2c, #f0d063, #b88e2c, #8b6a1f, #d4af37, #f0d063, #b88e2c
        );
    padding: 0.4rem;
    box-shadow:
        0 0 0 1px #2a1a08,
        inset 0 0 0 1px rgba(0,0,0,0.5),
        inset 0 2px 6px rgba(255,255,255,0.2),
        inset 0 -2px 6px rgba(0,0,0,0.5),
        0 0 1.5rem rgba(212,175,55,0.25);
}

/* The wheel itself */
.wheel {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
    background: var(--felt-bright);
    transform: rotate(0deg);
    will-change: transform;
    box-shadow:
        inset 0 0 1.5rem rgba(0,0,0,0.6),
        inset 0 0 0 1px rgba(0,0,0,0.5);
    transition: transform 4s cubic-bezier(0.17, 0.67, 0.16, 0.99);
}

.wheel.win-glow {
    animation: wheelWinGlow 0.45s ease-in-out 3;
}

@keyframes wheelWinGlow {
    0%, 100% { filter: brightness(1) drop-shadow(0 0 0 transparent); }
    50%       { filter: brightness(1.25) drop-shadow(0 0 1rem var(--gold-bright)); }
}

/* Ball track — концентричне коло вище секторів, з кулькою */
.ball-track {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 88%;
    height: 88%;
    transform: translate(-50%, -50%) rotate(0deg);
    pointer-events: none;
    z-index: 8;
    transition: transform 4s cubic-bezier(0.22, 0.7, 0.2, 1);
}

.ball {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translate(-50%, -0.1rem);
    width: 0.7rem;
    height: 0.7rem;
    background: radial-gradient(circle at 35% 30%, #ffffff 0%, #e0e0e0 60%, #888 100%);
    border-radius: 50%;
    box-shadow:
        0 0 0.4rem rgba(0,0,0,0.7),
        inset 0 -2px 3px rgba(0,0,0,0.3),
        inset 0 1px 1px rgba(255,255,255,0.9);
    z-index: 9;
    transition: top 1.1s cubic-bezier(0.5, 0, 0.5, 1);
}

.ball.settling {
    top: 7%;
}

.ball.rested {
    top: 7%;
    transition: none;
}

/* Hub (центральне декоративне ядро) */
.wheel-hub {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 25%;
    height: 25%;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    background:
        radial-gradient(circle at 50% 40%, #f0d063 0%, #d4af37 35%, #8b6a1f 80%, #4a3a10 100%);
    box-shadow:
        0 0 0 2px #2a1a08,
        0 0 0 3px var(--gold),
        inset 0 1px 2px rgba(255,255,255,0.4),
        inset 0 -2px 4px rgba(0,0,0,0.5),
        0 0 1rem rgba(0,0,0,0.6);
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
}

.hub-cross {
    width: 70%;
    height: 70%;
    position: relative;
}

.hub-cross::before,
.hub-cross::after {
    content: '';
    position: absolute;
    background: linear-gradient(90deg, transparent, var(--wood-dark), transparent);
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    transform-origin: center;
}

.hub-cross::after {
    transform: rotate(90deg);
}

/* ============ RESULT PLATE ============ */
.result-plate {
    margin-top: 0.6rem;
    padding: 0.35rem 0.9rem;
    border-radius: 0.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(0,0,0,0.45);
    border: 1px solid var(--gold-soft);
    box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}

.result-plate.hidden { display: none; }

.result-label {
    color: var(--text-soft);
    font-size: 0.75rem;
    letter-spacing: 0.05rem;
    text-transform: uppercase;
}

.result-number {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-cream);
    min-width: 1.5rem;
    text-align: center;
    border-radius: 0.3rem;
    padding: 0.05rem 0.45rem;
    background: var(--pocket-black);
    border: 1px solid var(--gold-soft);
}

.result-plate.red   .result-number { background: var(--pocket-red);   }
.result-plate.black .result-number { background: var(--pocket-black); }
.result-plate.green .result-number { background: var(--pocket-green); }

/* ============ WIN DISPLAY ============ */
#win-display {
    position: absolute;
    top: 32%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(160deg, rgba(10,42,34,0.97) 0%, rgba(5,26,20,0.97) 100%);
    padding: 1.1rem 2.5rem;
    border-radius: 1rem;
    border: 1px solid var(--gold);
    box-shadow:
        0 0 0 1px rgba(212,175,55,0.25),
        0 0 3rem rgba(212,175,55,0.5),
        inset 0 1px 0 rgba(255,255,255,0.08);
    z-index: 100;
    text-align: center;
    animation: winPopup 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#win-display.hidden { display: none; }

@keyframes winPopup {
    0%   { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
    100% { transform: translate(-50%, -50%) scale(1);   opacity: 1; }
}

.win-label {
    display: block;
    color: var(--gold-bright);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.2rem;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

#win-amount {
    display: block;
    color: var(--gold-bright);
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
    text-shadow: 0 0 1.2rem rgba(240,208,99,0.6);
    font-family: 'Georgia', serif;
}

/* ============ MESSAGE DISPLAY ============ */
#message-display {
    position: absolute;
    bottom: 12rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(5,26,20,0.95);
    padding: 0.5rem 1.4rem;
    border-radius: 0.5rem;
    border: 1px solid var(--gold-soft);
    z-index: 100;
    white-space: nowrap;
}

#message-display.hidden { display: none; }
#message-text { color: var(--text-cream); font-size: 0.8rem; }

/* ============ BET AREA (типи ставок) ============ */
.bet-area {
    width: 100%;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 0.6rem;
    padding: 0.5rem 0.6rem;
    margin: 0.4rem 0 0.3rem;
    display: flex;
    flex-direction: column;
    gap: 0.32rem;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}

.bet-row {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    width: 100%;
}

.row-label {
    flex: 0 0 3.5rem;
    color: var(--text-soft);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.06rem;
    text-transform: uppercase;
}

.row-mult {
    margin-left: auto;
    color: var(--gold-bright);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04rem;
}

.bet-type-btn {
    flex: 1 1 auto;
    height: 1.85rem;
    background: linear-gradient(180deg, rgba(255,255,255,0.06) 0%, rgba(0,0,0,0.2) 100%);
    border: 1px solid rgba(212,175,55,0.25);
    border-radius: 0.4rem;
    color: var(--text-cream);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.03rem;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: 'Georgia', serif;
}

.bet-type-btn:hover:not(:disabled) {
    border-color: var(--gold);
    background: linear-gradient(180deg, rgba(212,175,55,0.18) 0%, rgba(0,0,0,0.15) 100%);
}

.bet-type-btn.active {
    background: linear-gradient(180deg, var(--gold-bright) 0%, var(--gold) 70%, #a8841d 100%);
    color: #1a0d05;
    border-color: var(--gold-bright);
    box-shadow:
        0 0 0.6rem rgba(212,175,55,0.5),
        inset 0 1px 0 rgba(255,255,255,0.4);
}

.bet-type-btn.red {
    background: linear-gradient(180deg, #d83340 0%, var(--pocket-red) 70%, #8a1820 100%);
    border-color: rgba(0,0,0,0.5);
    color: var(--text-cream);
}

.bet-type-btn.black {
    background: linear-gradient(180deg, #2a2a2a 0%, var(--pocket-black) 70%, #000 100%);
    border-color: rgba(212,175,55,0.3);
    color: var(--text-cream);
}

.bet-type-btn.red.active {
    box-shadow: 0 0 0.7rem rgba(198,31,42,0.7), inset 0 0 0 2px var(--gold-bright);
}
.bet-type-btn.black.active {
    box-shadow: 0 0 0.7rem rgba(0,0,0,0.8), inset 0 0 0 2px var(--gold-bright);
}

.bet-type-btn.dozen { flex: 1; font-size: 0.7rem; }

.bet-type-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.number-row {
    align-items: center;
}

.number-input {
    width: 4.2rem;
    height: 1.85rem;
    background: rgba(0,0,0,0.45);
    border: 1px solid var(--gold-soft);
    border-radius: 0.4rem;
    color: var(--gold-bright);
    font-size: 0.85rem;
    font-weight: 700;
    text-align: center;
    font-family: 'Georgia', serif;
    -moz-appearance: textfield;
}

.number-input::-webkit-outer-spin-button,
.number-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.number-input:focus {
    outline: none;
    border-color: var(--gold-bright);
    box-shadow: 0 0 0.4rem rgba(240,208,99,0.4);
}

.bet-type-btn.number-pick {
    flex: 0 0 4.2rem;
}

.selected-info {
    text-align: center;
    color: var(--text-soft);
    font-size: 0.75rem;
    padding-top: 0.2rem;
    border-top: 1px dashed rgba(212,175,55,0.2);
    margin-top: 0.1rem;
}

.selected-info strong {
    color: var(--gold-bright);
    font-weight: 700;
}

/* ============ BET CONTROLS (розмір ставки) ============ */
#bet-controls {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.4rem 0.25rem;
    flex-wrap: wrap;
}

.bet-label {
    color: var(--text-soft);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06rem;
    text-transform: uppercase;
}

.bet-buttons { display: flex; gap: 0.35rem; }

.bet-btn {
    width: 3rem;
    height: 2rem;
    background: linear-gradient(180deg, rgba(255,255,255,0.08) 0%, rgba(0,0,0,0.25) 100%);
    border: 1px solid var(--gold-soft);
    border-radius: 0.35rem;
    color: var(--text-cream);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: 'Georgia', serif;
}

.bet-btn:hover:not(:disabled) {
    border-color: var(--gold);
    background: linear-gradient(180deg, rgba(212,175,55,0.2) 0%, rgba(0,0,0,0.2) 100%);
}

.bet-btn.active {
    background: linear-gradient(180deg, var(--gold-bright) 0%, var(--gold) 70%, #a8841d 100%);
    color: #1a0d05;
    border-color: var(--gold-bright);
    box-shadow:
        0 0 0.6rem rgba(212,175,55,0.45),
        inset 0 1px 0 rgba(255,255,255,0.4);
}

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

.current-bet {
    background: rgba(0,0,0,0.35);
    padding: 0.25rem 0.85rem;
    border-radius: 0.35rem;
    border: 1px solid var(--gold-soft);
}

#current-bet-value {
    color: var(--gold-bright);
    font-size: 1rem;
    font-weight: 700;
    font-family: 'Georgia', serif;
}

/* ============ SPIN BUTTON ============ */
#spin-button {
    width: 11.5rem;
    height: 3.2rem;
    background: linear-gradient(160deg, #2a8a4a 0%, #14633a 55%, #0a3f24 100%);
    border: 2px solid var(--gold);
    border-radius: 1.6rem;
    cursor: pointer;
    box-shadow:
        0 0 0 1px rgba(0,0,0,0.4),
        0 4px 1.2rem rgba(212,175,55,0.35),
        inset 0 1px 0 rgba(255,255,255,0.3),
        inset 0 -2px 6px rgba(0,0,0,0.4);
    transition: all 0.18s ease;
    margin: 0.5rem 0 0.4rem;
}

#spin-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow:
        0 0 0 1px rgba(0,0,0,0.4),
        0 8px 1.8rem rgba(212,175,55,0.6),
        inset 0 1px 0 rgba(255,255,255,0.4);
}

#spin-button:active:not(:disabled) {
    transform: translateY(0);
    box-shadow:
        0 0 0 1px rgba(0,0,0,0.4),
        0 2px 0.6rem rgba(212,175,55,0.25),
        inset 0 -1px 4px rgba(0,0,0,0.4);
}

#spin-button:disabled {
    background: linear-gradient(160deg, #2a2a2a 0%, #1a1a1a 100%);
    border-color: rgba(212,175,55,0.25);
    box-shadow: none;
    cursor: not-allowed;
}

#spin-button.pulse {
    animation: buttonPulse 2s ease-in-out infinite;
}

@keyframes buttonPulse {
    0%, 100% { box-shadow: 0 0 0 1px rgba(0,0,0,0.4), 0 4px 1.2rem rgba(212,175,55,0.35); }
    50%       { box-shadow: 0 0 0 1px rgba(0,0,0,0.4), 0 4px 2.2rem rgba(240,208,99,0.7); }
}

.spin-text {
    color: var(--gold-bright);
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: 0.2rem;
    font-family: 'Georgia', serif;
    text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}

#spin-button:disabled .spin-text {
    color: rgba(212,175,55,0.4);
}

/* ============ GAME TITLE ============ */
.game-title {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    padding: 0.2rem 0 0.4rem;
}

.title-euro {
    color: var(--text-muted);
    font-size: 0.7rem;
    letter-spacing: 0.15rem;
    text-transform: uppercase;
    font-family: 'Georgia', serif;
}

.title-mini {
    color: var(--gold-bright);
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.15rem;
    text-shadow: 0 0 0.7rem rgba(240,208,99,0.45);
    font-family: 'Georgia', serif;
}

/* ============ PARTICLES ============ */
#particles-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1000;
}

.particle {
    position: absolute;
    font-size: 1.2rem;
    animation: particleFall 2s ease-out forwards;
}

@keyframes particleFall {
    0%   { opacity: 1; transform: translateY(0) rotate(0deg) scale(1); }
    100% { opacity: 0; transform: translateY(80vh) rotate(540deg) scale(0.3); }
}

/* ============ RESPONSIVE ============ */
@media (max-width: 25rem) {
    .wheel-outer { width: 15rem; height: 15rem; }
    .bet-type-btn { font-size: 0.7rem; }
    .row-label { flex-basis: 3rem; font-size: 0.6rem; }
    #spin-button { width: 10rem; height: 2.8rem; }
    .spin-text { font-size: 0.95rem; }
}

@media (max-height: 44rem) {
    .wheel-outer { width: 14rem; height: 14rem; }
    .bet-area { padding: 0.3rem 0.5rem; gap: 0.22rem; }
    .bet-type-btn { height: 1.65rem; }
    #spin-button { height: 2.8rem; margin: 0.3rem 0; }
}

/* === clone palette override === */
body { filter: hue-rotate(30deg) saturate(110%); }
