.mempic-container {
    border: 1px solid #7b7b7b;
    padding: 1em;
    margin: 1em 0;
    max-width: 100%;
    overflow: hidden;
		-webkit-user-select: none;
    user-select: none;
}

.mempic-container.game-fullscreen {
	display: flex;
	flex-direction: column;
	justify-content: center;
}

@media screen and (max-width: 768px) {
  .mempic-container.game-fullscreen {
		justify-content: end;
  }
}

.mempic-grid {
    display: grid;
    gap: 8px;
    margin-bottom: 1em;
    width: 100%;
    max-width: min(70vh, 90vw); /* Ограничиваем максимальный размер */
    margin: 0 auto; /* Центрируем */
}

.mempic-cell {
    aspect-ratio: 1;
    background: #222;
    border: 1px solid #7b7b7b;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
		-webkit-tap-highlight-color: transparent;
    outline: none;
}

.mempic-cell.active:hover {
    background: #333;
    transform: scale(0.98);
}

.mempic-cell.correct {
	animation: correctBounce 0.3s ease-out;
}

@keyframes correctBounce {
    0%, 100% {
			border-color: #7b7b7b;
			box-shadow: 0 0 0px -6px #7b7b7b;
		}
    50% {
			border-color: #6fff20;
			box-shadow: 0 0 16px -6px #6fff20;
		}
}

.mempic-cell.correct::after,
.mempic-cell.has-dot::after {
    content: '';
    width: 60%;
    height: 60%;
    background: #EE4540;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(238, 69, 64, 0.5);
}

.mempic-cell.wrong::after {
    content: '✖';
    color: #EE4540;
    font-size: 1.8em;
    line-height: 1;
}

.mempic-cell.missed {
    position: relative;
    overflow: hidden;
}

.mempic-cell.missed::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(238, 69, 64, 0);
}

.mempic-cell.missed-animate::before {
    animation: missedPulse 1.5s ease-out;
}

@keyframes missedPulse {
    0% { background: rgba(238, 69, 64, 0.8); }
    100% { background: rgba(238, 69, 64, 0); }
}

.mempic-start,
.mempic-stop,
.mempic-restart {
    background: #222;
    border: 1px solid #EE4540 !important;
    padding: 0.8em 1.5em !important;
    margin: 1em auto;
    display: block;
    font-size: 1.1em;
    transition: all 0.3s;
    border-radius: 4px;
}

.mempic-stop,
.mempic-restart {
	margin: 0;
}

.mempic-start:hover,
.mempic-stop:hover,
.mempic-restart:hover {
    background: #EE4540;
    color: black !important;
    transform: translateY(-2px);
}

.mempic-result {
    text-align: center;
    padding: 1em;
    font-size: 1.2em;
    line-height: 1.6;
}

.mempic-result-buttons {
	display: flex;
	justify-content: center;
	gap: 2em;
	margin-top: 0.8em;
}

.mempic-result .mempic-stop {
	display: none;
}

.game-fullscreen .mempic-result .mempic-stop {
	display: block;
}

@media screen and (max-width: 768px) {
    .mempic-grid {
        gap: 6px;
    }

    .mempic-start,
		.mempic-stop,
    .mempic-restart {
        padding: 0.7em 1.2em !important;
    }
}

.mempic-timer {
    position: fixed;
    top: 10px;
    right: 10px;
    background: rgba(238, 69, 64, 0.2);
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 1.2em;
    color: #EE4540;
		z-index: 2000;
}

.mempic-timer.hidden {
	display: none;
}

/* Анимация для таймера */
@keyframes mempic-timer-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.mempic-timer {
    animation: mempic-timer-pulse 1s infinite;
}

.mempic-progress {
    text-align: center;
    margin-bottom: 1em;
    padding: 0.5em;
    background: rgba(0,0,0,0.3);
    border-radius: 20px;
}

.progress-count {
    display: block;
    margin-bottom: 5px;
    font-size: 1.1em;
}

.progress-track {
    height: 6px;
    background: #333;
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: #EE4540;
    transition: width 0.3s, background 0.3s;
}
