body {
    background: radial-gradient(circle, #4a0e60, #1e0328);
    color: white;
    font-family: 'Staatliches', cursive;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    overflow: hidden;
    user-select: none;
}

#game-wrapper {
    background: linear-gradient(145deg, #c0c0c0, #8d8d8d);
    border: 10px solid #ffd700;
    border-radius: 20px;
    padding: 20px;
    box-shadow: inset 0 0 15px rgba(0,0,0,0.5), 0 0 30px rgba(255, 255, 100, 0.6), 0 10px 20px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 90vw;
    max-width: 500px;
    position: relative;
}

#slots-game, #poker-game {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

#slots-game.hidden, #poker-game.hidden {
    display: none;
}

@keyframes machine-win-glow {
    0%, 100% { border-color: #ffd700; box-shadow: inset 0 0 15px rgba(0,0,0,0.5), 0 0 30px rgba(255, 255, 100, 0.6), 0 10px 20px rgba(0,0,0,0.5); }
    50% { border-color: #fff; box-shadow: inset 0 0 15px rgba(0,0,0,0.5), 0 0 50px rgba(255, 255, 255, 1), 0 10px 20px rgba(0,0,0,0.5), 0 0 40px #ffd700; }
}

@keyframes machine-shake {
    0% { transform: translate(1px, 1px) rotate(0deg); }
    10% { transform: translate(-1px, -2px) rotate(-0.2deg); }
    20% { transform: translate(-3px, 0px) rotate(0.2deg); }
    30% { transform: translate(3px, 2px) rotate(0deg); }
    40% { transform: translate(1px, -1px) rotate(0.2deg); }
    50% { transform: translate(-1px, 2px) rotate(-0.2deg); }
    60% { transform: translate(-3px, 1px) rotate(0deg); }
    70% { transform: translate(3px, 1px) rotate(-0.2deg); }
    80% { transform: translate(-1px, -1px) rotate(0.2deg); }
    90% { transform: translate(1px, 2px) rotate(0deg); }
    100% { transform: translate(0, 0) rotate(0deg); }
}

#game-wrapper.shake {
    animation: machine-shake 0.3s cubic-bezier(.36,.07,.19,.97) both;
}

#game-wrapper.win-glow {
    animation: machine-win-glow 0.5s ease-in-out 2;
}

.top-bar {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 5px;
}

.top-bar button {
    background: linear-gradient(to bottom, #4a0e60, #1e0328);
    color: #ffd700;
    border: 2px solid #ffd700;
    border-radius: 5px;
    padding: 5px 10px;
    font-family: 'Staatliches', cursive;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 2px #111;
    transition: all 0.1s ease;
    white-space: nowrap;
}

.top-bar button:active {
    transform: scale(0.95);
    box-shadow: 0 0px #111;
}

#shop-btn {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
}

#switch-game-btn {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
}

.top-bar h1 {
    text-align: center;
    color: #1e0328;
    text-shadow: 1px 1px 0px #fff, 2px 2px 0px #ffd700;
    margin: 0;
    font-size: 2.5rem;
    letter-spacing: 2px;
}

.reels-container {
    display: flex;
    justify-content: space-around;
    background: #111;
    border: 5px solid #333;
    border-radius: 10px;
    padding: 10px;
    overflow: hidden;
    position: relative;
    height: 120px;
    box-shadow: inset 0 0 10px #000;
}

.payout-line {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 4px;
    background: radial-gradient(circle, rgba(255,0,0,1) 0%, rgba(255,0,0,0) 70%);
    transform: translateY(-50%);
    z-index: 10;
    pointer-events: none;
}

.reel {
    width: 30%;
    background-color: #f0f0f0;
    overflow: hidden;
    position: relative;
    height: 100%;
    border-radius: 5px;
    border: 1px solid #555;
}

.reel-strip {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    transition: top 2s cubic-bezier(0.32, 0, 0.07, 1);
}

.symbol {
    width: 100%;
    height: 120px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 5rem;
}

.symbol img {
    max-width: 75%;
    max-height: 75%;
    filter: drop-shadow(2px 2px 3px rgba(0,0,0,0.3));
    transition: transform 0.2s ease-in-out;
}

