.referral-page {
    min-width: 0;
}

.content-area:has(.referral-page) { min-width: 0; }

.rf-hero {
    position: relative;
    padding: 30px 32px;
    margin-bottom: 16px;
    border-radius: 24px;
    overflow: hidden;
    color: #ffffff;
    background: linear-gradient(135deg, #0f2557 0%, #1d4ed8 55%, #2563eb 100%);
    box-shadow: 0 14px 36px rgba(15, 37, 87, 0.26);
}

.rf-hero::before {
    content: '';
    position: absolute;
    top: -45%;
    right: -8%;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.28) 0%, transparent 62%);
    pointer-events: none;
}

.rf-hero__body {
    position: relative;
    z-index: 1;
}

.rf-hero__kicker {
    display: inline-block;
    padding: 5px 12px;
    margin-bottom: 13px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.22);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.1px;
    text-transform: uppercase;
}

.rf-hero__title {
    max-width: 560px;
    font-size: clamp(22px, 2.8vw, 31px);
    font-weight: 800;
    line-height: 1.16;
    letter-spacing: -0.5px;
    color: #ffffff;
}

.rf-terms {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 20px 0 22px;
}

.rf-term {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.rf-term__num {
    font-size: 26px;
    font-weight: 900;
    line-height: 1;
    letter-spacing: -0.8px;
    color: #7dd3fc;
    white-space: nowrap;
}

.rf-term__text {
    font-size: 12px;
    line-height: 1.35;
    color: rgba(255, 255, 255, 0.8);
}

.rf-link__label {
    display: block;
    margin-bottom: 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.6);
}

.rf-link__row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.28);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    flex-wrap: wrap;
}

.ref-link__input {
    flex: 1 1 240px;
    min-width: 0;
    height: 46px;
    padding: 0 16px;
    border: 0;
    border-radius: 14px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    outline: none;
    text-overflow: ellipsis;
}

.ref-link__btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 46px;
    padding: 0 22px;
    border: 0;
    border-radius: 14px;
    background: var(--surface);
    color: var(--accent);
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: all .2s ease;
}

.ref-link__btn svg {
    width: 15px;
    height: 15px;
    flex: none;
}

.ref-link__btn:hover { background: var(--surface-2); transform: translateY(-1px); }

.ref-link__btn.copied { background: var(--ok); color: #fff; }

.rf-share {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    margin-top: 12px;
    padding: 10px 18px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    font: inherit;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    transition: all .2s ease;
}

.rf-share svg {
    width: 18px;
    height: 18px;
    flex: none;
}

.rf-share:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: translateY(-1px);
}

.rf-how {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.rf-how__step {
    display: flex;
    align-items: flex-start;
    gap: 13px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
}

.rf-how__num {
    flex: none;
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--surface-accent);
    color: var(--accent);
    font-size: 14px;
    font-weight: 800;
}

.rf-how__step h3 {
    margin: 0;
    font-size: 14.5px;
    font-weight: 700;
    color: var(--text);
}

.rf-how__step p {
    margin: 4px 0 0;
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--text-faint);
}

.rf-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.rf-stat {
    padding: 18px 20px;
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    transition: border-color .2s ease, box-shadow .2s ease;
}

.rf-stat:hover {
    border-color: var(--border);
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
}

.rf-stat__icon {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    margin-bottom: 12px;
    border-radius: 11px;
    background: var(--surface-accent);
    color: var(--accent);
}

.rf-stat__icon svg {
    width: 19px;
    height: 19px;
}

.rf-stat__value {
    font-size: 24px;
    font-weight: 800;
    color: var(--text);
    line-height: 1.1;
    letter-spacing: -.5px;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

.rf-stat__label {
    margin-top: 4px;
    font-size: 12.5px;
    color: var(--text-dim);
}

.rf-card {
    display: block;
    padding: 22px;
    margin-bottom: 16px;
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--surface);
}

.rf-card__head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-soft);
}

.rf-card__head h3 { margin: 0; font-size: 15.5px; font-weight: 800; color: var(--text); }
.rf-card__head p { margin: 3px 0 0; font-size: 12.5px; color: var(--text-faint); }

