@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Space+Grotesk:wght@500;600;700&display=swap');

* { touch-action: manipulation; }

body {
    font-family: 'Inter', system-ui, sans-serif;
    margin: 0;
    padding: 0;
    height: 100dvh;
    overflow: hidden;
    background: linear-gradient(180deg, #0A0A0C 0%, #11151F 100%);
    color: white;
}

.logo-font {
    font-family: 'Space Grotesk', sans-serif;
}

.glass {
    background: rgba(20, 22, 28, 0.92);
    backdrop-filter: blur(28px);
    border: 1px solid rgba(255,255,255,0.08);
}

.board-container {
    position: relative;
    width: 92vw;
    max-width: 360px;
    aspect-ratio: 1 / 1;
}

.board-bg {
    position: absolute;
    inset: -20px;
    background: radial-gradient(circle at 50% 40%, #1E2A44 0%, #0F1626 65%);
    border-radius: 42px;
    box-shadow: 0 0 80px rgba(0, 229, 192, 0.25), inset 0 0 60px rgba(0, 0, 0, 0.75);
    z-index: 0;
}

.board {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 11px;
    width: 100%;
    height: 100%;
    padding: 8px;
}

.cell {
    position: relative;
    overflow: visible;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.7), inset 0 3px 10px rgba(255,255,255,0.12);
    background: #1C2539;
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    perspective: 500px;
}

.cell:active { transform: scale(0.92); }

.cell-icon {
    width: 56%;
    height: 56%;
    object-fit: contain;
    pointer-events: none;
}

.cell-icon.icon-idle {
    opacity: 0.85;
}

.cell-icon.icon-reveal {
    animation: cell-reveal 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes cell-reveal {
    0% { transform: scale(0.3) rotateY(90deg); opacity: 0; }
    55% { transform: scale(1.2) rotateY(0deg); opacity: 1; }
    100% { transform: scale(1) rotateY(0deg); opacity: 1; }
}

.cell.revealed-safe {
    background: rgba(0, 229, 192, 0.22);
    box-shadow: inset 0 0 30px rgba(0, 229, 192, 0.4);
}

.cell.revealed-mine {
    background: #4C1D1D;
    animation: explode 0.6s ease forwards;
}

@keyframes explode {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

/* Particles inside a cell (diamond sparkle / bomb fragments) */
.cell-particle {
    position: absolute;
    top: 50%;
    left: 50%;
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
    z-index: 5;
}

.cell-particle.burst {
    animation: cell-burst 0.7s ease-out forwards;
}

@keyframes cell-burst {
    0% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0.2); }
}

/* Whole-board shake when a mine is hit */
.board-shake {
    animation: board-shake 0.45s ease;
}

@keyframes board-shake {
    0%, 100% { transform: translateX(0); }
    10%, 90% { transform: translateX(-3px); }
    20%, 80% { transform: translateX(5px); }
    30%, 50%, 70% { transform: translateX(-8px); }
    40%, 60% { transform: translateX(8px); }
}

/* Red flash burst when a mine is hit */
.mine-flash {
    position: absolute;
    inset: -20px;
    border-radius: 42px;
    background: radial-gradient(circle, rgba(255,90,95,0.6), transparent 70%);
    opacity: 0;
    pointer-events: none;
    z-index: 2;
}

.mine-flash.active {
    animation: mine-flash-anim 0.5s ease-out forwards;
}

@keyframes mine-flash-anim {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

.multiplier-glow {
    text-shadow: 0 0 20px #FFCC66;
}

/* ===== Spin screen ===== */
.spin-orb-wrap {
    position: relative;
    width: 260px;
    height: 260px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spin-orb-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: #00E5C0;
    border-right-color: rgba(0,229,192,0.35);
    animation: spin-rotate 1.1s linear infinite;
}

.spin-orb-ring.slow {
    animation-duration: 2.4s;
    border-top-color: #FFCC66;
    border-right-color: rgba(255,204,102,0.3);
    inset: 14px;
}

@keyframes spin-rotate {
    to { transform: rotate(360deg); }
}

.spin-orb-core {
    position: absolute;
    inset: 34px;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 35%, #1E2A44 0%, #0B0F1A 75%);
    box-shadow: 0 0 60px rgba(0,229,192,0.35), inset 0 0 40px rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}

.spin-orb-core.settled {
    box-shadow: 0 0 90px rgba(255,204,102,0.55), inset 0 0 40px rgba(0,0,0,0.8);
    transition: box-shadow 0.5s ease;
}

#spin-result {
    transition: transform 0.15s ease;
}

#spin-result.settled {
    animation: settle-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes settle-pop {
    0% { transform: scale(0.85); }
    55% { transform: scale(1.18); }
    100% { transform: scale(1); }
}

.spin-particle {
    position: absolute;
    border-radius: 50%;
    background: #00E5C0;
    opacity: 0;
    pointer-events: none;
}

.spin-particle.settled {
    animation: burst 0.9s ease-out forwards;
}

@keyframes burst {
    0% { opacity: 1; transform: translate(0,0) scale(1); }
    100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(0.3); }
}

.spin-progress-track {
    width: 100%;
    max-width: 300px;
    height: 4px;
    border-radius: 2px;
    background: rgba(255,255,255,0.08);
    overflow: hidden;
}

.spin-progress-fill {
    height: 100%;
    width: 0%;
    border-radius: 2px;
    background: linear-gradient(90deg, #00E5C0, #FFCC66);
}