.symbol.near-miss img {
    animation: near-miss-shake 0.5s cubic-bezier(.36,.07,.19,.97);
}

@keyframes near-miss-shake {
    10%, 90% { transform: translateX(-1px); }
    20%, 80% { transform: translateX(2px); }
    30%, 50%, 70% { transform: translateX(-4px); }
    40%, 60% { transform: translateX(4px); }
}

.controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.status-display {
    font-family: 'Roboto Condensed', sans-serif;
    display: flex;
    justify-content: space-around;
    width: 100%;
    background: #222;
    padding: 10px;
    border-radius: 5px;
    border: 2px solid #555;
    box-shadow: inset 0 0 5px #000;
}

.display-box {
    text-align: center;
    width: 30%;
}

.display-box span {
    font-size: 1rem;
    color: #ccc;
    font-family: 'Staatliches', cursive;
    letter-spacing: 1px;
}

.display-box p {
    margin: 5px 0 0;
    font-size: 2rem;
    color: #32cd32;
    text-shadow: 0 0 8px #32cd32, 0 0 10px #32cd32;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: transform 0.2s ease-in-out, color 0.2s, text-shadow 0.2s;
}

.display-box p.negative {
    color: #ff4141;
    text-shadow: 0 0 8px #ff4141, 0 0 10px #ff4141;
}

.display-box p.change-up {
    animation: update-creds-up 0.4s ease-out;
}
.display-box p.change-down {
    animation: update-creds-down 0.4s ease-out;
}

@keyframes update-creds-up {
    0% { transform: translateY(0) scale(1); color: #32cd32; }
    50% { transform: translateY(-10px) scale(1.2); color: #ffff00; }
    100% { transform: translateY(0) scale(1); color: #32cd32; }
}

@keyframes update-creds-down {
    0% { transform: translateY(0) scale(1); color: #32cd32; }
    50% { transform: translateY(10px) scale(1.2); color: #ff4141; }
    100% { transform: translateY(0) scale(1); color: #32cd32; }
}

@keyframes win-display-flash {
    0%, 100% { color: #32cd32; text-shadow: 0 0 8px #32cd32, 0 0 10px #32cd32; transform: scale(1); }
    50% { color: #ffff00; text-shadow: 0 0 15px #ffff00, 0 0 20px #ffff00; transform: scale(1.2); }
}

#win-display.flash {
    animation: win-display-flash 0.5s ease-in-out 2;
}

.bet-controls {
    display: flex;
    gap: 10px;
}

.bet-controls button {
    font-size: 1.5rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid #333;
    background: linear-gradient(145deg, #888, #555);
    color: white;
    cursor: pointer;
    box-shadow: 0 4px #333;
    transition: all 0.1s ease;
}

.bet-controls button:disabled {
    background: #666;
    color: #aaa;
    cursor: not-allowed;
    box-shadow: 0 4px #444;
}

.bet-controls button:active:not(:disabled) {
    transform: translateY(4px);
    box-shadow: 0 0px #333;
}

.main-controls {
    display: flex;
    width: 100%;
    justify-content: center;
    gap: 10px;
}

@keyframes spin-btn-glow {
    0%, 100% { box-shadow: 0 5px #600, 0 0 5px rgba(255,255,255,0); }
    50% { box-shadow: 0 5px #600, 0 0 20px rgba(255,255,255,0.7); }
}

#spin-btn {
    flex-grow: 2;
    padding: 15px 20px;
    font-size: 2.2rem;
    letter-spacing: 3px;
    color: white;
    background: linear-gradient(to bottom, #ff4141, #c00);
    border: 3px solid #800;
    border-radius: 10px;
    cursor: pointer;
    text-shadow: 1px 1px 2px #000;
    box-shadow: 0 5px #600;
    transition: all 0.1s ease;
}

#spin-btn:not(:disabled) {
    animation: spin-btn-glow 2s infinite ease-in-out;
}

#spin-btn:active:not(:disabled) {
    transform: translateY(5px);
    box-shadow: 0 0px #600;
}

#spin-btn:disabled {
    background: #555;
    color: #999;
    cursor: not-allowed;
    box-shadow: 0 5px #333;
}

#autoplay-btn {
    flex-grow: 1;
    padding: 15px 20px;
    font-size: 2.2rem;
    letter-spacing: 3px;
    color: white;
    background: linear-gradient(to bottom, #4f4f4f, #2b2b2b);
    border: 3px solid #1a1a1a;
    border-radius: 10px;
    cursor: pointer;
    text-shadow: 1px 1px 2px #000;
    box-shadow: 0 5px #111;
    transition: all 0.1s ease;
}

#autoplay-btn:active:not(:disabled) {
    transform: translateY(5px);
    box-shadow: 0 0px #111;
}

#autoplay-btn.active {
    background: linear-gradient(to bottom, #4CAF50, #388E3C);
    border-color: #1B5E20;
    box-shadow: 0 5px #14502e, inset 0 0 10px rgba(255,255,255,0.3);
}

#game-over {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    transition: opacity 0.5s;
}

#game-over.hidden {
    opacity: 0;
    pointer-events: none;
}

#game-over h2 {
    font-size: 4rem;
    color: #ff4141;
    text-shadow: 0 0 10px #ff0000;
}

#game-over p {
    font-size: 1.5rem;
}

#reset-btn {
    padding: 10px 30px;
    font-size: 1.5rem;
    background: linear-gradient(to bottom, #ffd700, #daa520);
    color: #1e0328;
    border: 2px solid #8B4513;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 20px;
}

#debt-warning {
    position: absolute;
    bottom: -60px; /* Start off-screen */
    left: 50%;
    transform: translateX(-50%);
    background: rgba(200, 0, 0, 0.8);
    color: white;
    padding: 10px 20px;
    border-radius: 10px;
    border: 2px solid #ff0;
    text-align: center;
    font-family: 'Roboto Condensed', sans-serif;
    z-index: 101;
    opacity: 0;
    transition: all 0.5s ease-in-out;
    width: 80%;
    box-shadow: 0 0 15px #f00;
}

#debt-warning.visible {
    bottom: 20px;
    opacity: 1;
}

