/* ТРЕНАЖЕР ПАМЯТИ - ОСНОВНЫЕ СТИЛИ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    overflow: hidden;
}

/* ЭКРАННАЯ СИСТЕМА */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    overflow-y: auto;
}

.screen.active {
    opacity: 1;
    visibility: visible;
    z-index: 10;
}

/* ЭКРАН ВЫБОРА УРОВНЯ */
.levels-screen {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.levels-container {
    max-width: 1000px;
    width: 100%;
    background: white;
    border-radius: 25px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: slideUp 0.5s ease;
    max-height: 95vh;
    overflow-y: auto;
}

.levels-header {
    text-align: center;
    margin-bottom: 25px;
}

.levels-header h1 {
    font-size: 2em;
    color: #333;
    margin-bottom: 10px;
}

.levels-header p {
    color: #666;
    margin-bottom: 15px;
}

.level-progress {
    background: #e9ecef;
    border-radius: 20px;
    height: 10px;
    overflow: hidden;
    margin: 15px 0;
}

.level-progress-bar {
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
    height: 100%;
    border-radius: 20px;
    transition: width 0.3s;
}

/* Сетка уровней */
.levels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    margin: 25px 0;
}

.level-card {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 15px 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    border: 3px solid transparent;
    position: relative;
}

.level-card:hover:not(.locked) {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    background: white;
    border-color: #4CAF50;
}

.level-card.completed {
    background: #e8f5e9;
    border-color: #4CAF50;
}

.level-card.current {
    background: #e3f2fd;
    border-color: #2196F3;
    animation: pulseBorder 2s infinite;
}

.level-card.locked {
    background: #f5f5f5;
    cursor: not-allowed;
    opacity: 0.6;
}

