/* --- Modal Base --- */
.modal {
    display: none; 
    position: fixed; 
    z-index: 100; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    overflow: auto; 
    background-color: rgba(0,0,0,0.85); 
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: #222;
    color: #fff;
    margin: 5% auto; 
    padding: 30px;
    border: 2px solid #333;
    width: 600px; 
    max-width: 90%;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.6);
    position: relative;
    text-align: center;
}

.modal-content h1 {
    font-family: 'Fredoka One', cursive;
    color: var(--primary-color);
    margin-bottom: 25px;
    font-size: 32px;
    text-shadow: 2px 2px 0px rgba(0,0,0,0.3);
}

.close {
    color: #666;
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    transition: all 0.2s;
    background: rgba(255,255,255,0.05);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
    padding-bottom: 4px; /* Visual adjustment */
}

.close:hover,
.close:focus {
    color: #fff;
    background: var(--primary-color);
    text-decoration: none;
    cursor: pointer;
    transform: rotate(90deg);
}

/* --- Change Logs Modal --- */
.changelogs-content {
    /* Inherit default modal styles, just override size if needed */
    width: 800px;
    text-align: left;
}

.changelogs-content h1 {
    text-align: center;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 15px;
}

.changelog-layout {
    display: flex;
    gap: 20px;
    height: 400px;
}

#changeLogSidebar {
    width: 150px;
     overflow-y: auto;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    padding-right: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.version-link {
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 5px;
    transition: background 0.2s;
    color: #aaa;
    font-weight: bold;
}

.version-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.version-link.active {
    background: var(--primary-color);
    color: white;
}

#changeLogsList {
    flex: 1;
    overflow-y: auto;
    padding-right: 10px;
}

.changelog-entry h4 {
    color: var(--primary-color);
    font-size: 1.2em;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 5px;
}

.changelog-entry .date {
    font-size: 0.8em;
    color: #888;
    font-weight: normal;
}

.changes-list li {
    margin-bottom: 8px;
    line-height: 1.5;
    color: #ddd;
    position: relative;
    padding-left: 20px;
}

.changes-list li::before {
    content: "•";
    color: var(--primary-color);
    position: absolute;
    left: 0;
    font-weight: bold;
}


/* --- Prestige & Dark Market Modals --- */
#prestigeModal .modal-content,
#darkMarketModal .modal-content {
    /* Ensure they match the default modal style */
    background: linear-gradient(145deg, #1a1a1a, #2d2d2d);
    border: 1px solid #444;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    color: #e0e0e0;
}

#prestigeModal h1,
#darkMarketModal h1 {
    color: #ff5252;
    text-shadow: 0 0 10px rgba(255, 82, 82, 0.5);
}

#prestigeModal p {
    font-size: 18px;
    color: #ccc;
    margin: 15px 0;
}

#prestigeModal hr {
    border-color: #444;
    margin: 20px 0;
}

#prestigeGain {
    font-size: 32px;
    color: #69f0ae; /* Green */
    text-shadow: 0 0 10px rgba(105, 240, 174, 0.3);
    margin: 10px 0 25px;
}

#prestigeBtn {
    background: linear-gradient(to bottom, #ff5252, #d32f2f);
    color: white;
    font-weight: bold;
    font-size: 20px;
    padding: 12px 30px;
    border: 1px solid #b71c1c;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    text-transform: uppercase;
    letter-spacing: 1px;
}

#prestigeBtn:hover {
    background: linear-gradient(to bottom, #ff8a80, #e53935);
    transform: translateY(-2px);
    box-shadow: 0 6px 10px rgba(0,0,0,0.4);
}

#currentSpiceLevel {
    color: #ffd740; /* Gold */
    font-weight: bold;
}

/* --- Offline Modal --- */
#offlineModal .modal-content {
    background: linear-gradient(145deg, #212121, #333);
    border: 2px solid #4caf50;
    box-shadow: 0 0 30px rgba(76, 175, 80, 0.3);
    color: #fff;
}

