@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
    /* Paleta kolorów dopasowana do kasyna */
    --primary-color-slots: #2c3e50; 
    --secondary-color-slots: #c8a45d; /* Złoty/musztardowy akcent */
    --accent-color-slots: #e67e22; /* Pomarańczowy dla przycisku SPIN */
    --success-color-slots: #2ecc71; 
    --danger-color-slots: #e74c3c; 
    
    --bg-color-slots: #0f1720; 
    --card-bg-slots: #1a2533; 
    --text-color-slots: #f0f0f0; 
    --muted-text-color-slots: #bdc3c7;

    --border-radius-sm: 8px;
    --border-radius-md: 12px;
    --border-radius-lg: 16px;
    --box-shadow-slots: 0 8px 25px rgba(0,0,0,0.4);
    --transition-speed: 0.3s;
}

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

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-color-slots);
    color: var(--text-color-slots);
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    line-height: 1.6;
}

.slot-machine-container {
    background-color: var(--card-bg-slots);
    padding: 20px 30px;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--box-shadow-slots);
    width: 100%;
    max-width: 700px; 
    text-align: center;
    border: 2px solid var(--secondary-color-slots);
}

.game-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--secondary-color-slots);
}

.game-header h1 {
    color: var(--secondary-color-slots);
    margin-bottom: 15px;
    font-weight: 700;
    font-size: 2.2em;
}

.player-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
    background-color: rgba(255,255,255,0.05);
    padding: 10px;
    border-radius: var(--border-radius-md);
}

.player-stats, .add-coins-controls {
    flex: 1;
    min-width: 200px; 
}
.player-stats {
    text-align: left;
    font-size: 1.1em;
}
#player-coins {
    color: var(--success-color-slots);
    font-weight: 700;
}
.add-coins-controls {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

input[type="number"] {
    padding: 8px 12px;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--secondary-color-slots);
    font-size: 0.9em;
    text-align: center;
    background-color: rgba(255,255,255,0.1);
    color: var(--text-color-slots);
    transition: border-color var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
    width: 80px;
}
input[type="number"]::placeholder { color: var(--muted-text-color-slots); }
input[type="number"]:focus {
    outline: none;
    border-color: var(--accent-color-slots);
    box-shadow: 0 0 0 0.2rem rgba(230,126,34,.25);
}
#add-coins-amount { width: 90px; }

button { 
    padding: 10px 18px;
    border-radius: var(--border-radius-sm);
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9em;
    transition: background-color var(--transition-speed) ease, transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}
button:active{ transform: translateY(0px); }

#add-coins-btn {
    background-color: var(--secondary-color-slots);
    color: var(--bg-color-slots); 
}
#add-coins-btn:hover { background-color: #b08f4d; }

.action-message { font-size: 0.9em; min-height: 1.2em; margin-top: 5px; font-weight: 500; }
.action-message.success { color: var(--success-color-slots); }
.action-message.error { color: var(--danger-color-slots); }

/* Slot Machine Specific Styles */
.slot-main {
    padding: 20px 0;
}

.reels-area {
    display: flex;
    justify-content: center;
    gap: 10px; 
    margin-bottom: 10px;
    background-color: rgba(0,0,0,0.3);
    padding: 15px; 
    border-radius: var(--border-radius-md);
    border: 2px solid var(--secondary-color-slots);
    position: relative;
    overflow: hidden;
}

.reel {
    width: 100px; 
    height: 100px; 
    background-color: #e0e0e0; 
    border: 2px solid #111; 
    border-radius: var(--border-radius-sm);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    box-shadow: inset 0 0 8px rgba(0,0,0,0.6);
}

.symbol-image { 
    width: 88px;  
    height: 88px; 
    object-fit: contain; 
    display: block; 
    animation-duration: 0.08s; 
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}

.reel.spinning .symbol-image { 
    animation-name: spinImageEffect;
}

@keyframes spinImageEffect {
  0% { transform: translateY(-15px) scale(0.9); opacity: 0.6; }
  50% { transform: translateY(0px) scale(1); opacity: 1; }
  100% { transform: translateY(15px) scale(0.9); opacity: 0.6; }
}

