/*1. ПЕРЕКРЫТИЕ ФОНА (МОДАЛЬНЫЙ ОВЕРЛЕЙ)
========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 14, 20, 0.8); /* Затемнение игрового экрана */
    backdrop-filter: blur(5px); /* Размытие поля битвы на заднем фоне */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000; /* Окно гарантированно поверх всего интерфейса */
    /* По умолчанию окно скрыто. Для показа через JS мы уберем эти 2 строчки или переключим их */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* Класс-активатор, который мы будем навешивать через JS для плавного появления */
.modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

/* ==========================================================================
   2. КАРТОЧКА ОКНА РЕГИСТРАЦИИ (БЛИЖЕ К КВАДРАТУ)
   ========================================================================== */
.modal-card {
    background: rgba(22, 27, 34, 0.96);
    border: 1px solid #30363d;
    border-top: 3px solid #8b6b43; /* Золотой кант сверху */
    border-radius: 8px;
    width: 100%;
    max-width: 460px; /* Фиксированная компактная ширина */
    padding: 30px 25px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.85);
    position: relative;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

/* Анимация увеличения карточки при открытии */
.modal-overlay.open .modal-card {
    transform: scale(1);
}

/* Заголовок модального окна */
.modal-card h2 {
    color: #f0f6fc;
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: center;
    margin-bottom: 25px;
    border-bottom: 1px solid #30363d;
    padding-bottom: 10px;
}

/* ==========================================================================
   3. КНОПКА ЗАКРЫТИЯ (КРЕСТИК)
   ========================================================================== */
.modal-close-btn {
    position: absolute;
    top: 12px;
    right: 15px;
    background: transparent;
    border: none;
    color: #8b949e;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    transition: color 0.2s ease;
}

    .modal-close-btn:hover {
        color: #ff7b72; /* Красное подсвечивание при наведении */
    }

/* ==========================================================================
   4. СТРОКИ С ПОЛЯМИ ВВОДА И ТУЛТИПАМИ
   ========================================================================== */
.reg-row {
    display: flex;
    flex-direction: column;
    margin-bottom: 16px;
    position: relative;
}

    .reg-row label {
        font-size: 0.85rem;
        color: #8b949e;
        font-weight: bold;
        margin-bottom: 6px;
    }

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.reg-row input[type="text"],
.reg-row input[type="password"],
.reg-row input[type="email"] {
    width: 100%;
    padding: 10px 12px;
    background: #0d1117;
    border: 1px solid #30363d;
    color: #f0f6fc;
    font-size: 0.85rem;
    border-radius: 4px;
    outline: none;
    transition: border-color 0.2s;
}

.reg-row input:focus {
    border-color: #8b6b43; /* Фокус под золото */
}

/* ТУЛТИПЫ (ВСПЛЫВАЮЩИЕ ПОДСКАЗКИ СПРАВА ОТ ПОЛЕЙ) */
.tooltip {
    position: absolute;
    left: calc(100% + 15px); /* Выталкиваем подсказку вправо за пределы карточки */
    top: 50%;
    transform: translateY(-50%);
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: bold;
    border-radius: 4px;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    z-index: 1010;
    /* По умолчанию скрыты, включаются классами состояния */
    display: none;
}

    /* Стрелочка-указатель для тултипа */
    .tooltip::before {
        content: '';
        position: absolute;
        right: 100%;
        top: 50%;
        margin-top: -5px;
        border-width: 5px;
        border-style: solid;
    }

    /* Состояние проверки (желтый/янтарный) */
    .tooltip.status-checking {
        background: #21262d;
        border: 1px solid #f1e05a;
        color: #f1e05a;
    }

        .tooltip.status-checking::before {
            border-color: transparent #f1e05a transparent transparent;
        }

    /* Состояние ошибки (красный) */
    .tooltip.status-error {
        background: #21262d;
        border: 1px solid #ff7b72;
        color: #ff7b72;
    }

        .tooltip.status-error::before {
            border-color: transparent #ff7b72 transparent transparent;
        }

/* ==========================================================================
   5. БЛОК КАПЧИ
   ========================================================================== */
.captcha-row {
    margin-bottom: 25px;
}

.captcha-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Окошко для самой картинки капчи */
.captcha-img-zone {
    width: 110px;
    height: 38px;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

    .captcha-img-zone img {
        max-width: 100%;
        height: auto;
        display: block;
    }

/* Маленькая круглая кнопка обновления со стрелочкой */
.captcha-refresh-btn {
    width: 38px;
    height: 38px;
    background: #21262d;
    border: 1px solid #30363d;
    color: #c9d1d9;
    font-size: 1.1rem;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s;
}

    .captcha-refresh-btn:hover {
        border-color: #8b6b43;
        color: #f1e05a;
    }

/* Поле ввода для кода капчи */
.captcha-wrapper input {
    flex: 1;
    padding: 10px 12px;
    background: #0d1117;
    border: 1px solid #30363d;
    color: #f0f6fc;
    font-size: 0.85rem;
    border-radius: 4px;
    outline: none;
}

/* ==========================================================================
   6. ФИНАЛЬНАЯ КНОПКА ОТПРАВКИ ПО ЦЕНТРУ
   ========================================================================== */
.reg-center-btn {
    display: flex;
    justify-content: center;
    margin-top: 10px;
}

.register-submit-btn {
    width: 65%; /* Аккуратная кнопка чуть шире половины окна */
    padding: 12px 0;
    background: #21262d;
    border: 1px solid #30363d;
    color: #f0f6fc;
    font-weight: bold;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

    .register-submit-btn:hover {
        background: #8b6b43;
        border-color: #ba9565;
        color: #0d1117;
    }

/* Адаптивность для мобильных экранов: убираем тултипы вбок, переносим их под поля */
@media (max-width: 768px) {
    .modal-card {
        max-width: 90%;
        padding: 20px 15px;
    }

    .tooltip {
        position: relative;
        left: 0 !important;
        top: 0 !important;
        transform: none !important;
        margin-top: 5px;
        display: block; /* Показываем внизу поля на мобилках */
        text-align: center;
    }

        .tooltip::before {
            display: none; /* Прячем стрелочку */
        }
}
