/* ===================================
   СТИЛИ ДЛЯ МИНИИГРЫ "ЛОВЕЦ МУКИ"
   flour_game.css
   =================================== */

@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700;900&display=swap');

/* Основной контейнер игры */
.flour-game-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 10, 15, 0.97);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
    font-family: 'Roboto', sans-serif;
}

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

/* Игровой контейнер */
.flour-game {
    width: 90%;
    max-width: 600px;
    height: 85vh;
    max-height: 750px;
    background: linear-gradient(180deg, 
        #1e1e24 0%, 
        #252530 30%,
        #1a1a20 60%,
        #15151a 100%
    );
    border-radius: 12px;
    box-shadow: 
        0 0 60px rgba(80, 20, 20, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    border: 1px solid #3a2020;
    font-family: 'Roboto', sans-serif;
}

/* Заголовок игры */
.flour-header {
    background: linear-gradient(180deg, #251515 0%, #1a0f0f 100%);
    padding: 15px 20px;
    border-bottom: 1px solid #3a2525;
}

.flour-stats {
    display: flex;
    justify-content: space-around;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.flour-stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #c0c0c0;
    font-size: 20px;
    font-weight: 700;
    font-family: 'Roboto', sans-serif;
}

.flour-stat-icon {
    font-size: 24px;
    display: flex;
    align-items: center;
}

.flour-stat-icon img {
    width: 40px;
    filter: drop-shadow(0 0 3px rgba(200, 180, 50, 0.4));
}

.flour-stat-value {
    min-width: 50px;
    text-align: center;
    background: rgba(80, 70, 30, 0.3);
    padding: 6px 14px;
    border-radius: 6px;
    font-family: 'Roboto', sans-serif;
    font-weight: 900;
    border: 1px solid #504020;
}

.flour-time-warning {
    animation: pulseOrange 0.5s infinite;
    color: #e09555;
}

@keyframes pulseOrange {
    0%, 100% {
        background: rgba(150, 100, 40, 0.5);
        transform: scale(1);
    }
    50% {
        background: rgba(180, 120, 50, 0.7);
        transform: scale(1.05);
    }
}

.flour-admin-mode {
    background: linear-gradient(135deg, #4a3a1a, #352815);
    padding: 6px 16px;
    border-radius: 6px;
    color: #d4a84a;
    font-size: 14px;
    font-weight: 700;
    border: 1px solid #5a4030;
}

/* Игровое поле */
.flour-game-field {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, 
        #1a1820 0%,
        #20202e 40%,
        #25253a 100%
    );
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

/* Фоновый узор */
.flour-game-field::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.02) 0%, transparent 50%),
        radial-gradient(circle at 80% 60%, rgba(255, 255, 255, 0.02) 0%, transparent 50%);
    pointer-events: none;
}

/* Пол кухни */
.flour-floor {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: linear-gradient(180deg, 
        rgba(30, 25, 20, 0.5) 0%,
        rgba(25, 20, 15, 0.8) 50%,
        rgba(20, 15, 10, 0.9) 100%
    );
    border-top: 2px solid #3a3025;
    box-shadow: inset 0 4px 12px rgba(0, 0, 0, 0.4);
    pointer-events: none;
}

/* Инструкция */
.flour-instruction {
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    color: #b0b0b0;
    font-size: 16px;
    font-weight: 500;
    text-align: center;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    pointer-events: none;
    z-index: 10;
    font-family: 'Roboto', sans-serif;
    background: rgba(0, 0, 0, 0.4);
    padding: 8px 18px;
    border-radius: 6px;
    border: 1px solid #2a2a1a;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Падающие объекты */
.flour-falling-item {
    position: absolute;
    width: 80px;
    height: 80px;
    pointer-events: none;
    z-index: 50;
    transition: top 0.05s linear;
}

.flour-falling-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
    pointer-events: none;
}

/* Анимация вращения для муки */
.flour-falling-item[data-type^="flour"] img {
    animation: flourRotate 2s linear infinite;
}

@keyframes flourRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Анимация покачивания для червяка */
.flour-falling-item[data-type="worm"] img {
    animation: wormWiggle 0.5s ease-in-out infinite;
}

@keyframes wormWiggle {
    0%, 100% { transform: rotate(-5deg); }
    50% { transform: rotate(5deg); }
}

/* Миска (корзина для ловли) */
.flour-basket {
    position: absolute;
    bottom: 85px;
    width: 140px;
    height: 100px;
    cursor: grab;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: left 0.05s ease-out;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

.flour-basket.dragging {
    cursor: grabbing;
    z-index: 101;
}

.flour-basket-shadow {
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 20px;
    background: radial-gradient(ellipse at center, 
        rgba(40, 30, 20, 0.4) 0%, 
        transparent 70%
    );
    filter: blur(8px);
    z-index: 1;
    pointer-events: none;
}

/* ИЗОБРАЖЕНИЕ МИСКИ */
.flour-basket-image {
    width: 140px;
    height: 100px;
    object-fit: contain;
    position: relative;
    z-index: 2;
    transition: transform 0.1s ease;
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
    pointer-events: none;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
}

.flour-basket:hover .flour-basket-image {
    transform: scale(1.05);
}

/* Эффект попадания */
.flour-basket.caught-good .flour-basket-image {
    animation: basketBounceGood 0.3s ease;
}

.flour-basket.caught-bad .flour-basket-image {
    animation: basketBounceBad 0.3s ease;
}

@keyframes basketBounceGood {
    0%, 100% { transform: scale(1); }
    50% { 
        transform: scale(1.15); 
        filter: drop-shadow(0 4px 16px rgba(212, 168, 74, 0.8)) brightness(1.2);
    }
}

@keyframes basketBounceBad {
    0%, 100% { transform: scale(1); }
    25% { transform: translateX(-10px) scale(0.95) rotate(-5deg); }
    75% { transform: translateX(10px) scale(0.95) rotate(5deg); }
}

/* Очки, появляющиеся при поимке */
.flour-score-popup {
    position: absolute;
    font-size: 24px;
    font-weight: 900;
    color: #d4a84a;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
    pointer-events: none;
    z-index: 200;
    animation: scorePopup 1s ease forwards;
}

.flour-score-popup.negative {
    color: #e05555;
}

@keyframes scorePopup {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-80px) scale(1.5);
    }
}

