.activity-shell,
.activity-shell * {
    box-sizing: border-box;
}

.activity-shell {
    width: min(1240px, calc(100% - 40px));
    margin: 0 auto;
    padding: 42px 0 64px;
    position: relative;
    z-index: var(--z-sticky);
}

.activity-hero {
    display: grid;
    gap: 28px;
    padding: 36px;
    border: 1px solid rgba(125, 164, 224, 0.22);
    border-radius: 24px;
    background: rgba(13, 27, 55, 0.86);
    box-shadow: 0 24px 70px rgba(2, 8, 23, 0.26);
}

.activity-hero-copy {
    max-width: 760px;
}

.activity-hero h1 {
    margin: 0;
    color: #f8fbff;
    font-size: clamp(2.2rem, 4vw, 4rem);
    line-height: 1.02;
    letter-spacing: -0.04em;
}

.activity-hero p {
    max-width: 680px;
    margin: 14px 0 0;
    color: #b8c8e3;
    font-size: clamp(1rem, 1.7vw, 1.18rem);
    line-height: 1.65;
}

.activity-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.activity-stat {
    display: grid;
    grid-template-rows: minmax(2.55rem, auto) auto;
    min-width: 0;
    padding: 18px;
    border: 1px solid rgba(133, 170, 228, 0.18);
    border-radius: 16px;
    background: rgba(7, 18, 39, 0.64);
}

.activity-stat-value {
    display: flex;
    min-height: 2.55rem;
    align-items: center;
    overflow: hidden;
    color: #ffffff;
    font-size: clamp(1.45rem, 2.5vw, 2.2rem);
    font-weight: 750;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#statLastUpdate {
    font-size: clamp(1rem, 1.6vw, 1.35rem);
    letter-spacing: -0.015em;
    text-overflow: clip;
}

.activity-stat-label {
    display: block;
    margin-top: 7px;
    color: #9eb2d3;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    line-height: 1.35;
    text-transform: uppercase;
}

.activity-toolbar {
    display: grid;
    grid-template-columns: minmax(150px, 0.75fr) minmax(170px, 0.9fr) minmax(240px, 1.6fr) auto;
    gap: 12px;
    align-items: center;
    margin: 22px 0;
    padding: 14px;
    border: 1px solid rgba(125, 164, 224, 0.2);
    border-radius: 18px;
    background: rgba(10, 24, 49, 0.9);
}

.activity-field {
    min-width: 0;
}

.activity-field select,
.activity-search {
    width: 100%;
    min-height: 48px;
    border: 1px solid rgba(137, 173, 228, 0.3);
    border-radius: 12px;
    outline: 0;
    background: #102447;
    color: #f7faff;
    font: inherit;
}

.activity-field select {
    padding: 0 38px 0 14px;
}

.activity-search {
    padding: 0 15px;
}

.activity-field select:focus-visible,
.activity-search:focus-visible,
.activity-achievement-toggle:focus-within {
    border-color: #7db4ff;
    box-shadow: 0 0 0 3px rgba(77, 147, 255, 0.22);
}

.activity-achievement-toggle {
    display: inline-flex;
    min-height: 48px;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 0 16px;
    border: 1px solid rgba(137, 173, 228, 0.3);
    border-radius: 12px;
    color: #dce8fa;
    font-size: 0.9rem;
    font-weight: 650;
    white-space: nowrap;
}

.activity-achievement-toggle input {
    width: 18px;
    height: 18px;
    accent-color: #6ea8ff;
}

.activity-statistic-day {
    grid-column: 1 / -1;
    margin: 0;
    padding: 3px 4px 0;
    color: #aebfda;
    font-size: 0.8rem;
    line-height: 1.4;
    text-align: right;
}

.activity-feed-shell {
    position: relative;
    min-height: 240px;
}