#offlineModal h1 {
    color: #4caf50;
    font-size: 32px;
    margin-bottom: 20px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

#offlineModal p {
    font-size: 18px;
    color: #ccc;
    margin: 10px 0;
}

#offlineModal #offlineTime {
    color: #fff;
    font-weight: bold;
}

#offlineModal h2 {
    font-size: 48px;
    color: #ffd700;
    margin: 20px 0;
    font-family: 'Fredoka One', cursive;
    text-shadow: 0 4px 8px rgba(0,0,0,0.5);
}

.collect-btn {
    background: linear-gradient(to bottom, #4caf50, #388e3c);
    color: white;
    font-size: 24px;
    padding: 15px 50px;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-family: 'Fredoka One', cursive;
    box-shadow: 0 5px 0 #2e7d32;
    transition: transform 0.1s, box-shadow 0.1s;
    margin-top: 20px;
}

.collect-btn:hover {
    background: linear-gradient(to bottom, #66bb6a, #43a047);
    transform: translateY(-2px);
    box-shadow: 0 7px 0 #2e7d32;
}

.collect-btn:active {
    transform: translateY(5px);
    box-shadow: none;
}

/* --- Casino Modal --- */
.casino-interface {
    background: rgba(0,0,0,0.2);
    padding: 20px;
    border-radius: 10px;
    margin-top: 20px;
}

.casino-display {
    font-size: 48px;
    background: #333;
    color: #fff;
    padding: 10px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    gap: 20px;
    border: 4px solid #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.bet-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

#betAmount, #coinBetAmount {
    padding: 10px;
    font-size: 18px;
    border-radius: 5px;
    border: 1px solid #555;
    background: #222;
    color: #fff;
    width: 100%;
    text-align: center;
    font-family: 'Fredoka One', cursive;
}

.bet-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.bet-buttons button {
    padding: 5px 15px;
    font-size: 14px;
    background: #555;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.bet-buttons button:hover {
    background: #777;
}

.spin-btn {
    background: linear-gradient(to bottom, #ff5252, #d32f2f);
    color: white;
    font-size: 24px;
    padding: 15px 40px;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-family: 'Fredoka One', cursive;
    box-shadow: 0 5px 0 #b71c1c;
    transition: transform 0.1s, box-shadow 0.1s;
    width: 100%;
}

.spin-btn:active {
    transform: translateY(5px);
    box-shadow: none;
}

#casinoResult {
    font-size: 18px;
    font-weight: bold;
    min-height: 24px;
    margin-bottom: 10px;
}

.casino-tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    padding-bottom: 10px;
}

.tab-btn {
    background: transparent;
    border: none;
    padding: 10px 20px;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
}

.tab-btn:hover {
    opacity: 1;
    background: rgba(0,0,0,0.05);
}

.tab-btn.active {
    opacity: 1;
    border-bottom: 3px solid var(--primary-color);
    font-weight: bold;
}

.casino-game {
    display: none;
    animation: fadeIn 0.3s ease;
}

.casino-game.active {
    display: block;
}

/* Coin Flip */
.coin-display {
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 20px 0;
    perspective: 1000px;
}

.coin {
    width: 100px;
    height: 100px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 3s ease-out;
}

.coin .side {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 50px;
    backface-visibility: hidden;
    border: 5px solid #d4af37;
    box-shadow: 0 0 10px rgba(0,0,0,0.3);
}

.coin .heads {
    background: #4caf50; /* Green/Mild */
    transform: rotateY(0deg);
}

.coin .tails {
    background: #f44336; /* Red/Spicy */
    transform: rotateY(180deg);
}

.coin-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 20px;
}

.coin-btn {
    padding: 15px 30px;
    font-size: 18px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.1s;
    font-weight: bold;
    color: white;
}

.coin-btn:hover {
    transform: scale(1.05);
}

.heads-btn { background: #4caf50; }
.tails-btn { background: #f44336; }

body.dark-mode .tab-btn { color: #eee; }
body.dark-mode .tab-btn:hover { background: rgba(255,255,255,0.1); }