.win-line-indicator {
    height: 5px;
    background-color: var(--danger-color-slots);
    /* Szerokość linii dostosowana do 3 bębnów po 100px i 2 odstępów po 10px */
    width: calc(3 * 100px + 2 * 10px); /* = 320px */
    max-width: 90%; /* Niech nie będzie szersza niż 90% kontenera reels-area */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); /* Dokładne centrowanie */
    z-index: 10;
    opacity: 0.7;
    box-shadow: 0 0 10px var(--danger-color-slots);
}


.controls-area {
    margin-top: 25px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.bet-control {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1em;
}
.bet-control label {
    font-weight: 500;
    color: var(--secondary-color-slots);
}

#spin-button {
    background-color: var(--accent-color-slots);
    color: var(--text-color-slots);
    font-size: 1.5em;
    padding: 15px 40px;
    border-radius: var(--border-radius-md);
    font-weight: 700;
    letter-spacing: 2px;
}
#spin-button:hover {
    background-color: #d35400; 
}
#spin-button:disabled {
    background-color: #555;
    color: #999;
    cursor: not-allowed;
}

.message-display {
    font-size: 1.2em;
    font-weight: 500;
    min-height: 1.5em;
    margin-bottom: 20px;
    color: var(--secondary-color-slots);
}
.message-display.win { color: var(--success-color-slots); }
.message-display.lose { color: var(--danger-color-slots); }


.payout-table-container {
    margin-top: 25px;
    padding: 15px;
    background-color: rgba(0,0,0,0.2);
    border-radius: var(--border-radius-md);
    border: 1px solid var(--secondary-color-slots);
}
.payout-table-container h3 {
    color: var(--secondary-color-slots);
    margin-bottom: 10px;
}
#payout-list {
    list-style: none;
    padding: 0;
    font-size: 0.9em; 
    columns: 2; 
    column-gap: 20px;
}
#payout-list li {
    padding: 4px 0; 
    border-bottom: 1px dashed rgba(200, 164, 93, 0.3);
    display: flex; 
    align-items: center; 
    gap: 8px; 
}
#payout-list li:last-child { border-bottom: none; } /* Usuwa linię tylko dla ostatniego elementu globalnie */


#payout-list .payout-symbol-icon { 
    width: 24px;
    height: 24px;
    object-fit: contain;
    vertical-align: middle; 
}
#payout-list .payout-text {
    flex-grow: 1; 
}

#payout-list .payout-value {
    color: var(--success-color-slots);
    font-weight: bold;
    margin-left: auto; 
}


.game-footer {
    margin-top: 30px;
    padding-top: 15px;
    border-top: 1px solid var(--secondary-color-slots);
    font-size: 0.9em;
    color: var(--muted-text-color-slots);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.back-to-menu-btn {
    display: inline-block;
    padding: 10px 20px;
    background-color: var(--secondary-color-slots);
    color: var(--bg-color-slots);
    text-decoration: none;
    border-radius: var(--border-radius-sm);
    font-weight: bold;
}
.back-to-menu-btn:hover { background-color: #b08f4d; }

/* Responsywność */
@media (max-width: 700px) {
    .slot-machine-container { padding: 15px; max-width: 100%; }
    .game-header h1 { font-size: 1.8em; }
    .player-actions { flex-direction: column; gap: 15px; }
    .player-stats, .add-coins-controls { text-align: center; justify-content: center; width: 100%;}
    #payout-list { columns: 1; } 
}

@media (max-width: 450px) { 
    .reels-area { 
        gap: 5px; 
        padding: 10px; 
    }
    .reel { 
        width: 80px; 
        height: 80px; 
    }
    .symbol-image {
        width: 70px;
        height: 70px;
    }
    .win-line-indicator {
        /* Pozostaje pozioma, ale szerokość dopasowana do jednego bębna */
        width: 80px; /* Szerokość bębna */
        max-width: 80%; /* Nie szersza niż 80% .reels-area */
        /* Centrowanie pozostaje takie samo (left: 50%, transform: translate(-50%, -50%)) */
    }
    #spin-button { font-size: 1.3em; padding: 12px 30px; }
}