.level-number {
    font-size: 1.8em;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.level-difficulty {
    font-size: 0.85em;
    font-weight: 600;
    color: #4CAF50;
    margin-bottom: 5px;
}

.level-info {
    font-size: 0.75em;
    color: #888;
    margin: 2px 0;
}

.level-stars {
    margin-top: 8px;
    color: #FFD700;
    font-size: 1.1em;
}

.lock-icon {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 0.9em;
}

/* ЭКРАН ЗАПОМИНАНИЯ */
.memorize-screen {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

.memorize-container {
    max-width: 800px;
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 40px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
    animation: fadeIn 0.3s ease;
}

.memorize-header h2 {
    color: white;
    font-size: 1.8em;
    margin-bottom: 20px;
}

.memorize-timer {
    color: white;
    font-size: 1.2em;
    background: rgba(255,255,255,0.2);
    display: inline-block;
    padding: 8px 20px;
    border-radius: 30px;
    margin-bottom: 30px;
}

.timer-value {
    font-size: 1.5em;
    font-weight: bold;
    margin: 0 5px;
}

.sequence-display {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
    margin: 40px 0;
    padding: 40px;
    background: rgba(255,255,255,0.1);
    border-radius: 30px;
    backdrop-filter: blur(10px);
}
.continue-btn,
.menu-btn
{
	
	padding:22px;
	margin:22px;
}
.memorize-icon {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    
    
    font-size: 3em;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    animation: bounceIn 0.4s ease;
    transition: transform 0.2s;
}

.memorize-icon svg {
    width: 60px;
    height: 60px;
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.memorize-progress {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

.progress-ring {
    position: relative;
    width: 80px;
    height: 80px;
}

.progress-circle {
    transition: stroke-dashoffset 0.1s linear;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5em;
    font-weight: bold;
    color: white;
}

.memorize-hint {
    color: rgba(255,255,255,0.8);
    margin-top: 20px;
    font-size: 0.9em;
}

/* ЭКРАН ВОССТАНОВЛЕНИЯ */
.recall-screen {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

.recall-container {
    max-width: 1000px;
    width: 100%;
    background: white;
    border-radius: 30px;
    padding: 25px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    max-height: 95vh;
    overflow-y: auto;
}

.recall-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 20px;
    border-bottom: 2px solid #e9ecef;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.level-badge {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    padding: 8px 20px;
    border-radius: 25px;
    font-weight: bold;
}

.recall-timer {
    font-size: 1.3em;
    font-weight: bold;
    color: #f44336;
    background: #fff3e0;
    padding: 8px 20px;
    border-radius: 25px;
}

.progress-indicator {
    font-size: 1.1em;
    font-weight: bold;
    color: #666;
    background: #f8f9fa;
    padding: 8px 20px;
    border-radius: 25px;
}

.recall-status {
    text-align: center;
    padding: 15px;
    margin-bottom: 20px;
    background: #e3f2fd;
    border-radius: 15px;
}

.status-message {
    font-size: 1.1em;
    color: #1976d2;
    font-weight: 500;
}

.recall-sequence {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    margin: 30px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 20px;
    min-height: 120px;
}

.recall-slot {
    width: 80px;
    height: 80px;
    background: white;
    border: 3px dashed #dee2e6;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 2.5em;
}

.recall-slot.filled {
    border: 3px solid #4CAF50;
    background: #e8f5e9;
}

.recall-slot svg {
    width: 50px;
    height: 50px;
}

/* Доступные иконки */
.available-icons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 15px;
    margin: 25px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 20px;
    max-height: 300px;
    overflow-y: auto;
}

.available-icon-card {
    background: white;
    border: 2px solid #dee2e6;
    border-radius: 15px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.available-icon-card:hover:not(.disabled) {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border-color: #4CAF50;
}

.available-icon-card.selected {
    background: #e8f5e9;
    border-color: #4CAF50;
    transform: scale(0.98);
}

.available-icon-card.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.icon-display {
    font-size: 2.5em;
}

.icon-display svg {
    width: 50px;
    height: 50px;
}

.icon-name {
    font-size: 0.7em;
    color: #888;
}

/* Управление */
.recall-controls {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.recall-controls button {
    flex: 1;
    padding: 14px;
    border: none;
    border-radius: 12px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.reset-btn {
    background: #6c757d;
    color: white;
}

.check-btn {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
}

.reset-btn:hover, .check-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

/* ЭКРАН РЕЗУЛЬТАТОВ */
.result-screen {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
}

.result-container {
    max-width: 500px;
    width: 100%;
    background: white;
    border-radius: 30px;
    padding: 35px;
    text-align: center;
    animation: slideUp 0.4s ease;
}

.result-header h1 {
    font-size: 1.8em;
    color: #333;
    margin-bottom: 15px;
}

.result-stars {
    font-size: 2.5em;
    color: #FFD700;
    margin: 15px 0;
}

.result-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin: 25px 0;
}

.result-stat {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 15px;
}

.result-icon {
    font-size: 1.5em;
    display: block;
    margin-bottom: 5px;
}

.result-value {
    font-size: 1.8em;
    font-weight: bold;
    color: #333;
    display: block;
}

.result-label {
    font-size: 0.8em;
    color: #888;
}

.result-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.result-buttons button {
    padding: 15px;
    border: none;
    border-radius: 15px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.next-level-btn {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
}

.levels-btn {
    background: #f8f9fa;
    color: #333;
    border: 2px solid #dee2e6;
}

.restart-btn {
    background: #ff9800;
    color: white;
}

.result-buttons button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

/* ЭКРАН ВРЕМЯ ВЫШЛО */
.timeout-screen {
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
}

.timeout-container {
    max-width: 400px;
    width: 100%;
    background: white;
    border-radius: 30px;
    padding: 35px;
    text-align: center;
    animation: slideUp 0.4s ease;
}

.timeout-icon {
    font-size: 4em;
    margin-bottom: 20px;
}

.timeout-container h1 {
    font-size: 1.8em;
    color: #333;
    margin-bottom: 10px;
}

.timeout-container p {
    color: #666;
    margin-bottom: 30px;
}

.timeout-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.timeout-buttons button {
    padding: 14px;
    border: none;
    border-radius: 15px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.timeout-buttons .restart-level-btn {
    background: #ff9800;
    color: white;
}

.timeout-buttons .levels-btn {
    background: #f8f9fa;
    color: #333;
    border: 2px solid #dee2e6;
}

/* МОДАЛЬНОЕ ОКНО */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: white;
    border-radius: 25px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    animation: slideIn 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 2px solid #e9ecef;
}

.modal-title {
    font-size: 1.3em;
    font-weight: bold;
    color: #333;
}

.close-modal {
    background: none;
    border: none;
    font-size: 2em;
    cursor: pointer;
    color: #999;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rules-content {
    padding: 20px;
    line-height: 1.6;
}

.rules-content h3 {
    color: #4CAF50;
    margin: 15px 0 10px;
}

.rules-content ul {
    margin-left: 20px;
    margin-bottom: 15px;
}

.rules-content li {
    margin: 5px 0;
}

.tips {
    background: #e8f5e9;
    padding: 15px;
    border-radius: 15px;
    margin-top: 15px;
}

.tips h3 {
    margin-top: 0;
    color: #2e7d32;
}

/* ПАУЗА */
.paused-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1100;
    cursor: pointer;
}

.paused-text {
    color: white;
    font-size: 2em;
    text-align: center;
    background: rgba(0,0,0,0.7);
    padding: 40px;
    border-radius: 30px;
    border: 3px solid rgba(255,255,255,0.3);
}

/* АНИМАЦИИ */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes pulseBorder {
    0%, 100% { border-color: #2196F3; }
    50% { border-color: #64B5F6; }
}

.shake {
    animation: shake 0.3s ease;
}

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

/* АДАПТАЦИЯ */
@media (max-width: 768px) {
    .levels-container {
        padding: 20px;
    }
    
    .levels-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
    
    .memorize-icon {
        width: 60px;
        height: 60px;
        font-size: 2em;
    }
    
    .memorize-icon svg {
        width: 40px;
        height: 40px;
    }
    
    .recall-slot {
        width: 60px;
        height: 60px;
        font-size: 2em;
    }
    
    .recall-slot svg {
        width: 35px;
        height: 35px;
    }
    
    .available-icons-grid {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
        gap: 10px;
    }
    
    .icon-display {
        font-size: 2em;
    }
    
    .icon-display svg {
        width: 35px;
        height: 35px;
    }
    
    .recall-header {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    
    .recall-controls {
        flex-direction: column;
    }
    
    .result-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .levels-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .memorize-container {
        padding: 25px;
    }
    
    .memorize-header h2 {
        font-size: 1.4em;
    }
    
    .sequence-display {
        gap: 10px;
    }
    
    .memorize-icon {
        width: 50px;
        height: 50px;
    }
    
    .recall-slot {
        width: 50px;
        height: 50px;
    }
    
    .result-container {
        padding: 25px;
    }
    
    .result-value {
        font-size: 1.5em;
    }
}

/* Стили для скролла */
.levels-container::-webkit-scrollbar,
.recall-container::-webkit-scrollbar,
.available-icons-grid::-webkit-scrollbar,
.modal::-webkit-scrollbar {
    width: 6px;
}

.levels-container::-webkit-scrollbar-track,
.recall-container::-webkit-scrollbar-track,
.available-icons-grid::-webkit-scrollbar-track,
.modal::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.levels-container::-webkit-scrollbar-thumb,
.recall-container::-webkit-scrollbar-thumb,
.available-icons-grid::-webkit-scrollbar-thumb,
.modal::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}