body {
    background-color: #1a1a1a; /* Dark fallback */
    color: #E0E0E0; /* Light grey for text */
    font-family: 'Roboto', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
    background-image: url('./egyptian_background.png'); /* New Egyptian background */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

#slot-machine {
    background-color: #4A3B2A; /* Dark Sandy Brown / Papyrus background */
    border: 10px solid #DAA520; /* Goldenrod border */
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 0 20px rgba(0,0,0,0.7), inset 0 0 15px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    width: fit-content;
    max-width: 95%;
    position: relative; 
    overflow: visible; 
}

header {
    text-align: center;
    margin-bottom: 20px;
    position: relative;
}

header h1 {
    font-family: 'Contrail One', cursive;
    font-size: 3.5em;
    color: #FFD700; /* Gold */
    text-shadow: 2px 2px #000, 0 0 10px #DAA520, 0 0 20px #B8860B; /* Goldenrod/DarkGoldenrod glow */
    margin: 0;
}

.neon-text {
    font-family: 'Contrail One', cursive;
    text-align: center;
    font-size: 3em;
    visibility: hidden; 
    color: #fff;
    text-shadow: 
        0 0 5px #FFD700, /* Gold */
        0 0 10px #FFD700,
        0 0 20px #DAA520, /* Goldenrod */
        0 0 40px #00BFFF, /* DeepSkyBlue */
        0 0 80px #00BFFF;
    animation: flicker-egyptian-win 1.5s infinite alternate; 
}

#win-announcement.active {
    visibility: visible;
}

@keyframes flicker-egyptian-win { 
    0%, 18%, 22%, 25%, 53%, 57%, 100% {
        text-shadow:
            0 0 4px #FFD700, /* Gold */
            0 0 11px #FFD700,
            0 0 19px #DAA520, /* Goldenrod */
            0 0 40px #00BFFF, /* DeepSkyBlue */
            0 0 80px #00BFFF;
        color: #FFFACD; /* LemonChiffon */
    }
    20%, 24%, 55% {
        text-shadow: none;
        color: #F0E68C; /* Khaki */
    }
}

#reels-area {
    position: relative;
    margin-bottom: 20px;
    background: #3B2F1E; /* Darker brown for reel background */
    padding: 10px;
    border-radius: 10px;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.8);
}

#floating-win-amount {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) translateY(20px); 
    font-family: 'Contrail One', cursive;
    font-size: 4em; 
    color: #FFD700; /* Gold */
    text-shadow: 
        2px 2px 0 #000, 
        0 0 8px #DAA520, /* Goldenrod glow */
        0 0 15px #B8860B, /* DarkGoldenrod glow */
        0 0 25px #B8860B;
    opacity: 0;
    pointer-events: none;
    z-index: 150; 
    white-space: nowrap; 
}

#floating-win-amount.active {
    animation: floatUpAndFade 2.5s forwards ease-out;
}

@keyframes floatUpAndFade {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) translateY(30px) scale(0.8);
    }
    15% { 
        opacity: 1;
        transform: translate(-50%, -50%) translateY(0px) scale(1.1);
    }
    25% { 
        transform: translate(-50%, -50%) translateY(-10px) scale(1);
    }
    80% { 
        opacity: 1;
        transform: translate(-50%, -50%) translateY(-60px) scale(1);
    }
    100% { 
        opacity: 0;
        transform: translate(-50%, -50%) translateY(-100px) scale(0.9);
    }
}

#reels-container {
    display: flex;
    gap: 10px; 
    border: 2px solid #805D2C; /* Brownish gold border */
    padding: 5px;
    background-color: #1C160C; /* Very dark brown/black */
}

.reel {
    display: flex;
    flex-direction: column;
    gap: 10px; 
}

.symbol-slot {
    width: 80px;
    height: 80px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    border: 2px solid #B8860B; /* DarkGoldenrod border for symbols */
    border-radius: 5px;
    background-color: #5C4033; /* Dark Brown, like aged stone/wood */
    box-shadow: inset 0 0 5px rgba(0,0,0,0.5);
    transition: transform 0.1s ease-out, box-shadow 0.3s ease;
}

.symbol-slot.spinning {
    opacity: 0.7;
}

.symbol-slot.landed {
    transform: scale(1.1);
    animation: land-bounce 0.3s;
}

@keyframes land-bounce {
    0% { transform: scale(1.0); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1.0); }
}

