* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
}

body {
    background: #0f172a;
    background-image: radial-gradient(circle at top, #1e293b, #0f172a);
    font-family: 'Fredoka One', 'Roboto', sans-serif;
    color: white;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

#game-container {
    width: 100%;
    max-width: 600px;
    height: 100%;
    max-height: 900px;
    display: flex;
    flex-direction: column;
    position: relative;
    background: url('data:image/svg+xml;utf8,<svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg"><defs><pattern id="grid" width="40" height="40" patternUnits="userSpaceOnUse"><path d="M 40 0 L 0 0 0 40" fill="none" stroke="rgba(255,255,255,0.03)" stroke-width="1"/></pattern></defs><rect width="100%" height="100%" fill="url(%23grid)" /></svg>');
}

/* Header */
#header {
    height: 15%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    z-index: 10;
}

.wallet-display {
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid #fbbf24;
    border-radius: 20px;
    padding: 5px 15px;
    display: flex;
    align-items: center;
    font-size: 20px;
    color: #fbbf24;
    box-shadow: 0 4px 10px rgba(251, 191, 36, 0.2);
}

.title-logo {
    display: flex;
    align-items: center;
}

.logo-img {
    width: 50px;
    height: 50px;
    margin-right: 10px;
    border-radius: 50%;
    box-shadow: 0 0 15px #f59e0b;
}

.title-text {
    font-size: 24px;
    color: #fff;
    text-shadow: 0 2px 4px #000, 0 0 10px #f59e0b;
    letter-spacing: 1px;
}

/* Slot Area */
#slot-area {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    padding: 10px;
}

#grid-container {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(6, 1fr);
    gap: 4px;
    width: 100%;
    aspect-ratio: 1 / 1;
    max-width: 550px;
    max-height: 550px;
    background: rgba(15, 23, 42, 0.8);
    border: 4px solid #334155;
    border-radius: 12px;
    padding: 6px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.8), inset 0 0 20px rgba(0,0,0,0.5);
    position: relative;
}

.cell {
    background: rgba(30, 41, 59, 0.5);
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.3);
}

.symbol {
    width: 85%;
    height: 85%;
    object-fit: contain;
    transition: transform 0.2s ease, opacity 0.3s ease;
    z-index: 2;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.4));
}

/* Animations */
.anim-pop-in {
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes popIn {
    0% { transform: scale(0.2); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.anim-eliminate {
    animation: eliminate 0.3s forwards;
}

@keyframes eliminate {
    0% { transform: scale(1); filter: brightness(1.5); }
    50% { transform: scale(1.2); filter: brightness(2); }
    100% { transform: scale(0); opacity: 0; }
}

.anim-merge {
    animation: mergeToCenter 0.5s forwards;
}

@keyframes mergeToCenter {
    0% { transform: scale(1); z-index: 10; }
    50% { transform: scale(1.1); filter: brightness(1.5); z-index: 10; }
    100% { transform: scale(0); opacity: 0; z-index: 10; }
}

.merged-2x2 {
    position: absolute;
    top: 0;
    left: 0;
    width: calc(200% + 4px);
    height: calc(200% + 4px);
    z-index: 5;
    border-radius: 12px;
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.6);
    pointer-events: none;
    background-size: 100%;
    background-position: center;
    background-repeat: no-repeat;
    background-color: rgba(30, 41, 59, 0.9);
    border: 2px solid #fbbf24;
}

.anim-bomb-explode {
    animation: bombExplode 0.6s forwards;
}

@keyframes bombExplode {
    0% { transform: scale(1); filter: brightness(1) sepia(0); }
    30% { transform: scale(1.2); filter: brightness(1.5) sepia(1) hue-rotate(-50deg); }
    70% { transform: scale(1.5); filter: brightness(2) contrast(2); opacity: 1; }
    100% { transform: scale(2); opacity: 0; filter: blur(4px); }
}

.anim-collect {
    animation: collect 0.6s forwards;
}

@keyframes collect {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); filter: brightness(1.5); }
    100% { transform: scale(0.5) translateY(-50px); opacity: 0; }
}

