/* --- Spectate List --- */
.spectate-entry { display: flex; align-items: center; gap: 1rem; padding: 0.75rem 1rem; border-radius: 0.5rem; border: 1px solid var(--panel-border); background: rgba(255, 255, 255, 0.03); animation: list-item-fade-in 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards; opacity: 0; transition: background-color 0.2s ease-out; }
.spectate-entry:hover { background-color: rgba(0, 229, 255, 0.1); }
.spectate-watch-btn.animate-pulse { animation: pulse-glow 2s infinite; }
@media (max-width: 639px) {
    .spectate-watch-btn { display: none; }
    .spectate-entry { cursor: pointer; }
}

/* --- Achievements List --- */
.achievement-item { display: flex; align-items: center; gap: 1rem; padding: 1rem; border-radius: 0.5rem; border: 1px solid var(--panel-border); background: rgba(255, 255, 255, 0.03); animation: list-item-fade-in 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards; opacity: 0; transition: all 0.3s ease-out; }
.achievement-item .icon { font-size: 2.5rem; flex-shrink: 0; }
.achievement-item .title { font-weight: 700; font-size: 1.125rem; color: var(--text-light); }
.achievement-item .desc { font-size: 0.875rem; color: var(--text-dark); }
.achievement-item.unlocked {
    border-color: var(--price-green);
    background: radial-gradient(ellipse at top left, rgba(26, 247, 175, 0.1), transparent 60%);
}
.achievement-item.locked {
    filter: grayscale(1);
    opacity: 0.6;
}
.achievement-item.locked:hover { filter: grayscale(0.8); opacity: 0.8; background-color: rgba(255, 255, 255, 0.05); }

/* --- Friends List --- */
.friend-entry, .friend-request-entry { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem; border-radius: 0.375rem; background: rgba(255, 255, 255, 0.03); transition: background-color 0.2s ease-out; }
.friend-entry:hover { background: rgba(255, 255, 255, 0.07); }
.friend-name { font-weight: 700; flex-grow: 1; font-size: 0.95rem; line-height: 1.25; }
.friend-name { word-break: break-word; hyphens: auto; white-space: normal; display: block; }
.friend-name.clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
    max-height: calc(1.2em * 2);
}
.friend-name.clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
    max-height: calc(1.2em * 3);
}

/* Allow expanding a long name to show fully on tap */
.friend-name.expanded {
    display: block;
    -webkit-line-clamp: unset;
    -webkit-box-orient: unset;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    max-height: none;
}
.online-status-indicator { width: 10px; height: 10px; border-radius: 50%; background-color: var(--text-dark); transition: all 0.3s ease; }
.online-status-indicator.online {
    background-color: var(--price-green);
    box-shadow: 0 0 8px var(--price-green);
}
.friends-tab {
    flex-grow: 1;
    padding: 0.75rem;
    text-align: center;
    background: transparent;
    color: var(--text-dark);
    font-weight: 700;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease-out;
}
.friends-tab.active {
    color: var(--accent-cyan);
    border-bottom-color: var(--accent-cyan);
}
.icon-android-glow { filter: drop-shadow(0 0 3px var(--price-green)); }
.friend-action-btn { position: relative; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 9999px; cursor: pointer; transition: all 0.2s ease-out; }
.friend-action-btn.remove { color: var(--text-dark); }
.friend-action-btn.remove:hover { background-color: rgba(247, 58, 142, 0.15); color: var(--price-red); transform: scale(1.1); }
.friend-action-btn.invite { color: var(--text-dark); }
.friend-action-btn.invite:hover:not(:disabled) { background-color: rgba(0, 229, 255, 0.15); color: var(--accent-cyan); transform: scale(1.1); }
.friend-action-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: scale(1); background-color: transparent; }
.friend-action-btn .tooltip {
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--bg-color);
    color: var(--text-light);
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 700;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease-out, visibility 0.2s ease-out;
    pointer-events: none;
    z-index: 10;
    border: 1px solid var(--panel-border);
}

@media (max-width: 639px) {
    #achievements-screen .menu-panel {
        display: flex;
        flex-direction: column;
        max-height: 85vh;
        padding: 1rem;
    }
    #achievements-screen .menu-panel > h2,
    #achievements-screen .menu-panel > div:last-child {
        flex-shrink: 0;
    }
    #achievements-list {
        flex-grow: 1;
        min-height: 0;
        max-height: none;
        gap: 0.5rem;
    }
    .achievement-item {
        padding: 0.75rem;
        gap: 0.75rem;
    }
    .achievement-item .icon { font-size: 2rem; }
    .achievement-item .title { font-size: 1rem; line-height: 1.5rem; }
    .achievement-item .desc { font-size: 0.75rem; line-height: 1rem; }
}

/* Move the level chip under the name on small screens to give long names more room */
@media (max-width: 480px) {
  .friend-header-row { flex-direction: column; align-items: flex-start; gap: 0.25rem; }
  .friend-header-row .level-chip { margin-left: 0 !important; }
}
