/* memory-main.css - ОПТИМИЗИРОВАННАЯ ВЕРСИЯ СО СЧЕТЧИКОМ НА КНОПКЕ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
    -webkit-touch-callout: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

body.memory-main-page {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    min-height: 100vh;
    overflow: hidden;
    touch-action: manipulation;
    -webkit-user-drag: none;
}

.main-container {
    width: 1280px;
    height: 720px;
    margin: 0 auto;
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 15px;
}

/* Верхняя панель */
.top-panel {
    background: rgba(0, 0, 0, 0.6);
    padding: 12px 20px;
    border-radius: 12px;
    margin-bottom: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.player-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-label {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}

.status-value {
    font-weight: bold;
    color: #feb47b;
}

.streak {
    color: #ff7e5f;
}

.challenge {
    background: rgba(255, 126, 95, 0.2);
    padding: 8px 15px;
    border-radius: 8px;
    border: 1px solid #ff7e5f;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* СЧЕТЧИК УДАЛЕН ИЗ ВЕРХНЕЙ ПАНЕЛИ */

.progress-bar {
    width: 120px;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(45deg, #ff7e5f, #feb47b);
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* Основной контент */
.main-content {
    display: flex;
    gap: 15px;
    flex: 1;
    align-items: stretch;
}

/* Колонки */
.left-column, .right-column {
    width: 280px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.center-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 20px;
}

/* Заголовок */
.game-header {
    text-align: center;
    margin-bottom: 10px;
}

.main-title {
    font-size: 2.8rem;
    margin-bottom: 5px;
    color: #ff7e5f;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    animation: titleGlow 3s ease-in-out infinite;
}

@keyframes titleGlow {
    0%, 100% { text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5); }
    50% { text-shadow: 0 2px 20px rgba(255, 126, 95, 0.8); }
}

/* Сетка уровней */
.levels-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    width: 100%;
    max-width: 700px;
}

.level-card {
    aspect-ratio: 3/4;
    perspective: 1000px;
    cursor: pointer;
    min-height: 200px;
    user-select: none;
    -webkit-user-select: none;
}

.card-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s ease;
}

.level-card:hover .card-inner {
    transform: rotateY(180deg);
}

.card-front, .card-back {
    width: 100%;
    height: 100%;
    position: absolute;
    backface-visibility: hidden;
    border-radius: 12px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.card-front {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.card-back {
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid #ff7e5f;
    transform: rotateY(180deg);
}

.level-card:hover .card-front {
    border-color: rgba(255, 126, 95, 0.5);
}

.level-icon {
    font-size: 2rem;
    margin-bottom: 10px;
}

.level-card h3 {
    font-size: 1.3rem;
    margin-bottom: 6px;
    color: #feb47b;
}

.level-card p {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.level-stats {
    background: rgba(255, 255, 255, 0.1);
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

.level-card:hover .level-stats {
    background: rgba(255, 126, 95, 0.3);
}

/* Мини-сетки для превью */
.mini-grid {
    display: grid;
    gap: 2px;
    margin-bottom: 12px;
    width: 80px;
    height: 80px;
}

.easy-preview {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
}

.medium-preview {
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(6, 1fr);
}

.hard-preview {
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
}

.mini-grid div {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 1px;
    transition: all 0.3s ease;
}

.level-card:hover .mini-grid div {
    background: rgba(255, 126, 95, 0.6);
}

.best-result {
    color: #feb47b;
    font-weight: bold;
    font-size: 0.9rem;
}

/* Быстрый старт с ЕЖЕДНЕВНЫМИ ЗАДАНИЯМИ */
.quick-actions {
    display: flex;
    gap: 12px;
    margin-top: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.quick-btn {
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
}

.quick-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.quick-btn:hover::before {
    left: 100%;
}

.quick-btn.primary {
    background: linear-gradient(45deg, #ff7e5f, #feb47b);
}

.quick-btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.quick-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.quick-btn:active {
    transform: translateY(0);
}

/* НОВЫЙ СЧЕТЧИК НА КНОПКЕ ЕЖЕДНЕВНЫХ ЗАДАНИЙ */
.quests-counter {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    box-shadow: 0 2px 6px rgba(255, 107, 107, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.3);
    min-width: 35px;
    text-align: center;
    display: inline-block;
    animation: pulse 2s infinite;
    margin-left: 4px;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Секции */
.stats-section, .best-scores, .collection-section, .special-modes, .tips-section {
    background: rgba(0, 0, 0, 0.6);
    padding: 12px;
    border-radius: 12px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.stats-section:hover, .best-scores:hover, .collection-section:hover, .special-modes:hover, .tips-section:hover {
    border-color: rgba(255, 126, 95, 0.3);
    transform: translateY(-2px);
}

.stats-section h3, .best-scores h3, .collection-section h3, .special-modes h3, .tips-section h3 {
    color: #ff7e5f;
    margin-bottom: 12px;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Статистика */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    transition: all 0.3s ease;
    border-left: 2px solid transparent;
}

.stat-card:hover {
    background: rgba(255, 255, 255, 0.1);
    border-left-color: #ff7e5f;
    transform: translateX(3px);
}

.stat-icon {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.stat-info {
    flex: 1;
}

.stat-value {
    font-weight: bold;
    color: #feb47b;
    font-size: 1rem;
}

.stat-label {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.7rem;
}

/* Лучшие результаты */
.score-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    font-size: 0.8rem;
    transition: all 0.3s ease;
    border-left: 2px solid transparent;
}

.score-item:hover {
    background: rgba(255, 255, 255, 0.1);
    border-left-color: #feb47b;
}

.score-difficulty {
    color: rgba(255, 255, 255, 0.9);
}

.score-value {
    color: #feb47b;
    font-weight: bold;
    font-size: 0.75rem;
}

/* Коллекция */
.current-theme {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.current-theme:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(3px);
}

.theme-preview {
    display: flex;
    gap: 4px;
}

.theme-card {
    width: 28px;
    height: 28px;
    background: linear-gradient(45deg, #ff7e5f, #feb47b);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

.current-theme:hover .theme-card {
    transform: rotate(5deg) scale(1.1);
}

.theme-info {
    flex: 1;
}

.theme-name {
    font-weight: bold;
    margin-bottom: 2px;
    font-size: 0.9rem;
    color: #feb47b;
}

.theme-progress {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.75rem;
}

.theme-btn {
    width: 100%;
    padding: 8px;
    background: linear-gradient(45deg, #667eea, #764ba2);
    border: none;
    border-radius: 6px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.85rem;
}

.theme-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* Специальные режимы */
.modes-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mode-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    transition: all 0.3s ease;
    cursor: pointer;
    border-left: 2px solid transparent;
}

.mode-item:hover {
    background: rgba(255, 255, 255, 0.1);
    border-left-color: #667eea;
    transform: translateX(3px);
}

/* ИСПРАВЛЕНИЕ: Выравнивание звёзд вправо */
.mode-icon {
    font-size: 1.1rem;
    width: 60px;
    text-align: right;
    min-width: 60px;
}

.mode-info {
    flex: 1;
}

.mode-name {
    font-weight: bold;
    color: #feb47b;
    font-size: 0.85rem;
}

.mode-desc {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.7rem;
}

/* ИСПРАВЛЕНИЕ: Скрытие неработающих кнопок информации */
.mode-info-btn {
    display: none !important;
}

/* Советы */
.tips-section {
    position: relative;
}

.tip-content {
    background: rgba(255, 255, 255, 0.05);
    padding: 10px;
    border-radius: 6px;
    border-left: 2px solid #ff7e5f;
    font-size: 0.8rem;
    line-height: 1.3;
    min-height: 60px;
    display: flex;
    align-items: center;
    transition: all 0.5s ease;
}

/* Фон с сеткой */
.background-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 40px 40px;
    animation: gridMove 20s linear infinite;
    z-index: -1;
    opacity: 0.3;
}

@keyframes gridMove {
    0% { transform: translate(0, 0); }
    100% { transform: translate(40px, 40px); }
}

/* Модальные окна */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 0;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.modal-header {
    background: rgba(0, 0, 0, 0.6);
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    color: #feb47b;
    margin: 0;
    font-size: 1.2rem;
}

.modal-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ff7e5f;
}

.modal-body {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    justify-content: flex-end;
}

.modal-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    min-width: 100px;
}

.modal-btn.primary {
    background: linear-gradient(45deg, #ff7e5f, #feb47b);
    color: white;
}

.modal-btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.modal-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Анимации */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-15px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(15px); }
    to { opacity: 1; transform: translateX(0); }
}

.stats-section, .best-scores {
    animation: slideInLeft 0.5s ease-out;
}

.collection-section, .special-modes, .tips-section {
    animation: slideInRight 0.5s ease-out;
}

.level-card {
    animation: fadeIn 0.5s ease-out;
}

.level-card:nth-child(1) { animation-delay: 0.1s; }
.level-card:nth-child(2) { animation-delay: 0.2s; }
.level-card:nth-child(3) { animation-delay: 0.3s; }

/* АДАПТИВНОСТЬ */
@media (max-width: 1280px) {
    .main-container {
        width: 100%;
        height: 100vh;
        border-radius: 0;
        padding: 10px;
    }
    
    .main-content {
        gap: 10px;
    }
    
    .left-column, .right-column {
        width: 250px;
    }
    
    .levels-grid {
        gap: 10px;
        max-width: 600px;
    }
    
    .level-card {
        min-height: 180px;
    }
    
    .main-title {
        font-size: 2.4rem;
    }
    
    .quests-counter {
        font-size: 0.75rem;
        padding: 3px 6px;
        min-width: 30px;
    }
}

@media (max-height: 720px) {
    .main-container {
        padding: 10px;
    }
    
    .top-panel {
        padding: 10px 15px;
        margin-bottom: 10px;
    }
    
    .main-content {
        gap: 10px;
    }
    
    .left-column, .right-column {
        gap: 10px;
    }
    
    .levels-grid {
        gap: 8px;
        max-width: 550px;
    }
    
    .level-card {
        min-height: 160px;
    }
    
    .card-front, .card-back {
        padding: 10px;
    }
    
    .level-icon {
        font-size: 1.8rem;
    }
    
    .level-card h3 {
        font-size: 1.1rem;
    }
    
    .quick-actions {
        margin-top: 10px;
    }
    
    .quick-btn {
        padding: 8px 14px;
        font-size: 0.85rem;
    }
    
    .quests-counter {
        font-size: 0.7rem;
        padding: 2px 5px;
        min-width: 28px;
    }
}

/* АДАПТИВНАЯ ОБЕРТКА ДЛЯ ВСЕЙ ИГРЫ */
.game-wrapper {
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
}

/* ОСНОВНОЙ КОНТЕЙНЕР С МАСШТАБИРОВАНИЕМ */
.main-container {
    transform-origin: center center;
    transition: transform 0.3s ease;
}

/* МЕДИА-ЗАПРОСЫ ДЛЯ АДАПТИВНОСТИ */
@media (max-width: 1024px) {
    .main-content {
        flex-direction: column;
        gap: 8px;
    }
    
    .left-column, .right-column {
        width: 100%;
        max-width: none;
    }
    
    .center-column {
        order: -1;
    }
    
    .levels-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

@media (max-width: 768px) {
    .levels-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .level-card {
        min-height: 150px;
    }
    
    .main-title {
        font-size: 2rem;
    }
    
    .player-status {
        flex-direction: column;
        gap: 8px;
    }
    
    .quick-actions {
        flex-direction: column;
    }
    
    .quick-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .main-container {
        padding: 5px;
    }
    
    .level-card {
        min-height: 120px;
    }
    
    .card-front, .card-back {
        padding: 8px;
    }
    
    .level-icon {
        font-size: 1.5rem;
    }
    
    .level-card h3 {
        font-size: 1rem;
    }
}