html, body {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    background: radial-gradient(ellipse at center, #202233 60%, #191a28 100%);
    color: #eee;
    min-height: 100vh;
}

.main {
    max-width: 420px;
    margin: 0 auto;
    padding: 16px;
}

.timer-box {
    background: #22253d;
    border-radius: 24px;
    margin: 16px 0;
    padding: 18px;
    text-align: center;
    box-shadow: 0 0 0 transparent !important;
    overflow: hidden;      /* <----- ЭТО ВАЖНО! */
}



/* Цифры таймера  */
.timer-wait {
    color: #a3ffe6;
    font-size: 22px;
    font-weight: bold;
    text-align: center;
    line-height: 1.22;
    letter-spacing: 1px;
    margin: 20px 0 16px 0;
    /* Можно glow, но деликатный */
    text-shadow:
      0 0 2px #009d91,
      0 0 6px #15ffbc33;
    /* Без анимаций! */
    transition: color 0.14s, text-shadow 0.14s;
}

.timer-value {
    color: #d6fff0;
    font-size: 46px;
    font-weight: bold;
    letter-spacing: 2px;
    text-align: center;
    text-shadow:
      0 0 3px #0a2832,
      0 0 8px #15ffbc99;
    animation: timer-glow-fade 1.1s infinite alternate;
}
@keyframes timer-glow-fade {
    0% { text-shadow: 0 0 3px #0a2832, 0 0 4px #15ffbc66; }
    100% { text-shadow: 0 0 3px #0a2832, 0 0 12px #15ffbc99; }
}



/* Кнопки запуска — общий блок и уникальные стили */
#startBtn, #stopBtn {
    font-size: 28px;
    width: 100%;
    min-width: 180px;
    min-height: 62px;
    border: none;
    border-radius: 18px;
    margin: 18px 0 18px 0;
    padding: 16px 0;
    font-weight: bold;
    letter-spacing: 2px;
    cursor: pointer;
    position: relative;
    outline: none;
    box-sizing: border-box;
    z-index: 2;
    transition: background 0.20s, box-shadow 0.15s, color 0.14s;
    overflow: hidden;
}
#startBtn {
    background: #09e97c;
    color: #101e13;
    text-shadow: 0 0 3px #00ffc1, 0 0 7px #00ffc155;
    box-shadow: 0 0 16px 3px #00ffb344, 0 0 5px 2px #00ffd733;
    border: 2px solid #15ffbc;
}
#startBtn:hover {
    background: #32ffbe;
    color: #0b5632;
    text-shadow: 0 0 7px #fff, 0 0 12px #15ffbc99;
    box-shadow: 0 0 19px 6px #2affd666, 0 0 8px 2px #16ffb880;
}
#startBtn:active {
    background: #0ab761;
    color: #001f11;
    box-shadow: 0 0 9px 3.5px #00ffc166;
}
#stopBtn {
    background: #ff2e63;
    color: #fff;
    text-shadow: 0 0 7px #fff, 0 0 13px #ff005a99;
    box-shadow: 0 0 14px 4px #ff2e6388, 0 0 7px 2px #ff2e6360;
    border: 2px solid #ff2e63;
}
#stopBtn:hover {
    background: #ff4d7e;
    box-shadow: 0 0 21px 6.5px #ff2e63cc, 0 0 9px 3px #ff5e99aa;
}
#stopBtn:active {
    background: #c41545;
    box-shadow: 0 0 8px 3px #ff2e6366;
}
#startBtn[disabled], #stopBtn[disabled] {
    opacity: 0.5;
}

#startBtn::before, #startBtn::after {
    content: '';
    position: absolute;
    left: -120%;
    width: 240%;
    height: 10px;
    background: linear-gradient(90deg, transparent 0%, #26ffe7 30%, #bbff44 55%, #26ffe7 80%, transparent 100%);
    opacity: 0.98;
    border-radius: 10px;
    pointer-events: none;
    animation: line-glow-green 2.1s linear infinite;
    z-index: 3;
    box-shadow: 0 0 16px 6px #19ff85cc, 0 0 14px 1px #88ff37aa;
}
#startBtn::before { top: 0; }
#startBtn::after  { bottom: 0; }
@keyframes line-glow-green {
    0% { left: -120%; }
    100% { left: 100%; }
}


    
#stopBtn::before, #stopBtn::after {
    content: '';
    position: absolute;
    left: -120%;
    width: 240%;
    height: 10px; /* Толще! */
    background: linear-gradient(90deg, transparent 0%, #ff5ba5 25%, #fff7a3 50%, #ff5ba5 75%, transparent 100%);
    opacity: 0.98;
    border-radius: 10px;
    pointer-events: none;
    animation: line-glow-pink 2.1s linear infinite;
    z-index: 3;
    box-shadow: 0 0 16px 6px #ff5ba5cc;
}
#stopBtn::before { top: 0; }
#stopBtn::after  { bottom: 0; }
@keyframes line-glow-pink {
    0% { left: -120%; }
    100% { left: 100%; }
}


