/* ===== Базовый сброс и общий стиль ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    background: #ffffff;
    color: #000000;
    -webkit-tap-highlight-color: transparent;
}

body {
    position: relative;
    transition: background-color 2s ease;
}

/* Финальный чёрный фон */
body.blackout {
    background: #000000;
    color: #ffffff;
}

/* ===== Верхние углы — версия и часы ===== */
.version {
    position: fixed;
    top: 12px;
    left: 16px;
    font-size: 11px;
    color: #999;
    user-select: none;
    z-index: 10;
}

.clock {
    position: fixed;
    top: 12px;
    right: 16px;
    font-size: 14px;
    font-weight: 700;
    color: #333;
    user-select: none;
    z-index: 10;
    letter-spacing: 1px;
}

body.blackout .version,
body.blackout .clock {
    color: #555;
}

/* ===== Главная область с кнопкой ===== */
.stage {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
}

/* ===== Кнопка ===== */
.button {
    /* Абсолютное позиционирование позволяет ей "убегать" */
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    min-width: 220px;
    min-height: 220px;
    padding: 40px 50px;
    border: none;
    border-radius: 50%;
    background: #e63946;
    color: #ffffff;
    font-family: inherit;
    font-size: 22px;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 2px;
    box-shadow: 0 8px 30px rgba(230, 57, 70, 0.4);
    /* Плавное движение при убегании и смене цвета */
    transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                top 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                background-color 0.6s ease,
                opacity 0.8s ease,
                box-shadow 0.6s ease;
    user-select: none;
    outline: none;
    z-index: 5;
}

.button:active {
    transform: translate(-50%, -50%) scale(0.95);
}

.button.fade-out {
    opacity: 0;
    pointer-events: none;
}

/* ===== Счётчик и подсказка ===== */
.info {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    font-size: 14px;
    color: #555;
    user-select: none;
    z-index: 4;
    transition: opacity 0.6s ease;
    width: 90%;
    max-width: 600px;
}

.counter {
    font-size: 15px;
    margin-bottom: 8px;
}

.counter strong {
    color: #e63946;
    font-size: 17px;
}

.hint {
    font-size: 12px;
    color: #aaa;
    font-style: italic;
}

.info.hidden {
    opacity: 0;
    pointer-events: none;
}

/* ===== Большой текст после нажатия ===== */
.big-message {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: clamp(24px, 5vw, 48px);
    font-weight: 700;
    color: #000;
    text-align: center;
    white-space: pre-wrap;
    opacity: 0;
    transition: opacity 0.6s ease, color 2s ease;
    pointer-events: none;
    z-index: 6;
    padding: 0 20px;
}

.big-message.show {
    opacity: 1;
}

body.blackout .big-message {
    color: #fff;
}

/* ===== Финальный текст блокировки ===== */
.block-message {
    position: fixed;
    left: 50%;
    bottom: 60px;
    transform: translateX(-50%);
    color: #ffffff;
    font-size: 14px;
    text-align: center;
    opacity: 0;
    transition: opacity 1.5s ease;
    pointer-events: none;
    width: 90%;
    max-width: 600px;
    line-height: 1.6;
    z-index: 7;
}

.block-message.show {
    opacity: 1;
}

.block-timer {
    display: block;
    margin-top: 16px;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 2px;
    color: #e63946;
}

/* ===== Toast-уведомление ===== */
.toast {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%) translateY(-120%);
    background: #000;
    color: #fff;
    padding: 14px 24px;
    font-size: 13px;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 20;
    max-width: 90%;
    text-align: center;
    line-height: 1.5;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

/* ===== Лидерборд ===== */
.leaderboard-toggle {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    background: #000;
    color: #fff;
    border: none;
    padding: 12px 8px;
    font-family: inherit;
    font-size: 11px;
    cursor: pointer;
    writing-mode: vertical-rl;
    border-radius: 6px 0 0 6px;
    letter-spacing: 2px;
    z-index: 15;
    transition: background 0.3s;
}

.leaderboard-toggle:hover {
    background: #e63946;
}

.leaderboard {
    position: fixed;
    right: 0;
    top: 0;
    height: 100%;
    width: 320px;
    max-width: 85%;
    background: #fafafa;
    border-left: 2px solid #000;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 16;
    padding: 30px 20px;
    overflow-y: auto;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
}

.leaderboard.open {
    transform: translateX(0);
}

.leaderboard h2 {
    font-size: 16px;
    margin-bottom: 6px;
    letter-spacing: 1px;
}

.leaderboard .subtitle {
    font-size: 11px;
    color: #888;
    margin-bottom: 20px;
}

.leaderboard ol {
    list-style: none;
    padding: 0;
}

.leaderboard li {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px dashed #ccc;
    font-size: 13px;
}

.leaderboard li .rank {
    color: #e63946;
    font-weight: 700;
    margin-right: 8px;
}

.leaderboard li .nick {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.leaderboard li .time {
    color: #555;
    margin-left: 8px;
    font-weight: 700;
}

.leaderboard .empty {
    color: #999;
    font-size: 12px;
    font-style: italic;
    text-align: center;
    margin-top: 20px;
}

.leaderboard-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    border: none;
    font-family: inherit;
    font-size: 18px;
    cursor: pointer;
    color: #666;
}

/* ===== Адаптивность ===== */
@media (max-width: 600px) {
    .button {
        min-width: 180px;
        min-height: 180px;
        font-size: 18px;
        padding: 30px 35px;
    }

    .info {
        bottom: 40px;
    }

    .counter {
        font-size: 13px;
    }

    .counter strong {
        font-size: 15px;
    }

    .clock {
        font-size: 12px;
    }

    .version {
        font-size: 10px;
    }

    .leaderboard-toggle {
        font-size: 10px;
        padding: 10px 6px;
    }
}
