:root {
    --bg-color: #0F1923;
    --sidebar-bg: #1A242D;
    --card-bg: #2C3E50;
    /* A generic dark card color for tiles before reveal */
    --accent-color: #E91E63;
    /* Pinkish red for blaze-like buttons */
    --accent-hover: #D81B60;
    --success-color: #00E701;
    --danger-color: #F12C4C;
    --text-color: #FFFFFF;
    --text-muted: #8B9BB4;
    --tile-size: 80px;
    --gap-size: 10px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.app-container {
    display: flex;
    width: 100%;
    max-width: 1200px;
    height: 90vh;
    background-color: var(--sidebar-bg);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* Sidebar */
.sidebar {
    width: 320px;
    background-color: var(--sidebar-bg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--danger-color);
    margin-bottom: 10px;
}

.brand h1 {
    font-size: 24px;
    font-weight: 800;
    color: white;
    letter-spacing: 2px;
}

.control-group label {
    display: block;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.input-wrapper {
    position: relative;
    background: #0f1923;
    border-radius: 4px;
    border: 1px solid #2f3c4e;
}

.input-wrapper input {
    width: 100%;
    background: transparent;
    border: none;
    padding: 12px 40px 12px 12px;
    color: white;
    font-size: 16px;
    font-weight: bold;
}

.input-wrapper .currency {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.quick-bets {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 5px;
    margin-top: 8px;
}

.quick-bets button {
    background: #2f3c4e;
    border: none;
    color: white;
    padding: 8px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.quick-bets button:hover {
    background: #4a5d75;
    transform: translateY(-1px);
}

.mines-selector {
    display: flex;
    align-items: center;
    background: #0f1923;
    border-radius: 6px;
    border: 1px solid #2f3c4e;
    overflow: hidden;
    height: 44px;
    margin-bottom: 12px;
}

.mines-selector button {
    width: 44px;
    height: 100%;
    background: #2f3c4e;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    transition: background 0.2s;
}

.mines-selector button:hover {
    background: #3e4f63;
}

.mines-selector input {
    flex: 1;
    text-align: center;
    background: transparent;
    border: none;
    color: white;
    font-weight: bold;
    font-size: 16px;
}

.mines-selector input::-webkit-outer-spin-button,
.mines-selector input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="range"] {
    width: 100%;
    accent-color: var(--danger-color);
    cursor: pointer;
}

.btn-primary {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 4px;
    background-color: var(--danger-color);
    color: white;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    text-transform: uppercase;
    transition: background 0.3s, transform 0.1s;
    box-shadow: 0 4px 15px rgba(241, 44, 76, 0.3);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-cashout {
    background-color: var(--success-color);
    box-shadow: 0 4px 15px rgba(0, 231, 1, 0.3);
}

.message-area {
    background: rgba(255, 255, 255, 0.05);
    padding: 10px;
    border-radius: 4px;
    font-size: 14px;
    text-align: center;
    color: #eee;
}

/* Game Area */
.game-area {
    flex: 1;
    background-color: var(--bg-color);
    display: flex;
    flex-direction: column;
    padding: 24px;
    position: relative;
    align-items: center;
    justify-content: center;
}

.top-bar {
    width: 100%;
    display: flex;
    justify-content: space-between;
    margin-bottom: 24px;
    padding: 0 40px;
}

.wallet-display {
    background: #1A242D;
    padding: 10px 20px;
    border-radius: 20px;
    display: flex;
    gap: 10px;
    align-items: center;
    font-weight: bold;
    border: 1px solid #2f3c4e;
}

.current-multiplier {
    background: rgba(0, 231, 1, 0.1);
    color: var(--success-color);
    padding: 10px 20px;
    border-radius: 20px;
    border: 1px solid var(--success-color);
    font-weight: bold;
    box-shadow: 0 0 10px rgba(0, 231, 1, 0.2);
}

.grid-container {
    position: relative;
    padding: 10px;
    background: #1A242D;
    border-radius: 12px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
}

.grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}

.tile {
    width: var(--tile-size);
    height: var(--tile-size);
    background-color: #2f3c4e;
    border-radius: 8px;
    cursor: pointer;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.3s, background-color 0.3s;
    box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.2);
}

.tile:hover:not(.revealed):not(.disabled) {
    background-color: #3e4f63;
    transform: translateY(-2px);
}

.tile.disabled {
    cursor: default;
    pointer-events: none;
    opacity: 0.9;
}

.tile .content {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 32px;
    backface-visibility: hidden;
    transform: scale(0);
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Revealed States */
.tile.revealed.gem {
    background-color: #0f1923;
    border: 2px solid var(--success-color);
    box-shadow: 0 0 15px rgba(0, 231, 1, 0.3);
}

.tile.revealed.bomb {
    background-color: #0f1923;
    border: 2px solid var(--danger-color);
    box-shadow: 0 0 15px rgba(241, 44, 76, 0.3);
}

.tile.revealed .content {
    transform: scale(1);
}

.tile.revealed.safe-inactive {
    opacity: 0.5;
    background-color: #1f2b38;
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    display: none;
}

.history-bar {
    margin-top: auto;
    width: 100%;
    height: 40px;
    display: flex;
    justify-content: center;
    gap: 10px;
    overflow: hidden;
    padding-top: 20px;
}

.history-item {
    padding: 5px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    background: #2f3c4e;
    color: white;
}

.history-item.win {
    background: rgba(0, 231, 1, 0.2);
    color: var(--success-color);
    border: 1px solid var(--success-color);
}

.history-item.loss {
    background: rgba(241, 44, 76, 0.2);
    color: var(--danger-color);
    border: 1px solid var(--danger-color);
}

/* Media Queries for Responsiveness */
@media (max-width: 768px) {
    body {
        height: auto;
        min-height: 100vh;
        overflow-y: auto;
        padding-bottom: 20px;
    }

    .app-container {
        flex-direction: column-reverse;
        /* Game on top, controls below */
        height: auto;
        border-radius: 0;
        box-shadow: none;
    }

    .sidebar {
        width: 100%;
        padding: 20px;
        border-top: 1px solid rgba(255, 255, 255, 0.05);
        border-right: none;
        gap: 16px;
    }

    .game-area {
        height: auto;
        min-height: 60vh;
        padding: 20px;
    }

    .grid {
        gap: 8px;
    }

    :root {
        --tile-size: 14vw;
        /* Responsive tiles on mobile */
    }

    .brand h1 {
        font-size: 20px;
    }

    .top-bar {
        padding: 0 10px;
        font-size: 14px;
        margin-bottom: 20px;
    }

    .wallet-display,
    .current-multiplier {
        padding: 8px 16px;
        font-size: 14px;
    }

    .input-wrapper input,
    .mines-selector input {
        font-size: 14px;
    }

    /* Better touch targets */
    .btn-primary,
    .mines-selector button,
    .quick-bets button {
        min-height: 44px;
    }
}