/* Кнопка выхода */
.flour-exit-btn {
    position: absolute;
    top: 15px;
    left: 15px;
    padding: 8px 14px;
    background: rgba(30, 25, 20, 0.6);
    color: #808080;
    border: 1px solid #352525;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    z-index: 200;
    font-family: 'Roboto', sans-serif;
    opacity: 0.7;
}

.flour-exit-btn:hover {
    background: rgba(50, 40, 30, 0.8);
    color: #b0b0b0;
    opacity: 1;
}

/* Экран результатов */
.flour-results {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #151015 0%, #1e1518 50%, #201518 100%);
    animation: slideIn 0.5s ease;
    font-family: 'Roboto', sans-serif;
}

@keyframes slideIn {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.flour-results-content {
    text-align: center;
    color: #c0c0c0;
    padding: 30px;
}

.flour-results-content h2 {
    font-size: 32px;
    margin-bottom: 25px;
    text-shadow: 0 2px 8px rgba(80, 60, 20, 0.4);
    animation: scaleIn 0.5s ease;
    font-weight: 900;
    color: #d0a080;
}

@keyframes scaleIn {
    from { transform: scale(0); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.flour-final-score {
    margin: 25px 0;
}

.flour-score-label {
    font-size: 18px;
    margin-bottom: 10px;
    font-weight: 500;
    color: #909090;
}

.flour-score-number {
    font-size: 56px;
    font-weight: 900;
    text-shadow: 0 4px 12px rgba(80, 60, 20, 0.5);
    animation: popIn 0.6s ease 0.3s both;
    color: #d4a84a;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.flour-score-number img {
    width: 56px;
    height: 56px;
}

@keyframes popIn {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

.flour-results-message {
    font-size: 15px;
    margin: 20px 0;
    padding: 15px;
    background: rgba(80, 60, 30, 0.2);
    border-radius: 8px;
    border: 1px solid #504025;
    font-weight: 500;
    line-height: 1.6;
}

.flour-results-buttons {
    margin-top: 25px;
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.flour-results-buttons button {
    padding: 12px 24px;
    font-size: 14px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    font-family: 'Roboto', sans-serif;
}

.flour-btn-primary {
    background: linear-gradient(135deg, #604030, #4a3020);
    color: #d4a84a;
    border: 1px solid #705040;
}

.flour-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(80, 60, 30, 0.4);
    background: linear-gradient(135deg, #705040, #5a4030);
}

.flour-btn-secondary {
    background: rgba(40, 40, 45, 0.8);
    color: #b0b0b0;
    border: 1px solid #404045;
}

.flour-btn-secondary:hover {
    background: rgba(50, 50, 55, 0.9);
    transform: translateY(-2px);
}

/* Адаптивность */
@media (max-width: 768px) {
    .flour-game {
        width: 100%;
        height: 100vh;
        max-height: none;
        border-radius: 0;
    }
    
    .flour-header {
        padding: 12px 15px;
    }
    
    .flour-stat-item {
        font-size: 18px;
    }
    
    .flour-stat-icon img {
        width: 36px;
        height: 36px;
    }
    
    .flour-stat-value {
        padding: 5px 12px;
        min-width: 45px;
        font-size: 16px;
    }
    
    .flour-instruction {
        font-size: 14px;
        top: 12px;
        padding: 6px 14px;
    }
    
    .flour-basket {
        width: 130px;
        height: 90px;
        bottom: 85px;
    }
    
    .flour-basket-image {
        width: 130px;
        height: 90px;
    }
    
    .flour-falling-item {
        width: 70px;
        height: 70px;
    }
    
    .flour-exit-btn {
        padding: 6px 10px;
        font-size: 11px;
        top: 10px;
        left: 10px;
    }
    
    .flour-results-content h2 {
        font-size: 26px;
    }
    
    .flour-score-number {
        font-size: 44px;
    }
    
    .flour-score-number img {
        width: 44px;
        height: 44px;
    }
    
    .flour-results-buttons {
        flex-direction: column;
    }
    
    .flour-results-buttons button {
        width: 100%;
    }
}

@media (max-width: 400px) {
    .flour-stats {
        gap: 6px;
    }
    
    .flour-stat-item {
        font-size: 16px;
        gap: 5px;
    }
    
    .flour-stat-icon img {
        width: 32px;
        height: 32px;
    }
    
    .flour-basket {
        width: 120px;
        height: 80px;
    }
    
    .flour-basket-image {
        width: 120px;
        height: 80px;
    }
    
    .flour-score-number {
        font-size: 38px;
    }
    
    .flour-score-number img {
        width: 38px;
        height: 38px;
    }
}
