/* ============================================
   SCRATCH - Игра "Скретч-карты"
   ============================================ */

/* ========== ПЛАТФОРМО-ЗАВИСИМЫЕ ПОЗИЦИИ ========== */

/* По умолчанию */
#scratch-screen {
    padding-top: 0 !important;
    position: relative;
    min-height: 100vh;
}

#scratch-screen header {
    top: 0 !important;
    background: transparent !important;
    z-index: 10;
}
#scratch-screen header::before { display: none !important; }

/* iOS: настройка позиций для скретча */
html[data-platform="ios"] #scratch-screen {
    padding-top: 70px !important;
}

html[data-platform="ios"] #scratch-screen header {
    top: 20px !important;
}

/* Android: настройка позиций для скретча */
html[data-platform="android"] #scratch-screen {
    padding-top: 50px !important;
}

html[data-platform="android"] #scratch-screen header {
    top: 15px !important;
}

/* ========== ФОН СКРЕТЧ-ЭКРАНА ========== */

#scratch-screen::before {
    content: '';
    position: absolute;
    inset: 0;
    /* Фолбэк */
    background-image: url('../content/scratch-cards.png');
    /* Современные форматы */
    background-image: image-set(
        url('../content/scratch-cards.avif') type('image/avif'),
        url('../content/scratch-cards.webp') type('image/webp'),
        url('../content/scratch-cards.png') type('image/png')
    );
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center calc(var(--scratch-bg-offset-y, 0px));
    opacity: 0.8;
    pointer-events: none;
    z-index: 0;
}

#scratch-screen::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(rgba(0,0,0,0.25), rgba(0,0,0,0.25));
    pointer-events: none;
    z-index: 1;
}

#scratch-screen > * { 
    position: relative; 
    z-index: 2; 
}

/* ========== ИГРОВАЯ ОБЛАСТЬ ========== */

.scratch-game-area {
    background: rgba(0, 0, 0, 0.35);
    padding: 1.5rem;
    border-radius: 1rem;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
    backdrop-filter: blur(4px);
}

/* Карточка внутри */
#scratch-card-container::before {
    background: rgba(0,0,0,0.35);
}

/* ========== CANVAS СКРЕТЧ-КАРТЫ ========== */

#scratch-card-canvas {
    border-radius: 6px;
    touch-action: none;
    display: block;
}

/* ========== ВИЗУАЛЬНЫЕ ЭФФЕКТЫ ========== */

/* Контейнер для блика - обрезает анимацию по границам карты */
#scratch-card-container {
    overflow: hidden;
    border-radius: 8px;
    border: 2px solid #ffd700;
}

.scratch-foil-overlay {
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    border-radius: 8px;
    pointer-events: none;
    background: linear-gradient(
        105deg, 
        transparent 0%,
        transparent 35%,
        rgba(255,255,255,0.15) 45%,
        rgba(255,215,0,0.2) 50%,
        rgba(255,255,255,0.15) 55%,
        transparent 65%,
        transparent 100%
    );
    animation: scratchFoilShine 3s ease-in-out infinite;
}

@keyframes scratchFoilShine {
    0% { 
        left: -50%;
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% { 
        left: 150%;
        opacity: 0;
    }
}

/* ========== ИНДИКАТОР ПРОГРЕССА ========== */

#scratch-percentage-display.enhanced { 
    position: relative; 
    height: 90px; 
    width: 90px; 
}

#scratch-progress-ring { 
    position: relative; 
    width: 90px; 
    height: 90px; 
    margin: 0 auto; 
}

#scratch-progress-ring svg { 
    width: 90px; 
    height: 90px; 
    transform: rotate(-90deg); 
}

.scratch-ring-bg { 
    stroke: rgba(255,255,255,0.18); 
    stroke-width: 6; 
    fill: none; 
}

.scratch-ring-fg { 
    stroke: #ffd700; 
    stroke-width: 6; 
    stroke-linecap: round; 
    fill: none; 
    transition: stroke-dashoffset .25s ease, filter .3s; 
    filter: drop-shadow(0 0 6px rgba(255,215,0,0.5)); 
}

.scratch-ring-label { 
    position: absolute; 
    top: 50%; 
    left: 50%; 
    transform: translate(-50%, -50%); 
    font-size: 14px; 
    font-weight: 700; 
    color: #ffd700; 
    text-shadow: 0 0 4px rgba(0,0,0,0.6); 
    font-family: Poppins, sans-serif; 
}

.scratch-ring-complete .scratch-ring-fg { 
    filter: drop-shadow(0 0 10px rgba(255,215,0,0.9)); 
}

/* ========== ЧАСТИЦЫ ========== */

.scratch-particle-container { 
    position: absolute; 
    inset: 0; 
    pointer-events: none; 
    overflow: hidden; 
    border-radius: 8px; 
}

.scratch-dust { 
    position: absolute; 
    width: 6px; 
    height: 6px; 
    background: #ffd700; 
    border-radius: 50%; 
    opacity: 0; 
    animation: scratchDust 0.6s ease-out forwards; 
}

@keyframes scratchDust { 
    0% { transform: scale(.4); opacity: 1; } 
    70% { opacity: 1; } 
    100% { transform: translateY(-30px) scale(0.1); opacity: 0; } 
}