.symbol-slot.winning-highlight {
    box-shadow: 0 0 10px 3px #FFD700, 0 0 20px 6px #FFD700, inset 0 0 5px #FFD700; /* Gold glow */
    border-color: #FFD700;
}

.symbol-slot.winning-highlight.symbol-win-animation {
    animation: winningSymbolShimmer 1.5s ease-out;
}

@keyframes winningSymbolShimmer { /* Changed from winningSymbolPop */
    0% {
        transform: scale(1.0);
        filter: brightness(100%);
    }
    20% { /* Start of "shimmer" */
        transform: scale(1.35);
        filter: brightness(180%) drop-shadow(0 0 6px #FFFACD) drop-shadow(0 0 12px #FFD700); /* LemonChiffon, Gold */
    }
    40% { /* Peak of shimmer */
        transform: scale(1.2);
        filter: brightness(150%) drop-shadow(0 0 4px #FFFACD) drop-shadow(0 0 10px #DAA520); /* Goldenrod */
    }
    70% { /* Settling back */
        transform: scale(1.05);
        filter: brightness(120%);
    }
    100% { /* Return to normal scale, brightness controlled by .winning-highlight or default */
        transform: scale(1.0);
        filter: brightness(100%);
    }
}

#payline-overlay {
    position: absolute;
    top: 15px; 
    left: 15px; 
    pointer-events: none; 
    overflow: visible; 
}

.payline-path {
    stroke-width: 4px;
    fill: none;
    stroke: rgba(218, 165, 32, 0.3); /* Dim Goldenrod */
    transition: stroke 0.3s ease, filter 0.3s ease;
}

.payline-path.win-active {
    stroke-width: 5px; 
}

#controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
    width: 100%;
    max-width: 600px; 
    padding: 15px;
    background-color: #604C38; /* Lighter brown for control panel */
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0,0,0,0.6);
}

.control-panel {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 10px;
}

.info-display {
    background-color: #3B2F1E; /* Darker brown */
    padding: 8px 12px;
    border-radius: 5px;
    font-size: 0.9em;
    text-align: center;
    min-width: 100px;
    color: #F0E68C; /* Khaki text */
}

.info-display span:first-child {
    font-weight: bold;
    margin-right: 5px;
    color: #FFD700; /* Gold for labels */
}

.action-panel {
    display: flex;
    justify-content: space-around;
    align-items: center;
    gap: 20px;
}

#bet-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

#bet-controls span {
    font-size: 1.2em;
    font-weight: bold;
    color: #FFD700; /* Gold for BET text */
}

.control-button {
    font-family: 'Contrail One', cursive; 
    background-color: #8B4513; /* SaddleBrown */
    color: #FFFACD; /* LemonChiffon text */
    border: 2px solid #5C2E00; /* Darker brown border */
    padding: 10px 20px;
    font-size: 1.5em;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 4px #4A2500; /* Darker brown shadow */
    transition: all 0.1s ease;
}

.control-button:hover {
    background-color: #A0522D; /* Sienna */
}

.control-button:active {
    background-color: #7A3C10; /* Darker active brown */
    box-shadow: 0 2px #4A2500;
    transform: translateY(2px);
}

.control-button:disabled {
    background-color: #786D5F; /* Greyish Brown disabled */
    color: #BDB7AB; /* Lighter greyish brown text */
    cursor: not-allowed;
    box-shadow: 0 4px #50483B;
}

#spin-button {
    padding: 15px 30px;
    font-size: 2em;
    background-color: #006400; /* DarkGreen */
    color: #FFD700; /* Gold text */
    border-color: #004D00; /* Darker green border */
    box-shadow: 0 4px #003300; /* Darker green shadow */
}
#spin-button:hover { background-color: #007A00; }
#spin-button:active { background-color: #005600; box-shadow: 0 2px #003300; }
#spin-button:disabled { background-color: #003300; color: #B8860B; box-shadow: 0 4px #002000;}

#payout-table-container {
    margin-top: 10px;
    background-color: #604C38; /* Lighter brown, same as controls */
    padding: 15px;
    border-radius: 10px;
    width: 100%;
    max-width: 600px;
    box-shadow: 0 0 10px rgba(0,0,0,0.6);
}

#payout-table-container h2 {
    font-family: 'Contrail One', cursive; 
    text-align: center;
    color: #FFD700; /* Gold */
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.3em; 
}

