* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    background:
        radial-gradient(circle at 20% 0%, rgba(186, 104, 200, 0.25), transparent 50%),
        radial-gradient(circle at 80% 100%, rgba(255, 80, 80, 0.18), transparent 50%),
        linear-gradient(135deg, #15131f 0%, #1c1a2b 60%, #1a1a2e 100%);
    height: 100vh;
    height: 100dvh;
    padding: 10px;
    color: #fff;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.user-bar { margin: 0 auto 12px; }

.mines-game {
    max-width: 460px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
}

.mines-status {
    display: flex;
    justify-content: space-between;
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
}
.mn-multi { color: #ffd980; font-size: 16px; font-weight: 700; }

.mines-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 5px;
    width: 100%;
    aspect-ratio: 1;
    padding: 5px;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    container-type: inline-size;
}
.mn-cell {
    aspect-ratio: 1;
    border-radius: 9px;
    background: linear-gradient(135deg, #4a4e69, #22223b);
    border: 1px solid rgba(255,255,255,0.10);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8.5cqi;
    font-weight: 800;
    user-select: none;
    -webkit-touch-callout: none;
    transition: background 0.2s, transform 0.15s;
    color: #fff;
}
.mn-cell:hover  { background: linear-gradient(135deg, #5a5e79, #2a224b); }
.mn-cell:active { transform: scale(0.95); }
.mn-cell.pending { opacity: 0.5; pointer-events: none; }
.mn-cell.flag   { background: linear-gradient(135deg, #5c4a7a, #2b2340); }
/* Флажок, который действительно стоял на мине — подсвечиваем в конце раунда */
.mn-cell.flag-ok { background: linear-gradient(135deg, #66bb6a, #2e7d32); pointer-events: none; }

/* Открытая клетка: цифра = сколько мин в 8 соседних, пусто = ни одной */
.mn-cell.open {
    background: rgba(0,0,0,0.32);
    border-color: rgba(255,255,255,0.05);
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.35);
    pointer-events: none;
    animation: pop 0.18s ease-out;
}
.mn-cell.open.n0 { background: rgba(0,0,0,0.42); }
.mn-cell.n1 { color: #64b5f6; }
.mn-cell.n2 { color: #81c784; }
.mn-cell.n3 { color: #ef5b5b; }
.mn-cell.n4 { color: #ba68c8; }
.mn-cell.n5 { color: #ffb74d; }
.mn-cell.n6 { color: #4dd0e1; }
.mn-cell.n7 { color: #f06292; }
.mn-cell.n8 { color: #e0e0e0; }

.mn-cell.mine   { background: linear-gradient(135deg, #ef5b5b, #c62828); color: #fff; pointer-events: none; animation: shake 0.4s; }
.mn-cell.disabled { pointer-events: none; opacity: 0.6; }
.mn-cell.revealed-mine { background: linear-gradient(135deg, #c62828, #7b1f1f); color: #fff; opacity: 0.4; }
@keyframes pop {
    from { transform: scale(0.82); opacity: 0.4; }
    to   { transform: scale(1);    opacity: 1; }
}
@keyframes shake {
    0%, 100% { transform: scale(1); }
    25% { transform: scale(1.15) translateX(-3px); }
    75% { transform: scale(1.15) translateX(3px); }
}

.mines-label {
    width: 100%;
    font-size: 13px;
    font-weight: 600;
    color: rgba(255,255,255,0.7);
    padding-left: 4px;
}
.mn-max { color: #ffd980; font-weight: 700; }
.mines-hint {
    width: 100%;
    font-size: 11px;
    line-height: 1.35;
    color: rgba(255,255,255,0.45);
    text-align: center;
    padding: 0 4px;
}
.mines-sizes {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    width: 100%;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 4px;
}
.mn-size {
    padding: 9px 0;
    border: none;
    border-radius: 9px;
    background: transparent;
    color: rgba(255,255,255,0.6);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    font-family: inherit;
}
.mn-size:hover  { color: #fff; }
.mn-size.active {
    background: linear-gradient(135deg, #ef5b5b, #c62828);
    color: #fff;
    box-shadow: 0 2px 8px rgba(198, 40, 40, 0.4);
}
.mn-size:disabled { opacity: 0.45; cursor: not-allowed; }

.bet-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    width: 100%;
}
.bet-buttons .bet {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 10px;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    padding: 10px 6px;
    cursor: pointer;
}
.bet-buttons .bet.active {
    background: linear-gradient(135deg, rgba(255,215,0,0.30), rgba(255,140,0,0.16));
    border-color: rgba(255,215,0,0.55);
}
.bet-buttons .bet:active { transform: scale(0.95); }

.mines-action {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    letter-spacing: 0.3px;
    transition: transform 0.12s ease, box-shadow 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    /* default = Старт (green) */
    background: linear-gradient(135deg, #4caf50, #2e7d32);
    box-shadow: 0 6px 18px rgba(46, 125, 50, 0.4);
}
.mines-action:active { transform: scale(0.98); }
.mines-action:disabled {
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.4);
    box-shadow: none;
    cursor: not-allowed;
}
/* Cashout state (gold) */
.mines-action.cashout {
    background: linear-gradient(135deg, #ffd700, #f9a825);
    color: #1a1a2e;
    box-shadow: 0 6px 18px rgba(249, 168, 37, 0.4);
}
.mines-action.cashout:disabled {
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.4);
    box-shadow: none;
}
