/* styles/wheel.css */
/* ====== БАЗОВЫЕ СТИЛИ ====== */
.wheel-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.92);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
                visibility 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    box-sizing: border-box;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
}

.wheel-container.visible {
    opacity: 1;
    visibility: visible;
}

/* ====== КНОПКА ЗАКРЫТИЯ ====== */
.close-btnWF {
    position: fixed;
    top: max(1.5rem, env(safe-area-inset-top));
    right: max(1.5rem, env(safe-area-inset-right));
    width: 3.5rem;
    height: 3.5rem;
    background: rgba(255, 255, 255, 0.12);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    font-size: 2.2rem;
    font-weight: 300;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10004;
    backdrop-filter: blur(10px) saturate(180%);
    -webkit-backdrop-filter: blur(10px) saturate(180%);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    user-select: none;
    min-width: 44px;
    min-height: 44px;
}

.close-btnWF:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.4);
}

.close-btnWF:active {
    transform: scale(0.95) rotate(90deg);
    transition: transform 0.1s ease;
}

/* ====== ОСНОВНОЙ КОНТЕНТ ====== */
.wheel-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 1200px;
    gap: 2.5rem;
    position: relative;
}

/* ====== ОБЕРТКА КОЛЕСА И СТРЕЛКИ ====== */
.wheel-wrapper {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

/* ====== КОЛЕСО ФОРТУНЫ ====== */
.wheel {
    position: relative;
    width: min(85vmin, 36rem);
    height: min(85vmin, 36rem);
    max-width: 36rem;
    max-height: 36rem;
    min-width: 18rem;
    min-height: 18rem;
    border-radius: 50%;
    background: conic-gradient(
        from 0deg,
        #3498db 0deg 60deg,
        #2ecc71 60deg 120deg,
        #e74c3c 120deg 180deg,
        #f39c12 180deg 240deg,
        #9b59b6 240deg 300deg,
        #1abc9c 300deg 360deg
    );
    box-shadow: 
        0 0 40px rgba(0, 0, 0, 0.6),
        inset 0 0 60px rgba(255, 255, 255, 0.1),
        0 0 0 2px rgba(255, 255, 255, 0.05);
    overflow: hidden;
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    will-change: transform;
}

.wheel::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10%;
    height: 10%;
    background: white;
    border-radius: 50%;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    z-index: 2;
}

/* ====== СЕГМЕНТЫ КОЛЕСА ====== */
.wheel-segment {
    position: absolute;
    width: 50%;
    height: 50%;
    transform-origin: bottom right;
    left: 0;
    top: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    overflow: hidden;
    clip-path: polygon(0 0, 100% 0, 100% 100%);
    user-select: none;
}

.wheel-segment-content {
    transform: rotate(45deg);
    color: white;
    font-weight: 800;
    font-size: clamp(0.65rem, 2vmin, 1.2rem);
    text-align: center;
    width: 65%;
    height: 65%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-shadow: 
        1px 1px 3px rgba(0, 0, 0, 0.8),
        0 0 10px rgba(255, 255, 255, 0.3);
    pointer-events: none;
    line-height: 1.2;
    padding: 10% 0 0 10%;
}

