:root {
    --bg-dark: #0f111a;
    --panel-bg: #1a1d2d;
    --accent-cyan: #00f3ff;
    --accent-pink: #ff0055;
    --accent-green: #00ff9d;
    --text-main: #ffffff;
    --text-muted: #8b8e99;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    min-height: 100vh;
}

.game-wrapper {
    width: 100%;
    max-width: 1200px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.back-btn {
    position: fixed;
    top: 10px;
    left: 10px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    z-index: 100;
}
.back-btn:hover { color: white; }

.main-layout {
    display: flex;
    gap: 15px;
    height: 600px;
}

/* Control Panel */
.control-panel {
    width: 300px;
    background-color: var(--panel-bg);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.balance-box {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--accent-cyan);
    text-shadow: 0 0 10px rgba(0, 243, 255, 0.5);
    text-align: center;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.input-group label, .setting-group label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.bet-input-row, .mines-control {
    display: flex;
    background: #0f1014;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #333;
    margin-bottom: 10px;
}
.bet-input-row button, .mines-control button {
    background: #2a2c36;
    border: none;
    color: white;
    width: 40px;
    cursor: pointer;
    font-size: 1.2rem;
}
.bet-input-row input, .mines-control input {
    flex: 1;
    background: transparent;
    border: none;
    color: white;
    text-align: center;
    font-size: 1.1rem;
    font-weight: bold;
    outline: none;
}

.quick-bets {
    display: flex;
    gap: 5px;
}
.quick-bets button {
    flex: 1;
    background: #2a2c36;
    border: none;
    color: var(--text-muted);
    padding: 8px 0;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: 0.2s;
}
.quick-bets button:hover { background: #3a3c46; color: white; }

.stats-box {
    background: rgba(0,0,0,0.3);
    padding: 15px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--text-muted);
}
.stat-row .highlight { color: var(--accent-cyan); font-weight: bold; }
.stat-row .profit { color: var(--accent-green); font-weight: bold; text-shadow: 0 0 5px rgba(0, 255, 157, 0.5); }

.action-btn {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 8px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.2s;
    margin-top: auto;
}

.start-btn {
    background: linear-gradient(135deg, var(--accent-green), #00cc6a);
    color: #000;
    box-shadow: 0 4px 15px rgba(0, 255, 157, 0.4);
}
.start-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0, 255, 157, 0.6); }

.cashout-btn {
    background: linear-gradient(135deg, var(--accent-pink), #ff00aa);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 0, 85, 0.4);
}
.cashout-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(255, 0, 85, 0.6); }

.action-btn:disabled {
    background: #333;
    color: #666;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

.message {
    text-align: center;
    font-weight: bold;
    min-height: 1.2em;
    font-size: 0.9rem;
}
.message.win { color: var(--accent-green); text-shadow: 0 0 10px var(--accent-green); }
.message.lose { color: var(--accent-pink); text-shadow: 0 0 10px var(--accent-pink); }

/* Game Grid */
.stage-container {
    flex: 1;
    background-color: var(--panel-bg);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: inset 0 0 50px rgba(0,0,0,0.5);
}

.grid-wrapper {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    width: 100%;
    max-width: 500px;
    aspect-ratio: 1;
}

.tile {
    background: #2a2c36;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 0 #1a1c24;
    user-select: none;
}

.tile:hover:not(.revealed):not(.disabled) {
    background: #3a3c46;
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #1a1c24;
}

.tile:active:not(.revealed):not(.disabled) {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #1a1c24;
}

.tile.revealed {
    cursor: default;
    transform: none;
    box-shadow: none;
}

.tile.gem {
    background: rgba(0, 243, 255, 0.2);
    border: 2px solid var(--accent-cyan);
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.5), inset 0 0 10px rgba(0, 243, 255, 0.3);
    animation: popIn 0.3s ease;
}

.tile.mine {
    background: rgba(255, 0, 85, 0.2);
    border: 2px solid var(--accent-pink);
    box-shadow: 0 0 15px rgba(255, 0, 85, 0.5), inset 0 0 10px rgba(255, 0, 85, 0.3);
    animation: shake 0.4s ease;
}

.tile.disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

@keyframes popIn {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}