/* Лидерборд */
.leaderboard {
    margin: 24px 0 12px 0;
    background: rgba(25, 26, 40, 0.0); /* полностью прозрачный */
    border-radius: 18px;
    padding: 14px;
    text-align: center;
}
.lb-title {
    font-size: 20px;
    margin-bottom: 8px;
}
.lb-table {
    width: 100%;
    font-size: 16px;
    margin: 0 auto;
}
.lb-table td {
    padding: 4px 7px;
}
.medal {
    font-size: 22px;
}
.prize {
    color: gold;
    font-weight: bold;
}
.win-range {
    color: #b8eb38;
    font-weight: bold;
}
.note {
    color: #ccc;
    font-size: 13px;
}
.top-legend {
    color: #ffe07a;
    font-size: 15px;
    margin-top: 8px;
}

/* Всегда flex! */
#winModal {
    position: fixed;                /* Окно поверх всех элементов */
    left: 0; top: 0;                /* Левый верхний угол */
    width: 100vw; height: 100vh;    /* На всю ширину/высоту экрана */
    background: rgba(12, 14, 22, 0.88); /* Полупрозрачный чёрный фон */
    z-index: 10;                    /* Поверх всех окон */
    display: flex;                  /* Центрируем содержимое */
    align-items: center;            /* Центр по вертикали */
    justify-content: center;        /* Центр по горизонтали */
    opacity: 0;                     /* Скрыто по умолчанию */
    pointer-events: none;           /* Не кликается, когда скрыто */
    transition: opacity 0.33s cubic-bezier(1,0,.16,1.01); /* Плавное появление/затухание */
    backdrop-filter: blur(7px);     /* Красивое размытие фона */
    overflow-y: auto;               /* Позволяет скроллить модалку, если много контента */
    -webkit-overflow-scrolling: touch; /* Лёгкий скролл на iOS */
}
/* Когда .active — плавное появление */
#winModal.active {
    opacity: 1;                   /* Полностью видно */
    pointer-events: auto;         /* Можно кликать */
}

/* --- Добавь адаптивности карточке! --- */
#winCard {
    background: #191a22;                /* Цвет самой карточки */
    border-radius: 28px;                /* Скругление */
    max-width: 340px;                   /* Максимальная ширина (на десктопах) */
    width: 96vw;                        /* Почти на всю ширину экрана, но с отступами */
    max-height: calc(100vh - 40px);     /* Не выходит за край экрана, всегда с запасом */
    overflow-y: auto;                   /* Если много текста — скролл внутри карточки */
    margin: 20px 0;                     /* Отступ сверху/снизу (для мобильных) */
    box-shadow: 0 10px 40px 0 #0007, 0 1.5px 6px 0 #09e80d55;  /* Тень (глубина) */
    padding: 30px 18px 24px 18px;       /* Внутренние отступы */
    box-sizing: border-box;             /* Не вылезает за пределы */
    /* Анимация появления */
    transform: translateY(60px) scale(0.57); /* Сдвинута вниз и чуть уменьшена в начале */
    opacity: 0;                              /* Скрыта */
    transition:
        opacity 0.52s 0.08s cubic-bezier(1,0,.16,1.01),   /* Плавное появление */
        transform 0.54s 0.11s cubic-bezier(1,0,.16,1.01); /* Плавный подъем и увеличение */
    will-change: transform, opacity;   /* Подсказка браузеру — будет анимация этих свойств */
}
/* Когда .active — делаем анимацию */
#winModal.active #winCard {
    opacity: 1;                       /* Показать */
    transform: translateY(0) scale(1.0); /* На место, полный размер */
    transition-delay: 0.56s, 1.13s;      /* Анимация чуть позже фона для красивого эффекта */
}


/* Победный блок */
#winshot {
    background: #232445;
    border-radius: 22px;
    padding: 24px 18px 14px 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 4px 20px #000a;
    margin: 0 auto 16px auto;
    box-sizing: border-box;
}

.win-header {
    font-size: 24px;
    font-weight: bold;
    color: #ffe07a;
    margin-bottom: 8px;
}

