* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    background:
        linear-gradient(180deg, rgba(10, 12, 17, 0.88), rgba(10, 12, 17, 0.92)),
        url('https://ru.dalam.world/dwback.jpeg') center center / cover no-repeat fixed;
    color: #e8e8ec;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.card {
    width: 100%;
    max-width: 460px;
    background: #171b24;
    border: 1px solid #262b38;
    border-radius: 14px;
    padding: 32px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.card.wide {
    max-width: 640px;
}

.mascot {
    display: block;
    max-width: 140px;
    width: 40%;
    margin: 0 auto 16px;
    filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.45));
}

h1 {
    font-size: 20px;
    margin: 0 0 24px;
    color: #fff;
    text-align: center;
}

label {
    display: block;
    font-size: 13px;
    color: #9aa1b2;
    margin-bottom: 6px;
}

input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 12px 14px;
    margin-bottom: 16px;
    border-radius: 8px;
    border: 1px solid #2c3242;
    background: #10131a;
    color: #fff;
    font-size: 15px;
}

input:focus {
    outline: none;
    border-color: #5b8cff;
}

button {
    padding: 12px;
    border: none;
    border-radius: 8px;
    background: #5b8cff;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

button:hover {
    background: #4977e0;
}

button:disabled {
    opacity: 0.6;
    cursor: default;
}

#loginForm button {
    width: 100%;
}

.error {
    background: #3a1d22;
    border: 1px solid #7a2c34;
    color: #ff9aa5;
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}

.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.stat {
    background: #10131a;
    border: 1px solid #262b38;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 12px;
}

.stat .label {
    font-size: 12px;
    color: #9aa1b2;
    text-transform: uppercase;
    letter-spacing: .03em;
    margin-bottom: 4px;
}

.stat .value {
    font-size: 22px;
    font-weight: 700;
    color: #fff;
}

.code {
    font-family: 'Courier New', monospace;
    background: #1e2330;
    padding: 3px 8px;
    border-radius: 6px;
    color: #7fd3ff;
}

.refs {
    margin-top: 8px;
    max-height: 320px;
    overflow-y: auto;
}

.refs table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.refs th,
.refs td {
    text-align: left;
    padding: 8px;
    border-bottom: 1px solid #262b38;
    color: #cfd3dd;
    white-space: nowrap;
}

.refs th {
    color: #9aa1b2;
    font-weight: 500;
    position: sticky;
    top: 0;
    background: #10131a;
}

.top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.top-row h1 {
    margin: 0;
    text-align: left;
}

.logout {
    font-size: 13px;
    color: #9aa1b2;
    background: transparent;
    border: 1px solid #2c3242;
    padding: 6px 12px;
    border-radius: 8px;
}

.logout:hover {
    color: #fff;
    border-color: #5b8cff;
    background: transparent;
}

.empty {
    color: #6b7183;
    font-size: 13px;
    padding: 8px 0;
}

@media (max-width: 480px) {
    .grid {
        grid-template-columns: 1fr;
    }
}

/* ---------- Языковой переключатель ---------- */
.lang-switcher {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 10;
}

.lang-switcher select {
    background: #171b24;
    color: #e8e8ec;
    border: 1px solid #262b38;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
    cursor: pointer;
}

/* ---------- Кнопка регистрации ---------- */
.register-link {
    display: block;
    text-align: center;
    margin-top: 14px;
    font-size: 13px;
    color: #9aa1b2;
    text-decoration: none;
    border: 1px solid #2c3242;
    padding: 10px;
    border-radius: 8px;
}

.register-link:hover {
    color: #fff;
    border-color: #5b8cff;
}

/* ---------- Копирование (реферальная ссылка и т.д.) ---------- */
.copy-row {
    display: flex;
    gap: 8px;
}

.copy-row input[type="text"] {
    flex: 1;
    margin-bottom: 0;
    font-size: 13px;
    color: #cfd3dd;
}

.copy-btn {
    white-space: nowrap;
    background: #262b38;
    padding: 10px 14px;
    font-size: 13px;
}

.copy-btn:hover {
    background: #323a4d;
}

.copy-btn.copied {
    background: #1f4d33;
    color: #7fffb0;
}

/* ---------- Раздел выплат ---------- */
.payouts-section {
    margin-top: 4px;
}

.mini-label {
    font-size: 12px;
    color: #9aa1b2;
    margin-bottom: 2px;
}

.payouts-balance-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.primary-btn {
    background: #5b8cff;
    padding: 12px 18px;
    white-space: nowrap;
}

.primary-btn:hover {
    background: #4977e0;
}

.socials-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.social-btn {
    flex: 1;
    min-width: 160px;
    text-align: center;
    text-decoration: none;
    color: #fff;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
}

.social-btn.telegram {
    background: #229ed9;
}

.social-btn.telegram:hover {
    background: #1c86ba;
}

.social-btn.discord {
    background: #5865f2;
}

.social-btn.discord:hover {
    background: #4752c4;
}

/* ---------- Модалка запроса выплаты ---------- */
.payout-modal {
    position: fixed;
    inset: 0;
    background: rgba(5, 7, 11, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 100;
}

/* Важно: без этого правила display:flex выше перебивает атрибут hidden,
   и модалка остаётся видимой всегда, даже когда hidden выставлен через JS. */
.payout-modal[hidden] {
    display: none;
}

.payout-modal-inner {
    position: relative;
    width: 100%;
    max-width: 480px;
    background: #171b24;
    border: 1px solid #262b38;
    border-radius: 14px;
    padding: 28px;
}

.payout-modal-inner label {
    margin-top: 12px;
}

.payout-modal-inner label:first-of-type {
    margin-top: 0;
}

.payout-modal-inner textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #2c3242;
    background: #10131a;
    color: #fff;
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    margin-bottom: 8px;
}

.payout-modal-inner textarea:focus {
    outline: none;
    border-color: #5b8cff;
}

.payout-modal-actions {
    margin-bottom: 14px;
}

.payout-modal-actions .copy-btn {
    width: 100%;
    padding: 12px;
}

.modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    background: transparent;
    border: none;
    color: #9aa1b2;
    font-size: 22px;
    line-height: 1;
    padding: 4px 8px;
    cursor: pointer;
}

.modal-close:hover {
    color: #fff;
    background: transparent;
}