.ref-badge {
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--surface-accent);
    border: 1px solid rgba(37, 99, 235, .16);
    color: var(--accent);
    font-size: 12.5px;
    font-weight: 700;
    white-space: nowrap;
}

.chart-wrapper {
    position: relative;
    width: 100%;
    height: 240px;
}

.ref-table { min-width: 0; }

.ref-table__head,
.referral-row {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
}

.ref-table__head {
    padding: 0 12px 10px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-faint);
}

.referral-row {
    padding: 12px;
    border-radius: 16px;
    transition: background .2s ease;
}
.referral-row:hover { background: var(--surface-2); }
.referral-row + .referral-row { border-top: 1px solid var(--border-soft); }

.referral-player {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.referral-avatar {
    width: 38px;
    height: 38px;
    flex: none;
    border-radius: 13px;
    display: grid;
    place-items: center;
    background: linear-gradient(145deg, #2563eb, #60a5fa);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
}

.referral-player-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.referral-player-meta {
    font-size: 12px;
    color: var(--text-faint);
    margin-top: 1px;
}

.referral-player-id {
    font-size: 13px;
    color: var(--text-dim);
    font-variant-numeric: tabular-nums;
}

.referral-deposit {
    font-size: 14px;
    font-weight: 700;
    color: var(--ok);
    font-variant-numeric: tabular-nums;
}
.referral-deposit.zero { color: var(--text-faint); font-weight: 500; }

.referral-action-btn {
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--accent);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all .2s ease;
}
.referral-action-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    box-shadow: 0 6px 16px rgba(37, 99, 235, .22);
}

.referral-fs-done {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid var(--ok-border);
    background: var(--ok-soft);
    color: var(--ok-strong);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.referral-fs-wait {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px dashed var(--border-strong);
    background: var(--surface-2);
    color: var(--text-dim);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    cursor: help;
}

.ref-empty {
    text-align: center;
    padding: 44px 20px;
    color: var(--text-faint);
}
.ref-empty-icon {
    width: 44px;
    height: 44px;
    margin: 0 auto 12px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--surface-3);
    color: var(--text-faint);
}
.ref-empty-text { font-size: 14px; }

.ref-pagination {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 18px;
}
.ref-pagination:empty { display: none; }

.ref-pagination button {
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-2);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s ease;
}
.ref-pagination button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.ref-pagination button.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.ref-pagination button:disabled { opacity: .4; cursor: not-allowed; }

.ref-modal { display: none; }
.ref-modal.open { display: block; }

.ref-modal__overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(15, 23, 42, .55);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}

.ref-modal__box {
    width: 100%;
    max-width: 440px;
    background: var(--surface);
    border-radius: 24px;
    box-shadow: 0 24px 64px rgba(15, 23, 42, .24);
    overflow: hidden;
    animation: refModalIn .22s cubic-bezier(.34, 1.4, .64, 1);
}
@keyframes refModalIn {
    from { opacity: 0; transform: translateY(12px) scale(.98); }
}

.ref-modal__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 22px 24px 16px;
    border-bottom: 1px solid var(--border-soft);
}
.ref-modal__head h3 { margin: 0; font-size: 17px; font-weight: 700; color: var(--text); }
.ref-modal__head p { margin: 4px 0 0; font-size: 13px; color: var(--text-faint); }

.ref-modal__close {
    width: 30px;
    height: 30px;
    flex: none;
    border: 0;
    border-radius: 50%;
    background: var(--surface-3);
    color: var(--text-dim);
    font-size: 19px;
    line-height: 1;
    cursor: pointer;
    transition: all .2s ease;
}
.ref-modal__close:hover { background: var(--border); color: var(--text); }

.ref-modal__body { padding: 20px 24px 24px; }
.ref-modal__submit { width: 100%; justify-content: center; margin-top: 16px; }

.ref-slots { display: flex; flex-direction: column; gap: 8px; }