#payout-table {
    width: 100%;
    border-collapse: collapse;
    background-color: #805D2C; /* Brownish gold for table background */
    color: #FFFACD; /* LemonChiffon text on table */
    border-radius: 5px;
    overflow: hidden; 
}

#payout-table th, #payout-table td {
    border: 1px solid #4A3B2A; /* Dark Sandy Brown border */
    padding: 5px; 
    text-align: center;
    font-size: 0.9em; 
}

#payout-table th {
    background-color: #5C4033; /* Dark Brown Header background */
    color: #FFD700; /* Gold text for headers */
    font-family: 'Contrail One', cursive; 
    font-size: 1em; 
}

#payout-table td:first-child { 
    font-weight: bold;
    color: #FFFACD; /* LemonChiffon for symbol name column */
    display: flex;
    align-items: center;
    justify-content: flex-start; /* Align items to the start of the cell */
    gap: 5px; /* Space between image and text */
}

.symbol-cell-in-table img {
    width: 100px; 
    height: 100px; 
    vertical-align: middle;
    margin-right: 4px; 
}

/* Neon border styles */
.neon-border {
    position: absolute;
    background-color: #FFD700; /* Gold neon color */
    opacity: 0;
    transition: opacity 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
    border-radius: 2px;
    z-index: 0; 
    pointer-events: none;
}

#slot-machine.has-win .neon-border {
    opacity: 1;
    animation: neon-border-flicker-gold 1.5s infinite alternate; 
}

/* Centering 4px thick bars on the 10px border of #slot-machine */
.neon-top {
    top: -12px; 
    left: -12px;
    width: calc(100% + 24px); 
    height: 4px;
}
.neon-bottom {
    bottom: -12px;
    left: -12px;
    width: calc(100% + 24px);
    height: 4px;
}
.neon-left {
    top: -12px;
    left: -12px;
    width: 4px;
    height: calc(100% + 24px);
}
.neon-right {
    top: -12px;
    right: -12px;
    left: auto; 
    width: 4px;
    height: calc(100% + 24px);
}

@keyframes neon-border-flicker-gold { 
  0%, 18%, 22%, 25%, 53%, 57%, 100% {
    box-shadow: 0 0 4px #FFD700, 0 0 8px #FFD700, 0 0 12px #DAA520, 0 0 16px #DAA520; /* Gold and Goldenrod */
    background-color: #FFFACD; /* LemonChiffon - brighter gold */
  }
  20%, 24%, 55% {
    box-shadow: 0 0 2px #B8860B, 0 0 4px #B8860B; /* DarkGoldenrod */
    background-color: #FFD700; /* Dimmer gold */
  }
}

/* Responsive adjustments */
@media (max-width: 700px) {
    body { padding: 10px; }
    #slot-machine { padding: 10px; }
    header h1 { font-size: 2.5em; }
    .symbol-slot { width: 60px; height: 60px; }
    #controls, #payout-table-container { max-width: none; }
    .control-panel { flex-direction: column; align-items: stretch;}
    .info-display { font-size: 0.8em; }
    .control-button { font-size: 1.2em; padding: 8px 15px; }
    #spin-button { font-size: 1.5em; padding: 12px 25px; }
    #payout-table th, #payout-table td { padding: 4px; font-size: 0.8em; } /* Further reduced for small screens */
    .symbol-cell-in-table img { 
        width: 30px; 
        height: 30px; 
    }
    #floating-win-amount {
        font-size: 3em; /* Responsive font size for floating win */
    }
}

@media (max-width: 450px) {
    header h1 { font-size: 2em; }
    .neon-text { font-size: 2.5em; } /* Make WIN text smaller */
    .symbol-slot { width: 45px; height: 45px; }
    #reels-container, #reels-area { padding: 5px; }
    #reels-container { gap: 5px; }
    .reel { gap: 5px; }
    .info-display { padding: 5px 8px; }
    .action-panel { flex-direction: column; gap: 10px; }
    #bet-controls {  width: 100%; justify-content: center; }
    #spin-button { width: 100%; }
    #payout-table th, #payout-table td { font-size: 0.7em; padding: 3px; } /* Further reduced */
    .symbol-cell-in-table img { 
        width: 25px; 
        height: 25px; 
    }
    #floating-win-amount {
        font-size: 2.2em; /* Further responsive font size */
    }
    #payline-overlay {
        top: -40px;
        left: 0px;
        width: -webkit-fill-available;
    }
}

td img {
    height: 80px;
}