.win-sub {
    font-size: 14px;
    color: #ccc;
    margin-bottom: 10px;
}

.place-row {
    font-size: 16px;
    font-weight: bold;
    color: #ffdd55;
    margin: 8px 0 2px;
}
.result-row {
    font-size: 14px;
    margin: 2px 0;
}
.timer-value {
    color: #00ffcc;
    font-weight: bold;
}
.reward-row {
    font-size: 16px;
    color: #00ff00;
    margin-top: 8px;
}
.reward-val {
    font-weight: bold;
}

/* QR */
#qrCanvas {
    margin-top: 10px;
    border-radius: 6px;
}

/* Proof */
.win-proof {
    background: #15191e;
    color: #b3e3b7;
    font-size: 11px;
    border-radius: 7px;
    padding: 7px 5px;
    margin: 10px 0 2px;
    text-align: left;
    word-break: break-all;
    width: 100%;
    box-sizing: border-box;
}

/* Ref */
.win-ref {
    color: #36fa6e;
    text-align: center;
    font-size: 11px;
    margin: 10px 0 0;
    word-break: break-all;
}

/* Назад */
.win-back-btn {
    background: linear-gradient(90deg, #26ffe7, #bbff44);
    color: #111;
    font-size: 20px;
    font-weight: bold;
    border: 2px solid #00ffcc;
    border-radius: 12px;
    padding: 10px 0;
    margin: 14px 0 0;
    width: 100%;
    cursor: pointer;
    box-shadow: 0 0 12px 2px #26ffe777;
    transition: background 0.3s, transform 0.2s;
}
.win-back-btn:hover {
    transform: scale(1.03);
    box-shadow: 0 0 16px 4px #00ffc977;
}


/* Адаптив */
@media (max-width: 500px) {
    .main {
        padding: 1px;
    }
    #winCard {
        padding: 0;
        max-width: 99vw;
    }
    #winshot {
        max-width: 95vw;
        padding: 16px 4vw 12px 4vw;
        border-radius: 14px;
    }
    .win-header {
        font-size: 20px;
    }
    .win-sub {
        font-size: 13px;
    }
    .place-row,
    .result-row,
    .reward-row {
        font-size: 14px;
    }
    .win-proof, .win-ref {
        font-size: 10px;
    }
    .win-back-btn {
        font-size: 12px;
        padding: 6px 0;
    }
}
#qrCanvas {
    margin-top: 10px;
    border-radius: 12px;
    background: #fff;
}
.win-socials {
    display: flex;
    justify-content: center;
    margin: 12px 0 0 0;
}

.win-socials-block {
    margin-top: 12px;
    text-align: center;
}
.share-text {
    font-size: 13px;
    color: #aaa;
    margin-bottom: 6px;
}
.win-soc-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}
.soc-btn, .copy-btn {
    background: #333;
    color: #fff;
    padding: 5px 12px;
    border-radius: 8px;
    font-size: 13px;
    text-decoration: none;
    font-weight: bold;
    border: none;
    cursor: pointer;
}
.soc-btn.vb {
    background: linear-gradient(145deg, #6f4dbf, #8e6be7);
    color: white;
}
.soc-btn.tg { background: #229ed9; }
.soc-btn.wa { background: #25d366; }
.soc-btn.fb { background: #4267B2; }
.copy-btn:hover, .soc-btn:hover {
    opacity: 0.8;
}

#eventsBox {
    opacity: 0;
    pointer-events: none;
    transition: opacity 1.35s;
}
#eventsBox.active {
    opacity: 1;
    pointer-events: auto;
}
.user-highlight {
    background: linear-gradient(90deg, #1bd87e33, #093);
    color: #fff;
    font-weight: bold;
    border-radius: 8px;
    box-shadow: 0 0 8px #09e80d33;
}
.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 6px;
}
#withdrawBox {
    opacity: 0;
    pointer-events: none;
    transition: opacity 1.15s cubic-bezier(.9,0,.16,1.01);
    display: none; /* Важно! */
}
#withdrawBox.active {
    opacity: 1;
    pointer-events: auto;
    display: block;
}
.podium-flex {
        display: flex;
        justify-content: center;
        align-items: flex-end;
        gap: 22px;
        margin-bottom: 10px;
}
.podium-card {
        display: flex;
        flex-direction: column;
        align-items: center;
        position: relative;
        background: none;
        box-shadow: none;
        min-height: 170px;
        padding: 6px 0 0 0;
}