.fs-slot-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--surface);
    cursor: pointer;
    transition: all .2s cubic-bezier(.4, 0, .2, 1);
}
.fs-slot-item:hover { border-color: var(--border-strong); background: var(--surface-2); }
.fs-slot-item.selected {
    border-color: var(--accent);
    background: var(--surface-accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}

.fs-slot-icon {
    width: 40px;
    height: 40px;
    flex: none;
    border-radius: 13px;
    display: grid;
    place-items: center;
    background: var(--surface-3);
    font-size: 20px;
}
.fs-slot-info { min-width: 0; flex: 1; }
.fs-slot-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.fs-slot-desc { font-size: 12px; color: var(--text-faint); margin-top: 1px; }

.fs-slot-check {
    width: 20px;
    height: 20px;
    flex: none;
    border-radius: 50%;
    border: 2px solid var(--border);
    display: grid;
    place-items: center;
    color: transparent;
    font-size: 11px;
    transition: all .2s ease;
}
.fs-slot-item.selected .fs-slot-check {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.fs-message {
    margin-top: 14px;
    padding: 11px 14px;
    border-radius: 14px;
    font-size: 13.5px;
    text-align: center;
}
.fs-message.success { background: var(--ok-soft); color: var(--ok); }
.fs-message.error { background: var(--danger-soft); color: var(--danger); }

.ref-steps { display: flex; flex-direction: column; gap: 14px; }

.ref-step { display: flex; gap: 12px; align-items: flex-start; }
.ref-step__num {
    width: 26px;
    height: 26px;
    flex: none;
    border-radius: 9px;
    display: grid;
    place-items: center;
    background: var(--surface-accent);
    color: var(--accent);
    font-size: 13px;
    font-weight: 800;
}
.ref-step__txt { font-size: 13.5px; line-height: 1.5; color: var(--text-2); min-width: 0; }
.ref-step__txt b { color: var(--text); font-weight: 700; }

.ref-terms { display: flex; flex-direction: column; gap: 10px; }
.ref-term {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 16px;
    background: var(--surface-2);
}
.ref-term__label { font-size: 13px; color: var(--text-dim); min-width: 0; }
.ref-term__value {
    font-size: 15px;
    font-weight: 800;
    color: var(--accent);
    white-space: nowrap;
}

@media (max-width: 900px) {
    .referral-page .banner { padding: 24px 26px; }
    .referral-page .banner-title { font-size: 23px; }
    .referral-page .banner-image img { width: 100px; }
}

@media (max-width: 700px) {

    .ref-table__head,
    .referral-row { grid-template-columns: minmax(0, 1fr) auto auto; }
    .ref-table__head span:nth-child(2),
    .referral-player-id { display: none; }
}

@media (max-width: 640px) {
    .rf-hero {
        padding: 22px 18px;
        border-radius: 20px;
    }

    .rf-terms { gap: 8px; }

    .rf-term {
        flex: 1 1 140px;
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        padding: 12px 14px;
    }

    .rf-term__num { font-size: 22px; }

    .rf-card { padding: 18px; }
    .rf-stat { padding: 16px; }
    .rf-stat__value { font-size: 21px; }
    .rf-how__step { padding: 15px; }

    .chart-wrapper { height: 200px; }

    .ref-link__btn { flex: 1; justify-content: center; }
    .rf-share { width: 100%; justify-content: center; }
}

.rf-pots {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.rf-pot {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 18px 20px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
}

.rf-pot__head {
    display: flex;
    align-items: center;
    gap: 12px;
}

.rf-pot__icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    flex: none;
    border-radius: 12px;
    background: var(--accent-soft, rgba(37, 99, 235, .1));
    color: var(--accent);
}

.rf-pot__icon svg { width: 20px; height: 20px; }

.rf-pot__label {
    font-size: 12.5px;
    color: var(--text-faint);
}

.rf-pot__value {
    font-size: 24px;
    font-weight: 800;
    line-height: 1.2;
    color: var(--text);
}

.rf-pot__hint {
    margin: 0;
    font-size: 12px;
    color: var(--text-faint);
}

.rf-pot__btn {
    margin-top: auto;
    padding: 11px 16px;
    border: 0;
    border-radius: 12px;
    background: var(--accent);
    color: #fff;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity .15s ease, transform .15s ease;
}

.rf-pot__btn:hover:not(:disabled) { transform: translateY(-1px); }

.rf-pot__btn:disabled {
    opacity: .45;
    cursor: default;
}

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