.activity-feed {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.activity-card {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    min-width: 0;
    min-height: 112px;
    padding: 17px;
    border: 1px solid rgba(126, 164, 222, 0.19);
    border-radius: 17px;
    background: rgba(12, 28, 55, 0.88);
    box-shadow: none;
    transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.activity-card:hover,
.activity-card:focus-within {
    border-color: rgba(123, 177, 255, 0.48);
    background: rgba(16, 36, 69, 0.96);
    transform: translateY(-1px);
}

.activity-badge-link {
    display: grid;
    width: 52px;
    height: 52px;
    place-items: center;
    border-radius: 13px;
    background: rgba(5, 16, 35, 0.68);
}

.badge-img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    image-rendering: pixelated;
}

.activity-card-copy {
    display: grid;
    min-width: 0;
    gap: 9px;
}

.user-row {
    display: flex;
    min-width: 0;
    min-height: 44px;
    align-items: center;
    gap: 9px;
}

.activity-avatar {
    position: relative;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    overflow: hidden;
    border: 1px solid rgba(134, 173, 230, 0.25);
    border-radius: 50%;
    background: #0a1a36;
}

.user-avatar,
.activity-avatar-fallback {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.user-avatar {
    z-index: 2;
    opacity: 0;
    object-fit: cover;
}

.user-avatar[data-avatar-state="loaded"] {
    opacity: 1;
}

.activity-avatar-fallback {
    display: grid;
    place-items: center;
    color: #dceaff;
    font-weight: 800;
}

.user-avatar[data-avatar-state="loaded"] + .activity-avatar-fallback {
    opacity: 0;
}

.username-link {
    display: inline-flex;
    min-height: 32px;
    align-items: center;
    overflow: hidden;
    color: #f5f9ff;
    font-size: 1rem;
    font-weight: 760;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hotel-flag {
    flex: 0 0 auto;
    width: 18px;
    height: 12px;
    object-fit: cover;
}

.activity-badge-copy {
    display: flex;
    min-width: 0;
    flex-wrap: wrap;
    gap: 5px 9px;
    align-items: baseline;
    color: inherit;
    text-decoration: none;
}

.badge-name {
    overflow: hidden;
    max-width: 100%;
    color: #d9e6f8;
    font-size: 0.9rem;
    font-weight: 650;
    text-overflow: ellipsis;
    text-shadow: none;
    white-space: nowrap;
}

.badge-code {
    color: #89a2c7;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 0.72rem;
}

.time {
    align-self: end;
    color: #91a8ca;
    font-size: 0.75rem;
    white-space: nowrap;
}

.activity-refresh-overlay {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: grid;
    place-items: center;
    border-radius: 18px;
    background: rgba(5, 14, 31, 0.62);
    opacity: 0;
    pointer-events: none;
    transition: opacity 140ms ease;
}

.activity-refresh-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.activity-spinner {
    width: 34px;
    height: 34px;
    border: 3px solid rgba(143, 182, 239, 0.22);
    border-top-color: #91bdff;
    border-radius: 50%;
    animation: activity-spin 700ms linear infinite;
}

@keyframes activity-spin {
    to { transform: rotate(360deg); }
}

.activity-state {
    grid-column: 1 / -1;
    display: grid;
    min-height: 220px;
    place-items: center;
    align-content: center;
    gap: 16px;
    padding: 30px;
    border: 1px dashed rgba(139, 175, 229, 0.28);
    border-radius: 18px;
    color: #b9c9e1;
    text-align: center;
}

.activity-state--error {
    border-color: rgba(246, 135, 135, 0.38);
    color: #ffd0d0;
}

.activity-retry,
.activity-pagination button {
    min-height: 42px;
    padding: 0 16px;
    border: 1px solid rgba(125, 174, 244, 0.4);
    border-radius: 10px;
    background: #173a70;
    color: #f8fbff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.activity-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    min-height: 50px;
    margin-top: 22px;
}

.activity-pagination button:disabled {
    opacity: 0.42;
    cursor: default;
}

.activity-page-indicator {
    color: #aebfda;
    font-variant-numeric: tabular-nums;
}

[data-theme="light"] .activity-hero,
[data-theme="light"] .activity-toolbar,
[data-theme="light"] .activity-card {
    border-color: #cbd8ea;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 18px 48px rgba(40, 65, 100, 0.1);
}

[data-theme="light"] .activity-hero h1,
[data-theme="light"] .activity-stat-value,
[data-theme="light"] .username-link {
    color: #14233b;
}

[data-theme="light"] .activity-hero p,
[data-theme="light"] .activity-stat-label,
[data-theme="light"] .badge-code,
[data-theme="light"] .time,
[data-theme="light"] .activity-statistic-day,
[data-theme="light"] .activity-page-indicator {
    color: #536883;
}

[data-theme="light"] .activity-stat,
[data-theme="light"] .activity-badge-link,
[data-theme="light"] .activity-avatar {
    border-color: #d4dfed;
    background: #edf3fa;
}

[data-theme="light"] .activity-field select,
[data-theme="light"] .activity-search {
    border-color: #becde0;
    background: #ffffff;
    color: #17263c;
}

[data-theme="light"] .activity-achievement-toggle,
[data-theme="light"] .badge-name,
[data-theme="light"] .activity-state {
    color: #30445f;
}

[data-theme="light"] .activity-refresh-overlay {
    background: rgba(236, 243, 252, 0.72);
}

[data-theme="light"] .public-blue-page.activity-page .activity-card .time {
    color: #354a65;
}

@media (max-width: 900px) {
    .activity-shell {
        width: min(100% - 28px, 720px);
        padding-top: 24px;
    }

    .activity-stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .activity-toolbar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .activity-feed {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 600px) {
    .activity-shell {
        width: min(100% - 20px, 560px);
    }

    .activity-hero {
        gap: 22px;
        padding: 24px 18px;
        border-radius: 19px;
    }

    .activity-toolbar {
        grid-template-columns: minmax(0, 1fr);
        padding: 11px;
    }

    .activity-stat {
        padding: 14px;
    }

    .activity-card {
        grid-template-columns: 46px minmax(0, 1fr);
        min-height: 126px;
        padding: 14px;
    }

    .activity-badge-link {
        width: 46px;
        height: 46px;
    }

    .time {
        grid-column: 2;
        justify-self: start;
    }
}

@media (max-width: 375px) {
    .activity-shell {
        width: calc(100% - 16px);
    }

    .activity-hero {
        padding: 21px 14px;
    }

    .activity-stat-grid {
        gap: 8px;
    }

    .activity-stat {
        padding: 12px;
    }

    #statLastUpdate {
        overflow: visible;
        font-size: 1.1rem;
        overflow-wrap: anywhere;
        text-overflow: clip;
        white-space: normal;
    }

    .activity-card {
        gap: 10px;
        padding: 12px;
    }

    .activity-avatar {
        flex-basis: 40px;
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 320px) {
    .activity-stat-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .activity-hero h1 {
        font-size: 2rem;
    }

    .activity-card {
        grid-template-columns: 42px minmax(0, 1fr);
    }

    .activity-badge-link {
        width: 42px;
        height: 42px;
    }

    .badge-img {
        width: 36px;
        height: 36px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .activity-card,
    .activity-refresh-overlay {
        transition: none;
    }

    .activity-spinner {
        animation-duration: 1.4s;
    }
}