.podium-avatar {
        width: 56px;
        height: 56px;
        border-radius: 50%;
        border: 3px solid #fff;
        background: #222;
        box-shadow: 0 4px 16px #0003;
        z-index: 2;
        margin-bottom: 1px;
        transition: box-shadow 0.25s;
}
.podium-winner-glow {
        box-shadow:
                0 0 0 5px #fff3,
                0 0 20px 5px #ffe271cc,
                0 0 34px 14px #fff99e33 !important;
}

.podium-medal {
        font-size: 30px;
        margin-bottom: 0;
        margin-top: 2px;
        text-shadow:
                0 1px 3px #0009,
                0 0 9px #fff6,
                0 0 22px #ffd700aa;
        filter: drop-shadow(0 0 8px #fff6);
        transition: filter 0.18s;
        z-index:3;
}
.podium-medal-0 { filter: drop-shadow(0 0 9px #b8b8ffcc); }
.podium-medal-1 { filter: drop-shadow(0 0 11px #ffe271cc); }
.podium-medal-2 { filter: drop-shadow(0 0 9px #ff9900bb); }

.podium-time {
        font-size: 15px;
        font-weight: bold;
        margin-top: 2px;
        text-shadow: 0 1px 7px #2228, 0 0 10px #fff4;
        letter-spacing: 0.5px;
        border-radius: 7px;
        padding: 1.5px 13px;
        background: rgba(32,32,50,0.10);
        /* background слабо-цветной, чтобы визуально лежало на пьедестале */
}

.pedestal-base {
        border-radius: 0 !important;
        /* Убрали скругления */
}
@keyframes pulse-glow {
        0% { opacity: 0.87; transform: translateX(-50%) scale(0.92);}
        100% { opacity: 1; transform: translateX(-50%) scale(1.05);}
}
@keyframes podium-glow-gold {
    0% { box-shadow: 0 0 22px 7px #ffe97c55, 0 0 46px 12px #ffd70022; }
    40% { box-shadow: 0 0 37px 15px #ffe97cbb, 0 0 60px 19px #ffd70055; }
    100% { box-shadow: 0 0 22px 7px #ffe97c55, 0 0 46px 12px #ffd70022; }
}
@keyframes podium-glow-silver {
    0% { box-shadow: 0 0 16px 7px #b8b8ff33, 0 0 38px 9px #a7f7ff22; }
    40% { box-shadow: 0 0 30px 14px #b8b8ffbb, 0 0 55px 19px #a7f7ff55; }
    100% { box-shadow: 0 0 16px 7px #b8b8ff33, 0 0 38px 9px #a7f7ff22; }
}
@keyframes podium-glow-bronze {
    0% { box-shadow: 0 0 13px 6px #ffb36233, 0 0 26px 7px #ff990022; }
    40% { box-shadow: 0 0 28px 13px #ffb362bb, 0 0 44px 17px #ff990055; }
    100% { box-shadow: 0 0 13px 6px #ffb36233, 0 0 26px 7px #ff990022; }
}
.podium-glow-gold {
    animation: podium-glow-gold 2.3s ease-in-out infinite;
}
.podium-glow-silver {
    animation: podium-glow-silver 2.8s ease-in-out infinite;
}
.podium-glow-bronze {
    animation: podium-glow-bronze 3.0s ease-in-out infinite;
}
.top-legend {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 48px;
    margin-top: -12px;
    margin-bottom: 8px;
}

.legend-item {
    font-weight: bold;
    font-size: 18px;
    min-width: 60px;
    text-align: center;
    filter: drop-shadow(0 0 8px #0008);
    position: relative;
    overflow: visible;
    background: linear-gradient(90deg,#fffbe4 10%,#ffe66c 35%,#ffc10e 70%,#fffbe4 100%);
    color: transparent;
    -webkit-background-clip: text;
    background-clip: text;
}
.legend-center {
    font-size: 20px;
    color: #fff083;
}

.sparkle-star {
    position: absolute;
    width: 22px;
    height: 22px;
    pointer-events: none;
    opacity: 0;
    transform: scale(0.4) rotate(0deg);
    z-index: 2;
    animation: sparkle-star-glint 8.8s infinite;
    will-change: opacity, transform;
}
@keyframes sparkle-star-glint {
    0%, 90%   { opacity: 0; transform: scale(0.3) rotate(0deg);}
    92%       { opacity: 1; transform: scale(1.2) rotate(18deg);}
    94%       { opacity: 0.8; }
    96%       { opacity: 0; transform: scale(0.3) rotate(0deg);}
    100%      { opacity: 0; }
}



/* стрелки  */

.socials-arrows-svg {
    /* Контейнер для стрелок, занимает всю область блока соц. кнопок */
    position: absolute;
    left: 0;             /* прижимаем к левому краю */
    right: 0;            /* прижимаем к правому краю */
    top: 0;              /* прижимаем к верху */
    bottom: 0;           /* прижимаем к низу */
    width: 100%;         /* ширина 100% от родителя */
    height: 100%;        /* высота 100% от родителя */
    pointer-events: none;/* стрелки не блокируют клики по кнопкам */
    z-index: 10;         /* стрелки поверх всего контента внутри блока */
}

.socials-arrows-svg svg {
    /* Общий стиль для обеих стрелок */
    position: absolute;                    /* свободное позиционирование */
    width: 44px;                           /* ширина SVG-стрелки */
    height: 44px;                          /* высота SVG-стрелки */
    opacity: 0.99;                         /* почти полностью видимые */
    filter: drop-shadow(0 0 1px #00ffe0b0) /* бирюзовое свечение вокруг */
           drop-shadow(0 0 1px #fffbe6b0); /* мягкое белое свечение */
}

/* СТРЕЛКА TG (слева от TG, смотрит влево) */
.socials-arrows-svg .arrow-tg {
    left: 18px;                /* отступ от левого края (стрелка слева) */
    top: 70px;               /* вертикальная позиция — строго напротив кнопки TG */
    transform: scaleX(-1) rotate(0deg); /* зеркалим по горизонтали: стрелка "смотрит" влево */
    animation: arrow-move-tg 1.5s infinite alternate; /* анимация движения */
}

/* Анимация "дыхания" стрелки TG (движение влево и назад) */
@keyframes arrow-move-tg {
    0%   { transform: scaleX(-1) rotate(0deg) translateX(0); }
    50%  { transform: scaleX(-1) rotate(0deg) translateX(-15px); } /* стрелка уходит ещё левее */
    100% { transform: scaleX(-1) rotate(0deg) translateX(0); }
}

/* СТРЕЛКА FB (справа от FB, смотрит вправо) */
.socials-arrows-svg .arrow-fb {
    right: 28px;               /* отступ от правого края (стрелка справа) */
    top: 70px;               /* вертикальная позиция — строго напротив кнопки FB */
    transform: rotate(0deg);  /* без поворота: стрелка смотрит вправо */
    animation: arrow-move-fb 1.5s infinite alternate .4s; /* анимация движения, с задержкой */
}

/* Анимация "дыхания" стрелки FB (движение вправо и назад) */
@keyframes arrow-move-fb {
    0%   { transform: rotate(0deg) translateX(0); }
    50%  { transform: rotate(0deg) translateX(15px); } /* стрелка уходит ещё правее */
    100% { transform: rotate(0deg) translateX(0); }
}

/* Кнопки вкл выкл вибро звук */
.header-icons button {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    margin-left: 4px;
    padding: 0 2px;
    color: #00eaaa;
    opacity: 0.9;
    transition: opacity .2s;
}
.header-icons button:hover {
    opacity: 1;
}

/* Пульс и зум для текста */
/* Контрастный радужный текст с плавным зумом */
.share-text {
    font-size: 22px !important;
    font-weight: 900;
    letter-spacing: 0.3px;
    margin-bottom: 13px !important;
    padding: 0 10px;
    border-radius: 6px;
    /* Радужный градиент для текста */
    background: linear-gradient(90deg,
        #ff0000,  /* Красный */
        #ff9900,  /* Оранжевый */
        #ffee00,  /* Жёлтый */
        #33ff00,  /* Зелёный */
        #00fff7,  /* Голубой */
        #0066ff,  /* Синий */
        #a800ff,  /* Фиолетовый */
        #ff008c,  /* Розовый */
        #ff0000   /* Красный (замыкаем круг) */
    );
    background-size: 400% 100%;
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    /* Только плавный зум, без моргания */
    animation: text-zoom 1.2s infinite cubic-bezier(.7,0,.2,1), rainbow-move 5s infinite linear;
    /* Нет text-shadow! */
}

/* Зум — только один спокойный удар (нет двойного "сердцебиения") */
@keyframes text-zoom {
    0%   { transform: scale(1);}
    10%  { transform: scale(1.10);}
    25%  { transform: scale(1.16);}
    40%  { transform: scale(1.10);}
    60%  { transform: scale(1);}
    100% { transform: scale(1);}
}

/* Плавное движение радуги по тексту */
@keyframes rainbow-move {
    0%   { background-position:   0% 50%; }
    100% { background-position: 100% 50%; }
}

