body {
    font-family: Arial, sans-serif;
    background-color: #111;
    background-image: radial-gradient(circle at 50% 0%, #1e1e26 0%, #0a0a0d 70%);
    color: white;
    text-align: center;
    margin: 0;
    padding: 20px;
}

.game-container {
    max-width: 640px;
    margin: 0 auto;
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

.btn {
    padding: 10px 20px;
    margin: 10px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    border: none;
    border-radius: 5px;
    background-color: #f1c40f;
    color: #333;
    transition: 0.3s;
}

.btn:disabled {
    background-color: #7f8c8d;
    cursor: not-allowed;
}

.btn:hover:not(:disabled) {
    background-color: #f39c12;
}

.btn-retirar {
    background-color: #27c93f;
    color: #06210c;
}

.btn-retirar:hover:not(:disabled) {
    background-color: #2ee84b;
}

.btn-retirar:disabled {
    background-color: #7f8c8d;
}

#message {
    height: 30px;
    margin-bottom: 10px;
}

.nota-info {
    color: #999;
    font-size: 0.78rem;
    line-height: 1.4;
    max-width: 460px;
    margin: 14px auto 0;
}

/* --- Cabecera y Botón Volver --- */
.header-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    margin-bottom: 10px;
}

.btn-back {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: bold;
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: all 0.3s ease;
    margin-bottom: 15px;
    cursor: pointer;
}

.btn-back:hover {
    background: #f1c40f;
    color: #111;
    border-color: #f1c40f;
    box-shadow: 0 0 15px rgba(241, 196, 15, 0.4);
    transform: translateY(-2px);
}

/* --- Apuestas / cantidad de minas --- */
.betting-area {
    background: linear-gradient(135deg, rgba(30, 30, 30, 0.75), rgba(15, 15, 15, 0.95));
    border: 2px solid #f1c40f;
    box-shadow: 0 8px 32px 0 rgba(241, 196, 15, 0.25), inset 0 0 15px rgba(241, 196, 15, 0.05);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 16px;
    padding: 15px 20px;
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    width: 100%;
    box-sizing: border-box;
}

.balance-display {
    font-weight: bold;
    font-size: 20px;
    color: #f1c40f;
    display: flex;
    align-items: center;
    gap: 10px;
    text-shadow: 0 0 10px rgba(241, 196, 15, 0.3);
}

.bet-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.6);
    padding: 6px 16px;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: all 0.3s ease;
}

.bet-controls:focus-within {
    border-color: #f1c40f;
    box-shadow: 0 0 15px rgba(241, 196, 15, 0.4);
}

.bet-controls label {
    color: #aaa;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: bold;
}

#bet-amount, #mines-amount {
    width: 60px;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 18px;
    text-align: center;
    font-weight: bold;
    outline: none;
}

#bet-amount::-webkit-outer-spin-button,
#bet-amount::-webkit-inner-spin-button,
#mines-amount::-webkit-outer-spin-button,
#mines-amount::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
#bet-amount, #mines-amount {
    appearance: textfield;
    -moz-appearance: textfield;
}

.btn-small {
    padding: 6px 14px;
    font-size: 11px;
    font-weight: 800;
    background: linear-gradient(135deg, #f1c40f, #d4ac0d);
    color: #000;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    box-shadow: 0 4px 10px rgba(241, 196, 15, 0.2);
}

.btn-small:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 6px 15px rgba(241, 196, 15, 0.4);
}

.btn-small:disabled {
    background: #444;
    color: #888;
    cursor: not-allowed;
    box-shadow: none;
}

/* --- Icono Petocoin --- */
.petocoin-icon {
    width: 26px;
    height: 26px;
    object-fit: contain;
    vertical-align: middle;
    animation: spin-coin 4s linear infinite;
    filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.5));
}

.petocoin-icon-small {
    width: 16px;
    height: 16px;
    object-fit: contain;
    vertical-align: middle;
}

@keyframes spin-coin {
    0% { transform: rotateY(0deg); }
    100% { transform: rotateY(360deg); }
}

/* --- Estadísticas de la ronda --- */
.stats-area {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.stat-box {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    padding: 10px 16px;
    min-width: 120px;
}

.stat-label {
    display: block;
    font-size: 0.68rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.stat-value {
    display: block;
    font-size: 1.15rem;
    font-weight: 800;
    color: #f1c40f;
}

/* --- Grilla 5x5 --- */
.grid-minas {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    max-width: 380px;
    margin: 0 auto 10px;
}

.casilla {
    aspect-ratio: 1 / 1;
    background: linear-gradient(145deg, #2c2c35, #1c1c22);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
    user-select: none;
}

.casilla:hover:not(.revelada):not(.deshabilitada) {
    transform: translateY(-3px);
    border-color: #f1c40f;
    box-shadow: 0 6px 14px rgba(241, 196, 15, 0.25);
}

.casilla.deshabilitada {
    cursor: not-allowed;
}

.casilla.revelada {
    cursor: default;
}

.casilla.gema {
    background: linear-gradient(145deg, #1d3b2a, #10241a);
    border-color: #27c93f;
    animation: pop-in 0.25s ease;
}

.casilla.mina {
    background: linear-gradient(145deg, #4a1414, #2a0b0b);
    border-color: #ff5f56;
}

.casilla.mina.explotada {
    animation: shake 0.4s ease;
    box-shadow: 0 0 20px rgba(255, 95, 86, 0.7);
}

@keyframes pop-in {
    0% { transform: scale(0.7); opacity: 0.4; }
    100% { transform: scale(1); opacity: 1; }
}

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

@media (max-width: 420px) {
    .grid-minas { max-width: 300px; }
    .casilla { font-size: 1.2rem; }
}