/* Индивидуальные цвета сегментов */
.wheel-segment:nth-child(1) .wheel-segment-content { color: #2c3e50; }
.wheel-segment:nth-child(2) .wheel-segment-content { color: #27ae60; }
.wheel-segment:nth-child(3) .wheel-segment-content { color: #c0392b; }
.wheel-segment:nth-child(4) .wheel-segment-content { color: #f39c12; }
.wheel-segment:nth-child(5) .wheel-segment-content { color: #8e44ad; }
.wheel-segment:nth-child(6) .wheel-segment-content { color: #16a085; }

/* ====== СТРЕЛКА ====== */
.wheel-pointer {
    position: absolute;
    top: -2.5rem;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 1.2rem solid transparent;
    border-right: 1.2rem solid transparent;
    border-top: 2.5rem solid #e74c3c;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
    z-index: 10001;
    transition: transform 0.3s ease;
}

.wheel-pointer::before {
    content: '';
    position: absolute;
    top: -2.8rem;
    left: 50%;
    transform: translateX(-50%);
    width: 0.8rem;
    height: 0.8rem;
    background: #e74c3c;
    border-radius: 50%;
}

/* ====== КНОПКА ВРАЩЕНИЯ ====== */
.spin-button {
    position: relative;
    padding: 1.2rem 3.5rem;
    background: linear-gradient(145deg, #2ecc71, #27ae60);
    color: white;
    border: none;
    border-radius: 3rem;
    cursor: pointer;
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    z-index: 10002;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 8px 25px rgba(46, 204, 113, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    min-width: 160px;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    overflow: hidden;
}

.spin-button::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.7s ease;
}

.spin-button:hover::before {
    left: 100%;
}

.spin-button:hover {
    background: linear-gradient(145deg, #27ae60, #219653);
    transform: translateY(-3px) scale(1.05);
    box-shadow: 
        0 12px 35px rgba(39, 174, 96, 0.5),
        0 0 0 2px rgba(255, 255, 255, 0.15);
}

.spin-button:active {
    transform: translateY(-1px) scale(0.98);
    transition: transform 0.1s ease;
}

.spin-button:disabled {
    background: linear-gradient(145deg, #95a5a6, #7f8c8d);
    transform: none !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    cursor: not-allowed;
    opacity: 0.7;
}

.spin-text {
    position: relative;
    z-index: 1;
}

.spin-icon {
    font-size: 1.6rem;
    animation: pulse 2s infinite;
    position: relative;
    z-index: 1;
}

/* ====== АНИМАЦИИ ====== */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(3600deg); /* 10 оборотов */
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
}

.wheel.spinning {
    animation: spin 4.5s cubic-bezier(0.17, 0.67, 0.21, 0.99) forwards;
}

/* ====== АДАПТИВНОСТЬ ====== */

/* Планшеты */
@media (max-width: 1024px) {
    .wheel-container {
        padding: 1.5rem;
    }
    
    .wheel {
        width: min(80vmin, 28rem);
        height: min(80vmin, 28rem);
    }
    
    .spin-button {
        padding: 1rem 2.5rem;
        font-size: 1.2rem;
        min-width: 140px;
        min-height: 55px;
    }
    
    .close-btnWF {
        width: 3rem;
        height: 3rem;
        font-size: 1.8rem;
    }
}

/* Мобильные (портрет) */
@media (max-width: 768px) {
    .wheel-container {
        padding: 1rem;
    }
    
    .wheel-content {
        gap: 2rem;
    }
    
    .wheel {
        width: min(90vmin, 22rem);
        height: min(90vmin, 22rem);
    }
    
    .wheel-pointer {
        top: -2rem;
        border-left-width: 1rem;
        border-right-width: 1rem;
        border-top-width: 2rem;
    }
    
    .spin-button {
        padding: 0.9rem 2rem;
        font-size: 1.1rem;
        min-width: 130px;
        min-height: 50px;
        border-radius: 2rem;
    }
    
    .close-btnWF {
        top: max(1rem, env(safe-area-inset-top));
        right: max(1rem, env(safe-area-inset-right));
        width: 2.8rem;
        height: 2.8rem;
        font-size: 1.6rem;
    }
}

/* Маленькие мобильные */
@media (max-width: 480px) {
    .wheel {
        width: min(95vmin, 20rem);
        height: min(95vmin, 20rem);
        min-width: 16rem;
        min-height: 16rem;
    }
    
    .wheel-segment-content {
        font-size: clamp(0.6rem, 2.5vmin, 0.9rem);
    }
    
    .spin-button {
        padding: 0.8rem 1.8rem;
        font-size: 1rem;
        min-width: 120px;
        min-height: 48px;
        gap: 0.5rem;
    }
    
    .spin-icon {
        font-size: 1.3rem;
    }
}

/* Ландшафтный режим */
@media (max-height: 700px) and (orientation: landscape) {
    .wheel-container {
        padding: 1rem;
    }
    
    .wheel-content {
        flex-direction: row;
        gap: 3rem;
        justify-content: center;
        align-items: center;
        max-height: 90vh;
    }
    
    .wheel {
        width: min(70vmin, 24rem);
        height: min(70vmin, 24rem);
        flex-shrink: 0;
    }
    
    .spin-button {
        margin-top: 0;
        align-self: center;
    }
    
    .wheel-pointer {
        top: -1.8rem;
    }
}

/* Очень маленькая высота */
@media (max-height: 500px) and (orientation: landscape) {
    .wheel-content {
        gap: 1.5rem;
    }
    
    .wheel {
        width: min(60vmin, 20rem);
        height: min(60vmin, 20rem);
    }
    
    .spin-button {
        padding: 0.7rem 1.5rem;
        font-size: 0.9rem;
        min-width: 110px;
        min-height: 45px;
    }
    
    .wheel-segment-content {
        font-size: 0.7rem;
    }
}

/* Большие экраны */
@media (min-width: 1600px) {
    .wheel {
        width: 40rem;
        height: 40rem;
    }
    
    .wheel-segment-content {
        font-size: 1.4rem;
    }
    
    .spin-button {
        padding: 1.5rem 4rem;
        font-size: 1.6rem;
        min-width: 180px;
        min-height: 70px;
    }
}

/* Поддержка темной/светлой темы */
@media (prefers-color-scheme: light) {
    .wheel-container {
        background-color: rgba(0, 0, 0, 0.88);
    }
    
    .close-btnWF {
        background: rgba(0, 0, 0, 0.15);
        border-color: rgba(0, 0, 0, 0.25);
        color: rgba(255, 255, 255, 0.9);
    }
}

/* Улучшение доступности */
.close-btnWF:focus-visible,
.spin-button:focus-visible {
    outline: 3px solid #3498db;
    outline-offset: 3px;
}

/* Высокий DPI экраны */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .wheel {
        box-shadow: 
            0 0 60px rgba(0, 0, 0, 0.7),
            inset 0 0 80px rgba(255, 255, 255, 0.1);
    }
    
    .spin-button {
        box-shadow: 
            0 10px 30px rgba(46, 204, 113, 0.5),
            0 0 0 1.5px rgba(255, 255, 255, 0.15);
    }
}

/* Анимация появления */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wheel-container.visible .wheel-content {
    animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) both;
}