.symbol.winning img {
    animation: pulse-win 0.8s ease-in-out 3;
}

@keyframes pulse-win {
    0% { transform: scale(1); filter: drop-shadow(2px 2px 3px rgba(0,0,0,0.3)); }
    50% { transform: scale(1.15); filter: drop-shadow(2px 2px 10px rgba(255, 255, 0, 0.8)); }
    100% { transform: scale(1); filter: drop-shadow(2px 2px 3px rgba(0,0,0,0.3)); }
}

/* --- SHOP STYLES --- */
#shop-modal {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    transition: opacity 0.3s;
    font-family: 'Roboto Condensed', sans-serif;
    padding: 20px;
}

#shop-modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.shop-content {
    background: linear-gradient(145deg, #4a0e60, #1e0328);
    border: 4px solid #ffd700;
    border-radius: 15px;
    padding: 20px;
    width: 100%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.shop-content h2 {
    font-family: 'Staatliches', cursive;
    font-size: 2rem;
    color: #ffd700;
    text-shadow: 1px 1px 2px #000;
    margin: 0;
}

.shop-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 40vh;
    overflow-y: auto;
    padding-right: 10px;
}

.shop-items::-webkit-scrollbar {
    width: 8px;
}

.shop-items::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.3);
    border-radius: 4px;
}

.shop-items::-webkit-scrollbar-thumb {
    background: #ffd700;
    border-radius: 4px;
}

.shop-item {
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 10px;
    border: 1px solid rgba(255,255,255,0.2);
}