/* Enhanced Explosion Effects */
.shake {
    animation: shakeAnim 0.4s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shakeAnim {
    0%, 100% { transform: translate3d(0, 0, 0); }
    10%, 90% { transform: translate3d(-5px, -5px, 0) rotate(-1deg); }
    20%, 80% { transform: translate3d(5px, 5px, 0) rotate(1deg); }
    30%, 50%, 70% { transform: translate3d(-10px, 5px, 0) rotate(-2deg); }
    40%, 60% { transform: translate3d(10px, -5px, 0) rotate(2deg); }
}

.anim-blown-away {
    animation: blownAway 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes blownAway {
    0% { transform: scale(1) rotate(0deg); opacity: 1; filter: brightness(2) contrast(2) hue-rotate(-50deg); }
    50% { transform: scale(1.5) rotate(45deg); opacity: 0.8; filter: brightness(3); }
    100% { transform: scale(0) rotate(180deg) translate(50px, -50px); opacity: 0; }
}

.shockwave {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0px;
    height: 0px;
    background: radial-gradient(circle, rgba(255,100,0,0.8) 0%, rgba(255,0,0,0) 70%);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: 100;
    pointer-events: none;
    animation: expandWave 0.5s ease-out forwards;
}

@keyframes expandWave {
    0% { width: 0px; height: 0px; opacity: 1; }
    100% { width: 500px; height: 500px; opacity: 0; }
}

/* Win Overlay */
#win-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    backdrop-filter: blur(3px);
}

#win-overlay.hidden {
    display: none;
}

#win-text {
    font-size: 50px;
    color: #fbbf24;
    text-shadow: 0 0 20px #b45309, 0 4px 0 #78350f;
    margin-bottom: 20px;
    transform: scale(0);
    animation: winTextAnim 0.5s forwards;
}

#win-amount {
    font-size: 60px;
    color: #fff;
    text-shadow: 0 0 30px #f59e0b, 0 5px 0 #b45309;
    transform: scale(0);
    animation: winTextAnim 0.5s 0.2s forwards;
}

@keyframes winTextAnim {
    to { transform: scale(1); }
}

/* Footer */
#footer {
    height: 15%;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0 20px 20px;
}

.bet-controls {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 30px;
    padding: 5px;
    border: 1px solid #475569;
}

.btn-small {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(145deg, #3b82f6, #1d4ed8);
    color: white;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 0 #1e3a8a, 0 5px 10px rgba(0,0,0,0.4);
}

.btn-small:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 #1e3a8a;
}

.bet-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0 15px;
    min-width: 60px;
}

.bet-label {
    font-size: 12px;
    color: #94a3b8;
}

#current-bet {
    font-size: 20px;
    color: #fff;
}

.btn-spin {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    border: 4px solid #fef08a;
    background: linear-gradient(145deg, #f59e0b, #d97706);
    color: white;
    font-size: 22px;
    font-family: 'Fredoka One', cursive;
    cursor: pointer;
    box-shadow: 0 8px 0 #92400e, 0 15px 20px rgba(0,0,0,0.5), inset 0 5px 10px rgba(255,255,255,0.4);
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    transition: all 0.1s;
}

.btn-spin:active {
    transform: translateY(8px);
    box-shadow: 0 0 0 #92400e, 0 5px 10px rgba(0,0,0,0.5), inset 0 5px 10px rgba(255,255,255,0.4);
}
.btn-spin:disabled {
    background: #64748b;
    border-color: #94a3b8;
    box-shadow: 0 8px 0 #334155;
    color: #cbd5e1;
    cursor: not-allowed;
}

.multiplier-fly {
    position: absolute;
    color: #fbbf24;
    font-size: 30px;
    font-weight: bold;
    text-shadow: 0 0 10px #000, 0 2px 2px #b45309;
    z-index: 50;
    pointer-events: none;
    animation: flyUp 1s ease-out forwards;
}

@keyframes flyUp {
    0% { transform: translateY(0) scale(1); opacity: 1; }
    100% { transform: translateY(-50px) scale(1.5); opacity: 0; }
}

.btn-cheat {
    padding: 6px 12px;
    background: #475569;
    border: 1px solid #94a3b8;
    color: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    font-family: 'Fredoka One', 'Roboto', sans-serif;
    transition: background 0.2s;
}

.btn-cheat:hover {
    background: #64748b;
}