.shop-item h3 {
    margin: 0 0 5px;
    color: #fff;
    font-family: 'Staatliches', cursive;
    letter-spacing: 1px;
}
.shop-item p {
    margin: 0;
    font-size: 0.9rem;
    color: #ddd;
}
.shop-item-cost {
    font-weight: bold;
    color: #ffd700 !important;
    margin-top: 5px !important;
}
.buy-btn {
    margin-top: 10px;
    padding: 8px 15px;
    background: linear-gradient(to bottom, #4CAF50, #388E3C);
    color: white;
    border: 2px solid #1B5E20;
    border-radius: 5px;
    cursor: pointer;
    font-family: 'Staatliches', cursive;
    font-size: 1rem;
    transition: transform 0.1s;
}
.buy-btn:hover:not(:disabled) {
    transform: scale(1.05);
}
.buy-btn:disabled {
    background: #555;
    color: #999;
    cursor: not-allowed;
    border-color: #333;
}

#luck-boost-status {
    background: rgba(0,0,0,0.3);
    padding: 8px;
    border-radius: 5px;
    font-size: 0.9rem;
}

#close-shop-btn {
    padding: 10px 20px;
    background: linear-gradient(to bottom, #ff4141, #c00);
    color: white;
    border: 2px solid #800;
    border-radius: 5px;
    cursor: pointer;
    font-family: 'Staatliches', cursive;
    font-size: 1.2rem;
}

/* --- POKER STYLES --- */
#poker-payout-table {
    background: #222;
    border: 2px solid #555;
    border-radius: 5px;
    padding: 5px;
    box-shadow: inset 0 0 5px #000;
    font-family: 'Roboto Condensed', sans-serif;
    font-size: 0.8rem;
    position: relative;
}
#poker-payout-table table {
    width: 100%;
    border-collapse: collapse;
}
#poker-payout-table th, #poker-payout-table td {
    padding: 2px 5px;
    text-align: left;
}
#poker-payout-table th {
    text-align: center;
    color: #ffd700;
    font-family: 'Staatliches', cursive;
    font-size: 1.1rem;
    letter-spacing: 1px;
}
#poker-payout-table td:last-child {
    text-align: right;
    font-weight: bold;
    color: #32cd32;
}
#poker-payout-table .win-highlight {
    background-color: #ffd700;
    color: #000;
    animation: win-highlight-flash 1s 2;
}
@keyframes win-highlight-flash {
    50% { background-color: #fff; color: #000; }
}
#poker-hand-result {
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    background: rgba(0,0,0,0.7);
    padding: 2px 15px;
    border-radius: 10px;
    font-family: 'Staatliches', cursive;
    font-size: 1.2rem;
    letter-spacing: 1px;
    color: #ffff00;
    text-shadow: 0 0 5px #ff0;
}
#poker-hand {
    display: flex;
    justify-content: center;
    gap: 10px;
    height: 120px;
}
.card {
    width: 18%;
    height: 100%;
    background: #fff;
    border: 1px solid #aaa;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.2rem;
    font-family: 'Arial', sans-serif;
    font-weight: bold;
    color: #000;
    position: relative;
    cursor: pointer;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.3);
    transition: transform 0.2s, box-shadow 0.2s;
}
.card.red {
    color: #D60000;
}
.card.held {
    transform: translateY(-10px);
    box-shadow: 2px 12px 10px rgba(0,0,0,0.4), 0 0 10px #ffd700;
    border-color: #ffd700;
}
.card.held::after {
    content: 'HELD';
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    background: #ffd700;
    color: #000;
    padding: 1px 8px;
    border-radius: 5px;
    font-size: 0.8rem;
    font-family: 'Staatliches', cursive;
}
.card-back {
    background: repeating-linear-gradient(
      45deg,
      #600000,
      #600000 10px,
      #700000 10px,
      #700000 20px
    );
    cursor: default;
}

#deal-draw-btn {
    width: 100%;
    padding: 15px 20px;
    font-size: 2.2rem;
    letter-spacing: 3px;
    color: white;
    background: linear-gradient(to bottom, #4CAF50, #388E3C);
    border: 3px solid #1B5E20;
    border-radius: 10px;
    cursor: pointer;
    text-shadow: 1px 1px 2px #000;
    box-shadow: 0 5px #14502e;
    transition: all 0.1s ease;
}

#deal-draw-btn:active:not(:disabled) {
    transform: translateY(5px);
    box-shadow: 0 0px #14502e;
}

#deal-draw-btn:disabled {
    background: #555;
    color: #999;
    cursor: not-allowed;
    box-shadow: 0 5px #333;
}